much friendlier get_theme_object
git-svn-id: file:///home/shish/svn/shimmie2/trunk@1019 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
1f0e363645
commit
f8f7470e61
@ -10,7 +10,7 @@ class BulkAdd implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("bulk_add", "BulkAddTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "bulk_add")) {
|
||||
if($event->user->is_admin() && isset($_POST['dir'])) {
|
||||
|
@ -10,7 +10,7 @@ class Downtime implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("downtime", "DowntimeTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof SetupBuildingEvent) {
|
||||
$sb = new SetupBlock("Downtime");
|
||||
|
@ -10,7 +10,7 @@ class ET implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("et", "ETTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "system_info")) {
|
||||
if($event->user->is_admin()) {
|
||||
|
@ -10,7 +10,7 @@ class EventLog implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("event_log", "EventLogTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
$this->setup();
|
||||
|
@ -10,7 +10,7 @@ class Featured implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("featured", "FeaturedTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -12,7 +12,7 @@ class Home implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("home", "HomeTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "home"))
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class Image_Hash_Ban implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("Image_Hash_Ban", "ImageBanTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -34,7 +34,7 @@ class IPBan implements Extension {
|
||||
var $theme;
|
||||
// event handler {{{
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("ipban", "IPBanTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -8,7 +8,7 @@ class LinkImage implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("link_image", "LinkImageTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
if(($event instanceof DisplayingImageEvent)) {
|
||||
global $config;
|
||||
$data_href = get_base_href();
|
||||
|
@ -10,7 +10,7 @@ class News implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("news", "NewsTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof PostListBuildingEvent) {
|
||||
global $config;
|
||||
|
@ -10,7 +10,7 @@ class Notes implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("notes", "NotesTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -20,7 +20,7 @@ class NumericScore implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("numeric_score", "NumericScoreTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -20,7 +20,7 @@ class Ratings implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("rating", "RatingsTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -10,7 +10,7 @@ class RegenThumb implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("regen_thumb", "RegenThumbTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "regen_thumb")) {
|
||||
global $user;
|
||||
|
@ -33,7 +33,7 @@ class ReportImage implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("report_image", "ReportImageTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -10,7 +10,7 @@ class SVNUpdate implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("svn_update", "SVNUpdateTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "update")) {
|
||||
if($event->user->is_admin()) {
|
||||
|
@ -9,7 +9,7 @@ class Tag_History implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("tag_history", "Tag_HistoryTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof InitExtEvent)) {
|
||||
// shimmie is being installed so call install to create the table.
|
||||
|
@ -11,7 +11,7 @@ class Tagger implements Extension {
|
||||
|
||||
public function receive_event ($event) {
|
||||
if(is_null($this->theme))
|
||||
$this->theme = get_theme_object("tagger", "taggerTheme");
|
||||
$this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $page, $config, $user;
|
||||
|
@ -20,7 +20,7 @@ class TextScore implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("text_score", "TextScoreTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof InitExtEvent)) {
|
||||
global $config;
|
||||
|
@ -56,7 +56,7 @@ class Wiki implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("wiki", "WikiTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof InitExtEvent)) {
|
||||
$this->setup();
|
||||
|
@ -10,7 +10,7 @@ class Zoom implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if($this->theme == null) $this->theme = get_theme_object("zoom", "ZoomTheme");
|
||||
if($this->theme == null) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof DisplayingImageEvent) {
|
||||
global $config;
|
||||
|
@ -178,12 +178,14 @@ function _count_execs($db, $sql, $inputarray) {
|
||||
$null = null; return $null;
|
||||
}
|
||||
|
||||
function get_theme_object($file, $class) {
|
||||
if(class_exists("Custom$class")) {
|
||||
$class = "Custom$class";
|
||||
function get_theme_object($class) {
|
||||
$base = get_class($class);
|
||||
if(class_exists("Custom{$base}Theme")) {
|
||||
$class = "Custom{$base}Theme";
|
||||
return new $class();
|
||||
}
|
||||
else {
|
||||
$class = "{$base}Theme";
|
||||
return new $class();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class AdminPage implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("admin", "AdminPageTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "admin")) {
|
||||
if(!$event->user->is_admin()) {
|
||||
|
@ -14,7 +14,7 @@ class AliasEditor implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("alias_editor", "AliasEditorTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "alias")) {
|
||||
if($event->get_arg(0) == "add") {
|
||||
|
@ -52,7 +52,7 @@ class CommentList implements Extension {
|
||||
var $theme;
|
||||
// event handler {{{
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("comment", "CommentListTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -57,7 +57,7 @@ class ExtManager implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("ext_manager", "ExtManagerTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "ext_manager")) {
|
||||
if($event->user->is_admin()) {
|
||||
|
@ -14,7 +14,7 @@ class Index implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("index", "IndexTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -126,7 +126,7 @@ class Setup implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("setup", "SetupTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -4,7 +4,7 @@ class TagEdit implements Extension {
|
||||
var $theme;
|
||||
// event handling {{{
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("tag_edit", "TagEditTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "tag_edit")) {
|
||||
global $page;
|
||||
|
@ -5,7 +5,7 @@ class TagList implements Extension {
|
||||
|
||||
// event handling {{{
|
||||
public function receive_event(Event $event) {
|
||||
if($this->theme == null) $this->theme = get_theme_object("tag_list", "TagListTheme");
|
||||
if($this->theme == null) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -4,7 +4,7 @@ class Upload implements Extension {
|
||||
var $theme;
|
||||
// event handling {{{
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("upload", "UploadTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
$is_full = (disk_free_space(realpath("./images/")) < 100*1024*1024);
|
||||
|
||||
|
@ -41,7 +41,7 @@ class UserPage implements Extension {
|
||||
|
||||
// event handling {{{
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("user", "UserPageTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if($event instanceof InitExtEvent) {
|
||||
global $config;
|
||||
|
@ -43,7 +43,7 @@ class ViewImage implements Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event(Event $event) {
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object("view", "ViewTheme");
|
||||
if(is_null($this->theme)) $this->theme = get_theme_object($this);
|
||||
|
||||
if(($event instanceof PageRequestEvent) && ($event->page_name == "post") && ($event->get_arg(0) == "view")) {
|
||||
$image_id = int_escape($event->get_arg(1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user