PluginProbe
WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript / trunk
WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript vtrunk
trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.4 1.5 1.5.1 1.6 2.0 2.0.1
wp-super-minify / includes / min / lib / Minify / DebugDetector.php

DebugDetector.php in WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript trunk, at includes/min/lib/Minify/DebugDetector.php

31 lines 784 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 {
11 public static function shouldDebugRequest(Minify_Env $env)
12 {
13 if ($env->get('debug') !== null) {
14 return true;
15 }
16
17 $cookieValue = $env->cookie('minifyDebug');
18 if ($cookieValue) {
19 foreach (preg_split('/\\s+/', $cookieValue) as $debugUri) {
20 $pattern = '@' . preg_quote($debugUri, '@') . '@i';
21 $pattern = str_replace(array('\\*', '\\?'), array('.*', '.'), $pattern);
22 if (preg_match($pattern, $env->getRequestUri())) {
23 return true;
24 }
25 }
26 }
27
28 return false;
29 }
30 }
31