-
Notifications
You must be signed in to change notification settings - Fork 0
/
Font_Awesome.php
87 lines (79 loc) · 2.71 KB
/
Font_Awesome.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
Component Name: Font Awesome
Description: Adds font awesome to Waboot
Category: Styles
Tags: Styles
Version: 1.0.0
Author: Waboot Team <info@waboot.io>
Author URI: http://www.waboot.io
*/
class Font_Awesome extends \WBF\modules\components\Component{
public function setup() {
parent::setup();
}
public function run() {
parent::run();
}
public function styles() {
if(!class_exists(\WBF\components\assets\AssetsManager::class)){
return;
}
$assets = [
'fontawesome-4' => [
'uri' => $this->directory_uri . '/assets/dist/css/font-awesome-4.7.0.min.css',
'path' => $this->directory . '/assets/dist/css/font-awesome-4.7.0.min.css',
'type' => 'css',
'enqueue' => \Waboot\functions\get_option('fa_version') === 'legacy'
],
'fontawesome-regular' => [
'uri' => $this->directory_uri . '/assets/dist/css/regular.min.css',
'path' => $this->directory . '/assets/dist/css/regular.min.css',
'type' => 'css',
'enqueue' => \Waboot\functions\get_option('fa_version') === 'latest'
],
'fontawesome-solid' => [
'uri' => $this->directory_uri . '/assets/dist/css/solid.min.css',
'path' => $this->directory . '/assets/dist/css/solid.min.css',
'type' => 'css',
'enqueue' => \Waboot\functions\get_option('fa_version') === 'latest'
],
'fontawesome-brands' => [
'uri' => $this->directory_uri . '/assets/dist/css/brands.min.css',
'path' => $this->directory . '/assets/dist/css/brands.min.css',
'type' => 'css',
'enqueue' => \Waboot\functions\get_option('fa_version') === 'latest'
],
'fontawesome' => [
'uri' => $this->directory_uri . '/assets/dist/css/fontawesome.min.css',
'path' => $this->directory . '/assets/dist/css/fontawesome.min.css',
'type' => 'css',
'deps' => ['fontawesome-regular','fontawesome-solid','fontawesome-brands'],
'enqueue' => \Waboot\functions\get_option('fa_version') === 'latest'
]
];
$am = new \WBF\components\assets\AssetsManager($assets);
try{
$am->enqueue();
}catch (\Exception $e){
trigger_error($e->getMessage(),E_USER_NOTICE);
}
}
public function register_options() {
parent::register_options();
$orgzr = \WBF\modules\options\Organizer::getInstance();
$orgzr->add_section('fontawesome', _x('FontAwesome','Theme Options tab','waboot'));
$orgzr->set_section('fontawesome');
$orgzr->set_group("std_options");
$orgzr->add([
'name' => _x( 'FontAwesome version', 'Theme options', 'waboot' ),
'desc' => _x( 'Choose the FontAwesome version to include', 'Theme options', 'waboot' ),
'id' => 'fa_version',
'std' => 'latest',
'type' => 'radio',
'options' => array( 'legacy' => 'Legacy (4.7.0)','latest' => 'Latest (5.x)' ),
]);
$orgzr->reset_group();
$orgzr->reset_section();
}
}