本文整理汇总了PHP中OutputPage::transformResourcePath方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::transformResourcePath方法的具体用法?PHP OutputPage::transformResourcePath怎么用?PHP OutputPage::transformResourcePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::transformResourcePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStyles
/**
* @param ResourceLoaderContext $context
* @return array
*/
public function getStyles(ResourceLoaderContext $context)
{
$conf = $this->getConfig();
$logo = $conf->get('Logo');
$logoHD = $conf->get('LogoHD');
$logo1 = OutputPage::transformResourcePath($conf, $logo);
$logo15 = OutputPage::transformResourcePath($conf, $logoHD['1.5x']);
$logo2 = OutputPage::transformResourcePath($conf, $logoHD['2x']);
$styles = parent::getStyles($context);
$styles['all'][] = '.mw-wiki-logo { background-image: ' . CSSMin::buildUrlValue($logo1) . '; }';
if ($logoHD) {
if (isset($logoHD['1.5x'])) {
$styles['(-webkit-min-device-pixel-ratio: 1.5), ' . '(min--moz-device-pixel-ratio: 1.5), ' . '(min-resolution: 1.5dppx), ' . '(min-resolution: 144dpi)'][] = '.mw-wiki-logo { background-image: ' . CSSMin::buildUrlValue($logo15) . ';' . 'background-size: 135px auto; }';
}
if (isset($logoHD['2x'])) {
$styles['(-webkit-min-device-pixel-ratio: 2), ' . '(min--moz-device-pixel-ratio: 2),' . '(min-resolution: 2dppx), ' . '(min-resolution: 192dpi)'][] = '.mw-wiki-logo { background-image: ' . CSSMin::buildUrlValue($logo2) . ';' . 'background-size: 135px auto; }';
}
}
return $styles;
}
示例2: getStyleURLsForDebug
/**
* @param ResourceLoaderContext $context
* @return array
*/
public function getStyleURLsForDebug(ResourceLoaderContext $context)
{
if ($this->hasGeneratedStyles) {
// Do the default behaviour of returning a url back to load.php
// but with only=styles.
return parent::getStyleURLsForDebug($context);
}
// Our module consists entirely of real css files,
// in debug mode we can load those directly.
$urls = [];
foreach ($this->getStyleFiles($context) as $mediaType => $list) {
$urls[$mediaType] = [];
foreach ($list as $file) {
$urls[$mediaType][] = OutputPage::transformResourcePath($this->getConfig(), $this->getRemotePath($file));
}
}
return $urls;
}