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


PHP Environment::getConfig方法代码示例

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


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

示例1: renderShow

 public function renderShow($id)
 {
     $service = new TripService($this->entityManager);
     $trip = $service->find($id);
     $this->template->trip = $trip;
     try {
         $eventService = new EventService();
         $config = Environment::getConfig('api');
         $events = $eventService->getEvents($trip->arrival, new DateTime(), new EventfulMapper($config->eventfulUser, $config->eventfulPassword, $config->eventfulKey));
         $this->template->events = $events;
     } catch (InvalidStateException $e) {
         $this->template->events = array();
     }
     $articleService = new ArticleService($this->entityManager);
     $this->template->article = $articleService->buildArticle($trip->arrival, new ArticleWikipediaMapper());
     try {
         $airportMapper = new AirportTravelMathMapper();
         $airportService = new AirportService();
         $locationService = new LocationService();
         $coordinates = $locationService->getCoordinates($trip->getDeparture());
         $from = $airportService->searchNearestAirport($airportMapper, $coordinates['latitude'], $coordinates['longitude']);
         $coordinates = $locationService->getCoordinates($trip->getArrival());
         $to = $airportService->searchNearestAirport($airportMapper, $coordinates['latitude'], $coordinates['longitude']);
         $flightMapper = new FlightKayakMapper();
         $flightService = new FlightService($this->entityManager);
         $depart_date = new DateTime('now');
         $return_date = new DateTime('+1 week');
         $this->template->flights = $flightService->buildFlights($flightMapper, $from, $to, $depart_date, $return_date, '1', 'e', 'n');
     } catch (FlightException $e) {
         $this->template->flightsError = "Connection with search system <a href='http://kayak.com'>Kayak</a> failed.";
     } catch (AirportException $e) {
         $this->template->flightsError = $e->getMessage();
     }
 }
开发者ID:jff15,项目名称:travelbot,代码行数:34,代码来源:TripPresenter.php

