Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • ConstantsExtension
  • NetteExtension
  • PhpExtension
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  */
11: 
12: namespace Nette\Config\Extensions;
13: 
14: use Nette,
15:     Nette\DI\ContainerBuilder;
16: 
17: 
18: /**
19:  * PHP directives definition.
20:  *
21:  * @author     David Grudl
22:  */
23: class PhpExtension extends Nette\Config\CompilerExtension
24: {
25: 
26:     public function afterCompile(Nette\Utils\PhpGenerator\ClassType $class)
27:     {
28:         $initialize = $class->methods['initialize'];
29:         foreach ($this->getConfig() as $name => $value) {
30:             if (!is_scalar($value)) {
31:                 throw new Nette\InvalidStateException("Configuration value for directive '$name' is not scalar.");
32: 
33:             } elseif ($name === 'include_path') {
34:                 $initialize->addBody('set_include_path(?);', array(str_replace(';', PATH_SEPARATOR, $value)));
35: 
36:             } elseif ($name === 'ignore_user_abort') {
37:                 $initialize->addBody('ignore_user_abort(?);', array($value));
38: 
39:             } elseif ($name === 'max_execution_time') {
40:                 $initialize->addBody('set_time_limit(?);', array($value));
41: 
42:             } elseif ($name === 'date.timezone') {
43:                 $initialize->addBody('date_default_timezone_set(?);', array($value));
44: 
45:             } elseif (function_exists('ini_set')) {
46:                 $initialize->addBody('ini_set(?, ?);', array($name, $value));
47: 
48:             } elseif (ini_get($name) != $value) { // intentionally ==
49:                 throw new Nette\NotSupportedException('Required function ini_set() is disabled.');
50:             }
51:         }
52:     }
53: 
54: }
55: 
Nette Framework 2.0.12 API API documentation generated by ApiGen 2.8.0