aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys/init_ste.php
blob: 567a32bc40045e9c92c56c18ab88fc3d58236028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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));
	}
);

?>