Skip to content

Commit 9526836

Browse files
authored
Merge branch 'master' into dependabot/composer/composer/installers-approx-2.3.0
2 parents 549ca9f + 433c087 commit 9526836

17 files changed

+280
-83
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.8.2
2+
3+
- Bugfix: Content filter
4+
15
## 2.8.1
26

37
- Bugfix: Category link

MultisiteLanguageSwitcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @wordpress-plugin
88
*
99
* Plugin Name: Multisite Language Switcher
10-
* Version: 2.8.1
10+
* Version: 2.8.2
1111
* Plugin URI: http://msls.co/
1212
* Description: A simple but powerful plugin that will help you to manage the relations of your contents in a multilingual multisite-installation.
1313
* Author: Dennis Ploetner
@@ -40,7 +40,7 @@
4040
* @author Dennis Ploetner <re@lloc.de>
4141
*/
4242
if ( ! defined( 'MSLS_PLUGIN_VERSION' ) ) {
43-
define( 'MSLS_PLUGIN_VERSION', '2.8.1' );
43+
define( 'MSLS_PLUGIN_VERSION', '2.8.2' );
4444
define( 'MSLS_PLUGIN_PATH', plugin_basename( __FILE__ ) );
4545
define( 'MSLS_PLUGIN__FILE__', __FILE__ );
4646

build/translations.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

css/flags.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,32 @@
3131
'cs_CZ' => 'flag-icon-cz',
3232
'cy' => 'flag-icon-gb-ls',
3333
'da_DK' => 'flag-icon-dk',
34-
'de_CH' => 'flag-icon-ch',
3534
'de_AT' => 'flag-icon-at',
35+
'de_DE' => 'flag-icon-de',
3636
'de_DE_formal' => 'flag-icon-de',
37+
'de_CH' => 'flag-icon-ch',
3738
'de_CH_informal' => 'flag-icon-ch',
38-
'de_DE' => 'flag-icon-de',
3939
'dzo' => 'flag-icon-bt',
4040
'el' => 'flag-icon-gr',
41+
'en_CA' => 'flag-icon-ca',
4142
'en_ZA' => 'flag-icon-za',
42-
'en_AU' => 'flag-icon-au',
4343
'en_GB' => 'flag-icon-gb',
44+
'en_AU' => 'flag-icon-au',
4445
'en_NZ' => 'flag-icon-nz',
45-
'en_CA' => 'flag-icon-ca',
4646
'eo' => 'flag-icon-eu',
47-
'es_AR' => 'flag-icon-ar',
47+
'es_CL' => 'flag-icon-cl',
4848
'es_ES' => 'flag-icon-es',
4949
'es_MX' => 'flag-icon-mx',
50-
'es_CO' => 'flag-icon-co',
51-
'es_VE' => 'flag-icon-ve',
5250
'es_CR' => 'flag-icon-cr',
51+
'es_VE' => 'flag-icon-ve',
5352
'es_EC' => 'flag-icon-ec',
5453
'es_DO' => 'flag-icon-do',
5554
'es_PE' => 'flag-icon-pe',
5655
'es_UY' => 'flag-icon-uy',
5756
'es_PR' => 'flag-icon-pr',
5857
'es_GT' => 'flag-icon-gt',
59-
'es_CL' => 'flag-icon-cl',
58+
'es_CO' => 'flag-icon-co',
59+
'es_AR' => 'flag-icon-ar',
6060
'et' => 'flag-icon-ee',
6161
'eu' => 'flag-icon-es',
6262
'fa_AF' => 'flag-icon-af',
@@ -97,16 +97,16 @@
9797
'my_MM' => 'flag-icon-mm',
9898
'nb_NO' => 'flag-icon-no',
9999
'ne_NP' => 'flag-icon-np',
100-
'nl_NL_formal' => 'flag-icon-nl',
101100
'nl_BE' => 'flag-icon-be',
101+
'nl_NL_formal' => 'flag-icon-nl',
102102
'nl_NL' => 'flag-icon-nl',
103103
'nn_NO' => 'flag-icon-no',
104104
'oci' => 'flag-icon-es-ca',
105105
'pa_IN' => 'flag-icon-in',
106106
'pl_PL' => 'flag-icon-pl',
107107
'ps' => 'flag-icon-af',
108-
'pt_PT' => 'flag-icon-pt',
109108
'pt_BR' => 'flag-icon-br',
109+
'pt_PT' => 'flag-icon-pt',
110110
'pt_PT_ao90' => 'flag-icon-90',
111111
'pt_AO' => 'flag-icon-ao',
112112
'ro_RO' => 'flag-icon-ro',
@@ -133,9 +133,9 @@
133133
'ur' => 'flag-icon-pk',
134134
'uz_UZ' => 'flag-icon-uz',
135135
'vi' => 'flag-icon-vn',
136+
'zh_TW' => 'flag-icon-tw',
136137
'zh_CN' => 'flag-icon-cn',
137138
'zh_HK' => 'flag-icon-hk',
138-
'zh_TW' => 'flag-icon-tw',
139139
);
140140

