/**
   * Executes this filter.
   *
   * @param sfFilterChain A sfFilterChain instance
   */
  public function execute($filterChain)
  {
    // execute next filter
    $filterChain->execute();

    $response = $this->getContext()->getResponse();
    $content = $response->getContent();

    // include UJS
    if ((false !== ($pos = strpos($content, '</body>'))) && !$response->getParameter('included', false, 'symfony/view/UJS'))
    {
      sfLoader::loadHelpers(array('Tag', 'UJS'));

      if ($html = get_UJS())
      {
        $response->setContent(substr($content, 0, $pos).$html.substr($content, $pos));
      }
    }
    
    $response->setParameter('included', false, 'symfony/view/UJS');
  }
예제 #2
0
/**
 * Prints previously added UJS code
 *
 * @param boolean True for static code (attached in another file), false otherwise (default)
 *
 */
function include_UJS($static = false)
{
  echo get_UJS($static);
}