Extends
lithium\net\http\Request
Pulls request data from superglobals.
Returns
voidSource
protected function _init() {
parent::_init();
$mobile = array(
'iPhone', 'MIDP', 'AvantGo', 'BlackBerry', 'J2ME', 'Opera Mini', 'DoCoMo', 'NetFront',
'Nokia', 'PalmOS', 'PalmSource', 'portalmmm', 'Plucker', 'ReqwirelessWeb', 'iPod',
'SonyEricsson', 'Symbian', 'UP\.Browser', 'Windows CE', 'Xiino', 'Android'
);
if (!empty($this->_config['detectors']['mobile'][1])) {
$mobile = array_merge($mobile, (array) $this->_config['detectors']['mobile'][1]);
}
$this->_detectors['mobile'][1] = $mobile;
$defaults = array('REQUEST_METHOD' => 'GET', 'CONTENT_TYPE' => 'text/html');
$this->_env += (array) $_SERVER + (array) $_ENV + $defaults;
$envs = array('isapi' => 'IIS', 'cgi' => 'CGI', 'cgi-fcgi' => 'CGI');
$this->_env['PLATFORM'] = isset($envs[PHP_SAPI]) ? $envs[PHP_SAPI] : null;
$this->_base = $this->_base();
$this->url = $this->_url();
if (!empty($this->_config['query'])) {
$this->query = $this->_config['query'];
}
if (isset($_GET)) {
$this->query += $_GET;
}
if (!empty($this->_config['data'])) {
$this->data = $this->_config['data'];
}
if (isset($_POST)) {
$this->data += $_POST;
}
if (isset($this->data['_method'])) {
$this->_env['HTTP_X_HTTP_METHOD_OVERRIDE'] = strtoupper($this->data['_method']);
unset($this->data['_method']);
}
if (!empty($this->_env['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
$this->_env['REQUEST_METHOD'] = $this->_env['HTTP_X_HTTP_METHOD_OVERRIDE'];
}
$type = $this->type($this->_env['CONTENT_TYPE']);
$this->method = $method = strtoupper($this->_env['REQUEST_METHOD']);
if (!$this->data && ($method == 'POST' || $method == 'PUT')) {
if ($type !== 'html') {
$this->_stream = $this->_stream ?: fopen('php://input', 'r');
$media = $this->_classes['media'];
$this->data = (array) $media::decode($type, stream_get_contents($this->_stream));
fclose($this->_stream);
}
}
$this->data = Set::merge((array) $this->data, $this->_parseFiles());
}