getRequests() public method

Returns all processed requests.
public getRequests ( ) : Nette\Application\Request[]
return Nette\Application\Request[]
示例#1
0
 public static function initialize(Nette\Application\Application $application, Nette\Http\IRequest $httpRequest)
 {
     Debugger::$bar->addPanel(new self($application->getRouter(), $httpRequest));
     Debugger::$blueScreen->addPanel(function ($e) use($application) {
         if ($e === NULL) {
             return array('tab' => 'Nette Application', 'panel' => '<h3>Requests</h3>' . Nette\Diagnostics\Helpers::clickableDump($application->getRequests()) . '<h3>Presenter</h3>' . Nette\Diagnostics\Helpers::clickableDump($application->getPresenter()));
         }
     });
 }
示例#2
0
	public static function initializePanel(Nette\Application\Application $application)
	{
		Tracy\Debugger::getBlueScreen()->addPanel(function ($e) use ($application) {
			return $e ? NULL : array(
				'tab' => 'Nette Application',
				'panel' => '<h3>Requests</h3>' . Tracy\Dumper::toHtml($application->getRequests())
					. '<h3>Presenter</h3>' . Tracy\Dumper::toHtml($application->getPresenter()),
			);
		});
	}
示例#3
0
 /**
  * Registers translation micro presenter
  * which handles translation saves
  *
  * This method is called from $app->onStartup() event
  */
 static function register(Nette\Application\Application $app)
 {
     if (isset(self::$registeredRoute)) {
         throw new Nette\InvalidStateException(__CLASS__ . "::register called twice?");
     }
     $routeList = $app->getRouter();
     self::$registeredRoute = new Nette\Application\Routers\Route('/<language [a-z]{2}>/vbuilder-translation-bar/<token [a-z0-9]{8}>', function (vBuilder\Localization\Translator $translator, Nette\Http\Session $session) use($app) {
         list($request) = $app->getRequests();
         $dictionary = NULL;
         foreach ($translator->getDictionaries() as $name => $dict) {
             if ($name == 'translationBar') {
                 $dictionary = $dict;
                 break;
             }
         }
         if ($dictionary === NULL) {
             throw new Nette\InvalidStateException("Missing translationBar dictionary");
         }
         if (!$dictionary->isFrozen()) {
             $dictionary->init($request->parameters['language']);
         }
         if (!$request->isPost()) {
             throw new Nette\Application\BadRequestException('Expected POST', 400);
         }
         // Check authorization token (basic CSRF prevention)
         $session = $session->getSection(strtr(__CLASS__, '\\', '.'));
         if (!isset($session->authToken) || $request->parameters['token'] != $session->authToken) {
             throw new Nette\Application\BadRequestException('Invalid token', 403);
         }
         // Process input
         $data = Nette\Utils\Json::decode(file_get_contents('php://input'), Nette\Utils\Json::FORCE_ARRAY);
         if (isset($data['translations'])) {
             foreach ($data['translations'] as $tr) {
                 if (!isset($tr['key']) || !isset($tr['value'])) {
                     continue;
                 }
                 $dictionary->addTranslation($tr['key'], (array) $tr['value']);
             }
         }
         // @note atomicity?
         $dictionary->save();
         $payload = array('ok' => TRUE);
         return new Nette\Application\Responses\JsonResponse($payload);
     });
     // Add our route as first
     $routeList[] = self::$registeredRoute;
     // Bypass the index check by expanding array
     for ($i = count($routeList) - 1; $i > 0; $i--) {
         $routeList[$i] = $routeList[$i - 1];
     }
     $routeList[0] = self::$registeredRoute;
 }
示例#4
0
 public static function initializePanel(Nette\Application\Application $application)
 {
     Debugger::$blueScreen->addPanel(function ($e) use($application) {
         return $e ? NULL : array('tab' => 'Nette Application', 'panel' => '<h3>Requests</h3>' . Nette\Diagnostics\Helpers::clickableDump($application->getRequests()) . '<h3>Presenter</h3>' . Nette\Diagnostics\Helpers::clickableDump($application->getPresenter()));
     });
 }