Author: Raymond Bosman
Date: 2006-05-29 09:51:53 +0200 (Mon, 29 May 2006)
New Revision: 2940

Log:
- Moved the base64 encode and decode functions from the web to the string group.
- Updated the Changelog for a previous commit.

Modified:
   trunk/Template/ChangeLog
   trunk/Template/docs/functions/string.txt
   trunk/Template/src/functions/function_to_class.php
   trunk/Template/src/functions/string_functions.php
   trunk/Template/src/functions/web_functions.php
   trunk/Template/tests/regression_tests/functions/correct/string_functions.in
   trunk/Template/tests/regression_tests/functions/correct/string_functions.out
   trunk/Template/tests/regression_tests/functions/correct/web_functions.in
   trunk/Template/tests/regression_tests/functions/correct/web_functions.out

Modified: trunk/Template/ChangeLog
===================================================================
--- trunk/Template/ChangeLog    2006-05-29 07:51:16 UTC (rev 2939)
+++ trunk/Template/ChangeLog    2006-05-29 07:51:53 UTC (rev 2940)
@@ -23,6 +23,7 @@
 - Fixed a bug that the break and continue tags could contain garbage.
   E.g. {break abcd}
 - Fixed a bug that the column number in error messages were incorrect.
+- Fixed a bug that the hash_intersect_key function was mapped wrong.
 - Fixed bug #8280: Array assignment with non-constants not working.
 - All compile errors throw the ezcTemplateParserException.  Removed the 
   ezcTemplateSourceToTstParserException.

Modified: trunk/Template/docs/functions/string.txt
===================================================================
--- trunk/Template/docs/functions/string.txt    2006-05-29 07:51:16 UTC (rev 
2939)
+++ trunk/Template/docs/functions/string.txt    2006-05-29 07:51:53 UTC (rev 
2940)
@@ -41,6 +41,8 @@
 * int str_paragraph_count_ ( string *$str* )
 * string str_replace_ ( string *$before*, int *$index*, int *$length*, string 
*$replace*)
 * string str_wrap_ ( string *$str*, int *$width*, string *$break* [, bool 
*$cut_word*] )
+* string str_base64_encode_ ( string *$str* )
+* string str_base64_decode_ ( string *$str* )
 
 
 string _`str_replace` ( string *$before*, int *$index*, int *$length*, string 
*$replace*)
@@ -566,7 +568,30 @@
    he word 'party' as a
    verb in this shop!
 
