@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * Bail if we are not in WP. |
| 14 | 14 | */ |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | - exit; |
|
| 16 | + exit; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -21,308 +21,308 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * A Class to be able to change settings for Font Awesome. |
|
| 26 | - * |
|
| 27 | - * Class WP_Font_Awesome_Settings |
|
| 28 | - * @since 1.0.10 Now able to pass wp.org theme check. |
|
| 29 | - * @since 1.0.11 Font Awesome Pro now supported. |
|
| 30 | - * @since 1.0.11 Font Awesome Kits now supported. |
|
| 31 | - * @since 1.0.13 RTL language support added. |
|
| 32 | - * @since 1.0.14 Warning added for v6 pro requires kit and will now not work if official FA plugin installed. |
|
| 33 | - * @ver 1.0.14 |
|
| 34 | - * @todo decide how to implement textdomain |
|
| 35 | - */ |
|
| 36 | - class WP_Font_Awesome_Settings { |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Class version version. |
|
| 40 | - * |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 43 | - public $version = '1.0.14'; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Class textdomain. |
|
| 47 | - * |
|
| 48 | - * @var string |
|
| 49 | - */ |
|
| 50 | - public $textdomain = 'font-awesome-settings'; |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Latest version of Font Awesome at time of publish published. |
|
| 54 | - * |
|
| 55 | - * @var string |
|
| 56 | - */ |
|
| 57 | - public $latest = "5.8.2"; |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * The title. |
|
| 61 | - * |
|
| 62 | - * @var string |
|
| 63 | - */ |
|
| 64 | - public $name = 'Font Awesome'; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Holds the settings values. |
|
| 68 | - * |
|
| 69 | - * @var array |
|
| 70 | - */ |
|
| 71 | - private $settings; |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * WP_Font_Awesome_Settings instance. |
|
| 75 | - * |
|
| 76 | - * @access private |
|
| 77 | - * @since 1.0.0 |
|
| 78 | - * @var WP_Font_Awesome_Settings There can be only one! |
|
| 79 | - */ |
|
| 80 | - private static $instance = null; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Main WP_Font_Awesome_Settings Instance. |
|
| 84 | - * |
|
| 85 | - * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded. |
|
| 86 | - * |
|
| 87 | - * @since 1.0.0 |
|
| 88 | - * @static |
|
| 89 | - * @return WP_Font_Awesome_Settings - Main instance. |
|
| 90 | - */ |
|
| 91 | - public static function instance() { |
|
| 92 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
| 93 | - self::$instance = new WP_Font_Awesome_Settings; |
|
| 94 | - |
|
| 95 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 96 | - |
|
| 97 | - if ( is_admin() ) { |
|
| 98 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 99 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 100 | - add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - do_action( 'wp_font_awesome_settings_loaded' ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return self::$instance; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Initiate the settings and add the required action hooks. |
|
| 111 | - * |
|
| 112 | - * @since 1.0.8 Settings name wrong - FIXED |
|
| 113 | - */ |
|
| 114 | - public function init() { |
|
| 115 | - $this->settings = $this->get_settings(); |
|
| 116 | - |
|
| 117 | - // check if the official plugin is active and use that instead if so. |
|
| 118 | - if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 119 | - |
|
| 120 | - if ( $this->settings['type'] == 'CSS' ) { |
|
| 121 | - |
|
| 122 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 123 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 127 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - } else { |
|
| 131 | - |
|
| 132 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 133 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 137 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // remove font awesome if set to do so |
|
| 142 | - if ( $this->settings['dequeue'] == '1' ) { |
|
| 143 | - add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Adds the Font Awesome styles. |
|
| 151 | - */ |
|
| 152 | - public function enqueue_style() { |
|
| 153 | - // build url |
|
| 154 | - $url = $this->get_url(); |
|
| 155 | - |
|
| 156 | - wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
| 157 | - wp_register_style( 'font-awesome', $url, array(), null ); |
|
| 158 | - wp_enqueue_style( 'font-awesome' ); |
|
| 159 | - |
|
| 160 | - // RTL language support CSS. |
|
| 161 | - if ( is_rtl() ) { |
|
| 162 | - wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() ); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - if ( $this->settings['shims'] ) { |
|
| 166 | - $url = $this->get_url( true ); |
|
| 167 | - wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
| 168 | - wp_register_style( 'font-awesome-shims', $url, array(), null ); |
|
| 169 | - wp_enqueue_style( 'font-awesome-shims' ); |
|
| 170 | - } |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * Adds the Font Awesome JS. |
|
| 175 | - */ |
|
| 176 | - public function enqueue_scripts() { |
|
| 177 | - // build url |
|
| 178 | - $url = $this->get_url(); |
|
| 179 | - |
|
| 180 | - $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script'; |
|
| 181 | - call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there |
|
| 182 | - wp_register_script( 'font-awesome', $url, array(), null ); |
|
| 183 | - wp_enqueue_script( 'font-awesome' ); |
|
| 184 | - |
|
| 185 | - if ( $this->settings['shims'] ) { |
|
| 186 | - $url = $this->get_url( true ); |
|
| 187 | - call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there |
|
| 188 | - wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
| 189 | - wp_enqueue_script( 'font-awesome-shims' ); |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Get the url of the Font Awesome files. |
|
| 195 | - * |
|
| 196 | - * @param bool $shims If this is a shim file or not. |
|
| 197 | - * |
|
| 198 | - * @return string The url to the file. |
|
| 199 | - */ |
|
| 200 | - public function get_url( $shims = false ) { |
|
| 201 | - $script = $shims ? 'v4-shims' : 'all'; |
|
| 202 | - $sub = $this->settings['pro'] ? 'pro' : 'use'; |
|
| 203 | - $type = $this->settings['type']; |
|
| 204 | - $version = $this->settings['version']; |
|
| 205 | - $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : ''; |
|
| 206 | - $url = ''; |
|
| 207 | - |
|
| 208 | - if ( $type == 'KIT' && $kit_url ) { |
|
| 209 | - if ( $shims ) { |
|
| 210 | - // if its a kit then we don't add shims here |
|
| 211 | - return ''; |
|
| 212 | - } |
|
| 213 | - $url .= $kit_url; // CDN |
|
| 214 | - $url .= "?wpfas=true"; // set our var so our version is not removed |
|
| 215 | - } else { |
|
| 216 | - $url .= "https://$sub.fontawesome.com/releases/"; // CDN |
|
| 217 | - $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 218 | - $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
|
| 219 | - $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
|
| 220 | - $url .= "?wpfas=true"; // set our var so our version is not removed |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - return $url; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Try and remove any other versions of Font Awesome added by other plugins/themes. |
|
| 228 | - * |
|
| 229 | - * Uses the clean_url filter to try and remove any other Font Awesome files added, it can also add pseudo-elements flag for the JS version. |
|
| 230 | - * |
|
| 231 | - * @param $url |
|
| 232 | - * @param $original_url |
|
| 233 | - * @param $_context |
|
| 234 | - * |
|
| 235 | - * @return string The filtered url. |
|
| 236 | - */ |
|
| 237 | - public function remove_font_awesome( $url, $original_url, $_context ) { |
|
| 238 | - |
|
| 239 | - if ( $_context == 'display' |
|
| 240 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 241 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 242 | - ) {// it's a font-awesome-url (probably) |
|
| 243 | - |
|
| 244 | - if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
| 245 | - if ( $this->settings['type'] == 'JS' ) { |
|
| 246 | - if ( $this->settings['js-pseudo'] ) { |
|
| 247 | - $url .= "' data-search-pseudo-elements defer='defer"; |
|
| 248 | - } else { |
|
| 249 | - $url .= "' defer='defer"; |
|
| 250 | - } |
|
| 251 | - } |
|
| 252 | - } else { |
|
| 253 | - $url = ''; // removing the url removes the file |
|
| 254 | - } |
|
| 255 | - |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - return $url; |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * Register the database settings with WordPress. |
|
| 263 | - */ |
|
| 264 | - public function register_settings() { |
|
| 265 | - register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * Add the WordPress settings menu item. |
|
| 270 | - * @since 1.0.10 Calling function name direct will fail theme check so we don't. |
|
| 271 | - */ |
|
| 272 | - public function menu_item() { |
|
| 273 | - $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
|
| 274 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 275 | - $this, |
|
| 276 | - 'settings_page' |
|
| 277 | - ) ); |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Get the current Font Awesome output settings. |
|
| 282 | - * |
|
| 283 | - * @return array The array of settings. |
|
| 284 | - */ |
|
| 285 | - public function get_settings() { |
|
| 286 | - |
|
| 287 | - $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
| 288 | - |
|
| 289 | - $defaults = array( |
|
| 290 | - 'type' => 'CSS', // type to use, CSS or JS or KIT |
|
| 291 | - 'version' => '', // latest |
|
| 292 | - 'enqueue' => '', // front and backend |
|
| 293 | - 'shims' => '0', // default OFF now in 2020 |
|
| 294 | - 'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive) |
|
| 295 | - 'dequeue' => '0', // if we should try to remove other versions added by other plugins/themes |
|
| 296 | - 'pro' => '0', // if pro CDN url should be used |
|
| 297 | - 'kit-url' => '', // the kit url |
|
| 298 | - ); |
|
| 299 | - |
|
| 300 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * Filter the Font Awesome settings. |
|
| 304 | - * |
|
| 305 | - * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
|
| 306 | - */ |
|
| 307 | - return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - |
|
| 311 | - /** |
|
| 312 | - * The settings page html output. |
|
| 313 | - */ |
|
| 314 | - public function settings_page() { |
|
| 315 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 316 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) ); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - // a hidden way to force the update of the version number via api instead of waiting the 48 hours |
|
| 320 | - if ( isset( $_REQUEST['force-version-check'] ) ) { |
|
| 321 | - $this->get_latest_version( $force_api = true ); |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 325 | - ?> |
|
| 24 | + /** |
|
| 25 | + * A Class to be able to change settings for Font Awesome. |
|
| 26 | + * |
|
| 27 | + * Class WP_Font_Awesome_Settings |
|
| 28 | + * @since 1.0.10 Now able to pass wp.org theme check. |
|
| 29 | + * @since 1.0.11 Font Awesome Pro now supported. |
|
| 30 | + * @since 1.0.11 Font Awesome Kits now supported. |
|
| 31 | + * @since 1.0.13 RTL language support added. |
|
| 32 | + * @since 1.0.14 Warning added for v6 pro requires kit and will now not work if official FA plugin installed. |
|
| 33 | + * @ver 1.0.14 |
|
| 34 | + * @todo decide how to implement textdomain |
|
| 35 | + */ |
|
| 36 | + class WP_Font_Awesome_Settings { |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Class version version. |
|
| 40 | + * |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | + public $version = '1.0.14'; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Class textdomain. |
|
| 47 | + * |
|
| 48 | + * @var string |
|
| 49 | + */ |
|
| 50 | + public $textdomain = 'font-awesome-settings'; |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Latest version of Font Awesome at time of publish published. |
|
| 54 | + * |
|
| 55 | + * @var string |
|
| 56 | + */ |
|
| 57 | + public $latest = "5.8.2"; |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * The title. |
|
| 61 | + * |
|
| 62 | + * @var string |
|
| 63 | + */ |
|
| 64 | + public $name = 'Font Awesome'; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Holds the settings values. |
|
| 68 | + * |
|
| 69 | + * @var array |
|
| 70 | + */ |
|
| 71 | + private $settings; |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * WP_Font_Awesome_Settings instance. |
|
| 75 | + * |
|
| 76 | + * @access private |
|
| 77 | + * @since 1.0.0 |
|
| 78 | + * @var WP_Font_Awesome_Settings There can be only one! |
|
| 79 | + */ |
|
| 80 | + private static $instance = null; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Main WP_Font_Awesome_Settings Instance. |
|
| 84 | + * |
|
| 85 | + * Ensures only one instance of WP_Font_Awesome_Settings is loaded or can be loaded. |
|
| 86 | + * |
|
| 87 | + * @since 1.0.0 |
|
| 88 | + * @static |
|
| 89 | + * @return WP_Font_Awesome_Settings - Main instance. |
|
| 90 | + */ |
|
| 91 | + public static function instance() { |
|
| 92 | + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
| 93 | + self::$instance = new WP_Font_Awesome_Settings; |
|
| 94 | + |
|
| 95 | + add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 96 | + |
|
| 97 | + if ( is_admin() ) { |
|
| 98 | + add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 99 | + add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 100 | + add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + do_action( 'wp_font_awesome_settings_loaded' ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return self::$instance; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Initiate the settings and add the required action hooks. |
|
| 111 | + * |
|
| 112 | + * @since 1.0.8 Settings name wrong - FIXED |
|
| 113 | + */ |
|
| 114 | + public function init() { |
|
| 115 | + $this->settings = $this->get_settings(); |
|
| 116 | + |
|
| 117 | + // check if the official plugin is active and use that instead if so. |
|
| 118 | + if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 119 | + |
|
| 120 | + if ( $this->settings['type'] == 'CSS' ) { |
|
| 121 | + |
|
| 122 | + if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 123 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 127 | + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + } else { |
|
| 131 | + |
|
| 132 | + if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 133 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 137 | + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + // remove font awesome if set to do so |
|
| 142 | + if ( $this->settings['dequeue'] == '1' ) { |
|
| 143 | + add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Adds the Font Awesome styles. |
|
| 151 | + */ |
|
| 152 | + public function enqueue_style() { |
|
| 153 | + // build url |
|
| 154 | + $url = $this->get_url(); |
|
| 155 | + |
|
| 156 | + wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
| 157 | + wp_register_style( 'font-awesome', $url, array(), null ); |
|
| 158 | + wp_enqueue_style( 'font-awesome' ); |
|
| 159 | + |
|
| 160 | + // RTL language support CSS. |
|
| 161 | + if ( is_rtl() ) { |
|
| 162 | + wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() ); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + if ( $this->settings['shims'] ) { |
|
| 166 | + $url = $this->get_url( true ); |
|
| 167 | + wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
| 168 | + wp_register_style( 'font-awesome-shims', $url, array(), null ); |
|
| 169 | + wp_enqueue_style( 'font-awesome-shims' ); |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * Adds the Font Awesome JS. |
|
| 175 | + */ |
|
| 176 | + public function enqueue_scripts() { |
|
| 177 | + // build url |
|
| 178 | + $url = $this->get_url(); |
|
| 179 | + |
|
| 180 | + $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script'; |
|
| 181 | + call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there |
|
| 182 | + wp_register_script( 'font-awesome', $url, array(), null ); |
|
| 183 | + wp_enqueue_script( 'font-awesome' ); |
|
| 184 | + |
|
| 185 | + if ( $this->settings['shims'] ) { |
|
| 186 | + $url = $this->get_url( true ); |
|
| 187 | + call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there |
|
| 188 | + wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
| 189 | + wp_enqueue_script( 'font-awesome-shims' ); |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Get the url of the Font Awesome files. |
|
| 195 | + * |
|
| 196 | + * @param bool $shims If this is a shim file or not. |
|
| 197 | + * |
|
| 198 | + * @return string The url to the file. |
|
| 199 | + */ |
|
| 200 | + public function get_url( $shims = false ) { |
|
| 201 | + $script = $shims ? 'v4-shims' : 'all'; |
|
| 202 | + $sub = $this->settings['pro'] ? 'pro' : 'use'; |
|
| 203 | + $type = $this->settings['type']; |
|
| 204 | + $version = $this->settings['version']; |
|
| 205 | + $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : ''; |
|
| 206 | + $url = ''; |
|
| 207 | + |
|
| 208 | + if ( $type == 'KIT' && $kit_url ) { |
|
| 209 | + if ( $shims ) { |
|
| 210 | + // if its a kit then we don't add shims here |
|
| 211 | + return ''; |
|
| 212 | + } |
|
| 213 | + $url .= $kit_url; // CDN |
|
| 214 | + $url .= "?wpfas=true"; // set our var so our version is not removed |
|
| 215 | + } else { |
|
| 216 | + $url .= "https://$sub.fontawesome.com/releases/"; // CDN |
|
| 217 | + $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 218 | + $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
|
| 219 | + $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
|
| 220 | + $url .= "?wpfas=true"; // set our var so our version is not removed |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + return $url; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Try and remove any other versions of Font Awesome added by other plugins/themes. |
|
| 228 | + * |
|
| 229 | + * Uses the clean_url filter to try and remove any other Font Awesome files added, it can also add pseudo-elements flag for the JS version. |
|
| 230 | + * |
|
| 231 | + * @param $url |
|
| 232 | + * @param $original_url |
|
| 233 | + * @param $_context |
|
| 234 | + * |
|
| 235 | + * @return string The filtered url. |
|
| 236 | + */ |
|
| 237 | + public function remove_font_awesome( $url, $original_url, $_context ) { |
|
| 238 | + |
|
| 239 | + if ( $_context == 'display' |
|
| 240 | + && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 241 | + && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 242 | + ) {// it's a font-awesome-url (probably) |
|
| 243 | + |
|
| 244 | + if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
| 245 | + if ( $this->settings['type'] == 'JS' ) { |
|
| 246 | + if ( $this->settings['js-pseudo'] ) { |
|
| 247 | + $url .= "' data-search-pseudo-elements defer='defer"; |
|
| 248 | + } else { |
|
| 249 | + $url .= "' defer='defer"; |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | + } else { |
|
| 253 | + $url = ''; // removing the url removes the file |
|
| 254 | + } |
|
| 255 | + |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + return $url; |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * Register the database settings with WordPress. |
|
| 263 | + */ |
|
| 264 | + public function register_settings() { |
|
| 265 | + register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * Add the WordPress settings menu item. |
|
| 270 | + * @since 1.0.10 Calling function name direct will fail theme check so we don't. |
|
| 271 | + */ |
|
| 272 | + public function menu_item() { |
|
| 273 | + $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
|
| 274 | + call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 275 | + $this, |
|
| 276 | + 'settings_page' |
|
| 277 | + ) ); |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Get the current Font Awesome output settings. |
|
| 282 | + * |
|
| 283 | + * @return array The array of settings. |
|
| 284 | + */ |
|
| 285 | + public function get_settings() { |
|
| 286 | + |
|
| 287 | + $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
| 288 | + |
|
| 289 | + $defaults = array( |
|
| 290 | + 'type' => 'CSS', // type to use, CSS or JS or KIT |
|
| 291 | + 'version' => '', // latest |
|
| 292 | + 'enqueue' => '', // front and backend |
|
| 293 | + 'shims' => '0', // default OFF now in 2020 |
|
| 294 | + 'js-pseudo' => '0', // if the pseudo elements flag should be set (CPU intensive) |
|
| 295 | + 'dequeue' => '0', // if we should try to remove other versions added by other plugins/themes |
|
| 296 | + 'pro' => '0', // if pro CDN url should be used |
|
| 297 | + 'kit-url' => '', // the kit url |
|
| 298 | + ); |
|
| 299 | + |
|
| 300 | + $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * Filter the Font Awesome settings. |
|
| 304 | + * |
|
| 305 | + * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
|
| 306 | + */ |
|
| 307 | + return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + |
|
| 311 | + /** |
|
| 312 | + * The settings page html output. |
|
| 313 | + */ |
|
| 314 | + public function settings_page() { |
|
| 315 | + if ( ! current_user_can( 'manage_options' ) ) { |
|
| 316 | + wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) ); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + // a hidden way to force the update of the version number via api instead of waiting the 48 hours |
|
| 320 | + if ( isset( $_REQUEST['force-version-check'] ) ) { |
|
| 321 | + $this->get_latest_version( $force_api = true ); |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 325 | + ?> |
|
| 326 | 326 | <style> |
| 327 | 327 | .wpfas-kit-show { |
| 328 | 328 | display: none; |
@@ -340,10 +340,10 @@ discard block |
||
| 340 | 340 | <h1><?php echo $this->name; ?></h1> |
| 341 | 341 | <form method="post" action="options.php" class="fas-settings-form"> |
| 342 | 342 | <?php |
| 343 | - settings_fields( 'wp-font-awesome-settings' ); |
|
| 344 | - do_settings_sections( 'wp-font-awesome-settings' ); |
|
| 345 | - $kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : ''; |
|
| 346 | - ?> |
|
| 343 | + settings_fields( 'wp-font-awesome-settings' ); |
|
| 344 | + do_settings_sections( 'wp-font-awesome-settings' ); |
|
| 345 | + $kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : ''; |
|
| 346 | + ?> |
|
| 347 | 347 | <table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>"> |
| 348 | 348 | <tr valign="top"> |
| 349 | 349 | <th scope="row"><label |
@@ -369,12 +369,12 @@ discard block |
||
| 369 | 369 | value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" |
| 370 | 370 | placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
| 371 | 371 | <span><?php |
| 372 | - echo sprintf( |
|
| 373 | - __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ), |
|
| 374 | - '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>', |
|
| 375 | - '</a>' |
|
| 376 | - ); |
|
| 377 | - ?></span> |
|
| 372 | + echo sprintf( |
|
| 373 | + __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ), |
|
| 374 | + '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>', |
|
| 375 | + '</a>' |
|
| 376 | + ); |
|
| 377 | + ?></span> |
|
| 378 | 378 | </td> |
| 379 | 379 | </tr> |
| 380 | 380 | |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | <input type="checkbox" name="wp-font-awesome-settings[pro]" |
| 444 | 444 | value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/> |
| 445 | 445 | <span><?php |
| 446 | - echo sprintf( |
|
| 447 | - __( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ), |
|
| 448 | - '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">', |
|
| 449 | - ' <i class="fas fa-external-link-alt"></i></a>', |
|
| 450 | - '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">', |
|
| 451 | - ' <i class="fas fa-external-link-alt"></i></a>' |
|
| 452 | - ); |
|
| 453 | - ?></span> |
|
| 446 | + echo sprintf( |
|
| 447 | + __( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ), |
|
| 448 | + '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">', |
|
| 449 | + ' <i class="fas fa-external-link-alt"></i></a>', |
|
| 450 | + '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">', |
|
| 451 | + ' <i class="fas fa-external-link-alt"></i></a>' |
|
| 452 | + ); |
|
| 453 | + ?></span> |
|
| 454 | 454 | </td> |
| 455 | 455 | </tr> |
| 456 | 456 | |
@@ -494,8 +494,8 @@ discard block |
||
| 494 | 494 | </table> |
| 495 | 495 | <div class="fas-buttons"> |
| 496 | 496 | <?php |
| 497 | - submit_button(); |
|
| 498 | - ?> |
|
| 497 | + submit_button(); |
|
| 498 | + ?> |
|
| 499 | 499 | <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> |
| 500 | 500 | |
| 501 | 501 | </div> |
@@ -519,126 +519,126 @@ discard block |
||
| 519 | 519 | } |
| 520 | 520 | </style> |
| 521 | 521 | <?php |
| 522 | - } |
|
| 523 | - } |
|
| 524 | - |
|
| 525 | - /** |
|
| 526 | - * Check a version number is valid and if so return it or else return an empty string. |
|
| 527 | - * |
|
| 528 | - * @param $version string The version number to check. |
|
| 529 | - * |
|
| 530 | - * @since 1.0.6 |
|
| 531 | - * |
|
| 532 | - * @return string Either a valid version number or an empty string. |
|
| 533 | - */ |
|
| 534 | - public function validate_version_number( $version ) { |
|
| 535 | - |
|
| 536 | - if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
| 537 | - // valid |
|
| 538 | - } else { |
|
| 539 | - $version = '';// not validated |
|
| 540 | - } |
|
| 541 | - |
|
| 542 | - return $version; |
|
| 543 | - } |
|
| 544 | - |
|
| 545 | - |
|
| 546 | - /** |
|
| 547 | - * Get the latest version of Font Awesome. |
|
| 548 | - * |
|
| 549 | - * We check for a cached version and if none we will check for a live version via API and then cache it for 48 hours. |
|
| 550 | - * |
|
| 551 | - * @since 1.0.7 |
|
| 552 | - * @return mixed|string The latest version number found. |
|
| 553 | - */ |
|
| 554 | - public function get_latest_version( $force_api = false ) { |
|
| 555 | - $latest_version = $this->latest; |
|
| 556 | - |
|
| 557 | - $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
| 558 | - |
|
| 559 | - if ( $cache === false || $force_api ) { // its not set |
|
| 560 | - $api_ver = $this->get_latest_version_from_api(); |
|
| 561 | - if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
| 562 | - $latest_version = $api_ver; |
|
| 563 | - set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
| 564 | - } |
|
| 565 | - } elseif ( $this->validate_version_number( $cache ) ) { |
|
| 566 | - if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
| 567 | - $latest_version = $cache; |
|
| 568 | - } |
|
| 569 | - } |
|
| 570 | - |
|
| 571 | - return $latest_version; |
|
| 572 | - } |
|
| 573 | - |
|
| 574 | - /** |
|
| 575 | - * Get the latest Font Awesome version from the github API. |
|
| 576 | - * |
|
| 577 | - * @since 1.0.7 |
|
| 578 | - * @return string The latest version number or `0` on API fail. |
|
| 579 | - */ |
|
| 580 | - public function get_latest_version_from_api() { |
|
| 581 | - $version = "0"; |
|
| 582 | - $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
| 583 | - if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
| 584 | - $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 585 | - if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
| 586 | - $version = $api_response['tag_name']; |
|
| 587 | - } |
|
| 588 | - } |
|
| 589 | - |
|
| 590 | - return $version; |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - /** |
|
| 594 | - * Inline CSS for RTL language support. |
|
| 595 | - * |
|
| 596 | - * @since 1.0.13 |
|
| 597 | - * @return string Inline CSS. |
|
| 598 | - */ |
|
| 599 | - public function rtl_inline_css() { |
|
| 600 | - $inline_css = '[dir=rtl] .fa-address,[dir=rtl] .fa-address-card,[dir=rtl] .fa-adjust,[dir=rtl] .fa-alarm-clock,[dir=rtl] .fa-align-left,[dir=rtl] .fa-align-right,[dir=rtl] .fa-analytics,[dir=rtl] .fa-angle-double-left,[dir=rtl] .fa-angle-double-right,[dir=rtl] .fa-angle-left,[dir=rtl] .fa-angle-right,[dir=rtl] .fa-arrow-alt-circle-left,[dir=rtl] .fa-arrow-alt-circle-right,[dir=rtl] .fa-arrow-alt-from-left,[dir=rtl] .fa-arrow-alt-from-right,[dir=rtl] .fa-arrow-alt-left,[dir=rtl] .fa-arrow-alt-right,[dir=rtl] .fa-arrow-alt-square-left,[dir=rtl] .fa-arrow-alt-square-right,[dir=rtl] .fa-arrow-alt-to-left,[dir=rtl] .fa-arrow-alt-to-right,[dir=rtl] .fa-arrow-circle-left,[dir=rtl] .fa-arrow-circle-right,[dir=rtl] .fa-arrow-from-left,[dir=rtl] .fa-arrow-from-right,[dir=rtl] .fa-arrow-left,[dir=rtl] .fa-arrow-right,[dir=rtl] .fa-arrow-square-left,[dir=rtl] .fa-arrow-square-right,[dir=rtl] .fa-arrow-to-left,[dir=rtl] .fa-arrow-to-right,[dir=rtl] .fa-balance-scale-left,[dir=rtl] .fa-balance-scale-right,[dir=rtl] .fa-bed,[dir=rtl] .fa-bed-bunk,[dir=rtl] .fa-bed-empty,[dir=rtl] .fa-border-left,[dir=rtl] .fa-border-right,[dir=rtl] .fa-calendar-check,[dir=rtl] .fa-caret-circle-left,[dir=rtl] .fa-caret-circle-right,[dir=rtl] .fa-caret-left,[dir=rtl] .fa-caret-right,[dir=rtl] .fa-caret-square-left,[dir=rtl] .fa-caret-square-right,[dir=rtl] .fa-cart-arrow-down,[dir=rtl] .fa-cart-plus,[dir=rtl] .fa-chart-area,[dir=rtl] .fa-chart-bar,[dir=rtl] .fa-chart-line,[dir=rtl] .fa-chart-line-down,[dir=rtl] .fa-chart-network,[dir=rtl] .fa-chart-pie,[dir=rtl] .fa-chart-pie-alt,[dir=rtl] .fa-chart-scatter,[dir=rtl] .fa-check-circle,[dir=rtl] .fa-check-square,[dir=rtl] .fa-chevron-circle-left,[dir=rtl] .fa-chevron-circle-right,[dir=rtl] .fa-chevron-double-left,[dir=rtl] .fa-chevron-double-right,[dir=rtl] .fa-chevron-left,[dir=rtl] .fa-chevron-right,[dir=rtl] .fa-chevron-square-left,[dir=rtl] .fa-chevron-square-right,[dir=rtl] .fa-clock,[dir=rtl] .fa-file,[dir=rtl] .fa-file-alt,[dir=rtl] .fa-file-archive,[dir=rtl] .fa-file-audio,[dir=rtl] .fa-file-chart-line,[dir=rtl] .fa-file-chart-pie,[dir=rtl] .fa-file-code,[dir=rtl] .fa-file-excel,[dir=rtl] .fa-file-image,[dir=rtl] .fa-file-pdf,[dir=rtl] .fa-file-powerpoint,[dir=rtl] .fa-file-video,[dir=rtl] .fa-file-word,[dir=rtl] .fa-flag,[dir=rtl] .fa-folder,[dir=rtl] .fa-folder-open,[dir=rtl] .fa-hand-lizard,[dir=rtl] .fa-hand-point-down,[dir=rtl] .fa-hand-point-left,[dir=rtl] .fa-hand-point-right,[dir=rtl] .fa-hand-point-up,[dir=rtl] .fa-hand-scissors,[dir=rtl] .fa-image,[dir=rtl] .fa-long-arrow-alt-left,[dir=rtl] .fa-long-arrow-alt-right,[dir=rtl] .fa-long-arrow-left,[dir=rtl] .fa-long-arrow-right,[dir=rtl] .fa-luggage-cart,[dir=rtl] .fa-moon,[dir=rtl] .fa-pencil,[dir=rtl] .fa-pencil-alt,[dir=rtl] .fa-play-circle,[dir=rtl] .fa-project-diagram,[dir=rtl] .fa-quote-left,[dir=rtl] .fa-quote-right,[dir=rtl] .fa-shopping-cart,[dir=rtl] .fa-thumbs-down,[dir=rtl] .fa-thumbs-up,[dir=rtl] .fa-user-chart{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);transform:scale(-1,1)}[dir=rtl] .fa-spin{animation-direction:reverse}'; |
|
| 601 | - |
|
| 602 | - return $inline_css; |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * Show any warnings as an admin notice. |
|
| 607 | - * |
|
| 608 | - * @return void |
|
| 609 | - */ |
|
| 610 | - public function admin_notices(){ |
|
| 611 | - $settings = $this->settings; |
|
| 612 | - |
|
| 613 | - if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 614 | - |
|
| 615 | - if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) { |
|
| 616 | - ?> |
|
| 522 | + } |
|
| 523 | + } |
|
| 524 | + |
|
| 525 | + /** |
|
| 526 | + * Check a version number is valid and if so return it or else return an empty string. |
|
| 527 | + * |
|
| 528 | + * @param $version string The version number to check. |
|
| 529 | + * |
|
| 530 | + * @since 1.0.6 |
|
| 531 | + * |
|
| 532 | + * @return string Either a valid version number or an empty string. |
|
| 533 | + */ |
|
| 534 | + public function validate_version_number( $version ) { |
|
| 535 | + |
|
| 536 | + if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
| 537 | + // valid |
|
| 538 | + } else { |
|
| 539 | + $version = '';// not validated |
|
| 540 | + } |
|
| 541 | + |
|
| 542 | + return $version; |
|
| 543 | + } |
|
| 544 | + |
|
| 545 | + |
|
| 546 | + /** |
|
| 547 | + * Get the latest version of Font Awesome. |
|
| 548 | + * |
|
| 549 | + * We check for a cached version and if none we will check for a live version via API and then cache it for 48 hours. |
|
| 550 | + * |
|
| 551 | + * @since 1.0.7 |
|
| 552 | + * @return mixed|string The latest version number found. |
|
| 553 | + */ |
|
| 554 | + public function get_latest_version( $force_api = false ) { |
|
| 555 | + $latest_version = $this->latest; |
|
| 556 | + |
|
| 557 | + $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
| 558 | + |
|
| 559 | + if ( $cache === false || $force_api ) { // its not set |
|
| 560 | + $api_ver = $this->get_latest_version_from_api(); |
|
| 561 | + if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
| 562 | + $latest_version = $api_ver; |
|
| 563 | + set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
| 564 | + } |
|
| 565 | + } elseif ( $this->validate_version_number( $cache ) ) { |
|
| 566 | + if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
| 567 | + $latest_version = $cache; |
|
| 568 | + } |
|
| 569 | + } |
|
| 570 | + |
|
| 571 | + return $latest_version; |
|
| 572 | + } |
|
| 573 | + |
|
| 574 | + /** |
|
| 575 | + * Get the latest Font Awesome version from the github API. |
|
| 576 | + * |
|
| 577 | + * @since 1.0.7 |
|
| 578 | + * @return string The latest version number or `0` on API fail. |
|
| 579 | + */ |
|
| 580 | + public function get_latest_version_from_api() { |
|
| 581 | + $version = "0"; |
|
| 582 | + $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
| 583 | + if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
| 584 | + $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 585 | + if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
| 586 | + $version = $api_response['tag_name']; |
|
| 587 | + } |
|
| 588 | + } |
|
| 589 | + |
|
| 590 | + return $version; |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + /** |
|
| 594 | + * Inline CSS for RTL language support. |
|
| 595 | + * |
|
| 596 | + * @since 1.0.13 |
|
| 597 | + * @return string Inline CSS. |
|
| 598 | + */ |
|
| 599 | + public function rtl_inline_css() { |
|
| 600 | + $inline_css = '[dir=rtl] .fa-address,[dir=rtl] .fa-address-card,[dir=rtl] .fa-adjust,[dir=rtl] .fa-alarm-clock,[dir=rtl] .fa-align-left,[dir=rtl] .fa-align-right,[dir=rtl] .fa-analytics,[dir=rtl] .fa-angle-double-left,[dir=rtl] .fa-angle-double-right,[dir=rtl] .fa-angle-left,[dir=rtl] .fa-angle-right,[dir=rtl] .fa-arrow-alt-circle-left,[dir=rtl] .fa-arrow-alt-circle-right,[dir=rtl] .fa-arrow-alt-from-left,[dir=rtl] .fa-arrow-alt-from-right,[dir=rtl] .fa-arrow-alt-left,[dir=rtl] .fa-arrow-alt-right,[dir=rtl] .fa-arrow-alt-square-left,[dir=rtl] .fa-arrow-alt-square-right,[dir=rtl] .fa-arrow-alt-to-left,[dir=rtl] .fa-arrow-alt-to-right,[dir=rtl] .fa-arrow-circle-left,[dir=rtl] .fa-arrow-circle-right,[dir=rtl] .fa-arrow-from-left,[dir=rtl] .fa-arrow-from-right,[dir=rtl] .fa-arrow-left,[dir=rtl] .fa-arrow-right,[dir=rtl] .fa-arrow-square-left,[dir=rtl] .fa-arrow-square-right,[dir=rtl] .fa-arrow-to-left,[dir=rtl] .fa-arrow-to-right,[dir=rtl] .fa-balance-scale-left,[dir=rtl] .fa-balance-scale-right,[dir=rtl] .fa-bed,[dir=rtl] .fa-bed-bunk,[dir=rtl] .fa-bed-empty,[dir=rtl] .fa-border-left,[dir=rtl] .fa-border-right,[dir=rtl] .fa-calendar-check,[dir=rtl] .fa-caret-circle-left,[dir=rtl] .fa-caret-circle-right,[dir=rtl] .fa-caret-left,[dir=rtl] .fa-caret-right,[dir=rtl] .fa-caret-square-left,[dir=rtl] .fa-caret-square-right,[dir=rtl] .fa-cart-arrow-down,[dir=rtl] .fa-cart-plus,[dir=rtl] .fa-chart-area,[dir=rtl] .fa-chart-bar,[dir=rtl] .fa-chart-line,[dir=rtl] .fa-chart-line-down,[dir=rtl] .fa-chart-network,[dir=rtl] .fa-chart-pie,[dir=rtl] .fa-chart-pie-alt,[dir=rtl] .fa-chart-scatter,[dir=rtl] .fa-check-circle,[dir=rtl] .fa-check-square,[dir=rtl] .fa-chevron-circle-left,[dir=rtl] .fa-chevron-circle-right,[dir=rtl] .fa-chevron-double-left,[dir=rtl] .fa-chevron-double-right,[dir=rtl] .fa-chevron-left,[dir=rtl] .fa-chevron-right,[dir=rtl] .fa-chevron-square-left,[dir=rtl] .fa-chevron-square-right,[dir=rtl] .fa-clock,[dir=rtl] .fa-file,[dir=rtl] .fa-file-alt,[dir=rtl] .fa-file-archive,[dir=rtl] .fa-file-audio,[dir=rtl] .fa-file-chart-line,[dir=rtl] .fa-file-chart-pie,[dir=rtl] .fa-file-code,[dir=rtl] .fa-file-excel,[dir=rtl] .fa-file-image,[dir=rtl] .fa-file-pdf,[dir=rtl] .fa-file-powerpoint,[dir=rtl] .fa-file-video,[dir=rtl] .fa-file-word,[dir=rtl] .fa-flag,[dir=rtl] .fa-folder,[dir=rtl] .fa-folder-open,[dir=rtl] .fa-hand-lizard,[dir=rtl] .fa-hand-point-down,[dir=rtl] .fa-hand-point-left,[dir=rtl] .fa-hand-point-right,[dir=rtl] .fa-hand-point-up,[dir=rtl] .fa-hand-scissors,[dir=rtl] .fa-image,[dir=rtl] .fa-long-arrow-alt-left,[dir=rtl] .fa-long-arrow-alt-right,[dir=rtl] .fa-long-arrow-left,[dir=rtl] .fa-long-arrow-right,[dir=rtl] .fa-luggage-cart,[dir=rtl] .fa-moon,[dir=rtl] .fa-pencil,[dir=rtl] .fa-pencil-alt,[dir=rtl] .fa-play-circle,[dir=rtl] .fa-project-diagram,[dir=rtl] .fa-quote-left,[dir=rtl] .fa-quote-right,[dir=rtl] .fa-shopping-cart,[dir=rtl] .fa-thumbs-down,[dir=rtl] .fa-thumbs-up,[dir=rtl] .fa-user-chart{filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);transform:scale(-1,1)}[dir=rtl] .fa-spin{animation-direction:reverse}'; |
|
| 601 | + |
|
| 602 | + return $inline_css; |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * Show any warnings as an admin notice. |
|
| 607 | + * |
|
| 608 | + * @return void |
|
| 609 | + */ |
|
| 610 | + public function admin_notices(){ |
|
| 611 | + $settings = $this->settings; |
|
| 612 | + |
|
| 613 | + if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 614 | + |
|
| 615 | + if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) { |
|
| 616 | + ?> |
|
| 617 | 617 | <div class="notice notice-error is-dismissible"> |
| 618 | 618 | <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p> |
| 619 | 619 | </div> |
| 620 | 620 | <?php |
| 621 | - } |
|
| 621 | + } |
|
| 622 | 622 | |
| 623 | - }else{ |
|
| 624 | - if ( ! empty( $settings ) ) { |
|
| 625 | - if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) { |
|
| 626 | - $link = admin_url('options-general.php?page=wp-font-awesome-settings'); |
|
| 627 | - ?> |
|
| 623 | + }else{ |
|
| 624 | + if ( ! empty( $settings ) ) { |
|
| 625 | + if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) { |
|
| 626 | + $link = admin_url('options-general.php?page=wp-font-awesome-settings'); |
|
| 627 | + ?> |
|
| 628 | 628 | <div class="notice notice-error is-dismissible"> |
| 629 | 629 | <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> |
| 630 | 630 | </div> |
| 631 | 631 | <?php |
| 632 | - } |
|
| 633 | - } |
|
| 634 | - } |
|
| 632 | + } |
|
| 633 | + } |
|
| 634 | + } |
|
| 635 | 635 | |
| 636 | - } |
|
| 636 | + } |
|
| 637 | 637 | |
| 638 | - } |
|
| 638 | + } |
|
| 639 | 639 | |
| 640 | - /** |
|
| 641 | - * Run the class if found. |
|
| 642 | - */ |
|
| 643 | - WP_Font_Awesome_Settings::instance(); |
|
| 640 | + /** |
|
| 641 | + * Run the class if found. |
|
| 642 | + */ |
|
| 643 | + WP_Font_Awesome_Settings::instance(); |
|
| 644 | 644 | } |
| 645 | 645 | \ No newline at end of file |
@@ -12,14 +12,14 @@ discard block |
||
| 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. |
@@ -89,18 +89,18 @@ discard block |
||
| 89 | 89 | * @return WP_Font_Awesome_Settings - Main instance. |
| 90 | 90 | */ |
| 91 | 91 | public static function instance() { |
| 92 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) { |
|
| 92 | + if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) { |
|
| 93 | 93 | self::$instance = new WP_Font_Awesome_Settings; |
| 94 | 94 | |
| 95 | - add_action( 'init', array( self::$instance, 'init' ) ); // set settings |
|
| 95 | + add_action('init', array(self::$instance, 'init')); // set settings |
|
| 96 | 96 | |
| 97 | - if ( is_admin() ) { |
|
| 98 | - add_action( 'admin_menu', array( self::$instance, 'menu_item' ) ); |
|
| 99 | - add_action( 'admin_init', array( self::$instance, 'register_settings' ) ); |
|
| 100 | - add_action( 'admin_notices', array( self::$instance, 'admin_notices' ) ); |
|
| 97 | + if (is_admin()) { |
|
| 98 | + add_action('admin_menu', array(self::$instance, 'menu_item')); |
|
| 99 | + add_action('admin_init', array(self::$instance, 'register_settings')); |
|
| 100 | + add_action('admin_notices', array(self::$instance, 'admin_notices')); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - do_action( 'wp_font_awesome_settings_loaded' ); |
|
| 103 | + do_action('wp_font_awesome_settings_loaded'); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return self::$instance; |
@@ -115,32 +115,32 @@ discard block |
||
| 115 | 115 | $this->settings = $this->get_settings(); |
| 116 | 116 | |
| 117 | 117 | // check if the official plugin is active and use that instead if so. |
| 118 | - if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 118 | + if (!defined('FONTAWESOME_PLUGIN_FILE')) { |
|
| 119 | 119 | |
| 120 | - if ( $this->settings['type'] == 'CSS' ) { |
|
| 120 | + if ($this->settings['type'] == 'CSS') { |
|
| 121 | 121 | |
| 122 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 123 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 122 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 123 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 127 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 ); |
|
| 126 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 127 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | } else { |
| 131 | 131 | |
| 132 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) { |
|
| 133 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 132 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') { |
|
| 133 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) { |
|
| 137 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 ); |
|
| 136 | + if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') { |
|
| 137 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // remove font awesome if set to do so |
| 142 | - if ( $this->settings['dequeue'] == '1' ) { |
|
| 143 | - add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 ); |
|
| 142 | + if ($this->settings['dequeue'] == '1') { |
|
| 143 | + add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -153,20 +153,20 @@ discard block |
||
| 153 | 153 | // build url |
| 154 | 154 | $url = $this->get_url(); |
| 155 | 155 | |
| 156 | - wp_deregister_style( 'font-awesome' ); // deregister in case its already there |
|
| 157 | - wp_register_style( 'font-awesome', $url, array(), null ); |
|
| 158 | - wp_enqueue_style( 'font-awesome' ); |
|
| 156 | + wp_deregister_style('font-awesome'); // deregister in case its already there |
|
| 157 | + wp_register_style('font-awesome', $url, array(), null); |
|
| 158 | + wp_enqueue_style('font-awesome'); |
|
| 159 | 159 | |
| 160 | 160 | // RTL language support CSS. |
| 161 | - if ( is_rtl() ) { |
|
| 162 | - wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() ); |
|
| 161 | + if (is_rtl()) { |
|
| 162 | + wp_add_inline_style('font-awesome', $this->rtl_inline_css()); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( $this->settings['shims'] ) { |
|
| 166 | - $url = $this->get_url( true ); |
|
| 167 | - wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there |
|
| 168 | - wp_register_style( 'font-awesome-shims', $url, array(), null ); |
|
| 169 | - wp_enqueue_style( 'font-awesome-shims' ); |
|
| 165 | + if ($this->settings['shims']) { |
|
| 166 | + $url = $this->get_url(true); |
|
| 167 | + wp_deregister_style('font-awesome-shims'); // deregister in case its already there |
|
| 168 | + wp_register_style('font-awesome-shims', $url, array(), null); |
|
| 169 | + wp_enqueue_style('font-awesome-shims'); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | $url = $this->get_url(); |
| 179 | 179 | |
| 180 | 180 | $deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script'; |
| 181 | - call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there |
|
| 182 | - wp_register_script( 'font-awesome', $url, array(), null ); |
|
| 183 | - wp_enqueue_script( 'font-awesome' ); |
|
| 184 | - |
|
| 185 | - if ( $this->settings['shims'] ) { |
|
| 186 | - $url = $this->get_url( true ); |
|
| 187 | - call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there |
|
| 188 | - wp_register_script( 'font-awesome-shims', $url, array(), null ); |
|
| 189 | - wp_enqueue_script( 'font-awesome-shims' ); |
|
| 181 | + call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there |
|
| 182 | + wp_register_script('font-awesome', $url, array(), null); |
|
| 183 | + wp_enqueue_script('font-awesome'); |
|
| 184 | + |
|
| 185 | + if ($this->settings['shims']) { |
|
| 186 | + $url = $this->get_url(true); |
|
| 187 | + call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there |
|
| 188 | + wp_register_script('font-awesome-shims', $url, array(), null); |
|
| 189 | + wp_enqueue_script('font-awesome-shims'); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -197,16 +197,16 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @return string The url to the file. |
| 199 | 199 | */ |
| 200 | - public function get_url( $shims = false ) { |
|
| 200 | + public function get_url($shims = false) { |
|
| 201 | 201 | $script = $shims ? 'v4-shims' : 'all'; |
| 202 | 202 | $sub = $this->settings['pro'] ? 'pro' : 'use'; |
| 203 | 203 | $type = $this->settings['type']; |
| 204 | 204 | $version = $this->settings['version']; |
| 205 | - $kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : ''; |
|
| 205 | + $kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : ''; |
|
| 206 | 206 | $url = ''; |
| 207 | 207 | |
| 208 | - if ( $type == 'KIT' && $kit_url ) { |
|
| 209 | - if ( $shims ) { |
|
| 208 | + if ($type == 'KIT' && $kit_url) { |
|
| 209 | + if ($shims) { |
|
| 210 | 210 | // if its a kit then we don't add shims here |
| 211 | 211 | return ''; |
| 212 | 212 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $url .= "?wpfas=true"; // set our var so our version is not removed |
| 215 | 215 | } else { |
| 216 | 216 | $url .= "https://$sub.fontawesome.com/releases/"; // CDN |
| 217 | - $url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 217 | + $url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version |
|
| 218 | 218 | $url .= $type == 'CSS' ? 'css/' : 'js/'; // type |
| 219 | 219 | $url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type |
| 220 | 220 | $url .= "?wpfas=true"; // set our var so our version is not removed |
@@ -234,16 +234,16 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return string The filtered url. |
| 236 | 236 | */ |
| 237 | - public function remove_font_awesome( $url, $original_url, $_context ) { |
|
| 237 | + public function remove_font_awesome($url, $original_url, $_context) { |
|
| 238 | 238 | |
| 239 | - if ( $_context == 'display' |
|
| 240 | - && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false ) |
|
| 241 | - && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false ) |
|
| 239 | + if ($_context == 'display' |
|
| 240 | + && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false) |
|
| 241 | + && (strstr($url, ".js") !== false || strstr($url, ".css") !== false) |
|
| 242 | 242 | ) {// it's a font-awesome-url (probably) |
| 243 | 243 | |
| 244 | - if ( strstr( $url, "wpfas=true" ) !== false ) { |
|
| 245 | - if ( $this->settings['type'] == 'JS' ) { |
|
| 246 | - if ( $this->settings['js-pseudo'] ) { |
|
| 244 | + if (strstr($url, "wpfas=true") !== false) { |
|
| 245 | + if ($this->settings['type'] == 'JS') { |
|
| 246 | + if ($this->settings['js-pseudo']) { |
|
| 247 | 247 | $url .= "' data-search-pseudo-elements defer='defer"; |
| 248 | 248 | } else { |
| 249 | 249 | $url .= "' defer='defer"; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * Register the database settings with WordPress. |
| 263 | 263 | */ |
| 264 | 264 | public function register_settings() { |
| 265 | - register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' ); |
|
| 265 | + register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings'); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function menu_item() { |
| 273 | 273 | $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme |
| 274 | - call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 274 | + call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array( |
|
| 275 | 275 | $this, |
| 276 | 276 | 'settings_page' |
| 277 | - ) ); |
|
| 277 | + )); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function get_settings() { |
| 286 | 286 | |
| 287 | - $db_settings = get_option( 'wp-font-awesome-settings' ); |
|
| 287 | + $db_settings = get_option('wp-font-awesome-settings'); |
|
| 288 | 288 | |
| 289 | 289 | $defaults = array( |
| 290 | 290 | 'type' => 'CSS', // type to use, CSS or JS or KIT |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | 'kit-url' => '', // the kit url |
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | - $settings = wp_parse_args( $db_settings, $defaults ); |
|
| 300 | + $settings = wp_parse_args($db_settings, $defaults); |
|
| 301 | 301 | |
| 302 | 302 | /** |
| 303 | 303 | * Filter the Font Awesome settings. |
| 304 | 304 | * |
| 305 | 305 | * @todo if we add this filer people might use it and then it defeates the purpose of this class :/ |
| 306 | 306 | */ |
| 307 | - return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults ); |
|
| 307 | + return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | * The settings page html output. |
| 313 | 313 | */ |
| 314 | 314 | public function settings_page() { |
| 315 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 316 | - wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) ); |
|
| 315 | + if (!current_user_can('manage_options')) { |
|
| 316 | + wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings')); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | // a hidden way to force the update of the version number via api instead of waiting the 48 hours |
| 320 | - if ( isset( $_REQUEST['force-version-check'] ) ) { |
|
| 321 | - $this->get_latest_version( $force_api = true ); |
|
| 320 | + if (isset($_REQUEST['force-version-check'])) { |
|
| 321 | + $this->get_latest_version($force_api = true); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if ( ! defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 324 | + if (!defined('FONTAWESOME_PLUGIN_FILE')) { |
|
| 325 | 325 | ?> |
| 326 | 326 | <style> |
| 327 | 327 | .wpfas-kit-show { |
@@ -340,37 +340,37 @@ discard block |
||
| 340 | 340 | <h1><?php echo $this->name; ?></h1> |
| 341 | 341 | <form method="post" action="options.php" class="fas-settings-form"> |
| 342 | 342 | <?php |
| 343 | - settings_fields( 'wp-font-awesome-settings' ); |
|
| 344 | - do_settings_sections( 'wp-font-awesome-settings' ); |
|
| 343 | + settings_fields('wp-font-awesome-settings'); |
|
| 344 | + do_settings_sections('wp-font-awesome-settings'); |
|
| 345 | 345 | $kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : ''; |
| 346 | 346 | ?> |
| 347 | - <table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>"> |
|
| 347 | + <table class="form-table wpfas-table-settings <?php echo esc_attr($kit_set); ?>"> |
|
| 348 | 348 | <tr valign="top"> |
| 349 | 349 | <th scope="row"><label |
| 350 | - for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th> |
|
| 350 | + for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th> |
|
| 351 | 351 | <td> |
| 352 | 352 | <select name="wp-font-awesome-settings[type]" id="wpfas-type" |
| 353 | 353 | onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}"> |
| 354 | 354 | <option |
| 355 | - value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option> |
|
| 356 | - <option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option> |
|
| 355 | + value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option> |
|
| 356 | + <option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option> |
|
| 357 | 357 | <option |
| 358 | - value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option> |
|
| 358 | + value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option> |
|
| 359 | 359 | </select> |
| 360 | 360 | </td> |
| 361 | 361 | </tr> |
| 362 | 362 | |
| 363 | 363 | <tr valign="top" class="wpfas-kit-show"> |
| 364 | 364 | <th scope="row"><label |
| 365 | - for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th> |
|
| 365 | + for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th> |
|
| 366 | 366 | <td> |
| 367 | 367 | <input class="regular-text" id="wpfas-kit-url" type="url" |
| 368 | 368 | name="wp-font-awesome-settings[kit-url]" |
| 369 | - value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>" |
|
| 370 | - placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
| 369 | + value="<?php echo esc_attr($this->settings['kit-url']); ?>" |
|
| 370 | + placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/> |
|
| 371 | 371 | <span><?php |
| 372 | 372 | echo sprintf( |
| 373 | - __( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ), |
|
| 373 | + __('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'), |
|
| 374 | 374 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>', |
| 375 | 375 | '</a>' |
| 376 | 376 | ); |
@@ -380,40 +380,40 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | <tr valign="top" class="wpfas-kit-hide"> |
| 382 | 382 | <th scope="row"><label |
| 383 | - for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th> |
|
| 383 | + for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th> |
|
| 384 | 384 | <td> |
| 385 | 385 | <select name="wp-font-awesome-settings[version]" id="wpfas-version"> |
| 386 | 386 | <option |
| 387 | - value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?> |
|
| 387 | + value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?> |
|
| 388 | 388 | </option> |
| 389 | - <option value="6.1.0" <?php selected( $this->settings['version'], '6.1.0' ); ?>> |
|
| 389 | + <option value="6.1.0" <?php selected($this->settings['version'], '6.1.0'); ?>> |
|
| 390 | 390 | 6.1.0 |
| 391 | 391 | </option> |
| 392 | - <option value="6.0.0" <?php selected( $this->settings['version'], '6.0.0' ); ?>> |
|
| 392 | + <option value="6.0.0" <?php selected($this->settings['version'], '6.0.0'); ?>> |
|
| 393 | 393 | 6.0.0 |
| 394 | 394 | </option> |
| 395 | - <option value="5.15.4" <?php selected( $this->settings['version'], '5.15.4' ); ?>> |
|
| 395 | + <option value="5.15.4" <?php selected($this->settings['version'], '5.15.4'); ?>> |
|
| 396 | 396 | 5.15.4 |
| 397 | 397 | </option> |
| 398 | - <option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>> |
|
| 398 | + <option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>> |
|
| 399 | 399 | 5.6.0 |
| 400 | 400 | </option> |
| 401 | - <option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>> |
|
| 401 | + <option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>> |
|
| 402 | 402 | 5.5.0 |
| 403 | 403 | </option> |
| 404 | - <option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>> |
|
| 404 | + <option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>> |
|
| 405 | 405 | 5.4.0 |
| 406 | 406 | </option> |
| 407 | - <option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>> |
|
| 407 | + <option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>> |
|
| 408 | 408 | 5.3.0 |
| 409 | 409 | </option> |
| 410 | - <option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>> |
|
| 410 | + <option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>> |
|
| 411 | 411 | 5.2.0 |
| 412 | 412 | </option> |
| 413 | - <option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>> |
|
| 413 | + <option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>> |
|
| 414 | 414 | 5.1.0 |
| 415 | 415 | </option> |
| 416 | - <option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>> |
|
| 416 | + <option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>> |
|
| 417 | 417 | 4.7.1 (CSS only) |
| 418 | 418 | </option> |
| 419 | 419 | </select> |
@@ -422,29 +422,29 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | <tr valign="top"> |
| 424 | 424 | <th scope="row"><label |
| 425 | - for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th> |
|
| 425 | + for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th> |
|
| 426 | 426 | <td> |
| 427 | 427 | <select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue"> |
| 428 | 428 | <option |
| 429 | - value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option> |
|
| 429 | + value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option> |
|
| 430 | 430 | <option |
| 431 | - value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option> |
|
| 431 | + value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option> |
|
| 432 | 432 | <option |
| 433 | - value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option> |
|
| 433 | + value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option> |
|
| 434 | 434 | </select> |
| 435 | 435 | </td> |
| 436 | 436 | </tr> |
| 437 | 437 | |
| 438 | 438 | <tr valign="top" class="wpfas-kit-hide"> |
| 439 | 439 | <th scope="row"><label |
| 440 | - for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th> |
|
| 440 | + for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th> |
|
| 441 | 441 | <td> |
| 442 | 442 | <input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/> |
| 443 | 443 | <input type="checkbox" name="wp-font-awesome-settings[pro]" |
| 444 | - value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/> |
|
| 444 | + value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro"/> |
|
| 445 | 445 | <span><?php |
| 446 | 446 | echo sprintf( |
| 447 | - __( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ), |
|
| 447 | + __('Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings'), |
|
| 448 | 448 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/referral?a=c9b89e1418">', |
| 449 | 449 | ' <i class="fas fa-external-link-alt"></i></a>', |
| 450 | 450 | '<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn">', |
@@ -456,38 +456,38 @@ discard block |
||
| 456 | 456 | |
| 457 | 457 | <tr valign="top" class="wpfas-kit-hide"> |
| 458 | 458 | <th scope="row"><label |
| 459 | - for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label> |
|
| 459 | + for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label> |
|
| 460 | 460 | </th> |
| 461 | 461 | <td> |
| 462 | 462 | <input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/> |
| 463 | 463 | <input type="checkbox" name="wp-font-awesome-settings[shims]" |
| 464 | - value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/> |
|
| 465 | - <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> |
|
| 464 | + value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/> |
|
| 465 | + <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> |
|
| 466 | 466 | </td> |
| 467 | 467 | </tr> |
| 468 | 468 | |
| 469 | 469 | <tr valign="top" class="wpfas-kit-hide"> |
| 470 | 470 | <th scope="row"><label |
| 471 | - for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label> |
|
| 471 | + for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label> |
|
| 472 | 472 | </th> |
| 473 | 473 | <td> |
| 474 | 474 | <input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/> |
| 475 | 475 | <input type="checkbox" name="wp-font-awesome-settings[js-pseudo]" |
| 476 | - value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?> |
|
| 476 | + value="1" <?php checked($this->settings['js-pseudo'], '1'); ?> |
|
| 477 | 477 | id="wpfas-js-pseudo"/> |
| 478 | - <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> |
|
| 478 | + <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> |
|
| 479 | 479 | </td> |
| 480 | 480 | </tr> |
| 481 | 481 | |
| 482 | 482 | <tr valign="top"> |
| 483 | 483 | <th scope="row"><label |
| 484 | - for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th> |
|
| 484 | + for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th> |
|
| 485 | 485 | <td> |
| 486 | 486 | <input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/> |
| 487 | 487 | <input type="checkbox" name="wp-font-awesome-settings[dequeue]" |
| 488 | - value="1" <?php checked( $this->settings['dequeue'], '1' ); ?> |
|
| 488 | + value="1" <?php checked($this->settings['dequeue'], '1'); ?> |
|
| 489 | 489 | id="wpfas-dequeue"/> |
| 490 | - <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> |
|
| 490 | + <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> |
|
| 491 | 491 | </td> |
| 492 | 492 | </tr> |
| 493 | 493 | |
@@ -496,12 +496,12 @@ discard block |
||
| 496 | 496 | <?php |
| 497 | 497 | submit_button(); |
| 498 | 498 | ?> |
| 499 | - <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> |
|
| 499 | + <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> |
|
| 500 | 500 | |
| 501 | 501 | </div> |
| 502 | 502 | </form> |
| 503 | 503 | |
| 504 | - <div id="wpfas-version"><?php echo sprintf(__( 'Version: %s (affiliate links provided)', 'font-awesome-settings' ), $this->version ); ?></div> |
|
| 504 | + <div id="wpfas-version"><?php echo sprintf(__('Version: %s (affiliate links provided)', 'font-awesome-settings'), $this->version); ?></div> |
|
| 505 | 505 | </div> |
| 506 | 506 | |
| 507 | 507 | <style> |
@@ -531,12 +531,12 @@ discard block |
||
| 531 | 531 | * |
| 532 | 532 | * @return string Either a valid version number or an empty string. |
| 533 | 533 | */ |
| 534 | - public function validate_version_number( $version ) { |
|
| 534 | + public function validate_version_number($version) { |
|
| 535 | 535 | |
| 536 | - if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) { |
|
| 536 | + if (version_compare($version, '0.0.1', '>=') >= 0) { |
|
| 537 | 537 | // valid |
| 538 | 538 | } else { |
| 539 | - $version = '';// not validated |
|
| 539 | + $version = ''; // not validated |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | return $version; |
@@ -551,19 +551,19 @@ discard block |
||
| 551 | 551 | * @since 1.0.7 |
| 552 | 552 | * @return mixed|string The latest version number found. |
| 553 | 553 | */ |
| 554 | - public function get_latest_version( $force_api = false ) { |
|
| 554 | + public function get_latest_version($force_api = false) { |
|
| 555 | 555 | $latest_version = $this->latest; |
| 556 | 556 | |
| 557 | - $cache = get_transient( 'wp-font-awesome-settings-version' ); |
|
| 557 | + $cache = get_transient('wp-font-awesome-settings-version'); |
|
| 558 | 558 | |
| 559 | - if ( $cache === false || $force_api ) { // its not set |
|
| 559 | + if ($cache === false || $force_api) { // its not set |
|
| 560 | 560 | $api_ver = $this->get_latest_version_from_api(); |
| 561 | - if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) { |
|
| 561 | + if (version_compare($api_ver, $this->latest, '>=') >= 0) { |
|
| 562 | 562 | $latest_version = $api_ver; |
| 563 | - set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS ); |
|
| 563 | + set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS); |
|
| 564 | 564 | } |
| 565 | - } elseif ( $this->validate_version_number( $cache ) ) { |
|
| 566 | - if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) { |
|
| 565 | + } elseif ($this->validate_version_number($cache)) { |
|
| 566 | + if (version_compare($cache, $this->latest, '>=') >= 0) { |
|
| 567 | 567 | $latest_version = $cache; |
| 568 | 568 | } |
| 569 | 569 | } |
@@ -579,10 +579,10 @@ discard block |
||
| 579 | 579 | */ |
| 580 | 580 | public function get_latest_version_from_api() { |
| 581 | 581 | $version = "0"; |
| 582 | - $response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" ); |
|
| 583 | - if ( ! is_wp_error( $response ) && is_array( $response ) ) { |
|
| 584 | - $api_response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
| 585 | - if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) { |
|
| 582 | + $response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest"); |
|
| 583 | + if (!is_wp_error($response) && is_array($response)) { |
|
| 584 | + $api_response = json_decode(wp_remote_retrieve_body($response), true); |
|
| 585 | + if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) { |
|
| 586 | 586 | $version = $api_response['tag_name']; |
| 587 | 587 | } |
| 588 | 588 | } |
@@ -607,26 +607,26 @@ discard block |
||
| 607 | 607 | * |
| 608 | 608 | * @return void |
| 609 | 609 | */ |
| 610 | - public function admin_notices(){ |
|
| 610 | + public function admin_notices() { |
|
| 611 | 611 | $settings = $this->settings; |
| 612 | 612 | |
| 613 | - if ( defined( 'FONTAWESOME_PLUGIN_FILE' ) ) { |
|
| 613 | + if (defined('FONTAWESOME_PLUGIN_FILE')) { |
|
| 614 | 614 | |
| 615 | - if ( ! empty( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wp-font-awesome-settings' ) { |
|
| 615 | + if (!empty($_REQUEST['page']) && $_REQUEST['page'] == 'wp-font-awesome-settings') { |
|
| 616 | 616 | ?> |
| 617 | 617 | <div class="notice notice-error is-dismissible"> |
| 618 | - <p><?php _e( 'The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings' ); ?></p> |
|
| 618 | + <p><?php _e('The Official Font Awesome Plugin is active, please adjust your settings there.', 'font-awesome-settings'); ?></p> |
|
| 619 | 619 | </div> |
| 620 | 620 | <?php |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - }else{ |
|
| 624 | - if ( ! empty( $settings ) ) { |
|
| 625 | - if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) { |
|
| 623 | + } else { |
|
| 624 | + if (!empty($settings)) { |
|
| 625 | + if ($settings['type'] != 'KIT' && $settings['pro'] && ($settings['version'] == '' || version_compare($settings['version'], '6', '>='))) { |
|
| 626 | 626 | $link = admin_url('options-general.php?page=wp-font-awesome-settings'); |
| 627 | 627 | ?> |
| 628 | 628 | <div class="notice notice-error is-dismissible"> |
| 629 | - <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> |
|
| 629 | + <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> |
|
| 630 | 630 | </div> |
| 631 | 631 | <?php |
| 632 | 632 | } |
@@ -620,7 +620,7 @@ |
||
| 620 | 620 | <?php |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - }else{ |
|
| 623 | + } else{ |
|
| 624 | 624 | if ( ! empty( $settings ) ) { |
| 625 | 625 | if ( $settings['type'] != 'KIT' && $settings['pro'] && ( $settings['version'] == '' || version_compare( $settings['version'], '6', '>=' ) ) ) { |
| 626 | 626 | $link = admin_url('options-general.php?page=wp-font-awesome-settings'); |