From 327a7c19a8837cd4e0c72d5e4bac604ca528771e Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Fri, 24 Oct 2008 10:10:46 +0000 Subject: [PATCH] --- classesjs/compactajs.php | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+), 0 deletions(-) create mode 100644 classesjs/compactajs.php diff --git a/classesjs/compactajs.php b/classesjs/compactajs.php new file mode 100644 index 0000000..70b843d --- /dev/null +++ b/classesjs/compactajs.php @@ -0,0 +1,226 @@ +pack(); + $t2 = microtime(true); + $time = sprintf('%.4f', ($t2 - $t1) ); + echo 'script ', $src, ' packed in ' , $out, ', in ', $time, ' s.', "\n"; + file_put_contents($out, $packed); + chmod($out,0777); +} +function salvatudojs($jsfiles,$buffer,$final,$tipo) +{ + //junta todos os js em um unico + foreach ($jsfiles as $f) + { + echo $f; + $abre = fopen($f, "r"); + while (!feof($abre)) + {$buffer .= fgets($abre);} + fclose($abre); + $buffer .= "\n"; + } + $abre = fopen($final, "wt"); + $escreve = fwrite ($abre,$buffer); + $fecha = fclose ($abre); + chmod($final,0777); + //gzip + $abre = fopen($final, "r"); + if ($tipo == "js") + $buffer = ""; + else + $buffer = ""; + + while (!feof($abre)) + {$buffer .= fgets($abre);} + fclose($abre); + $buffer .= "\n"; + $buffer .= ""; + $abre = fopen($final.".php", "wt"); + $escreve = fwrite ($abre,$buffer); + $fecha = fclose ($abre); + chmod($final.".php",0777); +} +?> \ No newline at end of file -- libgit2 0.21.2