Passed
Push — master ( 6a5a36...97fcb2 )
by Brian
04:18
created
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 1 patch
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) {
22
+if (!class_exists('WP_Font_Awesome_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
 		 * @return WP_Font_Awesome_Settings - Main instance.
91 91
 		 */
92 92
 		public static function instance() {
93
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
93
+			if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) {
94 94
 				self::$instance = new WP_Font_Awesome_Settings;
95 95
 
96
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
96
+				add_action('init', array(self::$instance, 'init')); // set settings
97 97
 
98
-				if ( is_admin() ) {
99
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
100
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
101
-					add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) );
98
+				if (is_admin()) {
99
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
100
+					add_action('admin_init', array(self::$instance, 'register_settings'));
101
+					add_action('admin_notices', array(self::$instance, 'admin_notices'));
102 102
 				}
103 103
 
104
-				do_action( 'wp_font_awesome_settings_loaded' );
104
+				do_action('wp_font_awesome_settings_loaded');
105 105
 			}
106 106
 
107 107
 			return self::$instance;
@@ -116,34 +116,34 @@  discard block
 block discarded – undo
116 116
 			$this->settings = $this->get_settings();
117 117
 
118 118
 			// check if the official plugin is active and use that instead if so.
119
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
119
+			if (!defined('FONTAWESOME_PLUGIN_FILE')) {
120 120
 
121
-				if ( $this->settings['type'] == 'CSS' ) {
121
+				if ($this->settings['type'] == 'CSS') {
122 122
 
123
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
124
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
123
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
124
+						add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000);
125 125
 					}
126 126
 
127
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
128
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
129
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_styles' ), 10, 2 );
127
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
128
+						add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000);
129
+						add_filter('block_editor_settings_all', array($this, 'enqueue_editor_styles'), 10, 2);
130 130
 					}
131 131
 
132 132
 				} else {
133 133
 
134
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
135
-						add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
134
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
135
+						add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
136 136
 					}
137 137
 
138
-					if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
139
-						add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
140
-						add_filter( 'block_editor_settings_all', array( $this, 'enqueue_editor_scripts' ), 10, 2 );
138
+					if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
139
+						add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
140
+						add_filter('block_editor_settings_all', array($this, 'enqueue_editor_scripts'), 10, 2);
141 141
 					}
142 142
 				}
143 143
 
144 144
 				// remove font awesome if set to do so
145
-				if ( $this->settings['dequeue'] == '1' ) {
146
-					add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
145
+				if ($this->settings['dequeue'] == '1') {
146
+					add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3);
147 147
 				}
148 148
 			}
149 149
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 		 *
158 158
 		 * @return array
159 159
 		 */
