本文整理汇总了PHP中Zend_Controller_Response_Http::clearHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http::clearHeader方法的具体用法?PHP Zend_Controller_Response_Http::clearHeader怎么用?PHP Zend_Controller_Response_Http::clearHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Response_Http
的用法示例。
在下文中一共展示了Zend_Controller_Response_Http::clearHeader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _outputImage
/**
* Intercept a request for a cached image from the proxy and output it
*
* @param string|bool $error If non-false, an error that occurred when validating the request
*/
protected function _outputImage($error)
{
if (empty(XenForo_Application::getOptions()->imageLinkProxy['images'])) {
$error = 'disabled';
}
/* @var $proxyModel XenForo_Model_ImageProxy */
$proxyModel = XenForo_Model::create('XenForo_Model_ImageProxy');
$image = false;
if (!$error) {
$urlParts = parse_url($this->_url);
if ($this->_isLocalHost($urlParts['host']) && (empty($_SERVER['SERVER_NAME']) || !$this->_isLocalHost($_SERVER['SERVER_NAME']))) {
$error = 'local_url';
}
}
if (!$error) {
$image = $proxyModel->getImage($this->_url);
if ($image) {
$image = $proxyModel->prepareImage($image);
if ($image['use_file']) {
$proxyModel->logImageView($image);
$eTag = !empty($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] : null;
if ($eTag && $eTag == '"' . $image['fetch_date'] . '"') {
$this->_response->setHttpResponseCode(304);
$this->_response->clearHeader('Last-Modified');
$this->_response->sendHeaders();
return;
}
} else {
$image = false;
$error = 'retrieve_failed';
}
}
}
if (!$image) {
$image = $proxyModel->getPlaceHolderImage();
}
$imageTypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png');
if (in_array($image['mime_type'], $imageTypes)) {
$this->_response->setHeader('Content-type', $image['mime_type'], true);
$this->_setDownloadFileName($image['file_name'], true);
} else {
$this->_response->setHeader('Content-type', 'application/octet-stream', true);
$this->_setDownloadFileName($image['file_name']);
}
if (!$error) {
$this->_response->setHeader('ETag', '"' . $image['fetch_date'] . '"', true);
}
if ($image['file_size']) {
$this->_response->setHeader('Content-Length', $image['file_size'], true);
}
$this->_response->setHeader('X-Content-Type-Options', 'nosniff');
if ($error) {
$this->_response->setHeader('X-Proxy-Error', $error);
}
$this->_response->sendHeaders();
$imageData = new XenForo_FileOutput($image['file_path']);
$imageData->output();
}