aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2010-12-26 06:20:52 +0000
committerrvelices <rv-github@modusoptimus.com>2010-12-26 06:20:52 +0000
commit61d07ecd8e6ca35b0c852540df97589ba8c27530 (patch)
tree18307769f5e006d5eeb068becf8814755ee970dd /include
parent07866088243c7aec025c51d605a2c1adfe93f407 (diff)
combine_script with remote url as path works now
git-svn-id: http://piwigo.org/svn/trunk@8305 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/template.class.php63
1 files changed, 34 insertions, 29 deletions
diff --git a/include/template.class.php b/include/template.class.php
index 2e62d3d94..3e16c84bc 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -410,26 +410,26 @@ class Template {
{
ksort($this->css_by_priority);
- global $conf;
- $css = array();
- if ($conf['template_combine_files'])
- {
- $combiner = new FileCombiner('css');
- foreach ($this->css_by_priority as $files)
- {
- foreach ($files as $file_ver)
- $combiner->add( $file_ver[0], $file_ver[1] );
- }
- if ( $combiner->combine( $out_file, $out_version) )
- $css[] = array($out_file, $out_version);
- }
- else
- {
- foreach ($this->css_by_priority as $files)
- $css = array_merge($css, $files);
- }
-
- $content = array();
+ global $conf;
+ $css = array();
+ if ($conf['template_combine_files'])
+ {
+ $combiner = new FileCombiner('css');
+ foreach ($this->css_by_priority as $files)
+ {
+ foreach ($files as $file_ver)
+ $combiner->add( $file_ver[0], $file_ver[1] );
+ }
+ if ( $combiner->combine( $out_file, $out_version) )
+ $css[] = array($out_file, $out_version);
+ }
+ else
+ {
+ foreach ($this->css_by_priority as $files)
+ $css = array_merge($css, $files);
+ }
+
+ $content = array();
foreach( $css as $file_ver )
{
$href = get_root_url() . $file_ver[0];
@@ -437,7 +437,7 @@ class Template {
$href .= '?v' . ($file_ver[1] ? $file_ver[1] : PHPWG_VERSION);
// trigger the event for eventual use of a cdn
$href = trigger_event('combined_css', $href, $file_ver[0], $file_ver[1]);
- $content[] = '<link rel="stylesheet" type="text/css" href="'.$href.'">';
+ $content[] = '<link rel="stylesheet" type="text/css" href="'.$href.'">';
}
$this->output = str_replace(self::COMBINED_CSS_TAG,
implode( "\n", $content ),
@@ -969,10 +969,6 @@ class ScriptLoader
function get_footer_scripts()
{
- /*if (!$this->did_head)
- {
- trigger_error("Attempt to write footer scripts without header scripts", E_USER_ERROR );
- }*/
$todo = array();
foreach( $this->registered_scripts as $id => $script)
{
@@ -1002,16 +998,25 @@ class ScriptLoader
if (count($scripts)<2 or !$conf['template_combine_files'])
return $scripts;
$combiner = new FileCombiner('js');
+ $result = array();
foreach ($scripts as $script)
{
- if ($script->is_remote()) fatal_error("NOT IMPLEMENTED");// TODO - we cannot combine remote scripts
- $combiner->add( $script->path, $script->version );
+ if ($script->is_remote())
+ {
+ if ( $combiner->combine( $out_file, $out_version) )
+ {
+ $results[] = new Script($load_mode, 'combi', $out_file, $out_version, array() );
+ }
+ $results[] = $script;
+ }
+ else
+ $combiner->add( $script->path, $script->version );
}
if ( $combiner->combine( $out_file, $out_version) )
{
- return array( 'combi' => new Script($load_mode, 'combi', $out_file, $out_version, array() ) );
+ $results[] = new Script($load_mode, 'combi', $out_file, $out_version, array() );
}
- return null;
+ return $results;
}
// checks that if B depends on A, then B->load_mode >= A->load_mode in order to respect execution order