#mc model class include_once JAPA_LIBRARY_DIR . 'japa/JapaModel.php'; #mc #cc controller class include_once JAPA_LIBRARY_DIR . 'japa/JapaInterfaceController.php'; #cc #cc controller class include_once JAPA_LIBRARY_DIR . 'japa/JapaController.php'; #cc #scc cache class include_once JAPA_LIBRARY_DIR . 'japa/JapaCache.php'; #scc #scc router class include_once JAPA_LIBRARY_DIR . 'japa/JapaRouter.php'; #scc /** * japa config class */ include_once JAPA_LIBRARY_DIR . 'japa/JapaConfig.php'; $japaConfig = new JapaConfig($_jpconfig); // pass the config array to the controller JapaController::setConfig($japaConfig); // include debug class // if ($_jpconfig['enable_custom_debug'] == true) { include_once JAPA_LIBRARY_DIR . 'japa/JapaDebug.php'; $japaDebug = new JapaDebug(); $japaDebug->config = $japaConfig; JapaController::setDebug($japaDebug); } unset($_jpconfig);
// GNU LESSER GENERAL PUBLIC LICENSE // To read the license please visit http://www.gnu.org/licenses/lgpl.txt // ---------------------------------------------------------------------- // bootstrap file // Define the absolute path to JAPA // define('JAPA_BASE_DIR', dirname(__FILE__) . '/'); // Define the absolute path to the JAPA library folder // define('JAPA_LIBRARY_DIR', JAPA_BASE_DIR . 'library/'); // Define the absolute path to the JAPA application folder // define('JAPA_APPLICATION_DIR', JAPA_BASE_DIR . 'application/'); // Define the absolute path to the JAPA modules folder // define('JAPA_MODULES_DIR', JAPA_BASE_DIR . 'modules/'); // Define the relative path to the JAPA public folder // define('JAPA_PUBLIC_DIR', 'public/'); // Include the system core file. include JAPA_LIBRARY_DIR . 'japa/japa_core.php'; // router which handles url rewrites $japaRouter = JapaRouter::newInstance($japaConfig, 'web'); $japaController = JapaController::newInstance($japaRouter); $japaController->dispatch(); // Debug if ($japaController->config->getVar('enable_custom_debug') == true) { $debugLocation = array("file" => __FILE__, "line" => __LINE__); $japaDebug->setDebugPoint('end', $debugLocation); $japaDebug->japaVarDump($japaController->config->getVar('debugShowMessageType')); }
/** * Retrieve a new Controller instance. * * @param object $router Router which handles url rewrites (cli). */ public static function newInstance($router) { try { if (!isset(self::$instance)) { // get application controller class name $application_controller = $router->getAppController(); $class_file = JAPA_BASE_DIR . 'library/japa/' . $application_controller . '.php'; if (!@file_exists($class_file)) { throw new JapaInitException($class_file . ' dosent exists'); } include_once $class_file; $object = new $application_controller($router); if (!$object instanceof JapaController) { throw new JapaInitException($class . ' dosent extends JapaController'); } // set singleton instance self::$instance = $object; return $object; } else { $type = get_class(self::$instance); throw new JapaInitException('Controller instance exists: ' . $type); } } catch (JapaInitException $e) { $e->performStackTrace(); } }