X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=application%2Fcontrollers%2Fhelpers%2FSyjApi.php;h=92974c5ea775ecb3ab96ba29b7a7e491d5eb7e75;hb=d2d165910aacef01961120326452e616f53991f2;hp=21aa9dd9f9b3fe5e4c88a2eb37bdaa4d8240eb5d;hpb=db98e1f62272cff0b425133aa3b909c5cfa6183d;p=syj.git diff --git a/application/controllers/helpers/SyjApi.php b/application/controllers/helpers/SyjApi.php index 21aa9dd..92974c5 100644 --- a/application/controllers/helpers/SyjApi.php +++ b/application/controllers/helpers/SyjApi.php @@ -1,5 +1,5 @@ _code; } + public function setRedirect($url, $code = 0) { + $this->_redirect = (string)$url; + if (is_numeric($code) && (int)$code >= 300 && (int)$code < 400) { + $this->_code; + } else if (!isset($this->_code)) { + $this->code = 301; + } + return $this; + } + + public function getRedirect() { + return $this->_redirect; + } + public function setCheckIfNoneMatch($check) { $this->_checkIfNoneMatch = (boolean)$check; return $this; @@ -80,6 +95,10 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_ $response->setHeader ('Etag', $etag); } + if ($this->_redirect) { + $response->setHeader ('Location', $this->_redirect); + } + $response->setHttpResponseCode($this->_code) ->setBody($this->_body); }