Changeset 25544 for trunk/include/template.class.php
- Timestamp:
- Nov 18, 2013, 6:01:11 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r25506 r25544 1047 1047 { 1048 1048 uasort($this->registered_css, array('CssLoader', 'cmp_by_order')); 1049 return self::do_combine($this->registered_css); 1049 $combiner = new FileCombiner('css', $this->registered_css); 1050 return $combiner->combine(); 1050 1051 } 1051 1052 … … 1053 1054 { 1054 1055 return $a->order - $b->order; 1055 }1056 1057 private static function do_combine($files)1058 {1059 $combiner = new FileCombiner('css');1060 foreach ($files as $css)1061 {1062 $combiner->add( $css);1063 }1064 return $combiner->combine();1065 1056 } 1066 1057 … … 1253 1244 private static function do_combine($scripts, $load_mode) 1254 1245 { 1255 $combiner = new FileCombiner('js'); 1256 foreach ($scripts as $script) 1257 { 1258 $combiner->add( $script); 1259 } 1246 $combiner = new FileCombiner('js', $scripts); 1260 1247 return $combiner->combine(); 1261 1248 } … … 1378 1365 private $type; // js or css 1379 1366 private $is_css; 1380 private $combinables = array();1381 1382 function FileCombiner($type )1367 private $combinables; 1368 1369 function FileCombiner($type, $combinables) 1383 1370 { 1384 1371 $this->type = $type; 1385 1372 $this->is_css = $type=='css'; 1373 $this->combinables = $combinables; 1386 1374 } 1387 1375 … … 1397 1385 } 1398 1386 1399 function add($combinable) 1400 { 1401 $this->combinables[] = $combinable; 1387 function add($combinables) 1388 { 1389 foreach($combinables as $combinable) 1390 $this->combinables[] = $combinable; 1402 1391 } 1403 1392 … … 1414 1403 $result = array(); 1415 1404 $pending = array(); 1416 $key = $this->is_css ? array(get_absolute_root_url(false)): array(); //because for css we modify bg url 1405 $ini_key = $this->is_css ? array(get_absolute_root_url(false)): array(); //because for css we modify bg url; 1406 $key = $ini_key; 1417 1407 1418 1408 foreach ($this->combinables as $combinable) 1419 1409 { 1420 if ($conf['template_combine_files'] && !$combinable->is_remote()) 1421 { 1422 $key[] = $combinable->path; 1423 $key[] = $combinable->version; 1424 if ($conf['template_compile_check']) 1425 $key[] = filemtime( PHPWG_ROOT_PATH . $combinable->path ); 1426 $pending[] = $combinable; 1427 } 1428 else 1410 if ($combinable->is_remote()) 1429 1411 { 1430 1412 $this->flush_pending($result, $pending, $key, $force); 1431 $key = $this->is_css ? array(get_absolute_root_url(false)): array(); //because for css we modify bg url 1432 if ($combinable->is_remote()) 1433 $result[] = $combinable; 1434 else 1435 $pending = array($combinable); 1436 } 1413 $key = $ini_key; 1414 $result[] = $combinable; 1415 continue; 1416 } 1417 elseif (!$conf['template_combine_files']) 1418 { 1419 $this->flush_pending($result, $pending, $key, $force); 1420 $key = $ini_key; 1421 } 1422 1423 $key[] = $combinable->path; 1424 $key[] = $combinable->version; 1425 if ($conf['template_compile_check']) 1426 $key[] = filemtime( PHPWG_ROOT_PATH . $combinable->path ); 1427 $pending[] = $combinable; 1437 1428 } 1438 1429 $this->flush_pending($result, $pending, $key, $force);
Note: See TracChangeset
for help on using the changeset viewer.