Esempio n. 1
0
 /**
  * Initialize all classes required for runtime. Master initialize method.
  *
  * @access public
  * @return void
  * @static
  */
 public static function initialize()
 {
     // Try and autoload from include_paths first
     spl_autoload_register();
     spl_autoload_register('\\titon\\core\\App::autoload');
     // Initialize core components
     Environment::initialize();
     Debugger::initialize();
     Router::initialize();
     // Get super globals
     $get = $_GET;
     $post = $_POST;
     $files = array();
     if (!empty($_FILES)) {
         foreach ($_FILES as $model => $data) {
             foreach ($data as $meta => $values) {
                 $keys = array_keys($values);
                 $files[$model][$keys[0]][$meta] = $values[$keys[0]];
             }
         }
     }
     // Clear magic quotes, just in case
     if (get_magic_quotes_gpc() > 0) {
         $stripSlashes = function ($data) {
             return is_array($data) ? array_map($stripSlashes, $data) : stripslashes($data);
         };
         $get = $stripSlashes($get);
         $post = $stripSlashes($post);
         $files = $stripSlashes($files);
     }
     static::$data = array_merge_recursive($post, $files);
     static::$globals = array('_GET' => $get, '_POST' => $post, '_FILES' => $files, '_SERVER' => $_SERVER, '_ENV' => $_ENV);
 }