本文整理汇总了PHP中Vtiger_Functions::getCompressInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::getCompressInfo方法的具体用法?PHP Vtiger_Functions::getCompressInfo怎么用?PHP Vtiger_Functions::getCompressInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::getCompressInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAndConvertJsScripts
function checkAndConvertJsScripts($jsFileNames)
{
$fileExtension = 'js';
$min = Vtiger_Functions::getCompressInfo('js');
$jsScriptInstances = array();
foreach ($jsFileNames as $jsFileName) {
// TODO Handle absolute inclusions (~/...) like in checkAndConvertCssStyles
$jsScript = new Vtiger_JsScript_Model();
// external javascript source file handling
if (strpos($jsFileName, 'http://') === 0 || strpos($jsFileName, 'https://') === 0) {
$jsScriptInstances[$jsFileName] = $jsScript->set('src', $jsFileName);
continue;
}
$completeFilePath = Vtiger_Loader::resolveNameToPath($jsFileName, $fileExtension);
if (file_exists($completeFilePath)) {
if (strpos($jsFileName, '~') === 0) {
$filePath = ltrim(ltrim($jsFileName, '~'), '/');
// if ~~ (reference is outside vtiger6 folder)
if (substr_count($jsFileName, "~") == 2) {
$filePath = "../" . $filePath;
}
} else {
$filePath = str_replace('.', '/', $jsFileName) . '.' . $fileExtension;
}
$jsScriptInstances[$jsFileName] = $jsScript->set('src', $filePath);
} else {
$fallBackFilePath = Vtiger_Loader::resolveNameToPath(Vtiger_JavaScript::getBaseJavaScriptPath() . '/' . $jsFileName . $min, 'js');
if (file_exists($fallBackFilePath)) {
$filePath = str_replace('.', '/', $jsFileName) . $min . '.js';
$jsScriptInstances[$jsFileName] = $jsScript->set('src', Vtiger_JavaScript::getFilePath($filePath));
}
$fallBackFilePath = Vtiger_Loader::resolveNameToPath(Vtiger_JavaScript::getBaseJavaScriptPath() . '/' . $jsFileName, 'js');
if (file_exists($fallBackFilePath)) {
$filePath = str_replace('.', '/', $jsFileName) . '.js';
$jsScriptInstances[$jsFileName] = $jsScript->set('src', Vtiger_JavaScript::getFilePath($filePath));
}
}
}
return $jsScriptInstances;
}