* (c) 2004 David Heinemeier Hansson * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * AssetHelper. * * @package symfony * @subpackage helper * @author Fabien Potencier * @author David Heinemeier Hansson * @version SVN: $Id: AssetHelper.php 3775 2007-04-13 07:08:08Z fabien $ */ /** * Returns a tag that browsers and news readers * can use to auto-detect a RSS or ATOM feed for the current page, * to be included in the section of a HTML document. * * Options: * - rel - defaults to 'alternate' * - type - defaults to 'application/rss+xml' * - title - defaults to the feed type in upper case * * Examples: * * echo auto_discovery_link_tag('rss', 'module/feed'); * => * echo auto_discovery_link_tag('rss', 'module/feed', array('title' => 'My RSS')); * => * * * @param string feed type ('rss', 'atom') * @param string 'module/action' or '@rule' of the feed * @param array additional HTML compliant tag parameters * @return string XHTML compliant tag */ function auto_discovery_link_tag($type = 'rss', $url_options = array(), $tag_options = array()) { return tag('link', array( 'rel' => isset($tag_options['rel']) ? $tag_options['rel'] : 'alternate', 'type' => isset($tag_options['type']) ? $tag_options['type'] : 'application/'.$type.'+xml', 'title' => isset($tag_options['title']) ? $tag_options['title'] : ucfirst($type), 'href' => url_for($url_options, true) )); } /** * Returns the path to a JavaScript asset. * * Example: * * echo javascript_path('myscript'); * => /js/myscript.js * * * Note: The asset name can be supplied as a... * - full path, like "/my_js/myscript.css" * - file name, like "myscript.js", that gets expanded to "/js/myscript.js" * - file name without extension, like "myscript", that gets expanded to "/js/myscript.js" * * @param string asset name * @param bool return absolute path ? * @return string file path to the JavaScript file * @see javascript_include_tag */ function javascript_path($source, $absolute = false) { return _compute_public_path($source, 'js', 'js', $absolute); } /** * Returns a * echo javascript_include_tag('common.javascript', '/elsewhere/cools'); * => * * * * @param string asset names * @return string XHTML compliant