示例#1
0
 /**
  * @see IController::constructor()
  */
 public function constructor()
 {
     // Link loader to controller
     // and the controller instance to itself
     $this->load = Loader::$instance;
     self::$instance =& $this;
     // Method and argument back references.
     if (isset($_GET["m"])) {
         $m = filter_var($_GET["m"], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     }
     if (isset($_GET["a"])) {
         $a = filter_var($_GET["a"], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
     }
     if (isset($m)) {
         $this->method = $m;
     }
     if (isset($a)) {
         $this->arg = $a;
     }
     AutoLoader::getInstance();
     /*
      * Changing the working directory to "application"
      * since we don't really need anything from the system folder.
      */
     chdir("application");
 }
示例#2
0
 public function setData(&$data)
 {
     $this->data =& $data;
     $this->data['is_admin'] = false;
     if ($this->httpRequest->arg(0) == 'admin') {
         $this->data['is_admin'] = true;
     }
     $this->data['headline'] = $this->data['title'];
     $autoloader = AutoLoader::getInstance();
     if (!$this->data['title']) {
         $this->data['title'] = $autoloader->config('default_title');
     }
     if (!$this->data['keywords']) {
         $this->data['keywords'] = $autoloader->config('default_keywords');
     }
     if (!$this->data['description']) {
         $this->data['description'] = $autoloader->config('default_description');
     }
 }
示例#3
0
<?php

defined('__XS_STANDALONE') or define('__XS_STANDALONE', true);
define('__XS_PRIVATE', __DIR__);
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
session_start();
$autoloader = AutoLoader::getInstance();
class AutoLoader
{
    private static $_instance;
    private static $db;
    private static $config = array();
    private static $controller = '';
    private static $action = '';
    private static $params = array();
    private static $controllerClass;
    public static function getInstance()
    {
        if (!self::$_instance instanceof self) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }
    public function config($name, $val = '')
    {
        if ($val) {
            $this->config[$name] = $val;
        } else {
            return $this->config[$name];
示例#4
0
 public function __construct()
 {
     $this->autoloader =& AutoLoader::getInstance();
     $this->httpRequest =& HttpRequest::getInstance();
     // nothing here
 }
示例#5
0
 private function setInitialized($init)
 {
     self::$_initialized = $init;
     AutoLoader::getInstance()->initialize($this);
 }
function __autoload($className)
{
    $autoLoader = AutoLoader::getInstance();
    $autoLoader->load($className);
}
示例#7
0
<?php

//error_reporting( E_ERROR | E_RECOVERABLE_ERROR | E_PARSE | E_USER_ERROR | E_CORE_ERROR );
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
//error_reporting(0);
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return (double) $usec + (double) $sec;
}
$time_start = microtime(true);
include 'modules/AutoLoader.php';
AutoLoader::getInstance()->register();
include 'modules/Core.php';
$webRequest = new MVC\WebRequest();
$webRequest->route();
echo $webRequest->getResponse();
$time_end = microtime(true);
$time = round($time_end - $time_start, 2);
echo "<br/>";
echo $time . ' seconds';