<?php
2/**
3* Módulo padrão para todas as funções, responsável por carregar as classes e incluir funções globais
4*
5* @author Lucas/Postali
6*/
7
8 define('REQUIRED_PHP_VERSION', '8.2');
9
10 define('MAIN_FOLDER', __DIR__);
11
12 /**
13 * Nomraliza os separadores de um nome de arquivo
14 * @param string $file Nome do arquivo
15 * @return string
16 */
17 function normalizeDirSeparator ($file)
18 {
19 return preg_replace("/\\/|\\\\/", DIRECTORY_SEPARATOR, $file);
20 }
21
22 require_once('utils.php');
23
24 set_error_handler(
25 function ($errno, $errstr, $errfile, $errline) {
26 throw new Exception($errstr, $errno);
27 }
28 );
29
30 set_exception_handler(
31 function ($err) {
32 HandlerException($err);
33 }
34 );
35
36 //Função de carregamento automático das classes
37 function _autoload ($class)
38 {
39 $folders = array(
40 array('Modules','Custom'),
41 array('Modules','Core'),
42 array('Modules','Classes'),
43 array('Controllers'),
44 array('Modules','Traits'),
45 array('vendor'),
46 array('Modules','Libraries'),
47 array('Modules','Interfaces'),
48 array('Models')
49 );
50
51 foreach($folders as $folder)
52 {
53 $file = MAIN_FOLDER . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $folder) . DIRECTORY_SEPARATOR . normalizeDirSeparator($class) . '.php';
54
55 if(file_exists($file))
56 {
57 //trace("Loading class '$class' from file '$file'", 'main', $class, TRACE_LOW);
58 require_once($file);
59 return;
60 }
61 }
62
63 trace("Class '$class' not found", 'main', $class, TRACE_ERROR);
64 throw new Exception("Class '$class' not found", 1);
65 }
66
67 //Auto registrar classes
68 spl_autoload_register('_autoload');
69
70 $composerAutoloadFile = MAIN_FOLDER . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
71
72 if(file_exists($composerAutoloadFile))
73 require_once($composerAutoloadFile);
74 else
75 Error('The composer autoload is not installed. Run composer install on console');
76
77 trace('System ready', 'main', MAIN_FOLDER, TRACE_LOW);
78
You can see detailed error trace in the console.
render ()
/home/savane/domains/dev.savane.com.br/public_html/index.php 19
parseMethod ()
/home/savane/domains/dev.savane.com.br/public_html/Modules/Core/Navigation/Page.php 377
show ()
/home/savane/domains/dev.savane.com.br/public_html/Modules/Core/Utils/Util.php 209
{closure} ()
/home/savane/domains/dev.savane.com.br/public_html/Modules/Classes/SEO/Sitemap.php 159
You can see detailed error trace in the console.
main
System ready
'/home/savane/domains/dev.savane.com.br/public_html'
web
Starting session
true
web
Starting web module
''
Navigation\Navigation
Setting Navigation default timezone
'America/Sao_Paulo'
Navigation\Navigation
Setting Navigation default language
false
web
User
'216.73.216.175'
Navigation\Navigation
Interpreting URI
'sitemap.xml'