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


PHP Environment::getVariable方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     // output
     $this->setOutputMode(self::HTML4_TRANSITIONAL);
     $this->htmlOutputModule->removeOptional = FALSE;
     $this->htmlOutputModule->lineWrap = false;
     $this->headingModule->balancing = TexyHeadingModule::FIXED;
     $this->allowed['phrase/sup'] = true;
     $this->allowed['phrase/sub'] = true;
     $this->allowed['phrase/del'] = true;
     // images
     $this->imageModule->fileRoot = WWW_DIR . "/data/files";
     $this->imageModule->root = Environment::getVariable("baseUri") . "data/files";
     // align classes
     //		$this->alignClasses['left'] = 'left';
     //		$this->alignClasses['right'] = 'right';
     //		$this->alignClasses['center'] = 'center';
     // justify, top, bottom, middle
     $this->imageModule->leftClass = "left";
     $this->imageModule->rightClass = "right";
     $this->figureModule->class = "box";
     $this->figureModule->leftClass = "box left";
     $this->figureModule->rightClass = "box right";
     $this->figureModule->widthDelta = 0;
     // handlers
     $this->addHandler('afterTable', array($this, 'afterTable'));
     $this->addHandler('image', array($this, 'youtubeHandler'));
     $this->addHandler('image', array($this, 'flashHandler'));
     $this->addHandler("phrase", array($this, "netteLink"));
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:31,代码来源:Texy.php

示例2: createTemplate

 /**
  * @return Nette\Templates\ITemplate
  */
 protected function createTemplate()
 {
     $template = new Nette\Templates\FileTemplate();
     $presenter = $this->getPresenter(FALSE);
     $template->onPrepareFilters[] = callback($this, 'templatePrepareFilters');
     // default parameters
     $template->control = $this;
     $template->presenter = $presenter;
     $template->user = Nette\Environment::getUser();
     $template->baseUri = Nette\Environment::getVariable('baseUri', NULL);
     $template->basePath = rtrim($template->baseUri, '/');
     // flash message
     if ($presenter !== NULL && $presenter->hasFlashSession()) {
         $id = $this->getParamId('flash');
         $template->flashes = $presenter->getFlashSession()->{$id};
     }
     if (!isset($template->flashes) || !is_array($template->flashes)) {
         $template->flashes = array();
     }
     // default helpers
     $template->registerHelper('escape', 'Nette\\Templates\\TemplateHelpers::escapeHtml');
     $template->registerHelper('escapeUrl', 'rawurlencode');
     $template->registerHelper('stripTags', 'strip_tags');
     $template->registerHelper('nl2br', 'nl2br');
     $template->registerHelper('substr', 'iconv_substr');
     $template->registerHelper('repeat', 'str_repeat');
     $template->registerHelper('replaceRE', 'Nette\\String::replace');
     $template->registerHelper('implode', 'implode');
     $template->registerHelper('number', 'number_format');
     $template->registerHelperLoader('Nette\\Templates\\TemplateHelpers::loader');
     return $template;
 }
开发者ID:JPalounek,项目名称:IconStore,代码行数:35,代码来源:Control.php

