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


PHP VmConfig::_jpConfig方法代码示例

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


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

示例1: loadConfig

 /**
  * Loads the configuration and works as singleton therefore called static. The call using the program cache
  * is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
  * The db is 10 times slower then the session.
  *
  * Performance:
  *
  * Fastest is
  * Program Cache: 1.5974044799805E-5
  * Session Cache: 0.00016094612121582
  *
  * First config db load: 0.00052118301391602
  * Parsed and in session: 0.001554012298584
  *
  * After install from file: 0.0040450096130371
  * Parsed and in session: 0.0051419734954834
  *
  *
  * Functions tests if already loaded in program cache, session cache, database and at last the file.
  *
  * Load the configuration values from the database into a session variable.
  * This step is done to prevent accessing the database for every configuration variable lookup.
  *
  * @author Max Milbers
  * @param $force boolean Forces the function to load the config from the db
  */
 public static function loadConfig($force = FALSE, $fresh = FALSE)
 {
     if ($fresh) {
         self::$_jpConfig = new VmConfig();
         return self::$_jpConfig;
     }
     vmSetStartTime('loadConfig');
     if (!$force) {
         if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
             return self::$_jpConfig;
         }
     }
     self::$_jpConfig = new VmConfig();
     if (!class_exists('VirtueMartModelConfig')) {
         require VMPATH_ADMIN . '/models/config.php';
     }
     $configTable = VirtueMartModelConfig::checkConfigTableExists();
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     self::$installed = true;
     $install = vRequest::getInt('install', false);
     $redirected = vRequest::getInt('redirected', false);
     $link = '';
     if (empty($configTable)) {
         self::$installed = false;
         $jlang = JFactory::getLanguage();
         $selectedLang = $jlang->getTag();
         if (empty($selectedLang)) {
             $selectedLang = $jlang->setLanguage($selectedLang);
         }
         $q = 'SELECT `element` FROM `#__extensions` WHERE type = "language" and enabled = "1"';
         $db->setQuery($q);
         $knownLangs = $db->loadColumn();
         //vmdebug('Selected language '.$selectedLang.' $knownLangs ',$knownLangs);
         if ($app->isAdmin() and !in_array($selectedLang, $knownLangs)) {
             $link = 'index.php?option=com_installer&view=languages';
             $msg = 'Install your selected language <b>' . $selectedLang . '</b> first in <a href="' . $link . '">joomla language manager</a>, just select then the component VirtueMart under menu "component", to proceed with the installation ';
             $app->enqueueMessage($msg);
         }
         self::$installed = VirtueMartModelConfig::checkVirtuemartInstalled();
         if (!self::$installed) {
             if (!$redirected and !$install) {
                 $link = 'index.php?option=com_virtuemart&view=updatesmigration&redirected=1';
                 $msg = '';
                 if ($app->isSite()) {
                     $link = JURI::root(true) . '/administrator/' . $link;
                 } else {
                     $msg = 'Install Virtuemart first, click on the menu component and select VirtueMart';
                 }
             }
         }
     } else {
         $query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
         $db->setQuery($query);
         self::$_jpConfig->_raw = $db->loadResult();
         //vmTime('time to load config','loadConfig');
     }
     if (empty(self::$_jpConfig->_raw)) {
         $_value = VirtueMartModelConfig::readConfigFile();
         if (!$_value) {
             vmError('Serious error, config file could not be filled with data');
             return FALSE;
         }
         $_value = join('|', $_value);
         self::$_jpConfig->_raw = $_value;
         self::$_jpConfig->setParams(self::$_jpConfig->_raw);
         self::$_jpConfig->storeConfig();
     } else {
         self::$_jpConfig->setParams(self::$_jpConfig->_raw);
     }
     self::$_secret = JFactory::getConfig()->get('secret');
     self::$_jpConfig->_params['sctime'] = microtime(TRUE);
     self::$_jpConfig->_params['vmlang'] = self::setdbLanguageTag();
     vmTime('time to load config', 'loadConfig');
//.........这里部分代码省略.........
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:101,代码来源:config.php

