aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys/init_ste.php
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2011-09-21 17:00:50 +0200
committerKevin Chabowski <kevin@kch42.de>2011-09-21 17:00:50 +0200
commit8311cba002dfcaf1836530b978f944f7228ac004 (patch)
treed8ff9eac15957194a53e4c6e94d4bd9eb2d89c2d /ratatoeskr/sys/init_ste.php
parenta85e1fbbfbbaef176141e98a4691273cd06d0a65 (diff)
downloadratatoeskr-cms-8311cba002dfcaf1836530b978f944f7228ac004.tar.gz
ratatoeskr-cms-8311cba002dfcaf1836530b978f944f7228ac004.tar.bz2
ratatoeskr-cms-8311cba002dfcaf1836530b978f944f7228ac004.zip
Replaced Smarty with STE and started the backend.
Diffstat (limited to 'ratatoeskr/sys/init_ste.php')
-rw-r--r--ratatoeskr/sys/init_ste.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/ratatoeskr/sys/init_ste.php b/ratatoeskr/sys/init_ste.php
new file mode 100644
index 0000000..567a32b
--- /dev/null
+++ b/ratatoeskr/sys/init_ste.php
@@ -0,0 +1,46 @@
+<?php
+
+/*
+ * File: ratatoeskr/sys/init_ste.php
+ *
+ * When included, the file will initialize the global STECore instance.
+ *
+ * License:
+ * This file is part of Ratatöskr.
+ * Ratatöskr is licensed unter the MIT / X11 License.
+ * See "ratatoeskr/licenses/ratatoeskr" for more information.
+ */
+
+require_once(dirname(__FILE__) . "/../libs/stupid_template_engine.php");
+
+$tpl_basedir = dirname(__FILE__) . "/../templates";
+
+if(!isset($ste))
+{
+ /*
+ * Variable: $ste
+ *
+ * The global STECore (Stupid Template Engine) instance.
+ */
+ $ste = new \ste\STECore(new \ste\FilesystemStorageAccess("$tpl_basedir/src", "$tpl_basedir/transc"));
+}
+
+$ste->register_tag(
+ "l10n_replace",
+ function($ste, $params, $sub)
+ {
+ $content = $sub($ste);
+ foreach($params as $name => $replace)
+ $content = str_replace("[[$name]]", $replace, $content);
+ return $content;
+ }
+);
+$ste->register_tag(
+ "capitalize",
+ function($ste, $params, $sub)
+ {
+ return ucwords($sub($ste));
+ }
+);
+
+?>