summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Autoloader.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-05 06:03:40 -0400
committerczaks <marcin@6irc.net>2013-08-05 06:03:40 -0400
commita84c4510fccfdc0cfb6f187633daea10dc70f326 (patch)
tree6077f5211196ae40cac0184bb7cc67b81d320b0b /inc/lib/Twig/Autoloader.php
parent33c7abf11f3a9b5c0964a2d7a25533c2849dbc78 (diff)
parenta8327c3a37fd22d2aa5d63061c9d3eaa30ae425a (diff)
Merge branch 'master' of github.com:vichan-devel/Tinyboard
Conflicts: js/post-hider.js
Diffstat (limited to 'inc/lib/Twig/Autoloader.php')
-rw-r--r--inc/lib/Twig/Autoloader.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/inc/lib/Twig/Autoloader.php b/inc/lib/Twig/Autoloader.php
index a93b8caf..7007d315 100644
--- a/inc/lib/Twig/Autoloader.php
+++ b/inc/lib/Twig/Autoloader.php
@@ -12,28 +12,30 @@
/**
* Autoloads Twig classes.
*
- * @package twig
- * @author Fabien Potencier <fabien@symfony.com>
+ * @author Fabien Potencier <fabien@symfony.com>
*/
class Twig_Autoloader
{
/**
* Registers Twig_Autoloader as an SPL autoloader.
+ *
+ * @param Boolean $prepend Whether to prepend the autoloader or not.
*/
- static public function register()
+ public static function register($prepend = false)
{
- ini_set('unserialize_callback_func', 'spl_autoload_call');
- spl_autoload_register(array(new self, 'autoload'));
+ if (version_compare(phpversion(), '5.3.0', '>=')) {
+ spl_autoload_register(array(new self, 'autoload'), true, $prepend);
+ } else {
+ spl_autoload_register(array(new self, 'autoload'));
+ }
}
/**
* Handles autoloading of classes.
*
- * @param string $class A class name.
- *
- * @return boolean Returns true if the class has been loaded
+ * @param string $class A class name.
*/
- static public function autoload($class)
+ public static function autoload($class)
{
if (0 !== strpos($class, 'Twig')) {
return;