示例2: loadConfig

 /**
  * Loads the configuration and works as singleton therefore called static. The call using the program cache
  * is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
  * The db is 10 times slower then the session.
  *
  * Performance:
  *
  * Fastest is
  * Program Cache: 1.5974044799805E-5
  * Session Cache: 0.00016094612121582
  *
  * First config db load: 0.00052118301391602
  * Parsed and in session: 0.001554012298584
  *
  * After install from file: 0.0040450096130371
  * Parsed and in session: 0.0051419734954834
  *
  *
  * Functions tests if already loaded in program cache, session cache, database and at last the file.
  *
  * Load the configuration values from the database into a session variable.
  * This step is done to prevent accessing the database for every configuration variable lookup.
  *
  * @author Max Milbers
  * @param $force boolean Forces the function to load the config from the db
  */
 public static function loadConfig($force = FALSE)
 {
     vmSetStartTime('loadConfig');
     if (!$force) {
         if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
             return self::$_jpConfig;
         }
     }
     self::$_jpConfig = new VmConfig();
     $db = JFactory::getDBO();
     $query = 'SHOW TABLES LIKE "%virtuemart_configs%"';
     $db->setQuery($query);
     $configTable = $db->loadResult();
     // 		self::$_debug = true;
     if (empty($configTable)) {
         self::$_jpConfig->installVMconfig();
     }
     $app = JFactory::getApplication();
     $install = 'no';
     if (empty(self::$_jpConfig->_raw)) {
         $query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
         $db->setQuery($query);
         self::$_jpConfig->_raw = $db->loadResult();
         if (empty(self::$_jpConfig->_raw)) {
             if (self::installVMconfig()) {
                 $install = 'yes';
                 $db->setQuery($query);
                 self::$_jpConfig->_raw = $db->loadResult();
                 self::$_jpConfig->_params = NULL;
             } else {
                 $app->enqueueMessage('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
             }
         }
     }
     $i = 0;
     $pair = array();
     if (!empty(self::$_jpConfig->_raw)) {
         $config = explode('|', self::$_jpConfig->_raw);
         foreach ($config as $item) {
             $item = explode('=', $item);
             if (!empty($item[1])) {
                 // if($item[0]!=='offline_message' && $item[0]!=='dateformat' ){
                 if ($item[0] !== 'offline_message') {
                     try {
                         $value = @unserialize($item[1]);
                         if ($value === FALSE) {
                             $app->enqueueMessage('Exception in loadConfig for unserialize ' . $item[0] . ' ' . $item[1]);
                             $uri = JFactory::getURI();
                             $configlink = $uri->root() . 'administrator/index.php?option=com_virtuemart&view=config';
                             $app->enqueueMessage('To avoid this message, enter your virtuemart <a href="' . $configlink . '">config</a> and just save it one time');
                         } else {
                             $pair[$item[0]] = $value;
                         }
                     } catch (Exception $e) {
                         vmdebug('Exception in loadConfig for unserialize ' . $e->getMessage(), $item);
                     }
                 } else {
                     $pair[$item[0]] = unserialize(base64_decode($item[1]));
                 }
             } else {
                 $pair[$item[0]] = '';
             }
         }
         // 			$pair['sctime'] = microtime(true);
         self::$_jpConfig->_params = $pair;
         self::$_jpConfig->set('sctime', microtime(TRUE));
         self::$_jpConfig->set('vmlang', self::setdbLanguageTag());
         self::$_jpConfig->setSession();
         vmTime('loadConfig db ' . $install, 'loadConfig');
         return self::$_jpConfig;
     }
     $app->enqueueMessage('Attention config is empty');
     return self::$_jpConfig;
 }
开发者ID:romuland,项目名称:khparts,代码行数:100,代码来源:config.php

