本文整理匯總了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;
}