[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 4 /** 5 * Environment 6 * 7 * @package Less 8 * @subpackage environment 9 */ 10 class Less_Environment{ 11 12 //public $paths = array(); // option - unmodified - paths to search for imports on 13 //public static $files = array(); // list of files that have been imported, used for import-once 14 //public $rootpath; // option - rootpath to append to URL's 15 //public static $strictImports = null; // option - 16 //public $insecure; // option - whether to allow imports from insecure ssl hosts 17 //public $processImports; // option - whether to process imports. if false then imports will not be imported 18 //public $javascriptEnabled; // option - whether JavaScript is enabled. if undefined, defaults to true 19 //public $useFileCache; // browser only - whether to use the per file session cache 20 public $currentFileInfo; // information about the current file - for error reporting and importing and making urls relative etc. 21 22 public $importMultiple = false; // whether we are currently importing multiple copies 23 24 25 /** 26 * @var array 27 */ 28 public $frames = array(); 29 30 /** 31 * @var array 32 */ 33 public $mediaBlocks = array(); 34 35 /** 36 * @var array 37 */ 38 public $mediaPath = array(); 39 40 public static $parensStack = 0; 41 42 public static $tabLevel = 0; 43 44 public static $lastRule = false; 45 46 public static $_outputMap; 47 48 public static $mixin_stack = 0; 49 50 /** 51 * @var array 52 */ 53 public $functions = array(); 54 55 56 public function Init(){ 57 58 self::$parensStack = 0; 59 self::$tabLevel = 0; 60 self::$lastRule = false; 61 self::$mixin_stack = 0; 62 63 if( Less_Parser::$options['compress'] ){ 64 65 Less_Environment::$_outputMap = array( 66 ',' => ',', 67 ': ' => ':', 68 '' => '', 69 ' ' => ' ', 70 ':' => ' :', 71 '+' => '+', 72 '~' => '~', 73 '>' => '>', 74 '|' => '|', 75 '^' => '^', 76 '^^' => '^^' 77 ); 78 79 }else{ 80 81 Less_Environment::$_outputMap = array( 82 ',' => ', ', 83 ': ' => ': ', 84 '' => '', 85 ' ' => ' ', 86 ':' => ' :', 87 '+' => ' + ', 88 '~' => ' ~ ', 89 '>' => ' > ', 90 '|' => '|', 91 '^' => ' ^ ', 92 '^^' => ' ^^ ' 93 ); 94 95 } 96 } 97 98 99 public function copyEvalEnv($frames = array() ){ 100 $new_env = new Less_Environment(); 101 $new_env->frames = $frames; 102 return $new_env; 103 } 104 105 106 public static function isMathOn(){ 107 return !Less_Parser::$options['strictMath'] || Less_Environment::$parensStack; 108 } 109 110 public static function isPathRelative($path){ 111 return !preg_match('/^(?:[a-z-]+:|\/)/',$path); 112 } 113 114 115 /** 116 * Canonicalize a path by resolving references to '/./', '/../' 117 * Does not remove leading "../" 118 * @param string path or url 119 * @return string Canonicalized path 120 * 121 */ 122 public static function normalizePath($path){ 123 124 $segments = explode('/',$path); 125 $segments = array_reverse($segments); 126 127 $path = array(); 128 $path_len = 0; 129 130 while( $segments ){ 131 $segment = array_pop($segments); 132 switch( $segment ) { 133 134 case '.': 135 break; 136 137 case '..': 138 if( !$path_len || ( $path[$path_len-1] === '..') ){ 139 $path[] = $segment; 140 $path_len++; 141 }else{ 142 array_pop($path); 143 $path_len--; 144 } 145 break; 146 147 default: 148 $path[] = $segment; 149 $path_len++; 150 break; 151 } 152 } 153 154 return implode('/',$path); 155 } 156 157 158 public function unshiftFrame($frame){ 159 array_unshift($this->frames, $frame); 160 } 161 162 public function shiftFrame(){ 163 return array_shift($this->frames); 164 } 165 166 }
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 |