function minify($arr, $url_min, $option = '', $url_ext) { #+ #+ Lay du lieu $content = ''; #+ Neu la array thi be ra de lay du lieu if (is_array($arr)) { foreach ($arr as $key => $value) { $content .= file_get_contents($value); } #+ Neu khong phai thi la string truyen vao } else { $content = $arr; } #+ #+ Lay ket qua $result = getMinified($url_ext, $content, $option); #+ #+ Ghi lai file if ($result != '') { $result = '/* Last update: ' . date('d/m/Y H:i:s') . ' */' . chr(13) . $result; write_content_utf8($url_min, $result); # echo $result; } }
function minify($arr, $url) { foreach ($arr as $key => $value) { $handler = fopen($value, 'w') or die("File <a href='" . $value . "'>" . $value . "</a> error!<br />"); fwrite($handler, getMinified($url, file_get_contents($key))); fclose($handler); echo "File <a href='" . $value . "'>" . $value . "</a> done!<br />"; } }
function minify($arr, $url, $path) { $treatment = ''; foreach ($arr as $key => $value) { $uploaded_file = $path . $key; $handler = fopen($value, 'w') or die("File <a href='" . $value . "'>" . $value . "</a> error!<br />"); fwrite($handler, getMinified($url, file_get_contents($uploaded_file))); fclose($handler); unlink($uploaded_file); // delete uploaded files $treatment .= "File <a href='" . $value . "'>" . $value . "</a> done!<br />"; } return $treatment; }