141141
/**

flags/flags.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,32 @@
3131
'cs_CZ' => 'cz.png',
3232
'cy' => 'wales.png',
3333
'da_DK' => 'dk.png',
34-
'de_CH' => 'ch.png',
3534
'de_AT' => 'at.png',
35+
'de_DE' => 'de.png',
3636
'de_DE_formal' => 'de.png',
37+
'de_CH' => 'ch.png',
3738
'de_CH_informal' => 'ch.png',
38-
'de_DE' => 'de.png',
3939
'dzo' => 'bt.png',
4040
'el' => 'gr.png',
41+
'en_CA' => 'ca.png',
4142
'en_ZA' => 'za.png',
42-
'en_AU' => 'au.png',
4343
'en_GB' => 'gb.png',
44+
'en_AU' => 'au.png',
4445
'en_NZ' => 'nz.png',
45-
'en_CA' => 'ca.png',
4646
'eo' => 'europeanunion.png',
47-
'es_AR' => 'ar.png',
47+
'es_CL' => 'cl.png',
4848
'es_ES' => 'es.png',
4949
'es_MX' => 'mx.png',
50-
'es_CO' => 'co.png',
51-
'es_VE' => 've.png',
5250
'es_CR' => 'cr.png',
51+
'es_VE' => 've.png',
5352
'es_EC' => 'ec.png',
5453
'es_DO' => 'do.png',
5554
'es_PE' => 'pe.png',
5655
'es_UY' => 'uy.png',
5756
'es_PR' => 'pr.png',
5857
'es_GT' => 'gt.png',
59-
'es_CL' => 'cl.png',
58+
'es_CO' => 'co.png',
59+
'es_AR' => 'ar.png',
6060
'et' => 'ee.png',
6161
'eu' => 'es.png',
6262
'fa_AF' => 'af.png',
@@ -97,16 +97,16 @@
9797
'my_MM' => 'mm.png',
9898
'nb_NO' => 'no.png',
9999
'ne_NP' => 'np.png',
100-
'nl_NL_formal' => 'nl.png',
101100
'nl_BE' => 'be.png',
101+
'nl_NL_formal' => 'nl.png',
102102
'nl_NL' => 'nl.png',
103103
'nn_NO' => 'no.png',
104104
'oci' => 'catalonia.png',
105105
'pa_IN' => 'in.png',
106106
'pl_PL' => 'pl.png',
107107
'ps' => 'af.png',
108-
'pt_PT' => 'pt.png',
109108
'pt_BR' => 'br.png',
109+
'pt_PT' => 'pt.png',
110110
'pt_PT_ao90' => '90.png',
111111
'pt_AO' => 'ao.png',
112112
'ro_RO' => 'ro.png',
@@ -133,9 +133,9 @@
133133
'ur' => 'pk.png',
134134
'uz_UZ' => 'uz.png',
135135
'vi' => 'vn.png',
136+
'zh_TW' => 'tw.png',
136137
'zh_CN' => 'cn.png',
137138
'zh_HK' => 'hk.png',
138-
'zh_TW' => 'tw.png',
139139
);
140140

141141
/**

includes/MslsAdmin.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,13 @@ public function render(): void {
172172
settings_fields( 'msls' );
173173
do_settings_sections( __CLASS__ );
174174

175+
$value = $this->options->is_empty() ?
176+
__( 'Configure', 'multisite-language-switcher' ) :
177+
__( 'Update', 'multisite-language-switcher' );
178+
175179
printf(
176180
'<p class="submit"><input name="Submit" type="submit" class="button button-primary" value="%s" /></p></form></div>',
177-
( $this->options->is_empty() ? __( 'Configure', 'multisite-language-switcher' ) : __(
178-
'Update',
179-
'multisite-language-switcher'
180-
) )
181+
esc_html( $value )
181182
);
182183
}
183184

includes/MslsContentFilter.php

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public function content_filter( string $content ) {
4343
* @return string
4444
*/
4545
public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
46-
$obj = MslsOutput::init();
47-
$links = $obj->get( 1, true, true );
46+
$links_arr = MslsOutput::init()->get( 1, true, true );
47+
$links_str = $this->format_available_languages( $links_arr );
4848

