當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Wildfire_Channel_HttpHeaders類代碼示例

本文整理匯總了PHP中Zend_Wildfire_Channel_HttpHeaders的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Wildfire_Channel_HttpHeaders類的具體用法?PHP Zend_Wildfire_Channel_HttpHeaders怎麽用?PHP Zend_Wildfire_Channel_HttpHeaders使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_Wildfire_Channel_HttpHeaders類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendJson

 /**
  * Encode JSON response and immediately send
  *
  * @param  mixed   $data
  * @param  boolean|array $keepLayouts
  * NOTE:   if boolean, establish $keepLayouts to true|false
  *         if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false
  *         if $keepLayouts and parmas for Zend_Json::encode are required
  *         then, the array can contains a 'keepLayout'=>true|false
  *         that will not be passed to Zend_Json::encode method but will be passed
  *         to Zend_View_Helper_Json
  * @param  bool $wrap
  * @return string|void
  */
 public function sendJson($data, $keepLayouts = false, $wrap = true)
 {
     if (!is_array($data)) {
         return parent::sendJson($data, $keepLayouts);
     }
     if (isset($data['success']) && !is_bool($data['success'])) {
         $data['success'] = (bool) $data['success'];
     }
     if ($wrap) {
         $messages = Axis::message()->getAll();
         //            if (isset(false === $data['success']) && $data['success']) {
         //                unset($messages['success']);
         //            }
         $data = array_merge(array('messages' => $messages), $data);
     }
     if ($this->_data) {
         $data = array_merge_recursive($this->_data, $data);
     }
     $data = $this->encodeJson($data, $keepLayouts);
     $response = $this->getResponse();
     $response->setBody($data);
     if (!$this->suppressExit) {
         Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
         //Axis_FirePhp
         $response->sendResponse();
         exit;
     }
     return $data;
 }
開發者ID:baisoo,項目名稱:axiscommerce,代碼行數:43,代碼來源:Json.php

示例2: getChannel

 public static function getChannel()
 {
     if (!self::$channel) {
         self::$channel = \Zend_Wildfire_Channel_HttpHeaders::getInstance();
     }
     return self::$channel;
 }
開發者ID:berliozd,項目名稱:cherbouquin,代碼行數:7,代碼來源:FireBugTrace.php

示例3: testNoQueries

 public function testNoQueries()
 {
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
     // call plugin postDispatch to record profiler data
     $this->_plugin->dispatchLoopShutdown();
     $messages = $protocol->getMessages();
     $this->assertFalse($messages);
 }
開發者ID:JellyBellyDev,項目名稱:zle,代碼行數:10,代碼來源:DoctrineProfilerFirebugTest.php

示例4: start

 public static function start($config, $db)
 {
     self::$_config = $config;
     if (self::$_config['Zend_Db_Profiler_Firebug'] == false) {
         return;
     }
     $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
     $profiler->setEnabled(true);
     $db->setProfiler($profiler);
     $request = new Zend_Controller_Request_Http();
     self::$_response = new Zend_Controller_Response_Http();
     self::$_channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     self::$_channel->setRequest($request);
     self::$_channel->setResponse(self::$_response);
     ob_start();
 }
開發者ID:sabril-2t,項目名稱:Open-Ad-Server,代碼行數:16,代碼來源:zend.php

示例5: sendToFirebug

 /**
  * send to Firebug
  *
  * @param $content
  */
 public function sendToFirebug($content)
 {
     $writer = new Zend_Log_Writer_Firebug();
     $logger = new Zend_Log($writer);
     $request = new Zend_Controller_Request_Http();
     $response = new Zend_Controller_Response_Http();
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $channel->setRequest($request);
     $channel->setResponse($response);
     // Start output buffering
     ob_start();
     $logger->log($content, Zend_Log::INFO);
     // Flush log data to browser
     $channel->flush();
     $response->sendHeaders();
 }
開發者ID:xiaoguizhidao,項目名稱:bb,代碼行數:21,代碼來源:Debug.php

示例6: test2PhpAction

 public function test2PhpAction()
 {
     Zend_Registry::get('logger')->debug('Test Logging Message');
     $this->view->json('Sample Json Data');
     $this->getHelper('Json')->suppressExit = true;
     $this->getHelper('Json')->sendJson('Test JSON data');
     Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
     $this->getHelper('Json')->getResponse()->sendResponse();
     exit;
     /*
             Zend_Registry::get('logger')->debug('Test Logging Message');      
             $this->view->json('Sample Json Data');
     
             $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
             $viewRenderer->setNoRender(true);
     */
 }
開發者ID:laiello,項目名稱:firephp,代碼行數:17,代碼來源:TestLoggingController.php

