From fca286913e8d00f7000894bad93e75ce20edb7cf Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 28 Aug 2011 00:31:30 -0400 Subject: [PATCH] Working on moving header() inside of the global $page data structure. --- contrib/browser_search/main.php | 2 +- contrib/regen_thumb/theme.php | 2 +- contrib/rss_comments/main.php | 2 +- contrib/rss_images/main.php | 4 ++-- contrib/site_description/main.php | 4 ++-- contrib/tagger/theme.php | 2 +- core/page.class.php | 20 ++++++++++---------- ext/view/theme.php | 10 +++++----- themes/danbooru/layout.class.php | 4 ++-- themes/default/layout.class.php | 4 ++-- themes/flat/layout.class.php | 4 ++-- themes/futaba/layout.class.php | 4 ++-- themes/lite/layout.class.php | 2 +- themes/old_default/layout.class.php | 4 ++-- themes/warm/layout.class.php | 2 +- 15 files changed, 35 insertions(+), 35 deletions(-) diff --git a/contrib/browser_search/main.php b/contrib/browser_search/main.php index fb0e5906..0b458a64 100755 --- a/contrib/browser_search/main.php +++ b/contrib/browser_search/main.php @@ -28,7 +28,7 @@ class BrowserSearch implements Extension { global $config; $search_title = $config->get_string('title'); $search_file_url = make_link('browser_search/please_dont_use_this_tag_as_it_would_break_stuff__search.xml'); - $page->add_header(""); + $page->add_html_header(""); } // The search.xml file that is generated on the fly diff --git a/contrib/regen_thumb/theme.php b/contrib/regen_thumb/theme.php index 2d8b7d68..6f5720a7 100644 --- a/contrib/regen_thumb/theme.php +++ b/contrib/regen_thumb/theme.php @@ -19,7 +19,7 @@ class RegenThumbTheme extends Themelet { public function display_results(Page $page, Image $image) { $page->set_title("Thumbnail Regenerated"); $page->set_heading("Thumbnail Regenerated"); - $page->add_header(""); + $page->add_html_header(""); $page->add_block(new NavBlock()); $page->add_block(new Block("Thumbnail", $this->build_thumb_html($image))); } diff --git a/contrib/rss_comments/main.php b/contrib/rss_comments/main.php index aa73d550..084ce836 100644 --- a/contrib/rss_comments/main.php +++ b/contrib/rss_comments/main.php @@ -11,7 +11,7 @@ class RSS_Comments extends SimpleExtension { global $config, $page; $title = $config->get_string('title'); - $page->add_header("add_html_header(""); } diff --git a/contrib/rss_images/main.php b/contrib/rss_images/main.php index 9c8c1f7c..101b0ac8 100644 --- a/contrib/rss_images/main.php +++ b/contrib/rss_images/main.php @@ -13,11 +13,11 @@ class RSS_Images extends SimpleExtension { if(count($event->search_terms) > 0) { $search = html_escape(implode(' ', $event->search_terms)); - $page->add_header("add_html_header(""); } else { - $page->add_header("add_html_header(""); } } diff --git a/contrib/site_description/main.php b/contrib/site_description/main.php index faccde49..43ed38b1 100644 --- a/contrib/site_description/main.php +++ b/contrib/site_description/main.php @@ -14,11 +14,11 @@ class SiteDescription extends SimpleExtension { global $config, $page; if(strlen($config->get_string("site_description")) > 0) { $description = $config->get_string("site_description"); - $page->add_header(""); + $page->add_html_header(""); } if(strlen($config->get_string("site_keywords")) > 0) { $keywords = $config->get_string("site_keywords"); - $page->add_header(""); + $page->add_html_header(""); } } diff --git a/contrib/tagger/theme.php b/contrib/tagger/theme.php index f1edc566..062998d9 100644 --- a/contrib/tagger/theme.php +++ b/contrib/tagger/theme.php @@ -11,7 +11,7 @@ class taggerTheme extends Themelet { // Initialization code $base_href = $config->get_string('base_href'); // TODO: AJAX test and fallback. - $page->add_header(""); + $page->add_html_header(""); $page->add_block(new Block(null, "","main",1000)); diff --git a/core/page.class.php b/core/page.class.php index dc7ebf29..3af68f16 100644 --- a/core/page.class.php +++ b/core/page.class.php @@ -108,7 +108,7 @@ class Page { var $heading = ""; var $subheading = ""; var $quicknav = ""; - var $headers = array(); + var $html_headers = array(); var $blocks = array(); /** @publicsection */ @@ -136,9 +136,9 @@ class Page { /** * Add a line to the HTML head section */ - public function add_header($line, $position=50) { - while(isset($this->headers[$position])) $position++; - $this->headers[$position] = $line; + public function add_html_header($line, $position=50) { + while(isset($this->html_headers[$position])) $position++; + $this->html_headers[$position] = $line; } /** @@ -165,7 +165,7 @@ class Page { case "page": header("Cache-control: no-cache"); usort($this->blocks, "blockcmp"); - $this->add_auto_headers(); + $this->add_auto_html_headers(); $layout = new Layout(); $layout->display_page($page); break; @@ -186,26 +186,26 @@ class Page { } } - protected function add_auto_headers() { + protected function add_auto_html_headers() { $data_href = get_base_href(); foreach(glob("lib/*.css") as $css) { - $this->add_header(""); + $this->add_html_header(""); } $css_files = glob("ext/*/style.css"); if($css_files) { foreach($css_files as $css_file) { - $this->add_header(""); + $this->add_html_header(""); } } foreach(glob("lib/*.js") as $js) { - $this->add_header(""); + $this->add_html_header(""); } $js_files = glob("ext/*/script.js"); if($js_files) { foreach($js_files as $js_file) { - $this->add_header(""); + $this->add_html_header(""); } } } diff --git a/ext/view/theme.php b/ext/view/theme.php index 993243b3..b9cb5cf8 100644 --- a/ext/view/theme.php +++ b/ext/view/theme.php @@ -10,11 +10,11 @@ class ViewImageTheme extends Themelet { $metatags = str_replace(" ", ", ", html_escape($image->get_tag_list())); $page->set_title("Image {$image->id}: ".html_escape($image->get_tag_list())); - $page->add_header(""); - $page->add_header(""); - $page->add_header(""); - $page->add_header("get_thumb_link())."\">"); - $page->add_header("id}"))."\">"); + $page->add_html_header(""); + $page->add_html_header(""); + $page->add_html_header(""); + $page->add_html_header("get_thumb_link())."\">"); + $page->add_html_header("id}"))."\">"); $page->set_heading(html_escape($image->get_tag_list())); $page->add_block(new Block("Navigation", $this->build_navigation($image), "left", 0)); $page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10)); diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php index b49b52c2..5045adcc 100644 --- a/themes/danbooru/layout.class.php +++ b/themes/danbooru/layout.class.php @@ -53,8 +53,8 @@ class Layout { $header_html = ""; - ksort($page->headers); - foreach($page->headers as $line) { + ksort($page->html_headers); + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php index 290d1a8c..3ee91b82 100644 --- a/themes/default/layout.class.php +++ b/themes/default/layout.class.php @@ -14,8 +14,8 @@ class Layout { $contact_link = $config->get_string('contact_link'); $header_html = ""; - ksort($page->headers); - foreach($page->headers as $line) { + ksort($page->html_headers); + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } diff --git a/themes/flat/layout.class.php b/themes/flat/layout.class.php index d8fb4e0f..f0e9a95b 100644 --- a/themes/flat/layout.class.php +++ b/themes/flat/layout.class.php @@ -14,8 +14,8 @@ class Layout { $contact_link = $config->get_string('contact_link'); $header_html = ""; - ksort($page->headers); - foreach($page->headers as $line) { + ksort($page->html_headers); + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } diff --git a/themes/futaba/layout.class.php b/themes/futaba/layout.class.php index ed1568fd..51f76716 100644 --- a/themes/futaba/layout.class.php +++ b/themes/futaba/layout.class.php @@ -9,8 +9,8 @@ class Layout { $contact_link = $config->get_string('contact_link'); $header_html = ""; - ksort($page->headers); - foreach($page->headers as $line) { + ksort($page->html_headers); + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index 5e9bed77..c7273ab3 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -20,7 +20,7 @@ class Layout { $contact_link = $config->get_string('contact_link'); $header_html = ""; - foreach($page->headers as $line) { + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } diff --git a/themes/old_default/layout.class.php b/themes/old_default/layout.class.php index 43931d5e..cb4e6952 100644 --- a/themes/old_default/layout.class.php +++ b/themes/old_default/layout.class.php @@ -9,8 +9,8 @@ class Layout { $contact_link = $config->get_string('contact_link'); $header_html = ""; - ksort($page->headers); - foreach($page->headers as $line) { + ksort($page->html_headers); + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; } diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php index 3bd85755..3d6c2cb7 100644 --- a/themes/warm/layout.class.php +++ b/themes/warm/layout.class.php @@ -14,7 +14,7 @@ class Layout { $contact_link = $config->get_string('contact_link'); $header_html = ""; - foreach($page->headers as $line) { + foreach($page->html_headers as $line) { $header_html .= "\t\t$line\n"; }