Beispiel #1
0
 /**
  * Loads the $_POST, $_FILES data, configures the query params and populates the accepted headers fields.
  *
  * @access public
  * @return void
  */
 public function initialize()
 {
     if ($this->_initialized) {
         return;
     }
     parent::initialize();
     // Store data
     $this->data =& App::$data;
     $this->params = Router::current();
     // Store accept HTTP headers
     foreach (array('Accept', 'Accept-Language', 'Accept-Charset') as $acception) {
         if ($accept = $this->env($acception)) {
             $accept = explode(',', $accept);
             foreach ($accept as $type) {
                 if (strpos($type, ';') !== false) {
                     list($type, $quality) = explode(';', $type);
                 } else {
                     $quality = 1;
                 }
                 $data = array('type' => $type, 'quality' => str_replace('q=', '', $quality));
                 if ($acception == 'Accept-Language') {
                     $this->__acceptLangs[] = $data;
                 } else {
                     if ($acception == 'Accept-Charset') {
                         $this->__acceptCharsets[] = $data;
                     } else {
                         $this->__acceptTypes[] = $data;
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 /**
  * Loads the current HTTP response headers.
  *
  * @access public
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
 }