[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Quoted 5 * 6 * @package Less 7 * @subpackage tree 8 */ 9 class Less_Tree_Quoted extends Less_Tree{ 10 public $escaped; 11 public $value; 12 public $quote; 13 public $index; 14 public $currentFileInfo; 15 public $type = 'Quoted'; 16 17 /** 18 * @param string $str 19 */ 20 public function __construct($str, $content = '', $escaped = false, $index = false, $currentFileInfo = null ){ 21 $this->escaped = $escaped; 22 $this->value = $content; 23 if( $str ){ 24 $this->quote = $str[0]; 25 } 26 $this->index = $index; 27 $this->currentFileInfo = $currentFileInfo; 28 } 29 30 /** 31 * @see Less_Tree::genCSS 32 */ 33 public function genCSS( $output ){ 34 if( !$this->escaped ){ 35 $output->add( $this->quote, $this->currentFileInfo, $this->index ); 36 } 37 $output->add( $this->value ); 38 if( !$this->escaped ){ 39 $output->add( $this->quote ); 40 } 41 } 42 43 public function compile($env){ 44 45 $value = $this->value; 46 if( preg_match_all('/`([^`]+)`/', $this->value, $matches) ){ 47 foreach($matches as $i => $match){ 48 $js = new Less_Tree_JavaScript($matches[1], $this->index, true); 49 $js = $js->compile()->value; 50 $value = str_replace($matches[0][$i], $js, $value); 51 } 52 } 53 54 if( preg_match_all('/@\{([\w-]+)\}/',$value,$matches) ){ 55 foreach($matches[1] as $i => $match){ 56 $v = new Less_Tree_Variable('@' . $match, $this->index, $this->currentFileInfo ); 57 $v = $v->compile($env); 58 $v = ($v instanceof Less_Tree_Quoted) ? $v->value : $v->toCSS(); 59 $value = str_replace($matches[0][$i], $v, $value); 60 } 61 } 62 63 return new Less_Tree_Quoted($this->quote . $value . $this->quote, $value, $this->escaped, $this->index, $this->currentFileInfo); 64 } 65 66 public function compare($x) { 67 68 if( !Less_Parser::is_method($x, 'toCSS') ){ 69 return -1; 70 } 71 72 $left = $this->toCSS(); 73 $right = $x->toCSS(); 74 75 if ($left === $right) { 76 return 0; 77 } 78 79 return $left < $right ? -1 : 1; 80 } 81 }
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 |