• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ResourceLoaderModule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ResourceLoaderModule的典型用法代码示例。如果您正苦于以下问题:PHP ResourceLoaderModule类的具体用法?PHP ResourceLoaderModule怎么用?PHP ResourceLoaderModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ResourceLoaderModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: preloadModuleInfo

 /**
  * Load information stored in the database about modules.
  *
  * This method grabs modules dependencies from the database and updates modules
  * objects.
  *
  * This is not inside the module code because it is much faster to
  * request all of the information at once than it is to have each module
  * requests its own information. This sacrifice of modularity yields a substantial
  * performance improvement.
  *
  * @param array $moduleNames List of module names to preload information for
  * @param ResourceLoaderContext $context Context to load the information within
  */
 public function preloadModuleInfo(array $moduleNames, ResourceLoaderContext $context)
 {
     if (!$moduleNames) {
         // Or else Database*::select() will explode, plus it's cheaper!
         return;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $skin = $context->getSkin();
     $lang = $context->getLanguage();
     // Batched version of ResourceLoaderModule::getFileDependencies
     $vary = "{$skin}|{$lang}";
     $res = $dbr->select('module_deps', array('md_module', 'md_deps'), array('md_module' => $moduleNames, 'md_skin' => $vary), __METHOD__);
     // Prime in-object cache for file dependencies
     $modulesWithDeps = array();
     foreach ($res as $row) {
         $module = $this->getModule($row->md_module);
         if ($module) {
             $module->setFileDependencies($context, ResourceLoaderModule::expandRelativePaths(FormatJson::decode($row->md_deps, true)));
             $modulesWithDeps[] = $row->md_module;
         }
     }
     // Register the absence of a dependency row too
     foreach (array_diff($moduleNames, $modulesWithDeps) as $name) {
         $module = $this->getModule($name);
         if ($module) {
             $this->getModule($name)->setFileDependencies($context, array());
         }
     }
     // Prime in-object cache for message blobs for modules with messages
     $modules = array();
     foreach ($moduleNames as $name) {
         $module = $this->getModule($name);
         if ($module && $module->getMessages()) {
             $modules[$name] = $module;
         }
     }
     $store = $this->getMessageBlobStore();
     $blobs = $store->getBlobs($modules, $lang);
     foreach ($blobs as $name => $blob) {
         $modules[$name]->setMessageBlob($blob, $lang);
     }
 }
开发者ID:bkmls,项目名称:mediawiki,代码行数:56,代码来源:ResourceLoader.php


示例2: getScriptURLsForDebug

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getScriptURLsForDebug(ResourceLoaderContext $context)
 {
     // Bypass file module urls
     return ResourceLoaderModule::getScriptURLsForDebug($context);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:9,代码来源:ResourceLoaderJqueryMsgModule.php


示例3: generateMessageBlob

 /**
  * Generate the message blob for a given module in a given language.
  *
  * @param ResourceLoaderModule $module
  * @param string $lang Language code
  * @return string JSON object
  */
 private function generateMessageBlob(ResourceLoaderModule $module, $lang)
 {
     $messages = array();
     foreach ($module->getMessages() as $key) {
         $messages[$key] = wfMessage($key)->inLanguage($lang)->plain();
     }
     return FormatJson::encode((object) $messages);
 }
开发者ID:junjiemars,项目名称:mediawiki,代码行数:15,代码来源:MessageBlobStore.php


示例4: generateMessageBlob

 /**
  * Generate the message blob for a given module in a given language.
  *
  * @param ResourceLoaderModule $module
  * @param string $lang Language code
  * @return string JSON blob
  */
 private function generateMessageBlob(ResourceLoaderModule $module, $lang)
 {
     $messages = [];
     foreach ($module->getMessages() as $key) {
         $messages[$key] = $this->fetchMessage($key, $lang);
     }
     $json = FormatJson::encode((object) $messages);
     if ($json === false) {
         $this->logger->warning('Failed to encode message blob for {module} ({lang})', ['module' => $module->getName(), 'lang' => $lang]);
         $json = '{}';
     }
     return $json;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:20,代码来源:MessageBlobStore.php


示例5: generateMessageBlob

 /**
  * Generate the message blob for a given module in a given language.
  *
  * @param ResourceLoaderModule $module
  * @param string $lang Language code
  * @return string JSON blob
  */
 private function generateMessageBlob(ResourceLoaderModule $module, $lang)
 {
     $messages = array();
     foreach ($module->getMessages() as $key) {
         $messages[$key] = $this->fetchMessage($key, $lang);
     }
     return FormatJson::encode((object) $messages);
 }
开发者ID:huatuoorg,项目名称:mediawiki,代码行数:15,代码来源:MessageBlobStore.php


示例6: generateMessageBlob

 /**
  * Generate the message blob for a given module in a given language.
  *
  * @param $module ResourceLoaderModule object
  * @param $lang String: language code
  * @return String: JSON object
  */
 private static function generateMessageBlob(ResourceLoaderModule $module, $lang)
 {
     $messages = array();
     foreach ($module->getMessages() as $key) {
         $messages[$key] = wfMsgExt($key, array('language' => $lang));
     }
     return FormatJson::encode((object) $messages);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:15,代码来源:MessageBlobStore.php


示例7: getModifiedTime

 public function getModifiedTime(ResourceLoaderContext $context)
 {
     return max($this->getGitHeadModifiedTime($context), $this->getMsgBlobMtime($context->getLanguage()), ResourceLoaderModule::safeFilemtime(__FILE__));
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:4,代码来源:VisualEditorDataModule.php


示例8: preloadModuleInfo

 /**
  * Load information stored in the database about modules.
  *
  * This method grabs modules dependencies from the database and updates modules
  * objects.
  *
  * This is not inside the module code because it is much faster to
  * request all of the information at once than it is to have each module
  * requests its own information. This sacrifice of modularity yields a substantial
  * performance improvement.
  *
  * @param array $modules List of module names to preload information for
  * @param ResourceLoaderContext $context Context to load the information within
  */
 public function preloadModuleInfo(array $modules, ResourceLoaderContext $context)
 {
     if (!count($modules)) {
         // Or else Database*::select() will explode, plus it's cheaper!
         return;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $skin = $context->getSkin();
     $lang = $context->getLanguage();
     // Batched version of ResourceLoaderModule::getFileDependencies
     $vary = "{$skin}|{$lang}";
     $res = $dbr->select('module_deps', array('md_module', 'md_deps'), array('md_module' => $modules, 'md_skin' => $vary), __METHOD__);
     // Prime in-object cache values for each module
     $modulesWithDeps = array();
     foreach ($res as $row) {
         $module = $this->getModule($row->md_module);
         if ($module) {
             $module->setFileDependencies($context, ResourceLoaderModule::expandRelativePaths(FormatJson::decode($row->md_deps, true)));
             $modulesWithDeps[] = $row->md_module;
         }
     }
     // Register the absence of a dependency row too
     foreach (array_diff($modules, $modulesWithDeps) as $name) {
         $module = $this->getModule($name);
         if ($module) {
             $this->getModule($name)->setFileDependencies($context, array());
         }
     }
     // Get message blob mtimes. Only do this for modules with messages
     $modulesWithMessages = array();
     foreach ($modules as $name) {
         $module = $this->getModule($name);
         if ($module && count($module->getMessages())) {
             $modulesWithMessages[] = $name;
         }
     }
     $modulesWithoutMessages = array_flip($modules);
     // Will be trimmed down by the loop below
     if (count($modulesWithMessages)) {
         $res = $dbr->select('msg_resource', array('mr_resource', 'mr_timestamp'), array('mr_resource' => $modulesWithMessages, 'mr_lang' => $lang), __METHOD__);
         foreach ($res as $row) {
             $module = $this->getModule($row->mr_resource);
             if ($module) {
                 $module->setMsgBlobMtime($lang, wfTimestamp(TS_UNIX, $row->mr_timestamp));
                 unset($modulesWithoutMessages[$row->mr_resource]);
             }
         }
     }
     foreach (array_keys($modulesWithoutMessages) as $name) {
         $module = $this->getModule($name);
         if ($module) {
             $module->setMsgBlobMtime($lang, 1);
         }
     }
 }
开发者ID:agothro,项目名称:mediawiki,代码行数:69,代码来源:ResourceLoader.php


示例9: getScriptURLsForDebug

 /**
  * Don't break debug mode by only showing file URLs
  */
 public function getScriptURLsForDebug(ResourceLoaderContext $context)
 {
     return ResourceLoaderModule::getScriptURLsForDebug($context);
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:7,代码来源:ResourceLoaderGeSHiVisualEditorModule.php


示例10: getDefinitionSummary

 /**
  * Get the definition summary for this module.
  *
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     global $IP;
     $summary = parent::getDefinitionSummary($context);
     $summary[] = ['vars' => $this->getConfigSettings($context), 'wgLegacyJavaScriptGlobals' => $this->getConfig()->get('LegacyJavaScriptGlobals'), 'moduleHashes' => $this->getAllModuleHashes($context), 'fileMtimes' => [filemtime("{$IP}/resources/src/startup.js")]];
     return $summary;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:13,代码来源:ResourceLoaderStartUpModule.php


示例11: getDefinitionSummary

 /**
  * Get the definition summary for this module.
  *
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $summary = parent::getDefinitionSummary($context);
     $options = array();
     foreach (array('scripts', 'debugScripts', 'loaderScripts', 'styles', 'languageScripts', 'skinScripts', 'skinStyles', 'messages', 'templates', 'skipFunction', 'debugRaw', 'raw') as $member) {
         $options[$member] = $this->{$member};
     }
     $summary[] = array('options' => $options, 'fileHashes' => $this->getFileHashes($context), 'msgBlobMtime' => $this->getMsgBlobMtime($context->getLanguage()));
     return $summary;
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:16,代码来源:ResourceLoaderFileModule.php


示例12: javaScriptParser

 /**
  * @return JSParser
  */
 protected static function javaScriptParser()
 {
     if (!self::$jsParser) {
         self::$jsParser = new JSParser();
     }
     return self::$jsParser;
 }
开发者ID:tempbottle,项目名称:Work,代码行数:10,代码来源:ResourceLoaderModule.php


示例13: isPositionDefault

 public function isPositionDefault()
 {
     $this->loadFromDefinition();
     return parent::isPositionDefault();
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:5,代码来源:ResourceLoaderImageModule.php


示例14: getDefinitionSummary

 /**
  * Get the definition summary for this module.
  *
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $this->loadFromDefinition();
     $summary = parent::getDefinitionSummary($context);
     $options = [];
     foreach (['localBasePath', 'images', 'variants', 'prefix', 'selectorWithoutVariant', 'selectorWithVariant'] as $member) {
         $options[$member] = $this->{$member};
     }
     $summary[] = ['options' => $options, 'fileHashes' => $this->getFileHashes($context)];
     return $summary;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:17,代码来源:ResourceLoaderImageModule.php


示例15: getDefinitionSummary

 /**
  * @param $context ResourceLoaderContext
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $r = parent::getDefinitionSummary($context);
     return $r + array('class' => get_class($this), 'lang' => $this->lang, 'geshi' => GESHI_VERSION);
 }
开发者ID:mediawiki4intranet,项目名称:SyntaxHighlight_GeSHi,代码行数:9,代码来源:ResourceLoaderGeSHiModule.php


示例16: getDefinitionSummary

 /**
  * Get the definition summary for this module.
  *
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $summary = parent::getDefinitionSummary($context);
     foreach (array('scripts', 'debugScripts', 'loaderScripts', 'styles', 'languageScripts', 'skinScripts', 'skinStyles', 'dependencies', 'messages', 'targets', 'templates', 'group', 'position', 'skipFunction', 'localBasePath', 'remoteBasePath', 'debugRaw', 'raw') as $member) {
         $summary[$member] = $this->{$member};
     }
     return $summary;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:14,代码来源:ResourceLoaderFileModule.php


示例17: reallyGetFlag

 /**
  * Get flag value
  *
  * @param $name string Parameter name
  */
 protected function reallyGetFlag($name)
 {
     if ($name == 'sass') {
         $styles = array();
         if (!empty($this->styles)) {
             $styles = array_merge($styles, (array) $this->styles);
         }
         if (!empty($this->skinStyles)) {
             foreach ($this->skinStyles as $skin => $skinStyles) {
                 if (!empty($skinStyles)) {
                     $styles = array_merge($styles, (array) $skinStyles);
                 }
             }
         }
         $requireSass = false;
         foreach ($styles as $k => $style) {
             if (is_array($style)) {
                 $style = $k;
             }
             if (self::getFileType($style) == self::FILE_TYPE_SASS) {
                 $requireSass = true;
             }
         }
         return $requireSass;
     }
     return parent::reallyGetFlag($name);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:ResourceLoaderFileModule.php


示例18: getDefinitionSummary

 /**
  * Get the definition summary for this module.
  *
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $this->loadFromDefinition();
     $summary = parent::getDefinitionSummary($context);
     foreach (['localBasePath', 'images', 'variants', 'prefix', 'selectorWithoutVariant', 'selectorWithVariant'] as $member) {
         $summary[$member] = $this->{$member};
     }
     return $summary;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:15,代码来源:ResourceLoaderImageModule.php


示例19: getDefinitionSummary

 /**
  * Get the definition summary for this module.
  *
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $summary = parent::getDefinitionSummary($context);
     $options = [];
     foreach (['scripts', 'debugScripts', 'styles', 'languageScripts', 'skinScripts', 'skinStyles', 'messages', 'templates', 'skipFunction', 'debugRaw', 'raw'] as $member) {
         $options[$member] = $this->{$member};
     }
     $summary[] = ['options' => $options, 'fileHashes' => $this->getFileHashes($context), 'messageBlob' => $this->getMessageBlob($context)];
     return $summary;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:16,代码来源:ResourceLoaderFileModule.php


示例20: getDefinitionSummary

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 public function getDefinitionSummary(ResourceLoaderContext $context)
 {
     $summary = parent::getDefinitionSummary($context);
     $summary[] = array('pages' => $this->getPages($context), 'titleInfo' => $this->getTitleInfo($context));
     return $summary;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:ResourceLoaderWikiModule.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ResourceUpdate类代码示例发布时间:2022-05-23
下一篇:
PHP ResourceLoaderContext类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap