本文整理汇总了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;
}