X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=template.php;h=5d35ff7731aa1d095808d03fd33b3fa44789fd8c;hb=35b2973c5ed7fbba047cf67a5e84957bfdedc7c7;hp=a20fd64b775964f4ee78e1165961d3ce335f5873;hpb=df03dc0feb1ecbab9aa238b46167faca504b1547;p=wfpl.git
diff --git a/template.php b/template.php
index a20fd64..5d35ff7 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;
}