type hints for hiphop

This commit is contained in:
Shish 2012-02-02 08:07:57 +00:00
parent ec0fab54d8
commit dc6c173efd
9 changed files with 49 additions and 49 deletions

View File

@ -61,7 +61,7 @@ class Comment {
} }
class CommentList extends SimpleExtension { class CommentList extends SimpleExtension {
public function onInitExt($event) { public function onInitExt(InitExtEvent $event) {
global $config, $database; global $config, $database;
$config->set_default_bool('comment_anon', true); $config->set_default_bool('comment_anon', true);
$config->set_default_int('comment_window', 5); $config->set_default_int('comment_window', 5);

View File

@ -130,7 +130,7 @@ class ParseLinkTemplateEvent extends Event {
* A class to handle adding / getting / removing image files from the disk. * A class to handle adding / getting / removing image files from the disk.
*/ */
class ImageIO extends SimpleExtension { class ImageIO extends SimpleExtension {
public function onInitExt($event) { public function onInitExt(InitExtEvent $event) {
global $config; global $config;
$config->set_default_int('thumb_width', 192); $config->set_default_int('thumb_width', 192);
$config->set_default_int('thumb_height', 192); $config->set_default_int('thumb_height', 192);
@ -147,7 +147,7 @@ class ImageIO extends SimpleExtension {
$config->set_default_int('image_expires', (60*60*24*365) ); // defaults to one year $config->set_default_int('image_expires', (60*60*24*365) ); // defaults to one year
} }
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
$num = $event->get_arg(0); $num = $event->get_arg(0);
$matches = array(); $matches = array();
if(!is_null($num) && preg_match("/(\d+)/", $num, $matches)) { if(!is_null($num) && preg_match("/(\d+)/", $num, $matches)) {
@ -186,7 +186,7 @@ class ImageIO extends SimpleExtension {
} }
} }
public function onImageAdminBlockBuilding($event) { public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) {
global $user; global $user;
global $config; global $config;
@ -199,7 +199,7 @@ class ImageIO extends SimpleExtension {
} }
} }
public function onImageAddition($event) { public function onImageAddition(ImageAdditionEvent $event) {
try { try {
$this->add_image($event->image); $this->add_image($event->image);
} }
@ -208,11 +208,11 @@ class ImageIO extends SimpleExtension {
} }
} }
public function onImageDeletion($event) { public function onImageDeletion(ImageDeletionEvent $event) {
$event->image->delete(); $event->image->delete();
} }
public function onImageReplace($event) { public function onImageReplace(ImageReplaceEvent $event) {
try { try {
$this->replace_image($event->id, $event->image); $this->replace_image($event->id, $event->image);
} }
@ -221,7 +221,7 @@ class ImageIO extends SimpleExtension {
} }
} }
public function onUserPageBuilding($event) { public function onUserPageBuilding(UserPageBuildingEvent $event) {
global $user; global $user;
global $config; global $config;
@ -233,7 +233,7 @@ class ImageIO extends SimpleExtension {
$event->add_stats("<a href='$images_link'>Images uploaded</a>: $i_image_count, $h_image_rate per day"); $event->add_stats("<a href='$images_link'>Images uploaded</a>: $i_image_count, $h_image_rate per day");
} }
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = new SetupBlock("Image Options"); $sb = new SetupBlock("Image Options");
$sb->position = 30; $sb->position = 30;
// advanced only // advanced only

View File

@ -129,14 +129,14 @@ class PostListBuildingEvent extends Event {
} }
class Index extends SimpleExtension { class Index extends SimpleExtension {
public function onInitExt($event) { public function onInitExt(InitExtEvent $event) {
global $config; global $config;
$config->set_default_int("index_width", 3); $config->set_default_int("index_width", 3);
$config->set_default_int("index_height", 4); $config->set_default_int("index_height", 4);
$config->set_default_bool("index_tips", true); $config->set_default_bool("index_tips", true);
} }
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
global $config, $database, $page, $user; global $config, $database, $page, $user;
if($event->page_matches("post/list")) { if($event->page_matches("post/list")) {
if(isset($_GET['search'])) { if(isset($_GET['search'])) {
@ -182,7 +182,7 @@ class Index extends SimpleExtension {
} }
} }
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = new SetupBlock("Index Options"); $sb = new SetupBlock("Index Options");
$sb->position = 20; $sb->position = 20;
@ -195,7 +195,7 @@ class Index extends SimpleExtension {
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
public function onSearchTermParse($event) { public function onSearchTermParse(SearchTermParseEvent $event) {
$matches = array(); $matches = array();
// check for tags first as tag based searches are more common. // check for tags first as tag based searches are more common.
if(preg_match("/tags(<|>|<=|>=|=)(\d+)/", $event->term, $matches)) { if(preg_match("/tags(<|>|<=|>=|=)(\d+)/", $event->term, $matches)) {

View File

@ -8,7 +8,7 @@
*/ */
class Mail extends SimpleExtension { class Mail extends SimpleExtension {
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = new SetupBlock("Mailing Options"); $sb = new SetupBlock("Mailing Options");
$sb->add_text_option("mail_sub", "<br>Subject prefix: "); $sb->add_text_option("mail_sub", "<br>Subject prefix: ");
$sb->add_text_option("mail_img", "<br>Banner Image URL: "); $sb->add_text_option("mail_img", "<br>Banner Image URL: ");
@ -18,7 +18,7 @@ class Mail extends SimpleExtension {
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
public function onInitExt($event) { public function onInitExt(InitExtEvent $event) {
global $config; global $config;
$config->set_default_string("mail_sub", $config->get_string("site_title")." - "); $config->set_default_string("mail_sub", $config->get_string("site_title")." - ");
$config->set_default_string("mail_img", make_http("ext/mail/banner.png")); $config->set_default_string("mail_img", make_http("ext/mail/banner.png"));
@ -27,7 +27,7 @@ class Mail extends SimpleExtension {
} }
} }
class MailTest extends SimpleExtension { class MailTest extends SimpleExtension {
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
if($event->page_matches("mail/test")) { if($event->page_matches("mail/test")) {
global $page; global $page;
$page->set_mode("data"); $page->set_mode("data");
@ -42,4 +42,4 @@ class MailTest extends SimpleExtension {
} }
} }
} }
?> ?>

View File

@ -162,7 +162,7 @@ class SetupBlock extends Block {
// }}} // }}}
class Setup extends SimpleExtension { class Setup extends SimpleExtension {
public function onInitExt($event) { public function onInitExt(SetupEvent $event) {
global $config; global $config;
$config->set_default_string("title", "Shimmie"); $config->set_default_string("title", "Shimmie");
$config->set_default_string("front_page", "post/list"); $config->set_default_string("front_page", "post/list");
@ -178,7 +178,7 @@ class Setup extends SimpleExtension {
$config->set_default_bool("autocache_min_js", false); $config->set_default_bool("autocache_min_js", false);
} }
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
global $config, $page, $user; global $config, $page, $user;
if($event->page_matches("nicetest")) { if($event->page_matches("nicetest")) {
@ -210,7 +210,7 @@ class Setup extends SimpleExtension {
} }
} }
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$themes = array(); $themes = array();
foreach(glob("themes/*") as $theme_dirname) { foreach(glob("themes/*") as $theme_dirname) {
$name = str_replace("themes/", "", $theme_dirname); $name = str_replace("themes/", "", $theme_dirname);
@ -309,7 +309,7 @@ class Setup extends SimpleExtension {
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
public function onConfigSave($event) { public function onConfigSave(ConfigSaveEvent $event) {
global $config; global $config;
foreach($_POST as $_name => $junk) { foreach($_POST as $_name => $junk) {
if(substr($_name, 0, 6) == "_type_") { if(substr($_name, 0, 6) == "_type_") {
@ -327,7 +327,7 @@ class Setup extends SimpleExtension {
log_warning("setup", "Configuration updated"); log_warning("setup", "Configuration updated");
} }
public function onUserBlockBuilding($event) { public function onUserBlockBuilding(UserBlockBuildingEvent $event) {
global $user; global $user;
if($user->is_admin()) { if($user->is_admin()) {
$event->add_link("Board Config", make_link("setup")); $event->add_link("Board Config", make_link("setup"));

View File

@ -56,7 +56,7 @@ class LockSetEvent extends Event {
} }
class TagEdit extends SimpleExtension { class TagEdit extends SimpleExtension {
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
global $user, $page; global $user, $page;
if($event->page_matches("tag_edit")) { if($event->page_matches("tag_edit")) {
if($event->get_arg(0) == "replace") { if($event->get_arg(0) == "replace") {
@ -71,7 +71,7 @@ class TagEdit extends SimpleExtension {
} }
} }
public function onImageInfoSet($event) { public function onImageInfoSet(ImageInfoSetEvent $event) {
global $user, $page; global $user, $page;
if($this->can_tag($event->image)) { if($this->can_tag($event->image)) {
send_event(new TagSetEvent($event->image, $_POST['tag_edit__tags'])); send_event(new TagSetEvent($event->image, $_POST['tag_edit__tags']));
@ -88,41 +88,41 @@ class TagEdit extends SimpleExtension {
} }
} }
public function onTagSet($event) { public function onTagSet(TagSetEvent $event) {
global $user; global $user;
if($user->is_admin() || !$event->image->is_locked()) { if($user->is_admin() || !$event->image->is_locked()) {
$event->image->set_tags($event->tags); $event->image->set_tags($event->tags);
} }
} }
public function onSourceSet($event) { public function onSourceSet(SourceSetEvent $event) {
global $user; global $user;
if($user->is_admin() || !$event->image->is_locked()) { if($user->is_admin() || !$event->image->is_locked()) {
$event->image->set_source($event->source); $event->image->set_source($event->source);
} }
} }
public function onLockSet($event) { public function onLockSet(LockSetEvent $event) {
global $user; global $user;
if($user->is_admin()) { if($user->is_admin()) {
$event->image->set_locked($event->locked); $event->image->set_locked($event->locked);
} }
} }
public function onImageDeletion($event) { public function onImageDeletion(ImageDeletionEvent $event) {
$event->image->delete_tags_from_image(); $event->image->delete_tags_from_image();
} }
public function onAdminBuilding($event) { public function onAdminBuilding(AdminBuildingEvent $event) {
$this->theme->display_mass_editor(); $this->theme->display_mass_editor();
} }
// When an alias is added, oldtag becomes inaccessable // When an alias is added, oldtag becomes inaccessable
public function onAddAlias($event) { public function onAddAlias(AddAliasEvent $event) {
$this->mass_tag_edit($event->oldtag, $event->newtag); $this->mass_tag_edit($event->oldtag, $event->newtag);
} }
public function onImageInfoBoxBuilding($event) { public function onImageInfoBoxBuilding(ImageInfoBoxBuildingEvent $event) {
global $user; global $user;
if($this->can_tag($event->image)) { if($this->can_tag($event->image)) {
$event->add_part($this->theme->get_tag_editor_html($event->image), 40); $event->add_part($this->theme->get_tag_editor_html($event->image), 40);
@ -135,7 +135,7 @@ class TagEdit extends SimpleExtension {
} }
} }
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = new SetupBlock("Tag Editing"); $sb = new SetupBlock("Tag Editing");
$sb->add_bool_option("tag_edit_anon", "Allow anonymous tag editing: "); $sb->add_bool_option("tag_edit_anon", "Allow anonymous tag editing: ");
$sb->add_bool_option("source_edit_anon", "<br>Allow anonymous source editing: "); $sb->add_bool_option("source_edit_anon", "<br>Allow anonymous source editing: ");

View File

@ -6,7 +6,7 @@
*/ */
class TagList extends SimpleExtension { class TagList extends SimpleExtension {
public function onInitExt($event) { public function onInitExt(InitExtEvent $event) {
global $config; global $config;
$config->set_default_int("tag_list_length", 15); $config->set_default_int("tag_list_length", 15);
$config->set_default_int("popular_tag_list_length", 15); $config->set_default_int("popular_tag_list_length", 15);
@ -16,7 +16,7 @@ class TagList extends SimpleExtension {
$config->set_default_bool("tag_list_pages", false); $config->set_default_bool("tag_list_pages", false);
} }
public function onPageRequest($event) { public function onPageRequest(PageRequestEvent $event) {
global $page, $database; global $page, $database;
if($event->page_matches("tags")) { if($event->page_matches("tags")) {
@ -59,7 +59,7 @@ class TagList extends SimpleExtension {
} }
} }
public function onPostListBuilding($event) { public function onPostListBuilding(PostListBuildingEvent $event) {
global $config, $page; global $config, $page;
if($config->get_int('tag_list_length') > 0) { if($config->get_int('tag_list_length') > 0) {
if(!empty($event->search_terms)) { if(!empty($event->search_terms)) {
@ -71,7 +71,7 @@ class TagList extends SimpleExtension {
} }
} }
public function onDisplayingImage($event) { public function onDisplayingImage(DisplayingImageEvent $event) {
global $config, $page; global $config, $page;
if($config->get_int('tag_list_length') > 0) { if($config->get_int('tag_list_length') > 0) {
if($config->get_string('tag_list_image_type') == 'related') { if($config->get_string('tag_list_image_type') == 'related') {
@ -83,7 +83,7 @@ class TagList extends SimpleExtension {
} }
} }
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$sb = new SetupBlock("Tag Map Options"); $sb = new SetupBlock("Tag Map Options");
$sb->add_int_option("tags_min", "Only show tags used at least "); $sb->add_label(" times"); $sb->add_int_option("tags_min", "Only show tags used at least "); $sb->add_label(" times");
$sb->add_bool_option("tag_list_pages", "<br>Paged tag lists: "); $sb->add_bool_option("tag_list_pages", "<br>Paged tag lists: ");

View File

@ -45,7 +45,7 @@ class Upload extends SimpleExtension {
// early, so it can stop the DataUploadEvent before any data handlers see it // early, so it can stop the DataUploadEvent before any data handlers see it
public function get_priority() {return 40;} public function get_priority() {return 40;}
public function onInitExt($event) { public function onInitExt(InitExtEvent $event) {
global $config; global $config;
$config->set_default_int('upload_count', 3); $config->set_default_int('upload_count', 3);
$config->set_default_int('upload_size', '1MB'); $config->set_default_int('upload_size', '1MB');
@ -63,7 +63,7 @@ class Upload extends SimpleExtension {
} }
public function onPostListBuilding($event) { public function onPostListBuilding(PostListBuildingEvent $event) {
global $user, $page; global $user, $page;
if($this->can_upload($user)) { if($this->can_upload($user)) {
if($this->is_full) { if($this->is_full) {
@ -75,7 +75,7 @@ class Upload extends SimpleExtension {
} }
} }
public function onSetupBuilding($event) { public function onSetupBuilding(SetupBuildingEvent $event) {
$tes = array(); $tes = array();
$tes["Disabled"] = "none"; $tes["Disabled"] = "none";
if(function_exists("curl_init")) { if(function_exists("curl_init")) {
@ -97,7 +97,7 @@ class Upload extends SimpleExtension {
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
public function onDataUpload($event) { public function onDataUpload(DataUploadEvent $event) {
global $config; global $config;
if($this->is_full) { if($this->is_full) {
throw new UploadException("Upload failed; disk nearly full"); throw new UploadException("Upload failed; disk nearly full");

View File

@ -43,7 +43,7 @@ class UserCreationEvent extends Event {
class UserCreationException extends SCoreException {} class UserCreationException extends SCoreException {}
class UserPage extends SimpleExtension { class UserPage extends SimpleExtension {
public function onInitExt(Event $event) { public function onInitExt(InitExtEvent $event) {
global $config; global $config;
$config->set_default_bool("login_signup_enabled", true); $config->set_default_bool("login_signup_enabled", true);
$config->set_default_int("login_memory", 365); $config->set_default_int("login_memory", 365);
@ -54,7 +54,7 @@ class UserPage extends SimpleExtension {
$config->set_default_bool("login_tac_bbcode", true); $config->set_default_bool("login_tac_bbcode", true);
} }
public function onPageRequest(Event $event) { public function onPageRequest(PageRequestEvent $event) {
global $config, $database, $page, $user; global $config, $database, $page, $user;
// user info is shown on all pages // user info is shown on all pages
@ -152,7 +152,7 @@ class UserPage extends SimpleExtension {
} }
} }
if(($event instanceof PageRequestEvent) && $event->page_matches("user")) { if($event->page_matches("user")) {
$display_user = ($event->count_args() == 0) ? $user : User::by_name($event->get_arg(0)); $display_user = ($event->count_args() == 0) ? $user : User::by_name($event->get_arg(0));
if($event->count_args() == 0 && $user->is_anonymous()) { if($event->count_args() == 0 && $user->is_anonymous()) {
$this->theme->display_error($page, "Not Logged In", $this->theme->display_error($page, "Not Logged In",
@ -169,7 +169,7 @@ class UserPage extends SimpleExtension {
} }
} }
public function onUserPageBuilding(Event $event) { public function onUserPageBuilding(UserPageBuildingEvent $event) {
global $page, $user, $config; global $page, $user, $config;
$h_join_date = autodate($event->display_user->join_date); $h_join_date = autodate($event->display_user->join_date);
@ -197,7 +197,7 @@ class UserPage extends SimpleExtension {
} }
} }
public function onSetupBuilding(Event $event) { public function onSetupBuilding(SetupBuildingEvent $event) {
global $config; global $config;
$hosts = array( $hosts = array(
@ -228,17 +228,17 @@ class UserPage extends SimpleExtension {
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
public function onUserBlockBuilding(Event $event) { public function onUserBlockBuilding(UserBlockBuildingEvent $event) {
$event->add_link("My Profile", make_link("user")); $event->add_link("My Profile", make_link("user"));
$event->add_link("Log Out", make_link("user_admin/logout"), 99); $event->add_link("Log Out", make_link("user_admin/logout"), 99);
} }
public function onUserCreation(Event $event) { public function onUserCreation(UserCreationEvent $event) {
$this->check_user_creation($event); $this->check_user_creation($event);
$this->create_user($event); $this->create_user($event);
} }
public function onSearchTermParse(Event $event) { public function onSearchTermParse(SearchTermParseEvent $event) {
global $user; global $user;
$matches = array(); $matches = array();