From 95ba22c5d7ffb28fa5c44a398edca86cc0f637f5 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 5 Aug 2009 18:27:27 -0400 Subject: Switch DOCTYPE's to the XHTML 5 DOCTYPE --- lib/htmloutputter.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 06603ac05..cba8a5f5e 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -110,9 +110,7 @@ class HTMLOutputter extends XMLOutputter $this->extraHeaders(); - $this->startXML('html', - '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + $this->startXML('html'); $language = $this->getLanguage(); -- cgit v1.2.3-54-g00ecf From b975a6a0e5a5a7332eea4834494029c5c1238540 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 5 Aug 2009 18:55:47 -0400 Subject: Don't start HTML responses with extraHeaders(); - - $this->startXML('html'); + if( ! substr($type,0,strlen('text/html'))=='text/html' ){ + // Browsers don't like it when xw->startDocument('1.0', 'UTF-8'); + } + if ($doc) { + $this->xw->writeDTD('html', $public, $system); + } $language = $this->getLanguage(); -- cgit v1.2.3-54-g00ecf From feac024348e0584c84fd5392c503d912000d30bc Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 5 Aug 2009 19:24:34 -0400 Subject: Accidentally caused the DOCTYPE to never be rendered - fix that. --- lib/htmloutputter.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 8f3b1a609..5da1fbe14 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -113,9 +113,7 @@ class HTMLOutputter extends XMLOutputter // Browsers don't like it when xw->startDocument('1.0', 'UTF-8'); } - if ($doc) { - $this->xw->writeDTD('html', $public, $system); - } + $this->xw->writeDTD('html', $public, $system); $language = $this->getLanguage(); -- cgit v1.2.3-54-g00ecf From 6a76addbe8bbfafd1a1dd6ed7ffbf8afebff5abe Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 5 Aug 2009 19:35:42 -0400 Subject: Added cssLink() and script() functions to htmloutputter --- lib/htmloutputter.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 5da1fbe14..0b4c1405a 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -339,6 +339,42 @@ 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') + { + $this->element('script', array('type' => $type, + 'src' => common_path($src) . '?version=' . LACONICA_VERSION), + ' '); + } + + /** + * output a css link + * + * @param string $relative relative path within the theme directory + * @param string $theme 'theme' that contains the stylesheet + * @param string media 'media' attribute of the tag + * + * @return void + */ + function cssLink($relative,$theme,$media) + { + if (!$theme) { + $theme = common_config('site', 'theme'); + } + + $this->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => theme_path($relative, $theme) . '?version=' . LACONICA_VERSION, + 'media' => $media)); + } + /** * output an HTML textarea and associated elements * -- cgit v1.2.3-54-g00ecf From 2eaf738bf708ec4f49bd7bbc8ca67d6fad33317a Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 5 Aug 2009 20:28:46 -0400 Subject: Handle relative and absolute url parameters to script() and cssLink() --- lib/htmloutputter.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/htmloutputter.php') 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)); } -- cgit v1.2.3-54-g00ecf From c8c2d9d7c93f40e7ac81c6211f8ba4c3f6ae91d9 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 6 Aug 2009 11:18:57 -0400 Subject: Make 2nd and 3rd cssLink() arguments optional --- lib/htmloutputter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 9d3244625..74876523a 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -368,7 +368,7 @@ class HTMLOutputter extends XMLOutputter * * @return void */ - function cssLink($src,$theme,$media) + function cssLink($src,$theme=null,$media=null) { if (!$theme) { $theme = common_config('site', 'theme'); -- cgit v1.2.3-54-g00ecf From e386a75d1b5271cfcd51825d0d2a420ef66d3622 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 6 Aug 2009 13:05:40 -0400 Subject: Check theme first for CSS files, then use the non-theme path. Fixes CSS links in plugins --- lib/htmloutputter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 74876523a..f4445b44f 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -376,7 +376,11 @@ class HTMLOutputter extends XMLOutputter $url = parse_url($src); if(! ($url->scheme || $url->host || $url->query || $url->fragment)) { - $src = theme_path($src) . '?version=' . LACONICA_VERSION; + 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', -- cgit v1.2.3-54-g00ecf From 04ed583cc504da20d0a5e8093f7232ec5bf03493 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 6 Aug 2009 18:05:46 -0400 Subject: remove redundant/unnecessary lines --- lib/htmloutputter.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index f4445b44f..2684baca6 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -370,9 +370,6 @@ class HTMLOutputter extends XMLOutputter */ 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)) { -- cgit v1.2.3-54-g00ecf From 060d5c4b8e1eea9561fe9dcad972cb412a5b00ec Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Sat, 8 Aug 2009 22:56:42 -0400 Subject: Fix logic that determines if a URL is relative or absolute in script() and cssLink() --- lib/htmloutputter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 2684baca6..604597116 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -350,7 +350,7 @@ class HTMLOutputter extends XMLOutputter function script($src, $type='text/javascript') { $url = parse_url($src); - if(! ($url->scheme || $url->host || $url->query || $url->fragment)) + if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) { $src = common_path($src) . '?version=' . LACONICA_VERSION; } @@ -371,7 +371,7 @@ class HTMLOutputter extends XMLOutputter function cssLink($src,$theme=null,$media=null) { $url = parse_url($src); - if(! ($url->scheme || $url->host || $url->query || $url->fragment)) + 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; -- cgit v1.2.3-54-g00ecf From d6bcc635bb7a1d5884f4691e7b74152b8cd9c9bc Mon Sep 17 00:00:00 2001 From: Brett Taylor Date: Tue, 11 Aug 2009 15:53:37 +1200 Subject: two variables $public and $system were generating notices in lib/htmloutputter.php, removed because these two parameters are null by default. --- lib/htmloutputter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/htmloutputter.php') diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 604597116..683a5e0b7 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -113,7 +113,7 @@ class HTMLOutputter extends XMLOutputter // Browsers don't like it when xw->startDocument('1.0', 'UTF-8'); } - $this->xw->writeDTD('html', $public, $system); + $this->xw->writeDTD('html'); $language = $this->getLanguage(); -- cgit v1.2.3-54-g00ecf