PluginProbe
Elementor Website Builder – more than just a page builder / trunk
Elementor Website Builder – more than just a page builder vtrunk
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / core / page-assets / data-managers / font-icon-svg / font-awesome.php

font-awesome.php in Elementor Website Builder – more than just a page builder trunk, at core/page-assets/data-managers/font-icon-svg/font-awesome.php

55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Page_Assets\Data_Managers\Font_Icon_Svg;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Font Awesome Icon Svg.
10 *
11 * @since 3.4.0
12 */
13 class Font_Awesome extends Base {
14 const LIBRARY_CURRENT_VERSION = '5.15.3';
15
16 protected function get_config( $icon ) {
17 preg_match( '/fa(.*) fa-/', $icon['value'], $icon_name_matches );
18
19 $icon_name = str_replace( $icon_name_matches[0], '', $icon['value'] );
20
21 $icon_key = str_replace( ' fa-', '-', $icon['value'] );
22
23 $icon_file_name = str_replace( 'fa-', '', $icon['library'] );
24
25 return [
26 'key' => $icon_key,
27 'version' => self::LIBRARY_CURRENT_VERSION,
28 'file_path' => ELEMENTOR_ASSETS_PATH . 'lib/font-awesome/json/' . $icon_file_name . '.json',
29 'data' => [
30 'icon_data' => [
31 'name' => $icon_name,
32 'library' => $icon['library'],
33 ],
34 ],
35 ];
36 }
37
38 protected function get_asset_content() {
39 $icon_data = $this->get_config_data( 'icon_data' );
40
41 $file_data = json_decode( $this->get_file_data( 'content', $icon_data['library'] ), true );
42
43 $icon_name = $icon_data['name'];
44
45 $svg_data = $file_data['icons'][ $icon_name ];
46
47 return [
48 'width' => $svg_data[0],
49 'height' => $svg_data[1],
50 'path' => $svg_data[4],
51 'key' => $this->get_key(),
52 ];
53 }
54 }
55