diff --git a/contrib/link_image/theme.php b/contrib/link_image/theme.php index c7a09be6..48e68cd2 100644 --- a/contrib/link_image/theme.php +++ b/contrib/link_image/theme.php @@ -33,7 +33,7 @@ class LinkImageTheme extends Themelet { 50)); } - private function url ($url,$content,$type) { + protected function url ($url,$content,$type) { if ($content == NULL) {$content=$url;} switch ($type) { @@ -49,7 +49,7 @@ class LinkImageTheme extends Themelet { return $text; } - private function img ($src,$type) { + protected function img ($src,$type) { switch ($type) { case "html": $text = ""; @@ -63,7 +63,7 @@ class LinkImageTheme extends Themelet { return $text; } - private function link_code($label,$content,$id=NULL) { + protected function link_code($label,$content,$id=NULL) { return "\n". "\n
\n"; } diff --git a/contrib/wiki/theme.php b/contrib/wiki/theme.php index de03f0ea..f47319a9 100644 --- a/contrib/wiki/theme.php +++ b/contrib/wiki/theme.php @@ -36,7 +36,7 @@ class WikiTheme { $page->add_block(new Block("Editor", $this->create_edit_html($wiki_page))); } - private function can_edit($user, $page) { + protected function can_edit($user, $page) { global $config; if(!is_null($page) && $page->is_locked() && !$user->is_admin()) return false; @@ -46,7 +46,7 @@ class WikiTheme { return false; } - private function create_edit_html($page) { + protected function create_edit_html($page) { $h_title = html_escape($page->title); $u_title = url_escape($page->title); $i_revision = int_escape($page->revision) + 1; @@ -70,7 +70,7 @@ class WikiTheme { "; } - private function create_display_html($page) { + protected function create_display_html($page) { $owner = $page->get_owner(); $tfe = new TextFormattingEvent($page->body); diff --git a/core/util.inc.php b/core/util.inc.php index b0343650..30ab0863 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -167,12 +167,11 @@ function _count_execs($db, $sql, $inputarray) { function get_theme_object($file, $class) { global $config; $theme = $config->get_string("theme", "default"); - if(file_exists("themes/$theme/$file.theme.php")) { - require_once "themes/$theme/$file.theme.php"; + if(class_exists("Custom$class")) { + $class = "Custom$class"; return new $class(); } else { - require_once "ext/$file/theme.php"; return new $class(); } } diff --git a/ext/comment/theme.php b/ext/comment/theme.php index bc7bb8da..d91a0276 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -75,7 +75,7 @@ class CommentListTheme extends Themelet { */ - private function comments_to_html($comments, $trim=false) { + protected function comments_to_html($comments, $trim=false) { $html = ""; foreach($comments as $comment) { $html .= $this->comment_to_html($comment, $trim); @@ -83,7 +83,7 @@ class CommentListTheme extends Themelet { return $html; } - private function comment_to_html($comment, $trim=false) { + protected function comment_to_html($comment, $trim=false) { global $user; $tfe = new TextFormattingEvent($comment->comment); @@ -105,7 +105,7 @@ class CommentListTheme extends Themelet { return "

$h_userlink: $h_comment $h_imagelink $h_dellink

"; } - private function build_postbox($image_id) { + protected function build_postbox($image_id) { $i_image_id = int_escape($image_id); return "
diff --git a/ext/et/theme.php b/ext/et/theme.php index 3c2a45c5..6d5088c3 100644 --- a/ext/et/theme.php +++ b/ext/et/theme.php @@ -13,7 +13,7 @@ class ETTheme extends Themelet { $page->add_block(new Block("Data which is to be sent:", $this->build_data_form($info))); } - private function build_data_form($info) { + protected function build_data_form($info) { $data = <<$h_search"; } - private function build_table($images, $query) { + protected function build_table($images, $query) { global $config; $width = $config->get_int('index_width'); diff --git a/ext/setup/theme.php b/ext/setup/theme.php index 34777aed..a9ccff8c 100644 --- a/ext/setup/theme.php +++ b/ext/setup/theme.php @@ -52,14 +52,14 @@ class SetupTheme extends Themelet { $page->add_block(new Block("Setup", $table)); } - private function build_navigation() { + protected function build_navigation() { return " Index
Help "; } - private function sb_to_html($block) { + protected function sb_to_html($block) { return "
{$block->header}
{$block->body}
\n"; } } diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index 7650d0f3..e963a337 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -115,7 +115,7 @@ class TagListTheme extends Themelet { $page->add_block(new Block("Refine Search", $html, "left", 60)); } - private function ars($tag, $tags) { + protected function ars($tag, $tags) { $html = ""; $html .= " ("; $html .= $this->get_add_link($tags, $tag); @@ -125,7 +125,7 @@ class TagListTheme extends Themelet { return $html; } - private function get_remove_link($tags, $tag) { + protected function get_remove_link($tags, $tag) { if(!in_array($tag, $tags) && !in_array("-$tag", $tags)) { return ""; } @@ -136,7 +136,7 @@ class TagListTheme extends Themelet { } } - private function get_add_link($tags, $tag) { + protected function get_add_link($tags, $tag) { if(in_array($tag, $tags)) { return ""; } @@ -147,7 +147,7 @@ class TagListTheme extends Themelet { } } - private function get_subtract_link($tags, $tag) { + protected function get_subtract_link($tags, $tag) { if(in_array("-$tag", $tags)) { return ""; } @@ -158,7 +158,7 @@ class TagListTheme extends Themelet { } } - private function tag_link($tag) { + protected function tag_link($tag) { $u_tag = url_escape($tag); return make_link("post/list/$u_tag/1"); } diff --git a/ext/upload/theme.php b/ext/upload/theme.php index 951d2e5e..0b50aa13 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -51,7 +51,7 @@ class UploadTheme extends Themelet { public function display_upload_status($page, $ok) { if($ok) { $page->set_mode("redirect"); - $page->set_redirect(make_link("post/list")); + $page->set_redirect(make_link()); } else { $page->set_title("Upload Status"); @@ -64,7 +64,7 @@ class UploadTheme extends Themelet { $page->add_block(new Block($title, $message)); } - private function build_upload_block() { + protected function build_upload_block() { global $config; $upload_list = ""; diff --git a/ext/user/theme.php b/ext/user/theme.php index a8631d86..a71ee823 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -106,7 +106,7 @@ class UserPageTheme extends Themelet { } } - private function build_stats($duser) { + protected function build_stats($duser) { global $database; global $config; @@ -130,7 +130,7 @@ class UserPageTheme extends Themelet { "; } - private function build_options($duser) { + protected function build_options($duser) { global $database; global $config; @@ -150,7 +150,7 @@ class UserPageTheme extends Themelet { return $html; } - private function build_more_options($duser) { + protected function build_more_options($duser) { global $database; global $config; diff --git a/ext/view/theme.php b/ext/view/theme.php index 6665a1e5..4357fa65 100644 --- a/ext/view/theme.php +++ b/ext/view/theme.php @@ -15,7 +15,7 @@ class ViewTheme extends Themelet { var $pin = null; - private function build_pin($image_id) { + protected function build_pin($image_id) { if(!is_null($this->pin)) { return $this->pin; } @@ -35,14 +35,14 @@ class ViewTheme extends Themelet { $prev = $database->get_prev_image($image_id, $search_terms); $h_prev = (!is_null($prev) ? "Prev" : "Prev"); - $h_index = "Index"; + $h_index = "Index"; $h_next = (!is_null($next) ? "Next" : "Next"); $this->pin = "$h_prev | $h_index | $h_next"; return $this->pin; } - private function build_navigation($image_id) { + protected function build_navigation($image_id) { $h_pin = $this->build_pin($image_id); $h_search = "

@@ -55,12 +55,12 @@ class ViewTheme extends Themelet { return "$h_pin
$h_search"; } - private function build_image_view($image) { + protected function build_image_view($image) { $ilink = $image->get_image_link(); return ""; } - private function build_info($image) { + protected function build_info($image) { global $user; $owner = $image->get_owner(); $h_owner = html_escape($owner->name); diff --git a/ext/zoom/theme.php b/ext/zoom/theme.php index 4815cf36..63bff869 100644 --- a/ext/zoom/theme.php +++ b/ext/zoom/theme.php @@ -5,7 +5,7 @@ class ZoomTheme extends Themelet { $page->add_block(new Block(null, $this->make_zoomer($image->width, $zoom_by_default))); } - private function make_zoomer($image_width, $zoom_by_default) { + protected function make_zoomer($image_width, $zoom_by_default) { global $config; $default = $zoom_by_default ? "scale(img);" : ""; return <<get_string("theme", "default"); require_once "themes/$_theme/page.class.php"; require_once "themes/$_theme/layout.class.php"; require_once "themes/$_theme/themelet.class.php"; +$themelets = array_merge(glob("ext/*/theme.php"), glob("themes/$_theme/*.theme.php")); +foreach($themelets as $filename) { + require_once $filename; +} $page = new Page(); $user = _get_user(); send_event(new InitExtEvent());