private static function instance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; }
public function __construct() { $config = Kiss_Registry::get("config"); if ($config->gochannel_url) { $this->url = "http://" . $config->gochannel_url; } else { throw new Exception("gochannel_url not config"); } $this->postParams = array("app_id" => $config->gochannel_app_id, "app_secret" => $config->gochannel_app_secret); }
public function indexAction() { $roomId = trim($_GET['room_id']); if (!$roomId) { $this->errorPage(); } $roomModel = new RoomModel(); $roomInfo = $roomModel->getRoomById($roomId); if (!$roomInfo) { $this->errorPage(); } $userlist = json_decode($roomInfo['user_list'], true); $userlist = $userlist ? $userlist : array(); $this->view->isJoined = in_array($this->uid, $userlist); $roomInfo['user_list'] = $userlist; $this->view->room = $roomInfo; $this->view->pageName = "room"; $config = Kiss_Registry::get("config"); $this->view->wsHost = $config->gochannel_url; $this->render('room/index'); }
public function __construct() { $config = Kiss_Registry::get("config"); $this->config = $config; }
<?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();