forked from francisbesset/PackingMinifyBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Francis Besset
committed
Feb 20, 2011
1 parent
0ebea43
commit 100ee81
Showing
4 changed files
with
79 additions
and
213 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,18 @@ | |
|
||
namespace Bundle\PackingMinifyBundle\Templating\Helper; | ||
|
||
use Symfony\Component\Templating\Helper\Helper; | ||
use Bundle\PackingMinifyBundle\Templating\Minifier\Minifier; | ||
use Bundle\PackingMinifyBundle\Templating\Resource\FileResource; | ||
|
||
class JavascriptsHelper extends BaseJavascriptsHelper | ||
/** | ||
* @author Fabien Potencier <[email protected]> | ||
* @author Francis Besset <http://www.github.com/francisbesset/> | ||
*/ | ||
class JavascriptsHelper extends Helper | ||
{ | ||
protected $javascripts = array(); | ||
protected $assetHelper; | ||
protected $minifier; | ||
protected $options; | ||
protected $resources = array(); | ||
|
@@ -20,7 +27,7 @@ class JavascriptsHelper extends BaseJavascriptsHelper | |
*/ | ||
public function __construct(AssetsHelper $assetHelper, Minifier $minifier, array $options = array()) | ||
{ | ||
parent::__construct($assetHelper); | ||
$this->assetHelper = $assetHelper; | ||
|
||
$this->options = array( | ||
'cache_dir' => null, | ||
|
@@ -51,6 +58,16 @@ public function add($javascript, $attributes = array()) | |
$this->javascripts[$javascript] = $attributes; | ||
} | ||
|
||
/** | ||
* Returns all JavaScript files. | ||
* | ||
* @return array An array of JavaScript files to include | ||
*/ | ||
public function get() | ||
{ | ||
return $this->javascripts; | ||
} | ||
|
||
/** | ||
* Returns HTML representation of the links to stylesheets. | ||
* | ||
|
@@ -118,7 +135,27 @@ public function setCache($cache) | |
} | ||
} | ||
|
||
public function getHtml($path, array $attributes = array()) | ||
/** | ||
* Returns a string representation of this helper as HTML. | ||
* | ||
* @return string The HTML representation of the JavaScripts | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->render(); | ||
} | ||
|
||
/** | ||
* Returns the canonical name of this helper. | ||
* | ||
* @return string The canonical name | ||
*/ | ||
public function getName() | ||
{ | ||
return 'javascripts'; | ||
} | ||
|
||
protected function getHtml($path, array $attributes = array()) | ||
{ | ||
$atts = ''; | ||
foreach ($attributes as $key => $value) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,18 @@ | |
|
||
namespace Bundle\PackingMinifyBundle\Templating\Helper; | ||
|
||
use Symfony\Component\Templating\Helper\Helper; | ||
use Bundle\PackingMinifyBundle\Templating\Minifier\MinifierInterface; | ||
use Bundle\PackingMinifyBundle\Templating\Resource\FileResource; | ||
|
||
class StylesheetsHelper extends BaseStylesheetsHelper | ||
/** | ||
* @author Fabien Potencier <[email protected]> | ||
* @author Francis Besset <http://www.github.com/francisbesset/> | ||
*/ | ||
class StylesheetsHelper extends Helper | ||
{ | ||
protected $stylesheets = array(); | ||
protected $assetHelper; | ||
protected $minifier; | ||
protected $options; | ||
protected $resources = array(); | ||
|
@@ -20,7 +27,7 @@ class StylesheetsHelper extends BaseStylesheetsHelper | |
*/ | ||
public function __construct(AssetsHelper $assetHelper, MinifierInterface $minifier, array $options = array()) | ||
{ | ||
parent::__construct($assetHelper); | ||
$this->assetHelper = $assetHelper; | ||
|
||
$this->options = array( | ||
'cache_dir' => null, | ||
|
@@ -51,6 +58,16 @@ public function add($stylesheet, $attributes = array()) | |
$this->stylesheets[$stylesheet] = $attributes; | ||
} | ||
|
||
/** | ||
* Returns all stylesheet files. | ||
* | ||
* @return array An array of stylesheet files to include | ||
*/ | ||
public function get() | ||
{ | ||
return $this->stylesheets; | ||
} | ||
|
||
/** | ||
* Returns HTML representation of the links to stylesheets. | ||
* | ||
|
@@ -118,6 +135,26 @@ public function setCache($cache) | |
} | ||
} | ||
|
||
/** | ||
* Returns the canonical name of this helper. | ||
* | ||
* @return string The canonical name | ||
*/ | ||
public function getName() | ||
{ | ||
return 'stylesheets'; | ||
} | ||
|
||
/** | ||
* Returns a string representation of this helper as HTML. | ||
* | ||
* @return string The HTML representation of the stylesheets | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->render(); | ||
} | ||
|
||
protected function getHtml($path, array $attributes = array()) | ||
{ | ||
$atts = ''; | ||
|