MDL-51530 libraries: Upgrade less.php to 1.7.0.9

This commit is contained in:
Damyon Wiese
2015-10-02 05:03:40 +00:00
committed by Ryan Wyllie
parent fd57d685c7
commit df09876082
11 changed files with 477 additions and 97 deletions
+24 -16
View File
@@ -47,13 +47,14 @@ class Less_Parser{
private $pos; // current index in `input`
private $saveStack = array(); // holds state for backtracking
private $furthest;
private $mb_internal_encoding = ''; // for remember exists value of mbstring.internal_encoding
/**
* @var Less_Environment
*/
private $env;
private $rules = array();
protected $rules = array();
private static $imports = array();
@@ -83,6 +84,14 @@ class Less_Parser{
$this->Reset( $env );
}
// mbstring.func_overload > 1 bugfix
// The encoding value must be set for each source file,
// therefore, to conserve resources and improve the speed of this design is taken here
if (ini_get('mbstring.func_overload')) {
$this->mb_internal_encoding = ini_get('mbstring.internal_encoding');
@ini_set('mbstring.internal_encoding', 'ascii');
}
}
@@ -204,17 +213,26 @@ class Less_Parser{
}
} catch (Exception $exc) {
// Intentional fall-through so we can reset environment
}
// Intentional fall-through so we can reset environment
}
//reset php settings
@ini_set('precision',$precision);
setlocale(LC_NUMERIC, $locale);
// If you previously defined $this->mb_internal_encoding
// is required to return the encoding as it was before
if ($this->mb_internal_encoding != '') {
@ini_set("mbstring.internal_encoding", $this->mb_internal_encoding);
$this->mb_internal_encoding = '';
}
// Rethrow exception after we handled resetting the environment
if (!empty($exc)) {
throw $exc;
}
throw $exc;
}
return $css;
}
@@ -285,7 +303,7 @@ class Less_Parser{
$filename = 'anonymous-file-'.Less_Parser::$next_id++.'.less';
}else{
$file_uri = self::WinPath($file_uri);
$filename = basename($file_uri);
$filename = $file_uri;
$uri_root = dirname($file_uri);
}
@@ -466,17 +484,7 @@ class Less_Parser{
* @param string $file_path
*/
private function _parse( $file_path = null ){
if (ini_get("mbstring.func_overload")) {
$mb_internal_encoding = ini_get("mbstring.internal_encoding");
@ini_set("mbstring.internal_encoding", "ascii");
}
$this->rules = array_merge($this->rules, $this->GetRules( $file_path ));
//reset php settings
if (isset($mb_internal_encoding)) {
@ini_set("mbstring.internal_encoding", $mb_internal_encoding);
}
}