Esempio n. 1
0
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;
    }
}
Esempio n. 2
0
	$arraySourceFilePath[] = $pathFile.$v;
}

//
// Kiem tra xem file trong list file co bi sua doi hay khong
$check_edit = check_file_edit($file_check_edit, $file_check_type, $arraySourceFilePath);
// $check_edit = 1;

//
// Neu nhu trong list file co file nao bi sua thi thuc hien
if($check_edit != 0 || !is_file($url_min) || filesize($url_min) < 10 || time() - filemtime($url_min) > 900){

	//
	// Minifier Default
	$dataAll = minifyCssDefault($arraySourceFilePath);
	write_content_utf8($url_min, $dataAll);

	//
	// Minifier with service
	//*/
	$arrOption = array(
		'keep_line_breaks' => '', // Keep line breaks
		'remove_comment' => '1', // Remove all special comments, i.e. /*! comment /
		'remove_comment_except_first_comment' => '' // Remove all special comments but the first one
		);

	minifyCSS($arraySourceFilePath, $url_min, $arrOption);
	//*/

}