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


PHP Tinebase_Helper::is_json方法代码示例

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


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

示例1: parseConfigValue

 /**
  * parse options
  * 
  * @param string $_value
  * @return array|string
  */
 public static function parseConfigValue($_value)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_value, TRUE));
     }
     // check value is json encoded
     if (Tinebase_Helper::is_json($_value)) {
         return Zend_Json::decode($_value);
     }
     $result = array('active' => 1);
     // keep spaces, \: and \,
     $_value = preg_replace(array('/ /', '/\\\\:/', '/\\\\,/', '/\\s*/'), array('§', '@', ';', ''), $_value);
     $parts = explode(',', $_value);
     foreach ($parts as $part) {
         $part = str_replace(';', ',', $part);
         $part = str_replace('§', ' ', $part);
         $part = str_replace('@', ':', $part);
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $part);
         }
         if (strpos($part, '_') !== FALSE) {
             list($key, $sub) = preg_split('/_/', $part, 2);
             if (preg_match('/:/', $sub)) {
                 list($subKey, $value) = explode(':', $sub);
                 $result[$key][$subKey] = $value;
             } else {
                 // might be a '_' in the value
                 if (preg_match('/:/', $part)) {
                     $exploded = explode(':', $part);
                     $key = array_shift($exploded);
                     $result[$key] = implode(':', $exploded);
                 } else {
                     throw new Timetracker_Exception_UnexpectedValue('You have an error in the config syntax (":" expected): ' . $part);
                 }
             }
         } else {
             if (strpos($part, ':') !== FALSE) {
                 list($key, $value) = preg_split('/:/', $part, 2);
                 $result[$key] = $value;
             } else {
                 $result = $part;
             }
         }
     }
     return $result;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:52,代码来源:Cli.php

示例2: _rawDataToRecordSet

 /**
  * converts raw data from adapter into a set of records
  *
  * @param  array $_rawData of arrays
  * @return Tinebase_Record_RecordSet
  */
 protected function _rawDataToRecordSet(array $_rawData)
 {
     $events = new Tinebase_Record_RecordSet($this->_modelName);
     $events->addIndices(array('rrule', 'recurid'));
     foreach ($_rawData as $rawEvent) {
         $rawEvent['rrule_constraints'] = Tinebase_Helper::is_json($rawEvent['rrule_constraints']) ? json_decode($rawEvent['rrule_constraints'], true) : NULL;
         $events->addRecord(new Calendar_Model_Event($rawEvent, true));
     }
     $this->appendForeignRecordSetToRecordSet($events, 'attendee', 'id', Calendar_Backend_Sql_Attendee::FOREIGNKEY_EVENT, $this->_attendeeBackend);
     return $events;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:Sql.php

示例3: _getSystemNoteChangeText

 /**
  * get system note change text
  * 
  * @param Tinebase_Model_ModificationLog $modification
  * @return string
  */
 protected function _getSystemNoteChangeText(Tinebase_Model_ModificationLog $modification)
 {
     // check if $modification->new_value is json string and record set diff
     // @see 0008546: When edit event, history show "code" ...
     if (Tinebase_Helper::is_json($modification->new_value)) {
         $newValueArray = Zend_Json::decode($modification->new_value);
         if ((isset($newValueArray['model']) || array_key_exists('model', $newValueArray)) && (isset($newValueArray['added']) || array_key_exists('added', $newValueArray))) {
             $diff = new Tinebase_Record_RecordSetDiff($newValueArray);
             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                 Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' fetching translated text for diff: ' . print_r($diff->toArray(), true));
             }
             return $diff->getTranslatedDiffText();
         }
     }
     return $modification->old_value . ' -> ' . $modification->new_value;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:22,代码来源:Notes.php


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