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


PHP Registry::loadString方法代码示例

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


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

示例1: handle

 /**
  * Prepare the statuses of the items.
  *
  * @param array $data
  * @param array $options
  */
 public function handle(&$data, array $options = array())
 {
     foreach ($data as $key => $item) {
         // Calculate funding end date
         if (is_numeric($item->funding_days) and $item->funding_days > 0) {
             $fundingStartDate = new Crowdfunding\Date($item->funding_start);
             $endDate = $fundingStartDate->calculateEndDate($item->funding_days);
             $item->funding_end = $endDate->format(Prism\Constants::DATE_FORMAT_SQL_DATE);
         }
         // Calculate funded percentage.
         $item->funded_percents = (string) MathHelper::calculatePercentage($item->funded, $item->goal, 0);
         // Calculate days left
         $today = new Crowdfunding\Date();
         $item->days_left = $today->calculateDaysLeft($item->funding_days, $item->funding_start, $item->funding_end);
         // Decode parameters.
         if ($item->params === null) {
             $item->params = '{}';
         }
         if (is_string($item->params) and $item->params !== '') {
             $params = new Registry();
             $params->loadString($item->params);
             $item->params = $params;
         }
     }
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:31,代码来源:PrepareItemsHelper.php

示例2: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->groups)) {
             // JSON Decode groups.
             $item->groups = json_decode($item->groups, true);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_componentbuilder.help_document');
         }
     }
     return $item;
 }
开发者ID:vdm-io,项目名称:Joomla-Component-Builder,代码行数:35,代码来源:help_document.php

示例3: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->template)) {
             // base64 Decode template.
             $item->template = base64_decode($item->template);
         }
         if (!empty($item->php_view)) {
             // base64 Decode php_view.
             $item->php_view = base64_decode($item->php_view);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_componentbuilder.template');
         }
     }
     return $item;
 }
开发者ID:vdm-io,项目名称:Joomla-Component-Builder,代码行数:39,代码来源:template.php

示例4: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->causesrisks)) {
             // JSON Decode causesrisks.
             $item->causesrisks = json_decode($item->causesrisks);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_costbenefitprojection.country');
         }
     }
     $this->countryvvvy = $item->id;
     $this->countryvvvz = $item->id;
     $this->countryvvwa = $item->id;
     return $item;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:38,代码来源:country.php

示例5: populateState

 /**
  * Method to auto-populate the model state.
  *
  * @param	string		$ordering	Field used for order by clause
  * @param	string		$direction	Direction of order
  * 	
  * Note. Calling getState in this method will result in recursion.
  *
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $this->setState('filter.extension', $this->_extension);
     // Get the parent id if defined.
     $parent_id = $app->input->getInt('id');
     $this->setState('filter.parentId', $parent_id);
     // Load the parameters. Merge Global and Menu Item params into new object
     $params = $app->getParams();
     $menu_params = new Registry();
     if ($menu = $app->getMenu()->getActive()) {
         $menu_params->loadString($menu->params);
     }
     $merged_params = clone $menu_params;
     $merged_params->merge($params);
     $this->setState('params', $merged_params);
     $params = $merged_params;
     $this->setState('filter.published', 1);
     $this->setState('filter.language', $app->getLanguageFilter());
     // process show_category_noauth parameter
     if (!$params->get('show_category_noauth')) {
         $this->setState('filter.access', true);
     } else {
         $this->setState('filter.access', false);
     }
 }
开发者ID:esorone,项目名称:efcpw,代码行数:35,代码来源:categories.php

示例6: getComponent

	/**
	 * Get the component information.
	 *
	 * @param   string   $option  The component option.
	 * @param   boolean  $strict  If set and the component does not exist, the enabled attribute will be set to false.
	 *
	 * @return  stdClass   An object with the information for the component.
	 *
	 * @since   1.5
	 */
	public static function getComponent($option, $strict = false)
	{
		if (!isset(static::$components[$option]))
		{
			if (static::load($option))
			{
				$result = static::$components[$option];
			}
			else
			{
				$result = new stdClass;
				$result->enabled = $strict ? false : true;
				$result->params = new Registry;
			}
		}
		else
		{
			$result = static::$components[$option];
		}

		if (is_string($result->params))
		{
			$temp = new Registry;
			$temp->loadString(static::$components[$option]->params);
			static::$components[$option]->params = $temp;
		}

		return $result;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:39,代码来源:helper.php

示例7: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->interventions)) {
             // JSON Decode interventions.
             $item->interventions = json_decode($item->interventions);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_costbenefitprojection.intervention');
         }
     }
     return $item;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:35,代码来源:intervention.php

