Merge branch 'MDL-65761' of git://github.com/Chocolate-lightning/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2019-07-16 12:27:43 +02:00
35 changed files with 3834 additions and 1070 deletions
+2 -2
View File
@@ -10861,9 +10861,9 @@ class admin_setting_scsscode extends admin_setting_configtextarea {
$scss = new core_scss();
try {
$scss->compile($data);
} catch (Leafo\ScssPhp\Exception\ParserException $e) {
} catch (ScssPhp\ScssPhp\Exception\ParserException $e) {
return get_string('scssinvalid', 'admin', $e->getMessage());
} catch (Leafo\ScssPhp\Exception\CompilerException $e) {
} catch (ScssPhp\ScssPhp\Exception\CompilerException $e) {
// Silently ignore this - it could be a scss variable defined from somewhere
// else which we are not examining here.
return true;
+1 -1
View File
@@ -80,7 +80,7 @@ class core_component {
'GeoIp2' => 'lib/maxmind/GeoIp2',
'Sabberworm\\CSS' => 'lib/php-css-parser',
'MoodleHQ\\RTLCSS' => 'lib/rtlcss',
'Leafo\\ScssPhp' => 'lib/scssphp',
'ScssPhp\\ScssPhp' => 'lib/scssphp',
'Box\\Spout' => 'lib/spout/src/Spout',
'MatthiasMullie\\Minify' => 'lib/minify/matthiasmullie-minify/src/',
'MatthiasMullie\\PathConverter' => 'lib/minify/matthiasmullie-pathconverter/src/',
+5 -5
View File
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2016 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_scss extends \Leafo\ScssPhp\Compiler {
class core_scss extends \ScssPhp\ScssPhp\Compiler {
/** @var string The path to the SCSS file. */
protected $scssfile;
@@ -150,14 +150,14 @@ class core_scss extends \Leafo\ScssPhp\Compiler {
* Compile child; returns a value to halt execution
*
* @param array $child
* @param \Leafo\ScssPhp\Formatter\OutputBlock $out
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
*
* @return array|null
*/
protected function compileChild($child, \Leafo\ScssPhp\Formatter\OutputBlock $out) {
protected function compileChild($child, \ScssPhp\ScssPhp\Formatter\OutputBlock $out) {
switch($child[0]) {
case \Leafo\ScssPhp\Type::T_SCSSPHP_IMPORT_ONCE:
case \Leafo\ScssPhp\Type::T_IMPORT:
case \ScssPhp\ScssPhp\Type::T_SCSSPHP_IMPORT_ONCE:
case \ScssPhp\ScssPhp\Type::T_IMPORT:
list(, $rawpath) = $child;
$rawpath = $this->reduce($rawpath);
$path = $this->compileStringContent($rawpath);
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2015-2018 Leaf Corcoran
* @copyright 2015-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Base;
namespace ScssPhp\ScssPhp\Base;
/**
* Range
+9 -4
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
/**
* Block
@@ -24,7 +24,7 @@ class Block
public $type;
/**
* @var \Leafo\ScssPhp\Block
* @var \ScssPhp\ScssPhp\Block
*/
public $parent;
@@ -62,4 +62,9 @@ class Block
* @var array
*/
public $children;
/**
* @var \ScssPhp\ScssPhp\Block
*/
public $selfParent;
}
+239
View File
@@ -0,0 +1,239 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://scssphp.github.io/scssphp
*/
namespace ScssPhp\ScssPhp;
use Exception;
/**
* The scss cache manager.
*
* In short:
*
* allow to put in cache/get from cache a generic result from a known operation on a generic dataset,
* taking in account options that affects the result
*
* The cache manager is agnostic about data format and only the operation is expected to be described by string
*
*/
/**
* SCSS cache
*
* @author Cedric Morin
*/
class Cache
{
const CACHE_VERSION = 1;
// directory used for storing data
public static $cacheDir = false;
// prefix for the storing data
public static $prefix = 'scssphp_';
// force a refresh : 'once' for refreshing the first hit on a cache only, true to never use the cache in this hit
public static $forceRefresh = false;
// specifies the number of seconds after which data cached will be seen as 'garbage' and potentially cleaned up
public static $gcLifetime = 604800;
// array of already refreshed cache if $forceRefresh==='once'
protected static $refreshed = [];
/**
* Constructor
*
* @param array $options
*/
public function __construct($options)
{
// check $cacheDir
if (isset($options['cache_dir'])) {
self::$cacheDir = $options['cache_dir'];
}
if (empty(self::$cacheDir)) {
throw new Exception('cache_dir not set');
}
if (isset($options['prefix'])) {
self::$prefix = $options['prefix'];
}
if (empty(self::$prefix)) {
throw new Exception('prefix not set');
}
if (isset($options['forceRefresh'])) {
self::$forceRefresh = $options['force_refresh'];
}
self::checkCacheDir();
}
/**
* Get the cached result of $operation on $what,
* which is known as dependant from the content of $options
*
* @param string $operation parse, compile...
* @param mixed $what content key (e.g., filename to be treated)
* @param array $options any option that affect the operation result on the content
* @param integer $lastModified last modified timestamp
*
* @return mixed
*
* @throws \Exception
*/
public function getCache($operation, $what, $options = [], $lastModified = null)
{
$fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
if ((! self::$forceRefresh || (self::$forceRefresh === 'once' &&
isset(self::$refreshed[$fileCache]))) && file_exists($fileCache)
) {
$cacheTime = filemtime($fileCache);
if ((is_null($lastModified) || $cacheTime > $lastModified) &&
$cacheTime + self::$gcLifetime > time()
) {
$c = file_get_contents($fileCache);
$c = unserialize($c);
if (is_array($c) && isset($c['value'])) {
return $c['value'];
}
}
}
return null;
}
/**
* Put in cache the result of $operation on $what,
* which is known as dependant from the content of $options
*
* @param string $operation
* @param mixed $what
* @param mixed $value
* @param array $options
*/
public function setCache($operation, $what, $value, $options = [])
{
$fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
$c = ['value' => $value];
$c = serialize($c);
file_put_contents($fileCache, $c);
if (self::$forceRefresh === 'once') {
self::$refreshed[$fileCache] = true;
}
}
/**
* Get the cache name for the caching of $operation on $what,
* which is known as dependant from the content of $options
*
* @param string $operation
* @param mixed $what
* @param array $options
*
* @return string
*/
private static function cacheName($operation, $what, $options = [])
{
$t = [
'version' => self::CACHE_VERSION,
'operation' => $operation,
'what' => $what,
'options' => $options
];
$t = self::$prefix
. sha1(json_encode($t))
. ".$operation"
. ".scsscache";
return $t;
}
/**
* Check that the cache dir exists and is writeable
*
* @throws \Exception
*/
public static function checkCacheDir()
{
self::$cacheDir = str_replace('\\', '/', self::$cacheDir);
self::$cacheDir = rtrim(self::$cacheDir, '/') . '/';
if (! file_exists(self::$cacheDir)) {
if (! mkdir(self::$cacheDir)) {
throw new Exception('Cache directory couldn\'t be created: ' . self::$cacheDir);
}
} elseif (! is_dir(self::$cacheDir)) {
throw new Exception('Cache directory doesn\'t exist: ' . self::$cacheDir);
} elseif (! is_writable(self::$cacheDir)) {
throw new Exception('Cache directory isn\'t writable: ' . self::$cacheDir);
}
}
/**
* Delete unused cached files
*/
public static function cleanCache()
{
static $clean = false;
if ($clean || empty(self::$cacheDir)) {
return;
}
$clean = true;
// only remove files with extensions created by SCSSPHP Cache
// css files removed based on the list files
$removeTypes = ['scsscache' => 1];
$files = scandir(self::$cacheDir);
if (! $files) {
return;
}
$checkTime = time() - self::$gcLifetime;
foreach ($files as $file) {
// don't delete if the file wasn't created with SCSSPHP Cache
if (strpos($file, self::$prefix) !== 0) {
continue;
}
$parts = explode('.', $file);
$type = array_pop($parts);
if (! isset($removeTypes[$type])) {
continue;
}
$fullPath = self::$cacheDir . $file;
$mtime = filemtime($fullPath);
// don't delete if it's a relatively new file
if ($mtime > $checkTime) {
continue;
}
unlink($fullPath);
}
}
}
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
/**
* CSS Colors
+2060 -492
View File
File diff suppressed because it is too large Load Diff
+10 -5
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Compiler;
namespace ScssPhp\ScssPhp\Compiler;
/**
* Compiler environment
@@ -19,12 +19,12 @@ namespace Leafo\ScssPhp\Compiler;
class Environment
{
/**
* @var \Leafo\ScssPhp\Block
* @var \ScssPhp\ScssPhp\Block
*/
public $block;
/**
* @var \Leafo\ScssPhp\Compiler\Environment
* @var \ScssPhp\ScssPhp\Compiler\Environment
*/
public $parent;
@@ -33,6 +33,11 @@ class Environment
*/
public $store;
/**
* @var array
*/
public $storeUnreduced;
/**
* @var integer
*/
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
namespace ScssPhp\ScssPhp\Exception;
/**
* Compiler exception
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
namespace ScssPhp\ScssPhp\Exception;
/**
* Parser Exception
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
namespace ScssPhp\ScssPhp\Exception;
/**
* Range exception
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
namespace ScssPhp\ScssPhp\Exception;
/**
* Server Exception
+42 -17
View File
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
use Leafo\ScssPhp\Formatter\OutputBlock;
use Leafo\ScssPhp\SourceMap\SourceMapGenerator;
use ScssPhp\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\SourceMap\SourceMapGenerator;
/**
* Base formatter
@@ -62,7 +62,7 @@ abstract class Formatter
public $keepSemicolons;
/**
* @var \Leafo\ScssPhp\Formatter\OutputBlock
* @var \ScssPhp\ScssPhp\Formatter\OutputBlock
*/
protected $currentBlock;
@@ -77,7 +77,7 @@ abstract class Formatter
protected $currentColumn;
/**
* @var \Leafo\ScssPhp\SourceMap\SourceMapGenerator
* @var \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator
*/
protected $sourceMapGenerator;
@@ -126,9 +126,7 @@ abstract class Formatter
return;
}
if (($count = count($lines))
&& substr($lines[$count - 1], -1) === ';'
) {
if (($count = count($lines)) && substr($lines[$count - 1], -1) === ';') {
$lines[$count - 1] = substr($lines[$count - 1], 0, -1);
}
}
@@ -136,7 +134,7 @@ abstract class Formatter
/**
* Output lines inside a block
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockLines(OutputBlock $block)
{
@@ -154,7 +152,7 @@ abstract class Formatter
/**
* Output block selectors
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockSelectors(OutputBlock $block)
{
@@ -168,7 +166,7 @@ abstract class Formatter
/**
* Output block children
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockChildren(OutputBlock $block)
{
@@ -180,7 +178,7 @@ abstract class Formatter
/**
* Output non-empty block
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
*/
protected function block(OutputBlock $block)
{
@@ -217,13 +215,37 @@ abstract class Formatter
}
}
/**
* Test and clean safely empty children
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
* @return bool
*/
protected function testEmptyChildren($block)
{
$isEmpty = empty($block->lines);
if ($block->children) {
foreach ($block->children as $k => &$child) {
if (! $this->testEmptyChildren($child)) {
$isEmpty = false;
} else {
if ($child->type === Type::T_MEDIA || $child->type === Type::T_DIRECTIVE) {
$child->children = [];
$child->selectors = null;
}
}
}
}
return $isEmpty;
}
/**
* Entry point to formatting a block
*
* @api
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
* @param \Leafo\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
* @param \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
*
* @return string
*/
@@ -237,6 +259,8 @@ abstract class Formatter
$this->sourceMapGenerator = $sourceMapGenerator;
}
$this->testEmptyChildren($block);
ob_start();
$this->block($block);
@@ -256,7 +280,8 @@ abstract class Formatter
$this->currentLine,
$this->currentColumn,
$this->currentBlock->sourceLine,
$this->currentBlock->sourceColumn - 1, //columns from parser are off by one
//columns from parser are off by one
$this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
$this->currentBlock->sourceName
);
+4 -4
View File
@@ -2,16 +2,16 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use ScssPhp\ScssPhp\Formatter;
/**
* Compact formatter
+24 -5
View File
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\Formatter;
use ScssPhp\ScssPhp\Formatter\OutputBlock;
/**
* Compressed formatter
@@ -59,4 +59,23 @@ class Compressed extends Formatter
$this->write($this->break);
}
}
/**
* Output block selectors
*
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockSelectors(OutputBlock $block)
{
$inner = $this->indentStr();
$this->write(
$inner
. implode(
$this->tagSeparator,
str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
)
. $this->open . $this->break
);
}
}
+24 -5
View File
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\Formatter;
use ScssPhp\ScssPhp\Formatter\OutputBlock;
/**
* Crunched formatter
@@ -57,4 +57,23 @@ class Crunched extends Formatter
$this->write($this->break);
}
}
/**
* Output block selectors
*
* @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockSelectors(OutputBlock $block)
{
$inner = $this->indentStr();
$this->write(
$inner
. implode(
$this->tagSeparator,
str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
)
. $this->open . $this->break
);
}
}
+5 -5
View File
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\Formatter;
use ScssPhp\ScssPhp\Formatter\OutputBlock;
/**
* Debug formatter
+5 -5
View File
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\Formatter;
use ScssPhp\ScssPhp\Formatter\OutputBlock;
/**
* Expanded formatter
+101 -90
View File
@@ -2,17 +2,18 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\Formatter;
use ScssPhp\ScssPhp\Formatter\OutputBlock;
use ScssPhp\ScssPhp\Type;
/**
* Nested formatter
@@ -67,44 +68,17 @@ class Nested extends Formatter
}
$this->write($inner . implode($glue, $block->lines));
if (! empty($block->children)) {
$this->write($this->break);
}
}
/**
* {@inheritdoc}
*/
protected function blockSelectors(OutputBlock $block)
protected function hasFlatChild($block)
{
$inner = $this->indentStr();
$this->write($inner
. implode($this->tagSeparator, $block->selectors)
. $this->open . $this->break);
}
/**
* {@inheritdoc}
*/
protected function blockChildren(OutputBlock $block)
{
foreach ($block->children as $i => $child) {
$this->block($child);
if ($i < count($block->children) - 1) {
$this->write($this->break);
if (isset($block->children[$i + 1])) {
$next = $block->children[$i + 1];
if ($next->depth === max($block->depth, 1) && $child->depth >= $next->depth) {
$this->write($this->break);
}
}
foreach ($block->children as $child) {
if (empty($child->selectors)) {
return true;
}
}
return false;
}
/**
@@ -112,8 +86,38 @@ class Nested extends Formatter
*/
protected function block(OutputBlock $block)
{
static $depths;
static $downLevel;
static $closeBlock;
static $previousEmpty;
static $previousHasSelector;
if ($block->type === 'root') {
$this->adjustAllChildren($block);
$depths = [ 0 ];
$downLevel = '';
$closeBlock = '';
$this->depth = 0;
$previousEmpty = false;
$previousHasSelector = false;
}
$isMediaOrDirective = in_array($block->type, [Type::T_DIRECTIVE, Type::T_MEDIA]);
$isSupport = ($block->type === Type::T_DIRECTIVE
&& $block->selectors && strpos(implode('', $block->selectors), '@supports') !== false);
while ($block->depth < end($depths) || ($block->depth == 1 && end($depths) == 1)) {
array_pop($depths);
$this->depth--;
if (!$this->depth && ($block->depth <= 1 || (!$this->indentLevel && $block->type === Type::T_COMMENT)) &&
(($block->selectors && ! $isMediaOrDirective) || $previousHasSelector)
) {
$downLevel = $this->break;
}
if (empty($block->lines) && empty($block->children)) {
$previousEmpty = true;
}
}
if (empty($block->lines) && empty($block->children)) {
@@ -122,80 +126,87 @@ class Nested extends Formatter
$this->currentBlock = $block;
if (! empty($block->lines) || (! empty($block->children) && ($this->depth < 1 || $isSupport))) {
if ($block->depth > end($depths)) {
if (! $previousEmpty || $this->depth < 1) {
$this->depth++;
$depths[] = $block->depth;
} else {
// keep the current depth unchanged but take the block depth as a new reference for following blocks
array_pop($depths);
$depths[] = $block->depth;
}
}
}
$this->depth = $block->depth;
$previousEmpty = ($block->type === Type::T_COMMENT);
$previousHasSelector = false;
if (! empty($block->selectors)) {
if ($closeBlock) {
$this->write($closeBlock);
$closeBlock = '';
}
if ($downLevel) {
$this->write($downLevel);
$downLevel = '';
}
$this->blockSelectors($block);
$this->indentLevel++;
}
if (! empty($block->lines)) {
if ($closeBlock) {
$this->write($closeBlock);
$closeBlock = '';
}
if ($downLevel) {
$this->write($downLevel);
$downLevel = '';
}
$this->blockLines($block);
$closeBlock = $this->break;
}
if (! empty($block->children)) {
$this->blockChildren($block);
if ($this->depth>0 && ($isMediaOrDirective || ! $this->hasFlatChild($block))) {
array_pop($depths);
$this->depth--;
$this->blockChildren($block);
$this->depth++;
$depths[] = $block->depth;
} else {
$this->blockChildren($block);
}
}
// reclear to not be spoiled by children if T_DIRECTIVE
if ($block->type === Type::T_DIRECTIVE) {
$previousHasSelector = false;
}
if (! empty($block->selectors)) {
$this->indentLevel--;
$this->write($this->close);
$closeBlock = $this->break;
if ($this->depth > 1 && ! empty($block->children)) {
array_pop($depths);
$this->depth--;
}
if (! $isMediaOrDirective) {
$previousHasSelector = true;
}
}
if ($block->type === 'root') {
$this->write($this->break);
}
}
/**
* Adjust the depths of all children, depth first
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
private function adjustAllChildren(OutputBlock $block)
{
// flatten empty nested blocks
$children = [];
foreach ($block->children as $i => $child) {
if (empty($child->lines) && empty($child->children)) {
if (isset($block->children[$i + 1])) {
$block->children[$i + 1]->depth = $child->depth;
}
continue;
}
$children[] = $child;
}
$count = count($children);
for ($i = 0; $i < $count; $i++) {
$depth = $children[$i]->depth;
$j = $i + 1;
if (isset($children[$j]) && $depth < $children[$j]->depth) {
$childDepth = $children[$j]->depth;
for (; $j < $count; $j++) {
if ($depth < $children[$j]->depth && $childDepth >= $children[$j]->depth) {
$children[$j]->depth = $depth + 1;
}
}
}
}
$block->children = $children;
// make relative to parent
foreach ($block->children as $child) {
$this->adjustAllChildren($child);
$child->depth = $child->depth - $block->depth;
}
}
}
+4 -4
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
namespace ScssPhp\ScssPhp\Formatter;
/**
* Output block
@@ -44,7 +44,7 @@ class OutputBlock
public $children;
/**
* @var \Leafo\ScssPhp\Formatter\OutputBlock
* @var \ScssPhp\ScssPhp\Formatter\OutputBlock
*/
public $parent;
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2015 Leaf Corcoran, http://leafo.github.io/scssphp
Copyright (c) 2015 Leaf Corcoran, http://scssphp.github.io/scssphp
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
/**
* Base node
+13 -13
View File
@@ -2,18 +2,18 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\Node;
namespace ScssPhp\ScssPhp\Node;
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Node;
use Leafo\ScssPhp\Type;
use ScssPhp\ScssPhp\Compiler;
use ScssPhp\ScssPhp\Node;
use ScssPhp\ScssPhp\Type;
/**
* Dimension + optional units
@@ -100,7 +100,7 @@ class Number extends Node implements \ArrayAccess
*
* @param array $units
*
* @return \Leafo\ScssPhp\Node\Number
* @return \ScssPhp\ScssPhp\Node\Number
*/
public function coerce($units)
{
@@ -123,7 +123,7 @@ class Number extends Node implements \ArrayAccess
/**
* Normalize number
*
* @return \Leafo\ScssPhp\Node\Number
* @return \ScssPhp\ScssPhp\Node\Number
*/
public function normalize()
{
@@ -148,10 +148,10 @@ class Number extends Node implements \ArrayAccess
return $this->sourceLine !== null;
}
if ($offset === -1
|| $offset === 0
|| $offset === 1
|| $offset === 2
if ($offset === -1 ||
$offset === 0 ||
$offset === 1 ||
$offset === 2
) {
return true;
}
@@ -259,7 +259,7 @@ class Number extends Node implements \ArrayAccess
/**
* Output number
*
* @param \Leafo\ScssPhp\Compiler $compiler
* @param \ScssPhp\ScssPhp\Compiler $compiler
*
* @return string
*/
+873 -332
View File
File diff suppressed because it is too large Load Diff
+184
View File
@@ -0,0 +1,184 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://scssphp.github.io/scssphp
*/
namespace ScssPhp\ScssPhp\SourceMap;
/**
* Base 64 Encode/Decode
*
* @author Anthon Pang <[email protected]>
*/
class Base64
{
/**
* @var array
*/
private static $encodingMap = [
0 => 'A',
1 => 'B',
2 => 'C',
3 => 'D',
4 => 'E',
5 => 'F',
6 => 'G',
7 => 'H',
8 => 'I',
9 => 'J',
10 => 'K',
11 => 'L',
12 => 'M',
13 => 'N',
14 => 'O',
15 => 'P',
16 => 'Q',
17 => 'R',
18 => 'S',
19 => 'T',
20 => 'U',
21 => 'V',
22 => 'W',
23 => 'X',
24 => 'Y',
25 => 'Z',
26 => 'a',
27 => 'b',
28 => 'c',
29 => 'd',
30 => 'e',
31 => 'f',
32 => 'g',
33 => 'h',
34 => 'i',
35 => 'j',
36 => 'k',
37 => 'l',
38 => 'm',
39 => 'n',
40 => 'o',
41 => 'p',
42 => 'q',
43 => 'r',
44 => 's',
45 => 't',
46 => 'u',
47 => 'v',
48 => 'w',
49 => 'x',
50 => 'y',
51 => 'z',
52 => '0',
53 => '1',
54 => '2',
55 => '3',
56 => '4',
57 => '5',
58 => '6',
59 => '7',
60 => '8',
61 => '9',
62 => '+',
63 => '/',
];
/**
* @var array
*/
private static $decodingMap = [
'A' => 0,
'B' => 1,
'C' => 2,
'D' => 3,
'E' => 4,
'F' => 5,
'G' => 6,
'H' => 7,
'I' => 8,
'J' => 9,
'K' => 10,
'L' => 11,
'M' => 12,
'N' => 13,
'O' => 14,
'P' => 15,
'Q' => 16,
'R' => 17,
'S' => 18,
'T' => 19,
'U' => 20,
'V' => 21,
'W' => 22,
'X' => 23,
'Y' => 24,
'Z' => 25,
'a' => 26,
'b' => 27,
'c' => 28,
'd' => 29,
'e' => 30,
'f' => 31,
'g' => 32,
'h' => 33,
'i' => 34,
'j' => 35,
'k' => 36,
'l' => 37,
'm' => 38,
'n' => 39,
'o' => 40,
'p' => 41,
'q' => 42,
'r' => 43,
's' => 44,
't' => 45,
'u' => 46,
'v' => 47,
'w' => 48,
'x' => 49,
'y' => 50,
'z' => 51,
0 => 52,
1 => 53,
2 => 54,
3 => 55,
4 => 56,
5 => 57,
6 => 58,
7 => 59,
8 => 60,
9 => 61,
'+' => 62,
'/' => 63,
];
/**
* Convert to base64
*
* @param integer $value
*
* @return string
*/
public static function encode($value)
{
return self::$encodingMap[$value];
}
/**
* Convert from base64
*
* @param string $value
*
* @return integer
*/
public static function decode($value)
{
return self::$decodingMap[$value];
}
}
+137
View File
@@ -0,0 +1,137 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://scssphp.github.io/scssphp
*/
namespace ScssPhp\ScssPhp\SourceMap;
use ScssPhp\ScssPhp\SourceMap\Base64;
/**
* Base 64 VLQ
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://github.com/google/closure-compiler/blob/master/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author John Lenz <[email protected]>
* @author Anthon Pang <[email protected]>
*/
class Base64VLQ
{
// A Base64 VLQ digit can represent 5 bits, so it is base-32.
const VLQ_BASE_SHIFT = 5;
// A mask of bits for a VLQ digit (11111), 31 decimal.
const VLQ_BASE_MASK = 31;
// The continuation bit is the 6th bit.
const VLQ_CONTINUATION_BIT = 32;
/**
* Returns the VLQ encoded value.
*
* @param integer $value
*
* @return string
*/
public static function encode($value)
{
$encoded = '';
$vlq = self::toVLQSigned($value);
do {
$digit = $vlq & self::VLQ_BASE_MASK;
$vlq >>= self::VLQ_BASE_SHIFT;
if ($vlq > 0) {
$digit |= self::VLQ_CONTINUATION_BIT;
}
$encoded .= Base64::encode($digit);
} while ($vlq > 0);
return $encoded;
}
/**
* Decodes VLQValue.
*
* @param string $str
* @param integer $index
*
* @return integer
*/
public static function decode($str, &$index)
{
$result = 0;
$shift = 0;
do {
$c = $str[$index++];
$digit = Base64::decode($c);
$continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
$digit &= self::VLQ_BASE_MASK;
$result = $result + ($digit << $shift);
$shift = $shift + self::VLQ_BASE_SHIFT;
} while ($continuation);
return self::fromVLQSigned($result);
}
/**
* Converts from a two-complement value to a value where the sign bit is
* is placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*
* @param integer $value
*
* @return integer
*/
private static function toVLQSigned($value)
{
if ($value < 0) {
return ((-$value) << 1) + 1;
}
return ($value << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* is placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*
* @param integer $value
*
* @return integer
*/
private static function fromVLQSigned($value)
{
$negate = ($value & 1) === 1;
$value = $value >> 1;
return $negate ? -$value : $value;
}
}
+7 -7
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\SourceMap;
namespace ScssPhp\ScssPhp\SourceMap;
/**
* Base64 VLQ Encoder
@@ -47,7 +47,7 @@ class Base64VLQEncoder
*
* @var array
*/
private $charToIntMap = array(
private $charToIntMap = [
'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, 'H' => 7,
'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, 'O' => 14, 'P' => 15,
'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20, 'V' => 21, 'W' => 22, 'X' => 23,
@@ -56,14 +56,14 @@ class Base64VLQEncoder
'o' => 40, 'p' => 41, 'q' => 42, 'r' => 43, 's' => 44, 't' => 45, 'u' => 46, 'v' => 47,
'w' => 48, 'x' => 49, 'y' => 50, 'z' => 51, 0 => 52, 1 => 53, 2 => 54, 3 => 55,
4 => 56, 5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63,
);
];
/**
* Integer to char map
*
* @var array
*/
private $intToCharMap = array(
private $intToCharMap = [
0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', 4 => 'E', 5 => 'F', 6 => 'G', 7 => 'H',
8 => 'I', 9 => 'J', 10 => 'K', 11 => 'L', 12 => 'M', 13 => 'N', 14 => 'O', 15 => 'P',
16 => 'Q', 17 => 'R', 18 => 'S', 19 => 'T', 20 => 'U', 21 => 'V', 22 => 'W', 23 => 'X',
@@ -72,7 +72,7 @@ class Base64VLQEncoder
40 => 'o', 41 => 'p', 42 => 'q', 43 => 'r', 44 => 's', 45 => 't', 46 => 'u', 47 => 'v',
48 => 'w', 49 => 'x', 50 => 'y', 51 => 'z', 52 => '0', 53 => '1', 54 => '2', 55 => '3',
56 => '4', 57 => '5', 58 => '6', 59 => '7', 60 => '8', 61 => '9', 62 => '+', 63 => '/',
);
];
/**
* Constructor
+45 -35
View File
@@ -2,16 +2,16 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp\SourceMap;
namespace ScssPhp\ScssPhp\SourceMap;
use Leafo\ScssPhp\Exception\CompilerException;
use ScssPhp\ScssPhp\Exception\CompilerException;
/**
* Source Map Generator
@@ -33,7 +33,7 @@ class SourceMapGenerator
*
* @var array
*/
protected $defaultOptions = array(
protected $defaultOptions = [
// an optional source root, useful for relocating source files
// on a server or removing repeated values in the 'sources' entry.
// This value is prepended to the individual entries in the 'source' field.
@@ -56,12 +56,12 @@ class SourceMapGenerator
// base path for filename normalization
'sourceMapBasepath' => ''
);
];
/**
* The base64 VLQ encoder
*
* @var \Leafo\ScssPhp\SourceMap\Base64VLQEncoder
* @var \ScssPhp\ScssPhp\SourceMap\Base64VLQ
*/
protected $encoder;
@@ -70,22 +70,22 @@ class SourceMapGenerator
*
* @var array
*/
protected $mappings = array();
protected $mappings = [];
/**
* Array of contents map
*
* @var array
*/
protected $contentsMap = array();
protected $contentsMap = [];
/**
* File to content map
*
* @var array
*/
protected $sources = array();
protected $source_keys = array();
protected $sources = [];
protected $sourceKeys = [];
/**
* @var array
@@ -95,7 +95,7 @@ class SourceMapGenerator
public function __construct(array $options = [])
{
$this->options = array_merge($this->defaultOptions, $options);
$this->encoder = new Base64VLQEncoder();
$this->encoder = new Base64VLQ();
}
/**
@@ -109,13 +109,13 @@ class SourceMapGenerator
*/
public function addMapping($generatedLine, $generatedColumn, $originalLine, $originalColumn, $sourceFile)
{
$this->mappings[] = array(
'generated_line' => $generatedLine,
$this->mappings[] = [
'generated_line' => $generatedLine,
'generated_column' => $generatedColumn,
'original_line' => $originalLine,
'original_column' => $originalColumn,
'source_file' => $sourceFile
);
'original_line' => $originalLine,
'original_column' => $originalColumn,
'source_file' => $sourceFile
];
$this->sources[$sourceFile] = $sourceFile;
}
@@ -123,10 +123,11 @@ class SourceMapGenerator
/**
* Saves the source map to a file
*
* @param string $file The absolute path to a file
* @param string $content The content to write
*
* @throws \Leafo\ScssPhp\Exception\CompilerException If the file could not be saved
* @return string
*
* @throws \ScssPhp\ScssPhp\Exception\CompilerException If the file could not be saved
*/
public function saveMap($content)
{
@@ -136,7 +137,9 @@ class SourceMapGenerator
// directory does not exist
if (! is_dir($dir)) {
// FIXME: create the dir automatically?
throw new CompilerException(sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir));
throw new CompilerException(
sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir)
);
}
// FIXME: proper saving, with dir write check!
@@ -156,7 +159,7 @@ class SourceMapGenerator
*/
public function generateJson()
{
$sourceMap = array();
$sourceMap = [];
$mappings = $this->generateMappings();
// File version (always the first entry in the object) and must be a positive integer.
@@ -178,14 +181,14 @@ class SourceMapGenerator
}
// A list of original sources used by the 'mappings' entry.
$sourceMap['sources'] = array();
$sourceMap['sources'] = [];
foreach ($this->sources as $source_uri => $source_filename) {
$sourceMap['sources'][] = $this->normalizeFilename($source_filename);
foreach ($this->sources as $sourceUri => $sourceFilename) {
$sourceMap['sources'][] = $this->normalizeFilename($sourceFilename);
}
// A list of symbol names used by the 'mappings' entry.
$sourceMap['names'] = array();
$sourceMap['names'] = [];
// A string with the encoded mapping data.
$sourceMap['mappings'] = $mappings;
@@ -202,7 +205,7 @@ class SourceMapGenerator
unset($sourceMap['sourceRoot']);
}
return json_encode($sourceMap);
return json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
}
/**
@@ -216,7 +219,7 @@ class SourceMapGenerator
return null;
}
$content = array();
$content = [];
foreach ($this->sources as $sourceFile) {
$content[] = file_get_contents($sourceFile);
@@ -236,10 +239,10 @@ class SourceMapGenerator
return '';
}
$this->source_keys = array_flip(array_keys($this->sources));
$this->sourceKeys = array_flip(array_keys($this->sources));
// group mappings by generated line number.
$groupedMap = $groupedMapEncoded = array();
$groupedMap = $groupedMapEncoded = [];
foreach ($this->mappings as $m) {
$groupedMap[$m['generated_line']][] = $m;
@@ -248,15 +251,15 @@ class SourceMapGenerator
ksort($groupedMap);
$lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;
foreach ($groupedMap as $lineNumber => $line_map) {
foreach ($groupedMap as $lineNumber => $lineMap) {
while (++$lastGeneratedLine < $lineNumber) {
$groupedMapEncoded[] = ';';
}
$lineMapEncoded = array();
$lineMapEncoded = [];
$lastGeneratedColumn = 0;
foreach ($line_map as $m) {
foreach ($lineMap as $m) {
$mapEncoded = $this->encoder->encode($m['generated_column'] - $lastGeneratedColumn);
$lastGeneratedColumn = $m['generated_column'];
@@ -293,9 +296,16 @@ class SourceMapGenerator
*/
protected function findFileIndex($filename)
{
return $this->source_keys[$filename];
return $this->sourceKeys[$filename];
}
/**
* Normalize filename
*
* @param string $filename
*
* @return string
*/
protected function normalizeFilename($filename)
{
$filename = $this->fixWindowsPath($filename);
@@ -303,7 +313,7 @@ class SourceMapGenerator
$basePath = $this->options['sourceMapBasepath'];
// "Trim" the 'sourceMapBasepath' from the output filename.
if (strpos($filename, $basePath) === 0) {
if (strlen($basePath) && strpos($filename, $basePath) === 0) {
$filename = substr($filename, strlen($basePath));
}
+3 -3
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
/**
* Block/node types
+8 -8
View File
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
use Leafo\ScssPhp\Base\Range;
use Leafo\ScssPhp\Exception\RangeException;
use ScssPhp\ScssPhp\Base\Range;
use ScssPhp\ScssPhp\Exception\RangeException;
/**
* Utilty functions
@@ -26,13 +26,13 @@ class Util
* room for slight floating-point errors.
*
* @param string $name The name of the value. Used in the error message.
* @param \Leafo\ScssPhp\Base\Range $range Range of values.
* @param \ScssPhp\ScssPhp\Base\Range $range Range of values.
* @param array $value The value to check.
* @param string $unit The unit of the value. Used in error reporting.
*
* @return mixed `value` adjusted to fall within range, if it was outside by a floating-point margin.
*
* @throws \Leafo\ScssPhp\Exception\RangeException
* @throws \ScssPhp\ScssPhp\Exception\RangeException
*/
public static function checkRange($name, Range $range, $value, $unit = '')
{
@@ -63,7 +63,7 @@ class Util
*/
public static function encodeURIComponent($string)
{
$revert = array('%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')');
$revert = ['%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'];
return strtr(rawurlencode($string), $revert);
}
+4 -4
View File
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
* @copyright 2012-2018 Leaf Corcoran
* @copyright 2012-2019 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
* @link http://scssphp.github.io/scssphp
*/
namespace Leafo\ScssPhp;
namespace ScssPhp\ScssPhp;
/**
* SCSSPHP version
@@ -18,5 +18,5 @@ namespace Leafo\ScssPhp;
*/
class Version
{
const VERSION = 'v0.7.5';
const VERSION = 'v1.0.2';
}
+1 -1
View File
@@ -1,7 +1,7 @@
scssphp
-------
Downloaded from: https://github.com/leafo/scssphp
Downloaded from: https://github.com/scssphp/scssphp
Import procedure:
+1 -1
View File
@@ -222,7 +222,7 @@
<location>scssphp</location>
<name>scssphp</name>
<license>MIT</license>
<version>0.7.5</version>
<version>1.0.2</version>
</library>
<library>
<location>spout</location>
+1
View File
@@ -19,6 +19,7 @@ information provided here is intended especially for developers.
a button. Action elements which perform actions on the selected checkboxes can also be enabled/disabled depending on whether
at least a single checkbox item is selected or not.
* Final deprecation (removal) of the core/modal_confirm dialogue.
* Upgrade scssphp to v1.0.2, This involves renaming classes from Leafo => ScssPhp as the repo has changed.
=== 3.7 ===