. */ /** * @brief class of install tools * * @file * @author Arnaud Veber * @date $date$ * @version $Revision$ * @ingroup install */ class Merge { function __construct() { //merge the css $this->mergeCss(); //merge the js $this->mergeJs(); } private function mergeCss() { if ($this->needToMergeCss()) { $dirStyle = 'install/css/'; $styleDirectory = opendir($dirStyle); $mergedCss = '@charset "UTF-8";'."\n\n"; //atProperty first $cssLines = file(realpath($dirStyle.'atProperty.css')); $mergedCss .= '/* atProperty.css */'."\n"; for ($i=0; $ineedToMergeJs()) { $dirJavascript = 'install/js/'; $javascriptDirectory = opendir($dirJavascript); $mergedJavascript = '// JavaScript Document'."\n\n"; //jquery first $javascriptLines = file(realpath($dirJavascript.'0_jQuery.js')); $mergedJavascript .= '/* 0_jQuery.js */'."\n"; for ($i=0; $i $dateModMerged) { $write = true; } } } closedir($styleDirectory); return $write; } private function needToMergeJs() { $write = false; $dirJavascript = 'install/js/'; $dateModMerged = '1'; if (file_exists($dirJavascript.'merged_js.js')) { $dateModMerged = filemtime($dirJavascript.'merged_js.js'); } $javascriptDirectory = opendir($dirJavascript); while($javascriptFile = @readdir($javascriptDirectory)) { if ( substr($javascriptFile, 0, 1) != '.' && substr($javascriptFile, -3) == '.js' && $javascriptFile != 'merged_js.js' && $javascriptFile != 'jQuery_dev.js' ) { $dateMod = filemtime(realpath($dirJavascript.$javascriptFile)); if ($dateMod > $dateModMerged) { $write = true; } } } closedir($javascriptDirectory); return $write; } }