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


PHP modX::toJson方法代码示例

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


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

示例1: getProperties

 /**
  * Get the properties on this source
  * @param boolean $parsed
  * @return array
  */
 public function getProperties($parsed = false)
 {
     $properties = $this->get('properties');
     $defaultProperties = $this->getDefaultProperties();
     if (!empty($properties) && is_array($properties)) {
         foreach ($properties as &$property) {
             $property['overridden'] = 0;
             if (array_key_exists($property['name'], $defaultProperties)) {
                 if ($defaultProperties[$property['name']]['value'] != $property['value']) {
                     $property['overridden'] = 1;
                 }
             } else {
                 $property['overridden'] = 2;
             }
         }
         $properties = array_merge($defaultProperties, $properties);
     } else {
         $properties = $defaultProperties;
     }
     /** @var array $results Allow manipulation of media source properties via event */
     $results = $this->xpdo->invokeEvent('OnMediaSourceGetProperties', array('properties' => $this->xpdo->toJson($properties)));
     if (!empty($results)) {
         foreach ($results as $result) {
             $result = is_array($result) ? $result : $this->xpdo->fromJSON($result);
             $properties = array_merge($properties, $result);
         }
     }
     if ($parsed) {
         $properties = $this->parseProperties($properties);
     }
     return $this->prepareProperties($properties);
 }
开发者ID:rossng,项目名称:revolution,代码行数:37,代码来源:modmediasource.class.php

示例2: count

         $plugin_events = is_array($events) ? array_merge($plugin_events, $events) : $plugin_events;
         $el_i++;
     }
     if (is_array($plugins)) {
         if ($category->addMany($plugins, 'Plugins')) {
             $helper->sendLog(modX::LOG_LEVEL_INFO, '    ' . $modx->lexicon('mc_packaged') . ' ' . count($plugins) . ' ' . $modx->lexicon('mc_plugins'));
         } else {
             $helper->sendLog(modX::LOG_LEVEL_FATAL, '    ' . $modx->lexicon('mc_adding_plugins_failed'));
         }
     } else {
         $helper->sendLog(modX::LOG_LEVEL_FATAL, '    ' . $modx->lexicon('mc_non_array_in') . ' transport.plugins.php');
     }
 }
 $filename = $sources['resolvers'] . 'plugin.resolver.php';
 if (file_exists($filename)) {
     $plugin_events = $modx->toJson($plugin_events);
     $content = file_get_contents($filename);
     $content = str_replace('{events}', $plugin_events, $content);
     file_put_contents($filename, $content);
 }
 /* Create Category attributes array dynamically
  * based on which elements are present
  */
 $attr = array(xPDOTransport::UNIQUE_KEY => 'category', xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::RELATED_OBJECTS => true);
 /* Only add this on first pass if no subPackages */
 if ($hasValidators && $i == 1 && !$hasSubPackages) {
     $attr[xPDOTransport::ABORT_INSTALL_ON_VEHICLE_FAIL] = true;
 }
 if ($hasSnippets) {
     $attr[xPDOTransport::RELATED_OBJECT_ATTRIBUTES]['Snippets'] = array(xPDOTransport::PRESERVE_KEYS => false, xPDOTransport::UPDATE_OBJECT => true, xPDOTransport::UNIQUE_KEY => 'name');
 }
开发者ID:pixelfanatiker,项目名称:migxmultilang,代码行数:31,代码来源:build.transport.php


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