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


PHP iaUtil::jsonEncode方法代码示例

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


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

示例1: _createJsFile

 protected function _createJsFile($file, $type = 'config')
 {
     $this->iaCore->factory('util');
     // required in order the class iaUtil to be loaded
     $iaDb =& $this->iaCore->iaDb;
     switch ($type) {
         case 'lang':
         case 'admin_lang':
             // get phrases
             $stmt = "`code` = :lang AND `category` NOT IN ('tooltip', 'page', :category)";
             $iaDb->bind($stmt, array('lang' => $this->iaCore->iaView->language, 'category' => $type == 'admin_lang' ? 'frontend' : iaCore::ADMIN));
             $phrases = $iaDb->keyvalue(array('key', 'value'), $stmt, iaLanguage::getTable());
             // get list of languages
             $languagesList = $iaDb->assoc(array('code', 'title', 'direction', 'flagicon', 'iso' => 'code'), 'admin_lang' == $type ? null : "`status` = 'active'", 'languages');
             $fileContent = 'intelli.' . ('admin_lang' == $type ? 'admin.' : '') . 'lang = ' . iaUtil::jsonEncode($phrases) . ';' . 'intelli.languages = ' . iaUtil::jsonEncode($languagesList) . ';';
             break;
         case 'config':
             $stmt = "`private` = 0 && `type` != 'divider' && `config_group` != 'email_templates'";
             $config = $iaDb->keyvalue(array('name', 'value'), $stmt, iaCore::getConfigTable());
             if (file_exists(IA_INCLUDES . 'custom.inc.php')) {
                 include IA_INCLUDES . 'custom.inc.php';
             }
             $config['ia_url'] = IA_CLEAR_URL;
             $config['packages'] = $this->iaCore->setPackagesData();
             $config['items'] = array();
             $config['extras'] = array(array('core', iaLanguage::get('core', 'Core')));
             $array = $iaDb->all(array('name', 'title'), "`status` = 'active' ORDER BY `type`", null, null, 'extras');
             foreach ($array as $item) {
                 $config['extras'][] = array($item['name'], $item['title']);
             }
             $array = $iaDb->onefield('`item`', "`item` != 'transactions'", null, null, 'items');
             foreach ($array as $item) {
                 $config['items'][] = array($item, iaLanguage::get($item, $item));
             }
             $fileContent = 'intelli.config = ' . iaUtil::jsonEncode($config) . ';';
     }
     if (isset($fileContent)) {
         if ($fh = fopen($file, 'w')) {
             fwrite($fh, $fileContent);
             fclose($fh);
         }
     }
 }
开发者ID:rentpad,项目名称:subrion,代码行数:43,代码来源:ia.core.cache.php

示例2: jsonp

 public function jsonp($data)
 {
     $this->iaCore->factory('util');
     echo sprintf('%s(%s)', isset($_GET['fn']) ? $_GET['fn'] : '', iaUtil::jsonEncode($data));
     exit;
 }
开发者ID:UzielSilva,项目名称:subrion,代码行数:6,代码来源:ia.core.view.php

示例3: _parseTreeNodes

 private function _parseTreeNodes($nodesFlatData)
 {
     $nestedIds = array();
     $preservedKeys = array('id', 'text', 'parent');
     $data = iaUtil::jsonDecode($nodesFlatData);
     foreach ($data as $i => $node) {
         foreach ($node as $key => $value) {
             if (!in_array($key, $preservedKeys)) {
                 unset($data[$i][$key]);
             }
         }
         $alias = strtolower(iaSanitize::alias($node['text']));
         $nestedIds[$node['id']] = array('node_id' => $node['id'], 'text' => $node['text'], 'parent_node_id' => '#' != $node['parent'] ? $node['parent'] : '', 'alias' => '#' != $node['parent'] && isset($nestedIds[$node['parent']]) ? $nestedIds[$node['parent']]['alias'] . $alias . IA_URL_DELIMITER : $alias . IA_URL_DELIMITER);
     }
     return array(iaUtil::jsonEncode($data), $nestedIds);
 }
开发者ID:kamilklkn,项目名称:subrion,代码行数:16,代码来源:fields.php

示例4: _assignValues

 protected function _assignValues(&$iaView, array &$entryData)
 {
     $pageGroups = array();
     $visibleOn = array();
     // get groups
     $groups = $this->_iaDb->onefield('`group`', '1 GROUP BY `group`', null, null, 'pages');
     $rows = $this->_iaDb->all(array('id', 'name', 'title'), null, null, null, 'admin_pages_groups');
     foreach ($rows as $row) {
         if (in_array($row['id'], $groups)) {
             $pageGroups[$row['id']] = $row;
         }
     }
     if (iaCore::ACTION_EDIT == $iaView->get('action')) {
         if ($array = $this->_iaDb->onefield('page_name', "`object_type` = 'blocks' && " . iaDb::convertIds($this->getEntryId(), 'object'), null, null, 'objects_pages')) {
             $visibleOn = $array;
         }
     } elseif (!empty($_POST['pages'])) {
         $visibleOn = $_POST['pages'];
     }
     if (!empty($_POST['menus'])) {
         $iaView->assign('treeData', iaSanitize::html(iaUtil::jsonEncode($_POST['menus'])));
     }
     $iaView->assign('visibleOn', $visibleOn);
     $iaView->assign('pages', $this->_getPages());
     $iaView->assign('pagesGroup', $pageGroups);
     $iaView->assign('positions', $this->getHelper()->getPositions());
 }
开发者ID:TalehFarzaliey,项目名称:subrion,代码行数:27,代码来源:menus.php

示例5: _parseTreeNodes

 private function _parseTreeNodes($nodesFlatData)
 {
     $preservedKeys = array('id', 'text', 'parent');
     $data = iaUtil::jsonDecode($nodesFlatData);
     foreach ($data as $i => $node) {
         foreach ($node as $key => $value) {
             if (!in_array($key, $preservedKeys)) {
                 unset($data[$i][$key]);
             }
         }
     }
     return iaUtil::jsonEncode($data);
 }
开发者ID:bohmszi,项目名称:kdbe_cms,代码行数:13,代码来源:fields.php


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