示例7: display

 /**
  * Display profiling results and flush output buffer
  */
 public function display()
 {
     $firebugMessage = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_renderCaption());
     $firebugMessage->setHeader(array_keys($this->_getColumns()));
     foreach ($this->_getTimers() as $timerId) {
         $row = array();
         foreach ($this->_getColumns() as $columnId) {
             $row[] = $this->_renderColumnValue($timerId, $columnId);
         }
         $firebugMessage->addRow($row);
     }
     Zend_Wildfire_Plugin_FirePhp::getInstance()->send($firebugMessage);
     // setup the wildfire channel
     $firebugChannel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $firebugChannel->setRequest($this->_request ? $this->_request : new Zend_Controller_Request_Http());
     $firebugChannel->setResponse($this->_response ? $this->_response : new Zend_Controller_Response_Http());
     // flush the wildfire headers into the response object
     $firebugChannel->flush();
     // send the response headers
     $firebugChannel->getResponse()->sendHeaders();
     ob_end_flush();
 }
開發者ID:buttasg,項目名稱:cowgirlk,代碼行數:25,代碼來源:Firebug.php

示例8: display

 /**
  * Display profiling results and flush output buffer
  *
  * @param Stat $stat
  * @return void
  */
 public function display(Stat $stat)
 {
     $firebugMessage = new \Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_renderCaption());
     $firebugMessage->setHeader(array_keys($this->_columns));
     foreach ($this->_getTimerIds($stat) as $timerId) {
         $row = array();
         foreach ($this->_columns as $column) {
             $row[] = $this->_renderColumnValue($stat->fetch($timerId, $column), $column);
         }
         $firebugMessage->addRow($row);
     }
     \Zend_Wildfire_Plugin_FirePhp::send($firebugMessage);
     // setup the wildfire channel
     $firebugChannel = \Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $firebugChannel->setRequest($this->getRequest());
     $firebugChannel->setResponse($this->getResponse());
     // flush the wildfire headers into the response object
     $firebugChannel->flush();
     // send the response headers
     $firebugChannel->getResponse()->sendHeaders();
     ob_end_flush();
 }
開發者ID:,項目名稱:,代碼行數:28,代碼來源:

示例9: __exit

function __exit()
{
    $front = Zend_Controller_Front::getInstance();
    $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
    //$channel->setRequest(new Zend_Controller_Request_Http());
    //$channel->setResponse(new Zend_Controller_Response_Http());
    $channel->getResponse();
    $channel->getRequest();
    $channel->flush();
    $channel->getResponse()->sendHeaders();
    //xdebug_get_code_coverage();
}
開發者ID:html,項目名稱:PI,代碼行數:12,代碼來源:functions.php

示例10: array

        $profiler->setEnabled(true);
        $db = Zend_Db::factory('PDO_SQLITE', array('dbname' => ':memory:'));
        $db->setProfiler($profiler);
        Zend_Registry::set('db', $db);
        $controller = Zend_Controller_Front::getInstance();
        $controller->setParam('useDefaultControllerAlways', true);
        $controller->setParam('noViewRenderer', true);
        $controller->setControllerDirectory(dirname(dirname(dirname(dirname(__FILE__)))) . '/application/controllers/Boot/Zend-Db-Profiler-Firebug');
        $controller->dispatch();
        print 'Test Doc Example with Controller';
        break;
    case 'WithoutController':
        $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
        $profiler->setEnabled(true);
        $db = Zend_Db::factory('PDO_SQLITE', array('dbname' => ':memory:'));
        $db->setProfiler($profiler);
        $request = new Zend_Controller_Request_Http();
        $response = new Zend_Controller_Response_Http();
        $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
        $channel->setRequest($request);
        $channel->setResponse($response);
        $db->getConnection()->exec('CREATE TABLE foo (
                                      id      INTEGNER NOT NULL,
                                      col1    VARCHAR(10) NOT NULL
                                    )');
        $db->insert('foo', array('id' => 1, 'col1' => 'original'));
        $channel->flush();
        $response->sendHeaders();
        print 'Test Doc Example without Controller';
        break;
}
開發者ID:travisj,項目名稱:zf,代碼行數:31,代碼來源:TestDocExample.php

示例11: testFileLineOffsets

 /**
  * @group ZF-10537
  */
 public function testFileLineOffsets()
 {
     $firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $firephp->setOption('includeLineNumbers', true);
     $firephp->setOption('maxTraceDepth', 0);
     $lines = array();
     // NOTE: Do NOT separate the following pairs otherwise the line numbers will not match for the test
     // Message number: 1
     $lines[] = __LINE__ + 1;
     $this->_logger->log('Hello World', Zend_Log::INFO);
     // Message number: 2
     $this->_logger->addPriority('TRACE', 8);
     $this->_writer->setPriorityStyle(8, 'TRACE');
     $lines[] = __LINE__ + 1;
     $this->_logger->trace('Trace to here');
     // Message number: 3
     $this->_logger->addPriority('TABLE', 9);
     $this->_writer->setPriorityStyle(9, 'TABLE');
     $table = array('Summary line for the table', array(array('Column 1', 'Column 2'), array('Row 1 c 1', ' Row 1 c 2'), array('Row 2 c 1', ' Row 2 c 2')));
     $lines[] = __LINE__ + 1;
     $this->_logger->table($table);
     // Message number: 4
     $lines[] = __LINE__ + 1;
     $this->_logger->info('Hello World');
     $messages = $protocol->getMessages();
     $messages = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI];
     for ($i = 0; $i < sizeof($messages); $i++) {
         if (!preg_match_all('/FirebugTest\\.php","Line":' . $lines[$i] . '/', $messages[$i], $m)) {
             $this->fail("File and line does not match for message number: " . ($i + 1));
         }
     }
 }
