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


PHP Environment::setVariable方法代码示例

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


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

示例1: startup

 public function startup()
 {
     parent::startup();
     $this->absoluteUrls = TRUE;
     $admin_config = ConfigAdapterIni::load(APP_DIR . '/config/admin.ini');
     foreach ($admin_config['admin'] as $var => $value) {
         Environment::setVariable($var, $value);
     }
     Environment::setVariable('themesDir', 'themes');
     $method = $this->getRequest()->getMethod();
     if ($method == 'GET') {
         $data = $method = $this->getRequest()->getParams();
         if (isset($data['rsd'])) {
             header('Content-Type: text/xml');
             $this->view = 'rsd';
         } elseif (isset($data['wlw'])) {
             header('Content-Type: text/xml');
             $this->view = 'wlw';
         }
     } else {
         if (!isset($HTTP_RAW_POST_DATA)) {
             $HTTP_RAW_POST_DATA = file_get_contents('php://input');
         }
         $data = $HTTP_RAW_POST_DATA;
         file_put_contents('xmlrpc.txt', $data, FILE_APPEND);
         $this->formatCallbacks($this->methods);
         $server = new IXR_Server($this->methods, $data);
     }
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:29,代码来源:AdminPublishPresenter.php

示例2: load

 /**
  * merges config files of each module imported via config.ini[modules] to one file and loads it
  * considering current environment [dev, production, ...] - separate config file for each
  * uses Nette/Cache for invalidation when one (or more) of config files changed
  *
  * @param string|null  filepath
  * @return Config
  */
 public static function load($baseConfigFile = null)
 {
     if ($baseConfigFile === null) {
         $baseConfigFile = Environment::expand(Environment::getConfigurator()->defaultConfigFile);
     }
     $envName = Environment::getName();
     Environment::setVariable('tempDir', VAR_DIR . '/cache');
     $cache = Environment::getCache('config');
     $key = "config[{$envName}]";
     if (!isset($cache[$key])) {
         // najviac casu zabera load, tak az tu, ked ho je treba
         $appConfig = Environment::loadConfig($baseConfigFile);
         $configs = array(Config::fromFile($baseConfigFile, $envName)->toArray());
         $configPaths = array($baseConfigFile);
         foreach ($appConfig->modules as $c) {
             $configPaths[] = $path = MODULES_DIR . "/{$c}Module/config.ini";
             if (file_exists($path)) {
                 $configs[] = Config::fromFile($path, $envName)->toArray();
             }
         }
         $arrayConfig = call_user_func_array('array_merge_recursive', $configs);
         $cache->save($key, $arrayConfig, array('files' => $configPaths));
     }
     return Environment::loadConfig(new Config($cache[$key]));
 }
开发者ID:radypala,项目名称:maga-website,代码行数:33,代码来源:MultiConfig.php

示例3: checkAndRegisterLang

 private function checkAndRegisterLang()
 {
     if (Environment::getConfig('langs')->multipleLangs) {
         //		dump( Environment::getHttpRequest()->getUri() );
         if ($this->getParam("lang") && LangsModel::isAllowed($this->getParam("lang"))) {
             $this->lang = $this->getParam("lang");
         } else {
             $this->redirect(301, ":Front:Homepage:", array('lang' => Environment::getVariable("lang")));
         }
     }
     $this->template->lang = $this->lang;
     Environment::setVariable('lang', $this->lang);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:13,代码来源:BasePresenter.php

示例4: run

 /**
  * Dispatch a HTTP request to a front controller.
  * @return void
  */
 public 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());
     }
     // autostarts session
     $session = $this->getSession();
     if (!$session->isStarted() && $session->exists()) {
         $session->start();
     }
     // 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
                 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>";
//.........这里部分代码省略.........
开发者ID:jaroslavlibal,项目名称:MDW,代码行数:101,代码来源:Application.php

示例5: getSnippetId

