public function execute($filterChain) { // execute next filter $filterChain->execute(); $response = $this->context->getResponse(); $content = $response->getContent(); // include javascripts and stylesheets if (false !== ($pos = strpos($content, '</head>'))) { sfProjectConfiguration::getActive()->loadHelpers(array('sfCombine')); $html = ''; if (!sfConfig::get('symfony.asset.javascripts_included', false)) { $html .= get_combined_javascripts(); } if (!sfConfig::get('symfony.asset.stylesheets_included', false)) { $html .= get_combined_stylesheets(); } if ($html) { $response->setContent(substr($content, 0, $pos) . $html . substr($content, $pos)); } } sfConfig::set('symfony.asset.javascripts_included', false); sfConfig::set('symfony.asset.stylesheets_included', false); }
/** * Executes this filter. * * @param sfFilterChain $filterChain A sfFilterChain instance */ public function execute($filterChain) { // execute next filter $filterChain->execute(); // execute this filter only once $response = $this->context->getResponse(); // include javascripts and stylesheets $content = $response->getContent(); if (false !== ($pos = strpos($content, '</head>')) && false !== strpos($response->getContentType(), 'html')) { $this->context->getConfiguration()->loadHelpers(array('Tag', 'Asset', 'Url', 'sfCombinePlus')); $html = ''; if (!sfConfig::get('symfony.asset.javascripts_included', false)) { $html .= get_combined_javascripts(); } if (!sfConfig::get('symfony.asset.stylesheets_included', false)) { $html .= get_combined_stylesheets(); } if ($html) { $response->setContent(substr($content, 0, $pos) . $html . substr($content, $pos)); } } sfConfig::set('symfony.asset.javascripts_included', false); sfConfig::set('symfony.asset.stylesheets_included', false); }
/** * Method to get both stylesheets and javascripts through one function call * * @see get_combined_javacripts */ function get_combined_assets($groups = null, $groupType = sfCombineManager::GROUP_INCLUDE, $onlyUnusedGroups = true, $markGroupsUsed = true) { return get_combined_javascripts($groups, $groupType, $onlyUnusedGroups, $markGroupsUsed) . get_combined_stylesheets($groups, $groupType, $onlyUnusedGroups, $markGroupsUsed); }
/** * Output the combined javascripts * * @see get_combined_javascripts */ function include_combined_javascripts($groups = null, $groupType = sfCombinePlusManager::GROUP_INCLUDE, $onlyUnusedGroups = true, $markGroupsUsed = true) { echo get_combined_javascripts($groups, $groupType); }
function include_combined_javascripts() { echo get_combined_javascripts(); }