ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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}
An exception for terminatinating execution or to throw for unit testing.
Autoloads Twig classes.
Definition: Autoloader.php:22
static autoload($class)
Handles autoloading of classes.
Definition: Autoloader.php:44
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file