@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function get_instance() { |
31 | 31 | |
32 | - if ( null === static::$instance ) { |
|
32 | + if (null === static::$instance) { |
|
33 | 33 | static::$instance = new static(); |
34 | 34 | self::load_cache(); |
35 | 35 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @param string $handle The handle of the stylesheet |
44 | 44 | * @return boolean|string |
45 | 45 | */ |
46 | - public function get( $handle ) { |
|
46 | + public function get($handle) { |
|
47 | 47 | |
48 | - if ( array_key_exists( $handle, self::$cache ) ) { |
|
49 | - return self::$cache[ $handle ]; |
|
48 | + if (array_key_exists($handle, self::$cache)) { |
|
49 | + return self::$cache[$handle]; |
|
50 | 50 | } |
51 | 51 | return false; |
52 | 52 | } |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | * @param string $handle The handle of the stylesheet |
58 | 58 | * @param string $compiled_css |
59 | 59 | */ |
60 | - public function update( $handle, $compiled_css, $expiration ) { |
|
60 | + public function update($handle, $compiled_css, $expiration) { |
|
61 | 61 | |
62 | - self::$cache[ $handle ] = $compiled_css; |
|
63 | - $this->update_option( $expiration ); |
|
62 | + self::$cache[$handle] = $compiled_css; |
|
63 | + $this->update_option($expiration); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param string $handle The handle of the stylesheet |
70 | 70 | */ |
71 | - public function clear( $handle ) { |
|
71 | + public function clear($handle) { |
|
72 | 72 | |
73 | - unset( self::$cache[ $handle ] ); |
|
74 | - delete_transient( 'wp-dynamic-css-cache' ); |
|
73 | + unset(self::$cache[$handle]); |
|
74 | + delete_transient('wp-dynamic-css-cache'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | private static function load_cache() { |
82 | 82 | |
83 | - if ( false === ( self::$cache = get_transient( 'wp-dynamic-css-cache' ) ) ) { |
|
83 | + if (false === (self::$cache = get_transient('wp-dynamic-css-cache'))) { |
|
84 | 84 | self::$cache = []; |
85 | 85 | } |
86 | 86 | // self::$cache = get_option('wp-dynamic-css-cache'); |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * Update the database option with the local cache value. |
96 | 96 | */ |
97 | - private function update_option( $expiration ) { |
|
97 | + private function update_option($expiration) { |
|
98 | 98 | |
99 | 99 | // update_option('wp-dynamic-css-cache', self::$cache); |
100 | - set_transient( 'wp-dynamic-css-cache', self::$cache, $expiration ); |
|
100 | + set_transient('wp-dynamic-css-cache', self::$cache, $expiration); |
|
101 | 101 | } |
102 | 102 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function get_instance() { |
52 | 52 | |
53 | - if ( null === static::$instance ) { |
|
53 | + if (null === static::$instance) { |
|
54 | 54 | static::$instance = new static(); |
55 | 55 | } |
56 | 56 | return static::$instance; |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function enqueue_styles() { |
63 | 63 | |
64 | - foreach ( $this->stylesheets as $stylesheet ) { |
|
65 | - if ( $this->callback_exists( $stylesheet['handle'] ) ) { |
|
66 | - $this->enqueue_style( $stylesheet ); |
|
64 | + foreach ($this->stylesheets as $stylesheet) { |
|
65 | + if ($this->callback_exists($stylesheet['handle'])) { |
|
66 | + $this->enqueue_style($stylesheet); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param array $stylesheet |
75 | 75 | */ |
76 | - public function enqueue_style( $stylesheet ) { |
|
76 | + public function enqueue_style($stylesheet) { |
|
77 | 77 | |
78 | - $handle = 'wp-dynamic-css-' . $stylesheet['handle']; |
|
78 | + $handle = 'wp-dynamic-css-'.$stylesheet['handle']; |
|
79 | 79 | $print = $stylesheet['print']; |
80 | 80 | |
81 | 81 | wp_register_style( |
82 | 82 | $handle, |
83 | 83 | // Don't pass a URL if this style is to be printed |
84 | - $print ? false : $this->get_ajax_callback_url( $stylesheet['handle'] ), |
|
84 | + $print ? false : $this->get_ajax_callback_url($stylesheet['handle']), |
|
85 | 85 | $stylesheet['deps'] |
86 | 86 | ); |
87 | 87 | |
88 | - wp_enqueue_style( $handle, $stylesheet['handle'], $stylesheet['deps'] ); |
|
88 | + wp_enqueue_style($handle, $stylesheet['handle'], $stylesheet['deps']); |
|
89 | 89 | |
90 | 90 | // Add inline styles for styles that are set to be printed |
91 | - if ( $print ) { |
|
91 | + if ($print) { |
|
92 | 92 | // Inline styles only work if the handle has already been registered and enqueued |
93 | - wp_add_inline_style( $handle, $this->get_compiled_style( $stylesheet ), $stylesheet['deps'] ); |
|
93 | + wp_add_inline_style($handle, $this->get_compiled_style($stylesheet), $stylesheet['deps']); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function ajax_callback() { |
102 | 102 | |
103 | - header( 'Content-type: text/css; charset: UTF-8' ); |
|
104 | - $handle = filter_input( INPUT_GET, 'handle' ); |
|
103 | + header('Content-type: text/css; charset: UTF-8'); |
|
104 | + $handle = filter_input(INPUT_GET, 'handle'); |
|
105 | 105 | |
106 | - foreach ( $this->stylesheets as $stylesheet ) { |
|
107 | - if ( $handle === $stylesheet['handle'] ) { |
|
108 | - echo $this->get_compiled_style( $stylesheet ); |
|
106 | + foreach ($this->stylesheets as $stylesheet) { |
|
107 | + if ($handle === $stylesheet['handle']) { |
|
108 | + echo $this->get_compiled_style($stylesheet); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param boolean $cache Whether to store the compiled version of this |
124 | 124 | * stylesheet in cache to avoid compilation on every page load. |
125 | 125 | */ |
126 | - public function register_style( $handle, $path, $deps, $print, $minify, $cache, $expiration ) { |
|
126 | + public function register_style($handle, $path, $deps, $print, $minify, $cache, $expiration) { |
|
127 | 127 | |
128 | 128 | $this->stylesheets[] = [ |
129 | 129 | 'handle' => $handle, |
@@ -142,20 +142,20 @@ discard block |
||
142 | 142 | * @param string $handle The stylesheet's name/id |
143 | 143 | * @param callable $callback |
144 | 144 | */ |
145 | - public function register_callback( $handle, $callback ) { |
|
145 | + public function register_callback($handle, $callback) { |
|
146 | 146 | |
147 | - $this->callbacks[ $handle ] = $callback; |
|
147 | + $this->callbacks[$handle] = $callback; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Register a filter function for a given stylesheet handle. |
152 | 152 | */ |
153 | - public function register_filter( $handle, $filter_name, $callback ) { |
|
153 | + public function register_filter($handle, $filter_name, $callback) { |
|
154 | 154 | |
155 | - if ( ! array_key_exists( $handle, $this->filters ) ) { |
|
156 | - $this->filters[ $handle ] = []; |
|
155 | + if (!array_key_exists($handle, $this->filters)) { |
|
156 | + $this->filters[$handle] = []; |
|
157 | 157 | } |
158 | - $this->filters[ $handle ][ $filter_name ] = $callback; |
|
158 | + $this->filters[$handle][$filter_name] = $callback; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -166,32 +166,32 @@ discard block |
||
166 | 166 | * stored in $this->stylesheets |
167 | 167 | * @return string The compiled CSS for this stylesheet |
168 | 168 | */ |
169 | - protected function get_compiled_style( $style ) { |
|
169 | + protected function get_compiled_style($style) { |
|
170 | 170 | |
171 | 171 | $cache = DynamicCSSCache::get_instance(); |
172 | 172 | |
173 | 173 | // Use cached compiled CSS if applicable |
174 | - if ( $style['cache'] ) { |
|
175 | - $cached_css = $cache->get( $style['handle'] ); |
|
176 | - if ( false !== $cached_css ) { |
|
174 | + if ($style['cache']) { |
|
175 | + $cached_css = $cache->get($style['handle']); |
|
176 | + if (false !== $cached_css) { |
|
177 | 177 | return $cached_css; |
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - $css = file_get_contents( $style['path'] ); |
|
182 | - if ( $style['minify'] ) { |
|
183 | - $css = $this->minify_css( $css ); |
|
181 | + $css = file_get_contents($style['path']); |
|
182 | + if ($style['minify']) { |
|
183 | + $css = $this->minify_css($css); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | // Compile the dynamic CSS |
187 | 187 | $compiled_css = $this->compile_css( |
188 | 188 | $css, |
189 | - $this->callbacks[ $style['handle'] ], |
|
190 | - (array) @$this->filters[ $style['handle'] ] |
|
189 | + $this->callbacks[$style['handle']], |
|
190 | + (array) @$this->filters[$style['handle']] |
|
191 | 191 | ); |
192 | 192 | |
193 | - $cache->update( $style['handle'], $compiled_css, $style['cache_time'] ); |
|
194 | - return $this->add_meta_info( $compiled_css ); |
|
193 | + $cache->update($style['handle'], $compiled_css, $style['cache_time']); |
|
194 | + return $this->add_meta_info($compiled_css); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | * @param string $compiled_css The compiled CSS |
201 | 201 | * @return string The compiled CSS with the meta information added to it |
202 | 202 | */ |
203 | - protected function add_meta_info( $compiled_css ) { |
|
203 | + protected function add_meta_info($compiled_css) { |
|
204 | 204 | |
205 | - return "/**\n" . |
|
206 | - " * Compiled using wp-dynamic-css\n" . |
|
207 | - " * https://github.com/askupasoftware/wp-dynamic-css\n" . |
|
208 | - " */\n\n" . |
|
205 | + return "/**\n". |
|
206 | + " * Compiled using wp-dynamic-css\n". |
|
207 | + " * https://github.com/askupasoftware/wp-dynamic-css\n". |
|
208 | + " */\n\n". |
|
209 | 209 | $compiled_css; |
210 | 210 | } |
211 | 211 | |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @param string $handle The stylesheet's handle |
216 | 216 | * @return string The URL for the given handle |
217 | 217 | */ |
218 | - protected function get_ajax_callback_url( $handle ) { |
|
218 | + protected function get_ajax_callback_url($handle) { |
|
219 | 219 | |
220 | 220 | return esc_url_raw( |
221 | - add_query_arg( [ |
|
221 | + add_query_arg([ |
|
222 | 222 | 'action' => 'wp_dynamic_css', |
223 | 223 | 'handle' => $handle, |
224 | - ], admin_url( 'admin-ajax.php' ) ) |
|
224 | + ], admin_url('admin-ajax.php')) |
|
225 | 225 | ); |
226 | 226 | } |
227 | 227 | |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | * @param string $css CSS style to minify |
233 | 233 | * @return string Minified CSS |
234 | 234 | */ |
235 | - protected function minify_css( $css ) { |
|
235 | + protected function minify_css($css) { |
|
236 | 236 | |
237 | - return preg_replace( '@({)\s+|(\;)\s+|/\*.+?\*\/|\R@is', '$1$2 ', $css ); |
|
237 | + return preg_replace('@({)\s+|(\;)\s+|/\*.+?\*\/|\R@is', '$1$2 ', $css); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | * @param string $handle |
244 | 244 | * @return boolean |
245 | 245 | */ |
246 | - protected function callback_exists( $handle ) { |
|
246 | + protected function callback_exists($handle) { |
|
247 | 247 | |
248 | - if ( array_key_exists( $handle, $this->callbacks ) ) { |
|
248 | + if (array_key_exists($handle, $this->callbacks)) { |
|
249 | 249 | return true; |
250 | 250 | } |
251 | 251 | trigger_error( |
252 | - "There is no callback function associated with the handle '$handle'. " . |
|
252 | + "There is no callback function associated with the handle '$handle'. ". |
|
253 | 253 | 'Use <b>wp_dynamic_css_set_callback()</b> to register a callback function for this handle.' |
254 | 254 | ); |
255 | 255 | return false; |
@@ -266,32 +266,32 @@ discard block |
||
266 | 266 | * @return string The compiled CSS after converting the variables to their |
267 | 267 | * corresponding values |
268 | 268 | */ |
269 | - protected function compile_css( $css, $callback, $filters ) { |
|
269 | + protected function compile_css($css, $callback, $filters) { |
|
270 | 270 | |
271 | 271 | return preg_replace_callback( |
272 | 272 | |
273 | - '#' . // Begin |
|
274 | - '\\$' . // Must start with $ |
|
275 | - '([\\w-]+)' . // Match alphanumeric characters and dashes |
|
276 | - "((?:\\['?[\\w-]+'?\\])*)" . // Optionally match array subscripts i.e. $myVar['index'] |
|
277 | - '((?:' . // Optionally match pipe filters i.e. $myVar|myFilter |
|
278 | - '\\|[\\w-]+' . // Starting with the | character |
|
279 | - "(\([\w\.,']+\))?" . // Filters can have strings and numbers i.e myFilter('string',1,2.5) |
|
280 | - ')*)' . // Allow for 0 or more piped filters |
|
281 | - '#', // End |
|
282 | - function( $matches ) use ( $callback, $filters ) { |
|
273 | + '#'.// Begin |
|
274 | + '\\$'.// Must start with $ |
|
275 | + '([\\w-]+)'.// Match alphanumeric characters and dashes |
|
276 | + "((?:\\['?[\\w-]+'?\\])*)".// Optionally match array subscripts i.e. $myVar['index'] |
|
277 | + '((?:'.// Optionally match pipe filters i.e. $myVar|myFilter |
|
278 | + '\\|[\\w-]+'.// Starting with the | character |
|
279 | + "(\([\w\.,']+\))?".// Filters can have strings and numbers i.e myFilter('string',1,2.5) |
|
280 | + ')*)'.// Allow for 0 or more piped filters |
|
281 | + '#', // End |
|
282 | + function($matches) use ($callback, $filters) { |
|
283 | 283 | $subscripts = []; |
284 | 284 | |
285 | 285 | // If this variable is an array, get the subscripts |
286 | - if ( '' !== $matches[2] ) { |
|
287 | - preg_match_all( '/[\w-]+/i', $matches[2], $subscripts ); |
|
286 | + if ('' !== $matches[2]) { |
|
287 | + preg_match_all('/[\w-]+/i', $matches[2], $subscripts); |
|
288 | 288 | } |
289 | 289 | |
290 | - $val = call_user_func_array( $callback, [ $matches[1], @$subscripts[0] ] ); |
|
290 | + $val = call_user_func_array($callback, [$matches[1], @$subscripts[0]]); |
|
291 | 291 | |
292 | 292 | // If there are filters, apply them |
293 | - if ( '' !== $matches[3] ) { |
|
294 | - $val = $this->apply_filters( substr( $matches[3], 1 ), $val, $filters ); |
|
293 | + if ('' !== $matches[3]) { |
|
294 | + $val = $this->apply_filters(substr($matches[3], 1), $val, $filters); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | return $val; |
@@ -307,21 +307,21 @@ discard block |
||
307 | 307 | * @param array $filters Array of callback functions |
308 | 308 | * @return string The value after all filters have been applied |
309 | 309 | */ |
310 | - protected function apply_filters( $filters_string, $value, $filters = [] ) { |
|
310 | + protected function apply_filters($filters_string, $value, $filters = []) { |
|
311 | 311 | |
312 | - foreach ( explode( '|', $filters_string ) as $filter ) { |
|
313 | - $args = [ $value ]; |
|
312 | + foreach (explode('|', $filters_string) as $filter) { |
|
313 | + $args = [$value]; |
|
314 | 314 | |
315 | - if ( false !== strrpos( $filters_string, '(' ) ) { |
|
316 | - $pieces = explode( '(', $filter ); |
|
315 | + if (false !== strrpos($filters_string, '(')) { |
|
316 | + $pieces = explode('(', $filter); |
|
317 | 317 | $filter = $pieces[0]; |
318 | - $params = explode( ',', str_replace( ')', '', $pieces[1] ) ); |
|
319 | - array_walk( $params, [ $this, 'strtoval' ] ); // Convert string values to actual values |
|
320 | - $args = array_merge( $args, $params ); |
|
318 | + $params = explode(',', str_replace(')', '', $pieces[1])); |
|
319 | + array_walk($params, [$this, 'strtoval']); // Convert string values to actual values |
|
320 | + $args = array_merge($args, $params); |
|
321 | 321 | } |
322 | 322 | |
323 | - if ( key_exists( $filter, $filters ) ) { |
|
324 | - $value = call_user_func_array( $filters[ $filter ], $args ); |
|
323 | + if (key_exists($filter, $filters)) { |
|
324 | + $value = call_user_func_array($filters[$filter], $args); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | return $value; |
@@ -332,19 +332,19 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @param string $str The string to be converted (passed by reference) |
334 | 334 | */ |
335 | - protected function strtoval( &$str ) { |
|
335 | + protected function strtoval(&$str) { |
|
336 | 336 | |
337 | - if ( 'false' === strtolower( $str ) ) { |
|
337 | + if ('false' === strtolower($str)) { |
|
338 | 338 | $str = false; |
339 | 339 | } |
340 | - if ( 'true' === strtolower( $str ) ) { |
|
340 | + if ('true' === strtolower($str)) { |
|
341 | 341 | $str = true; |
342 | 342 | } |
343 | - if ( false !== strrpos( $str, "'" ) ) { |
|
344 | - $str = str_replace( "'", '', $str ); |
|
343 | + if (false !== strrpos($str, "'")) { |
|
344 | + $str = str_replace("'", '', $str); |
|
345 | 345 | } |
346 | - if ( is_numeric( $str ) ) { |
|
347 | - $str = floatval( $str ); |
|
346 | + if (is_numeric($str)) { |
|
347 | + $str = floatval($str); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @copyright 2016 Askupa Software |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! function_exists( 'wp_dynamic_css_enqueue' ) ) { |
|
10 | +if (!function_exists('wp_dynamic_css_enqueue')) { |
|
11 | 11 | /** |
12 | 12 | * Enqueue a dynamic stylesheet |
13 | 13 | * |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * stylesheet in cache to avoid compilation on every page load. |
26 | 26 | * @param int $expiration Time until expiration in seconds. |
27 | 27 | */ |
28 | - function wp_dynamic_css_enqueue( $handle, $path, $deps = [], $print = true, $minify = false, $cache = false, $expiration = 0 ) { |
|
28 | + function wp_dynamic_css_enqueue($handle, $path, $deps = [], $print = true, $minify = false, $cache = false, $expiration = 0) { |
|
29 | 29 | |
30 | 30 | $dcss = DynamicCSSCompiler::get_instance(); |
31 | - $dcss->register_style( $handle, $path, $deps, $print, $minify, $cache, $expiration ); |
|
31 | + $dcss->register_style($handle, $path, $deps, $print, $minify, $cache, $expiration); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if ( ! function_exists( 'wp_dynamic_css_set_callback' ) ) { |
|
35 | +if (!function_exists('wp_dynamic_css_set_callback')) { |
|
36 | 36 | /** |
37 | 37 | * Set the value retrieval callback function |
38 | 38 | * |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * can either be a reference to a function name or method within an |
47 | 47 | * class/object. |
48 | 48 | */ |
49 | - function wp_dynamic_css_set_callback( $handle, $callback ) { |
|
49 | + function wp_dynamic_css_set_callback($handle, $callback) { |
|
50 | 50 | |
51 | 51 | $dcss = DynamicCSSCompiler::get_instance(); |
52 | - $dcss->register_callback( $handle, $callback ); |
|
52 | + $dcss->register_callback($handle, $callback); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | -if ( ! function_exists( 'wp_dynamic_css_clear_cache' ) ) { |
|
56 | +if (!function_exists('wp_dynamic_css_clear_cache')) { |
|
57 | 57 | /** |
58 | 58 | * Clear the cached compiled CSS for the given handle. |
59 | 59 | * |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @param string $handle The name of the stylesheet to be cleared from cache |
66 | 66 | */ |
67 | - function wp_dynamic_css_clear_cache( $handle ) { |
|
67 | + function wp_dynamic_css_clear_cache($handle) { |
|
68 | 68 | |
69 | 69 | $cache = DynamicCSSCache::get_instance(); |
70 | - $cache->clear( $handle ); |
|
70 | + $cache->clear($handle); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | -if ( ! function_exists( 'wp_dynamic_css_register_filter' ) ) { |
|
74 | +if (!function_exists('wp_dynamic_css_register_filter')) { |
|
75 | 75 | /** |
76 | 76 | * Register a filter function for a given stylesheet handle. |
77 | 77 | * |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | * @param Callable $callback The actual filter function. Accepts the $value |
108 | 108 | * as an argument. Should return the filtered value. |
109 | 109 | */ |
110 | - function wp_dynamic_css_register_filter( $handle, $filter_name, $callback ) { |
|
110 | + function wp_dynamic_css_register_filter($handle, $filter_name, $callback) { |
|
111 | 111 | |
112 | 112 | $dcss = DynamicCSSCompiler::get_instance(); |
113 | - $dcss->register_filter( $handle, $filter_name, $callback ); |
|
113 | + $dcss->register_filter($handle, $filter_name, $callback); |
|
114 | 114 | } |
115 | 115 | } |
@@ -20,23 +20,23 @@ discard block |
||
20 | 20 | * Domain Path: /languages |
21 | 21 | */ |
22 | 22 | |
23 | -defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
|
23 | +defined('ABSPATH') or die('No script kiddies please!'); |
|
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Prevent loading the library more than once |
28 | 28 | */ |
29 | -if ( defined( 'WP_DYNAMIC_CSS' ) ) { |
|
29 | +if (defined('WP_DYNAMIC_CSS')) { |
|
30 | 30 | return; |
31 | 31 | } |
32 | -define( 'WP_DYNAMIC_CSS', true ); |
|
32 | +define('WP_DYNAMIC_CSS', true); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Load required files |
36 | 36 | */ |
37 | -require_once dirname( __FILE__ ) . '/compiler.php'; |
|
38 | -require_once dirname( __FILE__ ) . '/cache.php'; |
|
39 | -require_once dirname( __FILE__ ) . '/functions.php'; |
|
37 | +require_once dirname(__FILE__).'/compiler.php'; |
|
38 | +require_once dirname(__FILE__).'/cache.php'; |
|
39 | +require_once dirname(__FILE__).'/functions.php'; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * The following actions are used for printing or loading the compiled |
@@ -45,6 +45,6 @@ discard block |
||
45 | 45 | * styles. |
46 | 46 | */ |
47 | 47 | $dcss = DynamicCSSCompiler::get_instance(); |
48 | -add_action( 'wp_enqueue_scripts', array( $dcss, 'enqueue_styles' ), 100 ); |
|
49 | -add_action( 'wp_ajax_wp_dynamic_css', array( $dcss, 'ajax_callback' ) ); |
|
50 | -add_action( 'wp_ajax_nopriv_wp_dynamic_css', array( $dcss, 'ajax_callback' ) ); |
|
48 | +add_action('wp_enqueue_scripts', array($dcss, 'enqueue_styles'), 100); |
|
49 | +add_action('wp_ajax_wp_dynamic_css', array($dcss, 'ajax_callback')); |
|
50 | +add_action('wp_ajax_nopriv_wp_dynamic_css', array($dcss, 'ajax_callback')); |