コード例 #1
0
ファイル: App.php プロジェクト: ManiacMike/dixit
 /**
  * initialize application
  */
 public static function init($strEnv, $configFile)
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     self::$setting['envString'] = $strEnv;
     self::$setting['env'] = constant(__CLASS__ . '::' . strtoupper($strEnv));
     $config = new Kiss_Config($configFile);
     self::$setting['config'] = $config;
     self::$isInit = true;
     return self::$instance;
 }
コード例 #2
0
ファイル: Router.php プロジェクト: ManiacMike/dixit
 private static function _terminate($e = null)
 {
     echo 'Internal Server Error!';
     if ($e && Kiss_App::getEnv() > Kiss_App::PRODUCTION) {
         echo "<br /><pre>\r\n";
         echo $e->getMessage(), PHP_EOL;
         echo $e->getTraceAsString(), PHP_EOL;
         echo "</pre><br />\r\n";
     }
     exit;
 }
コード例 #3
0
ファイル: index.php プロジェクト: ManiacMike/dixit
<?php

define('APP_PATH', realpath(dirname(__FILE__) . '/../'));
//set include path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APP_PATH), realpath(APP_PATH . '/app'), realpath(APP_PATH . '/app/Model'), realpath(APP_PATH . '/app/Library'), realpath(APP_PATH . '/app/View'), get_include_path())));
// echo APP_PATH . '/app/Library/Kiss';die;
$appEnv = getenv('APP_ENV') ? getenv('APP_ENV') : 'production';
//define config path
define('CONFIG_PATH', APP_PATH . '/app/Config/' . $appEnv);
//initial application
require APP_PATH . "/app/Library/Kiss/App.php";
Kiss_App::init($appEnv, CONFIG_PATH . '/app.ini');
Kiss_App::bootstrap();
//store config to Kiss_Registry
$config = Kiss_App::getConfig();
Kiss_Registry::set('config', $config);
//Resources::setConfig($config);
//create router
$router = new Kiss_Router();
//map "/hello/*" to Controller/Home.php::hiAction()
$router->addRoute('/room/(.*)', 'room/index', array(1 => 'room_id'));
//run
$router->dispatch();