mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-02-01 09:39:58 +09:00
Add CoolSMS PHP SDK, and update Composer dependencies
This commit is contained in:
parent
40c43e8fa0
commit
c719fc0500
242 changed files with 3487 additions and 28983 deletions
104
vendor/matthiasmullie/minify/src/CSS.php
vendored
104
vendor/matthiasmullie/minify/src/CSS.php
vendored
|
|
@ -12,7 +12,7 @@ use MatthiasMullie\PathConverter\Converter;
|
|||
*
|
||||
* @author Matthias Mullie <minify@mullie.eu>
|
||||
* @author Tijs Verkoyen <minify@verkoyen.eu>
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved.
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
||||
* @license MIT License
|
||||
*/
|
||||
class CSS extends Minify
|
||||
|
|
@ -76,7 +76,6 @@ class CSS extends Minify
|
|||
protected function moveImportsToTop($content)
|
||||
{
|
||||
if (preg_match_all('/@import[^;]+;/', $content, $matches)) {
|
||||
|
||||
// remove from content
|
||||
foreach ($matches[0] as $import) {
|
||||
$content = str_replace($import, '', $content);
|
||||
|
|
@ -84,7 +83,7 @@ class CSS extends Minify
|
|||
|
||||
// add to top
|
||||
$content = implode('', $matches[0]).$content;
|
||||
};
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
|
@ -95,9 +94,9 @@ class CSS extends Minify
|
|||
* @import's will be loaded and their content merged into the original file,
|
||||
* to save HTTP requests.
|
||||
*
|
||||
* @param string $source The file to combine imports for.
|
||||
* @param string $content The CSS content to combine imports for.
|
||||
* @param string[] $parents Parent paths, for circular reference checks.
|
||||
* @param string $source The file to combine imports for
|
||||
* @param string $content The CSS content to combine imports for
|
||||
* @param string[] $parents Parent paths, for circular reference checks
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
|
@ -247,8 +246,8 @@ class CSS extends Minify
|
|||
* @url(image.jpg) images will be loaded and their content merged into the
|
||||
* original file, to save HTTP requests.
|
||||
*
|
||||
* @param string $source The file to import files for.
|
||||
* @param string $content The CSS content to import files for.
|
||||
* @param string $source The file to import files for
|
||||
* @param string $content The CSS content to import files for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -291,10 +290,10 @@ class CSS extends Minify
|
|||
* Minify the data.
|
||||
* Perform CSS optimizations.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @param string[] $parents Parent paths, for circular reference checks.
|
||||
* @param string[optional] $path Path to write the data to
|
||||
* @param string[] $parents Parent paths, for circular reference checks
|
||||
*
|
||||
* @return string The minified data.
|
||||
* @return string The minified data
|
||||
*/
|
||||
public function execute($path = null, $parents = array())
|
||||
{
|
||||
|
|
@ -315,6 +314,7 @@ class CSS extends Minify
|
|||
$css = $this->stripWhitespace($css);
|
||||
$css = $this->shortenHex($css);
|
||||
$css = $this->shortenZeroes($css);
|
||||
$css = $this->shortenFontWeights($css);
|
||||
$css = $this->stripEmptyTags($css);
|
||||
|
||||
// restore the string we've extracted earlier
|
||||
|
|
@ -351,7 +351,7 @@ class CSS extends Minify
|
|||
* (e.g. ../../images/image.gif, if the new CSS file is 1 folder deeper).
|
||||
*
|
||||
* @param Converter $converter Relative path converter
|
||||
* @param string $content The CSS content to update relative urls for.
|
||||
* @param string $content The CSS content to update relative urls for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -479,7 +479,7 @@ class CSS extends Minify
|
|||
* Shorthand hex color codes.
|
||||
* #FF0000 -> #F00.
|
||||
*
|
||||
* @param string $content The CSS content to shorten the hex color codes for.
|
||||
* @param string $content The CSS content to shorten the hex color codes for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -487,13 +487,65 @@ class CSS extends Minify
|
|||
{
|
||||
$content = preg_replace('/(?<![\'"])#([0-9a-z])\\1([0-9a-z])\\2([0-9a-z])\\3(?![\'"])/i', '#$1$2$3', $content);
|
||||
|
||||
return $content;
|
||||
// we can shorten some even more by replacing them with their color name
|
||||
$colors = array(
|
||||
'#F0FFFF' => 'azure',
|
||||
'#F5F5DC' => 'beige',
|
||||
'#A52A2A' => 'brown',
|
||||
'#FF7F50' => 'coral',
|
||||
'#FFD700' => 'gold',
|
||||
'#808080' => 'gray',
|
||||
'#008000' => 'green',
|
||||
'#4B0082' => 'indigo',
|
||||
'#FFFFF0' => 'ivory',
|
||||
'#F0E68C' => 'khaki',
|
||||
'#FAF0E6' => 'linen',
|
||||
'#800000' => 'maroon',
|
||||
'#000080' => 'navy',
|
||||
'#808000' => 'olive',
|
||||
'#CD853F' => 'peru',
|
||||
'#FFC0CB' => 'pink',
|
||||
'#DDA0DD' => 'plum',
|
||||
'#800080' => 'purple',
|
||||
'#F00' => 'red',
|
||||
'#FA8072' => 'salmon',
|
||||
'#A0522D' => 'sienna',
|
||||
'#C0C0C0' => 'silver',
|
||||
'#FFFAFA' => 'snow',
|
||||
'#D2B48C' => 'tan',
|
||||
'#FF6347' => 'tomato',
|
||||
'#EE82EE' => 'violet',
|
||||
'#F5DEB3' => 'wheat',
|
||||
);
|
||||
|
||||
return str_ireplace(array_keys($colors), $colors, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorten CSS font weights.
|
||||
*
|
||||
* @param string $content The CSS content to shorten the font weights for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function shortenFontWeights($content)
|
||||
{
|
||||
$weights = array(
|
||||
'normal' => 400,
|
||||
'bold' => 700,
|
||||
);
|
||||
|
||||
$callback = function ($match) use ($weights) {
|
||||
return $match[1].$weights[$match[2]];
|
||||
};
|
||||
|
||||
return preg_replace_callback('/(font-weight\s*:\s*)('.implode('|', array_keys($weights)).')(?=[;}])/', $callback, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shorthand 0 values to plain 0, instead of e.g. -0em.
|
||||
*
|
||||
* @param string $content The CSS content to shorten the zero values for.
|
||||
* @param string $content The CSS content to shorten the zero values for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -527,6 +579,24 @@ class CSS extends Minify
|
|||
// strip negative zeroes (-0 -> 0) & truncate zeroes (00 -> 0)
|
||||
$content = preg_replace('/'.$before.'-?0+'.$units.'?'.$after.'/', '0\\1', $content);
|
||||
|
||||
// remove zeroes where they make no sense in calc: e.g. calc(100px - 0)
|
||||
// the 0 doesn't have any effect, and this isn't even valid without unit
|
||||
// strip all `+ 0` or `- 0` occurrences: calc(10% + 0) -> calc(10%)
|
||||
// looped because there may be multiple 0s inside 1 group of parentheses
|
||||
do {
|
||||
$previous = $content;
|
||||
$content = preg_replace('/\(([^\(\)]+)\s+[\+\-]\s+0(\s+[^\(\)]+)?\)/', '(\\1\\2)', $content);
|
||||
} while ($content !== $previous);
|
||||
// strip all `0 +` occurrences: calc(0 + 10%) -> calc(10%)
|
||||
$content = preg_replace('/\(\s*0\s+\+\s+([^\(\)]+)\)/', '(\\1)', $content);
|
||||
// strip all `0 -` occurrences: calc(0 - 10%) -> calc(-10%)
|
||||
$content = preg_replace('/\(\s*0\s+\-\s+([^\(\)]+)\)/', '(-\\1)', $content);
|
||||
// I'm not going to attempt to optimize away `x * 0` instances:
|
||||
// it's dumb enough code already that it likely won't occur, and it's
|
||||
// too complex to do right (order of operations would have to be
|
||||
// respected etc)
|
||||
// what I cared about most here was fixing incorrectly truncated units
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
|
@ -553,7 +623,7 @@ class CSS extends Minify
|
|||
/**
|
||||
* Strip whitespace.
|
||||
*
|
||||
* @param string $content The CSS content to strip the whitespace for.
|
||||
* @param string $content The CSS content to strip the whitespace for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -587,7 +657,7 @@ class CSS extends Minify
|
|||
/**
|
||||
* Check if file is small enough to be imported.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
* @param string $path The path to the file
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
|||
85
vendor/matthiasmullie/minify/src/JS.php
vendored
85
vendor/matthiasmullie/minify/src/JS.php
vendored
|
|
@ -9,7 +9,7 @@ namespace MatthiasMullie\Minify;
|
|||
*
|
||||
* @author Matthias Mullie <minify@mullie.eu>
|
||||
* @author Tijs Verkoyen <minify@verkoyen.eu>
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved.
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
||||
* @license MIT License
|
||||
*/
|
||||
class JS extends Minify
|
||||
|
|
@ -64,6 +64,17 @@ class JS extends Minify
|
|||
*/
|
||||
protected $keywordsAfter = array();
|
||||
|
||||
/**
|
||||
* List of all JavaScript operators.
|
||||
*
|
||||
* Will be loaded from /data/js/operators.txt
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $operators = array();
|
||||
|
||||
/**
|
||||
* List of JavaScript operators that accept a <variable, value, ...> after
|
||||
* them. Some end of lines are not the end of a statement, like with these
|
||||
|
|
@ -111,6 +122,7 @@ class JS extends Minify
|
|||
$this->keywordsReserved = file($dataDir.'keywords_reserved.txt', $options);
|
||||
$this->keywordsBefore = file($dataDir.'keywords_before.txt', $options);
|
||||
$this->keywordsAfter = file($dataDir.'keywords_after.txt', $options);
|
||||
$this->operators = file($dataDir.'operators.txt', $options);
|
||||
$this->operatorsBefore = file($dataDir.'operators_before.txt', $options);
|
||||
$this->operatorsAfter = file($dataDir.'operators_after.txt', $options);
|
||||
}
|
||||
|
|
@ -119,9 +131,9 @@ class JS extends Minify
|
|||
* Minify the data.
|
||||
* Perform JS optimizations.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @param string[optional] $path Path to write the data to
|
||||
*
|
||||
* @return string The minified data.
|
||||
* @return string The minified data
|
||||
*/
|
||||
public function execute($path = null)
|
||||
{
|
||||
|
|
@ -156,9 +168,9 @@ class JS extends Minify
|
|||
$this->extractRegex();
|
||||
$content = $this->replace($content);
|
||||
|
||||
$content = $this->stripWhitespace($content);
|
||||
$content = $this->propertyNotation($content);
|
||||
$content = $this->shortenBools($content);
|
||||
$content = $this->stripWhitespace($content);
|
||||
|
||||
/*
|
||||
* Earlier, we extracted strings & regular expressions and replaced them
|
||||
|
|
@ -205,25 +217,27 @@ class JS extends Minify
|
|||
$callback = function ($match) use ($minifier) {
|
||||
$count = count($minifier->extracted);
|
||||
$placeholder = '/'.$count.'/';
|
||||
$minifier->extracted[$placeholder] = $match[1];
|
||||
$minifier->extracted[$placeholder] = $match[0];
|
||||
|
||||
return $placeholder;
|
||||
};
|
||||
|
||||
// it's a regex if we can find an opening and (not escaped) closing /,
|
||||
// include \n because it may be there for a reason
|
||||
// (https://github.com/matthiasmullie/minify/issues/56)
|
||||
$pattern = '(\/.*?(?<!\\\\)(\\\\\\\\)*+\/\n?)';
|
||||
$pattern = '\/.*?(?<!\\\\)(\\\\\\\\)*+\/[gimy]*(?![0-9a-zA-Z\/])';
|
||||
|
||||
// / can't be preceded by variable, value, or similar because then
|
||||
// it's going to be division
|
||||
// checking for that is complex, so we'll do inverse:
|
||||
// * at the beginning of the file, it's not division, but regex
|
||||
$this->registerPattern('/^\s*\K'.$pattern.'/', $callback);
|
||||
// * following another operator, it's not division, but regex
|
||||
// a regular expression can only be followed by a few operators or some
|
||||
// of the RegExp methods (a `\` followed by a variable or value is
|
||||
// likely part of a division, not a regex)
|
||||
$after = '[\.,;\)\}]';
|
||||
$methods = '\.(exec|test|match|search|replace|split)\(';
|
||||
$this->registerPattern('/'.$pattern.'(?=\s*('.$after.'|'.$methods.'))/', $callback);
|
||||
|
||||
// 1 more edge case: a regex can be followed by a lot more operators or
|
||||
// keywords if there's a newline (ASI) in between, where the operator
|
||||
// actually starts a new statement
|
||||
// (https://github.com/matthiasmullie/minify/issues/56)
|
||||
$operators = $this->getOperatorsForRegex($this->operatorsBefore, '/');
|
||||
$operators += $this->getKeywordsForRegex($this->keywordsReserved, '/');
|
||||
$this->registerPattern('/(?:'.implode('|', $operators).')\s*\K'.$pattern.'/', $callback);
|
||||
$operators += $this->getOperatorsForRegex($this->keywordsReserved, '/');
|
||||
$this->registerPattern('/'.$pattern.'\s*\n?(?=\s*('.implode('|', $operators).'))/', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -238,7 +252,7 @@ class JS extends Minify
|
|||
* Because it's sometimes hard to tell if a newline is part of a statement
|
||||
* that should be terminated or not, we'll just leave some of them alone.
|
||||
*
|
||||
* @param string $content The content to strip the whitespace for.
|
||||
* @param string $content The content to strip the whitespace for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -256,17 +270,19 @@ class JS extends Minify
|
|||
// collapse consecutive line feeds into just 1
|
||||
$content = preg_replace('/\n+/', "\n", $content);
|
||||
|
||||
$before = $this->getOperatorsForRegex($this->operatorsBefore, '/');
|
||||
$after = $this->getOperatorsForRegex($this->operatorsAfter, '/');
|
||||
$operators = $before + $after;
|
||||
$operatorsBefore = $this->getOperatorsForRegex($this->operatorsBefore, '/');
|
||||
$operatorsAfter = $this->getOperatorsForRegex($this->operatorsAfter, '/');
|
||||
$operators = $this->getOperatorsForRegex($this->operators, '/');
|
||||
$keywordsBefore = $this->getKeywordsForRegex($this->keywordsBefore, '/');
|
||||
$keywordsAfter = $this->getKeywordsForRegex($this->keywordsAfter, '/');
|
||||
|
||||
// strip whitespace that ends in (or next line begin with) an operator
|
||||
// that allows statements to be broken up over multiple lines
|
||||
unset($before['+'], $before['-'], $after['+'], $after['-']);
|
||||
unset($operatorsBefore['+'], $operatorsBefore['-'], $operatorsAfter['+'], $operatorsAfter['-']);
|
||||
$content = preg_replace(
|
||||
array(
|
||||
'/('.implode('|', $before).')\s+/',
|
||||
'/\s+('.implode('|', $after).')/',
|
||||
'/('.implode('|', $operatorsBefore).')\s+/',
|
||||
'/\s+('.implode('|', $operatorsAfter).')/',
|
||||
), '\\1', $content
|
||||
);
|
||||
|
||||
|
|
@ -278,19 +294,20 @@ class JS extends Minify
|
|||
), '\\1', $content
|
||||
);
|
||||
|
||||
// collapse whitespace around reserved words into single space
|
||||
$content = preg_replace('/(^|[;\}\s])\K('.implode('|', $keywordsBefore).')\s+/', '\\2 ', $content);
|
||||
$content = preg_replace('/\s+('.implode('|', $keywordsAfter).')(?=([;\{\s]|$))/', ' \\1', $content);
|
||||
|
||||
/*
|
||||
* We didn't strip whitespace after a couple of operators because they
|
||||
* could be used in different contexts and we can't be sure it's ok to
|
||||
* strip the newlines. However, we can safely strip any non-line feed
|
||||
* whitespace that follows them.
|
||||
*/
|
||||
$content = preg_replace('/([\}\)\]])[^\S\n]+(?!'.implode('|', $operators).')/', '\\1', $content);
|
||||
|
||||
// collapse whitespace around reserved words into single space
|
||||
$before = $this->getKeywordsForRegex($this->keywordsBefore, '/');
|
||||
$after = $this->getKeywordsForRegex($this->keywordsAfter, '/');
|
||||
$content = preg_replace('/(^|[;\}\s])\K('.implode('|', $before).')\s+/', '\\2 ', $content);
|
||||
$content = preg_replace('/\s+('.implode('|', $after).')(?=([;\{\s]|$))/', ' \\1', $content);
|
||||
$operatorsDiffBefore = array_diff($operators, $operatorsBefore);
|
||||
$operatorsDiffAfter = array_diff($operators, $operatorsAfter);
|
||||
$content = preg_replace('/('.implode('|', $operatorsDiffBefore).')[^\S\n]+/', '\\1', $content);
|
||||
$content = preg_replace('/[^\S\n]+('.implode('|', $operatorsDiffAfter).')/', '\\1', $content);
|
||||
|
||||
/*
|
||||
* Get rid of double semicolons, except where they can be used like:
|
||||
|
|
@ -450,7 +467,7 @@ class JS extends Minify
|
|||
$keywords = $this->getKeywordsForRegex($keywords);
|
||||
$keywords = '(?<!'.implode(')(?<!', $keywords).')';
|
||||
|
||||
return preg_replace_callback('/(?<='.$previousChar.'|\])'.$keywords.'\[(([\'"])[0-9]+\\2)\]/u', $callback, $content);
|
||||
return preg_replace_callback('/(?<='.$previousChar.'|\])'.$keywords.'\[\s*(([\'"])[0-9]+\\2)\s*\]/u', $callback, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -462,8 +479,8 @@ class JS extends Minify
|
|||
*/
|
||||
protected function shortenBools($content)
|
||||
{
|
||||
$content = preg_replace('/\btrue\b/', '!0', $content);
|
||||
$content = preg_replace('/\bfalse\b/', '!1', $content);
|
||||
$content = preg_replace('/\btrue\b(?!:)/', '!0', $content);
|
||||
$content = preg_replace('/\bfalse\b(?!:)/', '!1', $content);
|
||||
|
||||
// for(;;) is exactly the same as while(true)
|
||||
$content = preg_replace('/\bwhile\(!0\){/', 'for(;;){', $content);
|
||||
|
|
|
|||
63
vendor/matthiasmullie/minify/src/Minify.php
vendored
63
vendor/matthiasmullie/minify/src/Minify.php
vendored
|
|
@ -11,7 +11,7 @@ use Psr\Cache\CacheItemInterface;
|
|||
* Please report bugs on https://github.com/matthiasmullie/minify/issues
|
||||
*
|
||||
* @author Matthias Mullie <minify@mullie.eu>
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved.
|
||||
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved
|
||||
* @license MIT License
|
||||
*/
|
||||
abstract class Minify
|
||||
|
|
@ -53,7 +53,7 @@ abstract class Minify
|
|||
/**
|
||||
* Add a file or straight-up code to be minified.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string|string[] $data
|
||||
*/
|
||||
public function add($data /* $data = null, ... */)
|
||||
{
|
||||
|
|
@ -65,6 +65,11 @@ abstract class Minify
|
|||
|
||||
// this method can be overloaded
|
||||
foreach ($args as $data) {
|
||||
if (is_array($data)) {
|
||||
call_user_func_array(array($this, 'add'), $data);
|
||||
continue;
|
||||
}
|
||||
|
||||
// redefine var
|
||||
$data = (string) $data;
|
||||
|
||||
|
|
@ -72,6 +77,10 @@ abstract class Minify
|
|||
$value = $this->load($data);
|
||||
$key = ($data != $value) ? $data : count($this->data);
|
||||
|
||||
// replace CR linefeeds etc.
|
||||
// @see https://github.com/matthiasmullie/minify/pull/139
|
||||
$value = str_replace(array("\r\n", "\r"), "\n", $value);
|
||||
|
||||
// store data
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
|
@ -80,9 +89,9 @@ abstract class Minify
|
|||
/**
|
||||
* Minify the data & (optionally) saves it to a file.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @param string[optional] $path Path to write the data to
|
||||
*
|
||||
* @return string The minified data.
|
||||
* @return string The minified data
|
||||
*/
|
||||
public function minify($path = null)
|
||||
{
|
||||
|
|
@ -99,10 +108,10 @@ abstract class Minify
|
|||
/**
|
||||
* Minify & gzip the data & (optionally) saves it to a file.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @param int[optional] $level Compression level, from 0 to 9.
|
||||
* @param string[optional] $path Path to write the data to
|
||||
* @param int[optional] $level Compression level, from 0 to 9
|
||||
*
|
||||
* @return string The minified & gzipped data.
|
||||
* @return string The minified & gzipped data
|
||||
*/
|
||||
public function gzip($path = null, $level = 9)
|
||||
{
|
||||
|
|
@ -120,9 +129,9 @@ abstract class Minify
|
|||
/**
|
||||
* Minify the data & write it to a CacheItemInterface object.
|
||||
*
|
||||
* @param CacheItemInterface $item Cache item to write the data to.
|
||||
* @param CacheItemInterface $item Cache item to write the data to
|
||||
*
|
||||
* @return CacheItemInterface Cache item with the minifier data.
|
||||
* @return CacheItemInterface Cache item with the minifier data
|
||||
*/
|
||||
public function cache(CacheItemInterface $item)
|
||||
{
|
||||
|
|
@ -135,16 +144,16 @@ abstract class Minify
|
|||
/**
|
||||
* Minify the data.
|
||||
*
|
||||
* @param string[optional] $path Path to write the data to.
|
||||
* @param string[optional] $path Path to write the data to
|
||||
*
|
||||
* @return string The minified data.
|
||||
* @return string The minified data
|
||||
*/
|
||||
abstract public function execute($path = null);
|
||||
|
||||
/**
|
||||
* Load data.
|
||||
*
|
||||
* @param string $data Either a path to a file or the content itself.
|
||||
* @param string $data Either a path to a file or the content itself
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -166,8 +175,8 @@ abstract class Minify
|
|||
/**
|
||||
* Save to file.
|
||||
*
|
||||
* @param string $content The minified data.
|
||||
* @param string $path The path to save the minified data to.
|
||||
* @param string $content The minified data
|
||||
* @param string $path The path to save the minified data to
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
@ -183,8 +192,8 @@ abstract class Minify
|
|||
/**
|
||||
* Register a pattern to execute against the source content.
|
||||
*
|
||||
* @param string $pattern PCRE pattern.
|
||||
* @param string|callable $replacement Replacement value for matched pattern.
|
||||
* @param string $pattern PCRE pattern
|
||||
* @param string|callable $replacement Replacement value for matched pattern
|
||||
*/
|
||||
protected function registerPattern($pattern, $replacement = '')
|
||||
{
|
||||
|
|
@ -202,9 +211,9 @@ abstract class Minify
|
|||
* The only way to accurately replace these pieces is to traverse the JS one
|
||||
* character at a time and try to find whatever starts first.
|
||||
*
|
||||
* @param string $content The content to replace patterns in.
|
||||
* @param string $content The content to replace patterns in
|
||||
*
|
||||
* @return string The (manipulated) content.
|
||||
* @return string The (manipulated) content
|
||||
*/
|
||||
protected function replace($content)
|
||||
{
|
||||
|
|
@ -284,9 +293,9 @@ abstract class Minify
|
|||
* This function will be called plenty of times, where $content will always
|
||||
* move up 1 character.
|
||||
*
|
||||
* @param string $pattern Pattern to match.
|
||||
* @param string|callable $replacement Replacement value.
|
||||
* @param string $content Content to match pattern against.
|
||||
* @param string $pattern Pattern to match
|
||||
* @param string|callable $replacement Replacement value
|
||||
* @param string $content Content to match pattern against
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -382,15 +391,15 @@ abstract class Minify
|
|||
*/
|
||||
protected function canImportFile($path)
|
||||
{
|
||||
return strlen($path) < PHP_MAXPATHLEN && is_file($path) && is_readable($path);
|
||||
return strlen($path) < PHP_MAXPATHLEN && @is_file($path) && is_readable($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to open file specified by $path for writing.
|
||||
*
|
||||
* @param string $path The path to the file.
|
||||
* @param string $path The path to the file
|
||||
*
|
||||
* @return resource Specifier for the target file.
|
||||
* @return resource Specifier for the target file
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
@ -406,9 +415,9 @@ abstract class Minify
|
|||
/**
|
||||
* Attempts to write $content to the file specified by $handler. $path is used for printing exceptions.
|
||||
*
|
||||
* @param resource $handler The resource to write to.
|
||||
* @param string $content The content to write.
|
||||
* @param string $path The path to the file (for exception printing only).
|
||||
* @param resource $handler The resource to write to
|
||||
* @param string $content The content to write
|
||||
* @param string $path The path to the file (for exception printing only)
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue