Source of file AsseticHelperFormulaLoader.php
Size: 2,482 Bytes - Last Modified: 2013-05-16T07:32:23+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Factory/Loader/AsseticHelperFormulaLoader.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | <?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\Factory\Loader; use Assetic\Factory\Loader\BasePhpFormulaLoader; /** * Loads formulae from Symfony2 PHP templates. * * @author Kris Wallsmith <kris@symfony.com> */ class AsseticHelperFormulaLoader extends BasePhpFormulaLoader { protected function registerPrototypes() { return array( '$view[\'assetic\']->javascripts(*)' => array('output' => 'js/*.js'), '$view[\'assetic\']->stylesheets(*)' => array('output' => 'css/*.css'), '$view[\'assetic\']->image(*)' => array('output' => 'images/*', 'single' => true), '$view["assetic"]->javascripts(*)' => array('output' => 'js/*.js'), '$view["assetic"]->stylesheets(*)' => array('output' => 'css/*.css'), '$view["assetic"]->image(*)' => array('output' => 'images/*', 'single' => true), '$view->get(\'assetic\')->javascripts(*)' => array('output' => 'js/*.js'), '$view->get(\'assetic\')->stylesheets(*)' => array('output' => 'css/*.css'), '$view->get(\'assetic\')->image(*)' => array('output' => 'images/*', 'single' => true), '$view->get("assetic")->javascripts(*)' => array('output' => 'js/*.js'), '$view->get("assetic")->stylesheets(*)' => array('output' => 'css/*.css'), '$view->get("assetic")->image(*)' => array('output' => 'images/*', 'single' => true), ); } protected function registerSetupCode() { return <<<'EOF' class Helper { public function assets() { global $_call; $_call = func_get_args(); } public function javascripts() { global $_call; $_call = func_get_args(); } public function stylesheets() { global $_call; $_call = func_get_args(); } public function image() { global $_call; $_call = func_get_args(); } } class View extends ArrayObject { public function __construct(Helper $helper) { parent::__construct(array('assetic' => $helper)); } public function get() { return $this['assetic']; } } $view = new View(new Helper()); EOF; } } |