From 6641962c263c52d41b71a308ff488d833f92950d Mon Sep 17 00:00:00 2001 From: Atanas Angelov Date: Sun, 28 Oct 2018 20:16:45 +0200 Subject: [PATCH] Fix lint rule violations --- app/Providers/AppServiceProvider.php | 1 + app/bootstrap-compat.php | 4 +- app/functions-setup.php | 28 +++++----- app/functions-template.php | 2 +- resources/scss/blocks/core/_file.scss | 12 ++--- resources/scss/blocks/core/_gallery.scss | 54 ++++++++----------- resources/scss/blocks/core/_image.scss | 2 - resources/scss/utilities/_alignment.scss | 10 ++-- resources/scss/utilities/_media.scss | 2 +- resources/views/comment/default.php | 4 +- resources/views/comment/ping.php | 2 +- resources/views/comments/default.php | 2 +- resources/views/content/404.php | 4 +- .../views/entry/single/attachment-audio.php | 22 ++++---- .../views/entry/single/attachment-image.php | 28 +++++----- .../views/entry/single/attachment-video.php | 14 ++--- resources/views/footer/default.php | 4 +- resources/views/header/default.php | 2 +- resources/views/nav/pagination/comments.php | 6 +-- resources/views/nav/pagination/post.php | 2 +- resources/views/nav/pagination/posts.php | 6 +-- 21 files changed, 101 insertions(+), 110 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 6164a4c..5f7be5d 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -44,6 +44,7 @@ public function register() { $file = get_theme_file_path( 'dist/mix-manifest.json' ); + // @codingStandardsIgnoreLine WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents return file_exists( $file ) ? json_decode( file_get_contents( $file ), true ) : null; } ); } diff --git a/app/bootstrap-compat.php b/app/bootstrap-compat.php index 6c3d16f..e217252 100644 --- a/app/bootstrap-compat.php +++ b/app/bootstrap-compat.php @@ -34,7 +34,7 @@ function mythic_compat_message() { return sprintf( // Translators: 1 is the required WordPress version and 2 is the user's current version. - __( 'Mythic requires at least WordPress version %1$s. You are running version %2$s. Please upgrade and try again.' ), + __( 'Mythic requires at least WordPress version %1$s. You are running version %2$s. Please upgrade and try again.', 'mythic' ), '4.9.6', $GLOBALS['wp_version'] ); @@ -43,7 +43,7 @@ function mythic_compat_message() { return sprintf( // Translators: 1 is the required PHP version and 2 is the user's current version. - __( 'Mythic requires at least PHP version %1$s. You are running version %2$s. Please upgrade and try again.' ), + __( 'Mythic requires at least PHP version %1$s. You are running version %2$s. Please upgrade and try again.', 'mythic' ), '5.6', PHP_VERSION ); diff --git a/app/functions-setup.php b/app/functions-setup.php index d4f35c4..82943fc 100644 --- a/app/functions-setup.php +++ b/app/functions-setup.php @@ -77,22 +77,22 @@ // `resources/scss/settings/_colors.scss` file. add_theme_support( 'editor-color-palette', [ [ - 'name' => __( 'Charcoal' ), + 'name' => __( 'Charcoal', 'mythic' ), 'slug' => 'charcoal', 'color' => '#282c34' ], [ - 'name' => __( 'Regent' ), + 'name' => __( 'Regent', 'mythic' ), 'slug' => 'regent', 'color' => '#8c97a7', ], [ - 'name' => __( 'Husk' ), + 'name' => __( 'Husk', 'mythic' ), 'slug' => 'husk', 'color' => '#B9A364', ], [ - 'name' => __( 'Red Stage' ), + 'name' => __( 'Red Stage', 'mythic' ), 'slug' => 'red-stage', 'color' => '#b15330', ] @@ -102,26 +102,26 @@ // `resources/scss/settings/_fonts.scss` file. add_theme_support( 'editor-font-sizes', [ [ - 'name' => __( 'Small' ), - 'shortName' => __( 'S' ), + 'name' => __( 'Small', 'mythic' ), + 'shortName' => __( 'S', 'mythic' ), 'size' => 12, 'slug' => 'small' ], [ - 'name' => __( 'Regular' ), - 'shortName' => __( 'M' ), + 'name' => __( 'Regular', 'mythic' ), + 'shortName' => __( 'M', 'mythic' ), 'size' => 16, 'slug' => 'regular' ], [ - 'name' => __( 'Large' ), - 'shortName' => __( 'L' ), + 'name' => __( 'Large', 'mythic' ), + 'shortName' => __( 'L', 'mythic' ), 'size' => 36, 'slug' => 'large' ], [ - 'name' => __( 'Larger' ), - 'shortName' => __( 'XL' ), + 'name' => __( 'Larger', 'mythic' ), + 'shortName' => __( 'XL', 'mythic' ), 'size' => 48, 'slug' => 'larger' ] @@ -201,7 +201,7 @@ add_action( 'init', function() { register_nav_menus( [ - 'primary' => esc_html_x( 'Primary', 'nav menu location' ) + 'primary' => esc_html_x( 'Primary', 'nav menu location', 'mythic' ) ] ); }, 5 ); @@ -248,7 +248,7 @@ register_sidebar( [ 'id' => 'primary', - 'name' => esc_html_x( 'Primary', 'sidebar' ) + 'name' => esc_html_x( 'Primary', 'sidebar', 'mythic' ) ] + $args ); }, 5 ); diff --git a/app/functions-template.php b/app/functions-template.php index 93add44..3b46440 100644 --- a/app/functions-template.php +++ b/app/functions-template.php @@ -28,7 +28,7 @@ function sep( $sep = '' ) { 'mythic/sep', sprintf( ' %s ', - $sep ?: esc_html_x( '·', 'meta separator' ) + $sep ?: esc_html_x( '·', 'meta separator', 'mythic' ) ) ); } diff --git a/resources/scss/blocks/core/_file.scss b/resources/scss/blocks/core/_file.scss index df05deb..05f94f2 100644 --- a/resources/scss/blocks/core/_file.scss +++ b/resources/scss/blocks/core/_file.scss @@ -23,6 +23,12 @@ padding: 0.5em 1em; text-decoration: none; + // Give the file block button some spacing to the left if there's + // another element preceding it. + * + & { + margin-left: 0.75em; + } + &:hover, &:visited, &:focus, @@ -33,9 +39,3 @@ } } } - -// Give the file block button some spacing to the left if there's another element -// preceding it. -* + .wp-block-file__button { - margin-left: 0.75em; -} diff --git a/resources/scss/blocks/core/_gallery.scss b/resources/scss/blocks/core/_gallery.scss index 55fe33a..9cca234 100644 --- a/resources/scss/blocks/core/_gallery.scss +++ b/resources/scss/blocks/core/_gallery.scss @@ -23,6 +23,13 @@ flex-direction: column; justify-content: center; position: relative; + // Fallback to 2 columns. + width: calc( 100% / 2 - 16px ); + + // 1 column. + .columns-1 & { + width: calc( 100% / 1 - 16px ); + } // Image figure. figure { @@ -30,7 +37,7 @@ height: 100%; // IE11 doesn't support flex and can't read this. - @supports( position: sticky ) { + @supports ( position: sticky ) { display: flex; align-items: flex-end; justify-content: flex-start; @@ -46,7 +53,7 @@ width: 100%; // IE11 can't read this. - @supports( position: sticky ) { + @supports ( position: sticky ) { width: auto; } } @@ -59,45 +66,30 @@ padding: 40px 10px 5px; text-align: center; color: color( white ); - background: linear-gradient( - 0deg, - rgba( color( black ), 0.7 ) 0, - rgba( color( black ), 0.3 ) 60%, - transparent - ); + background: linear-gradient( 0deg, rgba( color( black ), 0.7 ) 0, rgba( color( black ), 0.3 ) 60%, transparent ); img { display: inline; } } -} - -// Cropped images. -.is-cropped .blocks-gallery-item { - a, - img { - flex: 1; - width: 100%; - // IE11 doesn't support object-fit. - @supports( position: sticky ) { - flex: 1; - height: 100%; - object-fit: cover; + // Cropped images. + .is-cropped & { + a, + img { + flex: 1; + width: 100%; + + // IE11 doesn't support object-fit. + @supports ( position: sticky ) { + flex: 1; + height: 100%; + object-fit: cover; + } } } } -// Fallback to 2 columns. -.blocks-gallery-item { - width: calc( 100% / 2 - 16px ); -} - -// 1 column. -.columns-1 .blocks-gallery-item { - width: calc( 100% / 1 - 16px ); -} - // 3-8 columns on larger screens. @media ( min-width: break( small ) ) { diff --git a/resources/scss/blocks/core/_image.scss b/resources/scss/blocks/core/_image.scss index f7fc638..c0fba8a 100644 --- a/resources/scss/blocks/core/_image.scss +++ b/resources/scss/blocks/core/_image.scss @@ -29,6 +29,4 @@ max-width: none; } } - - figcaption {} } diff --git a/resources/scss/utilities/_alignment.scss b/resources/scss/utilities/_alignment.scss index 5c110e9..2687b98 100644 --- a/resources/scss/utilities/_alignment.scss +++ b/resources/scss/utilities/_alignment.scss @@ -11,7 +11,7 @@ // Left alignment. .alignleft { - @media( min-width: content-width() / 2 ) { + @media ( min-width: content-width() / 2 ) { float: left; margin: 0 1.5rem 1.5rem 0; max-width: 50%; @@ -20,7 +20,7 @@ // Right alignment. .alignright { - @media( min-width: content-width() / 2 ) { + @media ( min-width: content-width() / 2 ) { float: left; margin: 0 0 1.5rem 1.5rem; max-width: 50%; @@ -40,16 +40,16 @@ .alignfull, .alignwide { margin-left : calc( -100vw / 2 + 100% / 2 ); - margin-right : calc( -100vw / 2 + 100% / 2 ); + margin-right : calc( -100vw / 2 + 100% / 2 ); width: auto; max-width: 100vw; } -@media( min-width: content-width() ) { +@media ( min-width: content-width() ) { .alignwide { margin-left : -25%; margin-right : -25%; max-width : calc( #{ content-width() } + 50% ); - } + } } diff --git a/resources/scss/utilities/_media.scss b/resources/scss/utilities/_media.scss index 8b0673e..d3e401d 100644 --- a/resources/scss/utilities/_media.scss +++ b/resources/scss/utilities/_media.scss @@ -14,7 +14,7 @@ img.emoji { display: inline; width: 1em; height: 1em; - margin: 0 .07em; + margin: 0 0.07em; padding: 0; vertical-align: -0.1em; background: none; diff --git a/resources/views/comment/default.php b/resources/views/comment/default.php index 7497442..222e4ef 100644 --- a/resources/views/comment/default.php +++ b/resources/views/comment/default.php @@ -7,7 +7,7 @@ sprintf( // Translators: 1 is the comment date and 2 is the time. - esc_html__( '%1$s at %2$s' ), + esc_html__( '%1$s at %2$s', 'mythic' ), Hybrid\Comment\render_date(), Hybrid\Comment\render_time() ) @@ -21,7 +21,7 @@

- +

diff --git a/resources/views/comment/ping.php b/resources/views/comment/ping.php index 950f685..5cdc70e 100644 --- a/resources/views/comment/ping.php +++ b/resources/views/comment/ping.php @@ -5,7 +5,7 @@ sprintf( // Translators: 1 is the comment date and 2 is the time. - esc_html__( '%1$s at %2$s' ), + esc_html__( '%1$s at %2$s', 'mythic' ), Hybrid\Comment\render_date(), Hybrid\Comment\render_time() ) diff --git a/resources/views/comments/default.php b/resources/views/comments/default.php index 4f45aee..5cc7f07 100644 --- a/resources/views/comments/default.php +++ b/resources/views/comments/default.php @@ -25,7 +25,7 @@

- +

diff --git a/resources/views/content/404.php b/resources/views/content/404.php index 05a5264..035a9e3 100644 --- a/resources/views/content/404.php +++ b/resources/views/content/404.php @@ -4,10 +4,10 @@
-

+

-

+

diff --git a/resources/views/entry/single/attachment-audio.php b/resources/views/entry/single/attachment-audio.php index 22b615a..eb1f9f3 100644 --- a/resources/views/entry/single/attachment-audio.php +++ b/resources/views/entry/single/attachment-audio.php @@ -13,19 +13,19 @@
-

+

    - 'li', 'label' => __( 'Run Time' ) ] ) ?> - 'li', 'label' => __( 'Artist' ) ] ) ?> - 'li', 'label' => __( 'Album' ) ] ) ?> - 'li', 'label' => __( 'Track Number' ) ] ) ?> - 'li', 'label' => __( 'Year' ) ] ) ?> - 'li', 'label' => __( 'Genre' ) ] ) ?> - 'li', 'label' => __( 'Name' ) ] ) ?> - 'li', 'label' => __( 'Mime Type' ) ] ) ?> - 'li', 'label' => __( 'Type' ) ] ) ?> - 'li', 'label' => __( 'Size' ) ] ) ?> + 'li', 'label' => __( 'Run Time', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Artist', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Album', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Track Number', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Year', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Genre', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Name', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Mime Type', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Type', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Size', 'mythic' ) ] ) ?>
diff --git a/resources/views/entry/single/attachment-image.php b/resources/views/entry/single/attachment-image.php index 04bae6f..34467fc 100644 --- a/resources/views/entry/single/attachment-image.php +++ b/resources/views/entry/single/attachment-image.php @@ -6,7 +6,7 @@ @@ -29,7 +29,7 @@ @@ -37,20 +37,20 @@
-

+

    - 'li', 'label' => __( 'Dimensions' ) ] ) ?> - 'li', 'label' => __( 'Date' ) ] ) ?> - 'li', 'label' => __( 'Camera' ) ] ) ?> - 'li', 'label' => __( 'Aperture' ) ] ) ?> - 'li', 'label' => __( 'Focal Length' ) ] ) ?> - 'li', 'label' => __( 'ISO' ) ] ) ?> - 'li', 'label' => __( 'Shutter Speed' ) ] ) ?> - 'li', 'label' => __( 'Name' ) ] ) ?> - 'li', 'label' => __( 'Mime Type' ) ] ) ?> - 'li', 'label' => __( 'Type' ) ] ) ?> - 'li', 'label' => __( 'Size' ) ] ) ?> + 'li', 'label' => __( 'Dimensions', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Date', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Camera', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Aperture', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Focal Length', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'ISO', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Shutter Speed', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Name', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Mime Type', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Type', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Size', 'mythic' ) ] ) ?>
diff --git a/resources/views/entry/single/attachment-video.php b/resources/views/entry/single/attachment-video.php index 9ce5a23..d588fb3 100644 --- a/resources/views/entry/single/attachment-video.php +++ b/resources/views/entry/single/attachment-video.php @@ -13,15 +13,15 @@
-

+

    - 'li', 'label' => __( 'Run Time' ) ] ) ?> - 'li', 'label' => __( 'Dimensions' ) ] ) ?> - 'li', 'label' => __( 'Name' ) ] ) ?> - 'li', 'label' => __( 'Mime Type' ) ] ) ?> - 'li', 'label' => __( 'Type' ) ] ) ?> - 'li', 'label' => __( 'Size' ) ] ) ?> + 'li', 'label' => __( 'Run Time', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Dimensions', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Name', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Mime Type', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Type', 'mythic' ) ] ) ?> + 'li', 'label' => __( 'Size', 'mythic' ) ] ) ?>
diff --git a/resources/views/footer/default.php b/resources/views/footer/default.php index ffdd7fd..d5e03d4 100644 --- a/resources/views/footer/default.php +++ b/resources/views/footer/default.php @@ -1,7 +1,7 @@ -