[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Url 5 * 6 * @package Less 7 * @subpackage tree 8 */ 9 class Less_Tree_Url extends Less_Tree{ 10 11 public $attrs; 12 public $value; 13 public $currentFileInfo; 14 public $isEvald; 15 public $type = 'Url'; 16 17 public function __construct($value, $currentFileInfo = null, $isEvald = null){ 18 $this->value = $value; 19 $this->currentFileInfo = $currentFileInfo; 20 $this->isEvald = $isEvald; 21 } 22 23 public function accept( $visitor ){ 24 $this->value = $visitor->visitObj($this->value); 25 } 26 27 /** 28 * @see Less_Tree::genCSS 29 */ 30 public function genCSS( $output ){ 31 $output->add( 'url(' ); 32 $this->value->genCSS( $output ); 33 $output->add( ')' ); 34 } 35 36 /** 37 * @param Less_Functions $ctx 38 */ 39 public function compile($ctx){ 40 $val = $this->value->compile($ctx); 41 42 if( !$this->isEvald ){ 43 // Add the base path if the URL is relative 44 if( Less_Parser::$options['relativeUrls'] 45 && $this->currentFileInfo 46 && is_string($val->value) 47 && Less_Environment::isPathRelative($val->value) 48 ){ 49 $rootpath = $this->currentFileInfo['uri_root']; 50 if ( !$val->quote ){ 51 $rootpath = preg_replace('/[\(\)\'"\s]/', '\\$1', $rootpath ); 52 } 53 $val->value = $rootpath . $val->value; 54 } 55 56 $val->value = Less_Environment::normalizePath( $val->value); 57 } 58 59 // Add cache buster if enabled 60 if( Less_Parser::$options['urlArgs'] ){ 61 if( !preg_match('/^\s*data:/',$val->value) ){ 62 $delimiter = strpos($val->value,'?') === false ? '?' : '&'; 63 $urlArgs = $delimiter . Less_Parser::$options['urlArgs']; 64 $hash_pos = strpos($val->value,'#'); 65 if( $hash_pos !== false ){ 66 $val->value = substr_replace($val->value,$urlArgs, $hash_pos, 0); 67 } else { 68 $val->value .= $urlArgs; 69 } 70 } 71 } 72 73 return new Less_Tree_URL($val, $this->currentFileInfo, true); 74 } 75 76 }
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 |