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


PHP Registry::loadJSON方法代码示例

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


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

示例1: array

 /**
  * Method to get package data.
  * Packages are all stored in jos_fabrik_packages - so don't use {package} in the query to load them
  *
  * @param   int  $pk  The id of the package.
  *
  * @return  mixed	Menu item data object on success, false on failure.
  */
 public function &getItem($pk = null)
 {
     // Initialise variables.
     $pk = !empty($pk) ? $pk : (int) $this->getState('package.id');
     if (!isset($this->_item)) {
         $this->_item = array();
     }
     if (!isset($this->_item[$pk])) {
         try {
             $db = FabrikWorker::getDbo();
             $query = $db->getQuery(true);
             $query->select('label, params, published, component_name');
             $query->from('#__fabrik_packages');
             $query->where('id = ' . (int) $pk);
             // Filter by published state.
             $published = $this->getState('filter.published');
             $archived = $this->getState('filter.archived');
             if (is_numeric($published)) {
                 $query->where('(published = ' . (int) $published . ' OR published =' . (int) $archived . ')');
             }
             $db->setQuery($query);
             $data = $db->loadObject();
             if ($error = $db->getErrorMsg()) {
                 throw new Exception($error);
             }
             if (empty($data)) {
                 throw new JException(FText::_('COM_FABRIK_ERROR_PACKAGE_NOT_FOUND'), 404);
             }
             // Check for published state if filter set.
             if ((is_numeric($published) || is_numeric($archived)) && ($data->published != $published && $data->published != $archived)) {
                 throw new JException(FText::_('COM_FABRIK_ERROR_PACKAGE_NOT_FOUND'), 404);
             }
             // Convert parameter fields to objects.
             $registry = new Registry();
             $registry->loadJSON($data->params);
             $data->params = clone $this->getState('params');
             $data->params->merge($registry);
             $this->_item[$pk] = $data;
         } catch (JException $e) {
             $this->setError($e);
             $this->_item[$pk] = false;
         }
     }
     return $this->_item[$pk];
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:53,代码来源:package.php


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