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


PHP AssetsManager::getURL方法代碼示例

本文整理匯總了PHP中AssetsManager::getURL方法的典型用法代碼示例。如果您正苦於以下問題:PHP AssetsManager::getURL方法的具體用法?PHP AssetsManager::getURL怎麽用?PHP AssetsManager::getURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AssetsManager的用法示例。


在下文中一共展示了AssetsManager::getURL方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setAssets

 private function setAssets($type = 'live')
 {
     global $wgOut;
     $jsHeadGroups = ['venus_head_js'];
     $jsHeadFiles = '';
     $jsBodyGroups = ['venus_body_js'];
     $jsBodyFiles = '';
     $cssGroups = ['venus_css'];
     $cssLinks = '';
     if ($type == 'preview') {
         $cssGroups[] = 'article_scss';
         $jsPreviewFiles = '';
         foreach ($this->assetsManager->getURL(['venus_preview_js']) as $src) {
             $jsPreviewFiles .= "<script src='{$src}'></script>";
         }
         $this->jsPreviewFiles = $jsPreviewFiles;
     } else {
         // let extensions manipulate the asset packages (e.g. ArticleComments,
         // this is done to cut down the number or requests)
         $this->app->runHook('VenusAssetsPackages', [&$jsHeadGroups, &$jsBodyGroups, &$cssGroups]);
     }
     // SASS files requested via VenusAssetsPackages hook
     $sassFiles = [];
     foreach ($this->assetsManager->getURL($cssGroups) as $src) {
         if ($this->assetsManager->checkAssetUrlForSkin($src, $this->skin)) {
             $sassFiles[] = $src;
         }
     }
     // try to fetch all SASS files using a single request (CON-1487)
     // "WikiaSkin::getStylesWithCombinedSASS: combined 9 SASS files"
     $cssLinks .= $this->skin->getStylesWithCombinedSASS($sassFiles);
     foreach ($this->assetsManager->getURL($jsHeadGroups) as $src) {
         if ($this->assetsManager->checkAssetUrlForSkin($src, $this->skin)) {
             $jsHeadFiles .= "<script src='{$src}'></script>";
         }
     }
     // try to fetch all AM groups in a single JS request (CON-1772)
     // "WikiaSkin::getScriptsWithCombinedGroups: combined 8 JS groups"
     $jsBodyFiles = $this->skin->getScriptsWithCombinedGroups($jsBodyGroups);
     // global variables from ResourceLoaderStartUpModule
     $res = new ResourceVariablesGetter();
     $vars = WikiaSkin::makeInlineVariablesScript($res->get());
     // is it used anywhere?
     // set variables
     $this->cssLinks = $cssLinks;
     $this->jsBodyFiles = $jsBodyFiles;
     $this->jsHeadScripts = $wgOut->getHeadScripts() . $jsHeadFiles;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:48,代碼來源:VenusController.class.php


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