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


PHP ModUtil::modvars方法代码示例

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


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

示例1: initCoreVars

 /**
  * The initCoreVars preloads some module vars.
  *
  * Preloads module vars for a number of key modules to reduce sql statements.
  *
  * @return void
  */
 public static function initCoreVars($force = false)
 {
     // The empty arrays for handlers and settings are required to prevent messages with E_ALL error reporting
     self::$modvars = new ArrayObject(array(EventUtil::HANDLERS => array(), ServiceUtil::HANDLERS => array(), 'Settings' => array()));
     // don't init vars during the installer or upgrader
     if (!$force && System::isInstalling()) {
         return;
     }
     // This loads all module variables into the modvars static class variable.
     $em = ServiceUtil::get('doctrine')->getEntityManager();
     $modvars = $em->getRepository('Zikula\\Core\\Doctrine\\Entity\\ExtensionVar')->findAll();
     foreach ($modvars as $var) {
         if (!array_key_exists($var['modname'], self::$modvars)) {
             self::$modvars[$var['modname']] = array();
         }
         if (array_key_exists($var['name'], $GLOBALS['ZConfig']['System'])) {
             self::$modvars[$var['modname']][$var['name']] = $GLOBALS['ZConfig']['System'][$var['name']];
         } else {
             self::$modvars[$var['modname']][$var['name']] = $var['value'];
         }
     }
     // Pre-load the module variables array with empty arrays for known modules that
     // do not define any module variables to prevent unnecessary SQL queries to
     // the module_vars table.
     $knownModules = self::getAllMods();
     foreach ($knownModules as $key => $mod) {
         if (!array_key_exists($mod['name'], self::$modvars)) {
             self::$modvars[$mod['name']] = array();
         }
     }
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:38,代码来源:ModUtil.php

示例2: initCoreVars

 /**
  * The initCoreVars preloads some module vars.
  *
  * Preloads module vars for a number of key modules to reduce sql statements.
  *
  * @return void
  */
 public static function initCoreVars($force = false)
 {
     // The empty arrays for handlers and settings are required to prevent messages with E_ALL error reporting
     self::$modvars = new ArrayObject(array(EventUtil::HANDLERS => array(), ServiceUtil::HANDLERS => array(), 'Settings' => array()));
     // don't init vars during the installer or upgrader
     if (!$force && System::isInstalling()) {
         return;
     }
     // This loads all module variables into the modvars static class variable.
     $modvars = DBUtil::selectObjectArray('module_vars');
     foreach ($modvars as $var) {
         if (!array_key_exists($var['modname'], self::$modvars)) {
             self::$modvars[$var['modname']] = array();
         }
         if (array_key_exists($var['name'], $GLOBALS['ZConfig']['System'])) {
             self::$modvars[$var['modname']][$var['name']] = $GLOBALS['ZConfig']['System'][$var['name']];
         } elseif ($var['value'] == '0' || $var['value'] == '1') {
             self::$modvars[$var['modname']][$var['name']] = $var['value'];
         } else {
             self::$modvars[$var['modname']][$var['name']] = unserialize($var['value']);
         }
     }
     // Pre-load the module variables array with empty arrays for known modules that
     // do not define any module variables to prevent unnecessary SQL queries to
     // the module_vars table.
     $knownModules = self::getAllMods();
     foreach ($knownModules as $key => $mod) {
         if (!array_key_exists($mod['name'], self::$modvars)) {
             self::$modvars[$mod['name']] = array();
         }
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:39,代码来源:ModUtil.php

示例3: initCoreVars

 /**
  * The initCoreVars preloads some module vars.
  *
  * Preloads module vars for a number of key modules to reduce sql statements.
  *
  * @param boolean $force
  *
  * @return void
  */
 public static function initCoreVars($force = false)
 {
     // The empty arrays for handlers and settings are required to prevent messages with E_ALL error reporting
     self::$modvars = new ArrayObject(array(EventUtil::HANDLERS => array(), ServiceUtil::HANDLERS => array(), 'ZikulaSettingsModule' => array()));
     // don't init vars during the installer or upgrader
     if (!$force && System::isInstalling()) {
         return;
     }
     // This loads all module variables into the modvars static class variable.
     $em = ServiceUtil::get('doctrine.entitymanager');
     /** @var \Zikula\ExtensionsModule\Entity\ExtensionVarEntity[] $modvars */
     $modvars = $em->getRepository('Zikula\\ExtensionsModule\\Entity\\ExtensionVarEntity')->findAll();
     foreach ($modvars as $var) {
         if (!array_key_exists($var->getModname(), self::$modvars)) {
             self::$modvars[$var->getModname()] = array();
         }
         if (array_key_exists($var->getName(), $GLOBALS['ZConfig']['System'])) {
             self::$modvars[$var->getModname()][$var->getName()] = $GLOBALS['ZConfig']['System'][$var->getName()];
         } else {
             self::$modvars[$var->getModname()][$var->getName()] = $var->getValue();
         }
     }
     // Init multilingual variables here, just to have values, even with default site language (page language is set later)
     self::setupMultilingual();
     // Pre-load the module variables array with empty arrays for known modules that
     // do not define any module variables to prevent unnecessary SQL queries to
     // the module_vars table.
     $knownModules = self::getAllMods();
     foreach ($knownModules as $key => $mod) {
         if (!array_key_exists($mod['name'], self::$modvars)) {
             self::$modvars[$mod['name']] = array();
         }
     }
 }
开发者ID:Silwereth,项目名称:core,代码行数:43,代码来源:ModUtil.php


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