class HamlJavascriptFilter in Sassy 7
Javascript Filter for {@link http://haml-lang.com/ Haml} class. Surrounds the filtered text with <script> and CDATA tags. Useful for including inline Javascript. Code to be interpolated can be included by wrapping it in #(). @package PHamlP @subpackage Haml.filters
Hierarchy
- class \HamlBaseFilter
- class \HamlJavascriptFilter
Expanded class hierarchy of HamlJavascriptFilter
File
- phamlp/
haml/ filters/ HamlJavascriptFilter.php, line 20
View source
class HamlJavascriptFilter extends HamlBaseFilter {
/**
* Run the filter
* @param string text to filter
* @return string filtered text
*/
public function run($text) {
return "<script type=\"text/javascript\">\n //<![CDATA[\n" . preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \\1; ?>', $text) . " //]]>\n</script>\n";
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HamlBaseFilter:: |
public | function | * Initialise the filter. | 2 |
HamlJavascriptFilter:: |
public | function |
* Run the filter
* Overrides HamlBaseFilter:: |