本文整理汇总了PHP中Mage_Core_Controller_Request_Http::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::has方法的具体用法?PHP Mage_Core_Controller_Request_Http::has怎么用?PHP Mage_Core_Controller_Request_Http::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::has方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNeverExpireBrowserCacheHeader
public function setNeverExpireBrowserCacheHeader(Mage_Core_Controller_Request_Http $httpRequest, Mage_Core_Controller_Response_Http $response)
{
if (!Mage::app()->useCache('config')) {
return $this;
}
if (!$httpRequest->has(self::FUZE_VALUE_CACHE_KEY)) {
Mage::log("MegaMenu cache problem: You cannot set never expire browser cache, because this http request has not been secured by the fuze url param.");
return $this;
}
$expires = gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 3600 * self::HOURS_IN_BROWSER_CACHE);
$maxAge = self::HOURS_IN_BROWSER_CACHE * 3600;
$response->setHeader('Pragma', 'public', true);
$response->setHeader('Expires', $expires, true);
$response->setHeader('Cache-Control', "public, max-age={$maxAge}", true);
return $this;
}
示例2: applyCodeFromRequest
/**
* Takes in an HTTP request and applies the code
*
* @param Mage_Core_Controller_Request_Http $request
* @return boolean
*/
public function applyCodeFromRequest($request)
{
list($couponParam, $errorParam) = $this->getParams();
$session = Mage::getSingleton('core/session');
$errorCode = $request->getParam($errorParam, null);
$couponCode = $request->getParam($couponParam, null);
if ($errorCode || $couponCode) {
if (!empty($couponCode)) {
$force = $request->has(self::FORCE_PARAM);
try {
$coupon = $this->_validateCode($couponCode, $force);
if (!$this->isCouponApplied($coupon->getRuleId(), $couponCode)) {
$this->applyCode($coupon->getRuleId(), $couponCode);
$session->addSuccess($this->getSuccessMessage($couponCode));
}
return true;
} catch (Exception $e) {
$errorCode = $e->getMessage();
}
}
if (!$this->isValidErrorCode($errorCode)) {
$errorCode = self::INVALID_CODE;
}
$session->addError($this->getErrorMessage($errorCode, $couponCode));
}
return false;
}