Skip to content

Commit

Permalink
Refactor referrer code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivank committed Jun 23, 2015
1 parent 9a2c432 commit 66feb18
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*/
class Driver_Kohana_RequestFactory_Kohana implements Driver_Simple_RequestFactory {

protected static $_previous_url;

protected $_request;
protected $_response;
protected $_max_redirects = 5;
protected $_previous_url;

public function max_redirects($max_redirects = NULL)
{
Expand All @@ -38,6 +38,11 @@ public function current_url()
return \URL::site($this->current_path(), TRUE);
}

public function previous_url()
{
return $this->_previous_url;
}

public function current_path()
{
if ( ! $this->_request)
Expand Down Expand Up @@ -67,11 +72,11 @@ public function execute($method, $url, array $post = array())
->post($post)
->body(http_build_query($post));

if (Driver_Kohana_RequestFactory_Kohana::$_previous_url) {
$this->_request->referrer(Driver_Kohana_RequestFactory_Kohana::$_previous_url);
if ($this->_previous_url) {
$this->_request->referrer($this->_previous_url);
}

Driver_Kohana_RequestFactory_Kohana::$_previous_url = $this->current_url();
$this->_previous_url = $this->current_url();

\Request::$initial = $this->_request;

Expand Down

0 comments on commit 66feb18

Please sign in to comment.