4 * This file is part of Twig.
6 * (c) 2009 Fabien Potencier
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
13 * Autoloads Twig Extensions classes.
16 * @author Fabien Potencier <fabien.potencier@symfony-project.com>
18 class Twig_Extensions_Autoloader
21 * Registers Twig_Extensions_Autoloader as an SPL autoloader.
23 static public function register()
25 spl_autoload_register(array(new self
, 'autoload'));
29 * Handles autoloading of classes.
31 * @param string $class A class name.
33 * @return boolean Returns true if the class has been loaded
35 static public function autoload($class)
37 if (0 !== strpos($class, 'Twig_Extensions')) {
41 if (file_exists($file = dirname(__FILE__
).'/../../'.str_replace('_', '/', $class).'.php')) {