開發者ID:ThorstenSuckow,項目名稱:conjoon,代碼行數:37,代碼來源:FirebugTest.php

示例12: getResponse

 /**
  * getResponse
  *
  * <p>convert the $_response array to json and set the application mine type json</p>
  */
 public function getResponse()
 {
     if (Zend_Registry::get('config')->kebab->logging->enable && Zend_Registry::get('config')->kebab->logging->firebug->enable) {
         Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
     }
     //KBBTODO We should write an adapter for array, xml in future
     $jsonHelper = new Zend_Controller_Action_Helper_Json();
     $jsonHelper->direct($this->_response);
 }
開發者ID:esironal,項目名稱:kebab-project,代碼行數:14,代碼來源:Response.php

示例13: testNoQueriesAfterFiltering

 /**
  * @group ZF-6395
  */
 public function testNoQueriesAfterFiltering()
 {
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $profiler = $this->_profiler->setEnabled(true);
     $profiler->setFilterQueryType(Zend_Db_Profiler::INSERT | Zend_Db_Profiler::UPDATE);
     $this->_db->fetchAll('select * from foo');
     Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
     $messages = $protocol->getMessages();
     $this->assertFalse($messages);
 }
開發者ID:sasezaki,項目名稱:mirror-zf1-tests,代碼行數:14,代碼來源:FirebugTest.php

示例14: _sendFatalResponse

 protected static function _sendFatalResponse()
 {
     // Clean any previous output from buffer
     while (ob_get_level() > 0) {
         ob_end_clean();
     }
     // Send firephp headers
     if (APPLICATION_ENV == 'development') {
         try {
             $request = new Zend_Controller_Request_Http();
             $response = new Zend_Controller_Response_Http();
             $headers = Zend_Wildfire_Channel_HttpHeaders::getInstance();
             $headers->setResponse($response);
             $headers->setRequest($request);
             $headers->flush();
             $response->setBody(file_get_contents(APPLICATION_PATH . '/application/offline.html'));
             $response->sendHeaders();
             $response->sendResponse();
             die(1);
         } catch (Exception $e) {
             // Will fall through to stuff below
         }
     }
     // Send normal error message
     echo file_get_contents(APPLICATION_PATH . '/application/offline.html');
     die(1);
 }
開發者ID:robeendey,項目名稱:ce,代碼行數:27,代碼來源:Api.php

示例15: testMaxObjectArrayDepth

 /**
  * @group ZF-5540
  */
 public function testMaxObjectArrayDepth()
 {
     $this->_setupWithoutFrontController();
     $firephp = Zend_Wildfire_Plugin_FirePhp::getInstance();
     $channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
     $protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
     $firephp->setOption('maxObjectDepth', 2);
     $firephp->setOption('maxArrayDepth', 1);
     $obj = new Zend_Wildfire_WildfireTest_TestObject3();
     $obj->testArray = array('val1', array('val2', array('Hello World')));
     $obj->child = clone $obj;
     $obj->child->child = clone $obj;
     $firephp->send($obj);
     $table = array();
     $table[] = array('Col1', 'Col2');
     $table[] = array($obj, $obj);
     $firephp->send($table, 'Label', Zend_Wildfire_Plugin_FirePhp::TABLE);
     $messages = $protocol->getMessages();
     $message = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][0];
     $this->assertEquals($message, '[{"Type":"LOG"},{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":"** Max Object Depth (2) **"}}]');
     $message = $messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][1];
     $this->assertEquals($message, '[{"Type":"TABLE","Label":"Label"},[["Col1","Col2"],[{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":"** Max Object Depth (2) **"}},{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":{"__className":"Zend_Wildfire_WildfireTest_TestObject3","public:name":"Name","public:value":"Value","undeclared:testArray":["val1","** Max Array Depth (1) **"],"undeclared:child":"** Max Object Depth (2) **"}}]]]');
 }
開發者ID:bradley-holt,項目名稱:zf2,代碼行數:26,代碼來源:WildfireTest.php


注:本文中的Zend_Wildfire_Channel_HttpHeaders類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。