Project

General

Profile

Bug #19285 » 9286_json2.diff

Administrator Admin, 2008-09-04 01:01

View differences:

t3lib/class.t3lib_div.php (working copy)
return $str;
}
/**
/**
* Creates recursively a JSON literal from a mulidimensional associative array.
* Uses Services_JSON (http://mike.teczno.com/JSON/doc/)
* Uses native function of PHP >= 5.2.0
*
* @param array $jsonArray: The array to be transformed to JSON
* @return string JSON string
*/
public static function array2json(array $jsonArray) {
if (!$GLOBALS['JSON']) {
require_once(PATH_typo3.'contrib/json/json.php');
$GLOBALS['JSON'] = t3lib_div::makeInstance('Services_JSON');
}
return $GLOBALS['JSON']->encode($jsonArray);
return json_encode($jsonArray);
}
/**
......
}
}
?>
?>
typo3/alt_shortcut.php (working copy)
$this->content = $this->doc->insertStylesAndJS($this->content);
if($this->editPage && $this->isAjaxCall) {
require_once('contrib/json/json.php');
$data = array();
// edit page
......
$data['searchFor'] = rawurlencode($this->searchFor);
}
$json = new Services_JSON();
$content = $json->encode($data);
$content = json_encode($data);
header('Content-type: application/json; charset=utf-8');
header('X-JSON: '.$content);
(2-2/2)