-
Notifications
You must be signed in to change notification settings - Fork 0
/
patches.php
46 lines (36 loc) · 821 Bytes
/
patches.php
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
namespace zazzle\patches;
global $PatchStack;
$PatchStack = [];
function add_stack($name, $path){
global $PatchStack;
$PatchStack[$name] = $path;
}
function stitch($alias){
global $PatchStack;
if($alias[0] == "@"){
$alias = $PatchStack[substr($alias, 1, strlen($alias)-1)];
}
$data = patchesConfig::$TemplateAliases;
$path = explode(":", $alias);
$path = array_reverse($path);
$current = $data;
while(is_array($current)){
$find = array_pop($path);
//echo "finding ".$find."<br>";
$current = find($find, $current);
if(!$current){
echo $alias;
die("No thing here");};
}
require(\zazzle\core\Registry::$MODULES['patches']->TemplateDir.$current);
}
function find($target, $stack){
foreach($stack as $k=>$v){
if($k === $target){
return $v;
}
}
return false;
}
?>