initial commit
[namibia] / public / min / lib / Minify / DebugDetector.php
1 <?php
2
3 /**
4  * Detect whether request should be debugged
5  *
6  * @package Minify
7  * @author Stephen Clay <steve@mrclay.org>
8  */
9 class Minify_DebugDetector {
10     public static function shouldDebugRequest($cookie, $get, $requestUri)
11     {
12         if (isset($get['debug'])) {
13             return true;
14         }
15         if (! empty($cookie['minifyDebug'])) {
16             foreach (preg_split('/\\s+/', $cookie['minifyDebug']) as $debugUri) {
17                 $pattern = '@' . preg_quote($debugUri, '@') . '@i';
18                 $pattern = str_replace(array('\\*', '\\?'), array('.*', '.'), $pattern);
19                 if (preg_match($pattern, $requestUri)) {
20                     return true;
21                 }
22             }
23         }
24         return false;
25     }
26 }