4949
/* translators: %s: list of languages */
50-
$output = __( 'This post is also available in %s.', 'multisite-language-switcher' );
50+
$format = __( 'This post is also available in %s.', 'multisite-language-switcher' );
5151

5252
if ( has_filter( 'msls_filter_string' ) ) {
5353
/**
@@ -58,18 +58,28 @@ public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
5858
*
5959
* @since 1.0
6060
*/
61-
$output = apply_filters( 'msls_filter_string', $output, $links );
62-
} elseif ( count( $links ) > 1 ) {
63-
$last = array_pop( $links );
61+
$output = apply_filters( 'msls_filter_string', $format, $links_arr );
62+
} elseif ( $links_str ) {
63+
$output = sprintf( $format, $links_str );
64+
}
6465

65-
/* translators: %1$s: list of languages separated by a comma, %2$s: last language */
66-
$format = __( '%1$s and %2$s', 'multisite-language-switcher' );
66+
return ! empty( $output ) ? $pref . $output . $post : '';
67+
}
6768

68-
$output = sprintf( $output, sprintf( $format, implode( ', ', $links ), $last ) );
69-
} elseif ( 1 == count( $links ) ) {
70-
$output = sprintf( $output, $links[0] );
69+
public function format_available_languages( array $links ): ?string {
70+
if ( empty( $links ) ) {
71+
return null;
7172
}
7273

73-
return ! empty( $output ) ? $pref . $output . $post : '';
74+
if ( 1 == count( $links ) ) {
75+
return $links[0];
76+
}
77+
78+
$last = array_pop( $links );
79+
80+
/* translators: %1$s: list of languages separated by a comma, %2$s: last language */
81+
$format = __( '%1$s and %2$s', 'multisite-language-switcher' );
82+
83+
return sprintf( $format, implode( ', ', $links ), $last );
7484
}
7585
}

includes/MslsCustomColumn.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ public function td( $column_name, $item_id ) {
100100
$icon->set_href( (int) $mydata->$language );
101101
}
102102

103-
echo '<span class="msls-icon-wrapper ' . esc_attr( $this->options->admin_display ) . '">';
104-
echo $icon->get_a();
105-
echo '</span>';
103+
printf(
104+
'<span class="msls-icon-wrapper %1$s">%2$s</span>',
105+
esc_attr( $this->options->admin_display ),
106+
$icon->get_a()
107+
);
106108

107109
restore_current_blog();
108110
}

includes/MslsCustomColumnTaxonomy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function column_default( $deprecated, $column_name, $item_id ) {
5353
*
5454
* @param int $object_id
5555
*/
56-
public function delete( $object_id ) {
56+
public function delete( $object_id ): void {
5757
$this->save( $object_id, MslsOptionsTax::class );
5858
}
5959
}

includes/MslsMain.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function get_input_value( $key, $value ) {
113113
*
114114
* @return bool
115115
*/
116-
public function is_autosave( $post_id ) {
116+
public function is_autosave( $post_id ): bool {
117117
return ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || wp_is_post_revision( $post_id );
118118
}
119119

@@ -122,11 +122,8 @@ public function is_autosave( $post_id ) {
122122
*
123123
* @return boolean
124124
*/
125-
public function verify_nonce() {
126-
return (
127-
MslsRequest::has_var( MslsFields::FIELD_MSLS_NONCENAME ) &&
128-
wp_verify_nonce( MslsRequest::get_var( MslsFields::FIELD_MSLS_NONCENAME ), MslsPlugin::path() )
129-
);
125+
public function verify_nonce(): bool {
126+
return MslsRequest::has_var( MslsFields::FIELD_MSLS_NONCENAME ) && wp_verify_nonce( MslsRequest::get_var( MslsFields::FIELD_MSLS_NONCENAME ), MslsPlugin::path() );
130127
}
131128

132129
/**
@@ -136,7 +133,7 @@ public function verify_nonce() {
136133
*
137134
* @codeCoverageIgnore
138135
*/
139-
public function delete( $object_id ) {
136+
public function delete( $object_id ): void {
140137
$this->save( $object_id, MslsOptionsPost::class );
141138
}
142139

@@ -148,7 +145,7 @@ public function delete( $object_id ) {
148145
*
149146
* @codeCoverageIgnore
150147
*/
151-
protected function save( $object_id, $class ) {
148+
protected function save( $object_id, $class ): void {
152149
if ( has_action( 'msls_main_save' ) ) {
153150
/**
154151
* Calls completely customized save-routine

0 commit comments

Comments
 (0)