本文整理汇总了PHP中Debug::addPanel方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::addPanel方法的具体用法?PHP Debug::addPanel怎么用?PHP Debug::addPanel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::addPanel方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (class_exists('Debug', FALSE) && is_callable('Debug::addPanel')) {
/*Nette\*/
Debug::addPanel($this);
}
$this->useFirebug = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'FirePHP/');
}
示例2: __construct
public function __construct(array $config)
{
if (class_exists('Debug', FALSE) && is_callable('Debug::addPanel')) {
/*Nette\*/
Debug::addPanel($this);
}
$this->useFirebug = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'FirePHP/');
if (isset($config['filter'])) {
$this->setFilter($config['filter']);
}
if (isset($config['explain'])) {
$this->explainQuery = (bool) $config['explain'];
}
}
示例3: __construct
public function __construct(array $config)
{
if (is_callable('Nette\\Debug::addPanel')) {
call_user_func('Nette\\Debug::addPanel', $this);
} elseif (is_callable('NDebug::addPanel')) {
NDebug::addPanel($this);
} elseif (is_callable('Debug::addPanel')) {
Debug::addPanel($this);
}
$this->useFirebug = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'FirePHP/');
if (isset($config['file'])) {
$this->setFile($config['file']);
}
if (isset($config['filter'])) {
$this->setFilter($config['filter']);
}
if (isset($config['explain'])) {
$this->explainQuery = (bool) $config['explain'];
}
}
示例4: register
/**
* Registeres panel to Debug bar
*/
public static function register()
{
Debug::addPanel(new self());
}
示例5: Route
$routes[] = new Route('<lang [a-z]{2}>/<id>/', array('module' => 'Front', 'presenter' => 'Page', 'action' => 'default', 'id' => array(Route::FILTER_IN => callback('MenuSeoModel::findIdByUri'), Route::FILTER_OUT => callback('MenuSeoModel::findUriById')), 'lang' => NULL));
// setup CLI mode
if (Environment::isConsole()) {
Debug::$productionMode = false;
// to allow 'dump' render output
$application->allowedMethods = false;
$routes[] = new CliRouter(array('action' => 'Console:Default:default'));
}
$application->addRoutes($routes);
FormMacros::register();
/***** ***** **
* Debug Bar *
****** ***** **/
$todoPanel = new TodoPanel();
$todoPanel->todoMask = array('TODO', 'FIXME', 'FIX ME', 'FIX', 'TO DO', 'PENDING', 'XXX');
Debug::addPanel($todoPanel);
//PresenterTreePanel::register();
CallbackPanel::register();
FtpPermissionPanel::register();
//$callbacks = array();
////můj nový callback
//$callbacks[] = array(
// 'name' => "Rebuild RobotLoader Cache",
// 'callback' => callback(Environment::getService('Nette\Loaders\RobotLoader'), 'rebuild'),
// 'args' => array() //pole argumentů pro callback
//);
//CallbackPanel::register($callbacks);
/***** ***** ******
* Debug Bar END *
****** ***** ******/
// Step 5: Run the application!
示例6: __construct
static$fireTable=array(array('Time','SQL Statement','Rows','Connection'));function
__construct(array$config){if(is_callable('Nette\Debug::addPanel')){call_user_func('Nette\Debug::addPanel',$this);}elseif(is_callable('NDebug::addPanel')){NDebug::addPanel($this);}elseif(is_callable('Debug::addPanel')){Debug::addPanel($this);}$this->useFirebug=isset($_SERVER['HTTP_USER_AGENT'])&&strpos($_SERVER['HTTP_USER_AGENT'],'FirePHP/');if(isset($config['file'])){$this->setFile($config['file']);}if(isset($config['filter'])){$this->setFilter($config['filter']);}if(isset($config['explain'])){$this->explainQuery=(bool)$config['explain'];}}function
示例7: run
function run()
{
$httpRequest = $this->getHttpRequest();
$httpResponse = $this->getHttpResponse();
$httpRequest->setEncoding('UTF-8');
$httpResponse->setHeader('X-Powered-By', 'Nette Framework');
if (Environment::getVariable('baseUri') === NULL) {
Environment::setVariable('baseUri', $httpRequest->getUri()->getBasePath());
}
$session = $this->getSession();
if (!$session->isStarted() && $session->exists()) {
$session->start();
}
Debug::addPanel(new RoutingDebugger($this->getRouter(), $httpRequest));
if ($this->allowedMethods) {
$method = $httpRequest->getMethod();
if (!in_array($method, $this->allowedMethods, TRUE)) {
$httpResponse->setCode(IHttpResponse::S501_NOT_IMPLEMENTED);
$httpResponse->setHeader('Allow', implode(',', $this->allowedMethods));
echo '<h1>Method ' . htmlSpecialChars($method) . ' is not implemented</h1>';
return;
}
}
$request = NULL;
$repeatedError = FALSE;
do {
try {
if (count($this->requests) > self::$maxLoop) {
throw new ApplicationException('Too many loops detected in application life cycle.');
}
if (!$request) {
$this->onStartup($this);
$router = $this->getRouter();
if ($router instanceof MultiRouter && !count($router)) {
$router[] = new SimpleRouter(array('presenter' => 'Default', 'action' => 'default'));
}
$request = $router->match($httpRequest);
if (!$request instanceof PresenterRequest) {
$request = NULL;
throw new BadRequestException('No route for HTTP request.');
}
if (strcasecmp($request->getPresenterName(), $this->errorPresenter) === 0) {
throw new BadRequestException('Invalid request.');
}
}
$this->requests[] = $request;
$this->onRequest($this, $request);
$presenter = $request->getPresenterName();
try {
$class = $this->getPresenterLoader()->getPresenterClass($presenter);
$request->setPresenterName($presenter);
} catch (InvalidPresenterException $e) {
throw new BadRequestException($e->getMessage(), 404, $e);
}
$request->freeze();
$this->presenter = new $class();
$response = $this->presenter->run($request);
if ($response instanceof ForwardingResponse) {
$request = $response->getRequest();
continue;
} elseif ($response instanceof IPresenterResponse) {
$response->send();
}
break;
} catch (Exception $e) {
if ($this->catchExceptions === NULL) {
$this->catchExceptions = Environment::isProduction();
}
if (!$this->catchExceptions) {
throw $e;
}
$this->onError($this, $e);
if ($repeatedError) {
$e = new ApplicationException('An error occured while executing error-presenter', 0, $e);
}
if (!$httpResponse->isSent()) {
$httpResponse->setCode($e instanceof BadRequestException ? $e->getCode() : 500);
}
if (!$repeatedError && $this->errorPresenter) {
$repeatedError = TRUE;
$request = new PresenterRequest($this->errorPresenter, PresenterRequest::FORWARD, array('exception' => $e));
} else {
echo "<meta name='robots' content='noindex'>\n\n";
if ($e instanceof BadRequestException) {
echo "<title>404 Not Found</title>\n\n<h1>Not Found</h1>\n\n<p>The requested URL was not found on this server.</p>";
} else {
Debug::processException($e, FALSE);
echo "<title>500 Internal Server Error</title>\n\n<h1>Server Error</h1>\n\n", "<p>The server encountered an internal error and was unable to complete your request. Please try again later.</p>";
}
echo "\n\n<hr>\n<small><i>Nette Framework</i></small>";
break;
}
}
} while (1);
$this->onShutdown($this, isset($e) ? $e : NULL);
}
示例8: run
/**
* Dispatch a HTTP request to a front controller.
* @return void
*/
public function run()
{
$httpRequest = $this->getHttpRequest();
$httpResponse = $this->getHttpResponse();
$httpRequest->setEncoding('UTF-8');
if (Environment::getVariable('baseUri') === NULL) {
Environment::setVariable('baseUri', $httpRequest->getUri()->getBasePath());
}
// autostarts session
$session = $this->getSession();
if (!$session->isStarted() && $session->exists()) {
$session->start();
}
// enable routing debuggger
Debug::addPanel(new RoutingDebugger($this->getRouter(), $httpRequest));
// check HTTP method
if ($this->allowedMethods) {
$method = $httpRequest->getMethod();
if (!in_array($method, $this->allowedMethods, TRUE)) {
$httpResponse->setCode(IHttpResponse::S501_NOT_IMPLEMENTED);
$httpResponse->setHeader('Allow', implode(',', $this->allowedMethods));
echo '<h1>Method ' . htmlSpecialChars($method) . ' is not implemented</h1>';
return;
}
}
// dispatching
$request = NULL;
$repeatedError = FALSE;
do {
try {
if (count($this->requests) > self::$maxLoop) {
throw new ApplicationException('Too many loops detected in application life cycle.');
}
if (!$request) {
$this->onStartup($this);
// default router
$router = $this->getRouter();
if ($router instanceof MultiRouter && !count($router)) {
$router[] = new SimpleRouter(array('presenter' => 'Default', 'action' => 'default'));
}
// routing
$request = $router->match($httpRequest);
if (!$request instanceof PresenterRequest) {
$request = NULL;
throw new BadRequestException('No route for HTTP request.');
}
if (strcasecmp($request->getPresenterName(), $this->errorPresenter) === 0) {
throw new BadRequestException('Invalid request.');
}
}
$this->requests[] = $request;
$this->onRequest($this, $request);
// Instantiate presenter
$presenter = $request->getPresenterName();
try {
$class = $this->getPresenterLoader()->getPresenterClass($presenter);
$request->setPresenterName($presenter);
} catch (InvalidPresenterException $e) {
throw new BadRequestException($e->getMessage(), 404, $e);
}
$request->freeze();
// Execute presenter
$this->presenter = new $class();
$response = $this->presenter->run($request);
// Send response
if ($response instanceof ForwardingResponse) {
$request = $response->getRequest();
continue;
} elseif ($response instanceof IPresenterResponse) {
$response->send();
}
break;
} catch (Exception $e) {
// fault barrier
if ($this->catchExceptions === NULL) {
$this->catchExceptions = Environment::isProduction();
}
$this->onError($this, $e);
if (!$this->catchExceptions) {
$this->onShutdown($this, $e);
throw $e;
}
if ($repeatedError) {
$e = new ApplicationException('An error occured while executing error-presenter', 0, $e);
}
if (!$httpResponse->isSent()) {
$httpResponse->setCode($e instanceof BadRequestException ? $e->getCode() : 500);
}
if (!$repeatedError && $this->errorPresenter) {
$repeatedError = TRUE;
$request = new PresenterRequest($this->errorPresenter, PresenterRequest::FORWARD, array('exception' => $e));
// continue
} else {
// default error handler
if ($e instanceof BadRequestException) {
$code = $e->getCode();
//.........这里部分代码省略.........
示例9: register
/**
* Registers panel to Debug bar
* @return UserPanel;
*/
public static function register()
{
$panel = new self();
Debug::addPanel($panel);
return $panel;
}
示例10: register
/**
* Register this panel
*
* @param array $items items for add to pannel
*/
public static function register(array $items = NULL)
{
if (self::$registered) {
throw new InvalidStateException("Callback panel is already registered");
}
Debug::addPanel(new static($items));
// Debug::addPanel(new self($items));
// Debug::addPanel(new self);
self::$registered = TRUE;
}