本文整理汇总了PHP中ResourceLoader::makeCombinedStyles方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceLoader::makeCombinedStyles方法的具体用法?PHP ResourceLoader::makeCombinedStyles怎么用?PHP ResourceLoader::makeCombinedStyles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceLoader
的用法示例。
在下文中一共展示了ResourceLoader::makeCombinedStyles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCSS
/**
* Get the stylesheet of the MediaWiki skin.
*
* @return string
*/
public function getCSS()
{
global $wgStyleDirectory;
$moduleNames = array('mediawiki.legacy.shared', 'mediawiki.skinning.interface');
if (file_exists("{$wgStyleDirectory}/Vector/Vector.php")) {
// Force loading Vector skin if available as a fallback skin
// for whatever ResourceLoader wants to have as the default.
// Include instead of require, as this will work without it, it will just look bad.
// We need the 'global' statement for $wgResourceModules because the Vector skin adds the
// definitions for its RL modules there that we use implicitly below.
// @codingStandardsIgnoreStart
global $wgResourceModules;
// This is NOT UNUSED!
// @codingStandardsIgnoreEnd
include_once "{$wgStyleDirectory}/Vector/Vector.php";
$moduleNames[] = 'skins.vector.styles';
}
$moduleNames[] = 'mediawiki.legacy.config';
$resourceLoader = new ResourceLoader();
$rlContext = new ResourceLoaderContext($resourceLoader, new FauxRequest(array('debug' => 'true', 'lang' => $this->getLanguageCode(), 'only' => 'styles')));
$styles = array();
foreach ($moduleNames as $moduleName) {
/** @var ResourceLoaderFileModule $module */
$module = $resourceLoader->getModule($moduleName);
// Based on: ResourceLoaderFileModule::getStyles (without the DB query)
$styles = array_merge($styles, ResourceLoader::makeCombinedStyles($module->readStyleFiles($module->getStyleFiles($rlContext), $module->getFlip($rlContext))));
}
return implode("\n", $styles);
}
示例2: getCSS
/**
* Get the stylesheet of the MediaWiki skin.
*
* @return string
*/
public function getCSS()
{
global $wgStyleDirectory;
$moduleNames = array('mediawiki.legacy.shared', 'mediawiki.skinning.interface');
$resourceLoader = new ResourceLoader();
if (file_exists("{$wgStyleDirectory}/Vector/skin.json")) {
// Force loading Vector skin if available as a fallback skin
// for whatever ResourceLoader wants to have as the default.
$registry = new ExtensionRegistry();
$data = $registry->readFromQueue(array("{$wgStyleDirectory}/Vector/skin.json" => 1));
if (isset($data['globals']['wgResourceModules'])) {
$resourceLoader->register($data['globals']['wgResourceModules']);
}
$moduleNames[] = 'skins.vector.styles';
}
$moduleNames[] = 'mediawiki.legacy.config';
$rlContext = new ResourceLoaderContext($resourceLoader, new FauxRequest(array('debug' => 'true', 'lang' => $this->getLanguageCode(), 'only' => 'styles')));
$styles = array();
foreach ($moduleNames as $moduleName) {
/** @var ResourceLoaderFileModule $module */
$module = $resourceLoader->getModule($moduleName);
if (!$module) {
// T98043: Don't fatal, but it won't look as pretty.
continue;
}
// Based on: ResourceLoaderFileModule::getStyles (without the DB query)
$styles = array_merge($styles, ResourceLoader::makeCombinedStyles($module->readStyleFiles($module->getStyleFiles($rlContext), $module->getFlip($rlContext))));
}
return implode("\n", $styles);
}