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 ( 61806a...459bf7 )
by Askupa
02:40
created
compiler.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -152,6 +152,9 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -62,11 +62,11 @@  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( $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.