openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 357f5940c355c4163931bc7a429b1dd9cd2f6b18
parent 11ddd952fa9ff0c38be7693ad37849f8a6a918d3
Author: Jan Dankert <devnull@localhost>
Date:   Thu, 10 Jul 2014 23:53:47 +0200

Interne PHP-Methode zum Encodieren von JSON verwenden (Performance!)

Diffstat:
action/Action.class.php | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/action/Action.class.php b/action/Action.class.php @@ -413,7 +413,12 @@ class Action { $json = new JSON(); header('Content-Type: application/json; charset=UTF-8'); - echo $json->encode( $this->templateVars ); + if ( function_exists('json_encode')) + // Native Methode ist schneller.. + echo json_encode( $this->templateVars ); + else + // Fallback, falls json_encode() nicht existiert... + echo $json->encode( $this->templateVars ); exit; }