diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-08-08 18:11:47 +0000 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-08-08 18:11:47 +0000 |
commit | e3bb64cd6ceb9519aaed435fcb7dccb7e16e674d (patch) | |
tree | 97f5b0a35565a4300f352dc308ee0089926c0f4e /lib/htmloutputter.php | |
parent | c03d5932877c15eb673febabda5227df2173fbad (diff) | |
parent | 932d1fb7ce06081c788ea088171fd69ef03cd394 (diff) |
Merge branch '0.8.x' into twitter-oauth
Diffstat (limited to 'lib/htmloutputter.php')
-rw-r--r-- | lib/htmloutputter.php | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 06603ac05..f4445b44f 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -109,10 +109,11 @@ class HTMLOutputter extends XMLOutputter header('Content-Type: '.$type); $this->extraHeaders(); - - $this->startXML('html', - '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + if( ! substr($type,0,strlen('text/html'))=='text/html' ){ + // Browsers don't like it when <?xml it output for non-xhtml documents + $this->xw->startDocument('1.0', 'UTF-8'); + } + $this->xw->writeDTD('html', $public, $system); $language = $this->getLanguage(); @@ -339,6 +340,55 @@ class HTMLOutputter extends XMLOutputter } /** + * output a script (almost always javascript) tag + * + * @param string $src relative or absolute script path + * @param string $type 'type' attribute value of the tag + * + * @return void + */ + 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' => $src), + ' '); + } + + /** + * output a css link + * + * @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($src,$theme=null,$media=null) + { + if (!$theme) { + $theme = common_config('site', 'theme'); + } + $url = parse_url($src); + if(! ($url->scheme || $url->host || $url->query || $url->fragment)) + { + if(file_exists(theme_file($src,$theme))){ + $src = theme_path($src, $theme) . '?version=' . LACONICA_VERSION; + }else{ + $src = common_path($src); + } + } + $this->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => $src, + 'media' => $media)); + } + + /** * output an HTML textarea and associated elements * * @param string $id element ID, must be unique on page |