本文整理汇总了PHP中Less_Parser::SetOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Less_Parser::SetOption方法的具体用法?PHP Less_Parser::SetOption怎么用?PHP Less_Parser::SetOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Less_Parser
的用法示例。
在下文中一共展示了Less_Parser::SetOption方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLessCompiler
/**
* Returns LESS compiler set up for use with MediaWiki
*
* @since 1.22
* @since 1.26 added $extraVars parameter
* @param Config $config
* @param array $extraVars Associative array of extra (i.e., other than the
* globally-configured ones) that should be used for compilation.
* @throws MWException
* @return Less_Parser
*/
public static function getLessCompiler(Config $config, $extraVars = array())
{
// When called from the installer, it is possible that a required PHP extension
// is missing (at least for now; see bug 47564). If this is the case, throw an
// exception (caught by the installer) to prevent a fatal error later on.
if (!class_exists('Less_Parser')) {
throw new MWException('MediaWiki requires the less.php parser');
}
$parser = new Less_Parser();
$parser->ModifyVars(array_merge(self::getLessVars($config), $extraVars));
$parser->SetImportDirs(array_fill_keys($config->get('ResourceLoaderLESSImportPaths'), ''));
$parser->SetOption('relativeUrls', false);
$parser->SetCacheDir($config->get('CacheDirectory') ?: wfTempDir());
return $parser;
}