JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added missing format_url needed by metaform
authorJason Woofenden <jason183@herkamire.com>
Tue, 19 Dec 2006 07:09:23 +0000 (02:09 -0500)
committerJason Woofenden <jason183@herkamire.com>
Tue, 19 Dec 2006 07:09:23 +0000 (02:09 -0500)
template can now handle multiple encodings for one var, eg foo.html.sql

format.php
template.php

index b9270bd..60d0bf0 100644 (file)
@@ -44,6 +44,11 @@ function format_email($str) {
        return format_oneline($str);
 }
 
+function format_url($str) {
+       # FIXME
+       return format_oneline($str);
+}
+
 function format_money($str, $display_cents = true) {
        $str = ereg_replace('[^0-9.]', '', $str);
        if($display_cents) {
index 239630c..9808526 100644 (file)
@@ -33,6 +33,9 @@
 # tem_output('filename.html') to output the page. A more complex example
 # including the use of sub-templates can be found in tem_test.php
 
+# FIXME: sub-sub templates need to be cleared when the sub template containing
+# them is run
+
 require_once('code/wfpl/encode.php');
 require_once('code/wfpl/basics.php');
 
@@ -191,12 +194,15 @@ function template_filler($matches) {
        list($tag, $enc) = explode('.', $matches[1], 2);
        $value = $GLOBALS['wfpl_template_keyval'][$tag];
        if($enc) {
-               $enc = "enc_$enc";
-               if(function_exists($enc)) {
-                       $value = $enc($value);
-               } else {
-                       print "ERROR: encoder function '$enc' not found.<br>\n";
-                       exit(1);
+               $encs = explode('.', $enc);
+               foreach($encs as $enc) {
+                       $enc = "enc_$enc";
+                       if(function_exists($enc)) {
+                               $value = $enc($value);
+                       } else {
+                               print "ERROR: encoder function '$enc' not found.<br>\n";
+                               exit(1);
+                       }
                }
        }
        return $value;