[line 43]
Merge, compact, scramble and cache Javascript and CSS files
This compact class and scrambles JavaScript files through Dean Edwards's algorithm implemented in a class PHP by Nicolas Martin. Also, it compacts and optimize files CSS through the class CSSTidy. Finally, it compacts everything through gzip. And to save bandwidth, it creates files cache.
absolute script path to cache directory. $_SERVER["DOCUMENT_ROOT"] ."/cache" is default value. This directory should have writing permission (chmod -c 775)
Compact javascript and css files and save in cache directory
It ensures the client's browser accepts compressed files. If yes, return the file to accept compaction. If not, return the file without compress. Save the file in the cache for later use.
Merge, compact and scramble javascript and css files
This function first checks whether the file needs new version or the version stored in cache can be used. If a new file should be created, the function checks the variable $type to determine if a file is javascript or css. The function also check the $production and $scripts["pack"], to determine whether the file should be compressed. All css or javascripts files are merged into a single file and submitted to function gzipIt, which compact and return the content according to the client browser´s capabilities.