本文整理汇总了PHP中ResourceLoader::rawClassList方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceLoader::rawClassList方法的具体用法?PHP ResourceLoader::rawClassList怎么用?PHP ResourceLoader::rawClassList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceLoader
的用法示例。
在下文中一共展示了ResourceLoader::rawClassList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcRequestVars
/**
* Post process request uses globals and mediaWiki configuration to
* validate classes and generate request key
*/
function postProcRequestVars()
{
global $wgContLanguageCode, $wgResourceLoaderNamedPaths, $wgStyleVersion;
// Set debug flag
if (isset($_GET['debug']) && $_GET['debug'] == 'true' || isset($wgEnableScriptDebug) && $wgEnableScriptDebug == true) {
$this->debug = true;
}
// Set the urid. Be sure to escape it as it goes into our JS output.
if (isset($_GET['urid']) && $_GET['urid'] != '') {
$this->urid = htmlspecialchars($_GET['urid']);
} else {
// Just give it the current style sheet ID:
// NOTE: read the svn version number
$this->urid = $wgStyleVersion;
}
// Get the language code (if not provided use the "default" language
if (isset($_GET['uselang']) && $_GET['uselang'] != '') {
// Strip any non alphaNumeric or dash characters from the language code:
$this->langCode = preg_replace("/[^A-Za-z\\-_]/", '', $_GET['uselang']);
} else {
//set English as default
$this->langCode = 'en';
}
$this->langCode = self::checkForCommonsLanguageFormHack($this->langCode);
$reqClassList = false;
if (isset($_GET['class']) && $_GET['class'] != '') {
$reqClassList = explode(',', $_GET['class']);
self::$rawClassList = $_GET['class'];
}
// Check for the requested classes
if ($reqClassList) {
// sanitize the Resource list and populate namedFileList
foreach ($reqClassList as $reqClass) {
if (trim($reqClass) != '') {
if (substr($reqClass, 0, 3) == 'WT:') {
$doAddWT = false;
// Check for special case '-' resource for user-generated JS
if (substr($reqClass, 3, 1) == '-') {
$doAddWT = true;
} else {
if (strtolower(substr($reqClass, -3)) == '.js') {
//make sure its a valid wikipage before doing processing
$t = Title::newFromDBkey(substr($reqClass, 3));
if ($t->exists() && ($t->getNamespace() == NS_MEDIAWIKI || $t->getNamespace() == NS_USER)) {
$doAddWT = true;
}
}
}
if ($doAddWT) {
$this->namedFileList[$reqClass] = true;
$this->requestKey .= $reqClass;
$this->jsvarurl = true;
}
continue;
}
$reqClass = preg_replace("/[^A-Za-z0-9_\\-\\.]/", '', $reqClass);
$filePath = self::getPathFromClass($reqClass);
if (!$filePath) {
$this->errorMsg .= 'Requested class: ' . xml::escapeJsString($reqClass) . ' not found' . "\n";
} else {
$this->namedFileList[$reqClass] = $filePath;
$this->requestKey .= $reqClass;
}
}
}
}
// Add the language code to the requestKey:
$this->requestKey .= '_' . $wgContLanguageCode;
// Add the unique rid
$this->requestKey .= $this->urid;
}