• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Controller_Response_Http类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_Controller_Response_Http的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Response_Http类的具体用法?PHP Zend_Controller_Response_Http怎么用?PHP Zend_Controller_Response_Http使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zend_Controller_Response_Http类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
 }
开发者ID:berliozd,项目名称:cherbouquin,代码行数:7,代码来源:Bootstrap.php


示例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);
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:9,代码来源:Bootstrap.php


示例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);
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:30,代码来源:Api.php


示例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;
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:26,代码来源:Subscription.php


示例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);
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:36,代码来源:Http.php


示例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);
 }
开发者ID:louiesabado,项目名称:simple-php-contact-form,代码行数:13,代码来源:Bootstrap.php


示例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);
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:8,代码来源:payflow-link.php


示例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");
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:10,代码来源:junglepay.php


示例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);
 }
开发者ID:padraic,项目名称:ZFPlanet,代码行数:11,代码来源:Bootstrap.php


示例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;
 }
开发者ID:shevron,项目名称:zend-simplecal,代码行数:12,代码来源:Bootstrap.php


示例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);
 }
开发者ID:Tony133,项目名称:zf-web,代码行数:13,代码来源:Bootstrap.php


示例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);
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:13,代码来源:netbilling-form.php


示例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));
 }
开发者ID:grlf,项目名称:eyedock,代码行数:15,代码来源:PayoutMethod.php


示例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"));
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:17,代码来源:offline.php


示例15: prepareContent

 /**
  * Prepare response body before caching
  *
  * @param Zend_Controller_Response_Http $response
  * @return string
  */
 public function prepareContent(Zend_Controller_Response_Http $response)
 {
     $content = $response->getBody();
     $placeholders = array();
     preg_match_all(Enterprise_PageCache_Model_Container_Placeholder::HTML_NAME_PATTERN, $content, $placeholders, PREG_PATTERN_ORDER);
     $placeholders = array_unique($placeholders[1]);
     try {
         foreach ($placeholders as $definition) {
             $this->_placeholder = Mage::getModel('enterprise_pagecache/container_placeholder', $definition);
             $content = preg_replace_callback($this->_placeholder->getPattern(), array($this, '_getPlaceholderReplacer'), $content);
         }
         $this->_placeholder = null;
     } catch (Exception $e) {
         $this->_placeholder = null;
         throw $e;
     }
     return $content;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:24,代码来源:Default.php


示例16: __construct

 public function __construct($msg = '', $code = 0, Exception $previous = null)
 {
     // just pass ahead if it was throw from the CLI
     if (php_sapi_name() == "cli") {
         return parent::__construct($msg, (int) $code, $previous);
     } else {
         parent::__construct($msg, (int) $code, $previous);
         $response = new Zend_Controller_Response_Http();
         $response->setHttpResponseCode(500);
         ob_get_clean();
         ob_start();
         require APPLICATION_PATH . "/layout/scripts/exception.phtml";
         $outputBuffer = ob_get_clean();
         $response->setBody($outputBuffer);
         $response->sendResponse();
         trigger_error($msg, E_USER_ERROR);
         exit;
     }
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:19,代码来源:Exception.php


示例17: 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);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:26,代码来源:FirebugTest.php


示例18: _error

 protected function _error($message = null, $statusCode = self::REST_STATUS_BAD_REQUEST)
 {
     if (is_numeric($statusCode)) {
         $statusCode = intval($statusCode);
     }
     $this->_response->clearAllHeaders()->clearBody();
     $this->_response->setHttpResponseCode(intval($statusCode))->setHeader('Content-Type', 'application/json', true);
     if (!empty($message)) {
         $this->_response->setBody(json_encode($message));
     }
     $this->_response->sendResponse();
     exit;
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:13,代码来源:Abstract.php


示例19: testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag

    public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());

        $this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views');

        require_once 'Zend/Filter/PregReplace.php';
        require_once 'Zend/Filter/Word/UnderscoreToSeparator.php';
        
        $inflector = new Zend_Filter_Inflector('test.phtml');
        $inflector->addRules(array(
            ':module'     => array('Word_CamelCaseToDash', 'stringToLower'),
            ':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator(DIRECTORY_SEPARATOR), 'StringToLower'),
            ':action'     => array(
                'Word_CamelCaseToDash', 
                new Zend_Filter_PregReplace('/[^a-z0-9]+/i', '-'),
                'StringToLower'
            ),
        ));
        $this->helper->setInflector($inflector, true);

        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:28,代码来源:ViewRendererTest.php


示例20: sendHeaders

 /**
  * Fixes CGI only one Status header allowed bug
  *
  * @link  http://bugs.php.net/bug.php?id=36705
  *
  */
 public function sendHeaders()
 {
     if (!$this->canSendHeaders()) {
         AO::log('HEADERS ALREADY SENT: ' . mageDebugBacktrace(true, true, true));
         return $this;
     }
     if (substr(php_sapi_name(), 0, 3) == 'cgi') {
         $statusSent = false;
         foreach ($this->_headersRaw as $i => $header) {
             if (stripos($header, 'status:') === 0) {
                 if ($statusSent) {
                     unset($this->_headersRaw[$i]);
                 } else {
                     $statusSent = true;
                 }
             }
         }
         foreach ($this->_headers as $i => $header) {
             if (strcasecmp($header['name'], 'status') === 0) {
                 if ($statusSent) {
                     unset($this->_headers[$i]);
                 } else {
                     $statusSent = true;
                 }
             }
         }
     }
     parent::sendHeaders();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:35,代码来源:Http.php



注:本文中的Zend_Controller_Response_Http类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Controller_Router_Rewrite类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Controller_Request_Http类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap