From 436b87c80481ed92d7cca0e299c1b998bbeac8aa Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Tue, 4 Jun 2024 13:12:42 +0200 Subject: [PATCH 1/3] .distignore updated --- .distignore | 12 +++++++++--- tests/phpunit/TestMslsMetaBox.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.distignore b/.distignore index 91ef6d1b..2dd89892 100644 --- a/.distignore +++ b/.distignore @@ -4,19 +4,25 @@ /bin /build /docs +/githooks /legacy-tests /node_modules +/src /tests .distignore .gitattributes .gitignore .scrutinizer.yml Changelog.md +README.md composer.json composer.lock -package.json package-lock.json +package.json +patchwork.json +phpcs.xml phpdoc.xml +phpstan.neon phpunit.xml -README.md -setup.sh +playwright.config.ts +setup.sh \ No newline at end of file diff --git a/tests/phpunit/TestMslsMetaBox.php b/tests/phpunit/TestMslsMetaBox.php index 56a45524..1e1576ef 100644 --- a/tests/phpunit/TestMslsMetaBox.php +++ b/tests/phpunit/TestMslsMetaBox.php @@ -18,7 +18,7 @@ protected function setUp(): void { } public function test_suggest(): void { - $json = json_encode( array( 'some' => 'JSON' ) ); + $json = '{"some":"JSON"}'; Functions\when( 'wp_die' )->justEcho( $json ); From f935b3529fb8b2c3c849b10a8bc51bab9ced4a19 Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Tue, 4 Jun 2024 13:58:40 +0200 Subject: [PATCH 2/3] Plugin Check review --- includes/MslsAdmin.php | 24 ++++++++++++------------ includes/MslsMetaBox.php | 7 ------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/includes/MslsAdmin.php b/includes/MslsAdmin.php index 74faa0ac..df0700e9 100644 --- a/includes/MslsAdmin.php +++ b/includes/MslsAdmin.php @@ -137,21 +137,21 @@ public function has_problems(): bool { $message = ''; if ( $this->options->is_empty() ) { - $message = sprintf( - __( - 'Multisite Language Switcher is almost ready. You must complete the configuration process.', - 'multisite-language-switcher' - ), - esc_url( admin_url( $this->get_options_page_link() ) ) + /* translators: %s: URL to the options page */ + $format = __( + 'Multisite Language Switcher is almost ready. You must complete the configuration process.', + 'multisite-language-switcher' ); + $message = sprintf( $format, esc_url( admin_url( $this->get_options_page_link() ) ) ); } elseif ( 1 == count( $this->options->get_available_languages() ) ) { + /* translators: %1$s: URL to a page at WordPress.orgs */ + $format = __( + 'TNo language files are currently installed. Learn how to install various languages in WordPress by reading more here.', + 'multisite-language-switcher' + ); $message = sprintf( - __( - 'There are no language files installed. You can manually install some language files or you could use a plugin to download these files automatically.', - 'multisite-language-switcher' - ), - esc_url( 'http://codex.wordpress.org/Installing_WordPress_in_Your_Language#Manually_Installing_Language_Files' ), - esc_url( 'http://wordpress.org/plugins/wp-native-dashboard/' ) + $format, + esc_url( 'https://developer.wordpress.org/advanced-administration/before-install/in-your-language/#Manually_Installing_Language_Files' ) ); } diff --git a/includes/MslsMetaBox.php b/includes/MslsMetaBox.php index d5c9f41a..c1844d61 100644 --- a/includes/MslsMetaBox.php +++ b/includes/MslsMetaBox.php @@ -1,12 +1,5 @@ - * @since 0.9.8 - */ - namespace lloc\Msls; use lloc\Msls\ContentImport\MetaBox as ContentImportMetaBox; From 10ce9306cb7ee04e226ee55a373746bf023a31f7 Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Tue, 4 Jun 2024 15:15:58 +0200 Subject: [PATCH 3/3] Plugin Check review --- includes/MslsPlugin.php | 45 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/includes/MslsPlugin.php b/includes/MslsPlugin.php index d84e7223..c5366ae8 100644 --- a/includes/MslsPlugin.php +++ b/includes/MslsPlugin.php @@ -87,16 +87,17 @@ public static function init() { add_action( 'admin_notices', function () { - $href = 'https://wordpress.org/support/article/create-a-network/'; - $msg = sprintf( - __( - 'The Multisite Language Switcher needs the activation of the multisite-feature for working properly. Please read this post if you don\'t know the meaning.', - 'multisite-language-switcher' - ), - $href + /* translators: %s: URL to the WordPress Codex. */ + $format = __( + 'The Multisite Language Switcher needs the activation of the multisite-feature for working properly. Please read this post if you don\'t know the meaning.', + 'multisite-language-switcher' + ); + $message = sprintf( + $format, + esc_url( 'https://developer.wordpress.org/advanced-administration/multisite/create-network/' ) ); - self::message_handler( $msg ); + self::message_handler( $message ); } ); } @@ -150,8 +151,10 @@ public function content_filter( string $content ) { * @return string */ public function filter_string( $pref = '

', $post = '

' ) { - $obj = MslsOutput::init(); - $links = $obj->get( 1, true, true ); + $obj = MslsOutput::init(); + $links = $obj->get( 1, true, true ); + + /* translators: %s: list of languages */ $output = __( 'This post is also available in %s.', 'multisite-language-switcher' ); if ( has_filter( 'msls_filter_string' ) ) { @@ -164,25 +167,25 @@ public function filter_string( $pref = '

', $post = '

' ) { * @since 1.0 */ $output = apply_filters( 'msls_filter_string', $output, $links ); - } else { - $output = ''; + } elseif ( count( $links ) > 1 ) { + $last = array_pop( $links ); + + /* translators: %1$s: list of languages separated by a comma, %2$s: last language */ + $format = __( '%1$s and %2$s', 'multisite-language-switcher' ); - if ( count( $links ) > 1 ) { - $last = array_pop( $links ); $output = sprintf( $output, sprintf( - __( '%1$s and %2$s', 'multisite-language-switcher' ), + $format, implode( ', ', $links ), $last ) ); - } elseif ( 1 == count( $links ) ) { - $output = sprintf( - $output, - $links[0] - ); - } + } elseif ( 1 == count( $links ) ) { + $output = sprintf( + $output, + $links[0] + ); } return ! empty( $output ) ? $pref . $output . $post : '';