X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fhtmloutputter.php;h=683a5e0b71fb58da3a07e3cc7015250a70c981c2;hb=6c3149334cf69a33026a75be9f5ea579b2de3b8d;hp=06603ac05485660b206726ad217a769756f9713b;hpb=d014d43c6860e3aaf46a5afba0ea3dffd54f630d;p=quix0rs-gnu-social.git diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 06603ac054..683a5e0b71 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 xw->startDocument('1.0', 'UTF-8'); + } + $this->xw->writeDTD('html'); $language = $this->getLanguage(); @@ -338,6 +339,52 @@ class HTMLOutputter extends XMLOutputter 'title' => $title)); } + /** + * 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( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($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) + { + $url = parse_url($src); + if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($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 *