160
-		public function enqueue_editor_styles( $editor_settings, $block_editor_context ){
160
+		public function enqueue_editor_styles($editor_settings, $block_editor_context) {
161 161
 
162
-			if ( ! empty( $editor_settings['__unstableResolvedAssets']['styles'] ) ) {
162
+			if (!empty($editor_settings['__unstableResolvedAssets']['styles'])) {
163 163
 				$url = $this->get_url();
164 164
 				$editor_settings['__unstableResolvedAssets']['styles'] .= "<link rel='stylesheet' id='font-awesome-css'  href='$url' media='all' />";
165 165
 			}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		 *
176 176
 		 * @return array
177 177
 		 */
178
-		public function enqueue_editor_scripts( $editor_settings, $block_editor_context ){
178
+		public function enqueue_editor_scripts($editor_settings, $block_editor_context) {
179 179
 
180 180
 			$url = $this->get_url();
181 181
 			$editor_settings['__unstableResolvedAssets']['scripts'] .= "<script src='$url' id='font-awesome-js'></script>";
@@ -190,20 +190,20 @@  discard block
 block discarded – undo
190 190
 			// build url
191 191
 			$url = $this->get_url();
192 192
 
193
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
194
-			wp_register_style( 'font-awesome', $url, array(), null );
195
-			wp_enqueue_style( 'font-awesome' );
193
+			wp_deregister_style('font-awesome'); // deregister in case its already there
194
+			wp_register_style('font-awesome', $url, array(), null);
195
+			wp_enqueue_style('font-awesome');
196 196
 
197 197
 			// RTL language support CSS.
198
-			if ( is_rtl() ) {
199
-				wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
198
+			if (is_rtl()) {
199
+				wp_add_inline_style('font-awesome', $this->rtl_inline_css());
200 200
 			}
201 201
 
202
-			if ( $this->settings['shims'] ) {
203
-				$url = $this->get_url( true );
204
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
205
-				wp_register_style( 'font-awesome-shims', $url, array(), null );
206
-				wp_enqueue_style( 'font-awesome-shims' );
202
+			if ($this->settings['shims']) {
203
+				$url = $this->get_url(true);
204
+				wp_deregister_style('font-awesome-shims'); // deregister in case its already there
205
+				wp_register_style('font-awesome-shims', $url, array(), null);
206
+				wp_enqueue_style('font-awesome-shims');
207 207
 			}
208 208
 		}
209 209
 
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 			$url = $this->get_url();
216 216
 
217 217
 			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
218
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
219
-			wp_register_script( 'font-awesome', $url, array(), null );
220
-			wp_enqueue_script( 'font-awesome' );
221
-
222
-			if ( $this->settings['shims'] ) {
223
-				$url = $this->get_url( true );
224
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
225
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
226
-				wp_enqueue_script( 'font-awesome-shims' );
218
+			call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there
219
+			wp_register_script('font-awesome', $url, array(), null);
220
+			wp_enqueue_script('font-awesome');
221
+
222
+			if ($this->settings['shims']) {
223
+				$url = $this->get_url(true);
224
+				call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there
225
+				wp_register_script('font-awesome-shims', $url, array(), null);
226
+				wp_enqueue_script('font-awesome-shims');
227 227
 			}
228 228
 		}
229 229
 
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 		 *
235 235
 		 * @return string The url to the file.
236 236
 		 */
237
-		public function get_url( $shims = false ) {
237
+		public function get_url($shims = false) {
238 238
 			$script  = $shims ? 'v4-shims' : 'all';
239 239
 			$sub     = $this->settings['pro'] ? 'pro' : 'use';
240 240
 			$type    = $this->settings['type'];
241 241
 			$version = $this->settings['version'];
242
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
242
+			$kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : '';
243 243
 			$url     = '';
244 244
 
245
-			if ( $type == 'KIT' && $kit_url ) {
246
-				if ( $shims ) {
245
+			if ($type == 'KIT' && $kit_url) {
246
+				if ($shims) {
247 247
 					// if its a kit then we don't add shims here
248 248
 					return '';
249 249
 				}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 				$url .= "?wpfas=true"; // set our var so our version is not removed
252 252
 			} else {
253 253
 				$url .= "https://$sub.fontawesome.com/releases/"; // CDN
254
-				$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
254
+				$url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
255 255
 				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
256 256
 				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
257 257
 				$url .= "?wpfas=true"; // set our var so our version is not removed
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
 		 *
272 272
 		 * @return string The filtered url.
273 273
 		 */
274
-		public function remove_font_awesome( $url, $original_url, $_context ) {
274
+		public function remove_font_awesome($url, $original_url, $_context) {
275 275
 
276
-			if ( $_context == 'display'
277
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
278
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
276
+			if ($_context == 'display'
277
+			     && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false)
278
+			     && (strstr($url, ".js") !== false || strstr($url, ".css") !== false)
279 279
 			) {// it's a font-awesome-url (probably)
280 280
 
281
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
282
-					if ( $this->settings['type'] == 'JS' ) {
283
-						if ( $this->settings['js-pseudo'] ) {
281
+				if (strstr($url, "wpfas=true") !== false) {
282
+					if ($this->settings['type'] == 'JS') {
283
+						if ($this->settings['js-pseudo']) {
284 284
 							$url .= "' data-search-pseudo-elements defer='defer";
285 285
 						} else {
286 286
 							$url .= "' defer='defer";
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		 * Register the database settings with WordPress.
300 300
 		 */
301 301
 		public function register_settings() {
302
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
302
+			register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings');
303 303
 		}
304 304
 
305 305
 		/**
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 		 */
309 309
 		public function menu_item() {
310 310
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
311
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
311
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
312 312
 				$this,
313 313
 				'settings_page'
314
-			) );
314
+			));
315 315
 		}
316 316
 
317 317
 		/**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		 */
322 322
 		public function get_settings() {
323 323
 
324
-			$db_settings = get_option( 'wp-font-awesome-settings' );
324
+			$db_settings = get_option('wp-font-awesome-settings');
325 325
 
326 326
 			$defaults = array(
327 327
 				'type'      => 'CSS', // type to use, CSS or JS or KIT
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 				'kit-url'   => '', // the kit url
335 335
 			);
336 336
 
337
-			$settings = wp_parse_args( $db_settings, $defaults );
337
+			$settings = wp_parse_args($db_settings, $defaults);
338 338
 
339 339
 			/**
340 340
 			 * Filter the Font Awesome settings.
341 341
 			 *
342 342
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
343 343
 			 */
344
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
344
+			return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults);
345 345
 		}
346 346
 
347 347
 
@@ -349,16 +349,16 @@  discard block
 block discarded – undo
349 349
 		 * The settings page html output.
350 350
 		 */
351 351
 		public function settings_page() {
352
-			if ( ! current_user_can( 'manage_options' ) ) {
353
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
352
+			if (!current_user_can('manage_options')) {
353
+				wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings'));
354 354
 			}
355 355
 
356 356
 			// a hidden way to force the update of the version number via api instead of waiting the 48 hours
357
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
358
-				$this->get_latest_version( $force_api = true );
357
+			if (isset($_REQUEST['force-version-check'])) {
358
+				$this->get_latest_version($force_api = true);
359 359
 			}
360 360
 
361
-			if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
361
+			if (!defined('FONTAWESOME_PLUGIN_FILE')) {
362 362
 				?>
363 363
                 <style>
364 364
                     .wpfas-kit-show {
@@ -377,37 +377,37 @@  discard block
 block discarded – undo
377 377
                     <h1><?php echo $this->name; ?></h1>
378 378
                     <form method="post" action="options.php" class="fas-settings-form">
379 379
 						<?php
380
-						settings_fields( 'wp-font-awesome-settings' );
381
-						do_settings_sections( 'wp-font-awesome-settings' );
380
+						settings_fields('wp-font-awesome-settings');
381
+						do_settings_sections('wp-font-awesome-settings');
382 382
 						$kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : '';
383 383
 						?>
384
-                        <table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>">
384
+                        <table class="form-table wpfas-table-settings <?php echo esc_attr($kit_set); ?>">
385 385
                             <tr valign="top">
386 386
                                 <th scope="row"><label
387
-                                            for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th>
387
+                                            for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th>
388 388
                                 <td>
389 389
                                     <select name="wp-font-awesome-settings[type]" id="wpfas-type"
390 390
                                             onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}">
391 391
                                         <option
392
-                                                value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option>
393
-                                        <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option>
392
+                                                value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option>
393
+                                        <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option>
394 394
                                         <option
395
-                                                value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option>
395
+                                                value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option>
396 396
                                     </select>
397 397
                                 </td>
398 398
                             </tr>
399 399
 
400 400
                             <tr valign="top" class="wpfas-kit-show">
401 401
                                 <th scope="row"><label
402
-                                            for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th>
402
+                                            for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th>
403 403
                                 <td>
404 404
                                     <input class="regular-text" id="wpfas-kit-url" type="url"
405 405
                                            name="wp-font-awesome-settings[kit-url]"
406
-                                           value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>"
407
-                                           placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
406
+                                           value="<?php echo esc_attr($this->settings['kit-url']); ?>"
407
+                                           placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
408 408
                                     <span><?php
409 409
 										echo sprintf(
410
-											__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
410
+											__('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'),
411 411
 											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
412 412
 											'</a>'
413 413
 										);
@@ -417,40 +417,40 @@  discard block
 block discarded – undo
417 417
 
418 418
                             <tr valign="top" class="wpfas-kit-hide">
419 419
                                 <th scope="row"><label
420
-                                            for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th>
420
+                                            for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th>
421 421
                                 <td>
422 422
                                     <select name="wp-font-awesome-settings[version]" id="wpfas-version">
423 423
                                         <option
424
-                                                value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?>
424
+                                                value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?>
425 425
                                         </option>
426
-                                        <option value="6.1.0" <?php selected( $this->settings['version'], '6.1.0' ); ?>>
426
+                                        <option value="6.1.0" <?php selected($this->settings['version'], '6.1.0'); ?>>
427 427
                                             6.1.0
428 428
                                         </option>
429
-                                        <option value="6.0.0" <?php selected( $this->settings['version'], '6.0.0' ); ?>>
429
+                                        <option value="6.0.0" <?php selected($this->settings['version'], '6.0.0'); ?>>
430 430
                                             6.0.0
431 431
                                         </option>
432
-                                        <option value="5.15.4" <?php selected( $this->settings['version'], '5.15.4' ); ?>>
432
+                                        <option value="5.15.4" <?php selected($this->settings['version'], '5.15.4'); ?>>
433 433
                                             5.15.4
434 434
                                         </option>
435
-                                        <option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>>
435
+                                        <option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>>
436 436
                                             5.6.0
437 437
                                         </option>
438
-                                        <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>>
438
+                                        <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>>
439 439
                                             5.5.0
440 440
                                         </option>
441
-                                        <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>>
441
+                                        <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>>
442 442
                                             5.4.0
443 443
                                         </option>
444
-                                        <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>>
444
+                                        <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>>
445 445
                                             5.3.0
446 446
                                         </option>
447
-                                        <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>>
447
+                                        <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>>
448 448
                                             5.2.0
449 449
                                         </option>
450
-                                        <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>>
450
+                                        <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>>
451 451
                                             5.1.0
452 452
                                         </option>
453
-                                        <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>>
453
+                                        <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>>
454 454
                                             4.7.1 (CSS only)
455 455
                                         </option>
456 456
                                     </select>
@@ -459,29 +459,29 @@  discard block
 block discarded – undo
459 459
 
460 460
                             <tr valign="top">
461 461
                                 <th scope="row"><label
462
-                                            for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th>
462
+                                            for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th>
463 463
                                 <td>
464 464
                                     <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue">
465 465
                                         <option
466
-                                                value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option>
466
+                                                value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option>
467 467
                                         <option
468
-                                                value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option>
468
+                                                value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option>
469 469
                                         <option
470
-                                                value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option>
470
+                                                value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option>
471 471
                                     </select>
472 472
                                 </td>
473 473
                             </tr>
474 474
 
475 475
                             <tr valign="top" class="wpfas-kit-hide">
476 476
                                 <th scope="row"><label
477
-                                            for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th>
477
+                                            for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th>
478 478
                                 <td>
479 479
                                     <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
480 480
                                     <input type="checkbox" name="wp-font-awesome-settings[pro]"
481
-                                           value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/>
481
+                                           value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro"/>
482 482
                                     <span><?php
483 483
 										echo sprintf(
484
-											__( 'Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings' ),
484
+											__('Requires a subscription. %sLearn more%s  %sManage my allowed domains%s', 'font-awesome-settings'),
485 485
 											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">',
486 486
 											' <i class="fas fa-external-link-alt"></i></a>',
487 487
 											'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">',
@@ -493,38 +493,38 @@  discard block
 block discarded – undo
493 493
 
494 494
                             <tr valign="top" class="wpfas-kit-hide">
495 495
                                 <th scope="row"><label
496
-                                            for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label>
496
+                                            for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label>
497 497
                                 </th>
498 498
                                 <td>
499 499
                                     <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/>
500 500
                                     <input type="checkbox" name="wp-font-awesome-settings[shims]"
501
-                                           value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/>
502
-                                    <span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings' ); ?></span>
501
+                                           value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/>
502
+                                    <span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings'); ?></span>
503 503
                                 </td>
504 504
                             </tr>
505 505
 
506 506
                             <tr valign="top" class="wpfas-kit-hide">
507 507
                                 <th scope="row"><label
508
-                                            for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label>
508
+                                            for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label>
509 509
                                 </th>
510 510
                                 <td>
511 511
                                     <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/>
512 512
                                     <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]"
513
-                                           value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?>
513
+                                           value="1" <?php checked($this->settings['js-pseudo'], '1'); ?>
514 514
                                            id="wpfas-js-pseudo"/>
515
-                                    <span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings' ); ?></span>
515
+                                    <span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings'); ?></span>
516 516
                                 </td>
517 517
                             </tr>
518 518
 
519 519
                             <tr valign="top">
520 520
                                 <th scope="row"><label
521
-                                            for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th>
521
+                                            for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th>
522 522
                                 <td>
523 523
                                     <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/>
524 524
                                     <input type="checkbox" name="wp-font-awesome-settings[dequeue]"
525
-                                           value="1" <?php checked( $this->settings['dequeue'], '1' ); ?>
525
+                                           value="1" <?php checked($this->settings['dequeue'], '1'); ?>
526 526
                                            id="wpfas-dequeue"/>
527
-                                    <span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings' ); ?></span>
527
+                                    <span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings'); ?></span>
528 528
                                 </td>
529 529
                             </tr>
530 530
 
@@ -533,12 +533,12 @@  discard block
 block discarded – undo
533 533
 							<?php
534 534
 							submit_button();
535 535
 							?>
536
-                            <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 14,000+ more icons with Font Awesome Pro','font-awesome-settings'); ?> <i class="fas fa-external-link-alt"></i></a></p>
536
+                            <p class="submit"><a href="https://fontawesome.com/referral?a=c9b89e1418" class="button button-secondary"><?php _e('Get 14,000+ more icons with Font Awesome Pro', 'font-awesome-settings'); ?> <i class="fas fa-external-link-alt"></i></a></p>
537 537
 
538 538
                         </div>
539 539
                     </form>
540 540
 
541
-                    <div id="wpfas-version"><?php echo sprintf(__( 'Version: %s (affiliate links provided)', 'font-awesome-settings' ), $this->version ); ?></div>
541
+                    <div id="wpfas-version"><?php echo sprintf(__('Version: %s (affiliate links provided)', 'font-awesome-settings'), $this->version); ?></div>
542 542
                 </div>
543 543
 
544 544
                 <style>
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
 		 *
569 569
 		 * @return string Either a valid version number or an empty string.
570 570
 		 */
571
-		public function validate_version_number( $version ) {
571
+		public function validate_version_number($version) {
572 572
 
573
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
573
+			if (version_compare($version, '0.0.1', '>=') >= 0) {
574 574
 				// valid
575 575
 			} else {
576
-				$version = '';// not validated
576
+				$version = ''; // not validated
577 577
 			}
578 578
 
579 579
 			return $version;
@@ -588,19 +588,19 @@  discard block
 block discarded – undo
588 588
 		 * @since 1.0.7
589 589
 		 * @return mixed|string The latest version number found.
590 590
 		 */
591
-		public function get_latest_version( $force_api = false ) {
591
+		public function get_latest_version($force_api = false) {
592 592
 			$latest_version = $this->latest;
593 593
 
594
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
594
+			$cache = get_transient('wp-font-awesome-settings-version');
595 595
 
596
-			if ( $cache === false || $force_api ) { // its not set
596
+			if ($cache === false || $force_api) { // its not set
597 597
 				$api_ver = $this->get_latest_version_from_api();
598
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
598
+				if (version_compare($api_ver, $this->latest, '>=') >= 0) {
599 599
 					$latest_version = $api_ver;
600
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
600
+					set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS);
601 601
 				}
602
-			} elseif ( $this->validate_version_number( $cache ) ) {
603
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
602
+			} elseif ($this->validate_version_number($cache)) {
603
+				if (version_compare($cache, $this->latest, '>=') >= 0) {
604 604
 					$latest_version = $cache;
605 605
 				}
606 606
 			}
@@ -616,10 +616,10 @@  discard block
 block discarded – undo
616 616
 		 */
617 617
 		public function get_latest_version_from_api() {
618 618
 			$version  = "0";
619
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
620
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
621
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
622
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
619
+			$response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest");
620
+			if (!is_wp_error($response) && is_array($response)) {
621
+				$api_response = json_decode(wp_remote_retrieve_body($response), true);
622
+				if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) {
623 623
 					$version = $api_response['tag_name'];
624 624
 				}
625 625
 			}
@@ -644,26 +644,26 @@  discard block
 block discarded – undo
644 644
 		 *
645 645
 		 * @return void
646 646
 		 */
647
-		public function admin_notices(){
647
+		public function admin_notices() {
648 648
 			$settings = $this->settings;
649 649
 
650
-			if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) {
650
+			if (defined('FONTAWESOME_PLUGIN_FILE')) {
651 651
 
652
-				if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) {
652
+				if (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-font-awesome-settings') {
653 653
 					?>
654 654
                     <div class="notice  notice-error is-dismissible">
655
-                        <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p>
655
+                        <p><?php _e('The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings'); ?></p>
656 656
                     </div>
657 657
 					<?php
658 658
 				}
659 659
 
660
-			}else{
661
-				if ( ! empty( $settings ) ) {
662
-					if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) {
660
+			} else {
661
+				if (!empty($settings)) {
662
+					if ($settings['type'] != 'KIT' && $settings['pro'] && ($settings['version'] == '' || version_compare($settings['version'], '6', '>='))) {
663 663
 						$link = admin_url('options-general.php?page=wp-font-awesome-settings');
664 664
 						?>
665 665
                         <div class="notice  notice-error is-dismissible">
666
-                            <p><?php echo sprintf( __( 'Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'font-awesome-settings' ),"<a href='". esc_url_raw( $link )."'>","</a>" ); ?></p>
666
+                            <p><?php echo sprintf(__('Font Awesome Pro v6 requires the use of a kit, please setup your kit in %ssettings.%s', 'font-awesome-settings'), "<a href='" . esc_url_raw($link) . "'>", "</a>"); ?></p>
667 667
                         </div>
668 668
 						<?php
669 669
 					}
Please login to merge, or discard this patch.