Ignore:
Timestamp:
01/27/08 23:13:50 (12 years ago)
Author:
ray
Message:
  • one more attempt to properly fix #1136
  • added compression script for yui_compressor (though not going to use it)
  • removed some evitable uses of eval()
  • removed alerts for very old Geckos, because the seem to fire with recent versions of Safari
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/contrib/compress.php

    r905 r951  
    11<? 
    22die("Run this script to batch-compress the current Xinha snapshot. To run the script, open the file and comment out the die() command"); 
    3  
     3$repository_url = 'http://svn.xinha.webfactional.com/trunk'; 
     4$version =''; 
     5$date = date('r'); 
    46error_reporting(E_ALL); 
    57ini_set('show_errors',1); 
    68 
    79$return = array(); 
    8 function scan($dir, $durl = '',$min_size="3000") 
     10function scan($dir, $durl = '',$min_size="0") 
    911{ 
    1012        static $seen = array(); 
     
    4850scan("../"); 
    4951$cwd = getcwd(); 
     52 
     53$root_dir = realpath($cwd.'/..'); 
     54 
    5055print "Processing ".count($return)." files<br />"; 
    5156 
    52 $prefix = "/* This compressed file is part of Xinha. For uncomressed sources, forum, and bug reports, go to xinha.org */"; 
     57$prefix = "/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */"; 
     58if ($version) $prefix .= "\n/* This file is part of version $version released $date */"; 
     59 
    5360$core_prefix = ' 
    5461  /*-------------------------------------------------------------------------- 
     
    5865    --  BSD license)  please read license.txt in this package for details. 
    5966    -- 
    60     --  Copyright (c) 2005-2007 Xinha Developer Team and contributors 
     67    --  Copyright (c) 2005-2008 Xinha Developer Team and contributors 
    6168    --   
    6269    --  Xinha was originally based on work by Mihai Bazon which is: 
     
    7178        print "Processed $file<br />"; 
    7279        flush(); 
     80        $file_url = $repository_url.str_replace($root_dir,'',$file); 
     81 
    7382        copy($file,$file."_uncompr.js"); 
    74  
    75         exec("echo \"".(preg_match('/XinhaCore.js$/',$file) ? $prefix.$core_prefix : $prefix)."\" > $file && java -jar ${cwd}/dojo_js_compressor.jar -c ${file}_uncompr.js >> $file 2>&1"); 
     83         
     84        $file_prefix = $prefix."\n/* The URL of the most recent version of this file is $file_url */"; 
     85         
     86        exec("echo \"".(preg_match('/XinhaCore.js$/',$file) ? $file_prefix.$core_prefix : $file_prefix)."\" > $file && java -jar ${cwd}/dojo_js_compressor.jar -c ${file}_uncompr.js >> $file 2>&1"); 
    7687        if (preg_match('/js: ".*?", line \d+:/',file_get_contents($file))) 
    7788        { 
     
    8394                unlink($file."_uncompr.js"); 
    8495        } 
     96 
    8597} 
    8698print "Operation complete." 
Note: See TracChangeset for help on using the changeset viewer.