當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CMain::IsExternalLink方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:ASDAFF,項目名稱:1C_Bitrix_info_site,代碼行數:83,代碼來源:asset.php


注:本文中的CMain::IsExternalLink方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。