Repository navigation
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·109 lines (91 loc) · 2.36 KB
/
Copy pathfunctions.php
File metadata and controls
executable file
·109 lines (91 loc) · 2.36 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
namespace Pre\Plugin;
if (!function_exists("\\Pre\\Plugin\\find")) {
function find($file, $iterations = 10, $prefix = __DIR__)
{
$folder = "../";
if ($prefix) {
$folder = "{$prefix}/{$folder}";
}
for ($i = 0; $i < $iterations; $i++) {
$try = "{$folder}{$file}";
if (file_exists($try)) {
return realpath($try);
}
$folder .= "../";
}
}
}
if (!function_exists("\\Pre\\Plugin\\base")) {
function base()
{
$vendor = find("vendor");
return realpath("{$vendor}/../");
}
}
if (!function_exists("\\Pre\\Plugin\\instance")) {
function instance()
{
static $instance = null;
if ($instance === null) {
$instance = new Parser();
}
return $instance;
}
}
if (!function_exists("\\Pre\\Plugin\\process")) {
function process($from, $to = null, $format = true, $comment = true)
{
$instance = instance();
return $instance->process($from, $to, $format, $comment);
}
}
if (!function_exists("\\Pre\\Plugin\\compile")) {
function compile($from, $to, $format = true, $comment = true)
{
$instance = instance();
return $instance->compile($from, $to, $format, $comment);
}
}
if (!function_exists("\\Pre\\Plugin\\parse")) {
function parse($code)
{
$instance = instance();
return $instance->parse($code);
}
}
if (!function_exists("\\Pre\\Plugin\\format")) {
function format($code)
{
$instance = instance();
return $instance->format($code);
}
}
if (!function_exists("\\Pre\\Plugin\\addMacro")) {
function addMacro($macro)
{
$instance = instance();
return $instance->addMacro($macro);
}
}
if (!function_exists("\\Pre\\Plugin\\removeMacro")) {
function removeMacro($macro)
{
$instance = instance();
return $instance->removeMacro($macro);
}
}
if (!function_exists("\\Pre\\Plugin\\addCompiler")) {
function addCompiler($compiler, $callable)
{
$instance = instance();
return $instance->addCompiler($compiler, $callable);
}
}
if (!function_exists("\\Pre\\Plugin\\removeCompiler")) {
function removeCompiler($compiler)
{
$instance = instance();
return $instance->removeCompiler($compiler);
}
}