本文整理汇总了PHP中Zend_Controller_Response_Http类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http类的具体用法?PHP Zend_Controller_Response_Http怎么用?PHP Zend_Controller_Response_Http使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Controller_Response_Http类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initFrontControllerOutput
protected function _initFrontControllerOutput()
{
$front = $this->bootstrap('FrontController')->getResource('FrontController');
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
$front->setResponse($response);
}
示例2: _initResponse
/** Initialise the response and set gzip status
*/
protected function _initResponse()
{
$response = new Zend_Controller_Response_Http();
$response->setHeader('X-Powered-By', 'Dan\'s magic army of elves')->setHeader('Host', 'finds.org.uk')->setHeader('X-Compression', 'gzip')->setHeader('Accept-Encoding', 'gzip, deflate')->setHeader('Expires', gmdate('D, d M Y H:i:s', time() + 2 * 3600) . ' GMT', true);
$frontController = Zend_Controller_Front::getInstance();
$frontController->setResponse($response);
}
示例3: init
public function init()
{
$registry = Zend_Registry::getInstance();
$config = $registry->get("config");
$sysCache = $registry->get("sysCache");
$cacheFiles = new Ml_Cache_Files($sysCache);
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
$frontController = $this->getBootstrap()->getResource('FrontController');
$dispatcher = $frontController->getDispatcher();
$request = $frontController->getRequest();
$router = $frontController->getRouter();
$router->removeDefaultRoutes();
$compat = new Zend_Controller_Router_Route_Module(array(), $dispatcher, $request);
$router->addRoute(HOST_MODULE, $compat);
$routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
$router->addConfig($routerConfig, "apiroutes");
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers/helpers');
$loadOauthStore = Zend_Controller_Action_HelperBroker::getStaticHelper("LoadOauthstore");
$loadOauthStore->setinstance();
$loadOauthStore->preloadServer();
$frontController->setBaseUrl($config['apiroot'])->setParam('noViewRenderer', true)->addModuleDirectory(APPLICATION_PATH . '/modules')->addControllerDirectory(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers');
$response = new Zend_Controller_Response_Http();
if (filter_input(INPUT_GET, "responseformat", FILTER_UNSAFE_RAW) == 'json') {
$contentType = 'application/json';
} else {
$contentType = 'text/xml';
}
$response->setHeader('Content-Type', $contentType . '; charset=utf-8', true);
$frontController->setResponse($response);
}
示例4: prepareDiscoveryParams
public static function prepareDiscoveryParams(array &$params, Zend_Controller_Response_Http $response, $topicType, $topicId, $selfLink, $subscriptionOption)
{
if (!bdApi_Option::getSubscription($topicType)) {
// subscription for this topic type has been disabled
return false;
}
// subscription discovery
$hubLink = bdApi_Data_Helper_Core::safeBuildApiLink('subscriptions', null, array('hub.topic' => bdApi_Model_Subscription::getTopic($topicType, $topicId), 'oauth_token' => ''));
$response->setHeader('Link', sprintf('<%s>; rel=hub', $hubLink));
$response->setHeader('Link', sprintf('<%s>; rel=self', $selfLink));
// subscription info
if (!empty($subscriptionOption)) {
$subscriptionOption = @unserialize($subscriptionOption);
if (!empty($subscriptionOption['subscriptions'])) {
/* @var $session bdApi_Session */
$session = XenForo_Application::getSession();
$clientId = $session->getOAuthClientId();
foreach ($subscriptionOption['subscriptions'] as $subscription) {
if ($subscription['client_id'] == $clientId) {
$params['subscription_callback'] = $subscription['callback'];
}
}
}
}
return true;
}
示例5: send
/**
* Send the file to the client (Download)
*
* @param string|array $options Options for the file(s) to send
* @return void
*/
public function send($options = null)
{
if (is_string($options)) {
$filepath = $options;
} else {
if (is_array($options)) {
$filepath = $options['filepath'];
} else {
throw new Exception("Filename is not set.");
}
}
if (!is_file($filepath) || !is_readable($filepath)) {
throw new Exception("File '{$filepath}' does not exists.");
}
$mimeType = $this->_detectMimeType(array('name' => $filepath));
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-length', filesize($filepath));
$response->setHeader('Content-Type', $mimeType);
$response->sendHeaders();
$handle = fopen($filepath, 'r');
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer;
}
if (!feof($handle)) {
throw new Exception("Error: unexpected fgets() fail.");
}
fclose($handle);
}
}
示例6: _initResponseCharset
/**
* Creates a response object, sets the Content-Type header and assigns the
* response to the front controller.
*
* @return null
*/
protected function _initResponseCharset()
{
$front = Zend_Controller_Front::getInstance();
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-Type', 'text/html; charset=utf-8', false);
$front->setResponse($response);
}
示例7: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getFiltered('INVNUM', $request->getFiltered('INVOICE')) == '') {
$response->setRedirect($this->getRootUrl() . '/thanks');
} else {
parent::directAction($request, $response, $invokeArgs);
}
}
示例8: thanksAction
public function thanksAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$log = $this->logRequest($request, 'POSTBACK [thanks]');
if ($this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->getFiltered('referer'))) {
$log->setInvoice($this->invoice)->update();
$response->setRedirect($this->getReturnUrl());
return;
}
throw new Am_Exception_InputError("Invoice not found");
}
示例9: _initResponse
protected function _initResponse()
{
$options = $this->getOptions();
if (!isset($options['response']['defaultContentType'])) {
return;
}
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-Type', $options['response']['defaultContentType'], true);
$this->bootstrap('FrontController');
$this->getResource('FrontController')->setResponse($response);
}
示例10: _initResponse
protected function _initResponse()
{
// Ensure front controller instance is present, and fetch it
$this->bootstrap('FrontController');
$front = $this->getResource('FrontController');
/* @var $front Zend_Controller_Front */
// Initialize and set the response object
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-Type', 'text/html; charset=UTF-8', true);
$front->setResponse($response);
return $response;
}
示例11: _initModifiedFrontController
protected function _initModifiedFrontController()
{
$options = $this->getOption('resources');
if (!isset($options['modifiedFrontController']['contentType'])) {
return;
}
$this->bootstrap('FrontController');
$front = $this->getResource('FrontController');
//$front->addModuleDirectory(APPLICATION_PATH . '/modules');
$response = new Zend_Controller_Response_Http();
$response->setHeader('Content-Type', $options['modifiedFrontController']['contentType'], true);
$front->setResponse($response);
}
示例12: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
if ($request->getActionName() == 'thanks') {
if ($this->getConfig('debugLog')) {
Am_Di::getInstance()->errorLogTable->log('NetBilling Form [response-thanks]:' . json_encode($request->getParams()));
}
$this->invoice = $this->getDi()->invoiceTable->findFirstByPublicId($request->getFiltered('Ecom_ConsumerOrderID'));
$url = $request->get('Ecom_Ezic_Response_StatusCode') == 0 || $request->get('Ecom_Ezic_Response_StatusCode') == 'F' ? $this->getCancelUrl() : $this->getReturnUrl();
$response->setRedirect($url);
} else {
parent::directAction($request, $response, $invokeArgs);
}
}
示例13: sendCsv
protected function sendCsv($filename, array $rows, Zend_Controller_Response_Http $response, $delimiter = "\t")
{
$response->setHeader('Cache-Control', 'maxage=3600')->setHeader('Pragma', 'no-cache')->setHeader('Content-type', 'text/csv')->setHeader('Content-Disposition', 'attachment; filename=' . $filename);
foreach ($rows as &$r) {
if (is_array($r)) {
$out = "";
foreach ($r as $s) {
$out .= ($out ? $delimiter : "") . '"' . str_replace('"', "'", $s) . '"';
}
$out .= "\r\n";
$r = $out;
}
}
$response->appendBody(implode("", $rows));
}
示例14: directAction
public function directAction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs)
{
$invoice = $this->getDi()->invoiceTable->findBySecureId($request->getFiltered('id'), $this->getId());
if (!$invoice) {
throw new Am_Exception_InputError(___("Sorry, seems you have used wrong link"));
}
$view = new Am_View();
$html = $this->getConfig('html', 'SITE OWNER DID NOT PROVIDE INSTRUCTIONS FOR OFFLINE PAYMENT YET');
$tpl = new Am_SimpleTemplate();
$tpl->invoice = $invoice;
$tpl->user = $this->getDi()->userTable->load($invoice->user_id);
$tpl->invoice_id = $invoice->invoice_id;
$tpl->cancel_url = REL_ROOT_URL . '/cancel?id=' . $invoice->getSecureId('CANCEL');
$view->content = $tpl->render($html);
$view->title = $this->getTitle();
$response->setBody($view->render("layout.phtml"));
}
示例15: testDisplay
public function testDisplay()
{
$this->_response->expects($this->atLeastOnce())->method('sendHeaders');
$this->_request->expects($this->atLeastOnce())->method('getHeader');
$stat = (include __DIR__ . '/_files/timers.php');
$this->_output->display($stat);
$actualHeaders = $this->_response->getHeaders();
$this->assertNotEmpty($actualHeaders);
$actualProtocol = false;
$actualProfilerData = false;
foreach ($actualHeaders as $oneHeader) {
$headerName = $oneHeader['name'];
$headerValue = $oneHeader['value'];
if (!$actualProtocol && $headerName == 'X-Wf-Protocol-1') {
$actualProtocol = $headerValue;
}
if (!$actualProfilerData && $headerName == 'X-Wf-1-1-1-1') {
$actualProfilerData = $headerValue;
}
}
$this->assertNotEmpty($actualProtocol, 'Cannot get protocol header');
$this->assertNotEmpty($actualProfilerData, 'Cannot get profiler header');
$this->assertContains('Protocol/JsonStream', $actualProtocol);
$this->assertRegExp('/"Type":"TABLE","Label":"Code Profiler \\(Memory usage: real - \\d+, emalloc - \\d+\\)"/', $actualProfilerData);
$this->assertContains('[' . '["Timer Id","Time","Avg","Cnt","Emalloc","RealMem"],' . '["root","0.080000","0.080000","1","1,000","50,000"],' . '[". init","0.040000","0.040000","1","200","2,500"],' . '[". . init_store","0.020000","0.010000","2","100","2,000"],' . '["system","0.030000","0.015000","2","400","20,000"]' . ']', $actualProfilerData);
}