1
1
<?php
2
- /**
3
- * MslsAdminIcon
4
- * @author Dennis Ploetner <[email protected] >
5
- * @since 0.9.8
6
- */
7
2
8
3
namespace lloc \Msls ;
9
4
12
7
13
8
/**
14
9
* Handles the icon links in the backend
10
+ *
15
11
* @package Msls
16
12
*/
17
13
class MslsAdminIcon {
@@ -121,7 +117,7 @@ public function set_icon_type( $icon_type ): MslsAdminIcon {
121
117
*/
122
118
public function set_path (): MslsAdminIcon {
123
119
if ( 'post ' != $ this ->type ) {
124
- $ query_vars = [ 'post_type ' => $ this ->type ] ;
120
+ $ query_vars = array ( 'post_type ' => $ this ->type ) ;
125
121
$ this ->path = add_query_arg ( $ query_vars , $ this ->path );
126
122
}
127
123
@@ -209,12 +205,16 @@ public function get_img(): string {
209
205
*/
210
206
public function get_a (): string {
211
207
if ( empty ( $ this ->href ) ) {
212
- $ title = sprintf ( __ ( 'Create a new translation in the %s-blog ' , 'multisite-language-switcher ' ),
213
- $ this ->language );
208
+ $ title = sprintf (
209
+ __ ( 'Create a new translation in the %s-blog ' , 'multisite-language-switcher ' ),
210
+ $ this ->language
211
+ );
214
212
$ href = $ this ->get_edit_new ();
215
213
} else {
216
- $ title = sprintf ( __ ( 'Edit the translation in the %s-blog ' , 'multisite-language-switcher ' ),
217
- $ this ->language );
214
+ $ title = sprintf (
215
+ __ ( 'Edit the translation in the %s-blog ' , 'multisite-language-switcher ' ),
216
+ $ this ->language
217
+ );
218
218
$ href = $ this ->href ;
219
219
}
220
220
@@ -232,21 +232,25 @@ public function get_icon(): string {
232
232
}
233
233
234
234
switch ( $ this ->icon_type ) {
235
- case MslsAdminIcon::TYPE_FLAG :
236
- $ icon = sprintf ( '<span class="flag-icon %s">%s</span> ' ,
235
+ case self ::TYPE_FLAG :
236
+ $ icon = sprintf (
237
+ '<span class="flag-icon %s">%s</span> ' ,
237
238
( new IconSvg () )->get ( $ this ->language ),
238
239
$ this ->language
239
240
);
240
241
break ;
241
- case MslsAdminIcon::TYPE_LABEL :
242
- $ icon = sprintf ( '<span class="language-badge %s">%s</span> ' ,
242
+ case self ::TYPE_LABEL :
243
+ $ icon = sprintf (
244
+ '<span class="language-badge %s">%s</span> ' ,
243
245
$ this ->language ,
244
246
( new IconLabel () )->get ( $ this ->language )
245
247
);
246
248
break ;
247
249
default :
248
- $ icon = sprintf ( '<span class="dashicons %s"></span> ' ,
249
- empty ( $ this ->href ) ? 'dashicons-plus ' : 'dashicons-edit ' );
250
+ $ icon = sprintf (
251
+ '<span class="dashicons %s"></span> ' ,
252
+ empty ( $ this ->href ) ? 'dashicons-plus ' : 'dashicons-edit '
253
+ );
250
254
}
251
255
252
256
return $ icon ;
@@ -261,7 +265,13 @@ public function get_edit_new(): string {
261
265
$ path = $ this ->path ;
262
266
263
267
if ( null !== $ this ->id && null !== $ this ->origin_language ) {
264
- $ path = add_query_arg ( [ 'msls_id ' => $ this ->id , 'msls_lang ' => $ this ->origin_language ], $ this ->path );
268
+ $ path = add_query_arg (
269
+ array (
270
+ 'msls_id ' => $ this ->id ,
271
+ 'msls_lang ' => $ this ->origin_language ,
272
+ ),
273
+ $ this ->path
274
+ );
265
275
}
266
276
267
277
/**
@@ -275,5 +285,4 @@ public function get_edit_new(): string {
275
285
276
286
return get_admin_url ( get_current_blog_id (), $ path );
277
287
}
278
-
279
288
}
0 commit comments