-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.php
More file actions
89 lines (71 loc) · 2.9 KB
/
Plugin.php
File metadata and controls
89 lines (71 loc) · 2.9 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
<?php namespace Code200\Developer;
use Illuminate\Support\Facades\Lang;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public function __construct(\Illuminate\Contracts\Foundation\Application $app)
{
parent::__construct($app);
ini_set('xdebug.var_display_max_depth', 3);
ini_set('xdebug.var_display_max_children', 64);
ini_set('xdebug.var_display_max_data', 64);
// ini_set('xdebug.max_nesting_level', 64);
}
public function register()
{
parent::register();
$this->registerConsoleCommand('developer.dbbackup', 'Code200\Developer\Console\Dbbackup');
$this->registerConsoleCommand('developer.gradimtransfercategories', 'Code200\Developer\Console\GradimTransferCategories');
$this->registerConsoleCommand('developer.gradimtransferposts', 'Code200\Developer\Console\GradimTransferPosts');
$this->registerConsoleCommand('developer.gradimtransfersearch', 'Code200\Developer\Console\GradimTransferSearch');
}
// public function registerComponents()
// {
// }
//
// public function registerSettings()
// {
// }
public function registerMarkupTags()
{
return [
// 'filters' => [
// // A global function, i.e str_plural()
// 'plural' => 'str_plural',
//
// // A local method, i.e $this->makeTextAllCaps()
// 'uppercase' => [$this, 'makeTextAllCaps']
// ],
'functions' => [
// A static method call, i.e Form::open()
// 'printr' => ['October\Rain\Html\Form', 'open'],
'php_var_dump' => function($object) {
var_dump($object);
},
'php_print_r' => function($object, $format = false) {
if($format) echo '<pre>';
print_r($object);
if($format) echo '</pre>';
},
//@todo move this -> developer plugin shouldnt be in production
'UID' => function() {
//@todo move this thing to config !!!!
$salt = "ljh8o24#$&aDSFGG#T23da%#";
function getClientIp() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
$ip = getClientIp();
$uid = md5($ip . $salt . $_SERVER['HTTP_USER_AGENT']);
return $uid;
}
]
];
}
}