[Web] Update libs
[Web] Update filename when downloading
This commit is contained in:
@@ -525,7 +525,7 @@ class CSS extends Minify
|
||||
);
|
||||
|
||||
return preg_replace_callback(
|
||||
'/(?<=[: ])('.implode(array_keys($colors), '|').')(?=[; }])/i',
|
||||
'/(?<=[: ])('.implode('|', array_keys($colors)).')(?=[; }])/i',
|
||||
function ($match) use ($colors) {
|
||||
return $colors[strtoupper($match[0])];
|
||||
},
|
||||
@@ -708,7 +708,8 @@ class CSS extends Minify
|
||||
return $placeholder.$rest;
|
||||
};
|
||||
|
||||
$this->registerPattern('/calc(\(.+?)(?=$|;|calc\()/', $callback);
|
||||
$this->registerPattern('/calc(\(.+?)(?=$|;|}|calc\()/', $callback);
|
||||
$this->registerPattern('/calc(\(.+?)(?=$|;|}|calc\()/m', $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -99,6 +99,44 @@ abstract class Minify
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file to be minified.
|
||||
*
|
||||
* @param string|string[] $data
|
||||
*
|
||||
* @return static
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public function addFile($data /* $data = null, ... */)
|
||||
{
|
||||
// bogus "usage" of parameter $data: scrutinizer warns this variable is
|
||||
// not used (we're using func_get_args instead to support overloading),
|
||||
// but it still needs to be defined because it makes no sense to have
|
||||
// this function without argument :)
|
||||
$args = array($data) + func_get_args();
|
||||
|
||||
// this method can be overloaded
|
||||
foreach ($args as $path) {
|
||||
if (is_array($path)) {
|
||||
call_user_func_array(array($this, 'addFile'), $path);
|
||||
continue;
|
||||
}
|
||||
|
||||
// redefine var
|
||||
$path = (string) $path;
|
||||
|
||||
// check if we can read the file
|
||||
if (!$this->canImportFile($path)) {
|
||||
throw new IOException('The file "'.$path.'" could not be opened for reading. Check if PHP has enough permissions.');
|
||||
}
|
||||
|
||||
$this->add($path);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minify the data & (optionally) saves it to a file.
|
||||
*
|
||||
|
Reference in New Issue
Block a user