@@ -26,7 +26,9 @@ |
||
| 26 | 26 | /** |
| 27 | 27 | * Prevent loading the library more than once |
| 28 | 28 | */ |
| 29 | -if( defined( 'WP_DYNAMIC_CSS' ) ) return; |
|
| 29 | +if( defined( 'WP_DYNAMIC_CSS' ) ) { |
|
| 30 | + return; |
|
| 31 | +} |
|
| 30 | 32 | define( 'WP_DYNAMIC_CSS', true ); |
| 31 | 33 | |
| 32 | 34 | /** |
@@ -20,14 +20,14 @@ 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' ) ) return; |
|
| 30 | -define( 'WP_DYNAMIC_CSS', true ); |
|
| 29 | +if (defined('WP_DYNAMIC_CSS')) return; |
|
| 30 | +define('WP_DYNAMIC_CSS', true); |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Load required files |
@@ -43,6 +43,6 @@ discard block |
||
| 43 | 43 | * styles. |
| 44 | 44 | */ |
| 45 | 45 | $dcss = DynamicCSSCompiler::get_instance(); |
| 46 | -add_action( 'wp_enqueue_scripts', array( $dcss, 'enqueue_styles' ), 100 ); |
|
| 47 | -add_action( 'wp_ajax_wp_dynamic_css', array( $dcss, 'ajax_callback' ) ); |
|
| 48 | -add_action( 'wp_ajax_nopriv_wp_dynamic_css', array( $dcss, 'ajax_callback' ) ); |
|
| 49 | 46 | \ No newline at end of file |
| 47 | +add_action('wp_enqueue_scripts', array($dcss, 'enqueue_styles'), 100); |
|
| 48 | +add_action('wp_ajax_wp_dynamic_css', array($dcss, 'ajax_callback')); |
|
| 49 | +add_action('wp_ajax_nopriv_wp_dynamic_css', array($dcss, 'ajax_callback')); |
|
| 50 | 50 | \ No newline at end of file |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * @param string $handle The handle of the stylesheet |
| 45 | 45 | * @return boolean|string |
| 46 | 46 | */ |
| 47 | - public function get( $handle ) |
|
| 47 | + public function get($handle) |
|
| 48 | 48 | { |
| 49 | - if( array_key_exists( $handle, self::$cache ) ) |
|
| 49 | + if (array_key_exists($handle, self::$cache)) |
|
| 50 | 50 | { |
| 51 | 51 | return self::$cache[$handle]; |
| 52 | 52 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param string $handle The handle of the stylesheet |
| 60 | 60 | * @param type $compiled_css |
| 61 | 61 | */ |
| 62 | - public function update( $handle, $compiled_css ) |
|
| 62 | + public function update($handle, $compiled_css) |
|
| 63 | 63 | { |
| 64 | 64 | self::$cache[$handle] = $compiled_css; |
| 65 | 65 | $this->update_option(); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param string $handle The handle of the stylesheet |
| 72 | 72 | */ |
| 73 | - public function clear( $handle ) |
|
| 73 | + public function clear($handle) |
|
| 74 | 74 | { |
| 75 | 75 | unset(self::$cache[$handle]); |
| 76 | 76 | $this->update_option(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | self::$cache = get_option('wp-dynamic-css-cache'); |
| 86 | 86 | |
| 87 | - if( false === self::$cache ) |
|
| 87 | + if (false === self::$cache) |
|
| 88 | 88 | { |
| 89 | 89 | self::$cache = array(); |
| 90 | 90 | } |
@@ -184,7 +184,9 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $css = file_get_contents( $style['path'] ); |
| 187 | - if( $style['minify'] ) $css = $this->minify_css( $css ); |
|
| 187 | + if( $style['minify'] ) { |
|
| 188 | + $css = $this->minify_css( $css ); |
|
| 189 | + } |
|
| 188 | 190 | |
| 189 | 191 | // Compile the dynamic CSS |
| 190 | 192 | $compiled_css = $this->compile_css( |
@@ -310,9 +312,17 @@ discard block |
||
| 310 | 312 | */ |
| 311 | 313 | protected function strtoval( &$str ) |
| 312 | 314 | { |
| 313 | - if( 'false' === strtolower($str) ) $str = false; |
|
| 314 | - if( 'true' === strtolower($str) ) $str = true; |
|
| 315 | - if( false !== strrpos( $str, "'" ) ) $str = str_replace ( "'", "", $str ); |
|
| 316 | - if( is_numeric( $str ) ) $str = floatval( $str ); |
|
| 315 | + if( 'false' === strtolower($str) ) { |
|
| 316 | + $str = false; |
|
| 317 | + } |
|
| 318 | + if( 'true' === strtolower($str) ) { |
|
| 319 | + $str = true; |
|
| 320 | + } |
|
| 321 | + if( false !== strrpos( $str, "'" ) ) { |
|
| 322 | + $str = str_replace ( "'", "", $str ); |
|
| 323 | + } |
|
| 324 | + if( is_numeric( $str ) ) { |
|
| 325 | + $str = floatval( $str ); |
|
| 326 | + } |
|
| 317 | 327 | } |
| 318 | 328 | } |
@@ -205,10 +205,10 @@ |
||
| 205 | 205 | protected function add_meta_info( $compiled_css ) |
| 206 | 206 | { |
| 207 | 207 | return "/**\n". |
| 208 | - " * Compiled using wp-dynamic-css\n". |
|
| 209 | - " * https://github.com/askupasoftware/wp-dynamic-css\n". |
|
| 210 | - " */\n\n". |
|
| 211 | - $compiled_css; |
|
| 208 | + " * Compiled using wp-dynamic-css\n". |
|
| 209 | + " * https://github.com/askupasoftware/wp-dynamic-css\n". |
|
| 210 | + " */\n\n". |
|
| 211 | + $compiled_css; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -152,6 +152,9 @@ |
||
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Register a filter function for a given stylesheet handle. |
| 155 | + * @param string $handle |
|
| 156 | + * @param string $filter_name |
|
| 157 | + * @param callable $callback |
|
| 155 | 158 | */ |
| 156 | 159 | public function register_filter( $handle, $filter_name, $callback ) |
| 157 | 160 | { |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function enqueue_styles() |
| 64 | 64 | { |
| 65 | - foreach( $this->stylesheets as $stylesheet ) |
|
| 65 | + foreach ($this->stylesheets as $stylesheet) |
|
| 66 | 66 | { |
| 67 | - if( $this->callback_exists( $stylesheet['handle'] ) ) |
|
| 67 | + if ($this->callback_exists($stylesheet['handle'])) |
|
| 68 | 68 | { |
| 69 | - $this->enqueue_style( $stylesheet ); |
|
| 69 | + $this->enqueue_style($stylesheet); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @param array $stylesheet |
| 78 | 78 | */ |
| 79 | - public function enqueue_style( $stylesheet ) |
|
| 79 | + public function enqueue_style($stylesheet) |
|
| 80 | 80 | { |
| 81 | 81 | $handle = 'wp-dynamic-css-'.$stylesheet['handle']; |
| 82 | 82 | $print = $stylesheet['print']; |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | wp_register_style( |
| 85 | 85 | $handle, |
| 86 | 86 | // Don't pass a URL if this style is to be printed |
| 87 | - $print ? false : $this->get_ajax_callback_url( $stylesheet['handle'] ) |
|
| 87 | + $print ? false : $this->get_ajax_callback_url($stylesheet['handle']) |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - wp_enqueue_style( $handle ); |
|
| 90 | + wp_enqueue_style($handle); |
|
| 91 | 91 | |
| 92 | 92 | // Add inline styles for styles that are set to be printed |
| 93 | - if( $print ) |
|
| 93 | + if ($print) |
|
| 94 | 94 | { |
| 95 | 95 | // Inline styles only work if the handle has already been registered and enqueued |
| 96 | - wp_add_inline_style( $handle, $this->get_compiled_style( $stylesheet ) ); |
|
| 96 | + wp_add_inline_style($handle, $this->get_compiled_style($stylesheet)); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function ajax_callback() |
| 105 | 105 | { |
| 106 | - header( "Content-type: text/css; charset: UTF-8" ); |
|
| 107 | - $handle = filter_input( INPUT_GET, 'handle' ); |
|
| 106 | + header("Content-type: text/css; charset: UTF-8"); |
|
| 107 | + $handle = filter_input(INPUT_GET, 'handle'); |
|
| 108 | 108 | |
| 109 | - foreach( $this->stylesheets as $stylesheet ) |
|
| 109 | + foreach ($this->stylesheets as $stylesheet) |
|
| 110 | 110 | { |
| 111 | - if( $handle === $stylesheet['handle'] ) |
|
| 111 | + if ($handle === $stylesheet['handle']) |
|
| 112 | 112 | { |
| 113 | - echo $this->get_compiled_style( $stylesheet ); |
|
| 113 | + echo $this->get_compiled_style($stylesheet); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param boolean $cache Whether to store the compiled version of this |
| 129 | 129 | * stylesheet in cache to avoid compilation on every page load. |
| 130 | 130 | */ |
| 131 | - public function register_style( $handle, $path, $print, $minify, $cache ) |
|
| 131 | + public function register_style($handle, $path, $print, $minify, $cache) |
|
| 132 | 132 | { |
| 133 | 133 | $this->stylesheets[] = array( |
| 134 | 134 | 'handle'=> $handle, |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param string $handle The stylesheet's name/id |
| 146 | 146 | * @param callable $callback |
| 147 | 147 | */ |
| 148 | - public function register_callback( $handle, $callback ) |
|
| 148 | + public function register_callback($handle, $callback) |
|
| 149 | 149 | { |
| 150 | 150 | $this->callbacks[$handle] = $callback; |
| 151 | 151 | } |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * Register a filter function for a given stylesheet handle. |
| 155 | 155 | */ |
| 156 | - public function register_filter( $handle, $filter_name, $callback ) |
|
| 156 | + public function register_filter($handle, $filter_name, $callback) |
|
| 157 | 157 | { |
| 158 | - if( !array_key_exists( $handle, $this->filters ) ) |
|
| 158 | + if (!array_key_exists($handle, $this->filters)) |
|
| 159 | 159 | { |
| 160 | 160 | $this->filters[$handle] = array(); |
| 161 | 161 | } |
@@ -170,22 +170,22 @@ discard block |
||
| 170 | 170 | * stored in $this->stylesheets |
| 171 | 171 | * @return string The compiled CSS for this stylesheet |
| 172 | 172 | */ |
| 173 | - protected function get_compiled_style( $style ) |
|
| 173 | + protected function get_compiled_style($style) |
|
| 174 | 174 | { |
| 175 | 175 | $cache = DynamicCSSCache::get_instance(); |
| 176 | 176 | |
| 177 | 177 | // Use cached compiled CSS if applicable |
| 178 | - if( $style['cache'] ) |
|
| 178 | + if ($style['cache']) |
|
| 179 | 179 | { |
| 180 | - $cached_css = $cache->get( $style['handle'] ); |
|
| 181 | - if( false !== $cached_css ) |
|
| 180 | + $cached_css = $cache->get($style['handle']); |
|
| 181 | + if (false !== $cached_css) |
|
| 182 | 182 | { |
| 183 | 183 | return $cached_css; |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $css = file_get_contents( $style['path'] ); |
|
| 188 | - if( $style['minify'] ) $css = $this->minify_css( $css ); |
|
| 187 | + $css = file_get_contents($style['path']); |
|
| 188 | + if ($style['minify']) $css = $this->minify_css($css); |
|
| 189 | 189 | |
| 190 | 190 | // Compile the dynamic CSS |
| 191 | 191 | $compiled_css = $this->compile_css( |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | (array) @$this->filters[$style['handle']] |
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - $cache->update( $style['handle'], $compiled_css ); |
|
| 198 | - return $this->add_meta_info( $compiled_css ); |
|
| 197 | + $cache->update($style['handle'], $compiled_css); |
|
| 198 | + return $this->add_meta_info($compiled_css); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param string $compiled_css The compiled CSS |
| 205 | 205 | * @return string The compiled CSS with the meta information added to it |
| 206 | 206 | */ |
| 207 | - protected function add_meta_info( $compiled_css ) |
|
| 207 | + protected function add_meta_info($compiled_css) |
|
| 208 | 208 | { |
| 209 | 209 | return "/**\n". |
| 210 | 210 | " * Compiled using wp-dynamic-css\n". |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | * @param string $handle The stylesheet's handle |
| 220 | 220 | * @return string The URL for the given handle |
| 221 | 221 | */ |
| 222 | - protected function get_ajax_callback_url( $handle ) |
|
| 222 | + protected function get_ajax_callback_url($handle) |
|
| 223 | 223 | { |
| 224 | 224 | return esc_url_raw( |
| 225 | 225 | add_query_arg(array( |
| 226 | 226 | 'action' => 'wp_dynamic_css', |
| 227 | 227 | 'handle' => $handle |
| 228 | 228 | ), |
| 229 | - admin_url( 'admin-ajax.php')) |
|
| 229 | + admin_url('admin-ajax.php')) |
|
| 230 | 230 | ); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | * @param string $css CSS style to minify |
| 238 | 238 | * @return string Minified CSS |
| 239 | 239 | */ |
| 240 | - protected function minify_css( $css ) |
|
| 240 | + protected function minify_css($css) |
|
| 241 | 241 | { |
| 242 | - return preg_replace( '@({)\s+|(\;)\s+|/\*.+?\*\/|\R@is', '$1$2 ', $css ); |
|
| 242 | + return preg_replace('@({)\s+|(\;)\s+|/\*.+?\*\/|\R@is', '$1$2 ', $css); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | * @param string $handle |
| 249 | 249 | * @return boolean |
| 250 | 250 | */ |
| 251 | - protected function callback_exists( $handle ) |
|
| 251 | + protected function callback_exists($handle) |
|
| 252 | 252 | { |
| 253 | - if( array_key_exists( $handle, $this->callbacks ) ) |
|
| 253 | + if (array_key_exists($handle, $this->callbacks)) |
|
| 254 | 254 | { |
| 255 | 255 | return true; |
| 256 | 256 | } |
@@ -272,36 +272,36 @@ discard block |
||
| 272 | 272 | * @return string The compiled CSS after converting the variables to their |
| 273 | 273 | * corresponding values |
| 274 | 274 | */ |
| 275 | - protected function compile_css( $css, $callback, $filters ) |
|
| 275 | + protected function compile_css($css, $callback, $filters) |
|
| 276 | 276 | { |
| 277 | 277 | return preg_replace_callback( |
| 278 | 278 | |
| 279 | - "#". // Begin |
|
| 280 | - "\\$". // Must start with $ |
|
| 281 | - "([\\w-]+)". // Match alphanumeric characters and dashes |
|
| 282 | - "((?:\\['?[\\w-]+'?\\])*)". // Optionally match array subscripts i.e. $myVar['index'] |
|
| 283 | - "((?:". // Optionally match pipe filters i.e. $myVar|myFilter |
|
| 284 | - "\\|[\\w-]+". // Starting with the | character |
|
| 285 | - "(\([\w\.,']+\))?". // Filters can have strings and numbers i.e myFilter('string',1,2.5) |
|
| 286 | - ")*)". // Allow for 0 or more piped filters |
|
| 287 | - "#", // End |
|
| 279 | + "#".// Begin |
|
| 280 | + "\\$".// Must start with $ |
|
| 281 | + "([\\w-]+)".// Match alphanumeric characters and dashes |
|
| 282 | + "((?:\\['?[\\w-]+'?\\])*)".// Optionally match array subscripts i.e. $myVar['index'] |
|
| 283 | + "((?:".// Optionally match pipe filters i.e. $myVar|myFilter |
|
| 284 | + "\\|[\\w-]+".// Starting with the | character |
|
| 285 | + "(\([\w\.,']+\))?".// Filters can have strings and numbers i.e myFilter('string',1,2.5) |
|
| 286 | + ")*)".// Allow for 0 or more piped filters |
|
| 287 | + "#", // End |
|
| 288 | 288 | |
| 289 | - function( $matches ) use ( $callback, $filters ) |
|
| 289 | + function($matches) use ($callback, $filters) |
|
| 290 | 290 | { |
| 291 | 291 | $subscripts = array(); |
| 292 | 292 | |
| 293 | 293 | // If this variable is an array, get the subscripts |
| 294 | - if( '' !== $matches[2] ) |
|
| 294 | + if ('' !== $matches[2]) |
|
| 295 | 295 | { |
| 296 | 296 | preg_match_all('/[\w-]+/i', $matches[2], $subscripts); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - $val = call_user_func_array( $callback, array( $matches[1],@$subscripts[0] ) ); |
|
| 299 | + $val = call_user_func_array($callback, array($matches[1], @$subscripts[0])); |
|
| 300 | 300 | |
| 301 | 301 | // If there are filters, apply them |
| 302 | - if( '' !== $matches[3] ) |
|
| 302 | + if ('' !== $matches[3]) |
|
| 303 | 303 | { |
| 304 | - $val = $this->apply_filters( substr( $matches[3], 1 ), $val, $filters ); |
|
| 304 | + $val = $this->apply_filters(substr($matches[3], 1), $val, $filters); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | return $val; |
@@ -317,24 +317,24 @@ discard block |
||
| 317 | 317 | * @param array $filters Array of callback functions |
| 318 | 318 | * @return string The value after all filters have been applied |
| 319 | 319 | */ |
| 320 | - protected function apply_filters( $filters_string, $value, $filters = array() ) |
|
| 320 | + protected function apply_filters($filters_string, $value, $filters = array()) |
|
| 321 | 321 | { |
| 322 | - foreach( explode( '|', $filters_string) as $filter ) |
|
| 322 | + foreach (explode('|', $filters_string) as $filter) |
|
| 323 | 323 | { |
| 324 | - $args = array( $value ); |
|
| 324 | + $args = array($value); |
|
| 325 | 325 | |
| 326 | - if( false !== strrpos( $filters_string, "(" ) ) |
|
| 326 | + if (false !== strrpos($filters_string, "(")) |
|
| 327 | 327 | { |
| 328 | - $pieces = explode( '(', $filter ); |
|
| 328 | + $pieces = explode('(', $filter); |
|
| 329 | 329 | $filter = $pieces[0]; |
| 330 | - $params = explode( ',', str_replace( ')', '', $pieces[1] ) ); |
|
| 331 | - array_walk( $params, array( $this, 'strtoval' ) ); // Convert string values to actual values |
|
| 332 | - $args = array_merge( $args, $params ); |
|
| 330 | + $params = explode(',', str_replace(')', '', $pieces[1])); |
|
| 331 | + array_walk($params, array($this, 'strtoval')); // Convert string values to actual values |
|
| 332 | + $args = array_merge($args, $params); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if( key_exists( $filter, $filters ) ) |
|
| 335 | + if (key_exists($filter, $filters)) |
|
| 336 | 336 | { |
| 337 | - $value = call_user_func_array( $filters[$filter], $args ); |
|
| 337 | + $value = call_user_func_array($filters[$filter], $args); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | return $value; |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @param string $str The string to be converted (passed by reference) |
| 347 | 347 | */ |
| 348 | - protected function strtoval( &$str ) |
|
| 348 | + protected function strtoval(&$str) |
|
| 349 | 349 | { |
| 350 | - if( 'false' === strtolower($str) ) $str = false; |
|
| 351 | - if( 'true' === strtolower($str) ) $str = true; |
|
| 352 | - if( false !== strrpos( $str, "'" ) ) $str = str_replace ( "'", "", $str ); |
|
| 353 | - if( is_numeric( $str ) ) $str = floatval( $str ); |
|
| 350 | + if ('false' === strtolower($str)) $str = false; |
|
| 351 | + if ('true' === strtolower($str)) $str = true; |
|
| 352 | + if (false !== strrpos($str, "'")) $str = str_replace("'", "", $str); |
|
| 353 | + if (is_numeric($str)) $str = floatval($str); |
|
| 354 | 354 | } |
| 355 | 355 | } |
@@ -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 | /** |
| 13 | 13 | * Enqueue a dynamic stylesheet |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | * @param boolean $cache Whether to store the compiled version of this |
| 25 | 25 | * stylesheet in cache to avoid compilation on every page load. |
| 26 | 26 | */ |
| 27 | - function wp_dynamic_css_enqueue( $handle, $path, $print = true, $minify = false, $cache = false ) |
|
| 27 | + function wp_dynamic_css_enqueue($handle, $path, $print = true, $minify = false, $cache = false) |
|
| 28 | 28 | { |
| 29 | 29 | $dcss = DynamicCSSCompiler::get_instance(); |
| 30 | - $dcss->register_style( $handle, $path, $print, $minify, $cache ); |
|
| 30 | + $dcss->register_style($handle, $path, $print, $minify, $cache); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if( !function_exists('wp_dynamic_css_set_callback') ) |
|
| 34 | +if (!function_exists('wp_dynamic_css_set_callback')) |
|
| 35 | 35 | { |
| 36 | 36 | /** |
| 37 | 37 | * Set the value retrieval callback function |
@@ -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 | /** |
| 59 | 59 | * Clear the cached compiled CSS for the given handle. |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @param string $handle The name of the stylesheet to be cleared from cache |
| 67 | 67 | */ |
| 68 | - function wp_dynamic_css_clear_cache( $handle ) |
|
| 68 | + function wp_dynamic_css_clear_cache($handle) |
|
| 69 | 69 | { |
| 70 | 70 | $cache = DynamicCSSCache::get_instance(); |
| 71 | - $cache->clear( $handle ); |
|
| 71 | + $cache->clear($handle); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -if( !function_exists('wp_dynamic_css_register_filter') ) |
|
| 75 | +if (!function_exists('wp_dynamic_css_register_filter')) |
|
| 76 | 76 | { |
| 77 | 77 | /** |
| 78 | 78 | * Register a filter function for a given stylesheet handle. |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | * @param Callable $callback The actual filter function. Accepts the $value |
| 110 | 110 | * as an argument. Should return the filtered value. |
| 111 | 111 | */ |
| 112 | - function wp_dynamic_css_register_filter( $handle, $filter_name, $callback ) |
|
| 112 | + function wp_dynamic_css_register_filter($handle, $filter_name, $callback) |
|
| 113 | 113 | { |
| 114 | 114 | $dcss = DynamicCSSCompiler::get_instance(); |
| 115 | - $dcss->register_filter( $handle, $filter_name, $callback ); |
|
| 115 | + $dcss->register_filter($handle, $filter_name, $callback); |
|
| 116 | 116 | } |
| 117 | 117 | } |