8 * @subpackage environment
10 class Less_Environment
{
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.
22 public $importMultiple = false; // whether we are currently importing multiple copies
28 public $frames = array();
33 public $mediaBlocks = array();
38 public $mediaPath = array();
40 public static $parensStack = 0;
42 public static $tabLevel = 0;
44 public static $lastRule = false;
46 public static $_outputMap;
48 public static $mixin_stack = 0;
53 public $functions = array();
56 public function Init(){
58 self
::$parensStack = 0;
60 self
::$lastRule = false;
61 self
::$mixin_stack = 0;
63 if( Less_Parser
::$options['compress'] ){
65 Less_Environment
::$_outputMap = array(
81 Less_Environment
::$_outputMap = array(
99 public function copyEvalEnv($frames = array() ){
100 $new_env = new Less_Environment();
101 $new_env->frames
= $frames;
106 public static function isMathOn(){
107 return !Less_Parser
::$options['strictMath'] || Less_Environment
::$parensStack;
110 public static function isPathRelative($path){
111 return !preg_match('/^(?:[a-z-]+:|\/)/',$path);
116 * Canonicalize a path by resolving references to '/./', '/../'
117 * Does not remove leading "../"
118 * @param string path or url
119 * @return string Canonicalized path
122 public static function normalizePath($path){
124 $segments = explode('/',$path);
125 $segments = array_reverse($segments);
131 $segment = array_pop($segments);
138 if( !$path_len ||
( $path[$path_len-1] === '..') ){
154 return implode('/',$path);
158 public function unshiftFrame($frame){
159 array_unshift($this->frames
, $frame);
162 public function shiftFrame(){
163 return array_shift($this->frames
);