Working on moving header() inside of the global $page data structure.
This commit is contained in:
parent
bf035c247d
commit
fca286913e
15 changed files with 35 additions and 35 deletions
|
@ -28,7 +28,7 @@ class BrowserSearch implements Extension {
|
||||||
global $config;
|
global $config;
|
||||||
$search_title = $config->get_string('title');
|
$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');
|
$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
|
// The search.xml file that is generated on the fly
|
||||||
|
|
|
@ -19,7 +19,7 @@ class RegenThumbTheme extends Themelet {
|
||||||
public function display_results(Page $page, Image $image) {
|
public function display_results(Page $page, Image $image) {
|
||||||
$page->set_title("Thumbnail Regenerated");
|
$page->set_title("Thumbnail Regenerated");
|
||||||
$page->set_heading("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 NavBlock());
|
||||||
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
|
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class RSS_Comments extends SimpleExtension {
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
$title = $config->get_string('title');
|
$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")."\" />");
|
"title=\"$title - Comments\" href=\"".make_link("rss/comments")."\" />");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@ class RSS_Images extends SimpleExtension {
|
||||||
|
|
||||||
if(count($event->search_terms) > 0) {
|
if(count($event->search_terms) > 0) {
|
||||||
$search = html_escape(implode(' ', $event->search_terms));
|
$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")."\" />");
|
"title=\"$title - Images with tags: $search\" href=\"".make_link("rss/images/$search/1")."\" />");
|
||||||
}
|
}
|
||||||
else {
|
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")."\" />");
|
"title=\"$title - Images\" href=\"".make_link("rss/images/1")."\" />");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ class SiteDescription extends SimpleExtension {
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
if(strlen($config->get_string("site_description")) > 0) {
|
if(strlen($config->get_string("site_description")) > 0) {
|
||||||
$description = $config->get_string("site_description");
|
$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) {
|
if(strlen($config->get_string("site_keywords")) > 0) {
|
||||||
$keywords = $config->get_string("site_keywords");
|
$keywords = $config->get_string("site_keywords");
|
||||||
$page->add_header("<meta name=\"keywords\" content=\"$keywords\">");
|
$page->add_html_header("<meta name=\"keywords\" content=\"$keywords\">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class taggerTheme extends Themelet {
|
||||||
// Initialization code
|
// Initialization code
|
||||||
$base_href = $config->get_string('base_href');
|
$base_href = $config->get_string('base_href');
|
||||||
// TODO: AJAX test and fallback.
|
// 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,
|
$page->add_block(new Block(null,
|
||||||
"<script type='text/javascript'>Tagger.initialize("
|
"<script type='text/javascript'>Tagger.initialize("
|
||||||
.$event->get_image()->id.");</script>","main",1000));
|
.$event->get_image()->id.");</script>","main",1000));
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Page {
|
||||||
var $heading = "";
|
var $heading = "";
|
||||||
var $subheading = "";
|
var $subheading = "";
|
||||||
var $quicknav = "";
|
var $quicknav = "";
|
||||||
var $headers = array();
|
var $html_headers = array();
|
||||||
var $blocks = array();
|
var $blocks = array();
|
||||||
/** @publicsection */
|
/** @publicsection */
|
||||||
|
|
||||||
|
@ -136,9 +136,9 @@ class Page {
|
||||||
/**
|
/**
|
||||||
* Add a line to the HTML head section
|
* Add a line to the HTML head section
|
||||||
*/
|
*/
|
||||||
public function add_header($line, $position=50) {
|
public function add_html_header($line, $position=50) {
|
||||||
while(isset($this->headers[$position])) $position++;
|
while(isset($this->html_headers[$position])) $position++;
|
||||||
$this->headers[$position] = $line;
|
$this->html_headers[$position] = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +165,7 @@ class Page {
|
||||||
case "page":
|
case "page":
|
||||||
header("Cache-control: no-cache");
|
header("Cache-control: no-cache");
|
||||||
usort($this->blocks, "blockcmp");
|
usort($this->blocks, "blockcmp");
|
||||||
$this->add_auto_headers();
|
$this->add_auto_html_headers();
|
||||||
$layout = new Layout();
|
$layout = new Layout();
|
||||||
$layout->display_page($page);
|
$layout->display_page($page);
|
||||||
break;
|
break;
|
||||||
|
@ -186,26 +186,26 @@ class Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function add_auto_headers() {
|
protected function add_auto_html_headers() {
|
||||||
$data_href = get_base_href();
|
$data_href = get_base_href();
|
||||||
|
|
||||||
foreach(glob("lib/*.css") as $css) {
|
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");
|
$css_files = glob("ext/*/style.css");
|
||||||
if($css_files) {
|
if($css_files) {
|
||||||
foreach($css_files as $css_file) {
|
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) {
|
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");
|
$js_files = glob("ext/*/script.js");
|
||||||
if($js_files) {
|
if($js_files) {
|
||||||
foreach($js_files as $js_file) {
|
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>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,11 @@ class ViewImageTheme extends Themelet {
|
||||||
$metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
|
$metatags = str_replace(" ", ", ", html_escape($image->get_tag_list()));
|
||||||
|
|
||||||
$page->set_title("Image {$image->id}: ".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_html_header("<meta name=\"keywords\" content=\"$metatags\">");
|
||||||
$page->add_header("<meta property=\"og:title\" content=\"$metatags\">");
|
$page->add_html_header("<meta property=\"og:title\" content=\"$metatags\">");
|
||||||
$page->add_header("<meta property=\"og:type\" content=\"article\">");
|
$page->add_html_header("<meta property=\"og:type\" content=\"article\">");
|
||||||
$page->add_header("<meta property=\"og:image\" content=\"".make_http($image->get_thumb_link())."\">");
|
$page->add_html_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 property=\"og:url\" content=\"".make_http(make_link("post/view/{$image->id}"))."\">");
|
||||||
$page->set_heading(html_escape($image->get_tag_list()));
|
$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("Navigation", $this->build_navigation($image), "left", 0));
|
||||||
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10));
|
$page->add_block(new Block(null, $this->build_info($image, $editor_parts), "main", 10));
|
||||||
|
|
|
@ -53,8 +53,8 @@ class Layout {
|
||||||
|
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
ksort($page->headers);
|
ksort($page->html_headers);
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ class Layout {
|
||||||
$contact_link = $config->get_string('contact_link');
|
$contact_link = $config->get_string('contact_link');
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
ksort($page->headers);
|
ksort($page->html_headers);
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ class Layout {
|
||||||
$contact_link = $config->get_string('contact_link');
|
$contact_link = $config->get_string('contact_link');
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
ksort($page->headers);
|
ksort($page->html_headers);
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ class Layout {
|
||||||
$contact_link = $config->get_string('contact_link');
|
$contact_link = $config->get_string('contact_link');
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
ksort($page->headers);
|
ksort($page->html_headers);
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Layout {
|
||||||
$contact_link = $config->get_string('contact_link');
|
$contact_link = $config->get_string('contact_link');
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ class Layout {
|
||||||
$contact_link = $config->get_string('contact_link');
|
$contact_link = $config->get_string('contact_link');
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
ksort($page->headers);
|
ksort($page->html_headers);
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Layout {
|
||||||
$contact_link = $config->get_string('contact_link');
|
$contact_link = $config->get_string('contact_link');
|
||||||
|
|
||||||
$header_html = "";
|
$header_html = "";
|
||||||
foreach($page->headers as $line) {
|
foreach($page->html_headers as $line) {
|
||||||
$header_html .= "\t\t$line\n";
|
$header_html .= "\t\t$line\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue