Created
August 18, 2011 16:10
-
-
Save juareznjunior/1154407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Request extends Kohana_Request { | |
public function useHMVC() { | |
$this->headers['X-Request-Type'] = 'GET/HMVC'; | |
return $this; | |
} | |
public function isHMVC() { | |
return (bool) (isset($this->headers['X-Request-Type']) AND 'GET/HMVC' === $this->headers['X-Request-Type']); | |
} | |
public function setJSONHeader() { | |
$this->headers['Content-type'] = 'application/json'; | |
return $this; | |
} | |
public static function isPost() { | |
return (bool) ( 'POST' === parent::$method AND count($_POST) > 0 ); | |
} | |
public static function isAjaxPost() { | |
return (bool) ( parent::current()->is_ajax() AND self::isPost() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment