[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Join Selector Visitor 5 * 6 * @package Less 7 * @subpackage visitor 8 */ 9 class Less_Visitor_joinSelector extends Less_Visitor{ 10 11 public $contexts = array( array() ); 12 13 /** 14 * @param Less_Tree_Ruleset $root 15 */ 16 public function run( $root ){ 17 return $this->visitObj($root); 18 } 19 20 public function visitRule( $ruleNode, &$visitDeeper ){ 21 $visitDeeper = false; 22 } 23 24 public function visitMixinDefinition( $mixinDefinitionNode, &$visitDeeper ){ 25 $visitDeeper = false; 26 } 27 28 public function visitRuleset( $rulesetNode ){ 29 30 $paths = array(); 31 32 if( !$rulesetNode->root ){ 33 $selectors = array(); 34 35 if( $rulesetNode->selectors && $rulesetNode->selectors ){ 36 foreach($rulesetNode->selectors as $selector){ 37 if( $selector->getIsOutput() ){ 38 $selectors[] = $selector; 39 } 40 } 41 } 42 43 if( !$selectors ){ 44 $rulesetNode->selectors = null; 45 $rulesetNode->rules = null; 46 }else{ 47 $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; 48 $paths = $rulesetNode->joinSelectors( $context, $selectors); 49 } 50 51 $rulesetNode->paths = $paths; 52 } 53 54 $this->contexts[] = $paths; //different from less.js. Placed after joinSelectors() so that $this->contexts will get correct $paths 55 } 56 57 public function visitRulesetOut(){ 58 array_pop($this->contexts); 59 } 60 61 public function visitMedia($mediaNode) { 62 $context = end($this->contexts); //$context = $this->contexts[ count($this->contexts) - 1]; 63 64 if( !count($context) || (is_object($context[0]) && $context[0]->multiMedia) ){ 65 $mediaNode->rules[0]->root = true; 66 } 67 } 68 69 } 70
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |