@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function isSsl() |
56 | 56 | { |
57 | - if(!is_null(self::$isSSL)) |
|
57 | + if (!is_null(self::$isSSL)) |
|
58 | 58 | { |
59 | 59 | return self::$isSSL; |
60 | 60 | } |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | * */ |
89 | 89 | function loadFile($args) |
90 | 90 | { |
91 | - if(!is_array($args)) |
|
91 | + if (!is_array($args)) |
|
92 | 92 | { |
93 | 93 | $args = array($args); |
94 | 94 | } |
95 | 95 | $file = $this->getFileInfo($args[0], $args[2], $args[1]); |
96 | 96 | |
97 | 97 | $availableExtension = array('css' => 1, 'js' => 1); |
98 | - if(!isset($availableExtension[$file->fileExtension])) |
|
98 | + if (!isset($availableExtension[$file->fileExtension])) |
|
99 | 99 | { |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $file->index = (int) $args[3]; |
104 | 104 | |
105 | - if($file->fileExtension == 'css') |
|
105 | + if ($file->fileExtension == 'css') |
|
106 | 106 | { |
107 | 107 | $map = &$this->cssMap; |
108 | 108 | $mapIndex = &$this->cssMapIndex; |
109 | 109 | |
110 | 110 | $this->_arrangeCssIndex($pathInfo['dirname'], $file); |
111 | 111 | } |
112 | - else if($file->fileExtension == 'js') |
|
112 | + else if ($file->fileExtension == 'js') |
|
113 | 113 | { |
114 | - if($args[1] == 'body') |
|
114 | + if ($args[1] == 'body') |
|
115 | 115 | { |
116 | 116 | $map = &$this->jsBodyMap; |
117 | 117 | $mapIndex = &$this->jsBodyMapIndex; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | (is_null($file->index)) ? $file->index = 0 : $file->index = $file->index; |
127 | - if(!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index) |
|
127 | + if (!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index) |
|
128 | 128 | { |
129 | 129 | $this->unloadFile($args[0], $args[2], $args[1]); |
130 | 130 | $map[$file->index][$file->key] = $file; |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | { |
145 | 145 | static $existsInfo = array(); |
146 | 146 | |
147 | - if(isset($existsInfo[$existsKey])) |
|
147 | + if (isset($existsInfo[$existsKey])) |
|
148 | 148 | { |
149 | 149 | return $existsInfo[$existsKey]; |
150 | 150 | } |
151 | 151 | |
152 | 152 | $fileName = preg_replace('/(?:[\/]{3,})(.*)/', '//$1', $fileName); |
153 | 153 | $url_info = parse_url($fileName); |
154 | - $pathInfo = pathinfo(str_replace('?' . $url_info['query'], '', $fileName)); |
|
154 | + $pathInfo = pathinfo(str_replace('?'.$url_info['query'], '', $fileName)); |
|
155 | 155 | |
156 | 156 | $file = new stdClass(); |
157 | 157 | $file->fileName = basename($url_info['path']); |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | $file->keyName = implode('.', array($file->fileNameNoExt, $file->fileExtension)); |
165 | 165 | $file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']); |
166 | 166 | |
167 | - if(!$file->external) |
|
167 | + if (!$file->external) |
|
168 | 168 | { |
169 | - if(!__DEBUG__ && __XE_VERSION_STABLE__) |
|
169 | + if (!__DEBUG__ && __XE_VERSION_STABLE__) |
|
170 | 170 | { |
171 | 171 | // if no debug mode, load minifed file |
172 | 172 | $minifiedFileName = implode('.', array($file->fileNameNoExt, 'min', $file->fileExtension)); |
173 | 173 | $minifiedRealPath = implode('/', array($file->fileRealPath, $minifiedFileName)); |
174 | - if(file_exists($minifiedRealPath)) |
|
174 | + if (file_exists($minifiedRealPath)) |
|
175 | 175 | { |
176 | 176 | $file->fileName = $minifiedFileName; |
177 | 177 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | else |
180 | 180 | { |
181 | 181 | // Remove .min |
182 | - if(file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
|
182 | + if (file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
|
183 | 183 | { |
184 | 184 | $file->fileName = $file->keyName; |
185 | 185 | } |
@@ -188,18 +188,18 @@ discard block |
||
188 | 188 | |
189 | 189 | $file->targetIe = $targetIe; |
190 | 190 | |
191 | - if($file->fileExtension == 'css') |
|
191 | + if ($file->fileExtension == 'css') |
|
192 | 192 | { |
193 | 193 | $file->media = $media; |
194 | - if(!$file->media) |
|
194 | + if (!$file->media) |
|
195 | 195 | { |
196 | 196 | $file->media = 'all'; |
197 | 197 | } |
198 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media; |
|
198 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe."\t".$file->media; |
|
199 | 199 | } |
200 | - else if($file->fileExtension == 'js') |
|
200 | + else if ($file->fileExtension == 'js') |
|
201 | 201 | { |
202 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe; |
|
202 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $file; |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | { |
218 | 218 | $file = $this->getFileInfo($fileName, $targetIe, $media); |
219 | 219 | |
220 | - if($file->fileExtension == 'css') |
|
220 | + if ($file->fileExtension == 'css') |
|
221 | 221 | { |
222 | - if(isset($this->cssMapIndex[$file->key])) |
|
222 | + if (isset($this->cssMapIndex[$file->key])) |
|
223 | 223 | { |
224 | 224 | $index = $this->cssMapIndex[$file->key]; |
225 | 225 | unset($this->cssMap[$index][$file->key], $this->cssMapIndex[$file->key]); |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | } |
228 | 228 | else |
229 | 229 | { |
230 | - if(isset($this->jsHeadMapIndex[$file->key])) |
|
230 | + if (isset($this->jsHeadMapIndex[$file->key])) |
|
231 | 231 | { |
232 | 232 | $index = $this->jsHeadMapIndex[$file->key]; |
233 | 233 | unset($this->jsHeadMap[$index][$file->key], $this->jsHeadMapIndex[$file->key]); |
234 | 234 | } |
235 | - if(isset($this->jsBodyMapIndex[$file->key])) |
|
235 | + if (isset($this->jsBodyMapIndex[$file->key])) |
|
236 | 236 | { |
237 | 237 | $index = $this->jsBodyMapIndex[$file->key]; |
238 | 238 | unset($this->jsBodyMap[$index][$file->key], $this->jsBodyMapIndex[$file->key]); |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function unloadAllFiles($type = 'all') |
250 | 250 | { |
251 | - if($type == 'css' || $type == 'all') |
|
251 | + if ($type == 'css' || $type == 'all') |
|
252 | 252 | { |
253 | 253 | $this->cssMap = array(); |
254 | 254 | $this->cssMapIndex = array(); |
255 | 255 | } |
256 | 256 | |
257 | - if($type == 'js' || $type == 'all') |
|
257 | + if ($type == 'js' || $type == 'all') |
|
258 | 258 | { |
259 | 259 | $this->jsHeadMap = array(); |
260 | 260 | $this->jsBodyMap = array(); |
@@ -276,23 +276,23 @@ discard block |
||
276 | 276 | $this->_sortMap($map, $mapIndex); |
277 | 277 | |
278 | 278 | $result = array(); |
279 | - foreach($map as $indexedMap) |
|
279 | + foreach ($map as $indexedMap) |
|
280 | 280 | { |
281 | - foreach($indexedMap as $file) |
|
281 | + foreach ($indexedMap as $file) |
|
282 | 282 | { |
283 | 283 | $query = ''; |
284 | - if(!$file->external && is_readable($file->cdnPath . '/' . $file->fileName)) |
|
284 | + if (!$file->external && is_readable($file->cdnPath.'/'.$file->fileName)) |
|
285 | 285 | { |
286 | - $query = date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)); |
|
286 | + $query = date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)); |
|
287 | 287 | } |
288 | - if($file->query) |
|
288 | + if ($file->query) |
|
289 | 289 | { |
290 | - if($query) $query .= '&'; |
|
290 | + if ($query) $query .= '&'; |
|
291 | 291 | $query .= $file->query; |
292 | 292 | } |
293 | - $query = ($query) ? '?' . $query : ''; |
|
293 | + $query = ($query) ? '?'.$query : ''; |
|
294 | 294 | |
295 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $query; |
|
295 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$query; |
|
296 | 296 | $result[] = array( |
297 | 297 | 'file' => $fullFilePath, |
298 | 298 | 'media' => $file->media, |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | function getJsFileList($type = 'head') |
314 | 314 | { |
315 | - if($type == 'head') |
|
315 | + if ($type == 'head') |
|
316 | 316 | { |
317 | 317 | $map = &$this->jsHeadMap; |
318 | 318 | $mapIndex = &$this->jsHeadMapIndex; |
@@ -326,23 +326,23 @@ discard block |
||
326 | 326 | $this->_sortMap($map, $mapIndex); |
327 | 327 | |
328 | 328 | $result = array(); |
329 | - foreach($map as $indexedMap) |
|
329 | + foreach ($map as $indexedMap) |
|
330 | 330 | { |
331 | - foreach($indexedMap as $file) |
|
331 | + foreach ($indexedMap as $file) |
|
332 | 332 | { |
333 | 333 | $query = ''; |
334 | - if(!$file->external && is_readable($file->cdnPath . '/' . $file->fileName)) |
|
334 | + if (!$file->external && is_readable($file->cdnPath.'/'.$file->fileName)) |
|
335 | 335 | { |
336 | - $query = date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)); |
|
336 | + $query = date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)); |
|
337 | 337 | } |
338 | - if($file->query) |
|
338 | + if ($file->query) |
|
339 | 339 | { |
340 | - if($query) $query .= '&'; |
|
340 | + if ($query) $query .= '&'; |
|
341 | 341 | $query .= $file->query; |
342 | 342 | } |
343 | - $query = ($query) ? '?' . $query : ''; |
|
343 | + $query = ($query) ? '?'.$query : ''; |
|
344 | 344 | |
345 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $query; |
|
345 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$query; |
|
346 | 346 | $result[] = array( |
347 | 347 | 'file' => $fullFilePath, |
348 | 348 | 'targetie' => $file->targetIe |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | */ |
374 | 374 | function _normalizeFilePath($path) |
375 | 375 | { |
376 | - if(strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
|
376 | + if (strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
|
377 | 377 | { |
378 | - $path = './' . $path; |
|
378 | + $path = './'.$path; |
|
379 | 379 | } |
380 | - elseif(!strncmp($path, '//', 2)) |
|
380 | + elseif (!strncmp($path, '//', 2)) |
|
381 | 381 | { |
382 | 382 | return preg_replace('#^//+#', '//', $path); |
383 | 383 | } |
384 | 384 | |
385 | 385 | $path = preg_replace('@/\./|(?<!:)\/\/@', '/', $path); |
386 | 386 | |
387 | - while(strpos($path, '/../')) |
|
387 | + while (strpos($path, '/../')) |
|
388 | 388 | { |
389 | 389 | $path = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $path, 1); |
390 | 390 | } |
@@ -403,20 +403,20 @@ discard block |
||
403 | 403 | $path = $this->_normalizeFilePath($path); |
404 | 404 | $script_path = getScriptPath(); |
405 | 405 | |
406 | - if(strpos($path, './') === 0) |
|
406 | + if (strpos($path, './') === 0) |
|
407 | 407 | { |
408 | - if($script_path == '/' || $script_path == '\\') |
|
408 | + if ($script_path == '/' || $script_path == '\\') |
|
409 | 409 | { |
410 | - $path = '/' . substr($path, 2); |
|
410 | + $path = '/'.substr($path, 2); |
|
411 | 411 | } |
412 | 412 | else |
413 | 413 | { |
414 | - $path = $script_path . substr($path, 2); |
|
414 | + $path = $script_path.substr($path, 2); |
|
415 | 415 | } |
416 | 416 | } |
417 | - else if(strpos($file, '../') === 0) |
|
417 | + else if (strpos($file, '../') === 0) |
|
418 | 418 | { |
419 | - $path = $this->_normalizeFilePath($script_path . $path); |
|
419 | + $path = $this->_normalizeFilePath($script_path.$path); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | return $path; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | */ |
432 | 432 | function _arrangeCssIndex($dirName, &$file) |
433 | 433 | { |
434 | - if($file->index !== 0) |
|
434 | + if ($file->index !== 0) |
|
435 | 435 | { |
436 | 436 | return; |
437 | 437 | } |