示例2: __construct

 /**
  * Constructor of the poll control model layer.
  *
  * @param mixed $id Id of the current poll.
  */
 public function __construct($id)
 {
     $this->id = $id;
     $this->connection = new DibiConnection(Environment::getConfig('database'));
     $sess = Environment::getSession(self::SESSION_NAMESPACE);
     $sess->poll[$id] = FALSE;
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:12,代码来源:ModelImpl.php

示例3: getConfig

 public function getConfig()
 {
     if (!$this->config) {
         $this->config = Environment::getConfig();
     }
     return $this->config;
 }
开发者ID:GymvodNette,项目名称:cv2-authentizace,代码行数:7,代码来源:BasePresenter.php

示例4: __construct

 /** 
  * Constructor
  * 
  * @note Maybe get User by DI
  */
 public function __construct()
 {
     if (class_exists('\\Nette\\Environment')) {
         $this->userId = \Nette\Environment::getUser()->id;
         $this->avaibleTables = \Nette\Environment::getConfig('store');
     } else {
         $this->userId = 0;
         $this->avaibleTables = [];
     }
 }
开发者ID:kravcik,项目名称:core,代码行数:15,代码来源:StoreManager.php

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

示例6: renderDefault

	public function renderDefault()
	{
		$this->template->ambigousClasses = array();
		$this->template->notInsertedUseSts = array();
		$this->template->notFoundClasses = array();
		$this->template->fileParseTimes = array();
		$this->template->unusedUseSts = array();
		$this->template->useStAdded = array();
		$this->template->possibleCb = array();

		$config = Environment::getConfig("autoUse");

		$autoUse = new AutoUseWorker();
		$autoUse->onOutput[] = array($this, "setTemplateVariables");
		$autoUse->setSource($config->sourceDir);
		$autoUse->addLibrary((array)$config->libDirs);
		$autoUse->addIgnoredDirs((array)$config->ignoredDirs);

		$autoUse->run();
	}
开发者ID:norbe,项目名称:AutoUse,代码行数:20,代码来源:AutoUsePresenter.php

示例7: handlePois

 /**
  * @author Petr Vales
  * @version 4.11.2010
  */
 public function handlePois()
 {
     $location = $this->request->post['location'];
     $service = new LocationService();
     $coords = $service->getCoordinates($location);
     $service = new PoiService($this->entityManager);
     try {
         $key = Environment::getConfig('api')->gowallaKey;
         $pois = $service->getPois($coords['latitude'], $coords['longitude'], new PoiGowallaMapper($key));
     } catch (InvalidStateException $e) {
         $this->terminate(new JsonResponse(array('status' => 'FAIL')));
     }
     $jsonResponse = array();
     foreach ($pois as $poi) {
         $jsonResponse['pois'][] = array('name' => $poi->name, 'types' => $poi->types, 'address' => $poi->address, 'latitude' => $poi->latitude, 'longitude' => $poi->longitude, 'url' => $poi->url, 'icon' => $poi->imageUrl);
     }
     $jsonResponse['status'] = 'OK';
     $jsonResponse['latitude'] = $coords['latitude'];
     $jsonResponse['longitude'] = $coords['longitude'];
     $this->terminate(new JsonResponse($jsonResponse));
 }
开发者ID:jff15,项目名称:travelbot,代码行数:25,代码来源:AjaxPresenter.php

示例8: init

 static function init()
 {
     // TODO: remove this magic
     $config = Environment::getConfig('MultipleFileUploader', array('databasePath' => dirname(__FILE__) . '/database.sqlite3', 'uploadsTempDir' => ''));
     foreach ($config as $key => $val) {
         self::${$key} = $val;
     }
 }
开发者ID:jkuchar,项目名称:multiplefileupload,代码行数:8,代码来源:Queues.php

示例9: Route

 * @package    MyApplication
 */
use Nette\Debug;
use Nette\Environment;
use Nette\Application\Route;
// 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::$strictMode = TRUE;
Debug::enable();
// 2b) load configuration from config.ini file
Environment::loadConfig();
$config = Environment::getConfig();
// Step 3: Configure application
// 3a) get and setup a front controller
$application = Environment::getApplication();
$application->errorPresenter = 'Error';
//$application->catchExceptions = TRUE;
/**
 * Database connection
 */
Dibi::connect($config->database);
// Step 4: Setup application router
$router = $application->getRouter();
$router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
// Step 5: Run the application!
$application->run();
开发者ID:GymvodNette,项目名称:cv2-authentizace,代码行数:31,代码来源:bootstrap.php

示例10: beforeRender

 protected function beforeRender()
 {
     $this->template->mapsKey = Environment::getConfig('api')->googleMaps;
 }
开发者ID:jff15,项目名称:travelbot,代码行数:4,代码来源:BasePresenter.php

示例11: init

 static function init()
 {
     // TODO: remove this magic
     $config = Environment::getConfig("MultipleFileUploader", array("databasePath" => dirname(__FILE__) . "/database.sdb", "uploadsTempDir" => ""));
     foreach ($config as $key => $val) {
         self::${$key} = $val;
     }
 }
开发者ID:jurasm2,项目名称:multiplefileupload,代码行数:8,代码来源:Queues.php

示例12: proxy

 *
 * @copyright  Copyright (c) 2009 Filip Procházka
 * @package    Vdsc
 */
require_once dirname(__FILE__) . '/Nette/loader.php';
require_once dirname(__FILE__) . '/Curl/Request.php';
use Curl\Request;
use Curl\CurlException;
use Nette\Environment;
use Nette\Debug;
// register wrapper safe for file manipulation
Nette\SafeStream::register();
Debug::enable();
Debug::$strictMode = True;
Environment::loadConfig(realpath('./config.ini'));
$config = Environment::getConfig('curl');
$config['downloadFolder'] = realpath("download");
$config['cookieFile'] = $config['downloadFolder'] . '/cookies.tmp';
function proxy(&$test)
{
    // 	$test->addProxy('192.168.1.160', 3128);
}
if (TRUE) {
    // test 1: get
    $test = new Request("http://curl.kdyby.org/prevodnik.asm.zdrojak", $config);
    // 	$test = new Curl("http://iskladka.cz/iCopy/downloadBalancer.php?file=1222561395_obava_bojov+cz.avi&ticket=pc1660-1265493063.25");
    echo "<hr>test 1: get ... init ok<hr>", "<h2>Setup:</h2>";
    proxy($test);
    // for debbuging at school
    dump($test);
    $response = $test->get();
开发者ID:pavelmaca,项目名称:cURL-wrapper,代码行数:31,代码来源:curl_test.php

示例13: initialize

 public static function initialize()
 {
     dibi::connect(Environment::getConfig('database'));
 }
开发者ID:jakubkulhan,项目名称:nette,代码行数:4,代码来源:Albums.php

示例14: Route

<?php

use Nette\Debug;
use Nette\Environment;
use Nette\Application\Route;
use Ormion\Ormion;
require LIBS_DIR . '/Nette/loader.php';
Debug::enable();
Environment::loadConfig();
$application = Environment::getApplication();
Ormion::connect(Environment::getConfig("database"));
$router = $application->getRouter();
$router[] = new Route('<presenter>/<action>/<id>', array('presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
if (Environment::getName() !== "console") {
    $application->run();
}
开发者ID:janmarek,项目名称:Ormion,代码行数:16,代码来源:bootstrap.php

示例15: Route

// 2a) enable Nette\Debug for better exception and error visualisation
Debug::$strictMode = TRUE;
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>/<id [0-9]+>', array('action' => 'show'));
$router[] = new Route('<presenter>/<action>/<id>', array('presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
// Doctrine configuration
$arrayCache = new ArrayCache();
$doctrineConfig = new Configuration();
$doctrineConfig->setMetadataCacheImpl($arrayCache);
$doctrineConfig->setQueryCacheImpl($arrayCache);
$doctrineConfig->setMetadataDriverImpl($doctrineConfig->newDefaultAnnotationDriver(array(APP_DIR . '/models')));
$doctrineConfig->setProxyNamespace('DoctrineProxy');
$doctrineConfig->setProxyDir(TEMP_DIR . '/cache');
//$doctrineConfig->setSQLLogger(Doctrine2Panel::getAndRegister());
$entityManager = EntityManager::create(Environment::getConfig('database')->toArray(), $doctrineConfig);
$application->getContext()->addService('Doctrine\\ORM\\EntityManager', $entityManager);
// Step 5: Run the application!
// Don't run while running PHPUnit tests
if (!Environment::isConsole()) {
    $application->run();
}
开发者ID:jff15,项目名称:travelbot,代码行数:31,代码来源:bootstrap.php


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