Skip to content
Browse files

updated composer and twig view

  • Loading branch information...
1 parent a88ee7e commit e9e0ca18b4b92cee4e6d35eadd986ec9f783a34c Andrew Smith committed Feb 23, 2012
Showing with 9 additions and 7 deletions.
  1. +8 −6 Views/TwigView.php
  2. +1 −1 composer.json
View
14 Views/TwigView.php
@@ -82,9 +82,7 @@ public function render( $template ) {
*/
public function getEnvironment() {
if ( !$this->twigEnvironment ) {
- /*
- * Check for Composer Package Autoloader class loading
- */
+ // Check for Composer Package Autoloader class loading
if (!class_exists('Twig_Autoloader')) {
require_once self::$twigDirectory . '/Autoloader.php';
}
@@ -96,9 +94,13 @@ public function getEnvironment() {
self::$twigOptions
);
- $extension_autoloader = dirname(__FILE__) . '/Extension/TwigAutoloader.php';
- if (file_exists($extension_autoloader)) {
- require_once $extension_autoloader;
+ // Check for Composer Package Autoloader class loading
+ if (!class_exists('Twig_Extensions_Autoloader')) {
+ $extension_autoloader = dirname(__FILE__) . '/Extension/TwigAutoloader.php';
+ if (file_exists($extension_autoloader)) require_once $extension_autoloader;
+ }
+
+ if (class_exists('Twig_Extensions_Autoloader')) {
Twig_Extensions_Autoloader::register();
foreach (self::$twigExtensions as $ext) {
View
2 composer.json
@@ -20,6 +20,6 @@
"php": ">=5.2.0"
},
"autoload": {
- "psr-0": { "Twig_Extensions_": "Extension/" }
+ "psr-0": { "Twig_Extensions_": "Views/Extension/" }
}
}

0 comments on commit e9e0ca1

Please sign in to comment.
Something went wrong with that request. Please try again.