<h1>Nette\Templates\CurlyBracketsFilter & snippets test</h1>

<pre>
<?php 
require_once '../../Nette/loader.php';
/*use Nette\Debug;*/
/*use Nette\Environment;*/
/*use Nette\Templates\Template;*/
class MockControl extends Control
{
    public function getSnippetId($name = NULL)
    {
        return 'sni__' . $name;
    }
}
function printSource($s)
{
    echo $s;
}
Environment::setVariable('tempDir', dirname(__FILE__) . '/tmp');
$template = new Template();
$template->setFile(dirname(__FILE__) . '/templates/curly-brackets-snippet.phtml');
$template->registerFilter('Nette\\Templates\\CurlyBracketsFilter::invoke');
$template->registerFilter('printSource');
$template->control = new MockControl();
$template->render();
开发者ID:vrana,项目名称:nette,代码行数:26,代码来源:test.curlyBrackets.snippet.php

示例6:

<h1>Nette\Environment services test</h1>

<pre>
<?php 
require_once '../../Nette/loader.php';
/*use Nette\Debug;*/
/*use Nette\Environment;*/
echo "Environment::getHttpResponse\n";
$obj = Environment::getHttpResponse();
Debug::dump($obj->class);
echo "Environment::getApplication\n";
$obj = Environment::getApplication();
Debug::dump($obj->class);
echo "Environment::getCache(...)\n";
Environment::setVariable('tempDir', __FILE__);
$obj = Environment::getCache('my');
Debug::dump($obj->class);
/* in PHP 5.3
echo "Environment::getXyz(...)\n";
Environment::setServiceAlias('Nette\Web\IUser', 'xyz');
$obj = Environment::getXyz();
Debug::dump($obj->class);
*/
开发者ID:vrana,项目名称:nette,代码行数:23,代码来源:test.service.php

