X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=blobdiff_plain;f=template.php;h=06d02f551279e8cf142de9a2e81f7754b568ca8e;hp=a20fd64b775964f4ee78e1165961d3ce335f5873;hb=15459c86d0996ab3037b1738a8be6efd378c1258;hpb=df03dc0feb1ecbab9aa238b46167faca504b1547 diff --git a/template.php b/template.php index a20fd64..06d02f5 100644 --- a/template.php +++ b/template.php @@ -37,9 +37,9 @@ # tem_auto_* function to munge the data, automating certain common use # cases. See the comments on the tem_auto functions for more details. -require_once('code/wfpl/encode.php'); -require_once('code/wfpl/file.php'); -require_once('code/wfpl/misc.php'); +require_once(__DIR__.'/'.'encode.php'); +require_once(__DIR__.'/'.'file.php'); +require_once(__DIR__.'/'.'misc.php'); # Top-Level Functions @@ -209,10 +209,14 @@ function &tem_row_data($tem, $context) if(count($tem['args'])) { $auto_func = "tem_auto_" . $tem['args'][0]; - function_exists($auto_func) - or die("ERROR: template auto function '$auto_func' not found.
\n"); + if (!function_exists($auto_func)) { + die("ERROR: template auto function '$auto_func' not found.
\n"); + } + # NAMESPACIFY $auto_func + } + if ($auto_func) { + $value = $auto_func($scope['data'][$key], $key, $scope, $tem['args']); } - if($auto_func) $value = $auto_func($scope['data'][$key], $key, $scope); else $value = $scope['data'][$key]; $rows = tem_data_as_rows($value, $key); @@ -228,8 +232,12 @@ function tem_encoded_data($tag, $context) $value = tem_get_data($key, $context); foreach($tag['args'] as $encoding) { $func = "enc_$encoding"; - if(function_exists($func)) $value = $func($value, $key); - else die("ERROR: encoder function '$func' not found.
\n"); + if (function_exists($func)) { + # NAMESPACIFY $func + $value = $func($value, $key); + } else { + die("ERROR: encoder function '$func' not found.
\n"); + } } return $value; }