class YahooJavascriptLoaderFilter extends AgaviFilter implements AgaviIFilter, AgaviIGlobalFilter { function executeOnce(AgaviFilterChain $fc, AgaviExecutionContainer $cont) { $fc->execute($cont); $html = $cont->getResponse()->getContent(); $req = $this->context->getRequest(); $deps = $req->getAttribute('deps', 'xxx.layout.yahoo'); $js_dependencies = @array_unique($deps); if ($js_dependencies && is_array($js_dependencies)) { $r = $this->getContext()->getRouting(); $include = ''; foreach($js_dependencies as $dep) $include .= ' ' . "\n"; $html = str_replace('%%JS_INCLUDE%%', $include, $html); } else $include = ''; $html = str_replace('%%JS_INCLUDE%%', $include, $html); $cont->getResponse()->setContent($html); } }