11<?php
22/**
33 * MslsPlugin
4+ *
45 * @author Dennis Ploetner <re@lloc.de>
56 * @since 0.9.8
67 */
@@ -38,65 +39,72 @@ public function __construct( MslsOptions $options ) {
3839 * @return MslsPlugin
3940 */
4041 public static function init () {
41- $ obj = new self ( msls_options () );
42+ $ obj = new self ( msls_options () );
4243
43- add_action ( 'plugins_loaded ' , [ $ obj , 'init_i18n_support ' ] );
44+ add_action ( 'plugins_loaded ' , array ( $ obj , 'init_i18n_support ' ) );
4445
45- register_activation_hook ( self ::file (), [ $ obj , 'activate ' ] );
46+ register_activation_hook ( self ::file (), array ( $ obj , 'activate ' ) );
4647
4748 if ( function_exists ( 'is_multisite ' ) && is_multisite () ) {
48- add_filter ( 'msls_get_output ' , [ __CLASS__ , 'get_output ' ] );
49+ add_filter ( 'msls_get_output ' , array ( __CLASS__ , 'get_output ' ) );
4950
50- add_action ( 'widgets_init ' , [ $ obj , 'init_widget ' ] );
51- add_filter ( 'the_content ' , [ $ obj , 'content_filter ' ] );
51+ add_action ( 'widgets_init ' , array ( $ obj , 'init_widget ' ) );
52+ add_filter ( 'the_content ' , array ( $ obj , 'content_filter ' ) );
5253
53- add_action ( 'wp_head ' , [ __CLASS__ , 'print_alternate_links ' ] );
54+ add_action ( 'wp_head ' , array ( __CLASS__ , 'print_alternate_links ' ) );
5455
5556 if ( function_exists ( 'register_block_type ' ) ) {
56- add_action ( 'init ' , [ $ obj , 'block_init ' ] );
57+ add_action ( 'init ' , array ( $ obj , 'block_init ' ) );
5758 }
5859
59- add_action ( 'init ' , [ $ obj , 'admin_bar_init ' ] );
60- add_action ( 'admin_enqueue_scripts ' , [ $ obj , 'custom_enqueue ' ] );
61- add_action ( 'wp_enqueue_scripts ' , [ $ obj , 'custom_enqueue ' ] );
60+ add_action ( 'init ' , array ( $ obj , 'admin_bar_init ' ) );
61+ add_action ( 'admin_enqueue_scripts ' , array ( $ obj , 'custom_enqueue ' ) );
62+ add_action ( 'wp_enqueue_scripts ' , array ( $ obj , 'custom_enqueue ' ) );
6263
6364 \lloc \Msls \ContentImport \Service::instance ()->register ();
6465
6566 if ( is_admin () ) {
66- add_action ( 'admin_menu ' , [ MslsAdmin::class, 'init ' ] );
67- add_action ( 'load-post.php ' , [ MslsMetaBox::class, 'init ' ] );
68- add_action ( 'load-post-new.php ' , [ MslsMetaBox::class, 'init ' ] );
69- add_action ( 'load-edit.php ' , [ MslsCustomColumn::class, 'init ' ] );
70- add_action ( 'load-edit.php ' , [ MslsCustomFilter::class, 'init ' ] );
67+ add_action ( 'admin_menu ' , array ( MslsAdmin::class, 'init ' ) );
68+ add_action ( 'load-post.php ' , array ( MslsMetaBox::class, 'init ' ) );
69+ add_action ( 'load-post-new.php ' , array ( MslsMetaBox::class, 'init ' ) );
70+ add_action ( 'load-edit.php ' , array ( MslsCustomColumn::class, 'init ' ) );
71+ add_action ( 'load-edit.php ' , array ( MslsCustomFilter::class, 'init ' ) );
7172
72- add_action ( 'load-edit-tags.php ' , [ MslsCustomColumnTaxonomy::class, 'init ' ] );
73- add_action ( 'load-edit-tags.php ' , [ MslsPostTag::class, 'init ' ] );
74- add_action ( 'load-term.php ' , [ MslsPostTag::class, 'init ' ] );
73+ add_action ( 'load-edit-tags.php ' , array ( MslsCustomColumnTaxonomy::class, 'init ' ) );
74+ add_action ( 'load-edit-tags.php ' , array ( MslsPostTag::class, 'init ' ) );
75+ add_action ( 'load-term.php ' , array ( MslsPostTag::class, 'init ' ) );
7576
7677 if ( filter_has_var ( INPUT_POST , 'action ' ) ) {
7778 $ action = filter_input ( INPUT_POST , 'action ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS );
7879
7980 if ( 'add-tag ' === $ action ) {
80- add_action ( 'admin_init ' , [ MslsPostTag::class, 'init ' ] );
81+ add_action ( 'admin_init ' , array ( MslsPostTag::class, 'init ' ) );
8182 } elseif ( 'inline-save ' === $ action ) {
82- add_action ( 'admin_init ' , [ MslsCustomColumn::class, 'init ' ] );
83+ add_action ( 'admin_init ' , array ( MslsCustomColumn::class, 'init ' ) );
8384 } elseif ( 'inline-save-tax ' === $ action ) {
84- add_action ( 'admin_init ' , [ MslsCustomColumnTaxonomy::class, 'init ' ] );
85+ add_action ( 'admin_init ' , array ( MslsCustomColumnTaxonomy::class, 'init ' ) );
8586 }
8687 }
8788
88- add_action ( 'wp_ajax_suggest_posts ' , [ MslsMetaBox::class, 'suggest ' ] );
89- add_action ( 'wp_ajax_suggest_terms ' , [ MslsPostTag::class, 'suggest ' ] );
89+ add_action ( 'wp_ajax_suggest_posts ' , array ( MslsMetaBox::class, 'suggest ' ) );
90+ add_action ( 'wp_ajax_suggest_terms ' , array ( MslsPostTag::class, 'suggest ' ) );
9091 }
9192 } else {
92- add_action ( 'admin_notices ' , function () {
93- $ href = 'https://wordpress.org/support/article/create-a-network/ ' ;
94- $ msg = sprintf ( __ ( '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. ' ,
95- 'multisite-language-switcher ' ),
96- $ href );
97-
98- self ::message_handler ( $ msg );
99- } );
93+ add_action (
94+ 'admin_notices ' ,
95+ function () {
96+ $ href = 'https://wordpress.org/support/article/create-a-network/ ' ;
97+ $ msg = sprintf (
98+ __ (
99+ '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. ' ,
100+ 'multisite-language-switcher '
101+ ),
102+ $ href
103+ );
104+
105+ self ::message_handler ( $ msg );
106+ }
107+ );
100108 }
101109
102110 return $ obj ;
@@ -129,12 +137,22 @@ public static function update_adminbar( \WP_Admin_Bar $wp_admin_bar ): void {
129137 foreach ( $ blog_collection ->get_plugin_active_blogs () as $ blog ) {
130138 $ title = $ blog ->get_blavatar () . $ blog ->get_title ( $ icon_type );
131139
132- $ wp_admin_bar ->add_node ( [ 'id ' => 'blog- ' . $ blog ->userblog_id , 'title ' => $ title ] );
140+ $ wp_admin_bar ->add_node (
141+ array (
142+ 'id ' => 'blog- ' . $ blog ->userblog_id ,
143+ 'title ' => $ title ,
144+ )
145+ );
133146 }
134147
135148 $ blog = $ blog_collection ->get_current_blog ();
136149 if ( is_object ( $ blog ) && method_exists ( $ blog , 'get_title ' ) ) {
137- $ wp_admin_bar ->add_node ( [ 'id ' => 'site-name ' , 'title ' => $ blog ->get_title ( $ icon_type ) ] );
150+ $ wp_admin_bar ->add_node (
151+ array (
152+ 'id ' => 'site-name ' ,
153+ 'title ' => $ blog ->get_title ( $ icon_type ),
154+ )
155+ );
138156 }
139157 }
140158
@@ -195,7 +213,7 @@ public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
195213 $ output = sprintf (
196214 $ output ,
197215 sprintf (
198- __ ( '%s and %s ' , 'multisite-language-switcher ' ),
216+ __ ( '%1$ s and %2$ s ' , 'multisite-language-switcher ' ),
199217 implode ( ', ' , $ links ),
200218 $ last
201219 )
@@ -213,12 +231,13 @@ public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
213231
214232 /**
215233 * Register block and shortcode.
234+ *
216235 * @return bool
217236 */
218237 public function block_init () {
219238 if ( ! $ this ->options ->is_excluded () ) {
220- register_block_type ( self ::plugin_dir_path ('js/msls-widget-block ' ) );
221- add_shortcode ( 'sc_msls_widget ' , [ $ this , 'block_render ' ] );
239+ register_block_type ( self ::plugin_dir_path ( 'js/msls-widget-block ' ) );
240+ add_shortcode ( 'sc_msls_widget ' , array ( $ this , 'block_render ' ) );
222241
223242 return true ;
224243 }
@@ -231,7 +250,7 @@ public function block_init() {
231250 */
232251 public function admin_bar_init () {
233252 if ( is_admin_bar_showing () && is_super_admin () ) {
234- add_action ( 'admin_bar_menu ' , [ __CLASS__ , 'update_adminbar ' ] , 999 );
253+ add_action ( 'admin_bar_menu ' , array ( __CLASS__ , 'update_adminbar ' ) , 999 );
235254
236255 return true ;
237256 }
@@ -254,14 +273,11 @@ public function custom_enqueue() {
254273 $ ver = defined ( 'MSLS_PLUGIN_VERSION ' ) ? constant ( 'MSLS_PLUGIN_VERSION ' ) : false ;
255274 $ folder = defined ( 'SCRIPT_DEBUG ' ) && constant ( 'SCRIPT_DEBUG ' ) ? 'src ' : 'js ' ;
256275
257- wp_enqueue_style ( 'msls-styles ' , self ::plugins_url ( 'css/msls.css ' ), [] , $ ver );
258- wp_enqueue_style ( 'msls-flags ' , self ::plugins_url ( 'css-flags/css/flag-icon.min.css ' ), [] , $ ver );
276+ wp_enqueue_style ( 'msls-styles ' , self ::plugins_url ( 'css/msls.css ' ), array () , $ ver );
277+ wp_enqueue_style ( 'msls-flags ' , self ::plugins_url ( 'css-flags/css/flag-icon.min.css ' ), array () , $ ver );
259278
260279 if ( $ this ->options ->activate_autocomplete ) {
261- wp_enqueue_script ( 'msls-autocomplete ' ,
262- self ::plugins_url ( "$ folder/msls.js " ),
263- [ 'jquery-ui-autocomplete ' ],
264- $ ver );
280+ wp_enqueue_script ( 'msls-autocomplete ' , self ::plugins_url ( "$ folder/msls.js " ), array ( 'jquery-ui-autocomplete ' ), $ ver );
265281
266282 return true ;
267283 }
@@ -319,6 +335,7 @@ public static function path(): string {
319335 *
320336 * The widget will only be registered if the current blog is not
321337 * excluded in the configuration of the plugin.
338+ *
322339 * @return boolean
323340 */
324341 public function init_widget () {
@@ -384,7 +401,7 @@ public static function message_handler( $message, $css_class = 'error' ) {
384401 * Activate plugin
385402 */
386403 public static function activate () {
387- register_uninstall_hook ( self ::file (), [ __CLASS__ , 'uninstall ' ] );
404+ register_uninstall_hook ( self ::file (), array ( __CLASS__ , 'uninstall ' ) );
388405 }
389406
390407 /**
@@ -452,7 +469,7 @@ public static function cleanup() {
452469 * @return array
453470 */
454471 public static function get_superglobals ( array $ list ) {
455- $ arr = [] ;
472+ $ arr = array () ;
456473
457474 foreach ( $ list as $ var ) {
458475 $ arr [ $ var ] = '' ;
@@ -466,5 +483,4 @@ public static function get_superglobals( array $list ) {
466483
467484 return $ arr ;
468485 }
469-
470486}
0 commit comments