forked from ChristopherDay/Gangster-Legends-V2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
59 lines (51 loc) · 1.84 KB
/
test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
$roleForm = '
<form method="post" action="?page=admin&module=userRoles&action={editType}&id={id}">
<div class="row">
<div class="col-md-10">
<div class="form-group">
<label class="pull-left">Name</label>
<input type="text" class="form-control" name="name" value="{name}">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label class="pull-left">
Color <br />
<input type="color" name="color" value="{color}">
</label>
</div>
</div>
</div>
{#if canAlterModules}
<h3>Admin Modules</h3>
<ul class="list-group">
{#each modules}
{#if admin}
<li class="list-group-item col-md-4">
<input type="checkbox" name="access[]" value="{id}" {#if selected} checked{/if}> {name}
</li>
{/if}
{/each}
</ul>
<div class="clearfix"></div>
{/if}
<div class="text-right">
<button class="btn btn-default" name="submit" type="submit" value="1">
Save
</button>
</div>
</form>
';
function parse($html) {
$html = preg_replace_callback(
'#\{\#if (.+)\}(((?R)|.+)+)\{\/if}#iUs',
function ($a) {
htmlentities(print_r(parse($a), true));
},
$html
);
return $html;
}
echo "<pre>" . parse($roleForm);
?>