1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Bright Nucleus Dependency Component. |
4
|
|
|
* |
5
|
|
|
* @package BrightNucleus\Dependency |
6
|
|
|
* @author Alain Schlesser <[email protected]> |
7
|
|
|
* @license MIT |
8
|
|
|
* @link http://www.brightnucleus.com/ |
9
|
|
|
* @copyright 2015-2016 Alain Schlesser, Bright Nucleus |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace BrightNucleus\Dependency; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class StyleHandler. |
16
|
|
|
* |
17
|
|
|
* Handles stylesheet dependencies. |
18
|
|
|
* |
19
|
|
|
* @since 0.1.0 |
20
|
|
|
* |
21
|
|
|
* @package BrightNucleus\Dependency |
22
|
|
|
*/ |
23
|
|
|
class StyleHandler extends AbstractDependencyHandler { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Get the name of the function that is used for registering the dependency. |
27
|
|
|
* |
28
|
|
|
* @since 0.1.0 |
29
|
|
|
* |
30
|
|
|
* @return string Function name. |
31
|
|
|
*/ |
32
|
|
|
protected function get_register_function() { |
33
|
|
|
return 'wp_register_style'; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Check whether a specific handle has been registered. |
38
|
|
|
* |
39
|
|
|
* @since 0.2.3 |
40
|
|
|
* @since 0.3.3 Publicly accessible. |
41
|
|
|
* |
42
|
|
|
* @param string $handle The handle to check |
43
|
|
|
* @return bool Whether it is registered or not. |
44
|
|
|
*/ |
45
|
|
|
public function is_registered( $handle ) { |
46
|
|
|
return wp_style_is( $handle, 'registered' ); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Check whether a specific handle has been enqueued. |
51
|
|
|
* |
52
|
|
|
* @since 0.3.3 |
53
|
|
|
* |
54
|
|
|
* @param string $handle The handle to check |
55
|
|
|
* @return bool Whether it is enqueued or not. |
56
|
|
|
*/ |
57
|
|
|
public function is_enqueued( $handle ) { |
58
|
|
|
return wp_style_is( $handle, 'enqueued' ); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the name of the function that is used for enqueueing the dependency. |
63
|
|
|
* |
64
|
|
|
* @since 0.1.0 |
65
|
|
|
* |
66
|
|
|
* @return string Function name. |
67
|
|
|
*/ |
68
|
|
|
protected function get_enqueue_function() { |
69
|
|
|
return 'wp_enqueue_style'; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|