示例3: startup

 /**
  * Startup
  */
 public function startup()
 {
     parent::startup();
     $texy = Environment::getService("Texy");
     $this->baseFolderPath = $texy->imageModule->fileRoot;
     $this->baseFolderUri = $texy->imageModule->root;
     $this->tempDir = WWW_DIR . "/webtemp";
     $this->tempUri = Environment::getVariable("baseUri") . "/webtemp";
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:12,代码来源:TexylaPresenter.php

示例4: formatLayoutTemplateFiles

 public function formatLayoutTemplateFiles($presenter, $layout)
 {
     $appDir = Environment::getVariable('appDir');
     $path = '/' . str_replace(':', 'Module/', $presenter);
     $pathP = substr_replace($path, '/templates', strrpos($path, '/'), 0);
     $list = array("{$appDir}{$pathP}/@{$layout}.phtml", "{$appDir}{$pathP}.@{$layout}.phtml", NEURON_DIR . "{$pathP}/@{$layout}.phtml", NEURON_DIR . "{$pathP}.@{$layout}.phtml");
     while (($path = substr($path, 0, strrpos($path, '/'))) !== FALSE) {
         $list[] = "{$appDir}{$path}/templates/@{$layout}.phtml";
         $list[] = NEURON_DIR . "{$path}/templates/@{$layout}.phtml";
     }
     return $list;
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:12,代码来源:BasePresenter.php

示例5: __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

示例6: __construct

 public function __construct(\Nette\IComponentContainer $parent = null, $name = null)
 {
     parent::__construct($parent, $name);
     $this->setSourcePath(WWW_DIR . "/css");
     $this->setTempUri(Environment::getVariable("baseUri") . "data/webtemp");
     $this->setTempPath(WWW_DIR . "/data/webtemp");
     $this->setJoinFiles(Environment::isProduction());
     $this->fileFilters[] = new Webloader\LessFilter();
     if (Environment::isProduction()) {
         $this->filters[] = function ($code) {
             return cssmin::minify($code, "remove-last-semicolon");
         };
     }
     $this->init();
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:15,代码来源:CssLoader.php

示例7: processArguments

 public function processArguments($args, IContext $context)
 {
     return array_map(function ($arg) use($context) {
         if (!is_string($arg)) {
             return $arg;
         } elseif (String::startsWith($arg, "%")) {
             return $context->getService(substr($arg, 1));
         } elseif (String::startsWith($arg, "\$\$")) {
             return Environment::getConfig(substr($arg, 2));
         } elseif (String::startsWith($arg, "\$")) {
             return Environment::getVariable(substr($arg, 1));
         } else {
             return $arg;
         }
     }, $args);
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:16,代码来源:ServiceLoader.php

示例8: absolutizeUrl

 /**
  * Make relative url absolute
  * @param string image url
  * @param string single or double quote
  * @param string absolute css file path
  * @param string source path
  * @return string
  */
 public static function absolutizeUrl($url, $quote, $cssFile, $sourcePath)
 {
     // is already absolute
     if (preg_match("/^([a-z]+:\\/)?\\//", $url)) {
         return $url;
     }
     $docroot = realpath(WWW_DIR);
     $basePath = rtrim(Environment::getVariable("baseUri"), '/');
     // inside document root
     if (String::startsWith($cssFile, $docroot)) {
         $path = $basePath . substr(dirname($cssFile), strlen($docroot)) . DIRECTORY_SEPARATOR . $url;
         // outside document root
     } else {
         $path = $basePath . substr($sourcePath, strlen($docroot)) . DIRECTORY_SEPARATOR . $url;
     }
     //$path = self::cannonicalizePath($path);
     $path = strtr($path, "\\", "/");
     return $quote === '"' ? addslashes($path) : $path;
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:27,代码来源:CssUrlsFilter.php

示例9: 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

示例10: match

	public function match(IHttpRequest $httpRequest)
	{
		$path = substr($httpRequest->getUri()->getAbsoluteUri(), strlen(Environment::getVariable("baseUri")));

		foreach ($this->getData() as $id => $url) {
			if ($this->prefix . $url == $path || $this->prefix . $url . "/" == $path) {
				$params = $httpRequest->getQuery();
				$params["id"] = $id;
				$params["action"] = $this->action;

				return new PresenterRequest(
					$this->presenter,
					$httpRequest->getMethod(),
					$params,
					$httpRequest->getPost(),
					$httpRequest->getFiles(),
					array('secured' => $httpRequest->isSecured())
				);
			}
		}

		return null;
	}
开发者ID:JanTvrdik,项目名称:Neuron,代码行数:23,代码来源:SeoRouter.php

示例11: function

use Nette\Web\Html;



// Load libraries
require LIBS_DIR . '/Nette/loader.php';
require APP_DIR . '/routers/StaticRouter.php';
require APP_DIR . '/classes/TemplateLocator.php';
require APP_DIR . '/classes/PresenterLoader.php';

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

// Configure environment
date_default_timezone_set('Europe/Prague');
Html::$xhtml = FALSE;
Env::getContext()->addService('TemplateLocator', 'StaticWeb\TemplateLocator');
Env::getContext()->addService('Nette\\Application\\IPresenterLoader', function () {
	return new PresenterLoader(Env::getVariable('appDir'));
});

// Configure application
$application = Env::getApplication();
$application->errorPresenter = 'Error';
$application->catchExceptions = Debug::$productionMode;
$application->setRouter(new StaticRouter('StaticPage', 'homepage', 'default'));

// Run the application!
$application->run();
开发者ID:JanTvrdik,项目名称:NetteExtrasWeb,代码行数:30,代码来源:bootstrap.php

示例12: formatTemplateFiles

 /**
  * Formats view template file names.
  * @param  string
  * @param  string
  * @return array
  */
 public function formatTemplateFiles($presenter, $view)
 {
     $appDir = Environment::getVariable('appDir');
     $path = '/' . str_replace(':', 'Module/', $presenter);
     $pathP = substr_replace($path, '/templates', strrpos($path, '/'), 0);
     $path = substr_replace($path, '/templates', strrpos($path, '/'));
     return array("{$appDir}{$pathP}/{$view}.phtml", "{$appDir}{$pathP}.{$view}.phtml", "{$appDir}{$path}/@global.{$view}.phtml");
 }
开发者ID:jff15,项目名称:travelbot,代码行数:14,代码来源:Presenter.php

示例13: createRobotLoader

 /**
  * @return Nette\Loaders\RobotLoader
  */
 public static function createRobotLoader($options)
 {
     $loader = new Nette\Loaders\RobotLoader();
     $loader->autoRebuild = isset($options['autoRebuild']) ? $options['autoRebuild'] : !Environment::isProduction();
     $loader->setCacheStorage(Environment::getService('Nette\\Caching\\ICacheStorage'));
     if (isset($options['directory'])) {
         $loader->addDirectory($options['directory']);
     } else {
         foreach (array('appDir', 'libsDir') as $var) {
             if ($dir = Environment::getVariable($var, NULL)) {
                 $loader->addDirectory($dir);
             }
         }
     }
     $loader->register();
     return $loader;
 }
开发者ID:JPalounek,项目名称:IconStore,代码行数:20,代码来源:Configurator.php

示例14: getCacheStorage

 /**
  * @return Nette\Caching\ICacheStorage
  */
 public static function getCacheStorage()
 {
     if (self::$cacheStorage === NULL) {
         $dir = Environment::getVariable('tempDir') . '/cache';
         umask(00);
         @mkdir($dir, 0755);
         // @ - directory may exists
         self::$cacheStorage = new TemplateCacheStorage($dir);
     }
     return self::$cacheStorage;
 }
开发者ID:JPalounek,项目名称:IconStore,代码行数:14,代码来源:FileTemplate.php

示例15: createTemplate

	/**
	 * Creates and returns configured template.
	 *
	 * @author   Jan Tvrdík, David Grudl
	 * @param    string            template file path
	 * @return   Nette\Templates\FileTemplate
	 */
	protected function createTemplate($path = NULL)
	{
		$template = new Nette\Templates\FileTemplate($path);

		// default parameters
		$template->baseUri = rtrim(Env::getVariable('baseUri', NULL), '/');
		$template->basePath = preg_replace('#https?://[^/]+#A', '', $template->baseUri);
		$template->presenter = $this;
		$template->page = $this->page;
		$template->lang = $this->lang;

		// default filters
		$template->onPrepareFilters[] = function($template) {
			require_once APP_DIR . '/classes/ConfiguredTexy.php';
			require_once APP_DIR . '/classes/TexyElementsFilter.php';
			require_once APP_DIR . '/classes/LatteMacros.php';

			$texyElementsFilter = new TexyElementsFilter();
			$texyElementsFilter->texy = new ConfiguredTexy();
			$texyElementsFilter->autoChangeSyntax = TRUE;

			$latteHandler = new LatteMacros();
			$latteHandler->macros['@href'] = ' href="<?php echo %:escape%(%:macroPageLink%) ?>"';
			$latteFilter = new Nette\Templates\LatteFilter();
			$latteFilter->setHandler($latteHandler);

			$template->registerFilter($texyElementsFilter);
			$template->registerFilter($latteFilter);
		};

		// default helpers
		$template->registerHelper('escape', 'Nette\Templates\TemplateHelpers::escapeHtml');
		$template->registerHelper('escapeUrl', 'rawurlencode');
		$template->registerHelper('stripTags', 'strip_tags');
		$template->registerHelper('nl2br', 'nl2br');
		$template->registerHelper('substr', 'iconv_substr');
		$template->registerHelper('repeat', 'str_repeat');
		$template->registerHelper('replaceRE', 'Nette\String::replace');
		$template->registerHelper('implode', 'implode');
		$template->registerHelper('number', 'number_format');
		$template->registerHelperLoader('Nette\Templates\TemplateHelpers::loader');

		return $template;
	}
开发者ID:JanTvrdik,项目名称:StaticWeb,代码行数:51,代码来源:BaseStaticPresenter.php


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