示例3: loadConfig

 /**
  * Loads the configuration and works as singleton therefore called static. The call using the program cache
  * is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
  * The db is 10 times slower then the session.
  *
  * Performance:
  *
  * Fastest is
  * Program Cache: 1.5974044799805E-5
  * Session Cache: 0.00016094612121582
  *
  * First config db load: 0.00052118301391602
  * Parsed and in session: 0.001554012298584
  *
  * After install from file: 0.0040450096130371
  * Parsed and in session: 0.0051419734954834
  *
  *
  * Functions tests if alread loaded in program cache, session cache, database and at last the file.
  *
  * Load the configuration values from the database into a session variable.
  * This step is done to prevent accessing the database for every configuration variable lookup.
  *
  * @author Max Milbers
  * @param $force boolean Forces the function to load the config from the db
  */
 public function loadConfig($force = false)
 {
     vmSetStartTime('loadConfig');
     if (!$force) {
         if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
             // 				vmTime('loadConfig Program Cache','loadConfig');
             return self::$_jpConfig;
         }
         /*			else {
         				$session = JFactory::getSession();
         				$vmConfig = $session->get('vmconfig','','vm');
         				if(!empty($vmConfig)){
         					$params = unserialize($vmConfig);
         					if(!empty($params)) {
         						//This is our cache valid time, atm I use 5 minutes, that means that for exampel changes at the config
         						//have at least 5 minutes later an effect of a currently logged in user (shopper)
         						// 5 minutes until the config settings takes effect for OTHER users.
         						$app = JFactory::getApplication();
         						$cacheenabled = $app->getCfg('caching');
         						$cachetime = $app->getCfg('cachetime');
         
         						if(!empty($cacheenabled) and !empty($params['sctime']) and (microtime(true) - $params['sctime'])<$cachetime) {
         							$params['offline_message'] = base64_decode($params['offline_message']);
         							// $params['dateformat'] = base64_decode($params['dateformat']);
         
         							self::$_jpConfig = new VmConfig();
         							self::$_jpConfig->_params = $params;
         							self::$_jpConfig->set('vmlang',self::setdbLanguageTag());
         							vmTime('loadConfig Session','loadConfig');
         
         							return self::$_jpConfig;
         						} else {
         // 							VmInfo('empty $params->sctime');
         						}
         
         					}
         				}
         
         			} */
     }
     self::$_jpConfig = new VmConfig();
     $db = JFactory::getDBO();
     $query = 'SHOW TABLES LIKE "%virtuemart_configs%"';
     $db->setQuery($query);
     $configTable = $db->loadResult();
     // 		self::$_debug = true;
     if (empty($configTable)) {
         self::$_jpConfig->installVMconfig();
     }
     $install = 'no';
     if (empty(self::$_jpConfig->_raw)) {
         $query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
         $db->setQuery($query);
         self::$_jpConfig->_raw = $db->loadResult();
         if (empty(self::$_jpConfig->_raw)) {
             if (self::installVMconfig()) {
                 $install = 'yes';
                 $db->setQuery($query);
                 self::$_jpConfig->_raw = $db->loadResult();
                 self::$_jpConfig->_params = null;
             } else {
                 VmError('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
             }
         }
     }
     $i = 0;
     $pair = array();
     if (!empty(self::$_jpConfig->_raw)) {
         $config = explode('|', self::$_jpConfig->_raw);
         foreach ($config as $item) {
             $item = explode('=', $item);
             if (!empty($item[1])) {
                 // if($item[0]!=='offline_message' && $item[0]!=='dateformat' ){
                 if ($item[0] !== 'offline_message') {
//.........这里部分代码省略.........
开发者ID:joselapria,项目名称:virtuemart,代码行数:101,代码来源:config.php

示例4: loadConfig

 /**
  * Loads the configuration and works as singleton therefore called static. The call using the program cache
  * is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
  * The db is 10 times slower then the session.
  *
  * Performance:
  *
  * Fastest is
  * Program Cache: 1.5974044799805E-5
  * Session Cache: 0.00016094612121582
  *
  * First config db load: 0.00052118301391602
  * Parsed and in session: 0.001554012298584
  *
  * After install from file: 0.0040450096130371
  * Parsed and in session: 0.0051419734954834
  *
  *
  * Functions tests if already loaded in program cache, session cache, database and at last the file.
  *
  * Load the configuration values from the database into a session variable.
  * This step is done to prevent accessing the database for every configuration variable lookup.
  *
  * @author Max Milbers
  * @param $force boolean Forces the function to load the config from the db
  */
 public static function loadConfig($force = FALSE, $fresh = FALSE)
 {
     if ($fresh) {
         return self::$_jpConfig = new VmConfig();
     }
     vmSetStartTime('loadConfig');
     if (!$force) {
         if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
             return self::$_jpConfig;
         }
     }
     self::$_jpConfig = new VmConfig();
     if (!class_exists('VirtueMartModelConfig')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'config.php';
     }
     $configTable = VirtueMartModelConfig::checkConfigTableExists();
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     $freshInstall = vRequest::getInt('install', false);
     if (empty($configTable) or $freshInstall) {
         if (!$freshInstall) {
             $installed = VirtueMartModelConfig::checkVirtuemartInstalled();
             if (!$installed) {
                 $jlang = JFactory::getLanguage();
                 $selectedLang = $jlang->getTag();
                 if (empty($selectedLang)) {
                     $selectedLang = $jlang->setLanguage($selectedLang);
                 }
                 $msg = '';
                 $q = 'SELECT `element` FROM `#__extensions` WHERE type = "language" and enabled = "1"';
                 $db->setQuery($q);
                 $knownLangs = $db->loadColumn();
                 //vmdebug('Selected language '.$selectedLang.' $knownLangs ',$knownLangs);
                 if ($app->isAdmin() and !in_array($selectedLang, $knownLangs)) {
                     $link = 'index.php?option=com_installer&view=languages';
                     $msg = 'Install your selected language <b>' . $selectedLang . '</b> first in <a href="' . $link . '">joomla language manager</a>, just select then the component VirtueMart under menu "component", to proceed with the installation ';
                     $app->enqueueMessage($msg);
                 }
                 //else {
                 if ($app->isSite()) {
                     $link = 'index.php?option=com_virtuemart';
                 } else {
                     $link = 'index.php?option=com_virtuemart&view=updatesmigration&install=1';
                     $msg = 'Install Virtuemart first, click on the menu component and select VirtueMart';
                 }
                 if ($app->isSite()) {
                     $link = JURI::root(true) . '/administrator/' . $link;
                 }
                 $app->redirect($link, $msg);
                 //}
             }
             if ($installed) {
                 self::$_jpConfig->installVMconfig();
             }
         } else {
             self::$_jpConfig->installVMconfig($freshInstall);
         }
     }
     $install = 'no';
     if (empty(self::$_jpConfig->_raw)) {
         $query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
         $db->setQuery($query);
         self::$_jpConfig->_raw = $db->loadResult();
         if (empty(self::$_jpConfig->_raw)) {
             if (self::installVMconfig($freshInstall)) {
                 $install = 'yes';
                 $db->setQuery($query);
                 self::$_jpConfig->_raw = $db->loadResult();
                 self::$_jpConfig->_params = NULL;
             } else {
                 $app->enqueueMessage('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:juanmcortez,项目名称:Lectorum,代码行数:101,代码来源:config.php

示例5: loadConfig

 /**
  * Loads the configuration and works as singleton therefore called static. The call using the program cache
  * is 10 times faster then taking from the session. The session is still approx. 30 times faster then using the file.
  * The db is 10 times slower then the session.
  *
  * Performance:
  *
  * Fastest is
  * Program Cache: 1.5974044799805E-5
  * Session Cache: 0.00016094612121582
  *
  * First config db load: 0.00052118301391602
  * Parsed and in session: 0.001554012298584
  *
  * After install from file: 0.0040450096130371
  * Parsed and in session: 0.0051419734954834
  *
  *
  * Functions tests if already loaded in program cache, session cache, database and at last the file.
  *
  * Load the configuration values from the database into a session variable.
  * This step is done to prevent accessing the database for every configuration variable lookup.
  *
  * @author Max Milbers
  * @param $force boolean Forces the function to load the config from the db
  * Note Patrick Kohl STUDIO42
  * added prefix from joomla in like to prevent getting false config for multiple use of joomla in same database
  */
 public static function loadConfig($force = FALSE, $fresh = FALSE)
 {
     if ($fresh) {
         return self::$_jpConfig = new VmConfig();
     }
     vmSetStartTime('loadConfig');
     if (!$force) {
         if (!empty(self::$_jpConfig) && !empty(self::$_jpConfig->_params)) {
             return self::$_jpConfig;
         }
     }
     self::$_jpConfig = new VmConfig();
     $db = JFactory::getDBO();
     $prefix = $db->getPrefix();
     $query = 'SHOW TABLES LIKE "' . $prefix . 'virtuemart_configs"';
     $db->setQuery($query);
     $configTable = $db->loadResult();
     // 		self::$_debug = true;
     if (empty($configTable)) {
         self::$_jpConfig->installVMconfig();
     }
     $app = JFactory::getApplication();
     $install = 'no';
     if (empty(self::$_jpConfig->_raw)) {
         $query = ' SELECT `config` FROM `#__virtuemart_configs` WHERE `virtuemart_config_id` = "1";';
         $db->setQuery($query);
         self::$_jpConfig->_raw = json_decode($db->loadResult(), TRUE);
         if (empty(self::$_jpConfig->_raw)) {
             if (self::installVMconfig()) {
                 $install = 'yes';
                 $db->setQuery($query);
                 self::$_jpConfig->_raw = json_decode($db->loadResult(), TRUE);
                 self::$_jpConfig->_params =& self::$_jpConfig->_raw;
             } else {
                 $app->enqueueMessage('Error loading configuration file', 'Error loading configuration file, please contact the storeowner');
             }
         }
     }
     $i = 0;
     $pair = array();
     if (!empty(self::$_jpConfig->_raw)) {
         // 			$pair['sctime'] = microtime(true);
         self::$_jpConfig->_params =& self::$_jpConfig->_raw;
         self::$_jpConfig->set('sctime', microtime(TRUE));
         self::$_jpConfig->set('vmlang', self::setdbLanguageTag());
         self::$_jpConfig->setSession();
         vmTime('loadConfig db ' . $install, 'loadConfig');
         return self::$_jpConfig;
     }
     $app->enqueueMessage('Attention config is empty');
     return self::$_jpConfig;
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:80,代码来源:config.php


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