Exemplo n.º 1
0
 public static function getInstance()
 {
     if (Route::$instance == null) {
         Route::$instance = new Route();
     }
     return Route::$instance;
 }
Exemplo n.º 2
0
 /**
  * @return mixed
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
Exemplo n.º 3
0
 /**
  * start the app
  */
 public function run()
 {
     $this->_initRegister();
     date_default_timezone_set($this->config['timezone']);
     if (false === IS_CLI) {
         $this->route = Route::instance()->init();
         $this->controller = Controller::create($this->route);
     }
 }
Exemplo n.º 4
0
 public static function start()
 {
     $ds = DIRECTORY_SEPARATOR;
     include 'vendor' . $ds . 'simple' . $ds . 'base' . $ds . 'Loader' . EXT;
     include 'vendor' . $ds . 'simple' . $ds . 'base' . $ds . 'Handler' . EXT;
     include 'vendor' . $ds . 'simple' . $ds . 'base' . $ds . 'Route' . EXT;
     spl_autoload_register(['Loader', 'autoload']);
     //set the error and exception handlers
     Handler::set();
     //set the routes
     Route::instance()->run();
 }
Exemplo n.º 5
0
 public function __construct($layout = '', $view = '')
 {
     $this->_conf = Config::instance();
     if (!empty($layout)) {
         $this->_layout = $layout;
     } else {
         $this->_layout = $this->_conf->get('default_layout');
     }
     if (!empty($view)) {
         $this->_view = $view;
     } else {
         $router = Route::instance();
         $this->_view = className2fileName($router->controller()) . DS . $router->action();
     }
 }
Exemplo n.º 6
0
<?php

$route = Route::instance();
$route->connect('page/(\\d*)/(\\d*)', 'pages_FirstPage/index/$1/$2');
$route->connect('page', 'page/index');
$route->connect('page/test', 'test/main');
unset($route);
Exemplo n.º 7
0
 * Подключения файла с функциями
 */
include_once CORE_PATH . DS . 'functions.php';
//errorReporting ();
/*
 * Добовляются пути к include_path
 */
$includePath = array(APP_PATH . DS . 'classes', CORE_PATH . DS . 'classes', get_include_path());
$includePath = implode(PATH_SEPARATOR, $includePath);
set_include_path($includePath);
/**
 * 
 * автолод для подключения классов
 */
function __autoload($class)
{
    $file = className2fileName($class) . '.php';
    include_once $file;
}
include_once APP_PATH . DS . 'config' . DS . 'app_config.php';
// фаил конфигурации приложения
$config = Config::instance();
include_once APP_PATH . DS . 'config' . DS . 'routes.php';
$router = Route::instance();
//подключаем роут
$route = $router->getRoute($_SERVER['REQUEST_URI']);
//текущий роут
errorReporting();
//вывод ошибок
dispatch($route);
//фронт контроллер
Exemplo n.º 8
0
 public static function instance()
 {
     if (!self::$instance instanceof self) {
         return self::$instance = new self();
     }
 }