ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Autoloader.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 @trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED);
13 
22 {
28  public static function register($prepend = false)
29  {
30  @trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED);
31 
32  if (PHP_VERSION_ID < 50300) {
33  spl_autoload_register(array(__CLASS__, 'autoload'));
34  } else {
35  spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
36  }
37  }
38 
44  public static function autoload($class)
45  {
46  if (0 !== strpos($class, 'Twig')) {
47  return;
48  }
49 
50  if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) {
51  require $file;
52  }
53  }
54 }
static autoload($class)
Handles autoloading of classes.
Definition: Autoloader.php:44
Autoloads Twig classes.
Definition: Autoloader.php:21