summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/TJavaScript.php
diff options
context:
space:
mode:
authorwei <>2006-05-02 08:28:17 +0000
committerwei <>2006-05-02 08:28:17 +0000
commitd255f4d0e332740b3984e21ce3f7a4a4f1968ba3 (patch)
tree84bf54643e3a188330f6b7b5043efeed1aa44b6e /framework/Web/Javascripts/TJavaScript.php
parentc5983c0440913cd67f3744c7dda3c3bfc7eee0ed (diff)
Adding more work on ActiveControls.
Diffstat (limited to 'framework/Web/Javascripts/TJavaScript.php')
-rw-r--r--framework/Web/Javascripts/TJavaScript.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php
index 75fc2438..0f6414ec 100644
--- a/framework/Web/Javascripts/TJavaScript.php
+++ b/framework/Web/Javascripts/TJavaScript.php
@@ -24,6 +24,11 @@
class TJavaScript
{
/**
+ * @var TJSON JSON decoder and encoder instance
+ */
+ private static $_json;
+
+ /**
* Renders a list of javascript files
* @param array URLs to the javascript files
* @return string rendering result
@@ -191,8 +196,9 @@ class TJavaScript
*/
public static function jsonEncode($value)
{
- Prado::using('System.Web.Javascripts.TJSON');
- return TJSON::encode($value);
+ if(is_null(self::$_json))
+ self::$_json = Prado::createComponent('System.Web.Javascripts.TJSON');
+ return self::$_json->encode($value);
}
/**
@@ -203,8 +209,9 @@ class TJavaScript
*/
public static function jsonDecode($value)
{
- Prado::using('System.Web.Javascripts.TJSON');
- return TJSON::decode($value);
+ if(is_null(self::$_json))
+ self::$_json = Prado::createComponent('System.Web.Javascripts.TJSON');
+ return self::$_json->decode($value);
}
}