+string _`str_base64_encode` ( string *$str* )
+`````````````````````````````````````````````
+Returns a MIME base64 encoded string from the *$str*::
 
+    {str_base64_encode( "I don't want to be encoded!" )}
+    
+Outputs::
+
+    SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh
+
+
+string _`str_base64_decode` ( string *$str* )
+``````````````````````````````````````````````
+Decodes the given MIME base64 *$str* and returns the original data::
+
+    {str_base64_decode( "SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh" )}
+    
+Outputs::
+
+    I don't want to be encoded!
+
+
+
+
 
 ..
    Local Variables:

Modified: trunk/Template/src/functions/function_to_class.php
===================================================================
--- trunk/Template/src/functions/function_to_class.php  2006-05-29 07:51:16 UTC 
(rev 2939)
+++ trunk/Template/src/functions/function_to_class.php  2006-05-29 07:51:53 UTC 
(rev 2940)
@@ -12,7 +12,7 @@
 ( 
 
 "/^str_.*/" => "ezcTemplateStringFunctions",
-"/^(base64_|url_).*/" => "ezcTemplateWebFunctions",
+"/^url_.*/" => "ezcTemplateWebFunctions",
 "/^date_.*/" => "ezcTemplateDateFunctions",
 "/^array_.*/" => "ezcTemplateArrayFunctions",
 "/^hash_.*/" => "ezcTemplateArrayFunctions",

Modified: trunk/Template/src/functions/string_functions.php
===================================================================
--- trunk/Template/src/functions/string_functions.php   2006-05-29 07:51:16 UTC 
(rev 2939)
+++ trunk/Template/src/functions/string_functions.php   2006-05-29 07:51:53 UTC 
(rev 2940)
@@ -290,6 +290,14 @@
             case "str_wrap": return array( ezcTemplateAstNode::TYPE_VALUE, 
array( "%string", "%width", "%break", "[%cut]" ), 
                     self::functionCall( "wordwrap", array( "%string", 
"%width", "%break", "[%cut]" ) ) );
 
+            // base64_encode( $s )
+            case "str_base64_encode":
+                return array( ezcTemplateAstNode::TYPE_VALUE, array( "%string" 
), self::functionCall( "base64_encode", array( "%string" ) ) );
+            
+            // base64_decode( $s )
+            case "str_base64_decode":
+                return array( ezcTemplateAstNode::TYPE_VALUE, array( "%string" 
), self::functionCall( "base64_decode", array( "%string" ) ) );
+ 
             // 
             // - *string* str_wrap_indent::
             // 

Modified: trunk/Template/src/functions/web_functions.php
===================================================================
--- trunk/Template/src/functions/web_functions.php      2006-05-29 07:51:16 UTC 
(rev 2939)
+++ trunk/Template/src/functions/web_functions.php      2006-05-29 07:51:53 UTC 
(rev 2940)
@@ -20,14 +20,6 @@
     {
         switch( $functionName )
         {
-            // base64_encode( $s )
-            case "base64_encode":
-                return array( array( "%string" ), self::functionCall( 
"base64_encode", array( "%string" ) ) );
-            
-            // base64_decode( $s )
-            case "base64_decode":
-                return array( array( "%string" ), self::functionCall( 
"base64_decode", array( "%string" ) ) );
-            
             // url_encode( $s )
             case "url_encode":
                 return array( array( "%string" ), self::functionCall( 
"urlencode", array( "%string" ) ) );

Modified: 
trunk/Template/tests/regression_tests/functions/correct/string_functions.in
===================================================================
--- trunk/Template/tests/regression_tests/functions/correct/string_functions.in 
2006-05-29 07:51:16 UTC (rev 2939)
+++ trunk/Template/tests/regression_tests/functions/correct/string_functions.in 
2006-05-29 07:51:53 UTC (rev 2940)
@@ -43,3 +43,5 @@
 
 two paragraphs")}
 36. {str_wrap("abcdefghijklmnop", 4, "\n", true)}{str_wrap("qrst asdf asdf", 
5, "\n")} 
+37. {str_base64_encode( "I don't want to be encoded!" )}
+38. {str_base64_decode( "SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh" )}

Modified: 
trunk/Template/tests/regression_tests/functions/correct/string_functions.out
===================================================================
--- 
trunk/Template/tests/regression_tests/functions/correct/string_functions.out    
    2006-05-29 07:51:16 UTC (rev 2939)
+++ 
trunk/Template/tests/regression_tests/functions/correct/string_functions.out    
    2006-05-29 07:51:53 UTC (rev 2940)
@@ -41,4 +41,6 @@
 ijkl
 mnopqrst
 asdf
-asdf
+asdf 
+37. SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh
+38. I don't want to be encoded!

Modified: 
trunk/Template/tests/regression_tests/functions/correct/web_functions.in
===================================================================
--- trunk/Template/tests/regression_tests/functions/correct/web_functions.in    
2006-05-29 07:51:16 UTC (rev 2939)
+++ trunk/Template/tests/regression_tests/functions/correct/web_functions.in    
2006-05-29 07:51:53 UTC (rev 2940)
@@ -1,5 +1,3 @@
-1. {base64_encode( "I don't want to be encoded!" )}
-2. {base64_decode( "SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh" )}
 3. {url_encode( "some string / for & an % URL" )}
 4. {url_decode( "some+string+%2F+for+%26+an+%25+URL" )}
 5. {url_parameters_build( array( "foo" => "bar", "baz" => "foo" ) )}

Modified: 
trunk/Template/tests/regression_tests/functions/correct/web_functions.out
===================================================================
--- trunk/Template/tests/regression_tests/functions/correct/web_functions.out   
2006-05-29 07:51:16 UTC (rev 2939)
+++ trunk/Template/tests/regression_tests/functions/correct/web_functions.out   
2006-05-29 07:51:53 UTC (rev 2940)
@@ -1,5 +1,3 @@
-1. SSBkb24ndCB3YW50IHRvIGJlIGVuY29kZWQh
-2. I don't want to be encoded!
 3. some+string+%2F+for+%26+an+%25+URL
 4. some string / for & an % URL
 5. foo=bar&baz=foo

-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to