defined('SYSTEMPATH') or define('SYSTEMPATH', dirname(__FILE__) . DS); defined('BASEPATH') or define('BASEPATH', dirname(__FILE__) . DS); defined('APPFOLDER') or define('APPFOLDER', ROOTPATH . 'App' . DS); // ---- plugin paths ---- defined('PLUGINPATH') or define('PLUGINPATH', SYSTEMPATH . 'plugins' . DS); defined('PLUGINCONTROLLERPATH') or define('PLUGINCONTROLLERPATH', PLUGINPATH . 'controllers' . DS); defined('PLUGINMODELPATH') or define('PLUGINMODELPATH', PLUGINPATH . 'models' . DS); // ---- app paths ------ defined('MODELPATH') or define('MODELPATH', APPFOLDER . 'Model' . DS); defined('VIEWPATH') or define('VIEWPATH', APPFOLDER . 'View' . DS); defined('CONTROLLERPATH') or define('CONTROLLERPATH', APPFOLDER . 'Controller' . DS); defined('CONFIGPATH') or define('CONFIGPATH', APPFOLDER . 'Config' . DS); defined('SMARTYPATH') or define('SMARTYPATH', SYSTEMPATH . 'Vendor' . DS . 'Smarty/'); defined('EXT') or define('EXT', '.php'); defined('SMARTY_EXT') or define('SMARTY_EXT', '.tpl'); // ------- system constants ------- defined('PPI_VERSION') or define('PPI_VERSION', '1.1'); set_include_path('.' . PATH_SEPARATOR . SYSTEMPATH . PATH_SEPARATOR . get_include_path()); // Autoload registration include_once 'Autoload.php'; PPI_Autoload::register(); // General stuff include_once 'common.php'; // load up custom error handlers include_once 'errors.php'; setErrorHandlers('ppi_error_handler', 'ppi_exception_handler'); // Turn off magic quotes if it's enabled if (version_compare(PHP_VERSION, '5.3.0', '<')) { set_magic_quotes_runtime(0); // Kill magic quotes }
/** * Run the boot process, boot up our app. Call the relevant classes such as: * config, registry, session, dispatch, router. * * @return $this Fluent interface */ function boot() { error_reporting($this->_errorLevel); ini_set('display_errors', $this->_showErrors); // Fire up the default config handler if ($this->_config === null) { $this->_config = new PPI_Config('general.ini', array('block' => $this->_siteMode)); } $this->_config = $this->_config->getConfig(); $registry = PPI_Registry::getInstance(); // Set the config into the registry for quick read/write $registry->set('PPI_Config', $this->_config); // ------------- Initialise the session ----------------- if (!headers_sent()) { // Fire up the default session handler if ($this->_session === null) { $this->_session = new PPI_Session(); } $registry->set('PPI_Session', $this->_session); } // -------------- Library Autoloading Process -------------- if (!empty($this->_config->system->autoloadLibs)) { foreach (explode(',', $this->_config->system->autoloadLibs) as $sLib) { switch (strtolower(trim($sLib))) { case 'zf': PPI_Autoload::add('Zend', array('path' => SYSTEMPATH . 'Vendor/', 'prefix' => 'Zend_')); break; case 'github': $githubAutoloader = SYSTEMPATH . 'Vendor/Github/Autoloader.php'; if (!file_exists($githubAutoloader)) { throw new PPI_Exception('Unable to autoload github, the github autoloader was no found.'); } include_once SYSTEMPATH . 'Vendor/Github/Autoloader.php'; Github_Autoloader::register(); break; // @todo - test this. // @todo - test this. case 'swift': include_once SYSTEMPATH . 'Vendor/Swift/swift_required_pear.php'; break; /* case 'solar': PPI_Autoload::add('Solar', array( 'path' => SYSTEMPATH . 'Vendor/', 'prefix' => 'Solar_' )); Solar::start(); break; */ } } } $registry->set('PPI_App', $this); return $this; // Fluent Interface }