本文整理汇总了PHP中Zend_Wildfire_Channel_HttpHeaders类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Wildfire_Channel_HttpHeaders类的具体用法?PHP Zend_Wildfire_Channel_HttpHeaders怎么用?PHP Zend_Wildfire_Channel_HttpHeaders使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Wildfire_Channel_HttpHeaders类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: testAdvancedLogging
/**
* @group ZF-4934
*/
public function testAdvancedLogging()
{
Zend_Wildfire_Plugin_FirePhp::getInstance()->setOption('maxTraceDepth', 0);
$message = 'This is a log message!';
$label = 'Test Label';
$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')));
$this->_logger->addPriority('TRACE', 8);
$this->_logger->addPriority('TABLE', 9);
$this->_writer->setPriorityStyle(8, 'TRACE');
$this->_writer->setPriorityStyle(9, 'TABLE');
$this->_logger->trace($message);
$this->_logger->table($table);
try {
throw new Exception('Test Exception');
} catch (Exception $e) {
$this->_logger->err($e);
}
try {
Zend_Wildfire_Plugin_FirePhp::send($message, $label, 'UNKNOWN');
$this->fail('Should not be able to log with undefined log style');
} catch (Exception $e) {
// success
}
$channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
$protocol = $channel->getProtocol(Zend_Wildfire_Plugin_FirePhp::PROTOCOL_URI);
$messages = array(Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE => array(Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI => array(1 => '[{"Type":"TABLE"},["Summary line for the table",[["Column 1","Column 2"],["Row 1 c 1"," Row 1 c 2"],["Row 2 c 1"," Row 2 c 2"]]]]')));
$qued_messages = $protocol->getMessages();
unset($qued_messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][0]);
unset($qued_messages[Zend_Wildfire_Plugin_FirePhp::STRUCTURE_URI_FIREBUGCONSOLE][Zend_Wildfire_Plugin_FirePhp::PLUGIN_URI][2]);
$this->assertEquals(serialize($qued_messages), serialize($messages));
}
开发者ID:rexmac,项目名称:zf2,代码行数:34,代码来源:FirebugTest.php
示例17: _toFirebug
public static function _toFirebug()
{
$timers = self::getTimers();
$rows = array();
$rows[] = array('Name', 'Time', 'Count', 'Real Mem', 'Emallac');
foreach ($timers as $name => $timer) {
$row = array();
$row[] = $name;
$row[] = number_format(self::fetch($name, 'sum'), 5);
$row[] = number_format(self::fetch($name, 'count'));
$row[] = number_format(self::fetch($name, 'realmem'));
$row[] = number_format(self::fetch($name, 'emalloc'));
$rows[] = $row;
}
$count = count($timers);
$table = array("App Profiling ({$count} total)", $rows);
Zend_Registry::get('log')->table($table);
Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
}
开发者ID:EvanDotPro,项目名称:cosmos,代码行数:19,代码来源:Profiler.php
示例18: setFirebugChannel
/**
* Setter method for the channel property. If no channel given
* a new instance of the Zend_Wildfire_Channel_HttpHeaders will be used.
*
* @param Zend_Wildfire_Channel_HttpHeaders $channel
*/
public function setFirebugChannel($channel = null)
{
if ($channel === null) {
$channel = Zend_Wildfire_Channel_HttpHeaders::getInstance();
}
$this->channel = $channel;
}
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:13,代码来源:Bootstrap.php
示例19: setAjax
/**
* Call this in controller (before any output) to dispatch Ajax requests.
*
* @param string $id ID to recognize the request from multiple tables ajax request will be ignored if FALSE
*
* @return void
*/
public function setAjax($id = '')
{
$this->setId($id);
// apply additional configuration
$this->runConfigCallbacks();
// track that this function was called
$this->_ajaxFuncCalled = true;
// if request is Ajax we should only return data
if (false !== $id && $this->isAjaxRequest() && isset($_GET['q']) && $id === $_GET['q']) {
// prepare data
parent::deploy();
// set data in JSON format
$response = Zend_Controller_Front::getInstance()->getResponse();
if (!self::$debug) {
$response->setHeader('Content-Type', 'application/json');
}
$response->setBody($this->renderPartData());
// send logged messages to FirePHP
Zend_Wildfire_Channel_HttpHeaders::getInstance()->flush();
// send the response now and end request processing
$response->sendResponse();
exit;
}
}
开发者ID:robjacoby,项目名称:xlr8u,代码行数:31,代码来源:JqGrid.php
示例20: testHttpHeadersChannelSubclass
public function testHttpHeadersChannelSubclass()
{
$firephp = Zend_Wildfire_Channel_HttpHeaders::init('Zend_Wildfire_WildfireTest_HttpHeadersChannel');
$this->assertEquals(get_class($firephp), 'Zend_Wildfire_WildfireTest_HttpHeadersChannel');
Zend_Wildfire_Channel_HttpHeaders::destroyInstance();
try {
Zend_Wildfire_Channel_HttpHeaders::init('Zend_Wildfire_WildfireTest_Request');
$this->fail('Should not be able to initialize');
} catch (Exception $e) {
// success
}
$this->assertNull(Zend_Wildfire_Channel_HttpHeaders::getInstance(true));
try {
Zend_Wildfire_Channel_HttpHeaders::init(array());
$this->fail('Should not be able to initialize');
} catch (Exception $e) {
// success
}
$this->assertNull(Zend_Wildfire_Channel_HttpHeaders::getInstance(true));
}
开发者ID:lortnus,项目名称:zf1,代码行数:20,代码来源:WildfireTest.php
注:本文中的Zend_Wildfire_Channel_HttpHeaders类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论