From: Jason Woofenden Date: Tue, 19 Dec 2006 07:09:23 +0000 (-0500) Subject: added missing format_url needed by metaform X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=fe7ab127fc133be74b2601cbaa3ae789d7e2a2d7 added missing format_url needed by metaform template can now handle multiple encodings for one var, eg foo.html.sql --- diff --git a/format.php b/format.php index b9270bd..60d0bf0 100644 --- a/format.php +++ b/format.php @@ -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) { diff --git a/template.php b/template.php index 239630c..9808526 100644 --- a/template.php +++ b/template.php @@ -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.
\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.
\n"; + exit(1); + } } } return $value;