Example #1
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', true);
define("DS", DIRECTORY_SEPARATOR);
define("ROOT", dirname(dirname(__FILE__)) . DS . 'projetofw2');
#define("ROOT", dirname(dirname(__FILE__)));
require_once ROOT . DS . 'config' . DS . 'config.php';
session_cache_limiter(2400);
Config::ConfigCharset();
Config::DefinirTimeZone();
function autoLoader($className)
{
    $directories = array('', ROOT . DS . '', ROOT . DS . 'config' . DS, ROOT . DS . 'css' . DS, ROOT . DS . 'js' . DS, ROOT . DS . 'dados' . DS, ROOT . DS . 'seguranca' . DS, ROOT . DS . 'controllers' . DS, ROOT . DS . 'libs' . DS, ROOT . DS . 'models' . DS, ROOT . DS . 'views' . DS, ROOT . DS . 'helpers' . DS);
    $fileNameFormats = array('%s.php', '%s.lib.php', '%s.class.php', '%s.inc.php', '%s.config.php', '%s.css', '%s.js');
    foreach ($directories as $directory) {
        foreach ($fileNameFormats as $fileNameFormat) {
            $path = $directory . sprintf($fileNameFormat, strtolower($className));
            //echo $path."<br/>";
            if (file_exists($path)) {
                #echo "encontrado!!!<br/><br/>";
                include_once $path;
                return;
            }
        }
    }
}
spl_autoload_register('autoLoader');