|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Codexshaper\WP\Application; |
|
4
|
|
|
use Illuminate\Container\Container; |
|
5
|
|
|
|
|
6
|
|
|
if (!function_exists('csrf_token')) { |
|
7
|
|
|
function csrf_token($action = 'wbp_nonce') |
|
8
|
|
|
{ |
|
9
|
|
|
return wp_create_nonce($action); |
|
10
|
|
|
} |
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
if (!function_exists('app')) { |
|
14
|
|
|
/** |
|
15
|
|
|
* Get the available container instance. |
|
16
|
|
|
* |
|
17
|
|
|
* @param string|null $abstract |
|
18
|
|
|
* @param array $parameters |
|
19
|
|
|
* |
|
20
|
|
|
* @return mixed|\Illuminate\Contracts\Foundation\Application |
|
21
|
|
|
*/ |
|
22
|
|
|
function app($abstract = null, array $parameters = []) |
|
|
|
|
|
|
23
|
|
|
{ |
|
24
|
|
|
$app = new Application(); |
|
25
|
|
|
var_dump($app->app); |
|
|
|
|
|
|
26
|
|
|
die(); |
|
27
|
|
|
if (is_null($abstract) && $container != null) { |
|
|
|
|
|
|
28
|
|
|
return $container; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
return Container::getInstance()->make($abstract, $parameters); |
|
32
|
|
|
} |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
if (!function_exists('config')) { |
|
36
|
|
|
/** |
|
37
|
|
|
* Get / set the specified configuration value. |
|
38
|
|
|
* |
|
39
|
|
|
* If an array is passed as the key, we will assume you want to set an array of values. |
|
40
|
|
|
* |
|
41
|
|
|
* @param array|string|null $key |
|
42
|
|
|
* @param mixed $default |
|
43
|
|
|
* |
|
44
|
|
|
* @return mixed|\Illuminate\Config\Repository |
|
45
|
|
|
*/ |
|
46
|
|
|
function config($key = null, $default = null) |
|
47
|
|
|
{ |
|
48
|
|
|
if (is_null($key)) { |
|
49
|
|
|
return app('config'); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
if (is_array($key)) { |
|
53
|
|
|
return app('config')->set($key); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
return app('config')->get($key, $default); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
if (!function_exists('view')) { |
|
61
|
|
|
function view($view, $data = [], $mergeData = []) |
|
|
|
|
|
|
62
|
|
|
{ |
|
63
|
|
|
global $app; |
|
64
|
|
|
|
|
65
|
|
|
if (!class_exists(\CodexShaper\Blade\View::class)) { |
|
66
|
|
|
throw new \Exception('View not resolved. Please install View'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return (new \CodexShaper\Blade\View([], '', $app))->make($view, $data = [], $mergeData = []); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.