import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -16,7 +16,7 @@
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: Json.php 10664 2008-08-05 10:56:06Z matthew $
* @version $Id: Json.php 15113 2009-04-23 16:54:22Z matthew $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -43,14 +43,28 @@ class Zend_View_Helper_Json extends Zend_View_Helper_Abstract
* Encode data as JSON, disable layouts, and set response header
*
* If $keepLayouts is true, does not disable layouts.
*
* @param mixed $data
*
* @param mixed $data
* @param bool $keepLayouts
* NOTE: if boolean, establish $keepLayouts to true|false
* if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
* this array can contains a 'keepLayout'=>true|false
* that will not be passed to Zend_Json::encode method but will be used here
* @return string|void
*/
public function json($data, $keepLayouts = false)
{
$data = Zend_Json::encode($data);
$options = array();
if (is_array($keepLayouts))
{
$options = $keepLayouts;
$keepLayouts = (array_key_exists('keepLayouts', $keepLayouts))
? $keepLayouts['keepLayouts']
: false;
unset($options['keepLayouts']);
}
$data = Zend_Json::encode($data, null, $options);
if (!$keepLayouts) {
require_once 'Zend/Layout.php';
$layout = Zend_Layout::getMvcInstance();