Working on moving header() inside of the global $page data structure.

This commit is contained in:
green-ponies (jgen) 2011-08-28 00:31:30 -04:00
parent bf035c247d
commit fca286913e
15 changed files with 35 additions and 35 deletions

View file

@ -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("<link rel='search' type='application/opensearchdescription+xml' title='$search_title' href='$search_file_url'>");
$page->add_html_header("<link rel='search' type='application/opensearchdescription+xml' title='$search_title' href='$search_file_url'>");
}
// The search.xml file that is generated on the fly

View file

@ -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("<meta http-equiv=\"cache-control\" content=\"no-cache\">");
$page->add_html_header("<meta http-equiv=\"cache-control\" content=\"no-cache\">");
$page->add_block(new NavBlock());
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
}

View file

@ -11,7 +11,7 @@ class RSS_Comments extends SimpleExtension {
global $config, $page;
$title = $config->get_string('title');
$page->add_header("<link rel=\"alternate\" type=\"application/rss+xml\" ".
$page->add_html_header("<link rel=\"alternate\" type=\"application/rss+xml\" ".
"title=\"$title - Comments\" href=\"".make_link("rss/comments")."\" />");
}

View file

@ -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("<link id=\"images\" rel=\"alternate\" type=\"application/rss+xml\" ".
$page->add_html_header("<link id=\"images\" rel=\"alternate\" type=\"application/rss+xml\" ".
"title=\"$title - Images with tags: $search\" href=\"".make_link("rss/images/$search/1")."\" />");
}
else {
$page->add_header("<link id=\"images\" rel=\"alternate\" type=\"application/rss+xml\" ".
$page->add_html_header("<link id=\"images\" rel=\"alternate\" type=\"application/rss+xml\" ".
"title=\"$title - Images\" href=\"".make_link("rss/images/1")."\" />");
}
}

View file

@ -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("<meta name=\"description\" content=\"$description\">");
$page->add_html_header("<meta name=\"description\" content=\"$description\">");
}
if(strlen($config->get_string("site_keywords")) > 0) {
$keywords = $config->get_string("site_keywords");
$page->add_header("<meta name=\"keywords\" content=\"$keywords\">");
$page->add_html_header("<meta name=\"keywords\" content=\"$keywords\">");
}
}

View file

@ -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("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
$page->add_block(new Block(null,
"<script type='text/javascript'>Tagger.initialize("
.$event->get_image()->id.");</script>","main",1000));

View file

@ -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("<link rel='stylesheet' href='$data_href/$css' type='text/css'>");
$this->add_html_header("<link rel='stylesheet' href='$data_href/$css' type='text/css'>");
}
$css_files = glob("ext/*/style.css");
if($css_files) {
foreach($css_files as $css_file) {
$this->add_header("<link rel='stylesheet' href='$data_href/$css_file' type='text/css'>");
$this->add_html_header("<link rel='stylesheet' href='$data_href/$css_file' type='text/css'>");
}
}
foreach(glob("lib/*.js") as $js) {
$this->add_header("<script src='$data_href/$js' type='text/javascript'></script>");
$this->add_html_header("<script src='$data_href/$js' type='text/javascript'></script>");
}
$js_files = glob("ext/*/script.js");
if($js_files) {
foreach($js_files as $js_file) {
$this->add_header("<script src='$data_href/$js_file' type='text/javascript'></script>");
$this->add_html_header("<script src='$data_href/$js_file' type='text/javascript'></script>");
}
}
}

View file

@ -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("<meta name=\"keywords\" content=\"$metatags\">");
$page->add_header("<meta property=\"og:title\" content=\"$metatags\">");
$page->add_header("<meta property=\"og:type\" content=\"article\">");
$page->add_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">");
$page->add_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">");
$page->add_html_header("<meta name=\"keywords\" content=\"$metatags\">");
$page->add_html_header("<meta property=\"og:title\" content=\"$metatags\">");
$page->add_html_header("<meta property=\"og:type\" content=\"article\">");
$page->add_html_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">");
$page->add_html_header("<meta property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->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));

View file

@ -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";
}

View file

@ -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";
}

View file

@ -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";
}

View file

@ -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";
}

View file

@ -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";
}

View file

@ -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";
}

View file

@ -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";
}