示例7: str_replace

     $theme = Environment::getVariable('theme');
     $appDir = Environment::getVariable('appDir');
     $path = '/' . str_replace(':', 'Module/', $presenter);
     $pathP = substr_replace($path, '/' . $themesDir . '/' . $theme . '/templates', strrpos($path, '/'), 0);
     $list = array("{$appDir}{$pathP}/@{$layout}.phtml", "{$appDir}{$pathP}.@{$layout}.phtml");
     while (($path = substr($path, 0, strrpos($path, '/'))) !== FALSE) {
         $list[] = "{$appDir}{$path}" . '/' . $themesDir . '/' . $theme . '/templates/' . "@{$layout}.phtml";
     }
     return $list;
 }
 private function setupThemePath()
 {
     $presenter = $this->getName();
     $parts = explode(':', $presenter);
     Environment::setVariable('moduleDir', $parts[0] . 'Module');
     $themesDir = Environment::getVariable('themesDir');
开发者ID:bazo,项目名称:Mokuji,代码行数:16,代码来源:FrontBasePresenter.php

示例8: run

 /**
  * Dispatch a HTTP request to a front controller.
  */
 public 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()->basePath);
     }
     // check HTTP method
     $method = $httpRequest->getMethod();
     if ($this->allowedMethods) {
         if (!in_array($method, $this->allowedMethods, TRUE)) {
             $httpResponse->setCode(IHttpResponse::S501_NOT_IMPLEMENTED);
             $httpResponse->setHeader('Allow', implode(',', $this->allowedMethods));
             $method = htmlSpecialChars($method);
             die("<h1>Method {$method} is not implemented</h1>");
         }
     }
     // dispatching
     $request = NULL;
     $hasError = 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->modify('name', $presenter);
             } catch (InvalidPresenterException $e) {
                 throw new BadRequestException($e->getMessage(), 404, $e);
             }
             $this->presenter = new $class($request);
             // Instantiate topmost service locator
             $this->presenter->setServiceLocator(new ServiceLocator($this->serviceLocator));
             // Execute presenter
             $this->presenter->run();
             break;
         } catch (RedirectingException $e) {
             // not error, presenter redirects to new URL
             $httpResponse->redirect($e->getUri(), $e->getCode());
             break;
         } catch (ForwardingException $e) {
             // not error, presenter forwards to new request
             $request = $e->getRequest();
         } catch (AbortException $e) {
             // not error, application is correctly terminated
             unset($e);
             break;
         } catch (Exception $e) {
             // fault barrier
             if ($this->catchExceptions === NULL) {
                 $this->catchExceptions = Environment::isProduction();
             }
             if (!$this->catchExceptions) {
                 throw $e;
             }
             $this->onError($this, $e);
             if ($hasError) {
                 $e = new ApplicationException('An error occured while executing error-presenter', 0, $e);
             } elseif ($this->errorPresenter) {
                 $hasError = TRUE;
                 $request = new PresenterRequest($this->errorPresenter, PresenterRequest::FORWARD, array('exception' => $e));
                 continue;
             }
             if ($e instanceof BadRequestException) {
                 if (!$httpResponse->isSent()) {
                     $httpResponse->setCode($e->getCode());
                 }
                 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>";
                 break;
             } else {
                 if (!$httpResponse->isSent()) {
                     $httpResponse->setCode(500);
                 }
//.........这里部分代码省略.........
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:101,代码来源:Application.php

示例9: loadConfig

 /**
  * Loads global configuration from file and process it.
  * @param  string|Nette\Config\Config  file name or Config object
  * @param  bool
  * @return Nette\Config\Config
  */
 public function loadConfig($file, $useCache)
 {
     if ($useCache === NULL) {
         $useCache = Environment::isLive();
     }
     $cache = $useCache && $this->cacheKey ? Environment::getCache('Nette.Environment') : NULL;
     $name = Environment::getName();
     $cacheKey = Environment::expand($this->cacheKey);
     if (isset($cache[$cacheKey])) {
         Environment::swapState($cache[$cacheKey]);
         $config = Environment::getConfig();
     } else {
         if ($file instanceof Config) {
             $config = $file;
             $file = NULL;
         } else {
             if ($file === NULL) {
                 $file = $this->defaultConfigFile;
             }
             $file = Environment::expand($file);
             $config = Config::fromFile($file, $name, 0);
         }
         // process environment variables
         if ($config->variable instanceof Config) {
             foreach ($config->variable as $key => $value) {
                 Environment::setVariable($key, $value);
             }
         }
         if (PATH_SEPARATOR !== ';' && isset($config->set->include_path)) {
             $config->set->include_path = str_replace(';', PATH_SEPARATOR, $config->set->include_path);
         }
         $config->expand();
         $config->setReadOnly();
         // process services
         $locator = Environment::getServiceLocator();
         if ($config->service instanceof Config) {
             foreach ($config->service as $key => $value) {
                 $locator->addService($value, strtr($key, '-', '\\'));
             }
         }
         // save cache
         if ($cache) {
             $state = Environment::swapState(NULL);
             $state[0] = $config;
             // TODO: better!
             $cache->save($cacheKey, $state, array(Cache::FILES => $file));
         }
     }
     // check temporary directory - TODO: discuss
     /*
     $dir = Environment::getVariable('tempDir');
     if ($dir && !(is_dir($dir) && is_writable($dir))) {
     	trigger_error("Temporary directory '$dir' is not writable", E_USER_NOTICE);
     }
     */
     // process ini settings
     if ($config->set instanceof Config) {
         foreach ($config->set as $key => $value) {
             $key = strtr($key, '-', '.');
             if (function_exists('ini_set')) {
                 ini_set($key, $value);
             } else {
                 switch ($key) {
                     case 'include_path':
                         set_include_path($value);
                         break;
                     case 'iconv.internal_encoding':
                         iconv_set_encoding('internal_encoding', $value);
                         break;
                     case 'mbstring.internal_encoding':
                         mb_internal_encoding($value);
                         break;
                     case 'date.timezone':
                         date_default_timezone_set($value);
                         break;
                     case 'error_reporting':
                         error_reporting($value);
                         break;
                     case 'ignore_user_abort':
                         ignore_user_abort($value);
                         break;
                     case 'max_execution_time':
                         set_time_limit($value);
                         break;
                     default:
                         throw new NotSupportedException('Required function ini_set() is disabled.');
                 }
             }
         }
     }
     // define constants
     if ($config->const instanceof Config) {
         foreach ($config->const as $key => $value) {
             define($key, $value);
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:webuntucms,代码行数:101,代码来源:Configurator.php

示例10: loadConfig

 function loadConfig($file)
 {
     $name = Environment::getName();
     if ($file instanceof Config) {
         $config = $file;
         $file = NULL;
     } else {
         if ($file === NULL) {
             $file = $this->defaultConfigFile;
         }
         $file = Environment::expand($file);
         $config = Config::fromFile($file, $name);
     }
     if ($config->variable instanceof Config) {
         foreach ($config->variable as $key => $value) {
             Environment::setVariable($key, $value);
         }
     }
     $iterator = new RecursiveIteratorIterator($config);
     foreach ($iterator as $key => $value) {
         $tmp = $iterator->getDepth() ? $iterator->getSubIterator($iterator->getDepth() - 1)->current() : $config;
         $tmp[$key] = Environment::expand($value);
     }
     $runServices = array();
     $locator = Environment::getServiceLocator();
     if ($config->service instanceof Config) {
         foreach ($config->service as $key => $value) {
             $key = strtr($key, '-', '\\');
             if (is_string($value)) {
                 $locator->removeService($key);
                 $locator->addService($key, $value);
             } else {
                 if ($value->factory) {
                     $locator->removeService($key);
                     $locator->addService($key, $value->factory, isset($value->singleton) ? $value->singleton : TRUE, (array) $value->option);
                 }
                 if ($value->run) {
                     $runServices[] = $key;
                 }
             }
         }
     }
     if (!$config->php) {
         $config->php = $config->set;
         unset($config->set);
     }
     if ($config->php instanceof Config) {
         if (PATH_SEPARATOR !== ';' && isset($config->php->include_path)) {
             $config->php->include_path = str_replace(';', PATH_SEPARATOR, $config->php->include_path);
         }
         foreach (clone $config->php as $key => $value) {
             if ($value instanceof Config) {
                 unset($config->php->{$key});
                 foreach ($value as $k => $v) {
                     $config->php->{"{$key}.{$k}"} = $v;
                 }
             }
         }
         foreach ($config->php as $key => $value) {
             $key = strtr($key, '-', '.');
             if (!is_scalar($value)) {
                 throw new InvalidStateException("Configuration value for directive '{$key}' is not scalar.");
             }
             if ($key === 'date.timezone') {
                 date_default_timezone_set($value);
             }
             if (function_exists('ini_set')) {
                 ini_set($key, $value);
             } else {
                 switch ($key) {
                     case 'include_path':
                         set_include_path($value);
                         break;
                     case 'iconv.internal_encoding':
                         iconv_set_encoding('internal_encoding', $value);
                         break;
                     case 'mbstring.internal_encoding':
                         mb_internal_encoding($value);
                         break;
                     case 'date.timezone':
                         date_default_timezone_set($value);
                         break;
                     case 'error_reporting':
                         error_reporting($value);
                         break;
                     case 'ignore_user_abort':
                         ignore_user_abort($value);
                         break;
                     case 'max_execution_time':
                         set_time_limit($value);
                         break;
                     default:
                         if (ini_get($key) != $value) {
                             throw new NotSupportedException('Required function ini_set() is disabled.');
                         }
                 }
             }
         }
     }
     if ($config->const instanceof Config) {
//.........这里部分代码省略.........
开发者ID:xixixao,项目名称:chytrapalice,代码行数:101,代码来源:loader.php

示例11: date_default_timezone_set

if (!function_exists('date_default_timezone_set')) {
    function date_default_timezone_set($timezone)
    {
        ini_set('date.timezone', $timezone);
    }
}
date_default_timezone_set(require Environment::expand('%timezoneFile%'));
// debugging
Debug::enable(NULL, BASE_DIR . '/error.log', Environment::expand('%adminEmail%'));
// paths
Environment::setVariable('themeDir', Environment::expand('%baseDir%/themes'));
Environment::setVariable('templatesDir', Environment::expand('%themeDir%/%theme%'));
Environment::setVariable('tempDir', Environment::expand('%baseDir%/tmp'));
Environment::setVariable('themeBaseUri', Environment::expand('%baseUri%/themes/%theme%'));
Environment::setVariable('mediaDir', Environment::expand('%baseDir%/media'));
Environment::setVariable('mediaBaseUri', Environment::expand('%baseUri%/media'));
set_include_path(LIB_DIR . PATH_SEPARATOR . get_include_path());
Html::$xhtml = FALSE;
SafeStream::register();
setlocale(LC_ALL, require Environment::expand('%localeFile%'));
Zend_Search_Lucene::setDefaultSearchField('description');
// configure locale
require_once LIB_DIR . '/tr.php';
$available = array();
foreach (glob(APP_DIR . '/locale/' . '*.php') as $_) {
    $available[substr(substr($_, strlen(APP_DIR . '/locale/')), 0, 2)] = $_;
}
tr::$locale = Environment::getHttpRequest()->detectLanguage(array_keys($available));
if (tr::$locale) {
    list(tr::$plurals[tr::$locale], tr::$table[tr::$locale]) = (require $available[tr::$locale]);
}
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:31,代码来源:bootstrap.php

示例12: loadConfig

 /**
  * Loads global configuration from file and process it.
  * @param  string|Nette\Config\Config  file name or Config object
  * @return Config
  */
 public function loadConfig($file)
 {
     $name = Environment::getName();
     if ($file instanceof Config) {
         $config = $file;
         $file = NULL;
     } else {
         if ($file === NULL) {
             $file = $this->defaultConfigFile;
         }
         $file = Environment::expand($file);
         $config = Config::fromFile($file, $name, 0);
     }
     // process environment variables
     if ($config->variable instanceof Config) {
         foreach ($config->variable as $key => $value) {
             Environment::setVariable($key, $value);
         }
     }
     $config->expand();
     // process services
     $locator = Environment::getServiceLocator();
     if ($config->service instanceof Config) {
         foreach ($config->service as $key => $value) {
             $locator->addService($value, strtr($key, '-', '\\'));
         }
     }
     // check temporary directory - TODO: discuss
     /*
     $dir = Environment::getVariable('tempDir');
     if ($dir && !(is_dir($dir) && is_writable($dir))) {
     	trigger_error("Temporary directory '$dir' is not writable", E_USER_NOTICE);
     }
     */
     // process ini settings
     if ($config->set instanceof Config) {
         if (PATH_SEPARATOR !== ';' && isset($config->set->include_path)) {
             $config->set->include_path = str_replace(';', PATH_SEPARATOR, $config->set->include_path);
         }
         foreach ($config->set as $key => $value) {
             $key = strtr($key, '-', '.');
             // old INI compatibility
             if (!is_scalar($value)) {
                 throw new InvalidStateException("Configuration value for directive '{$key}' is not scalar.");
             }
             if (function_exists('ini_set')) {
                 ini_set($key, $value);
             } else {
                 switch ($key) {
                     case 'include_path':
                         set_include_path($value);
                         break;
                     case 'iconv.internal_encoding':
                         iconv_set_encoding('internal_encoding', $value);
                         break;
                     case 'mbstring.internal_encoding':
                         mb_internal_encoding($value);
                         break;
                     case 'date.timezone':
                         date_default_timezone_set($value);
                         break;
                     case 'error_reporting':
                         error_reporting($value);
                         break;
                     case 'ignore_user_abort':
                         ignore_user_abort($value);
                         break;
                     case 'max_execution_time':
                         set_time_limit($value);
                         break;
                     default:
                         if (ini_get($key) != $value) {
                             // intentionally ==
                             throw new NotSupportedException('Required function ini_set() is disabled.');
                         }
                 }
             }
         }
     }
     // define constants
     if ($config->const instanceof Config) {
         foreach ($config->const as $key => $value) {
             define($key, $value);
         }
     }
     // set modes
     if (isset($config->mode)) {
         foreach ($config->mode as $mode => $state) {
             Environment::setMode($mode, $state);
         }
     }
     $config->setReadOnly();
     return $config;
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:99,代码来源:Configurator.php

示例13:

<?php

require LIBS_DIR . '/nette-dev/loader.php';
require LIBS_DIR . '/debug.php';
require LIBS_DIR . '/Mokuji/Mokuji.php';
//enable Debugging
//Environment::setMode(Environment::DEVELOPMENT);
//Debug::enable(Debug::DEVELOPMENT);
//load configuration
Environment::loadConfig(APP_DIR . '/config/config.ini');
Environment::setVariable('website', WEBSITE);
db::connect(Environment::getConfig('database'));
//get Application
Environment::getSession()->start();
$app = Environment::getApplication();
$app->catchExceptions = FALSE;
$app->run();
开发者ID:bazo,项目名称:Mokuji,代码行数:17,代码来源:bootstrap.php

示例14: formatTemplateFiles

 public function formatTemplateFiles($presenter, $view)
 {
     $parts = explode(':', $presenter);
     Environment::setVariable('moduleDir', $parts[0] . 'Module');
     $themesDir = Environment::getVariable('themesDir');
     $theme = Environment::getVariable('theme');
     $appDir = Environment::getVariable('appDir');
     $path = '/' . str_replace(':', 'Module/', $presenter);
     $pathP = substr_replace($path, '/' . $themesDir . '/' . $theme . '/templates', strrpos($path, '/'), 0);
     $this->pathToTheme = substr($pathP, 0, strrpos($pathP, '/'));
     $this->pathToTheme = substr($this->pathToTheme, 0, strrpos($this->pathToTheme, '/'));
     $path = substr_replace($path, '/' . $themesDir . '/' . $theme . '/templates', strrpos($path, '/'));
     return array("{$appDir}{$pathP}/{$view}.phtml", "{$appDir}{$pathP}.{$view}.phtml", "{$appDir}{$path}/@global.{$view}.phtml");
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:14,代码来源:AdminBasePresenter.php

示例15: handleBuy

        $uri = $this->mycontrol->link('this?x=1&round=1#frag');
        echo "3.12 {$uri}\n\n";
        $uri = $this->mycontrol->link('//this?x=1&round=1#frag');
        echo "3.13 {$uri}\n\n";
    }
    /**
     * @view: default
     */
    public function handleBuy($x = 1, $y = 1)
    {
    }
}
class OtherPresenter extends TestPresenter
{
}
class Submodule_OtherPresenter extends TestPresenter
{
}
Environment::setVariable('appDir', dirname(__FILE__));
$httpRequest = Environment::getHttpRequest();
$uri = clone $httpRequest->getUri();
$uri->scriptPath = '/index.php';
$uri->host = 'localhost';
$httpRequest->setUri($uri);
$application = Environment::getApplication();
$application->setRouter(new SimpleRouter());
$request = new PresenterRequest('Test', HttpRequest::GET, array());
TestPresenter::$invalidLinkMode = TestPresenter::INVALID_LINK_WARNING;
$presenter = new TestPresenter($request);
$presenter->autoCanonicalize = FALSE;
$presenter->run();
开发者ID:vrana,项目名称:nette,代码行数:31,代码来源:test.link.php


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