当前位置: 首页>>代码示例>>PHP>>正文


PHP Environment::getApplication方法代码示例

本文整理汇总了PHP中Nette\Environment::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::getApplication方法的具体用法?PHP Environment::getApplication怎么用?PHP Environment::getApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Environment的用法示例。


在下文中一共展示了Environment::getApplication方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * Register MFU into Nette
  */
 public static function register()
 {
     self::init();
     $application = Environment::getApplication();
     $application->onStartup[] = callback("MultipleFileUpload::handleUploads");
     $application->onShutdown[] = callback("MultipleFileUpload::cleanCache");
 }
开发者ID:patrickkusebauch,项目名称:27skauti,代码行数:10,代码来源:MultipleFileUpload.php

示例2: register

 /**
  * Register MFU into Nette
  */
 public static function register()
 {
     self::init();
     $application = Environment::getApplication();
     $application->onStartup[] = callback(__CLASS__, "handleUploads");
     $application->onShutdown[] = callback(__CLASS__, "cleanCache");
 }
开发者ID:jurasm2,项目名称:multiplefileupload,代码行数:10,代码来源:MultipleFileUpload.php

示例3: __construct

 public function __construct(\Nette\IComponentContainer $parent = null, $name = null)
 {
     parent::__construct($parent, $name);
     $this->setJoinFiles(Environment::isProduction());
     $this->setTempUri(Environment::getVariable("baseUri") . "data/webtemp");
     $this->setTempPath(WWW_DIR . "/data/webtemp");
     $this->setSourcePath(WWW_DIR . "/js");
     $presenter = Environment::getApplication()->getPresenter();
     $this->filters[] = new VariablesFilter(array("baseUri" => Environment::getVariable("baseUri"), "texylaPreviewPath" => $presenter->link(":Texyla:preview"), "texylaFilesPath" => $presenter->link(":Texyla:listFiles"), "texylaFilesUploadPath" => $presenter->link(":Texyla:upload")));
     if (Environment::isProduction()) {
         $this->filters[] = "JSMin::minify";
     }
     $this->init();
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:14,代码来源:JsLoader.php

示例4: redirectBack

 /**
  * Přesměruje zpět na RequestButton, když je z něj požadavek.
  * Používá ho RequestButtonReceiver a tuto funkcy lze zavolat i třeba v signálu.
  *
  * @param AppForm|PresenterComponent|NULL Null znamená vzít presenter z prostředí, u AppForm se kontroluje jestli nebyl stisknut další RequestButton.
  * @throw AbortException
  */
 public static function redirectBack($form = NULL)
 {
     if ($form === NULL) {
         $presenter = \Nette\Environment::getApplication()->getPresenter();
     } else {
         if ($form instanceof PresenterComponent or $form instanceof AppForm) {
             $presenter = $form->getPresenter();
         }
     }
     $backlinkId = $presenter->getParam(RequestButton::BACKLINK_KEY);
     if ($backlinkId and ($form === NULL or !$form->isSubmitted() instanceof RequestButton) and RequestButtonStorage::is($backlinkId)) {
         $presenter->redirect(RequestButtonStorage::getDestination($backlinkId), array(RequestButton::RECEIVED_KEY => $backlinkId, 'do' => NULL) + RequestButtonStorage::getDestinationArgs($backlinkId));
     }
 }
开发者ID:soundake,项目名称:requestbutton,代码行数:21,代码来源:RequestButtonHelper.php

示例5: netteLink

 /**
  * @param TexyHandlerInvocation  handler invocation
  * @param string
  * @param string
  * @param TexyModifier
  * @param TexyLink
  * @return TexyHtml|string|FALSE
  */
 public function netteLink($invocation, $phrase, $content, $modifier, $link)
 {
     // is there link?
     if (!$link) {
         return $invocation->proceed();
     }
     $url = $link->URL;
     if (String::startsWith($url, "plink://")) {
         $url = substr($url, 8);
         list($presenter, $params) = explode("?", $url, 2);
         $arr = array();
         if ($params) {
             parse_str($params, $arr);
         }
         $link->URL = Environment::getApplication()->getPresenter()->link($presenter, $arr);
     }
     return $invocation->proceed();
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:26,代码来源:Texy.php

示例6: setUrl

 public function setUrl($url)
 {
     $uriScript = new UriScript($url);
     $uriScript->setScriptPath(Environment::getHttpRequest()->getUri()->getScriptPath());
     $httpRequest = new HttpRequest($uriScript);
     $presenterRequest = Environment::getApplication()->getRouter()->match($httpRequest);
     if ($presenterRequest === null || !String::startsWith($url, Environment::getVariable("baseUri"))) {
         $this->url = $url ?: null;
         $this->destination = null;
         $this->params = array();
     } else {
         $presenter = $presenterRequest->getPresenterName();
         $params = $presenterRequest->getParams();
         $action = isset($params["action"]) ? $params["action"] : "default";
         $module = isset($params["module"]) ? $params["module"] . ":" : "";
         unset($params["action"]);
         $this->destination = "{$module}{$presenter}:{$action}";
         $this->params = $params;
         $this->url = null;
     }
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:21,代码来源:MenuItem.php

示例7: die

 * @copyright  Copyright (c) 2010 John Doe
 * @package    MyApplication
 */
use Nette\Debug;
use Nette\Environment;
use Nette\Application\Route;
use Nette\Application\SimpleRouter;
// REMOVE THIS LINE
if (!is_file(LIBS_DIR . '/Nette/loader.php')) {
    die('Copy Nette Framework to /libs/ directory.');
}
// Step 1: Load Nette Framework
// this allows load Nette Framework classes automatically so that
// you don't have to litter your code with 'require' statements
require LIBS_DIR . '/Nette/loader.php';
// Step 2: Configure environment
// 2a) enable Nette\Debug for better exception and error visualisation
Debug::enable();
// 2b) load configuration from config.ini file
Environment::loadConfig();
// Step 3: Configure application
// 3a) get and setup a front controller
$application = Environment::getApplication();
$application->errorPresenter = 'Error';
//$application->catchExceptions = TRUE;
// Step 4: Setup application router
$router = $application->getRouter();
$router[] = new Route('index.php', array('presenter' => 'Homepage', 'action' => 'default'), Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>/<id>', array('presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
// Step 5: Run the application!
$application->run();
开发者ID:jakubkulhan,项目名称:nette,代码行数:31,代码来源:bootstrap.php

示例8: onShutdown

 /**
  * @param $presenter Presenter
  * @param $response PresenterResponse
  * @internal
  */
 public function onShutdown($presenter, $response)
 {
     $this->response = $response;
     $application = Environment::getApplication();
     $presenter = $application->getPresenter();
     $request = $presenter->getRequest();
     $httpRequest = Environment::getHttpRequest();
     $entry = array();
     if ($signal = $presenter->getSignal()) {
         $receiver = empty($signal[0]) ? $presenter->name : $signal[0];
         $signal = $receiver . " :: " . $signal[1];
     }
     if ($response !== NULL) {
         $rInfo = get_class($response);
         if ($response->getReflection()->hasMethod('getCode')) {
             $rInfo .= ' (' . $response->code . ')';
         }
     }
     $entry['info']['presenter'] = $presenter->backlink();
     $entry['info']['response'] = $response === NULL ? 'NO RESPONSE' : $rInfo;
     $entry['info']['uri'] = $httpRequest->getUrl();
     $entry['info']['uriPath'] = $httpRequest->getUrl()->path;
     $entry['info']['request'] = $request->getMethod();
     $entry['info']['signal'] = $signal;
     $entry['info']['time'] = number_format((microtime(TRUE) - Debugger::$time) * 1000, 1, '.', ' ');
     $entry['dumps']['HttpRequest'] = Helpers::clickableDump($httpRequest);
     $entry['dumps']['PresenterRequest'] = Helpers::clickableDump($request);
     $entry['dumps']['Presenter'] = Helpers::clickableDump($presenter);
     $entry['dumps']['PresenterResponse'] = Helpers::clickableDump($response);
     foreach (self::$dumps as $key => $dump) {
         if (is_numeric($key)) {
             $entry['dumps'][] = $dump;
         } else {
             $entry['dumps'][$key] = $dump;
         }
     }
     $session = Environment::getSession('debug/RequestsPanel');
     if (!isset($session->logs)) {
         $session->logs = array();
     }
     $session->logs[] = $entry;
 }
开发者ID:jasir,项目名称:RequestsPanel,代码行数:47,代码来源:RequestsPanel.php

示例9: getApplication

 /**
  * @return Application
  */
 public function getApplication()
 {
     return Environment::getApplication();
 }
开发者ID:jff15,项目名称:travelbot,代码行数:7,代码来源:Presenter.php

示例10: getEntityManager

 /**
  * @return Doctrine\ORM\EntityManager
  */
 public function getEntityManager()
 {
     return Environment::getApplication()->getContext()->getService('Doctrine\\ORM\\EntityManager');
 }
开发者ID:jff15,项目名称:travelbot,代码行数:7,代码来源:TestCase.php

示例11: function

require LIBS_DIR . '/Nette/loader.php';
require APP_DIR . '/routers/StaticRouter.php';
require APP_DIR . '/managers/PageManager.php';
require APP_DIR . '/classes/TemplateLocator.php';
require APP_DIR . '/classes/PresenterFactory.php';

// Enable and setup Nette\Debug
Debug::enable();
Debug::$strictMode = !Debug::$productionMode;

// Configure environment
date_default_timezone_set('Europe/Prague');
Html::$xhtml = FALSE;

// Configure application
$application = Env::getApplication();
$application->errorPresenter = 'Error';
$application->catchExceptions = Debug::$productionMode;

// Configure application context
$context = $application->getContext();
$context->addService('StaticWeb\\TemplateLocator', 'StaticWeb\\TemplateLocator');
$context->addService('StaticWeb\\PageManager', function() use ($context) {
	$manager = new PageManager();
	$manager->setContext($context);
	return $manager;
});
$context->addService('Nette\\Application\\IPresenterFactory', function() use ($context) {
	return new PresenterFactory(Env::getVariable('appDir'), $context);
});
$context->addService('Nette\\Application\\IRouter', function() use ($context) {
开发者ID:JanTvrdik,项目名称:StaticWeb,代码行数:31,代码来源:bootstrap.php

示例12: getPanel

 /**
  * Renders HTML code for custom panel.
  * @return string
  * @see IDebugPanel::getPanel()
  */
 public function getPanel()
 {
     if ($this->response instanceof \Nette\Application\Responses\ForwardResponse || $this->response instanceof \Nette\Application\Responses\RedirectResponse) {
         return '';
     }
     /** @var Template */
     $template = new FileTemplate();
     $template->setFile(dirname(__FILE__) . "/bar.latte");
     $template->registerFilter(new Engine());
     $template->presenter = $template->control = $template->rootComponent = Environment::getApplication()->getPresenter();
     if ($template->presenter === NULL) {
         return NULL;
     }
     $template->wrap = static::$wrap;
     $template->cache = static::$cache ? Environment::getCache('Debugger.Panels.ComponentTree') : NULL;
     $template->dumps = static::$dumps;
     $template->parametersOpen = static::$parametersOpen;
     $template->presenterOpen = static::$presenterOpen;
     $template->showSources = static::$showSources;
     $template->omittedVariables = static::$omittedTemplateVariables;
     $template->registerHelper('parametersInfo', callback($this, 'getParametersInfo'));
     $template->registerHelper('editlink', callback($this, 'buildEditorLink'));
     $template->registerHelper('highlight', callback($this, 'highlight'));
     $template->registerHelper('filterMethods', callback($this, 'filterMethods'));
     $template->registerHelper('renderedTemplates', callback($this, 'getRenderedTemplates'));
     $template->registerHelper('isPersistent', callback($this, 'isPersistent'));
     $template->registerHelperLoader('Nette\\Templating\\Helpers::loader');
     ob_start();
     $template->render();
     return ob_get_clean();
 }
开发者ID:vojtabiberle,项目名称:ComponentTreePanel,代码行数:36,代码来源:ComponentTreePanel.php

示例13: getApplication

	/**
	 * Returns Application instance.
	 *
	 * @author   David Grudl
	 * @return   Nette\Application\Application
	 */
	protected function getApplication()
	{
		return Env::getApplication();
	}
开发者ID:JanTvrdik,项目名称:NetteExtrasWeb,代码行数:10,代码来源:BaseStaticPresenter.php


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