|
Revision 24281, 1.6 kB
(checked in by fabien, 3 years ago)
|
[1.3, 1.4] added back the common filter to ease upgrading existing website (the default is still the same though) (refs #7657)
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfCommonFilter extends sfFilter |
|---|
| 20 |
{ |
|---|
| 21 |
|
|---|
| 22 |
* Executes this filter. |
|---|
| 23 |
* |
|---|
| 24 |
* @param sfFilterChain $filterChain A sfFilterChain instance |
|---|
| 25 |
*/ |
|---|
| 26 |
public function execute($filterChain) |
|---|
| 27 |
{ |
|---|
| 28 |
|
|---|
| 29 |
$filterChain->execute(); |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
$response = $this->context->getResponse(); |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
$content = $response->getContent(); |
|---|
| 36 |
if (false !== ($pos = strpos($content, '</head>'))) |
|---|
| 37 |
{ |
|---|
| 38 |
$this->context->getConfiguration()->loadHelpers(array('Tag', 'Asset')); |
|---|
| 39 |
$html = ''; |
|---|
| 40 |
if (!sfConfig::get('symfony.asset.javascripts_included', false)) |
|---|
| 41 |
{ |
|---|
| 42 |
$html .= get_javascripts($response); |
|---|
| 43 |
} |
|---|
| 44 |
if (!sfConfig::get('symfony.asset.stylesheets_included', false)) |
|---|
| 45 |
{ |
|---|
| 46 |
$html .= get_stylesheets($response); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
if ($html) |
|---|
| 50 |
{ |
|---|
| 51 |
$response->setContent(substr($content, 0, $pos).$html.substr($content, $pos)); |
|---|
| 52 |
} |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
sfConfig::set('symfony.asset.javascripts_included', false); |
|---|
| 56 |
sfConfig::set('symfony.asset.stylesheets_included', false); |
|---|
| 57 |
} |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|