<?php
/**
* Módulo padrão para todas as funções, responsável por carregar as classes e incluir funções globais
*
* @author Lucas/Postali
*/
define('REQUIRED_PHP_VERSION', '8.3');
define('MAIN_FOLDER', __DIR__);
/**
* Nomraliza os separadores de um nome de arquivo
* @param string $file Nome do arquivo
* @return string
*/
function normalizeDirSeparator($file)
{
return preg_replace("/\\/|\\\\/", DIRECTORY_SEPARATOR, $file);
}
require_once('utils.php');
set_error_handler(
function ($errno, $errstr, $errfile, $errline) {
// Filtra erros de acordo com o nível de erro desejado
if ($errno === E_WARNING || $errno === E_NOTICE) {
\Core::log([$errno, $errstr, $errfile, $errline]);
return false; // Ignora esses tipos de erro
}
throw new Exception($errstr, $errno);
}
);
set_exception_handler(
function ($err) {
HandlerException($err);
}
);
//Função de carregamento automático das classes
function _autoload($class)
{
$folders = array(
array('Modules', 'Custom'),
array('Modules', 'Core'),
array('Modules', 'Classes'),
array('Controllers'),
array('Modules', 'Traits'),
array('vendor'),
array('Modules', 'Libraries'),
array('Modules', 'Interfaces'),
array('Models'),
array("Scripts")
);
foreach ($folders as $folder) {
$file = MAIN_FOLDER . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $folder) . DIRECTORY_SEPARATOR . normalizeDirSeparator($class) . '.php';
if (file_exists($file)) {
//trace("Loading class '$class' from file '$file'", 'main', $class, TRACE_LOW);
require_once($file);
return;
}
}
trace("Class '$class' not found", 'main', $class, TRACE_ERROR);
throw new Exception("Class '$class' not found", 1);
}
//Auto registrar classes
spl_autoload_register('_autoload');
$composerAutoloadFile = MAIN_FOLDER . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
if (file_exists($composerAutoloadFile)) {
require_once($composerAutoloadFile);
} else {
Error('The composer autoload is not installed. Run composer install on console');
}
trace('System ready', 'main', MAIN_FOLDER, TRACE_LOW);
You can see detailed error trace in the console.
render ()
/var/www/homologacao-parceiros.gazinsemijoias.com.br/index.php 20
parseMethod ()
/var/www/homologacao-parceiros.gazinsemijoias.com.br/Modules/Core/Navigation/Page.php 377
show ()
/var/www/homologacao-parceiros.gazinsemijoias.com.br/Modules/Core/Utils/Util.php 206
{closure} ()
/var/www/homologacao-parceiros.gazinsemijoias.com.br/Modules/Classes/SEO/Sitemap.php 159
You can see detailed error trace in the console.
main
System ready
'/var/www/homologacao-parceiros.gazinsemijoias.com.br'
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.95'
Navigation\Navigation
Interpreting URI
'sitemap.xml'