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


PHP JParameter::loadJSON方法代码示例

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


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

示例1: install

 function install($theme)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $package = $this->_getPackageFromUpload();
     if (!$package) {
         JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_FIND_INSTALL_PACKAGE'));
         $this->deleteTempFiles();
         return false;
     }
     if ($package['dir'] && JFolder::exists($package['dir'])) {
         $this->setPath('source', $package['dir']);
     } else {
         JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_INSTALL_PATH_NOT_EXISTS'));
         $this->deleteTempFiles();
         return false;
     }
     // We need to find the installation manifest file
     if (!$this->_findManifest()) {
         JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_FIND_INFO_INSTALL_PACKAGE'));
         $this->deleteTempFiles();
         return false;
     }
     // Files - copy files in manifest
     foreach ($this->_manifest->children() as $child) {
         if (is_a($child, 'JXMLElement') && $child->name() == 'files') {
             if ($this->parseFiles($child) === false) {
                 JError::raiseWarning(1, JText::_('COM_PHOCAGALLERY_ERROR_FIND_INFO_INSTALL_PACKAGE'));
                 $this->deleteTempFiles();
                 return false;
             }
         }
     }
     // File - copy the xml file
     $copyFile = array();
     $path['src'] = $this->getPath('manifest');
     // XML file will be copied too
     $path['dest'] = JPATH_SITE . DS . 'media' . DS . 'com_phocagallery' . DS . 'images' . DS . basename($this->getPath('manifest'));
     $copyFile[] = $path;
     $this->copyFiles($copyFile, array());
     $this->deleteTempFiles();
     // -------------------
     // Themes
     // -------------------
     // Params -  Get new themes params
     $paramsThemes = $this->getParamsThemes();
     // -------------------
     // Component
     // -------------------
     if (isset($theme['component']) && $theme['component'] == 1) {
         $component = 'com_phocagallery';
         $paramsC = JComponentHelper::getParams($component);
         foreach ($paramsThemes as $keyT => $valueT) {
             $paramsC->set($valueT['name'], $valueT['value']);
         }
         $data['params'] = $paramsC->toArray();
         $table = JTable::getInstance('extension');
         $idCom = $table->find(array('element' => $component));
         $table->load($idCom);
         if (!$table->bind($data)) {
             JError::raiseWarning(500, 'Not a valid component');
             return false;
         }
         // pre-save checks
         if (!$table->check()) {
             JError::raiseWarning(500, $table->getError('Check Problem'));
             return false;
         }
         // save the changes
         if (!$table->store()) {
             JError::raiseWarning(500, $table->getError('Store Problem'));
             return false;
         }
     }
     // -------------------
     // Menu Categories
     // -------------------
     if (isset($theme['categories']) && $theme['categories'] == 1) {
         $link = 'index.php?option=com_phocagallery&view=categories';
         $where = array();
         $where[] = 'link = ' . $db->Quote($link);
         $query = 'SELECT id, params FROM #__menu WHERE ' . implode(' AND ', $where);
         $db->setQuery($query);
         $itemsCat = $db->loadObjectList();
         if (!empty($itemsCat)) {
             foreach ($itemsCat as $keyIT => $valueIT) {
                 $query = 'SELECT m.params FROM #__menu AS m WHERE m.id = ' . (int) $valueIT->id;
                 $db->setQuery($query);
                 $paramsCJSON = $db->loadResult();
                 //$paramsCJSON = $valueIT->params;
                 $paramsMc = new JParameter();
                 $paramsMc->loadJSON($paramsCJSON);
                 foreach ($paramsThemes as $keyT => $valueT) {
                     $paramsMc->set($valueT['name'], $valueT['value']);
                 }
                 $dataMc['params'] = $paramsMc->toArray();
                 $table =& JTable::getInstance('menu');
                 if (!$table->load((int) $valueIT->id)) {
                     JError::raiseWarning(500, 'Not a valid table');
                     return false;
//.........这里部分代码省略.........
开发者ID:01J,项目名称:skazkipronebo,代码行数:101,代码来源:phocagalleryt.php


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