1 | <?php |
||
21 | class Kirki_Modules_Webfonts { |
||
22 | |||
23 | /** |
||
24 | * The object instance. |
||
25 | * |
||
26 | * @static |
||
27 | * @access private |
||
28 | * @since 3.0.0 |
||
29 | * @var object |
||
30 | */ |
||
31 | private static $instance; |
||
32 | |||
33 | /** |
||
34 | * Which method to use when loading googlefonts. |
||
35 | * Available options: link, js, embed. |
||
36 | * |
||
37 | * @static |
||
38 | * @access private |
||
39 | * @since 3.0.0 |
||
40 | * @var string |
||
41 | */ |
||
42 | private static $method = array( |
||
43 | 'global' => 'embed', |
||
44 | ); |
||
45 | |||
46 | /** |
||
47 | * Whether we should fallback to the link method or not. |
||
48 | * |
||
49 | * @access private |
||
50 | * @since 3.0.0 |
||
51 | * @var bool |
||
52 | */ |
||
53 | private $fallback_to_link = false; |
||
54 | |||
55 | /** |
||
56 | * The Kirki_Fonts_Google object. |
||
57 | * |
||
58 | * @access protected |
||
59 | * @since 3.0.0 |
||
60 | * @var object |
||
61 | */ |
||
62 | protected $fonts_google; |
||
63 | |||
64 | |||
65 | /** |
||
66 | * The class constructor |
||
67 | * |
||
68 | * @access protected |
||
69 | * @since 3.0.0 |
||
70 | */ |
||
71 | protected function __construct() { |
||
79 | |||
80 | /** |
||
81 | * Run on after_setup_theme. |
||
82 | * |
||
83 | * @access public |
||
84 | * @since 3.0.0 |
||
85 | */ |
||
86 | public function run() { |
||
91 | |||
92 | /** |
||
93 | * Gets an instance of this object. |
||
94 | * Prevents duplicate instances which avoid artefacts and improves performance. |
||
95 | * |
||
96 | * @static |
||
97 | * @access public |
||
98 | * @since 3.0.0 |
||
99 | * @return object |
||
100 | */ |
||
101 | public static function get_instance() { |
||
107 | |||
108 | /** |
||
109 | * Init other objects depending on the method we'll be using. |
||
110 | * |
||
111 | * @access protected |
||
112 | * @since 3.0.0 |
||
113 | */ |
||
114 | protected function init() { |
||
124 | |||
125 | /** |
||
126 | * Get the method we're going to use. |
||
127 | * |
||
128 | * @access public |
||
129 | * @since 3.0.0 |
||
130 | * @param string $config_id The config-ID. |
||
131 | * @return string |
||
132 | */ |
||
133 | public function get_method( $config_id ) { |
||
153 | |||
154 | /** |
||
155 | * Should we fallback to link method? |
||
156 | * |
||
157 | * @access protected |
||
158 | * @since 3.0.0 |
||
159 | */ |
||
160 | protected function maybe_fallback_to_link() { |
||
174 | |||
175 | /** |
||
176 | * Goes through all our fields and then populates the $this->fonts property. |
||
177 | * |
||
178 | * @access public |
||
179 | */ |
||
180 | public function loop_fields() { |
||
185 | } |
||
186 |