|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use PSFS\base\extension\CustomTranslateExtension; |
|
4
|
|
|
use Symfony\Component\Finder\Finder; |
|
5
|
|
|
//Cargamos en memoria la función de desarrollo PRE |
|
6
|
|
|
if (!function_exists('pre')) { |
|
7
|
|
|
function pre($var, $die = FALSE) |
|
8
|
|
|
{ |
|
9
|
|
|
$html = '<pre style="padding:10px;margin:0;display:block;background: #EEE; box-shadow: inset 0 0 3px 3px #DDD; color: #666; text-shadow: 1px 1px 1px #CCC;border-radius: 5px;">'; |
|
10
|
|
|
$html .= (is_null($var)) ? '<b>NULL</b>' : print_r($var, TRUE); |
|
11
|
|
|
$html .= '</pre>'; |
|
12
|
|
|
ob_start(); |
|
13
|
|
|
echo $html; |
|
14
|
|
|
ob_flush(); |
|
15
|
|
|
ob_end_clean(); |
|
16
|
|
|
if ($die) { |
|
17
|
|
|
die; |
|
18
|
|
|
} |
|
19
|
|
|
} |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
if (!function_exists('jpre')) { |
|
23
|
|
|
function jpre($var, $die = false) |
|
24
|
|
|
{ |
|
25
|
|
|
echo json_encode($var, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
|
26
|
|
|
if ($die) { |
|
27
|
|
|
die; |
|
28
|
|
|
} |
|
29
|
|
|
} |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
if (!function_exists("getallheaders")) { |
|
33
|
|
|
function getallheaders() |
|
34
|
|
|
{ |
|
35
|
|
|
$headers = array(); |
|
36
|
|
|
foreach ($_SERVER as $h => $v) |
|
37
|
|
|
if (preg_match('/HTTP_(.+)/', $h, $hp)) |
|
38
|
|
|
$headers[$hp[1]] = $v; |
|
39
|
|
|
return $headers; |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
if (file_exists(CORE_DIR)) { |
|
44
|
|
|
$loaded_files = []; |
|
45
|
|
|
//Autoload de módulos |
|
46
|
|
|
$finder = new Finder(); |
|
47
|
|
|
$finder->files()->in(CORE_DIR)->name('autoload.php'); |
|
48
|
|
|
/* @var $file SplFileInfo */ |
|
49
|
|
|
foreach ($finder as $file) { |
|
50
|
|
|
$path = $file->getRealPath(); |
|
51
|
|
|
if(!in_array($path, $loaded_files)) { |
|
52
|
|
|
$loaded_files[] = $path; |
|
53
|
|
|
require_once($path); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
if(!function_exists('t')) { |
|
59
|
|
|
function t($message, $key = null, $reload = false) { |
|
60
|
|
|
return CustomTranslateExtension::_($message, $key, $reload); |
|
61
|
|
|
} |
|
62
|
|
|
} |