当前位置: 首页>>代码示例>>PHP>>正文


PHP ResourceLoader::rawClassList方法代码示例

本文整理汇总了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;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:75,代码来源:ResourceLoader.php


注:本文中的ResourceLoader::rawClassList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。