summaryrefslogtreecommitdiffstats
path: root/admin/survey/minify/lib/Minify
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /admin/survey/minify/lib/Minify
parentprvi-commit (diff)
download1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip
Diffstat (limited to '')
-rw-r--r--admin/survey/minify/lib/Minify.php7
-rw-r--r--admin/survey/minify/lib/Minify/App.php6
-rw-r--r--admin/survey/minify/lib/Minify/CSSmin.php12
-rw-r--r--admin/survey/minify/lib/Minify/Cache/Null.php2
-rw-r--r--admin/survey/minify/lib/Minify/Cache/WinCache.php2
-rw-r--r--admin/survey/minify/lib/Minify/Controller/Files.php1
-rw-r--r--admin/survey/minify/lib/Minify/Controller/Groups.php1
-rw-r--r--admin/survey/minify/lib/Minify/Controller/Page.php1
-rw-r--r--admin/survey/minify/lib/Minify/ControllerInterface.php2
-rw-r--r--admin/survey/minify/lib/Minify/HTML.php59
-rw-r--r--admin/survey/minify/lib/Minify/ImportProcessor.php4
-rw-r--r--admin/survey/minify/lib/Minify/JS/ClosureCompiler.php4
-rw-r--r--admin/survey/minify/lib/Minify/NailgunClosureCompiler.php2
-rw-r--r--admin/survey/minify/lib/Minify/Source/Factory.php2
-rw-r--r--admin/survey/minify/lib/Minify/YUICompressor.php1
15 files changed, 57 insertions, 49 deletions
diff --git a/admin/survey/minify/lib/Minify.php b/admin/survey/minify/lib/Minify.php
index b01a2b9..047d9ed 100644
--- a/admin/survey/minify/lib/Minify.php
+++ b/admin/survey/minify/lib/Minify.php
@@ -242,7 +242,7 @@ class Minify
if (! $this->options['quiet']) {
$this->errorExit($this->options['badRequestHeader'], self::URL_DEBUG);
} else {
- list(,$statusCode) = explode(' ', $this->options['badRequestHeader']);
+ list(, $statusCode) = explode(' ', $this->options['badRequestHeader']);
return array(
'success' => false,
@@ -470,7 +470,7 @@ class Minify
public function errorExit($header, $url = '', $msgHtml = '')
{
$url = htmlspecialchars($url, ENT_QUOTES);
- list(,$h1) = explode(' ', $header, 2);
+ list(, $h1) = explode(' ', $header, 2);
$h1 = htmlspecialchars($h1);
// FastCGI environments require 3rd arg to header() to be set
list(, $code) = explode(' ', $header, 3);
@@ -593,7 +593,8 @@ class Minify
! $source // yes, we ran out of sources
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)
|| $minifier !== $lastMinifier // yes, minifier changed
- || $options !== $lastOptions)) { // yes, options changed
+ || $options !== $lastOptions // yes, options changed
+ )) {
// minify previous sources with last settings
$imploded = implode($implodeSeparator, $groupToProcessTogether);
$groupToProcessTogether = array();
diff --git a/admin/survey/minify/lib/Minify/App.php b/admin/survey/minify/lib/Minify/App.php
index 5ddb3e9..1270672 100644
--- a/admin/survey/minify/lib/Minify/App.php
+++ b/admin/survey/minify/lib/Minify/App.php
@@ -80,6 +80,12 @@ class App extends Container
};
$varNames = array_map($prefixer, $propNames);
+ $varDefined = get_defined_vars();
+
+ $varNames = array_filter($varNames, function ($name) use ($varDefined) {
+ return array_key_exists($name, $varDefined);
+ });
+
$vars = compact($varNames);
foreach ($varNames as $varName) {
diff --git a/admin/survey/minify/lib/Minify/CSSmin.php b/admin/survey/minify/lib/Minify/CSSmin.php
index dcde782..7fbcb68 100644
--- a/admin/survey/minify/lib/Minify/CSSmin.php
+++ b/admin/survey/minify/lib/Minify/CSSmin.php
@@ -73,16 +73,16 @@ class Minify_CSSmin
}
if ($options['currentDir']) {
return Minify_CSS_UriRewriter::rewrite(
- $css
- ,$options['currentDir']
- ,$options['docRoot']
- ,$options['symlinks']
+ $css,
+ $options['currentDir'],
+ $options['docRoot'],
+ $options['symlinks']
);
}
return Minify_CSS_UriRewriter::prepend(
- $css
- ,$options['prependRelativePath']
+ $css,
+ $options['prependRelativePath']
);
}
}
diff --git a/admin/survey/minify/lib/Minify/Cache/Null.php b/admin/survey/minify/lib/Minify/Cache/Null.php
index b6f6566..0c9183e 100644
--- a/admin/survey/minify/lib/Minify/Cache/Null.php
+++ b/admin/survey/minify/lib/Minify/Cache/Null.php
@@ -64,4 +64,4 @@ class Minify_Cache_Null implements Minify_CacheInterface
public function fetch($id)
{
}
-} \ No newline at end of file
+}
diff --git a/admin/survey/minify/lib/Minify/Cache/WinCache.php b/admin/survey/minify/lib/Minify/Cache/WinCache.php
index 089d66d..cec9cd8 100644
--- a/admin/survey/minify/lib/Minify/Cache/WinCache.php
+++ b/admin/survey/minify/lib/Minify/Cache/WinCache.php
@@ -136,4 +136,4 @@ class Minify_Cache_WinCache implements Minify_CacheInterface
return true;
}
-} \ No newline at end of file
+}
diff --git a/admin/survey/minify/lib/Minify/Controller/Files.php b/admin/survey/minify/lib/Minify/Controller/Files.php
index a9bb941..32d5a56 100644
--- a/admin/survey/minify/lib/Minify/Controller/Files.php
+++ b/admin/survey/minify/lib/Minify/Controller/Files.php
@@ -68,4 +68,3 @@ class Minify_Controller_Files extends Minify_Controller_Base
return new Minify_ServeConfiguration($options, $sources);
}
}
-
diff --git a/admin/survey/minify/lib/Minify/Controller/Groups.php b/admin/survey/minify/lib/Minify/Controller/Groups.php
index 6d4e5f4..521a58e 100644
--- a/admin/survey/minify/lib/Minify/Controller/Groups.php
+++ b/admin/survey/minify/lib/Minify/Controller/Groups.php
@@ -73,4 +73,3 @@ class Minify_Controller_Groups extends Minify_Controller_Files
return parent::createConfiguration($options);
}
}
-
diff --git a/admin/survey/minify/lib/Minify/Controller/Page.php b/admin/survey/minify/lib/Minify/Controller/Page.php
index 8ca00d5..3fa0ee3 100644
--- a/admin/survey/minify/lib/Minify/Controller/Page.php
+++ b/admin/survey/minify/lib/Minify/Controller/Page.php
@@ -66,4 +66,3 @@ class Minify_Controller_Page extends Minify_Controller_Base
return new Minify_ServeConfiguration($options, $sources, $selectionId);
}
}
-
diff --git a/admin/survey/minify/lib/Minify/ControllerInterface.php b/admin/survey/minify/lib/Minify/ControllerInterface.php
index d468635..dad19a9 100644
--- a/admin/survey/minify/lib/Minify/ControllerInterface.php
+++ b/admin/survey/minify/lib/Minify/ControllerInterface.php
@@ -19,4 +19,4 @@ interface Minify_ControllerInterface
* @return Minify_Env
*/
public function getEnv();
-} \ No newline at end of file
+}
diff --git a/admin/survey/minify/lib/Minify/HTML.php b/admin/survey/minify/lib/Minify/HTML.php
index 24b14ac..c5caad2 100644
--- a/admin/survey/minify/lib/Minify/HTML.php
+++ b/admin/survey/minify/lib/Minify/HTML.php
@@ -99,32 +99,34 @@ class Minify_HTML
// replace SCRIPTs (and minify) with placeholders
$this->_html = preg_replace_callback(
- '/(\\s*)<script(\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/iu'
- ,array($this, '_removeScriptCB')
- ,$this->_html);
+ '/(\\s*)<script(\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/iu',
+ array($this, '_removeScriptCB'),
+ $this->_html
+ );
// replace STYLEs (and minify) with placeholders
$this->_html = preg_replace_callback(
- '/\\s*<style(\\b[^>]*>)([\\s\\S]*?)<\\/style>\\s*/iu'
- ,array($this, '_removeStyleCB')
- ,$this->_html);
+ '/\\s*<style(\\b[^>]*>)([\\s\\S]*?)<\\/style>\\s*/iu',
+ array($this, '_removeStyleCB'),
+ $this->_html
+ );
// remove HTML comments (not containing IE conditional comments).
$this->_html = preg_replace_callback(
- '/<!--([\\s\\S]*?)-->/u'
- ,array($this, '_commentCB')
- ,$this->_html);
+ '/<!--([\\s\\S]*?)-->/u',
+ array($this, '_commentCB'),
+ $this->_html
+ );
// replace PREs with placeholders
- $this->_html = preg_replace_callback('/\\s*<pre(\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/iu'
- ,array($this, '_removePreCB')
- ,$this->_html);
+ $this->_html = preg_replace_callback('/\\s*<pre(\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/iu', array($this, '_removePreCB'), $this->_html);
// replace TEXTAREAs with placeholders
$this->_html = preg_replace_callback(
- '/\\s*<textarea(\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/iu'
- ,array($this, '_removeTextareaCB')
- ,$this->_html);
+ '/\\s*<textarea(\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/iu',
+ array($this, '_removeTextareaCB'),
+ $this->_html
+ );
// trim each line.
// @todo take into account attribute values that span multiple lines.
@@ -139,24 +141,25 @@ class Minify_HTML
// remove ws outside of all elements
$this->_html = preg_replace(
- '/>(\\s(?:\\s*))?([^<]+)(\\s(?:\s*))?</u'
- ,'>$1$2$3<'
- ,$this->_html);
+ '/>(\\s(?:\\s*))?([^<]+)(\\s(?:\s*))?</u',
+ '>$1$2$3<',
+ $this->_html
+ );
// use newlines before 1st attribute in open tags (to limit line lengths)
$this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/iu', "$1\n$2", $this->_html);
// fill placeholders
$this->_html = str_replace(
- array_keys($this->_placeholders)
- ,array_values($this->_placeholders)
- ,$this->_html
+ array_keys($this->_placeholders),
+ array_values($this->_placeholders),
+ $this->_html
);
// issue 229: multi-pass to catch scripts that didn't get replaced in textareas
$this->_html = str_replace(
- array_keys($this->_placeholders)
- ,array_values($this->_placeholders)
- ,$this->_html
+ array_keys($this->_placeholders),
+ array_values($this->_placeholders),
+ $this->_html
);
return $this->_html;
@@ -164,7 +167,7 @@ class Minify_HTML
protected function _commentCB($m)
{
- return (0 === strpos($m[1], '[') || false !== strpos($m[1], '<!['))
+ return (0 === strpos($m[1], '[') || false !== strpos($m[1], '<![') || 0 === strpos($m[1], '#'))
? $m[0]
: '';
}
@@ -209,7 +212,8 @@ class Minify_HTML
: 'trim';
$css = call_user_func($minifier, $css);
- return $this->_reservePlace($this->_needsCdata($css)
+ return $this->_reservePlace(
+ $this->_needsCdata($css)
? "{$openStyle}/*<![CDATA[*/{$css}/*]]>*/</style>"
: "{$openStyle}{$css}</style>"
);
@@ -238,7 +242,8 @@ class Minify_HTML
: 'trim';
$js = call_user_func($minifier, $js);
- return $this->_reservePlace($this->_needsCdata($js)
+ return $this->_reservePlace(
+ $this->_needsCdata($js)
? "{$ws1}{$openScript}/*<![CDATA[*/{$js}/*]]>*/</script>{$ws2}"
: "{$ws1}{$openScript}{$js}</script>{$ws2}"
);
diff --git a/admin/survey/minify/lib/Minify/ImportProcessor.php b/admin/survey/minify/lib/Minify/ImportProcessor.php
index 0f8c981..57c22e8 100644
--- a/admin/survey/minify/lib/Minify/ImportProcessor.php
+++ b/admin/survey/minify/lib/Minify/ImportProcessor.php
@@ -66,7 +66,7 @@ class Minify_ImportProcessor
$this->_currentDir = dirname($file);
// remove UTF-8 BOM if present
- if (pack("CCC",0xef,0xbb,0xbf) === substr($content, 0, 3)) {
+ if (pack("CCC", 0xef, 0xbb, 0xbf) === substr($content, 0, 3)) {
$content = substr($content, 3);
}
// ensure uniform EOLs
@@ -182,7 +182,7 @@ class Minify_ImportProcessor
private function truepath($path)
{
// whether $path is unix or not
- $unipath = ('' === $path) || ($path{0} !== '/');
+ $unipath = ('' === $path) || ($path[0] !== '/');
// attempts to detect if path is relative in which case, add cwd
if (strpos($path, ':') === false && $unipath) {
diff --git a/admin/survey/minify/lib/Minify/JS/ClosureCompiler.php b/admin/survey/minify/lib/Minify/JS/ClosureCompiler.php
index 05e2e33..63f7b90 100644
--- a/admin/survey/minify/lib/Minify/JS/ClosureCompiler.php
+++ b/admin/survey/minify/lib/Minify/JS/ClosureCompiler.php
@@ -195,13 +195,13 @@ class Minify_JS_ClosureCompiler
curl_close($ch);
} else {
throw new Minify_JS_ClosureCompiler_Exception(
- "Could not make HTTP request: allow_url_open is false and cURL not available"
+ "Could not make HTTP request: allow_url_open is false and cURL not available"
);
}
if (false === $contents) {
throw new Minify_JS_ClosureCompiler_Exception(
- "No HTTP response from server"
+ "No HTTP response from server"
);
}
diff --git a/admin/survey/minify/lib/Minify/NailgunClosureCompiler.php b/admin/survey/minify/lib/Minify/NailgunClosureCompiler.php
index 683e30f..516cc5e 100644
--- a/admin/survey/minify/lib/Minify/NailgunClosureCompiler.php
+++ b/admin/survey/minify/lib/Minify/NailgunClosureCompiler.php
@@ -110,4 +110,4 @@ class Minify_NailgunClosureCompiler extends Minify_ClosureCompiler
$this->shell("$serverCommand </dev/null >/dev/null 2>/dev/null & sleep 10");
}
-} \ No newline at end of file
+}
diff --git a/admin/survey/minify/lib/Minify/Source/Factory.php b/admin/survey/minify/lib/Minify/Source/Factory.php
index 4371931..a817417 100644
--- a/admin/survey/minify/lib/Minify/Source/Factory.php
+++ b/admin/survey/minify/lib/Minify/Source/Factory.php
@@ -170,7 +170,7 @@ class Minify_Source_Factory
if ($this->options['noMinPattern'] && preg_match($this->options['noMinPattern'], $basename)) {
if (preg_match('~\.(css|less)$~i', $basename)) {
$spec['minifyOptions']['compress'] = false;
- // we still want URI rewriting to work for CSS
+ // we still want URI rewriting to work for CSS
} else {
$spec['minifier'] = 'Minify::nullMinifier';
}
diff --git a/admin/survey/minify/lib/Minify/YUICompressor.php b/admin/survey/minify/lib/Minify/YUICompressor.php
index 40fd02c..3d14f41 100644
--- a/admin/survey/minify/lib/Minify/YUICompressor.php
+++ b/admin/survey/minify/lib/Minify/YUICompressor.php
@@ -154,4 +154,3 @@ class Minify_YUICompressor
}
}
}
-