@@ -40,7 +40,7 @@ public static function init() {
40
40
41
41
add_action ( 'plugins_loaded ' , array ( $ obj , 'init_i18n_support ' ) );
42
42
43
- register_activation_hook ( self ::file (), array ( $ obj , 'activate ' ) );
43
+ register_activation_hook ( self ::file (), array ( __CLASS__ , 'activate ' ) );
44
44
45
45
if ( function_exists ( 'is_multisite ' ) && is_multisite () ) {
46
46
add_action ( 'admin_enqueue_scripts ' , array ( $ obj , 'custom_enqueue ' ) );
@@ -69,14 +69,16 @@ public static function init() {
69
69
add_action ( 'load-term.php ' , array ( MslsPostTag::class, 'init ' ) );
70
70
71
71
if ( MslsRequest::has_var ( MslsFields::FIELD_ACTION ) ) {
72
- $ action = MslsRequest::get_var ( MslsFields::FIELD_ACTION );
73
-
74
- if ( 'add-tag ' === $ action ) {
75
- add_action ( 'admin_init ' , array ( MslsPostTag::class, 'init ' ) );
76
- } elseif ( 'inline-save ' === $ action ) {
77
- add_action ( 'admin_init ' , array ( MslsCustomColumn::class, 'init ' ) );
78
- } elseif ( 'inline-save-tax ' === $ action ) {
79
- add_action ( 'admin_init ' , array ( MslsCustomColumnTaxonomy::class, 'init ' ) );
72
+ switch ( MslsRequest::get_var ( MslsFields::FIELD_ACTION ) ) {
73
+ case 'add-tag ' :
74
+ add_action ( 'admin_init ' , array ( MslsPostTag::class, 'init ' ) );
75
+ break ;
76
+ case 'inline-save ' :
77
+ add_action ( 'admin_init ' , array ( MslsCustomColumn::class, 'init ' ) );
78
+ break ;
79
+ case 'inline-save-tax ' :
80
+ add_action ( 'admin_init ' , array ( MslsCustomColumnTaxonomy::class, 'init ' ) );
81
+ break ;
80
82
}
81
83
}
82
84
@@ -120,23 +122,16 @@ public static function get_output() {
120
122
return $ obj ;
121
123
}
122
124
123
- /**
124
- * Callback for action wp_head
125
- */
126
- public static function print_alternate_links () {
125
+ public static function print_alternate_links (): void {
127
126
echo self ::get_output ()->get_alternate_links (), PHP_EOL ;
128
127
}
129
128
130
129
/**
131
130
* Loads styles and some js if needed
132
- *
133
- * The method returns true if the autocomplete-option is activated, false otherwise.
134
- *
135
- * @return boolean
136
131
*/
137
- public function custom_enqueue () {
132
+ public function custom_enqueue (): void {
138
133
if ( ! is_admin_bar_showing () ) {
139
- return false ;
134
+ return ;
140
135
}
141
136
142
137
$ ver = defined ( 'MSLS_PLUGIN_VERSION ' ) ? constant ( 'MSLS_PLUGIN_VERSION ' ) : false ;
@@ -147,11 +142,7 @@ public function custom_enqueue() {
147
142
148
143
if ( $ this ->options ->activate_autocomplete ) {
149
144
wp_enqueue_script ( 'msls-autocomplete ' , self ::plugins_url ( "$ folder/msls.js " ), array ( 'jquery-ui-autocomplete ' ), $ ver , array ( 'in_footer ' => true ) );
150
-
151
- return true ;
152
145
}
153
-
154
- return false ;
155
146
}
156
147
157
148
/**
@@ -202,13 +193,10 @@ public static function path(): string {
202
193
/**
203
194
* Load textdomain
204
195
*
205
- * The method should be executed always on init because we have some
206
- * translatable string in the frontend too.
207
- *
208
- * @return boolean
196
+ * The method should be executed always on init because we have some translatable string in the frontend too.
209
197
*/
210
- public function init_i18n_support () {
211
- return load_plugin_textdomain ( 'multisite-language-switcher ' , false , self ::dirname ( '/languages/ ' ) );
198
+ public function init_i18n_support (): void {
199
+ load_plugin_textdomain ( 'multisite-language-switcher ' , false , self ::dirname ( '/languages/ ' ) );
212
200
}
213
201
214
202
/**
@@ -234,7 +222,7 @@ public static function message_handler( $message, $css_class = 'error' ) {
234
222
/**
235
223
* Activate plugin
236
224
*/
237
- public static function activate () {
225
+ public static function activate (): void {
238
226
register_uninstall_hook ( self ::file (), array ( __CLASS__ , 'uninstall ' ) );
239
227
}
240
228
0 commit comments