From 09b2be6830956b88dc7d08c1589b5da23bf01f54 Mon Sep 17 00:00:00 2001 From: shish Date: Fri, 22 Aug 2008 09:41:30 +0000 Subject: [PATCH] PHP4 is dead \o/ \o/ \o/ (Part 1, make use of instanceof) git-svn-id: file:///home/shish/svn/shimmie2/trunk@994 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/autocomplete/main.php | 4 ++-- contrib/ban_words/main.php | 6 +++--- contrib/browser_search/main.php | 14 +++++--------- contrib/bulk_add/main.php | 4 ++-- contrib/danbooru_api/main.php | 4 ++-- contrib/downtime/main.php | 6 +++--- contrib/emoticons/main.php | 2 +- contrib/et/main.php | 4 ++-- contrib/event_log/main.php | 20 ++++++++++---------- contrib/featured/main.php | 10 +++++----- contrib/handle_archive/main.php | 6 +++--- contrib/handle_flash/main.php | 6 +++--- contrib/handle_ico/main.php | 8 ++++---- contrib/handle_mp3/main.php | 6 +++--- contrib/handle_svg/main.php | 8 ++++---- contrib/home/main.php | 4 ++-- contrib/image_hash_ban/main.php | 14 +++++++------- contrib/ipban/main.php | 10 +++++----- contrib/link_image/main.php | 6 +++--- contrib/news/main.php | 4 ++-- contrib/notes/main.php | 4 ++-- contrib/numeric_score/main.php | 16 ++++++++-------- contrib/piclens/main.php | 4 ++-- contrib/random_image/main.php | 2 +- contrib/rating/main.php | 14 +++++++------- contrib/regen_thumb/main.php | 4 ++-- contrib/report_image/main.php | 16 ++++++++-------- contrib/res_limit/main.php | 4 ++-- contrib/rss_comments/main.php | 4 ++-- contrib/rss_images/main.php | 6 +++--- contrib/site_description/main.php | 4 ++-- contrib/svn_update/main.php | 4 ++-- contrib/tag_history/main.php | 12 ++++++------ contrib/tagger/main.php | 11 +++++++---- contrib/text_score/main.php | 14 +++++++------- contrib/wiki/main.php | 8 ++++---- contrib/word_filter/main.php | 4 ++-- contrib/zoom/main.php | 4 ++-- ext/admin/main.php | 10 +++++----- ext/alias_editor/main.php | 6 +++--- ext/bbcode/main.php | 2 +- ext/comment/main.php | 16 ++++++++-------- ext/ext_manager/main.php | 4 ++-- ext/handle_404/main.php | 2 +- ext/handle_pixel/main.php | 6 +++--- ext/image/main.php | 10 +++++----- ext/index/main.php | 8 ++++---- ext/load_ext_data/main.php | 2 +- ext/setup/main.php | 11 ++++++----- ext/tag_edit/main.php | 18 +++++++++--------- ext/tag_list/main.php | 10 +++++----- ext/upgrade/main.php | 2 +- ext/upload/main.php | 10 +++++----- ext/user/main.php | 18 +++++++++--------- ext/view/main.php | 6 +++--- 55 files changed, 211 insertions(+), 211 deletions(-) diff --git a/contrib/autocomplete/main.php b/contrib/autocomplete/main.php index 26b5d975..7cf81172 100644 --- a/contrib/autocomplete/main.php +++ b/contrib/autocomplete/main.php @@ -8,10 +8,10 @@ class AutoComplete extends Extension { public function receive_event($event) { - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index" || $event->page_name == "view")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "index" || $event->page_name == "view")) { $event->page->add_header(""); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "autocomplete")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "autocomplete")) { $event->page->set_mode("data"); $event->page->set_type("text/plain"); $event->page->set_data($this->get_completions($event->get_arg(0))); diff --git a/contrib/ban_words/main.php b/contrib/ban_words/main.php index 57a2727e..126dae2d 100644 --- a/contrib/ban_words/main.php +++ b/contrib/ban_words/main.php @@ -8,7 +8,7 @@ class BanWords extends Extension { public function receive_event($event) { - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_string('banned_words', " viagra @@ -16,7 +16,7 @@ porn "); } - if(is_a($event, 'CommentPostingEvent')) { + if($event instanceof CommentPostingEvent) { global $config; $banned = $config->get_string("banned_words"); $comment = strtolower($event->comment); @@ -44,7 +44,7 @@ porn } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Banned Phrases"); $sb->add_label("One per line, lines that start with slashes are treated as regex
"); $sb->add_longtext_option("banned_words"); diff --git a/contrib/browser_search/main.php b/contrib/browser_search/main.php index e345ae4d..073ac0dc 100755 --- a/contrib/browser_search/main.php +++ b/contrib/browser_search/main.php @@ -16,12 +16,12 @@ class BrowserSearch extends Extension { global $page; global $config; - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { $config->set_default_string("search_suggestions_results_order", 'a'); } // Add in header code to let the browser know that the search plugin exists - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { // We need to build the data for the header global $config; $search_title = $config->get_string('title'); @@ -30,7 +30,7 @@ class BrowserSearch extends Extension { } // The search.xml file that is generated on the fly - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "browser_search") && $event->get_arg(0) == "please_dont_use_this_tag_as_it_would_break_stuff__search.xml") { + if(($event instanceof PageRequestEvent) && ($event->page_name == "browser_search") && $event->get_arg(0) == "please_dont_use_this_tag_as_it_would_break_stuff__search.xml") { // First, we need to build all the variables we'll need $search_title = $config->get_string('title'); @@ -58,7 +58,7 @@ class BrowserSearch extends Extension { $page->set_mode("data"); $page->set_type("text/xml"); $page->set_data($xml); - } else if(is_a($event, 'PageRequestEvent') && ($event->page_name == "browser_search") && !$config->get_bool("disable_search_suggestions")) { // We need to return results! + } else if(($event instanceof PageRequestEvent) && ($event->page_name == "browser_search") && !$config->get_bool("disable_search_suggestions")) { // We need to return results! global $database; // We have to build some json stuff @@ -93,8 +93,7 @@ class BrowserSearch extends Extension { $page->set_data($json_string); } - if(is_a($event, 'SetupBuildingEvent')) { - + if($event instanceof SetupBuildingEvent) { $sort_by = array(); $sort_by['Alphabetical'] = 'a'; $sort_by['Tag Count'] = 't'; @@ -105,10 +104,7 @@ class BrowserSearch extends Extension { $sb->add_choice_option("search_suggestions_results_order", $sort_by, "Sort the suggestions by:"); $event->panel->add_block($sb); } - } - - } add_event_listener(new BrowserSearch()); ?> diff --git a/contrib/bulk_add/main.php b/contrib/bulk_add/main.php index 0acf5b3d..f8023169 100644 --- a/contrib/bulk_add/main.php +++ b/contrib/bulk_add/main.php @@ -12,7 +12,7 @@ class BulkAdd extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("bulk_add", "BulkAddTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "bulk_add")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "bulk_add")) { if($event->user->is_admin() && isset($_POST['dir'])) { set_time_limit(0); @@ -21,7 +21,7 @@ class BulkAdd extends Extension { } } - if(is_a($event, 'AdminBuildingEvent')) { + if($event instanceof AdminBuildingEvent) { global $page; $this->theme->display_admin_block($page); } diff --git a/contrib/danbooru_api/main.php b/contrib/danbooru_api/main.php index 991361fd..c270a790 100644 --- a/contrib/danbooru_api/main.php +++ b/contrib/danbooru_api/main.php @@ -44,12 +44,12 @@ class DanbooruApi extends Extension public function receive_event($event) { // Check if someone is accessing /api/danbooru (us) - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "api") && ($event->get_arg(0) == 'danbooru')) + if(($event instanceof PageRequestEvent) && ($event->page_name == "api") && ($event->get_arg(0) == 'danbooru')) { // execute the danbooru processing code $this->api_danbooru($event); } - if(is_a($event, 'SearchTermParseEvent')) + if($event instanceof SearchTermParseEvent) { $matches = array(); if(preg_match("/md5:([0-9a-fA-F]*)/i", $event->term, $matches)) diff --git a/contrib/downtime/main.php b/contrib/downtime/main.php index 79cbf96f..00a4192b 100644 --- a/contrib/downtime/main.php +++ b/contrib/downtime/main.php @@ -12,14 +12,14 @@ class Downtime extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("downtime", "DowntimeTheme"); - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Downtime"); $sb->add_bool_option("downtime", "Disable non-admin access: "); $sb->add_longtext_option("downtime_message", "
"); $event->panel->add_block($sb); } - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { global $config; if($config->get_bool("downtime")) { $this->check_downtime($event); @@ -33,7 +33,7 @@ class Downtime extends Extension { global $config; if($config->get_bool("downtime") && !$user->is_admin() && - is_a($event, 'PageRequestEvent') && !$this->is_safe_page($event)) { + ($event instanceof PageRequestEvent) && !$this->is_safe_page($event)) { $msg = $config->get_string("downtime_message"); $this->theme->display_message($msg); } diff --git a/contrib/emoticons/main.php b/contrib/emoticons/main.php index cfa9ca87..f7064e44 100644 --- a/contrib/emoticons/main.php +++ b/contrib/emoticons/main.php @@ -8,7 +8,7 @@ class Emoticons extends Extension { public function receive_event($event) { - if(is_a($event, 'TextFormattingEvent')) { + if($event instanceof TextFormattingEvent) { $event->formatted = $this->bbcode_to_html($event->formatted); $event->stripped = $this->bbcode_to_text($event->stripped); } diff --git a/contrib/et/main.php b/contrib/et/main.php index c9116196..24629d98 100644 --- a/contrib/et/main.php +++ b/contrib/et/main.php @@ -12,13 +12,13 @@ class ET extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("et", "ETTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "system_info")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "system_info")) { if($event->user->is_admin()) { $this->theme->display_info_page($event->page, $this->get_info()); } } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("System Info", make_link("system_info")); } diff --git a/contrib/event_log/main.php b/contrib/event_log/main.php index d7f66f55..5a8b822c 100644 --- a/contrib/event_log/main.php +++ b/contrib/event_log/main.php @@ -12,11 +12,11 @@ class EventLog extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("event_log", "EventLogTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { $this->setup(); } - if(is_a($event, 'PageRequestEvent') && $event->page_name == "event_log") { + if(($event instanceof PageRequestEvent) && $event->page_name == "event_log") { global $database; if($event->user->is_admin()) { if(isset($_POST['action'])) { @@ -59,32 +59,32 @@ class EventLog extends Extension { $this->theme->display_error($event->page, "Denied", "Only admins can see the event log"); } } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Event Log", make_link("event_log")); } } global $user; // bad - if(is_a($event, 'UploadingImageEvent')) { + if($event instanceof UploadingImageEvent) { $this->add_to_log($event->user, 'Uploading Image', "Uploaded a new image"); } - if(is_a($event, 'CommentPostingEvent')) { + if($event instanceof CommentPostingEvent) { $this->add_to_log($event->user, 'Comment Posting', "Posted a comment on image #{$event->image_id}"); } - if(is_a($event, 'WikiUpdateEvent')) { + if($event instanceof WikiUpdateEvent) { $this->add_to_log($event->user, 'Wiki Update', "Edited '{$event->wikipage->title}'"); } - if(is_a($event, 'ConfigSaveEvent')) { + if($event instanceof ConfigSaveEvent) { $this->add_to_log($user, 'Config Save', "Updated the board config"); } - if(is_a($event, 'ImageDeletionEvent')) { + if($event instanceof ImageDeletionEvent) { $this->add_to_log($user, 'Image Deletion', "Deleted image {$event->image->id} (tags: {$event->image->get_tag_list()})"); } - if(is_a($event, 'SourceSetEvent')) { + if($event instanceof SourceSetEvent) { $this->add_to_log($user, 'Source Set', "Source for image #{$event->image_id} set to '{$event->source}'"); } - if(is_a($event, 'TagSetEvent')) { + if($event instanceof TagSetEvent) { $tags = implode($event->tags, ", "); $this->add_to_log($user, 'Tags Set', "Tags for image #{$event->image_id} set to '$tags'"); } diff --git a/contrib/featured/main.php b/contrib/featured/main.php index a429393e..265ed886 100644 --- a/contrib/featured/main.php +++ b/contrib/featured/main.php @@ -12,12 +12,12 @@ class Featured extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("featured", "FeaturedTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_int('featured_id', 0); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "set_feature")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "set_feature")) { global $user; if($user->is_admin() && isset($_POST['image_id'])) { global $config; @@ -30,7 +30,7 @@ class Featured extends Extension { } } - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $config, $database; $fid = $config->get_int("featured_id"); if($fid > 0) { @@ -42,14 +42,14 @@ class Featured extends Extension { } /* - if(is_a($event, 'SetupBuildingEvent')) { + if(($event instanceof SetupBuildingEvent)) { $sb = new SetupBlock("Featured Image"); $sb->add_int_option("featured_id", "Image ID: "); $event->panel->add_block($sb); } */ - if(is_a($event, 'ImageAdminBlockBuildingEvent')) { + if($event instanceof ImageAdminBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_part($this->theme->get_buttons_html($event->image->id)); } diff --git a/contrib/handle_archive/main.php b/contrib/handle_archive/main.php index cc4db0b6..8bff2fdf 100644 --- a/contrib/handle_archive/main.php +++ b/contrib/handle_archive/main.php @@ -7,12 +7,12 @@ class ArchiveFileHandler extends Extension { public function receive_event($event) { - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_string('archive_extract_command', 'unzip -d "%d" "%f"'); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Archive Handler Options"); $sb->add_text_option("archive_tmp_dir", "Temporary folder: "); $sb->add_text_option("archive_extract_command", "
Extraction command: "); @@ -20,7 +20,7 @@ class ArchiveFileHandler extends Extension { $event->panel->add_block($sb); } - if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type)) { + if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type)) { global $config; $tmp = sys_get_temp_dir(); $tmpdir = "$tmp/shimmie-archive-{$event->hash}"; diff --git a/contrib/handle_flash/main.php b/contrib/handle_flash/main.php index 6aeffdbb..ae6c5cb4 100644 --- a/contrib/handle_flash/main.php +++ b/contrib/handle_flash/main.php @@ -11,7 +11,7 @@ class FlashFileHandler extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("handle_flash", "FlashFileHandlerTheme"); - if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { + if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { $hash = $event->hash; $ha = substr($hash, 0, 2); if(!move_upload_to_archive($event)) return; @@ -25,14 +25,14 @@ class FlashFileHandler extends Extension { send_event(new ImageAdditionEvent($event->user, $image)); } - if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) { + if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) { $hash = $event->hash; $ha = substr($hash, 0, 2); // FIXME: scale image, as not all boards use 192x192 copy("ext/handle_flash/thumb.jpg", "thumbs/$ha/$hash"); } - if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) { + if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) { $this->theme->display_image($event->page, $event->image); } } diff --git a/contrib/handle_ico/main.php b/contrib/handle_ico/main.php index c8b312b0..8e9cdd98 100644 --- a/contrib/handle_ico/main.php +++ b/contrib/handle_ico/main.php @@ -11,7 +11,7 @@ class IcoFileHandler extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("handle_ico", "IcoFileHandlerTheme"); - if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { + if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { $hash = $event->hash; $ha = substr($hash, 0, 2); if(!move_upload_to_archive($event)) return; @@ -30,15 +30,15 @@ class IcoFileHandler extends Extension { } } - if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) { + if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) { $this->create_thumb($event->hash); } - if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) { + if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) { $this->theme->display_image($event->page, $event->image); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "get_ico")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "get_ico")) { global $database; $id = int_escape($event->get_arg(0)); $image = $database->get_image($id); diff --git a/contrib/handle_mp3/main.php b/contrib/handle_mp3/main.php index 594b798b..41ef55aa 100644 --- a/contrib/handle_mp3/main.php +++ b/contrib/handle_mp3/main.php @@ -11,7 +11,7 @@ class MP3FileHandler extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("handle_mp3", "MP3FileHandlerTheme"); - if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { + if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { $hash = $event->hash; $ha = substr($hash, 0, 2); if(!move_upload_to_archive($event)) return; @@ -24,14 +24,14 @@ class MP3FileHandler extends Extension { send_event(new ImageAdditionEvent($event->user, $image)); } - if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) { + if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) { $hash = $event->hash; $ha = substr($hash, 0, 2); // FIXME: scale image, as not all boards use 192x192 copy("ext/handle_mp3/thumb.jpg", "thumbs/$ha/$hash"); } - if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) { + if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) { $this->theme->display_image($event->page, $event->image); } } diff --git a/contrib/handle_svg/main.php b/contrib/handle_svg/main.php index 3dc1de01..48a39e9e 100644 --- a/contrib/handle_svg/main.php +++ b/contrib/handle_svg/main.php @@ -11,7 +11,7 @@ class SVGFileHandler extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("handle_svg", "SVGFileHandlerTheme"); - if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { + if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { $hash = $event->hash; $ha = substr($hash, 0, 2); if(!move_upload_to_archive($event)) return; @@ -24,7 +24,7 @@ class SVGFileHandler extends Extension { send_event(new ImageAdditionEvent($event->user, $image)); } - if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) { + if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) { $hash = $event->hash; $ha = substr($hash, 0, 2); @@ -44,11 +44,11 @@ class SVGFileHandler extends Extension { // } } - if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) { + if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) { $this->theme->display_image($event->page, $event->image); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "get_svg")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "get_svg")) { global $database; $id = int_escape($event->get_arg(0)); $image = $database->get_image($id); diff --git a/contrib/home/main.php b/contrib/home/main.php index f5e21413..f0cc8dae 100644 --- a/contrib/home/main.php +++ b/contrib/home/main.php @@ -14,12 +14,12 @@ class Home extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("home", "HomeTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "home")) + if(($event instanceof PageRequestEvent) && ($event->page_name == "home")) { // this is a request to display this page so output the page. $this->output_pages($event->page); } - if(is_a($event, 'SetupBuildingEvent')) + if($event instanceof SetupBuildingEvent) { $counters = array(); foreach(glob("ext/home/counters/*") as $counter_dirname) { diff --git a/contrib/image_hash_ban/main.php b/contrib/image_hash_ban/main.php index c58006a5..764c1439 100644 --- a/contrib/image_hash_ban/main.php +++ b/contrib/image_hash_ban/main.php @@ -36,14 +36,14 @@ class Image_Hash_Ban extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("Image_Hash_Ban", "ImageBanTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; if($config->get_int("ext_imageban_version") < 1) { $this->install(); } } - if(is_a($event, 'DataUploadEvent')) { + if($event instanceof DataUploadEvent) { global $database; $row = $database->db->GetRow("SELECT * FROM image_bans WHERE hash = ?", $event->hash); @@ -52,7 +52,7 @@ class Image_Hash_Ban extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "image_hash_ban")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "image_hash_ban")) { if($event->user->is_admin()) { if($event->get_arg(0) == "add") { if(isset($_POST['hash']) && isset($_POST['reason'])) { @@ -84,20 +84,20 @@ class Image_Hash_Ban extends Extension { } } - if(is_a($event, 'AdminBuildingEvent')) { + if($event instanceof AdminBuildingEvent) { global $page; $this->theme->display_Image_hash_Bans($page, $this->get_image_hash_bans()); } - if(is_a($event, 'AddImageHashBanEvent')) { + if($event instanceof AddImageHashBanEvent) { $this->add_image_hash_ban($event->hash, $event->reason); } - if(is_a($event, 'RemoveImageHashBanEvent')) { + if($event instanceof RemoveImageHashBanEvent) { $this->remove_image_hash_ban($event->hash); } - if(is_a($event, 'ImageAdminBlockBuildingEvent')) { + if($event instanceof ImageAdminBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_part($this->theme->get_buttons_html($event->image)); } diff --git a/contrib/ipban/main.php b/contrib/ipban/main.php index 98d399c3..737ba90c 100644 --- a/contrib/ipban/main.php +++ b/contrib/ipban/main.php @@ -36,7 +36,7 @@ class IPBan extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("ipban", "IPBanTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; if($config->get_int("ext_ipban_version") < 5) { $this->install(); @@ -45,7 +45,7 @@ class IPBan extends Extension { $this->check_ip_ban(); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "ip_ban")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "ip_ban")) { global $user; if($user->is_admin()) { if($event->get_arg(0) == "add") { @@ -71,18 +71,18 @@ class IPBan extends Extension { } } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("IP Bans", make_link("ip_ban/list")); } } - if(is_a($event, 'AddIPBanEvent')) { + if($event instanceof AddIPBanEvent) { global $user; $this->add_ip_ban($event->ip, $event->reason, $event->end, $user); } - if(is_a($event, 'RemoveIPBanEvent')) { + if($event instanceof RemoveIPBanEvent) { global $database; $database->Execute("DELETE FROM bans WHERE id = ?", array($event->id)); } diff --git a/contrib/link_image/main.php b/contrib/link_image/main.php index 229c3dc1..95153df6 100644 --- a/contrib/link_image/main.php +++ b/contrib/link_image/main.php @@ -9,19 +9,19 @@ class LinkImage extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("link_image", "LinkImageTheme"); - if(is_a($event, 'DisplayingImageEvent')) { + if(($event instanceof DisplayingImageEvent)) { global $config; $data_href = get_base_href(); $event->page->add_header("",0); $this->theme->links_block($event->page,$this->data($event->image)); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Link to Image"); $sb->add_text_option("ext_link-img_text-link_format", "Text Link Format: "); $event->panel->add_block($sb); } - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; //just set default if empty. $config->set_default_string("ext_link-img_text-link_format", diff --git a/contrib/news/main.php b/contrib/news/main.php index a7ef041f..636bc22e 100644 --- a/contrib/news/main.php +++ b/contrib/news/main.php @@ -12,14 +12,14 @@ class News extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("news", "NewsTheme"); - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $config; if(strlen($config->get_string("news_text")) > 0) { $this->theme->display_news($event->page, $config->get_string("news_text")); } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("News"); $sb->add_longtext_option("news_text"); $event->panel->add_block($sb); diff --git a/contrib/notes/main.php b/contrib/notes/main.php index 94416cbb..03beac0a 100644 --- a/contrib/notes/main.php +++ b/contrib/notes/main.php @@ -12,14 +12,14 @@ class Notes extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("notes", "NotesTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; if($config->get_int("ext_notes_version") < 1) { $this->install(); } } - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $database; $notes = $database->get_all("SELECT * FROM image_notes WHERE image_id = ?", array($event->image->id)); $this->theme->display_notes($event->page, $notes); diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index f6ebdefe..ef754e8a 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -22,14 +22,14 @@ class NumericScore extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("numeric_score", "NumericScoreTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; if($config->get_int("ext_numeric_score_version", 0) < 1) { $this->install(); } } - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $user; if(!$user->is_anonymous()) { $html = $this->theme->get_voter_html($event->image); @@ -37,7 +37,7 @@ class NumericScore extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "numeric_score_vote")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "numeric_score_vote")) { if(!$event->user->is_anonymous()) { $image_id = int_escape($_POST['image_id']); $char = $_POST['vote']; @@ -50,7 +50,7 @@ class NumericScore extends Extension { } } - if(is_a($event, 'ImageInfoSetEvent')) { + if($event instanceof ImageInfoSetEvent) { global $user; $char = $_POST['numeric_score']; $score = 0; @@ -59,20 +59,20 @@ class NumericScore extends Extension { if($score != 0) send_event(new NumericScoreSetEvent($event->image_id, $user, $score)); } - if(is_a($event, 'NumericScoreSetEvent')) { + if($event instanceof NumericScoreSetEvent) { $this->add_vote($event->image_id, $event->user->id, $event->score); } - if(is_a($event, 'ImageDeletionEvent')) { + if($event instanceof ImageDeletionEvent) { global $database; $database->execute("DELETE FROM numeric_score_votes WHERE image_id=?", array($event->image->id)); } - if(is_a($event, 'ParseLinkTemplateEvent')) { + if($event instanceof ParseLinkTemplateEvent) { $event->replace('$score', $event->image->numeric_score); } - if(is_a($event, 'SearchTermParseEvent')) { + if($event instanceof SearchTermParseEvent) { $matches = array(); if(preg_match("/score(<|<=|=|>=|>)(\d+)/", $event->term, $matches)) { $cmp = $matches[1]; diff --git a/contrib/piclens/main.php b/contrib/piclens/main.php index 2d1fcf21..17b67e26 100644 --- a/contrib/piclens/main.php +++ b/contrib/piclens/main.php @@ -7,10 +7,10 @@ */ class PicLens extends Extension { public function receive_event($event) { - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { $event->page->add_header(""); } - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { $foo=' Start Slideshow page_name == "random_image")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "random_image")) { global $database; if($event->count_args() == 1) { diff --git a/contrib/rating/main.php b/contrib/rating/main.php index e8623af4..b2c10e69 100644 --- a/contrib/rating/main.php +++ b/contrib/rating/main.php @@ -22,7 +22,7 @@ class Ratings extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("rating", "RatingsTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; if($config->get_int("ext_ratings2_version") < 2) { $this->install(); @@ -33,25 +33,25 @@ class Ratings extends Extension { $config->set_default_string("ext_rating_user_privs", 'sq'); } - if(is_a($event, 'RatingSetEvent')) { + if($event instanceof RatingSetEvent) { $this->set_rating($event->image_id, $event->rating); } - if(is_a($event, 'ImageInfoBoxBuildingEvent')) { + if($event instanceof ImageInfoBoxBuildingEvent) { global $user; if($user->is_admin()) { $event->add_part($this->theme->get_rater_html($event->image->id, $event->image->rating), 80); } } - if(is_a($event, 'ImageInfoSetEvent')) { + if($event instanceof ImageInfoSetEvent) { global $user; if($user->is_admin()) { send_event(new RatingSetEvent($event->image_id, $user, $_POST['rating'])); } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $privs = array(); $privs['Safe Only'] = 's'; $privs['Safe and Questionable'] = 'sq'; @@ -63,11 +63,11 @@ class Ratings extends Extension { $event->panel->add_block($sb); } - if(is_a($event, 'ParseLinkTemplateEvent')) { + if($event instanceof ParseLinkTemplateEvent) { $event->replace('$rating', $this->theme->rating_to_name($event->image->rating)); } - if(is_a($event, 'SearchTermParseEvent')) { + if($event instanceof SearchTermParseEvent) { $matches = array(); if(preg_match("/rating=([sqe]+)/", $event->term, $matches)) { $sqes = $matches[1]; diff --git a/contrib/regen_thumb/main.php b/contrib/regen_thumb/main.php index 28bb22d3..f6f3e12a 100644 --- a/contrib/regen_thumb/main.php +++ b/contrib/regen_thumb/main.php @@ -12,7 +12,7 @@ class RegenThumb extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("regen_thumb", "RegenThumbTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "regen_thumb")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "regen_thumb")) { global $user; if($user->is_admin() && isset($_POST['image_id'])) { global $database; @@ -22,7 +22,7 @@ class RegenThumb extends Extension { } } - if(is_a($event, 'ImageAdminBlockBuildingEvent')) { + if($event instanceof ImageAdminBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_part($this->theme->get_buttons_html($event->image->id)); } diff --git a/contrib/report_image/main.php b/contrib/report_image/main.php index 4f710867..cdb44c00 100755 --- a/contrib/report_image/main.php +++ b/contrib/report_image/main.php @@ -35,7 +35,7 @@ class ReportImage extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("report_image", "ReportImageTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_bool('report_image_show_thumbs', true); @@ -45,7 +45,7 @@ class ReportImage extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "image_report")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "image_report")) { global $user; if($event->get_arg(0) == "add") { if(isset($_POST['image_id']) && isset($_POST['reason'])) { @@ -71,7 +71,7 @@ class ReportImage extends Extension { } } - if(is_a($event, 'AddReportedImageEvent')) { + if($event instanceof AddReportedImageEvent) { global $database; $database->Execute( "INSERT INTO image_reports(image_id, reporter_id, reason) @@ -79,12 +79,12 @@ class ReportImage extends Extension { array($event->image_id, $event->reporter_id, $event->reason)); } - if(is_a($event, 'RemoveReportedImageEvent')) { + if($event instanceof RemoveReportedImageEvent) { global $database; $database->Execute("DELETE FROM image_reports WHERE id = ?", array($event->id)); } - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $user; global $config; if($config->get_bool('report_image_anon') || !$user->is_anonymous()) { @@ -92,20 +92,20 @@ class ReportImage extends Extension { } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Report Image Options"); $sb->add_bool_option("report_image_anon", "Allow anonymous image reporting: "); $sb->add_bool_option("report_image_show_thumbs", "
Show thumbnails in admin panel: "); $event->panel->add_block($sb); } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Reported Images", make_link("image_report/list")); } } - if(is_a($event, 'ImageDeletionEvent')) { + if($event instanceof ImageDeletionEvent) { global $database; $database->Execute("DELETE FROM image_reports WHERE image_id = ?", array($event->image->id)); } diff --git a/contrib/res_limit/main.php b/contrib/res_limit/main.php index 26479966..0eb0e380 100644 --- a/contrib/res_limit/main.php +++ b/contrib/res_limit/main.php @@ -7,7 +7,7 @@ */ class ResolutionLimit extends Extension { public function receive_event($event) { - if(is_a($event, 'ImageAdditionEvent')) { + if($event instanceof ImageAdditionEvent) { global $config; $min_w = $config->get_int("upload_min_width", -1); $min_h = $config->get_int("upload_min_height", -1); @@ -40,7 +40,7 @@ class ResolutionLimit extends Extension { } } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Resolution Limits"); $sb->add_label("Min "); diff --git a/contrib/rss_comments/main.php b/contrib/rss_comments/main.php index 969a74bc..71917534 100644 --- a/contrib/rss_comments/main.php +++ b/contrib/rss_comments/main.php @@ -9,7 +9,7 @@ class RSS_Comments extends Extension { // event handling {{{ public function receive_event($event) { - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $page; global $config; $title = $config->get_string('title'); @@ -17,7 +17,7 @@ class RSS_Comments extends Extension { $page->add_header(""); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "rss")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "rss")) { if($event->get_arg(0) == 'comments') { global $database; $this->do_rss($database); diff --git a/contrib/rss_images/main.php b/contrib/rss_images/main.php index 2aa98c49..ae39759b 100644 --- a/contrib/rss_images/main.php +++ b/contrib/rss_images/main.php @@ -6,11 +6,10 @@ * Description: Self explanitory */ - class RSS_Images extends Extension { // event handling {{{ public function receive_event($event) { - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $page; global $config; $title = $config->get_string('title'); @@ -25,7 +24,8 @@ class RSS_Images extends Extension { "title=\"$title - Images\" href=\"".make_link("rss/images")."\" />"); } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "rss")) { + + if(($event instanceof PageRequestEvent) && ($event->page_name == "rss")) { if($event->get_arg(0) == 'images') { global $database; if($event->count_args() >= 2) { diff --git a/contrib/site_description/main.php b/contrib/site_description/main.php index a7f9dac5..108dbc14 100644 --- a/contrib/site_description/main.php +++ b/contrib/site_description/main.php @@ -8,14 +8,14 @@ */ class SiteDescription extends Extension { public function receive_event($event) { - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { global $config; if(strlen($config->get_string("site_description")) > 0) { $description = $config->get_string("site_description"); $event->page->add_header(""); } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Site Description"); $sb->add_longtext_option("site_description"); $event->panel->add_block($sb); diff --git a/contrib/svn_update/main.php b/contrib/svn_update/main.php index f381677d..fb82f429 100644 --- a/contrib/svn_update/main.php +++ b/contrib/svn_update/main.php @@ -12,7 +12,7 @@ class SVNUpdate extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("svn_update", "SVNUpdateTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "update")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "update")) { if($event->user->is_admin()) { if($event->get_arg(0) == "view_changes") { $this->theme->display_update_todo($event->page, @@ -31,7 +31,7 @@ class SVNUpdate extends Extension { } } - if(is_a($event, 'AdminBuildingEvent')) { + if($event instanceof AdminBuildingEvent) { global $page; $this->theme->display_form($page); } diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php index 8e4c6c55..b2530fd6 100644 --- a/contrib/tag_history/main.php +++ b/contrib/tag_history/main.php @@ -11,7 +11,7 @@ class Tag_History extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("tag_history", "Tag_HistoryTheme"); - if(is_a($event, 'InitExtEvent')) { + if(($event instanceof InitExtEvent)) { // shimmie is being installed so call install to create the table. global $config; if($config->get_int("ext_tag_history_version") < 3) { @@ -19,7 +19,7 @@ class Tag_History extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_history")) + if(($event instanceof PageRequestEvent) && ($event->page_name == "tag_history")) { if($event->get_arg(0) == "revert") { @@ -39,24 +39,24 @@ class Tag_History extends Extension { $this->theme->display_global_page($event->page, $this->get_global_tag_history()); } } - if(is_a($event, 'DisplayingImageEvent')) + if(($event instanceof DisplayingImageEvent)) { // handle displaying a link on the view page $this->theme->display_history_link($event->page, $event->image->id); } - if(is_a($event, 'ImageDeletionEvent')) + if(($event instanceof ImageDeletionEvent)) { // handle removing of history when an image is deleted $this->delete_all_tag_history($event->image->id); } - if(is_a($event, 'SetupBuildingEvent')) { + if(($event instanceof SetupBuildingEvent)) { $sb = new SetupBlock("Tag History"); $sb->add_label("Limit to "); $sb->add_int_option("history_limit"); $sb->add_label(" entires per image"); $event->panel->add_block($sb); } - if(is_a($event, 'TagSetEvent')) { + if(($event instanceof TagSetEvent)) { $this->add_tag_history($event->image_id, $event->tags); } } diff --git a/contrib/tagger/main.php b/contrib/tagger/main.php index 3981747b..bad7950d 100644 --- a/contrib/tagger/main.php +++ b/contrib/tagger/main.php @@ -13,7 +13,7 @@ class Tagger extends Extension { if(is_null($this->theme)) $this->theme = get_theme_object("tagger", "taggerTheme"); - if(is_a($event,'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $page, $config, $user; if($config->get_bool("tag_edit_anon") @@ -23,7 +23,8 @@ class Tagger extends Extension { $this->theme->build_tagger($page,$event); } } - if(is_a($event,'SetupBuildingEvent')) { + + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Tagger"); $sb->add_bool_option("ext_tagger_enabled","Enable Tagger"); $sb->add_int_option("ext_tagger_search_delay","
Delay queries by "); @@ -35,12 +36,14 @@ class Tagger extends Extension { $event->panel->add_block($sb); } } -} add_event_listener( new tagger()); +} + +add_event_listener(new Tagger()); // Tagger AJAX back-end class TaggerXML extends Extension { public function receive_event($event) { - if(is_a($event,'PageRequestEvent') + if(($event instanceof PageRequestEvent) && $event->page_name == "tagger" && $event->get_arg(0) == "tags") { diff --git a/contrib/text_score/main.php b/contrib/text_score/main.php index 97abeee1..d0178f26 100644 --- a/contrib/text_score/main.php +++ b/contrib/text_score/main.php @@ -22,7 +22,7 @@ class TextScore extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("text_score", "TextScoreTheme"); - if(is_a($event, 'InitExtEvent')) { + if(($event instanceof InitExtEvent)) { global $config; if($config->get_int("ext_text_score_version", 0) < 1) { $this->install(); @@ -30,7 +30,7 @@ class TextScore extends Extension { $config->set_default_bool("text_score_anon", true); } - if(is_a($event, 'ImageInfoBoxBuildingEvent')) { + if(($event instanceof ImageInfoBoxBuildingEvent)) { global $user; global $config; if(!$user->is_anonymous() || $config->get_bool("text_score_anon")) { @@ -38,7 +38,7 @@ class TextScore extends Extension { } } - if(is_a($event, 'ImageInfoSetEvent')) { + if($event instanceof ImageInfoSetEvent) { global $user; $i_score = int_escape($_POST['text_score__score']); @@ -47,24 +47,24 @@ class TextScore extends Extension { } } - if(is_a($event, 'TextScoreSetEvent')) { + if(($event instanceof TextScoreSetEvent)) { if(!$event->user->is_anonymous() || $config->get_bool("text_score_anon")) { $this->add_vote($event->image_id, $event->user->id, $event->score); } } - if(is_a($event, 'ImageDeletionEvent')) { + if(($event instanceof ImageDeletionEvent)) { global $database; $database->execute("DELETE FROM text_score_votes WHERE image_id=?", array($event->image->id)); } - if(is_a($event, 'SetupBuildingEvent')) { + if(($event instanceof SetupBuildingEvent)) { $sb = new SetupBlock("Text Score"); $sb->add_bool_option("text_score_anon", "Allow anonymous votes: "); $event->panel->add_block($sb); } - if(is_a($event, 'ParseLinkTemplateEvent')) { + if(($event instanceof ParseLinkTemplateEvent)) { $event->replace('$text_score', $this->theme->score_to_name($event->image->text_score)); } } diff --git a/contrib/wiki/main.php b/contrib/wiki/main.php index 38ce433f..7e27914c 100644 --- a/contrib/wiki/main.php +++ b/contrib/wiki/main.php @@ -57,11 +57,11 @@ class Wiki extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("wiki", "WikiTheme"); - if(is_a($event, 'InitExtEvent')) { + if(($event instanceof InitExtEvent)) { $this->setup(); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "wiki")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "wiki")) { if(is_null($event->get_arg(0)) || strlen(trim($event->get_arg(0))) == 0) { $title = "Index"; } @@ -118,11 +118,11 @@ class Wiki extends Extension { } } - if(is_a($event, 'WikiUpdateEvent')) { + if(($event instanceof WikiUpdateEvent)) { $this->set_page($event->user, $event->wikipage); } - if(is_a($event, 'SetupBuildingEvent')) { + if(($event instanceof SetupBuildingEvent)) { $sb = new SetupBlock("Wiki"); $sb->add_bool_option("wiki_edit_anon", "Allow anonymous edits: "); $sb->add_bool_option("wiki_edit_user", "
Allow user edits: "); diff --git a/contrib/word_filter/main.php b/contrib/word_filter/main.php index b1980f0d..2d04f751 100644 --- a/contrib/word_filter/main.php +++ b/contrib/word_filter/main.php @@ -8,11 +8,11 @@ class WordFilter extends Extension { public function receive_event($event) { - if(is_a($event, 'TextFormattingEvent')) { + if($event instanceof TextFormattingEvent) { $event->formatted = $this->filter($event->formatted); $event->stripped = $this->filter($event->stripped); } - if(is_a($event, 'SetupBuildingEvent')) { + if(($event instanceof SetupBuildingEvent)) { $sb = new SetupBlock("Word Filter"); $sb->add_longtext_option("word_filter"); $sb->add_label("
(each line should be search term and replace term, separated by a comma)"); diff --git a/contrib/zoom/main.php b/contrib/zoom/main.php index 221e7907..72af5554 100644 --- a/contrib/zoom/main.php +++ b/contrib/zoom/main.php @@ -12,12 +12,12 @@ class Zoom extends Extension { public function receive_event($event) { if($this->theme == null) $this->theme = get_theme_object("zoom", "ZoomTheme"); - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $config; $this->theme->display_zoomer($event->page, $event->image, $config->get_bool("image_zoom", false)); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Image Zoom"); $sb->add_bool_option("image_zoom", "Zoom by default: "); $event->panel->add_block($sb); diff --git a/ext/admin/main.php b/ext/admin/main.php index 908e8434..62fc4f18 100644 --- a/ext/admin/main.php +++ b/ext/admin/main.php @@ -17,7 +17,7 @@ class AdminPage extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("admin", "AdminPageTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "admin")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "admin")) { if(!$event->user->is_admin()) { $this->theme->display_error($event->page, "Permission Denied", "This page is for admins only"); } @@ -40,7 +40,7 @@ class AdminPage extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "admin_utils")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "admin_utils")) { if($event->user->is_admin()) { set_time_limit(0); $redirect = false; @@ -70,18 +70,18 @@ class AdminPage extends Extension { } } - if(is_a($event, 'ImageAdminBlockBuildingEvent')) { + if($event instanceof ImageAdminBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_part($this->theme->get_deleter_html($event->image->id)); } } - if(is_a($event, 'AdminBuildingEvent')) { + if($event instanceof AdminBuildingEvent) { $this->theme->display_page($event->page); $this->theme->display_form($event->page); } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Board Admin", make_link("admin")); } diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 0f44fdcd..0b2a8052 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -16,7 +16,7 @@ class AliasEditor extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("alias_editor", "AliasEditorTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "alias")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "alias")) { if($event->get_arg(0) == "add") { if($event->user->is_admin()) { if(isset($_POST['oldtag']) && isset($_POST['newtag'])) { @@ -76,7 +76,7 @@ class AliasEditor extends Extension { } } - if(is_a($event, 'AddAliasEvent')) { + if($event instanceof AddAliasEvent) { global $database; $pair = array($event->oldtag, $event->newtag); if($database->db->GetRow("SELECT * FROM aliases WHERE oldtag=? AND lower(newtag)=lower(?)", $pair)) { @@ -87,7 +87,7 @@ class AliasEditor extends Extension { } } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Alias Editor", make_link("alias/list")); } diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php index b188412f..c28bd7c5 100644 --- a/ext/bbcode/main.php +++ b/ext/bbcode/main.php @@ -2,7 +2,7 @@ class BBCode extends Extension { public function receive_event($event) { - if(is_a($event, 'TextFormattingEvent')) { + if($event instanceof TextFormattingEvent) { $event->formatted = $this->bbcode_to_html($event->formatted); $event->stripped = $this->bbcode_to_text($event->stripped); } diff --git a/ext/comment/main.php b/ext/comment/main.php index 50c76ce6..866d9180 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -54,7 +54,7 @@ class CommentList extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("comment", "CommentListTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_bool('comment_anon', true); $config->set_default_int('comment_window', 5); @@ -66,7 +66,7 @@ class CommentList extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "comment")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "comment")) { if($event->get_arg(0) == "add") { $cpe = new CommentPostingEvent($_POST['image_id'], $event->user, $_POST['comment']); send_event($cpe); @@ -101,7 +101,7 @@ class CommentList extends Extension { } } - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $config; $cc = $config->get_int("comment_count"); if($cc > 0) { @@ -109,7 +109,7 @@ class CommentList extends Extension { } } - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { $this->theme->display_comments( $event->page, $this->get_comments($event->image->id), @@ -117,18 +117,18 @@ class CommentList extends Extension { $event->image->id); } - if(is_a($event, 'ImageDeletionEvent')) { + if($event instanceof ImageDeletionEvent) { $this->delete_comments($event->image->id); } // TODO: split akismet into a separate class, which can veto the event - if(is_a($event, 'CommentPostingEvent')) { + if($event instanceof CommentPostingEvent) { $this->add_comment_wrapper($event->image_id, $event->user, $event->comment, $event); } - if(is_a($event, 'CommentDeletionEvent')) { + if($event instanceof CommentDeletionEvent) { $this->delete_comment($event->comment_id); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Comment Options"); $sb->add_bool_option("comment_anon", "Allow anonymous comments: "); $sb->add_label("
Limit to "); diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index a1bcb076..10444b6a 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -59,7 +59,7 @@ class ExtManager extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("ext_manager", "ExtManagerTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "ext_manager")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "ext_manager")) { if($event->user->is_admin()) { if($event->get_arg(0) == "set") { if(is_writable("ext")) { @@ -78,7 +78,7 @@ class ExtManager extends Extension { } } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Extension Manager", make_link("ext_manager")); } diff --git a/ext/handle_404/main.php b/ext/handle_404/main.php index b4a1894b..3646044f 100644 --- a/ext/handle_404/main.php +++ b/ext/handle_404/main.php @@ -2,7 +2,7 @@ class Handle404 extends Extension { public function receive_event($event) { - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { $page = $event->page; // hax. if($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) { diff --git a/ext/handle_pixel/main.php b/ext/handle_pixel/main.php index 29573d69..00280955 100644 --- a/ext/handle_pixel/main.php +++ b/ext/handle_pixel/main.php @@ -11,7 +11,7 @@ class PixelFileHandler extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("handle_pixel", "PixelFileHandlerTheme"); - if(is_a($event, 'DataUploadEvent') && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { + if(($event instanceof DataUploadEvent) && $this->supported_ext($event->type) && $this->check_contents($event->tmpname)) { $hash = $event->hash; $ha = substr($hash, 0, 2); if(!move_upload_to_archive($event)) return; @@ -30,11 +30,11 @@ class PixelFileHandler extends Extension { } } - if(is_a($event, 'ThumbnailGenerationEvent') && $this->supported_ext($event->type)) { + if(($event instanceof ThumbnailGenerationEvent) && $this->supported_ext($event->type)) { $this->create_thumb($event->hash); } - if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) { + if(($event instanceof DisplayingImageEvent) && $this->supported_ext($event->image->ext)) { $this->theme->display_image($event->page, $event->image); } } diff --git a/ext/image/main.php b/ext/image/main.php index f99cc833..7712025e 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -6,7 +6,7 @@ class ImageIO extends Extension { // event handling {{{ public function receive_event($event) { - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_int('thumb_width', 192); $config->set_default_int('thumb_height', 192); @@ -19,7 +19,7 @@ class ImageIO extends Extension { $config->set_default_string('upload_collision_handler', 'error'); } - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { $num = $event->get_arg(0); $matches = array(); if(!is_null($num) && preg_match("/(\d+)/", $num, $matches)) { @@ -34,16 +34,16 @@ class ImageIO extends Extension { } } - if(is_a($event, 'ImageAdditionEvent')) { + if($event instanceof ImageAdditionEvent) { $error = $this->add_image($event->image); if(!empty($error)) $event->veto($error); } - if(is_a($event, 'ImageDeletionEvent')) { + if($event instanceof ImageDeletionEvent) { $this->remove_image($event->image); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Image Options"); $sb->position = 30; $sb->add_text_option("image_ilink", "Image link: "); diff --git a/ext/index/main.php b/ext/index/main.php index db483903..e21fc83d 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -16,14 +16,14 @@ class Index extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("index", "IndexTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_int("index_width", 3); $config->set_default_int("index_height", 4); $config->set_default_bool("index_tips", true); } - if(is_a($event, 'PageRequestEvent') && (($event->page_name == "index") || + if(($event instanceof PageRequestEvent) && (($event->page_name == "index") || ($event->page_name == "post" && $event->get_arg(0) == "list"))) { if($event->page_name == "post") array_shift($event->args); @@ -67,7 +67,7 @@ class Index extends Extension { $this->theme->display_page($event->page, $images); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Index Options"); $sb->position = 20; @@ -80,7 +80,7 @@ class Index extends Extension { $event->panel->add_block($sb); } - if(is_a($event, 'SearchTermParseEvent')) { + if($event instanceof SearchTermParseEvent) { $matches = array(); if(preg_match("/size(<|>|<=|>=|=)(\d+)x(\d+)/", $event->term, $matches)) { $cmp = $matches[1]; diff --git a/ext/load_ext_data/main.php b/ext/load_ext_data/main.php index e0b216de..dd707d4c 100644 --- a/ext/load_ext_data/main.php +++ b/ext/load_ext_data/main.php @@ -1,7 +1,7 @@ theme)) $this->theme = get_theme_object("setup", "SetupTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_string("title", "Shimmie"); $config->set_default_string("front_page", "post/list"); @@ -137,7 +137,7 @@ class Setup extends Extension { $config->set_default_string("theme", "default"); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "setup")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "setup")) { global $user; if(!$user->is_admin()) { $this->theme->display_error($event->page, "Permission Denied", "This page is for admins only"); @@ -164,7 +164,7 @@ class Setup extends Extension { } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $themes = array(); foreach(glob("themes/*") as $theme_dirname) { $name = str_replace("themes/", "", $theme_dirname); @@ -181,7 +181,8 @@ class Setup extends Extension { $sb->add_choice_option("theme", $themes, "
Theme: "); $event->panel->add_block($sb); } - if(is_a($event, 'ConfigSaveEvent')) { + + if($event instanceof ConfigSaveEvent) { foreach($_POST as $_name => $junk) { if(substr($_name, 0, 6) == "_type_") { $name = substr($_name, 6); @@ -196,7 +197,7 @@ class Setup extends Extension { } } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { if($event->user->is_admin()) { $event->add_link("Board Config", make_link("setup")); } diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 71e619a1..5714b850 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -6,7 +6,7 @@ class TagEdit extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("tag_edit", "TagEditTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tag_edit")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "tag_edit")) { global $page; if($event->get_arg(0) == "replace") { global $user; @@ -27,7 +27,7 @@ class TagEdit extends Extension { } } - if(is_a($event, 'ImageInfoSetEvent')) { + if($event instanceof ImageInfoSetEvent) { if($this->can_tag()) { global $database; send_event(new TagSetEvent($event->image_id, $_POST['tag_edit__tags'])); @@ -40,36 +40,36 @@ class TagEdit extends Extension { } } - if(is_a($event, 'TagSetEvent')) { + if($event instanceof TagSetEvent) { global $database; $database->set_tags($event->image_id, $event->tags); } - if(is_a($event, 'SourceSetEvent')) { + if($event instanceof SourceSetEvent) { global $database; $database->set_source($event->image_id, $event->source); } - if(is_a($event, 'ImageDeletionEvent')) { + if($event instanceof ImageDeletionEvent) { global $database; $database->delete_tags_from_image($event->image->id); } - if(is_a($event, 'AdminBuildingEvent')) { + if($event instanceof AdminBuildingEvent) { $this->theme->display_mass_editor($event->page); } // When an alias is added, oldtag becomes inaccessable - if(is_a($event, 'AddAliasEvent')) { + if($event instanceof AddAliasEvent) { $this->mass_tag_edit($event->oldtag, $event->newtag); } - if(is_a($event, 'ImageInfoBoxBuildingEvent')) { + if($event instanceof ImageInfoBoxBuildingEvent) { global $user; $event->add_part($this->theme->get_editor_html($event->image, $user), 40); } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Tag Editing"); $sb->add_bool_option("tag_edit_anon", "Allow anonymous tag editing: "); $sb->add_bool_option("source_edit_anon", "
Allow anonymous source editing: "); diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 5f2b6a55..2bf65eb9 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -7,7 +7,7 @@ class TagList extends Extension { public function receive_event($event) { if($this->theme == null) $this->theme = get_theme_object("tag_list", "TagListTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_int("tag_list_length", 15); $config->set_default_int("tags_min", 3); @@ -15,7 +15,7 @@ class TagList extends Extension { $config->set_default_string("tag_list_image_type", 'related'); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "tags")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "tags")) { global $page; $this->theme->set_navigation($this->build_navigation()); @@ -37,7 +37,7 @@ class TagList extends Extension { $this->theme->display_page($page); } - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $config; if($config->get_int('tag_list_length') > 0) { if(!empty($event->search_terms)) { @@ -49,7 +49,7 @@ class TagList extends Extension { } } - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $config; if($config->get_int('tag_list_length') > 0) { if($config->get_string('tag_list_image_type') == 'related') { @@ -61,7 +61,7 @@ class TagList extends Extension { } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Tag Map Options"); $sb->add_int_option("tags_min", "Only show tags used at least "); $sb->add_label(" times"); $event->panel->add_block($sb); diff --git a/ext/upgrade/main.php b/ext/upgrade/main.php index 3ffdce51..91d09033 100644 --- a/ext/upgrade/main.php +++ b/ext/upgrade/main.php @@ -2,7 +2,7 @@ class Upgrade extends Extension { public function receive_event($event) { - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { $this->do_things(); } } diff --git a/ext/upload/main.php b/ext/upload/main.php index 08a0f03a..cdbde216 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -8,14 +8,14 @@ class Upload extends Extension { $is_full = (disk_free_space("./images/") < 100*1024*1024); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_int('upload_count', 3); $config->set_default_int('upload_size', '256KB'); $config->set_default_bool('upload_anon', false); } - if(is_a($event, 'PostListBuildingEvent')) { + if($event instanceof PostListBuildingEvent) { global $user; if($this->can_upload($user)) { if($is_full) { @@ -27,7 +27,7 @@ class Upload extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "upload")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "upload")) { if(count($_FILES) + count($_POST) > 0) { $tags = tag_explode($_POST['tags']); $source = isset($_POST['source']) ? $_POST['source'] : null; @@ -71,7 +71,7 @@ class Upload extends Extension { } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("Upload"); $sb->position = 10; $sb->add_int_option("upload_count", "Max uploads: "); @@ -86,7 +86,7 @@ class Upload extends Extension { $event->panel->add_block($sb); } - if(is_a($event, "DataUploadEvent")) { + if($event instanceof DataUploadEvent) { global $config; if($is_full) { $event->veto("Upload failed; disk nearly full"); diff --git a/ext/user/main.php b/ext/user/main.php index 21a2796c..d40179da 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -43,13 +43,13 @@ class UserPage extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("user", "UserPageTheme"); - if(is_a($event, 'InitExtEvent')) { + if($event instanceof InitExtEvent) { global $config; $config->set_default_bool("login_signup_enabled", true); $config->set_default_int("login_memory", 365); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user_admin")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "user_admin")) { global $user; global $database; global $config; @@ -97,7 +97,7 @@ class UserPage extends Extension { $this->set_more_wrapper($event->page); } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "user")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "user")) { global $user; global $database; $duser = ($event->count_args() == 0) ? $user : $database->get_user_by_name($event->get_arg(0)); @@ -111,7 +111,7 @@ class UserPage extends Extension { } } - if(is_a($event, 'UserPageBuildingEvent')) { + if($event instanceof UserPageBuildingEvent) { global $user; global $config; $this->theme->display_user_page($event->page, $event->user, $user); @@ -127,7 +127,7 @@ class UserPage extends Extension { } // user info is shown on all pages - if(is_a($event, 'PageRequestEvent')) { + if($event instanceof PageRequestEvent) { global $user; global $page; @@ -142,23 +142,23 @@ class UserPage extends Extension { } } - if(is_a($event, 'SetupBuildingEvent')) { + if($event instanceof SetupBuildingEvent) { $sb = new SetupBlock("User Options"); $sb->add_bool_option("login_signup_enabled", "Allow new signups: "); $sb->add_longtext_option("login_tac", "
Terms & Conditions:
"); $event->panel->add_block($sb); } - if(is_a($event, 'UserBlockBuildingEvent')) { + if($event instanceof UserBlockBuildingEvent) { $event->add_link("User Config", make_link("user")); $event->add_link("Log Out", make_link("user_admin/logout"), 99); } - if(is_a($event, 'UserCreationEvent')) { + if($event instanceof UserCreationEvent) { if($this->check_user_creation($event)) $this->create_user($event); } - if(is_a($event, 'SearchTermParseEvent')) { + if($event instanceof SearchTermParseEvent) { $matches = array(); if(preg_match("/(poster|user)=(.*)/i", $event->term, $matches)) { global $database; diff --git a/ext/view/main.php b/ext/view/main.php index 4dfa6ccc..8f4baaee 100644 --- a/ext/view/main.php +++ b/ext/view/main.php @@ -45,7 +45,7 @@ class ViewImage extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("view", "ViewTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "post") && ($event->get_arg(0) == "view")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "post") && ($event->get_arg(0) == "view")) { $image_id = int_escape($event->get_arg(1)); global $database; @@ -63,7 +63,7 @@ class ViewImage extends Extension { } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "post") && ($event->get_arg(0) == "set")) { + if(($event instanceof PageRequestEvent) && ($event->page_name == "post") && ($event->get_arg(0) == "set")) { $image_id = int_escape($_POST['image_id']); send_event(new ImageInfoSetEvent($image_id)); @@ -73,7 +73,7 @@ class ViewImage extends Extension { $event->page->set_redirect(make_link("post/view/$image_id", $query)); } - if(is_a($event, 'DisplayingImageEvent')) { + if($event instanceof DisplayingImageEvent) { global $user; $iibbe = new ImageInfoBoxBuildingEvent($event->get_image(), $user); send_event($iibbe);