summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Autoloader.php
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-01 23:43:20 -0400
committerczaks <marcin@6irc.net>2013-08-01 23:43:20 -0400
commit1ed45ebe9e39724ec70098abfcd267d8ac478511 (patch)
treeda133b7426dedaf0785f64be752aa0437de7e80a /inc/lib/Twig/Autoloader.php
parentdc84ccc6a8e0b6fd3fc626eb1f321e4cf2d05511 (diff)
parent40ab2e0c1728fab613bc16a19ab8fcb3fa78c1d4 (diff)
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts: stylesheets/dark.css stylesheets/futaba+vichan.css stylesheets/miku.css stylesheets/stripes.css stylesheets/testorange.css stylesheets/wasabi.css
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;