From fd72b0f50a355006069c5a336441f08beb7d3c50 Mon Sep 17 00:00:00 2001 From: derchris Date: Mon, 4 Feb 2019 13:11:28 +0100 Subject: Revert "update less.php to PHP 7.x compatible fork" This reverts commit 7ad9f272a482802da2d43fe83841adbe9bcd8cb4. --- lib/less.php/Tree/Selector.php | 168 ----------------------------------------- 1 file changed, 168 deletions(-) delete mode 100644 lib/less.php/Tree/Selector.php (limited to 'lib/less.php/Tree/Selector.php') diff --git a/lib/less.php/Tree/Selector.php b/lib/less.php/Tree/Selector.php deleted file mode 100644 index 6b9dae6..0000000 --- a/lib/less.php/Tree/Selector.php +++ /dev/null @@ -1,168 +0,0 @@ -elements = $elements; - $this->elements_len = count($elements); - $this->extendList = $extendList; - $this->condition = $condition; - if( $currentFileInfo ){ - $this->currentFileInfo = $currentFileInfo; - } - $this->isReferenced = $isReferenced; - if( !$condition ){ - $this->evaldCondition = true; - } - - $this->CacheElements(); - } - - public function accept($visitor) { - $this->elements = $visitor->visitArray($this->elements); - $this->extendList = $visitor->visitArray($this->extendList); - if( $this->condition ){ - $this->condition = $visitor->visitObj($this->condition); - } - - if( $visitor instanceof Less_Visitor_extendFinder ){ - $this->CacheElements(); - } - } - - public function createDerived( $elements, $extendList = null, $evaldCondition = null ){ - $newSelector = new Less_Tree_Selector( $elements, ($extendList ? $extendList : $this->extendList), null, $this->index, $this->currentFileInfo, $this->isReferenced); - $newSelector->evaldCondition = $evaldCondition ? $evaldCondition : $this->evaldCondition; - return $newSelector; - } - - - public function match( $other ){ - - if( !$other->_oelements || ($this->elements_len < $other->_oelements_len) ){ - return 0; - } - - for( $i = 0; $i < $other->_oelements_len; $i++ ){ - if( $this->elements[$i]->value !== $other->_oelements[$i]) { - return 0; - } - } - - return $other->_oelements_len; // return number of matched elements - } - - - public function CacheElements(){ - - $this->_oelements = array(); - $css = ''; - - foreach($this->elements as $v){ - - $css .= $v->combinator; - if( !$v->value_is_object ){ - $css .= $v->value; - continue; - } - - if( !property_exists($v->value,'value') || !is_string($v->value->value) ){ - $this->cacheable = false; - return; - } - $css .= $v->value->value; - } - - $this->_oelements_len = preg_match_all('/[,&#\.\w-](?:[\w-]|(?:\\\\.))*/', $css, $matches); - if( $this->_oelements_len ){ - $this->_oelements = $matches[0]; - - if( $this->_oelements[0] === '&' ){ - array_shift($this->_oelements); - $this->_oelements_len--; - } - } - } - - public function isJustParentSelector(){ - return !$this->mediaEmpty && - count($this->elements) === 1 && - $this->elements[0]->value === '&' && - ($this->elements[0]->combinator === ' ' || $this->elements[0]->combinator === ''); - } - - public function compile($env) { - - $elements = array(); - foreach($this->elements as $el){ - $elements[] = $el->compile($env); - } - - $extendList = array(); - foreach($this->extendList as $el){ - $extendList[] = $el->compile($el); - } - - $evaldCondition = false; - if( $this->condition ){ - $evaldCondition = $this->condition->compile($env); - } - - return $this->createDerived( $elements, $extendList, $evaldCondition ); - } - - - /** - * @see Less_Tree::genCSS - */ - public function genCSS( $output, $firstSelector = true ){ - - if( !$firstSelector && $this->elements[0]->combinator === "" ){ - $output->add(' ', $this->currentFileInfo, $this->index); - } - - foreach($this->elements as $element){ - $element->genCSS( $output ); - } - } - - public function markReferenced(){ - $this->isReferenced = true; - } - - public function getIsReferenced(){ - return !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] || $this->isReferenced; - } - - public function getIsOutput(){ - return $this->evaldCondition; - } - -} -- cgit v1.2.3