vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticExtension.php
changeset 0 7f95f8617b0b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/Symfony/Bundle/AsseticBundle/Twig/AsseticExtension.php	Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,54 @@
+<?php
+
+/*
+ * This file is part of the Symfony framework.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\AsseticBundle\Twig;
+
+use Assetic\Extension\Twig\AsseticExtension as BaseAsseticExtension;
+use Assetic\Factory\AssetFactory;
+
+/**
+ * Assetic extension.
+ *
+ * @author Kris Wallsmith <kris@symfony.com>
+ */
+class AsseticExtension extends BaseAsseticExtension
+{
+    private $useController;
+
+    public function __construct(AssetFactory $factory, $useController = false, $functions = array())
+    {
+        parent::__construct($factory, $functions);
+
+        $this->useController = $useController;
+    }
+
+    public function getTokenParsers()
+    {
+        return array(
+            new AsseticTokenParser($this->factory, 'javascripts', 'js/*.js', false, array('package')),
+            new AsseticTokenParser($this->factory, 'stylesheets', 'css/*.css', false, array('package')),
+            new AsseticTokenParser($this->factory, 'image', 'images/*', true, array('package')),
+        );
+    }
+
+    public function getNodeVisitors()
+    {
+        return array(new AsseticNodeVisitor());
+    }
+
+    public function getGlobals()
+    {
+        $globals = parent::getGlobals();
+        $globals['assetic']['use_controller'] = $this->useController;
+
+        return $globals;
+    }
+}