Esempio n. 1
0
 function encode($decode)
 {
     $result = '';
     switch (gettype($decode)) {
         case 'array':
             if (!count($decode) || array_keys($decode) === range(0, count($decode) - 1)) {
                 $keys = array();
                 foreach ($decode as $value) {
                     if (($value = RSTicketsProJSON::encode($value)) !== '') {
                         array_push($keys, $value);
                     }
                 }
                 $result = '[' . implode(',', $keys) . ']';
             } else {
                 $result = RSTicketsProJSON::convert($decode);
             }
             break;
         case 'string':
             $replacement = RSTicketsProJSON::__getStaticReplacement();
             $result = '"' . str_replace($replacement['find'], $replacement['replace'], $decode) . '"';
             break;
         default:
             if (!is_callable($decode)) {
                 $result = RSTicketsProJSON::convert($decode);
             }
             break;
     }
     return $result;
 }
Esempio n. 2
0
 function showCustomFieldValues()
 {
     header('Content-Type: text/javascript; charset=utf-8');
     $model = $this->getModel('kbrules');
     $values = $model->getCustomFieldValues();
     echo RSTicketsProJSON::encode($values);
     die;
 }