Changeset 8305 for trunk


Ignore:
Timestamp:
Dec 26, 2010, 7:20:52 AM (13 years ago)
Author:
rvelices
Message:

combine_script with remote url as path works now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r8299 r8305  
    411411      ksort($this->css_by_priority);
    412412
    413                         global $conf;
    414                         $css = array();
    415                         if ($conf['template_combine_files'])
    416                         {
    417                                 $combiner = new FileCombiner('css');
    418                                 foreach ($this->css_by_priority as $files)
    419                                 {
    420                                         foreach ($files as $file_ver)
    421                                                 $combiner->add( $file_ver[0], $file_ver[1] );
    422                                 }
    423                                 if ( $combiner->combine( $out_file, $out_version) )
    424                                         $css[] = array($out_file, $out_version);
    425                         }
    426                         else
    427                         {
    428                                 foreach ($this->css_by_priority as $files)
    429                                         $css = array_merge($css, $files);
    430                         }
    431                        
    432                         $content = array();
     413      global $conf;
     414      $css = array();
     415      if ($conf['template_combine_files'])
     416      {
     417        $combiner = new FileCombiner('css');
     418        foreach ($this->css_by_priority as $files)
     419        {
     420          foreach ($files as $file_ver)
     421            $combiner->add( $file_ver[0], $file_ver[1] );
     422        }
     423        if ( $combiner->combine( $out_file, $out_version) )
     424          $css[] = array($out_file, $out_version);
     425      }
     426      else
     427      {
     428        foreach ($this->css_by_priority as $files)
     429          $css = array_merge($css, $files);
     430      }
     431     
     432      $content = array();
    433433      foreach( $css as $file_ver )
    434434      {
     
    438438        // trigger the event for eventual use of a cdn
    439439        $href = trigger_event('combined_css', $href, $file_ver[0], $file_ver[1]);
    440                                 $content[] = '<link rel="stylesheet" type="text/css" href="'.$href.'">';
     440        $content[] = '<link rel="stylesheet" type="text/css" href="'.$href.'">';
    441441      }
    442442      $this->output = str_replace(self::COMBINED_CSS_TAG,
     
    970970  function get_footer_scripts()
    971971  {
    972     /*if (!$this->did_head)
    973     {
    974       trigger_error("Attempt to write footer scripts without header scripts", E_USER_ERROR );
    975     }*/
    976972    $todo = array();
    977973    foreach( $this->registered_scripts as $id => $script)
     
    1003999      return $scripts;
    10041000    $combiner = new FileCombiner('js');
     1001    $result = array();
    10051002    foreach ($scripts as $script)
    10061003    {
    1007       if ($script->is_remote()) fatal_error("NOT IMPLEMENTED");// TODO - we cannot combine remote scripts
    1008       $combiner->add( $script->path, $script->version );
     1004      if ($script->is_remote())
     1005      {
     1006        if ( $combiner->combine( $out_file, $out_version) )
     1007        {
     1008          $results[] = new Script($load_mode, 'combi', $out_file, $out_version, array() );
     1009        }
     1010        $results[] = $script;
     1011      }
     1012      else
     1013        $combiner->add( $script->path, $script->version );
    10091014    }
    10101015    if ( $combiner->combine( $out_file, $out_version) )
    10111016    {
    1012       return array( 'combi' => new Script($load_mode, 'combi', $out_file, $out_version, array() ) );
    1013     }
    1014     return null;
     1017      $results[] = new Script($load_mode, 'combi', $out_file, $out_version, array() );
     1018    }
     1019    return $results;
    10151020  }
    10161021 
Note: See TracChangeset for help on using the changeset viewer.