Changeset 8075 for trunk/include


Ignore:
Timestamp:
Dec 11, 2010, 2:24:09 PM (13 years ago)
Author:
rvelices
Message:

combine css small fixes

File:
1 edited

Legend:

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

    r8012 r8075  
    11441144    }
    11451145
     1146    $is_css = $this->type == "css";
    11461147    global $conf;
    11471148    $key = array();
    1148 
     1149    if ($is_css)
     1150      $key[] = get_absolute_root_url(false);//because we modify bg url
    11491151    for ($i=0; $i<count($this->files); $i++)
    11501152    {
     
    11571159    $file = base_convert(crc32($key),10,36);
    11581160    $file = self::OUT_SUB_DIR . $file . '.' . $this->type;
    1159     if (file_exists( PHPWG_ROOT_PATH . $file ) )
     1161   
     1162    $exists = file_exists( PHPWG_ROOT_PATH . $file );
     1163    if ($exists)
     1164    {
     1165      $is_reload =
     1166        (isset($_SERVER['HTTP_CACHE_CONTROL']) && strpos($_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0') !== false)
     1167        || (isset($_SERVER['HTTP_PRAGMA']) && strpos($_SERVER['HTTP_PRAGMA'], 'no-cache'));
     1168      if ($is_reload)
     1169      {// the user pressed F5 in the browser
     1170        if ($is_css || $conf['template_compile_check']==false)
     1171          $exists = false; // we foce regeneration of css because @import sub-files are never checked for modification
     1172      }
     1173    }
     1174
     1175    if ($exists)
    11601176    {
    11611177      $out_file = $file;
     
    11701186    {
    11711187      $output .= "/* BEGIN $input_file */\n";
    1172       if ($this->type == "css")
     1188      if ($is_css)
    11731189        $output .= self::process_css($input_file);
    11741190      else
    1175                                 $output .= self::process_js($input_file);
     1191        $output .= self::process_js($input_file);
    11761192      $output .= "\n";
    11771193    }
     
    11841200  }
    11851201
    1186         private static function process_js($file)
    1187         {
    1188                 $js = file_get_contents(PHPWG_ROOT_PATH . $file);
    1189                 if (strpos($file, '.min')===false and strpos($file, '.packed')===false )
    1190                 {
    1191                         //TODO minify javascript with some php lib from www...
    1192                 }
    1193                 return $js;
    1194         }
    1195        
     1202  private static function process_js($file)
     1203  {
     1204    $js = file_get_contents(PHPWG_ROOT_PATH . $file);
     1205    if (strpos($file, '.min')===false and strpos($file, '.packed')===false )
     1206    {
     1207      //TODO minify javascript with some php lib from www...
     1208    }
     1209    return $js;
     1210  }
     1211 
    11961212  private static function process_css($file)
    11971213  {
Note: See TracChangeset for help on using the changeset viewer.