Skip to content

Instantly share code, notes, and snippets.

@juareznjunior
Created August 18, 2011 16:10
Show Gist options
  • Save juareznjunior/1154407 to your computer and use it in GitHub Desktop.
Save juareznjunior/1154407 to your computer and use it in GitHub Desktop.
<?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