本文整理汇总了PHP中CMain::IsExternalLink方法的典型用法代码示例。如果您正苦于以下问题:PHP CMain::IsExternalLink方法的具体用法?PHP CMain::IsExternalLink怎么用?PHP CMain::IsExternalLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMain
的用法示例。
在下文中一共展示了CMain::IsExternalLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareJs
/** Prepare js asset to optimize */
private function prepareJs()
{
$cnt = 0;
$arAdditional = array();
foreach ($this->js as $js => $set) {
/** @var $assetTID - get first target where added asset */
$assetTID = $set['ADDITIONAL'] ? 'TEMPLATE' : $set['TARGET'][0];
$jsInfo = array('PATH' => $js, 'FULL_PATH' => false, 'FILE_PATH' => false, 'SKIP' => false, 'TARGET' => $assetTID, 'EXTERNAL' => \CMain::IsExternalLink($js), 'BODY' => false, 'ADDITIONAL' => $set['ADDITIONAL']);
if ($jsInfo['EXTERNAL']) {
if ($set['ADDITIONAL']) {
$tmpKey = 'TEMPLATE';
$tmpPrefix = 'template';
} else {
$tmpKey = 'KERNEL';
$tmpPrefix = 'kernel';
}
$jsInfo['MODULE_ID'] = $cnt;
$jsInfo['TARGET'] = $tmpKey . '_' . $cnt;
$jsInfo['PREFIX'] = $tmpPrefix . '_' . $cnt;
$jsInfo['FULL_PATH'] = $jsInfo['PATH'];
$jsInfo['SKIP'] = true;
$cnt++;
$this->targetList[$tmpKey]['JS_LIST'][$jsInfo['TARGET']] = array('TARGET' => $jsInfo['TARGET'], 'PREFIX' => $jsInfo['PREFIX'], 'MODE' => $this->targetList[$assetTID]['MODE'], 'UNIQUE' => false);
} else {
$jsInfo['FILE_PATH'] = $this->documentRoot . $js;
if (file_exists($jsInfo['FILE_PATH']) && filesize($jsInfo['FILE_PATH']) > 0) {
$jsInfo['FULL_PATH'] = \CUtil::GetAdditionalFileURL($jsInfo['PATH'], true);
} else {
unset($this->js[$js]);
continue;
}
if (strncmp($jsInfo['PATH'], '/bitrix/js/', 11) != 0) {
$jsInfo['SKIP'] = !(strncmp($jsInfo['PATH'], '/bitrix/panel/', 14) != 0 && strncmp($jsInfo['PATH'], '/bitrix/themes/', 15) != 0 && strncmp($jsInfo['PATH'], '/bitrix/modules/', 16) != 0);
} else {
$jsInfo['TARGET'] = 'KERNEL';
if ($this->sliceKernel() && $this->optimizeJs()) {
$moduleInfo = $this->isKernelJS($jsInfo['PATH']);
} else {
$moduleInfo = false;
}
if ($moduleInfo) {
$jsInfo['MODULE_ID'] = $moduleInfo['MODULE_ID'];
$jsInfo['TARGET'] = 'KERNEL_' . $moduleInfo['MODULE_ID'];
$jsInfo['PREFIX'] = 'kernel_' . $moduleInfo['MODULE_ID'];
$jsInfo['BODY'] = $moduleInfo['BODY'];
} else {
$jsInfo['MODULE_ID'] = $cnt;
$jsInfo['TARGET'] = 'KERNEL_' . $cnt;
$jsInfo['PREFIX'] = 'kernel_' . $cnt;
$jsInfo['SKIP'] = true;
$cnt++;
}
if ($jsInfo['BODY']) {
$this->targetList['BODY']['JS_LIST'][$jsInfo['TARGET']] = array('TARGET' => $jsInfo['TARGET'], 'PREFIX' => $jsInfo['PREFIX'], 'MODE' => $this->targetList[$assetTID]['MODE'], 'UNIQUE' => true);
} else {
if (isset($this->targetList['KERNEL']['JS_LIST'][$jsInfo['TARGET']]['MODE'])) {
$this->targetList['KERNEL']['JS_LIST'][$jsInfo['TARGET']]['MODE'] |= $this->targetList[$assetTID]['MODE'];
} else {
$this->targetList['KERNEL']['JS_LIST'][$jsInfo['TARGET']] = array('TARGET' => $jsInfo['TARGET'], 'PREFIX' => $jsInfo['PREFIX'], 'MODE' => $set['ADDITIONAL'] ? $this->targetList[$set['TARGET'][0]]['MODE'] : $this->targetList[$assetTID]['MODE'], 'UNIQUE' => true);
}
}
// Add information about sets where used
foreach ($set['TARGET'] as $setID) {
$this->targetList['KERNEL']['JS_LIST'][$jsInfo['TARGET']]['WHERE_USED'][$setID] = true;
}
}
}
if ($jsInfo['ADDITIONAL']) {
$arAdditional[] = $jsInfo;
} else {
$this->js[$jsInfo['TARGET']][] = $jsInfo;
}
unset($this->js[$js]);
}
// Clean body scripts
foreach ($this->targetList['BODY']['JS_LIST'] as $item) {
unset($this->targetList['KERNEL']['JS_LIST'][$item['TARGET']]);
}
foreach ($arAdditional as $jsInfo) {
$this->js[$jsInfo['TARGET']][] = $jsInfo;
}
}