| @@ -60,9 +60,9 @@ discard block | ||
| 60 | 60 |      { | 
| 61 | 61 | // Only enqueue if there is at least one dynamic stylesheet that is | 
| 62 | 62 | // set to be loaded externally | 
| 63 | - if( 0 < count( array_filter($this->stylesheets, array( $this, 'filter_external' ) ) ) ) | |
| 63 | + if (0 < count(array_filter($this->stylesheets, array($this, 'filter_external')))) | |
| 64 | 64 |          { | 
| 65 | - wp_enqueue_style( 'wp-dynamic-css', admin_url( 'admin-ajax.php?action=wp_dynamic_css' ) ); | |
| 65 | +            wp_enqueue_style('wp-dynamic-css', admin_url('admin-ajax.php?action=wp_dynamic_css')); | |
| 66 | 66 | } | 
| 67 | 67 | } | 
| 68 | 68 | |
| @@ -73,15 +73,15 @@ discard block | ||
| 73 | 73 | public function compile_printed_styles() | 
| 74 | 74 |      { | 
| 75 | 75 | $compiled_css = ''; | 
| 76 | - $styles = array_filter($this->stylesheets, array( $this, 'filter_print' ) ); | |
| 76 | + $styles = array_filter($this->stylesheets, array($this, 'filter_print')); | |
| 77 | 77 | |
| 78 | 78 | // Bail if there are no styles to be printed | 
| 79 | - if( count( $styles ) === 0 ) return; | |
| 79 | + if (count($styles) === 0) return; | |
| 80 | 80 | |
| 81 | - foreach( $styles as $style ) | |
| 81 | + foreach ($styles as $style) | |
| 82 | 82 |          { | 
| 83 | - $css = file_get_contents( $style['path'] ); | |
| 84 | - $compiled_css .= $this->compile_css( $css, $this->callbacks[$style['handle']] )."\n"; | |
| 83 | + $css = file_get_contents($style['path']); | |
| 84 | + $compiled_css .= $this->compile_css($css, $this->callbacks[$style['handle']])."\n"; | |
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 | echo "<style id=\"wp-dynamic-css\">\n"; | 
| @@ -95,14 +95,14 @@ discard block | ||
| 95 | 95 | */ | 
| 96 | 96 | public function compile_external_styles() | 
| 97 | 97 |      { | 
| 98 | - header( "Content-type: text/css; charset: UTF-8" ); | |
| 98 | +        header("Content-type: text/css; charset: UTF-8"); | |
| 99 | 99 | $compiled_css = ''; | 
| 100 | - $styles = array_filter($this->stylesheets, array( $this, 'filter_external' ) ); | |
| 100 | + $styles = array_filter($this->stylesheets, array($this, 'filter_external')); | |
| 101 | 101 | |
| 102 | - foreach( $styles as $style ) | |
| 102 | + foreach ($styles as $style) | |
| 103 | 103 |          { | 
| 104 | - $css = file_get_contents( $style['path'] ); | |
| 105 | - $compiled_css .= $this->compile_css( $css, $this->callbacks[$style['handle']] )."\n"; | |
| 104 | + $css = file_get_contents($style['path']); | |
| 105 | + $compiled_css .= $this->compile_css($css, $this->callbacks[$style['handle']])."\n"; | |
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | 108 | include 'style.phtml'; | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | * @param boolean $print Whether to print the compiled CSS to the document | 
| 118 | 118 | * head, or include it as an external CSS file | 
| 119 | 119 | */ | 
| 120 | - public function enqueue_style( $handle, $path, $print ) | |
| 120 | + public function enqueue_style($handle, $path, $print) | |
| 121 | 121 |      { | 
| 122 | 122 | $this->stylesheets[] = array( | 
| 123 | 123 | 'handle'=> $handle, | 
| @@ -132,7 +132,7 @@ discard block | ||
| 132 | 132 | * @param type $handle The stylesheet's name/id | 
| 133 | 133 | * @param type $callback | 
| 134 | 134 | */ | 
| 135 | - public function register_callback( $handle, $callback ) | |
| 135 | + public function register_callback($handle, $callback) | |
| 136 | 136 |      { | 
| 137 | 137 | $this->callbacks[$handle] = $callback; | 
| 138 | 138 | } | 
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | * @param array $style | 
| 145 | 145 | * @return boolean | 
| 146 | 146 | */ | 
| 147 | - protected function filter_print( $style ) | |
| 147 | + protected function filter_print($style) | |
| 148 | 148 |      { | 
| 149 | 149 | return true === $style['print']; | 
| 150 | 150 | } | 
| @@ -156,7 +156,7 @@ discard block | ||
| 156 | 156 | * @param array $style | 
| 157 | 157 | * @return boolean | 
| 158 | 158 | */ | 
| 159 | - protected function filter_external( $style ) | |
| 159 | + protected function filter_external($style) | |
| 160 | 160 |      { | 
| 161 | 161 | return true !== $style['print']; | 
| 162 | 162 | } | 
| @@ -172,15 +172,15 @@ discard block | ||
| 172 | 172 | * @return string The compiled CSS after converting the variables to their | 
| 173 | 173 | * corresponding values | 
| 174 | 174 | */ | 
| 175 | - protected function compile_css( $css, $callback ) | |
| 175 | + protected function compile_css($css, $callback) | |
| 176 | 176 |      {    | 
| 177 | -        return preg_replace_callback( "#\\$([\\w-]+)((?:\\['?[\\w-]+'?\\])*)#", function( $matches ) use ( $callback ) { | |
| 177 | +        return preg_replace_callback("#\\$([\\w-]+)((?:\\['?[\\w-]+'?\\])*)#", function($matches) use ($callback) { | |
| 178 | 178 | // If this variable is an array, get the subscripts | 
| 179 | - if( '' !== $matches[2] ) | |
| 179 | +            if ('' !== $matches[2]) | |
| 180 | 180 |              { | 
| 181 | 181 |                  preg_match_all('/[\w-]+/i', $matches[2], $subscripts); | 
| 182 | 182 | } | 
| 183 | - return call_user_func_array( $callback, array($matches[1],@$subscripts[0]) ); | |
| 183 | + return call_user_func_array($callback, array($matches[1], @$subscripts[0])); | |
| 184 | 184 | }, $css); | 
| 185 | 185 | } | 
| 186 | 186 | } |