public function __construct()
 {
     parent::__construct();
     $this->cacheFile = dirname(__FILE__) . 'class_path_cache.txt';
     $this->removeCacheFile();
     include_once dirname(dirname(dirname(__FILE__))) . '/extras/Autoloader.class.php';
     Autoloader::addClassPath(dirname(__FILE__) . '/classes_app/');
     Autoloader::addClassPath(dirname(__FILE__) . '/classes_shared/');
     Autoloader::setCacheFilePath($this->cacheFile);
     //Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\..*$/');
     spl_autoload_register(array('Autoloader', 'loadClass'));
 }
Exemple #2
0
 function setDirectory($dir)
 {
     $this->directory = $dir;
     Autoloader::addClassPath(DIR . $dir . '/');
 }
Exemple #3
0
 * 
 *     <code>
 *     include_once('coughphp/extras/Autoloader.class.php');
 *     Autoloader::addClassPath('app_path/classes/');
 *     Autoloader::addClassPath('shared_path/classes/');
 *     Autoloader::setCacheFilePath('app_path/tmp/class_path_cache.txt');
 *     Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\..*$/');
 *     spl_autoload_register(array('Autoloader', 'loadClass'));
 *     </code>
 * 
 * @package default
 * @author Anthony Bush, Wayne Wight
 * @copyright 2006-2008 Academic Superstore. This software is open source protected by the FreeBSD License.
 * @version 2008-09-22
 **/
Autoloader::addClassPath(DIR . 'library/');
spl_autoload_register(array('Autoloader', 'loadClass'));
class Autoloader
{
    protected static $classPaths = array();
    protected static $classFileSuffix = '.php';
    protected static $cacheFilePath = null;
    protected static $cachedPaths = null;
    protected static $excludeFolderNames = '/^CVS|\\..*$/';
    // CVS directories and directories starting with a dot (.).
    protected static $hasSaver = false;
    /**
     * Sets the paths to search in when looking for a class.
     * 
     * @param array $paths
     * @return void
Exemple #4
0
<?php

session_start();
define('APP_ROOT', dirname(__FILE__) . '/protected');
// Get CoughPHP
require_once APP_ROOT . '/vendor/coughphp/load.inc.php';
require_once APP_ROOT . '/vendor/coughphp/as_database/load.inc.php';
require_once APP_ROOT . '/vendor/coughphp/extras/Autoloader.class.php';
Autoloader::addClassPath(APP_ROOT . '/models/');
Autoloader::setCacheFilePath(APP_ROOT . '/cache/cough_class_path_cache.txt');
spl_autoload_register(array('Autoloader', 'loadClass'));
// Get config stuff
require_once APP_ROOT . '/config/config.php';
require_once APP_ROOT . '/config/routes.php';
require_once APP_ROOT . '/config/database.php';
// Get system classes
require_once APP_ROOT . '/system/view.php';
require_once APP_ROOT . '/system/controller.php';
require_once APP_ROOT . '/system/uri.php';
// Parse URI
if (false === strpos($_SERVER['REQUEST_URI'], $config['uri_prefix'])) {
    die('Configuration Error - Bad uri_prefix');
}
$path = substr($_SERVER['REQUEST_URI'], strlen($config['uri_prefix']));
$components = explode('/', $path);
for ($i = 0; $i < count($components); ++$i) {
    if (empty($components[$i])) {
        unset($components[$i]);
    }
}
$controller_name = $config['default_controller'];