GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 7bdf98...52bff1 )
by Askupa
02:17
created
bootstrap.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
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
 /**
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
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,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * styles.
44 44
  */
45 45
 $dcss = DynamicCSSCompiler::get_instance();
46
-add_action( 'wp_print_styles', array( $dcss, 'print_styles' ), 100 );
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 46
\ No newline at end of file
47
+add_action('wp_print_styles', array($dcss, 'print_styles'), 100);
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'));
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
cache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
tests.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 /**
91 91
  * Value retrieval function
92 92
  */
93
-function callback( $varname, $subscripts )
93
+function callback($varname, $subscripts)
94 94
 {
95 95
     $values = array(
96 96
         'var1'  => 'value1',
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
     );
107 107
     
108 108
     $val = $values[$varname];
109
-    if( null !== $subscripts )
109
+    if (null !== $subscripts)
110 110
     {
111
-        foreach( $subscripts as $subscript )
111
+        foreach ($subscripts as $subscript)
112 112
         {
113 113
             $val = $val[$subscript];
114 114
         }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 /**
121 121
  * Simple string concat filter
122 122
  */
123
-function simple_filter_callback( $foo )
123
+function simple_filter_callback($foo)
124 124
 {
125 125
     return $foo.'bar';
126 126
 }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 /**
129 129
  * String concat filter with parameters
130 130
  */
131
-function complex_filter_callback( $value, $arg1 = '', $arg2 = '')
131
+function complex_filter_callback($value, $arg1 = '', $arg2 = '')
132 132
 {
133 133
     return $value.$arg1.$arg2;
134 134
 }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /**
137 137
  * Number adding filter
138 138
  */
139
-function add_filter_callback( $value, $a, $b )
139
+function add_filter_callback($value, $a, $b)
140 140
 {
141
-    return $value.($a+$b);
141
+    return $value.($a + $b);
142 142
 }
143 143
\ No newline at end of file
Please login to merge, or discard this patch.
functions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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->enqueue_style( $handle, $path, $print, $minify, $cache );
30
+        $dcss->enqueue_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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
compiler.php 2 patches
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
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( !$stylesheet['print'] && $this->callback_exists( $stylesheet['handle'] ) )
67
+            if (!$stylesheet['print'] && $this->callback_exists($stylesheet['handle']))
68 68
             {
69 69
                 wp_enqueue_style( 
70 70
                     'wp-dynamic-css-'.$stylesheet['handle'],
71
-                    esc_url_raw( add_query_arg(array(
71
+                    esc_url_raw(add_query_arg(array(
72 72
                         'action' => 'wp_dynamic_css',
73 73
                         'handle' => $stylesheet['handle']
74
-                    ), admin_url( 'admin-ajax.php')))
74
+                    ), admin_url('admin-ajax.php')))
75 75
                 );
76 76
             }
77 77
         }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function print_styles()
84 84
     {        
85
-        foreach( $this->stylesheets as $stylesheet )
85
+        foreach ($this->stylesheets as $stylesheet)
86 86
         {
87
-            if( $stylesheet['print'] && $this->callback_exists( $stylesheet['handle'] ) )
87
+            if ($stylesheet['print'] && $this->callback_exists($stylesheet['handle']))
88 88
             {
89
-                $compiled_css = $this->get_compiled_style( $stylesheet );
89
+                $compiled_css = $this->get_compiled_style($stylesheet);
90 90
         
91 91
                 echo "<style id=\"wp-dynamic-css-".$stylesheet['handle']."\">\n";
92 92
                 include 'style.phtml';
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function ajax_callback()
103 103
     {
104
-        header( "Content-type: text/css; charset: UTF-8" );
105
-        $handle = filter_input( INPUT_GET, 'handle' );
104
+        header("Content-type: text/css; charset: UTF-8");
105
+        $handle = filter_input(INPUT_GET, 'handle');
106 106
         
107
-        foreach( $this->stylesheets as $stylesheet )
107
+        foreach ($this->stylesheets as $stylesheet)
108 108
         {
109
-            if( $handle === $stylesheet['handle'] )
109
+            if ($handle === $stylesheet['handle'])
110 110
             {
111
-                $compiled_css = $this->get_compiled_style( $stylesheet );
111
+                $compiled_css = $this->get_compiled_style($stylesheet);
112 112
                 include 'style.phtml';
113 113
             }
114 114
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      * @param boolean $cache Whether to store the compiled version of this 
128 128
      * stylesheet in cache to avoid compilation on every page load.
129 129
      */
130
-    public function enqueue_style( $handle, $path, $print, $minify, $cache )
130
+    public function enqueue_style($handle, $path, $print, $minify, $cache)
131 131
     {
132 132
         $this->stylesheets[] = array(
133 133
             'handle'=> $handle,
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      * @param type $handle The stylesheet's name/id
145 145
      * @param type $callback
146 146
      */
147
-    public function register_callback( $handle, $callback )
147
+    public function register_callback($handle, $callback)
148 148
     {
149 149
         $this->callbacks[$handle] = $callback;
150 150
     }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     /**
153 153
      * Register a filter function for a given stylesheet handle.
154 154
      */
155
-    public function register_filter( $handle, $filter_name, $callback )
155
+    public function register_filter($handle, $filter_name, $callback)
156 156
     {
157
-        if( !array_key_exists( $handle, $this->filters ) )
157
+        if (!array_key_exists($handle, $this->filters))
158 158
         {
159 159
             $this->filters[$handle] = array();
160 160
         }
@@ -169,31 +169,31 @@  discard block
 block discarded – undo
169 169
      * stored in $this->stylesheets
170 170
      * @return type
171 171
      */
172
-    protected function get_compiled_style( $style )
172
+    protected function get_compiled_style($style)
173 173
     {
174 174
         $cache = DynamicCSSCache::get_instance();
175 175
         
176 176
         // Use cached compiled CSS if applicable
177
-        if( $style['cache'] )
177
+        if ($style['cache'])
178 178
         {
179
-            $cached_css = $cache->get( $style['handle'] );
180
-            if( false !== $cached_css )
179
+            $cached_css = $cache->get($style['handle']);
180
+            if (false !== $cached_css)
181 181
             {
182 182
                 return $cached_css;
183 183
             }
184 184
         }
185 185
 
186
-        $css = file_get_contents( $style['path'] );
187
-        if( $style['minify'] ) $css = $this->minify_css( $css );
186
+        $css = file_get_contents($style['path']);
187
+        if ($style['minify']) $css = $this->minify_css($css);
188 188
         
189 189
         // Compile the dynamic CSS
190 190
         $compiled_css = $this->compile_css( 
191 191
             $css, 
192 192
             $this->callbacks[$style['handle']], 
193
-            key_exists( $style['handle'], $this->filters ) ? $this->filters[$style['handle']] : array()
193
+            key_exists($style['handle'], $this->filters) ? $this->filters[$style['handle']] : array()
194 194
         );
195 195
         
196
-        $cache->update( $style['handle'], $compiled_css );
196
+        $cache->update($style['handle'], $compiled_css);
197 197
         return $compiled_css;
198 198
     }
199 199
     
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
      * @param string $css CSS style to minify
205 205
      * @return string Minified CSS
206 206
      */
207
-    protected function minify_css( $css )
207
+    protected function minify_css($css)
208 208
     {
209
-        return preg_replace( '@({)\s+|(\;)\s+|/\*.+?\*\/|\R@is', '$1$2 ', $css );
209
+        return preg_replace('@({)\s+|(\;)\s+|/\*.+?\*\/|\R@is', '$1$2 ', $css);
210 210
     }
211 211
     
212 212
     /**
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
      * @param string $handle 
216 216
      * @return boolean
217 217
      */
218
-    protected function callback_exists( $handle )
218
+    protected function callback_exists($handle)
219 219
     {
220
-        if( array_key_exists( $handle, $this->callbacks ) )
220
+        if (array_key_exists($handle, $this->callbacks))
221 221
         {
222 222
             return true;
223 223
         }
@@ -239,33 +239,33 @@  discard block
 block discarded – undo
239 239
      * @return string The compiled CSS after converting the variables to their 
240 240
      * corresponding values
241 241
      */
242
-    protected function compile_css( $css, $callback, $filters )
242
+    protected function compile_css($css, $callback, $filters)
243 243
     {
244 244
         return preg_replace_callback( 
245 245
                 
246
-            "#".                        // Begin
247
-            "\\$".                      // Must start with $
248
-            "([\\w-]+)".                // Match alphanumeric characters and dashes
249
-            "((?:\\['?[\\w-]+'?\\])*)". // Optionally match array subscripts i.e. $myVar['index']
250
-            "((?:".                     // Optionally match pipe filters i.e. $myVar|myFilter
251
-                "\\|[\\w-]+".           // Starting with the | character
252
-                "(\([\w\.,']+\))?".     // Filters can have strings and numbers i.e myFilter('string',1,2.5)
253
-            ")*)".                      // Allow for 0 or more piped filters
254
-            "#",                        // End
246
+            "#".// Begin
247
+            "\\$".// Must start with $
248
+            "([\\w-]+)".// Match alphanumeric characters and dashes
249
+            "((?:\\['?[\\w-]+'?\\])*)".// Optionally match array subscripts i.e. $myVar['index']
250
+            "((?:".// Optionally match pipe filters i.e. $myVar|myFilter
251
+                "\\|[\\w-]+".// Starting with the | character
252
+                "(\([\w\.,']+\))?".// Filters can have strings and numbers i.e myFilter('string',1,2.5)
253
+            ")*)".// Allow for 0 or more piped filters
254
+            "#", // End
255 255
             
256
-            function( $matches ) use ( $callback, $filters ) {
256
+            function($matches) use ($callback, $filters) {
257 257
                 // If this variable is an array, get the subscripts
258
-                if( '' !== $matches[2] )
258
+                if ('' !== $matches[2])
259 259
                 {
260 260
                     preg_match_all('/[\w-]+/i', $matches[2], $subscripts);
261 261
                 }
262 262
                 
263
-                $val = call_user_func_array( $callback, array($matches[1],@$subscripts[0]) );
263
+                $val = call_user_func_array($callback, array($matches[1], @$subscripts[0]));
264 264
                 
265 265
                 // Apply custom filters
266
-                if( '' !== $matches[3] )
266
+                if ('' !== $matches[3])
267 267
                 {
268
-                    $val = $this->apply_filters( substr($matches[3], 1), $val, $filters );
268
+                    $val = $this->apply_filters(substr($matches[3], 1), $val, $filters);
269 269
                 }
270 270
                 
271 271
                 return $val;
@@ -280,24 +280,24 @@  discard block
 block discarded – undo
280 280
      * @param array $filters Array of callback functions
281 281
      * @return string The value after all filters have been applied
282 282
      */
283
-    protected function apply_filters( $filters_string, $value, $filters )
283
+    protected function apply_filters($filters_string, $value, $filters)
284 284
     {
285
-        foreach( explode( '|', $filters_string) as $filter )
285
+        foreach (explode('|', $filters_string) as $filter)
286 286
         {
287
-            $args = array( $value );
287
+            $args = array($value);
288 288
             
289
-            if( false !== strrpos( $filters_string, "(" ) )
289
+            if (false !== strrpos($filters_string, "("))
290 290
             {
291
-                $pieces = explode( '(', $filter );
291
+                $pieces = explode('(', $filter);
292 292
                 $filter = $pieces[0];
293
-                $params = explode( ',', str_replace( ')', '', $pieces[1] ) );
294
-                array_walk( $params, array( $this, 'strtoval' ) ); // Convert string values to actual values
295
-                $args = array_merge( $args, $params );
293
+                $params = explode(',', str_replace(')', '', $pieces[1]));
294
+                array_walk($params, array($this, 'strtoval')); // Convert string values to actual values
295
+                $args = array_merge($args, $params);
296 296
             }
297 297
             
298
-            if( key_exists( $filter, $filters ) )
298
+            if (key_exists($filter, $filters))
299 299
             {
300
-                $value = call_user_func_array( $filters[$filter], $args );
300
+                $value = call_user_func_array($filters[$filter], $args);
301 301
             }
302 302
         }
303 303
         return $value;
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
      * 
309 309
      * @param string $str The string to be converted (passed by reference)
310 310
      */
311
-    protected function strtoval( &$str )
311
+    protected function strtoval(&$str)
312 312
     {
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 );
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);
317 317
     }
318 318
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -184,7 +184,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.