Skip to content

Commit 10ce930

Browse files
committed
Plugin Check review
1 parent f935b35 commit 10ce930

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

includes/MslsPlugin.php

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,17 @@ public static function init() {
8787
add_action(
8888
'admin_notices',
8989
function () {
90-
$href = 'https://wordpress.org/support/article/create-a-network/';
91-
$msg = sprintf(
92-
__(
93-
'The Multisite Language Switcher needs the activation of the multisite-feature for working properly. Please read <a onclick="window.open(this.href); return false;" href="%s">this post</a> if you don\'t know the meaning.',
94-
'multisite-language-switcher'
95-
),
96-
$href
90+
/* translators: %s: URL to the WordPress Codex. */
91+
$format = __(
92+
'The Multisite Language Switcher needs the activation of the multisite-feature for working properly. Please read <a onclick="window.open(this.href); return false;" href="%s">this post</a> if you don\'t know the meaning.',
93+
'multisite-language-switcher'
94+
);
95+
$message = sprintf(
96+
$format,
97+
esc_url( 'https://developer.wordpress.org/advanced-administration/multisite/create-network/' )
9798
);
9899

99-
self::message_handler( $msg );
100+
self::message_handler( $message );
100101
}
101102
);
102103
}
@@ -150,8 +151,10 @@ public function content_filter( string $content ) {
150151
* @return string
151152
*/
152153
public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
153-
$obj = MslsOutput::init();
154-
$links = $obj->get( 1, true, true );
154+
$obj = MslsOutput::init();
155+
$links = $obj->get( 1, true, true );
156+
157+
/* translators: %s: list of languages */
155158
$output = __( 'This post is also available in %s.', 'multisite-language-switcher' );
156159

157160
if ( has_filter( 'msls_filter_string' ) ) {
@@ -164,25 +167,25 @@ public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
164167
* @since 1.0
165168
*/
166169
$output = apply_filters( 'msls_filter_string', $output, $links );
167-
} else {
168-
$output = '';
170+
} elseif ( count( $links ) > 1 ) {
171+
$last = array_pop( $links );
172+
173+
/* translators: %1$s: list of languages separated by a comma, %2$s: last language */
174+
$format = __( '%1$s and %2$s', 'multisite-language-switcher' );
169175

170-
if ( count( $links ) > 1 ) {
171-
$last = array_pop( $links );
172176
$output = sprintf(
173177
$output,
174178
sprintf(
175-
__( '%1$s and %2$s', 'multisite-language-switcher' ),
179+
$format,
176180
implode( ', ', $links ),
177181
$last
178182
)
179183
);
180-
} elseif ( 1 == count( $links ) ) {
181-
$output = sprintf(
182-
$output,
183-
$links[0]
184-
);
185-
}
184+
} elseif ( 1 == count( $links ) ) {
185+
$output = sprintf(
186+
$output,
187+
$links[0]
188+
);
186189
}
187190

188191
return ! empty( $output ) ? $pref . $output . $post : '';

0 commit comments

Comments
 (0)