diff options
author | xue <> | 2006-04-25 01:31:43 +0000 |
---|---|---|
committer | xue <> | 2006-04-25 01:31:43 +0000 |
commit | 5ba6cd4be568f686d890835a77586077cde1a943 (patch) | |
tree | 54138a79e147bcfb0f6833d2d284a2f825c18f2a /framework/Web/Javascripts/TJavaScript.php | |
parent | 1afc913c386bba8e6072c278b0eb4fd9818ab310 (diff) |
Merge from 3.0 branch till 967.
Diffstat (limited to 'framework/Web/Javascripts/TJavaScript.php')
-rw-r--r-- | framework/Web/Javascripts/TJavaScript.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index 4066565b..a3848201 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -96,9 +96,16 @@ class TJavaScript * //expects the following javascript code
* // {'onLoading':'doit','onComplete':'more'}
* </code>
+ *
+ * To pass raw javascript statements start strings with
+ * <tt>javascript:</tt>. E.g.
+ * <code>
+ * $options['onLoading'] = "javascript:function(){ alert('hello'); }";
+ * //outputs {'onLoading':function(){ alert('hello'); }}
+ * </code>
*
- * For higher complexity data structures use {@link jsonEncode} and {@link jsonDecode}
- * to serialize and unserialize.
+ * For higher complexity data structures use {@link jsonEncode} and {@link
+ * jsonDecode} to serialize and unserialize.
*
* @param mixed PHP variable to be encoded
* @param boolean whether the output is a map or a list.
@@ -115,6 +122,8 @@ class TJavaScript if(($first==='[' && $last===']') || ($first==='{' && $last==='}'))
return $value;
}
+ else if(strpos($value, 'javascript:')===0)
+ return substr($value,11);
return "'".self::quoteString($value)."'";
}
else if(is_bool($value))
|