示例8: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->testcompanies)) {
             // JSON Decode testcompanies.
             $item->testcompanies = json_decode($item->testcompanies);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_costbenefitprojection.service_provider');
         }
     }
     $this->service_providervvvx = $item->id;
     return $item;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:36,代码来源:service_provider.php

示例9: render

 /**
  * Renders a module script and returns the results as a string
  *
  * @param   mixed   $module   The name of the module to render
  * @param   array   $attribs  Associative array of values
  * @param   string  $content  If present, module information from the buffer will be used
  *
  * @return  string  The output of the script
  *
  * @since   11.1
  */
 public function render($module, $attribs = array(), $content = null)
 {
     if (!is_object($module)) {
         $title = isset($attribs['title']) ? $attribs['title'] : null;
         $module = JModuleHelper::getModule($module, $title);
         if (!is_object($module)) {
             if (is_null($content)) {
                 return '';
             } else {
                 /**
                  * If module isn't found in the database but data has been pushed in the buffer
                  * we want to render it
                  */
                 $tmp = $module;
                 $module = new stdClass();
                 $module->params = null;
                 $module->module = $tmp;
                 $module->id = 0;
                 $module->user = 0;
             }
         }
     }
     // Get the user and configuration object
     // $user = JFactory::getUser();
     $conf = Factory::getConfig();
     // Set the module content
     if (!is_null($content)) {
         $module->content = $content;
     }
     // Get module parameters
     $params = new Registry();
     $params->loadString($module->params);
     // Use parameters from template
     if (isset($attribs['params'])) {
         $template_params = new Registry();
         $template_params->loadString(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8'));
         $params->merge($template_params);
         $module = clone $module;
         $module->params = (string) $params;
     }
     $contents = '';
     // Default for compatibility purposes. Set cachemode parameter or use JModuleHelper::moduleCache from within the
     // module instead
     $cachemode = $params->get('cachemode', 'oldstatic');
     if ($params->get('cache', 0) == 1 && $conf->get('caching') >= 1 && $cachemode != 'id' && $cachemode != 'safeuri') {
         // Default to itemid creating method and workarounds on
         $cacheparams = new stdClass();
         $cacheparams->cachemode = $cachemode;
         $cacheparams->class = 'JModuleHelper';
         $cacheparams->method = 'renderModule';
         $cacheparams->methodparams = array($module, $attribs);
         $contents = JModuleHelper::ModuleCache($module, $params, $cacheparams);
     } else {
         $contents = JModuleHelper::renderModule($module, $attribs);
     }
     return $contents;
 }
开发者ID:Alibek,项目名称:joomla-platform-namespace-example,代码行数:68,代码来源:module.php

示例10: __construct

 /**
  * Constructor
  *
  * @param   DispatcherInterface  &$subject  The object to observe
  * @param   array                $config    An optional associative array of configuration settings.
  *                                          Recognized key values include 'name', 'group', 'params', 'language'
  *                                         (this list is not meant to be comprehensive).
  *
  * @since   1.5
  */
 public function __construct(&$subject, $config = array())
 {
     // Get the parameters.
     if (isset($config['params'])) {
         if ($config['params'] instanceof Registry) {
             $this->params = $config['params'];
         } else {
             $this->params = new Registry();
             $this->params->loadString($config['params']);
         }
     }
     // Get the plugin name.
     if (isset($config['name'])) {
         $this->_name = $config['name'];
     }
     // Get the plugin type.
     if (isset($config['type'])) {
         $this->_type = $config['type'];
     }
     // Load the language files if needed.
     if ($this->autoloadLanguage) {
         $this->loadLanguage();
     }
     if (property_exists($this, 'app')) {
         $reflection = new ReflectionClass($this);
         $appProperty = $reflection->getProperty('app');
         if ($appProperty->isPrivate() === false && is_null($this->app)) {
             $this->app = JFactory::getApplication();
         }
     }
     if (property_exists($this, 'db')) {
         $reflection = new ReflectionClass($this);
         $dbProperty = $reflection->getProperty('db');
         if ($dbProperty->isPrivate() === false && is_null($this->db)) {
             $this->db = JFactory::getDbo();
         }
     }
     // Set the dispatcher we are to register our listeners with
     $this->setDispatcher($subject);
     // Register the event listeners with the dispatcher. Override the registerListeners method to customise.
     $this->registerListeners();
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:52,代码来源:plugin.php

示例11: getItem

 /**
  * Retrieve the detail record for the current $id if the data has not already been loaded.
  *
  * @author Max Milbers
  */
 function getItem($id = 0)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('*')->from('#__tsmart_general');
     $item = $db->setQuery($query)->loadObject();
     $params = new Registry();
     $params->loadString($item->params);
     $item->params = $params;
     return $item;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:16,代码来源:general.php

示例12: getParams

 function getParams()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('params')->from('#__extensions')->where('enabled = 1')->where('type =' . $db->quote('plugin'))->where('folder =' . $db->quote('kmplugins'))->where('element =' . $db->quote('modules'));
     $db_params = $db->setQuery($query)->loadResult();
     $params = new Registry();
     if (!empty($db_params)) {
         $params->loadString($db_params);
     }
     return $params;
 }
开发者ID:JexyRu,项目名称:Ksenmart,代码行数:11,代码来源:modules.php

示例13: __construct

 /**
  * Constructor
  *
  * @param   object  &$subject  The object to observe
  * @param   array   $config    An optional associative array of configuration settings.
  *                             Recognized key values include 'name', 'group', 'params', 'language'
  *                             (this list is not meant to be comprehensive).
  *
  * @since   11.1
  */
 public function __construct(&$subject, $config = array())
 {
     // Get the parameters.
     if (isset($config['params'])) {
         if ($config['params'] instanceof Registry) {
             $this->params = $config['params'];
         } else {
             $this->params = new Registry();
             $this->params->loadString($config['params']);
         }
     }
     // Get the plugin name.
     if (isset($config['name'])) {
         $this->_name = $config['name'];
     }
     // Get the plugin type.
     if (isset($config['type'])) {
         $this->_type = $config['type'];
     }
     parent::__construct($subject);
 }
开发者ID:Alibek,项目名称:joomla-platform-namespace-example,代码行数:31,代码来源:Plugin.php

示例14: __construct

 /**
  * Constructor
  *
  * @param   object  &$subject  The object to observe
  * @param   array   $config    An optional associative array of configuration settings.
  *                             Recognized key values include 'name', 'group', 'params', 'language'
  *                             (this list is not meant to be comprehensive).
  *
  * @since   1.5
  */
 public function __construct(&$subject, $config = array())
 {
     // Get the parameters.
     if (isset($config['params'])) {
         if ($config['params'] instanceof Registry) {
             $this->params = $config['params'];
         } else {
             $this->params = new Registry();
             $this->params->loadString($config['params']);
         }
     }
     // Get the plugin name.
     if (isset($config['name'])) {
         $this->_name = $config['name'];
     }
     // Get the plugin type.
     if (isset($config['type'])) {
         $this->_type = $config['type'];
     }
     // Load the language files if needed.
     if ($this->autoloadLanguage) {
         $this->loadLanguage();
     }
     if (property_exists($this, 'app')) {
         $reflection = new ReflectionClass($this);
         $appProperty = $reflection->getProperty('app');
         if ($appProperty->isPrivate() === false && is_null($this->app)) {
             $this->app = JFactory::getApplication();
         }
     }
     if (property_exists($this, 'db')) {
         $reflection = new ReflectionClass($this);
         $dbProperty = $reflection->getProperty('db');
         if ($dbProperty->isPrivate() === false && is_null($this->db)) {
             $this->db = JFactory::getDbo();
         }
     }
     parent::__construct($subject);
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:49,代码来源:plugin.php

示例15: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->php_after_getitem)) {
             // base64 Decode php_after_getitem.
             $item->php_after_getitem = base64_decode($item->php_after_getitem);
         }
         if (!empty($item->php_before_getitems)) {
             // base64 Decode php_before_getitems.
             $item->php_before_getitems = base64_decode($item->php_before_getitems);
         }
         if (!empty($item->php_before_getitem)) {
             // base64 Decode php_before_getitem.
             $item->php_before_getitem = base64_decode($item->php_before_getitem);
         }
         if (!empty($item->php_getlistquery)) {
             // base64 Decode php_getlistquery.
             $item->php_getlistquery = base64_decode($item->php_getlistquery);
         }
         if (!empty($item->php_after_getitems)) {
             // base64 Decode php_after_getitems.
             $item->php_after_getitems = base64_decode($item->php_after_getitems);
         }
         if (!empty($item->php_calculation)) {
             // base64 Decode php_calculation.
             $item->php_calculation = base64_decode($item->php_calculation);
         }
         if (!empty($item->php_custom_get)) {
             // base64 Decode php_custom_get.
             $item->php_custom_get = base64_decode($item->php_custom_get);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_componentbuilder.dynamic_get');
         }
     }
     return $item;
 }
开发者ID:vdm-io,项目名称:Joomla-Component-Builder,代码行数:59,代码来源:dynamic_get.php


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