Ejemplo n.º 1
0
 /**
  * Application PHP 5 constructor
  */
 public function __construct()
 {
     parent::__construct();
     /**
      * call Instance Error Handler
      */
     ErrorHandler::singleton();
     /**
      * Set Benchmark
      */
     Benchmark::set('app', 'start');
     /**
      * start buffer to make content overide
      */
     ob_start();
     /**
      * Check empty  to prevent Multiple call
      */
     if (empty(static::$x_record_app)) {
         /**
          * Prereserved Application
          * [APP, APPLICATION, ENPROJECT, CORE]
          */
         // protect it
         static::$x_protected_app = array(static::$x_app_prefix . 'APP', static::$x_app_prefix . 'APPLICATION', static::$x_app_prefix . 'ENPROJECT', static::$x_app_prefix . 'CORE');
         // set it
         foreach (static::$x_protected_app as $value) {
             static::$x_record_app[$value] = $this;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * PHP5 Constructor
  *
  * @param string $body    The HTTP response body
  * @param int    $status  The HTTP response status
  * @param array  $headers The HTTP response headers
  */
 public function __construct($body = '', $status = 200, $headers = array())
 {
     parent::__construct();
     static::setStatus($status);
     Headers::has('Content-Type') || Headers::replace(array('Content-Type' => 'text/html'));
     Headers::replace($headers);
     $this->cookies = new Cookie();
     static::write($body);
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param int $code The HTTP code
  * @param string $message (optional) HTTP message for the corresponding code
  */
 public function __construct($items = array(), $code = 200, $message = null)
 {
     parent::__construct();
     static::replace($items);
     // set code
     static::setCode($code);
     if (null === $message) {
         $message = static::httpMessage($code);
     }
     $this->x_message = $message;
 }
Ejemplo n.º 4
0
 /**
  * Constructor
  *
  * @param array $settings
  */
 public function __construct()
 {
     parent::__construct();
     /**
      * Session
      *
      * We must start a native PHP session to initialize the $_SESSION superglobal.
      * However, we won't be using the native session store for persistence, so we
      * disable the session cookie and cache limiter. We also set the session
      * handler to this class instance to avoid PHP's native session file locking.
      */
     ini_set('session.use_cookies', 0);
     session_cache_limiter(false);
     session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
 }
Ejemplo n.º 5
0
 /**
  * PHP5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->x_uri_sufix = Config::get('uri_sufix', '');
     /**
      * Set BenchMark Start
      */
     Benchmark::set('url', 'start');
     /**
      * initiate
      */
     $this->reInitiate();
     /**
      * Set BenchMark End
      */
     Benchmark::set('url', 'end');
 }
Ejemplo n.º 6
0
 /**
  * PHP5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // set writer
     self::setWriter(new LogWriter());
 }
Ejemplo n.º 7
0
 /**
  * PHP 5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->x_error_handler = function ($arr, $exception = false) {
         // if has fatal error
         if (!empty($arr['is_fatal'])) {
             if (is_callable(Route::getDefault500())) {
                 Route::setDefault500(array("\\" . __NAMESPACE__ . "\\Controller", 'error500'));
             }
             return call_user_func_array(Route::getDefault500(), array($arr));
         }
     };
     $this->x_isexception = false;
     /**
      * Register
      */
     set_error_handler(array($this, 'handleError'));
     set_exception_handler(array($this, 'handleException'));
     register_shutdown_function(array($this, 'handleShutdown'));
 }
Ejemplo n.º 8
0
 /**
  * PHP5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
     static::collector();
 }
Ejemplo n.º 9
0
 /**
  * PHP5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
     /**
      * Set Routes Default
      */
     $this->x_routes['main'] = array();
     $this->x_routes[$this->x_default_name] = array();
     /**
      * Set default Current Route
      * @var array
      */
     $this->x_current_route = array('name' => null, 'route' => null);
     $this->x_default_view = array("\\" . __NAMESPACE__ . '\\Controller', 'defaultView');
     $this->x_default_notfound = array("\\" . __NAMESPACE__ . '\\Controller', 'defaultNotFound');
     $this->x_default_500 = array("\\" . __NAMESPACE__ . '\\Controller', 'error500');
     $this->x_default_blocked = array("\\" . __NAMESPACE__ . '\\Controller', 'errorBlocked');
 }
Ejemplo n.º 10
0
 /**
  * PHP5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 11
0
 /**
  * PHP 5 Constructor
  */
 public function __construct($config = array())
 {
     // doing isntance of current object
     parent::__construct();
     static::set($config);
 }
Ejemplo n.º 12
0
 /**
  * PHP5 Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->cookies = new Collector\Collector(Response::parseCookieHeader(Header::get('HTTP_COOKIE')));
 }