forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMustacheOptions.php
More file actions
53 lines (43 loc) · 1.28 KB
/
MustacheOptions.php
File metadata and controls
53 lines (43 loc) · 1.28 KB
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
<?php
namespace ProcessMaker\Bpmn;
use Illuminate\Support\Facades\Hash;
use Mustache_LambdaHelper;
class MustacheOptions
{
public $helpers = [];
public function __construct()
{
$this->helpers = [
'base64' => [$this, 'base64'],
'html64' => [$this, 'html64'],
'key' => [$this, 'key'],
'json' => [$this, 'json'],
'serialize' => [$this, 'serialize'],
'xml' => [$this, 'xml'],
];
}
public function html64($text, Mustache_LambdaHelper $helper)
{
return base64_encode('<html><body>' . $helper->render($text) . '</body></html>');
}
public function base64($text, Mustache_LambdaHelper $helper)
{
return base64_encode($helper->render($text));
}
public function key($text, Mustache_LambdaHelper $helper)
{
return urlencode(Hash::make($helper->render($text)));
}
public function json($text, Mustache_LambdaHelper $helper)
{
return json_encode($helper->render($text));
}
public function serialize($text, Mustache_LambdaHelper $helper)
{
return serialize($helper->render($text));
}
public function xml($text, Mustache_LambdaHelper $helper)
{
return xmlrpc_encode($helper->render($text));
}
}