diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-08-05 20:28:46 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-08-05 20:28:46 -0400 |
commit | 2eaf738bf708ec4f49bd7bbc8ca67d6fad33317a (patch) | |
tree | 8d78d8937e7f982c1dbb7cb38963f1231a19583f /lib | |
parent | ca70874b0a4880842f5770155170f3bded4bfadc (diff) |
Handle relative and absolute url parameters to script() and cssLink()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/htmloutputter.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 0b4c1405a..9d3244625 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -349,29 +349,38 @@ class HTMLOutputter extends XMLOutputter */ function script($src, $type='text/javascript') { + $url = parse_url($src); + if(! ($url->scheme || $url->host || $url->query || $url->fragment)) + { + $src = common_path($src) . '?version=' . LACONICA_VERSION; + } $this->element('script', array('type' => $type, - 'src' => common_path($src) . '?version=' . LACONICA_VERSION), + 'src' => $src), ' '); } /** * output a css link * - * @param string $relative relative path within the theme directory + * @param string $src relative path within the theme directory, or an absolute path * @param string $theme 'theme' that contains the stylesheet * @param string media 'media' attribute of the tag * * @return void */ - function cssLink($relative,$theme,$media) + function cssLink($src,$theme,$media) { if (!$theme) { $theme = common_config('site', 'theme'); } - + $url = parse_url($src); + if(! ($url->scheme || $url->host || $url->query || $url->fragment)) + { + $src = theme_path($src) . '?version=' . LACONICA_VERSION; + } $this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', - 'href' => theme_path($relative, $theme) . '?version=' . LACONICA_VERSION, + 'href' => $src, 'media' => $media)); } |