| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | const FONT_ICON_SVG_CLASS_NAME = 'e-font-icon-svg'; |
| 24 | 24 | |
| 25 | 25 | const LOAD_FA4_SHIM_OPTION_KEY = 'elementor_load_fa4_shim'; |
| 26 | 26 | |
| 27 | - const ELEMENTOR_ICONS_VERSION = '5.50.0'; | |
| 27 | + const ELEMENTOR_ICONS_VERSION = '5.34.0'; | |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Tabs. |
| 31 | 31 | * |
| @@ -44,11 +44,11 @@ | ||
| 44 | 44 | return get_option( 'elementor_' . self::NEEDS_UPDATE_OPTION, null ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @param array $icon | |
| 49 | - * @param array $attributes | |
| 50 | - * @param string $tag | |
| 48 | + * @param $icon | |
| 49 | + * @param $attributes | |
| 50 | + * @param $tag | |
| 51 | 51 | * @return bool|mixed|string |
| 52 | 52 | */ |
| 53 | 53 | public static function try_get_icon_html( $icon, $attributes = [], $tag = 'i' ) { |
| 54 | 54 | if ( empty( $icon['library'] ) ) { |
| @@ -58,11 +58,11 @@ | ||
| 58 | 58 | return static::get_icon_html( $icon, $attributes, $tag ); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * @param array $icon | |
| 63 | - * @param array $attributes | |
| 64 | - * @param string $tag | |
| 62 | + * @param array $icon | |
| 63 | + * @param array $attributes | |
| 64 | + * @param $tag | |
| 65 | 65 | * @return bool|mixed|string |
| 66 | 66 | */ |
| 67 | 67 | private static function get_icon_html( array $icon, array $attributes, $tag ) { |
| 68 | 68 | /** |
| @@ -77,9 +77,9 @@ | ||
| 77 | 77 | return $output; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Register styles | |
| 81 | + * register styles | |
| 82 | 82 | * |
| 83 | 83 | * Used to register all icon types stylesheets so they could be enqueued later by widgets |
| 84 | 84 | */ |
| 85 | 85 | public function register_styles() { |
| @@ -178,9 +178,8 @@ | ||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Get Icon Manager Tabs |
| 182 | - * | |
| 183 | 182 | * @return array |
| 184 | 183 | */ |
| 185 | 184 | public static function get_icon_manager_tabs() { |
| 186 | 185 | if ( self::is_font_icon_inline_svg() && ! Plugin::$instance->editor->is_edit_mode() && ! Plugin::$instance->preview->is_preview_mode() ) { |
| @@ -230,9 +229,9 @@ | ||
| 230 | 229 | |
| 231 | 230 | private static function get_fa_asset_url( $filename, $ext_type = 'css', $add_suffix = true ) { |
| 232 | 231 | static $is_test_mode = null; |
| 233 | 232 | if ( null === $is_test_mode ) { |
| 234 | - $is_test_mode = Utils::is_script_debug() || Utils::is_elementor_tests(); | |
| 233 | + $is_test_mode = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'ELEMENTOR_TESTS' ) && ELEMENTOR_TESTS; | |
| 235 | 234 | } |
| 236 | 235 | $url = ELEMENTOR_ASSETS_URL . 'lib/font-awesome/' . $ext_type . '/' . $filename; |
| 237 | 236 | if ( ! $is_test_mode && $add_suffix ) { |
| 238 | 237 | $url .= '.min'; |
| @@ -253,8 +252,13 @@ | ||
| 253 | 252 | |
| 254 | 253 | return array_values( array_merge( $tabs, self::get_icon_manager_tabs() ) ); |
| 255 | 254 | } |
| 256 | 255 | |
| 256 | + /** | |
| 257 | + * is_font_awesome_inline | |
| 258 | + * | |
| 259 | + * @return bool | |
| 260 | + */ | |
| 257 | 261 | private static function is_font_icon_inline_svg() { |
| 258 | 262 | return Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' ); |
| 259 | 263 | } |
| 260 | 264 | |
| @@ -268,9 +272,8 @@ | ||
| 268 | 272 | } |
| 269 | 273 | |
| 270 | 274 | /** |
| 271 | 275 | * Get font awesome svg. |
| 272 | - * | |
| 273 | 276 | * @param $icon array [ 'value' => string, 'library' => string ] |
| 274 | 277 | * |
| 275 | 278 | * @return bool|mixed|string |
| 276 | 279 | */ |
| @@ -329,12 +332,14 @@ | ||
| 329 | 332 | |
| 330 | 333 | if ( ! $content ) { |
| 331 | 334 | if ( empty( $attributes['class'] ) ) { |
| 332 | 335 | $attributes['class'] = $icon['value']; |
| 333 | - } elseif ( is_array( $attributes['class'] ) ) { | |
| 336 | + } else { | |
| 337 | + if ( is_array( $attributes['class'] ) ) { | |
| 334 | 338 | $attributes['class'][] = $icon['value']; |
| 335 | - } else { | |
| 336 | - $attributes['class'] .= ' ' . $icon['value']; | |
| 339 | + } else { | |
| 340 | + $attributes['class'] .= ' ' . $icon['value']; | |
| 341 | + } | |
| 337 | 342 | } |
| 338 | 343 | } |
| 339 | 344 | |
| 340 | 345 | return '<' . $tag . ' ' . Utils::render_html_attributes( $attributes ) . '>' . $content . '</' . $tag . '>'; |
| @@ -343,13 +348,12 @@ | ||
| 343 | 348 | /** |
| 344 | 349 | * Render Icon |
| 345 | 350 | * |
| 346 | 351 | * Used to render Icon for \Elementor\Controls_Manager::ICONS |
| 352 | + * @param array $icon Icon Type, Icon value | |
| 353 | + * @param array $attributes Icon HTML Attributes | |
| 354 | + * @param string $tag Icon HTML tag, defaults to <i> | |
| 347 | 355 | * |
| 348 | - * @param array $icon Icon Type, Icon value. | |
| 349 | - * @param array $attributes Icon HTML Attributes. | |
| 350 | - * @param string $tag Icon HTML tag, defaults to <i>. | |
| 351 | - * | |
| 352 | 356 | * @return mixed|string |
| 353 | 357 | */ |
| 354 | 358 | public static function render_icon( $icon, $attributes = [], $tag = 'i' ) { |
| 355 | 359 | if ( empty( $icon['library'] ) ) { |
| @@ -365,9 +369,9 @@ | ||
| 365 | 369 | |
| 366 | 370 | /** |
| 367 | 371 | * Font Awesome 4 to font Awesome 5 Value Migration |
| 368 | 372 | * |
| 369 | - * Used to convert string value of Icon control to array value of Icons control | |
| 373 | + * used to convert string value of Icon control to array value of Icons control | |
| 370 | 374 | * ex: 'fa fa-star' => [ 'value' => 'fas fa-star', 'library' => 'fa-solid' ] |
| 371 | 375 | * |
| 372 | 376 | * @param $value |
| 373 | 377 | * |
| @@ -394,15 +398,14 @@ | ||
| 394 | 398 | ]; |
| 395 | 399 | } |
| 396 | 400 | |
| 397 | 401 | /** |
| 398 | - * On_import_migration | |
| 402 | + * on_import_migration | |
| 403 | + * @param array $element settings array | |
| 404 | + * @param string $old_control old control id | |
| 405 | + * @param string $new_control new control id | |
| 406 | + * @param bool $remove_old boolean whether to remove old control or not | |
| 399 | 407 | * |
| 400 | - * @param array $element settings array. | |
| 401 | - * @param string $old_control old control id. | |
| 402 | - * @param string $new_control new control id. | |
| 403 | - * @param bool $remove_old boolean whether to remove old control or not. | |
| 404 | - * | |
| 405 | 408 | * @return array |
| 406 | 409 | */ |
| 407 | 410 | public static function on_import_migration( array $element, $old_control = '', $new_control = '', $remove_old = false ) { |
| 408 | 411 | |
| @@ -422,9 +425,9 @@ | ||
| 422 | 425 | } |
| 423 | 426 | |
| 424 | 427 | $element['settings'][ $new_control ] = $new_value; |
| 425 | 428 | |
| 426 | - // remove old value | |
| 429 | + //remove old value | |
| 427 | 430 | if ( $remove_old ) { |
| 428 | 431 | unset( $element['settings'][ $old_control ] ); |
| 429 | 432 | } |
| 430 | 433 | |
| @@ -430,8 +433,12 @@ | ||
| 430 | 433 | |
| 431 | 434 | return $element; |
| 432 | 435 | } |
| 433 | 436 | |
| 437 | + /** | |
| 438 | + * is_migration_allowed | |
| 439 | + * @return bool | |
| 440 | + */ | |
| 434 | 441 | public static function is_migration_allowed() { |
| 435 | 442 | static $migration_allowed = false; |
| 436 | 443 | if ( false === $migration_allowed ) { |
| 437 | 444 | $migration_allowed = null === self::get_needs_upgrade_option(); |
| @@ -450,10 +457,9 @@ | ||
| 450 | 457 | |
| 451 | 458 | /** |
| 452 | 459 | * Register_Admin Settings |
| 453 | 460 | * |
| 454 | - * Adds Font Awesome migration / update admin settings | |
| 455 | - * | |
| 461 | + * adds Font Awesome migration / update admin settings | |
| 456 | 462 | * @param Settings $settings |
| 457 | 463 | */ |
| 458 | 464 | public function register_admin_settings( Settings $settings ) { |
| 459 | 465 | $settings->add_field( |
| @@ -552,9 +558,8 @@ | ||
| 552 | 558 | } |
| 553 | 559 | |
| 554 | 560 | /** |
| 555 | 561 | * Add Update Needed Flag |
| 556 | - * | |
| 557 | 562 | * @param array $settings |
| 558 | 563 | * |
| 559 | 564 | * @return array; |
| 560 | 565 | */ |