manager.php (1005B)
1 <?php 2 namespace Elementor\Core\Page_Assets\Managers\Font_Icon_Svg; 3 4 use Elementor\Core\Base\Base_Object; 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 9 10 /** 11 * Elementor Font Icon Svg Manager. 12 * 13 * @since 3.4.0 14 */ 15 class Manager extends Base_Object { 16 private static $font_icon_svg_data = []; 17 18 private static function get_font_icon_svg_data() { 19 if ( ! self::$font_icon_svg_data ) { 20 self::$font_icon_svg_data = [ 21 'font-awesome' => [ 22 'regex' => '/^fa-/', 23 'manager' => Font_Awesome::class, 24 ], 25 ]; 26 } 27 28 return self::$font_icon_svg_data; 29 } 30 31 public static function get_font_family_manager( $font_family ) { 32 $font_icon_svg_data = self::get_font_icon_svg_data(); 33 34 return $font_icon_svg_data[ $font_family ]['manager']; 35 } 36 37 public static function get_font_family( $icon_library ) { 38 foreach ( self::get_font_icon_svg_data() as $family => $data ) { 39 if ( preg_match( $data['regex'], $icon_library ) ) { 40 return $family; 41 } 42 } 43 44 return ''; 45 } 46 }