move extension-specific events into their extensions
This commit is contained in:
		
							parent
							
								
									2f8cf7c08e
								
							
						
					
					
						commit
						bca8221609
					
				@ -19,103 +19,6 @@ abstract class Event {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * ConfigSaveEvent:
 | 
					 | 
				
			||||||
 * Sent when the setup screen's 'set' button has been
 | 
					 | 
				
			||||||
 * activated; new config options are in $_POST
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class ConfigSaveEvent extends Event {
 | 
					 | 
				
			||||||
	var $config;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public function ConfigSaveEvent($config) {
 | 
					 | 
				
			||||||
		$this->config = $config;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * DataUploadEvent:
 | 
					 | 
				
			||||||
 *   $user     -- the user uploading the data
 | 
					 | 
				
			||||||
 *   $tmpname  -- the temporary file used for upload
 | 
					 | 
				
			||||||
 *   $metadata -- info about the file, should contain at least "filename", "extension", "tags" and "source"
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Some data is being uploaded. Should be caught by a file handler.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class DataUploadEvent extends Event {
 | 
					 | 
				
			||||||
	var $user, $tmpname, $metadata, $hash, $type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function DataUploadEvent($user, $tmpname, $metadata) {
 | 
					 | 
				
			||||||
		$this->user = $user;
 | 
					 | 
				
			||||||
		$this->tmpname = $tmpname;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		$this->metadata = $metadata;
 | 
					 | 
				
			||||||
		$this->metadata['hash'] = md5_file($tmpname);
 | 
					 | 
				
			||||||
		$this->metadata['size'] = filesize($tmpname);
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		// useful for most file handlers, so pull directly into fields
 | 
					 | 
				
			||||||
		$this->hash = $this->metadata['hash'];
 | 
					 | 
				
			||||||
		$this->type = strtolower($metadata['extension']);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * DisplayingImageEvent:
 | 
					 | 
				
			||||||
 *   $image -- the image being displayed
 | 
					 | 
				
			||||||
 *   $page  -- the page to display on
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Sent when an image is ready to display. Extensions who
 | 
					 | 
				
			||||||
 * wish to appear on the "view" page should listen for this,
 | 
					 | 
				
			||||||
 * which only appears when an image actually exists.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class DisplayingImageEvent extends Event {
 | 
					 | 
				
			||||||
	var $image, $page;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function DisplayingImageEvent($image, $page) {
 | 
					 | 
				
			||||||
		$this->image = $image;
 | 
					 | 
				
			||||||
		$this->page = $page;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function get_image() {
 | 
					 | 
				
			||||||
		return $this->image;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * ImageAdditionEvent:
 | 
					 | 
				
			||||||
 *   $user  -- the user adding the image
 | 
					 | 
				
			||||||
 *   $image -- the image being added
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * An image is being added to the database
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class ImageAdditionEvent extends Event {
 | 
					 | 
				
			||||||
	var $user, $image;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function ImageAdditionEvent($user, $image) {
 | 
					 | 
				
			||||||
		$this->image = $image;
 | 
					 | 
				
			||||||
		$this->user = $user;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * ImageDeletionEvent:
 | 
					 | 
				
			||||||
 *   $image -- the image being deleted
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * An image is being deleted. Used by things like tags
 | 
					 | 
				
			||||||
 * and comments handlers to clean out related rows in
 | 
					 | 
				
			||||||
 * their tables
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class ImageDeletionEvent extends Event {
 | 
					 | 
				
			||||||
	var $image;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function ImageDeletionEvent($image) {
 | 
					 | 
				
			||||||
		$this->image = $image;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * InitExtEvent:
 | 
					 * InitExtEvent:
 | 
				
			||||||
 * A wake-up call for extensions
 | 
					 * A wake-up call for extensions
 | 
				
			||||||
@ -126,9 +29,10 @@ class InitExtEvent extends Event {}
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * PageRequestEvent:
 | 
					 * PageRequestEvent:
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * TODO: up to date docs
 | 
					 * User requests /view/42 -> an event is generated with $args = array("view",
 | 
				
			||||||
 *
 | 
					 * "42"); when an event handler asks $event->page_matches("view"), it returns
 | 
				
			||||||
 * Used for initial page generation triggers
 | 
					 * true and ignores the matched part, such that $event->count_args() = 1 and
 | 
				
			||||||
 | 
					 * $event->get_arg(0) = "42"
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class PageRequestEvent extends Event {
 | 
					class PageRequestEvent extends Event {
 | 
				
			||||||
	var $args;
 | 
						var $args;
 | 
				
			||||||
@ -177,68 +81,11 @@ class PageRequestEvent extends Event {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * ParseLinkTemplateEvent:
 | 
					 | 
				
			||||||
 *   $link     -- the formatted link
 | 
					 | 
				
			||||||
 *   $original -- the formatting string, for reference
 | 
					 | 
				
			||||||
 *   $image    -- the image who's link is being parsed
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class ParseLinkTemplateEvent extends Event {
 | 
					 | 
				
			||||||
	var $link, $original;
 | 
					 | 
				
			||||||
	var $image;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function ParseLinkTemplateEvent($link, $image) {
 | 
					 | 
				
			||||||
		$this->link = $link;
 | 
					 | 
				
			||||||
		$this->original = $link;
 | 
					 | 
				
			||||||
		$this->image = $image;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function replace($needle, $replace) {
 | 
					 | 
				
			||||||
		$this->link = str_replace($needle, $replace, $this->link);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * SourceSetEvent:
 | 
					 | 
				
			||||||
 *   $image_id
 | 
					 | 
				
			||||||
 *   $source
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class SourceSetEvent extends Event {
 | 
					 | 
				
			||||||
	var $image_id;
 | 
					 | 
				
			||||||
	var $source;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function SourceSetEvent($image_id, $source) {
 | 
					 | 
				
			||||||
		$this->image_id = $image_id;
 | 
					 | 
				
			||||||
		$this->source = $source;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * TagSetEvent:
 | 
					 | 
				
			||||||
 *   $image_id
 | 
					 | 
				
			||||||
 *   $tags
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class TagSetEvent extends Event {
 | 
					 | 
				
			||||||
	var $image_id;
 | 
					 | 
				
			||||||
	var $tags;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function TagSetEvent($image_id, $tags) {
 | 
					 | 
				
			||||||
		$this->image_id = $image_id;
 | 
					 | 
				
			||||||
		$this->tags = tag_explode($tags);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * TextFormattingEvent:
 | 
					 * TextFormattingEvent:
 | 
				
			||||||
 *   $original  - for reference
 | 
					 *   $original  - for reference
 | 
				
			||||||
 *   $formatted - with formatting applied
 | 
					 *   $formatted - with formatting applied
 | 
				
			||||||
 *   $stripped  - with formatting removed
 | 
					 *   $stripped  - with formatting removed
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class TextFormattingEvent extends Event {
 | 
					class TextFormattingEvent extends Event {
 | 
				
			||||||
	var $original;
 | 
						var $original;
 | 
				
			||||||
@ -252,47 +99,4 @@ class TextFormattingEvent extends Event {
 | 
				
			|||||||
		$this->stripped  = $h_text;
 | 
							$this->stripped  = $h_text;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * ThumbnailGenerationEvent:
 | 
					 | 
				
			||||||
 * Request a thumb be made for an image
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class ThumbnailGenerationEvent extends Event {
 | 
					 | 
				
			||||||
	var $hash;
 | 
					 | 
				
			||||||
	var $type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function ThumbnailGenerationEvent($hash, $type) {
 | 
					 | 
				
			||||||
		$this->hash = $hash;
 | 
					 | 
				
			||||||
		$this->type = $type;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * SearchTermParseEvent:
 | 
					 | 
				
			||||||
 * Signal that a search term needs parsing
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
class SearchTermParseEvent extends Event {
 | 
					 | 
				
			||||||
	var $term = null;
 | 
					 | 
				
			||||||
	var $context = null;
 | 
					 | 
				
			||||||
	var $querylets = array();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function SearchTermParseEvent($term, $context) {
 | 
					 | 
				
			||||||
		$this->term = $term;
 | 
					 | 
				
			||||||
		$this->context = $context;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function is_querylet_set() {
 | 
					 | 
				
			||||||
		return (count($this->querylets) > 0);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function get_querylets() {
 | 
					 | 
				
			||||||
		return $this->querylets;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function add_querylet($q) {
 | 
					 | 
				
			||||||
		$this->querylets[] = $q;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,75 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * ImageAdditionEvent:
 | 
				
			||||||
 | 
					 *   $user  -- the user adding the image
 | 
				
			||||||
 | 
					 *   $image -- the image being added
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * An image is being added to the database
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class ImageAdditionEvent extends Event {
 | 
				
			||||||
 | 
						var $user, $image;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function ImageAdditionEvent($user, $image) {
 | 
				
			||||||
 | 
							$this->image = $image;
 | 
				
			||||||
 | 
							$this->user = $user;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * ImageDeletionEvent:
 | 
				
			||||||
 | 
					 *   $image -- the image being deleted
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * An image is being deleted. Used by things like tags
 | 
				
			||||||
 | 
					 * and comments handlers to clean out related rows in
 | 
				
			||||||
 | 
					 * their tables
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class ImageDeletionEvent extends Event {
 | 
				
			||||||
 | 
						var $image;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function ImageDeletionEvent($image) {
 | 
				
			||||||
 | 
							$this->image = $image;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * ThumbnailGenerationEvent:
 | 
				
			||||||
 | 
					 * Request a thumb be made for an image
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class ThumbnailGenerationEvent extends Event {
 | 
				
			||||||
 | 
						var $hash;
 | 
				
			||||||
 | 
						var $type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function ThumbnailGenerationEvent($hash, $type) {
 | 
				
			||||||
 | 
							$this->hash = $hash;
 | 
				
			||||||
 | 
							$this->type = $type;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * ParseLinkTemplateEvent:
 | 
				
			||||||
 | 
					 *   $link     -- the formatted link
 | 
				
			||||||
 | 
					 *   $original -- the formatting string, for reference
 | 
				
			||||||
 | 
					 *   $image    -- the image who's link is being parsed
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class ParseLinkTemplateEvent extends Event {
 | 
				
			||||||
 | 
						var $link, $original;
 | 
				
			||||||
 | 
						var $image;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function ParseLinkTemplateEvent($link, $image) {
 | 
				
			||||||
 | 
							$this->link = $link;
 | 
				
			||||||
 | 
							$this->original = $link;
 | 
				
			||||||
 | 
							$this->image = $image;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function replace($needle, $replace) {
 | 
				
			||||||
 | 
							$this->link = str_replace($needle, $replace, $this->link);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * A class to handle adding / getting / removing image
 | 
					 * A class to handle adding / getting / removing image
 | 
				
			||||||
 * files from the disk
 | 
					 * files from the disk
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,30 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * SearchTermParseEvent:
 | 
				
			||||||
 | 
					 * Signal that a search term needs parsing
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class SearchTermParseEvent extends Event {
 | 
				
			||||||
 | 
						var $term = null;
 | 
				
			||||||
 | 
						var $context = null;
 | 
				
			||||||
 | 
						var $querylets = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function SearchTermParseEvent($term, $context) {
 | 
				
			||||||
 | 
							$this->term = $term;
 | 
				
			||||||
 | 
							$this->context = $context;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function is_querylet_set() {
 | 
				
			||||||
 | 
							return (count($this->querylets) > 0);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function get_querylets() {
 | 
				
			||||||
 | 
							return $this->querylets;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function add_querylet($q) {
 | 
				
			||||||
 | 
							$this->querylets[] = $q;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PostListBuildingEvent extends Event {
 | 
					class PostListBuildingEvent extends Event {
 | 
				
			||||||
	var $page = null;
 | 
						var $page = null;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,18 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* ConfigSaveEvent {{{
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Sent when the setup screen's 'set' button has been
 | 
				
			||||||
 | 
					 * activated; new config options are in $_POST
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class ConfigSaveEvent extends Event {
 | 
				
			||||||
 | 
						var $config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function ConfigSaveEvent($config) {
 | 
				
			||||||
 | 
							$this->config = $config;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					// }}}
 | 
				
			||||||
/* SetupBuildingEvent {{{
 | 
					/* SetupBuildingEvent {{{
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Sent when the setup page is ready to be added to
 | 
					 * Sent when the setup page is ready to be added to
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,36 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * SourceSetEvent:
 | 
				
			||||||
 | 
					 *   $image_id
 | 
				
			||||||
 | 
					 *   $source
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class SourceSetEvent extends Event {
 | 
				
			||||||
 | 
						var $image_id;
 | 
				
			||||||
 | 
						var $source;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function SourceSetEvent($image_id, $source) {
 | 
				
			||||||
 | 
							$this->image_id = $image_id;
 | 
				
			||||||
 | 
							$this->source = $source;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * TagSetEvent:
 | 
				
			||||||
 | 
					 *   $image_id
 | 
				
			||||||
 | 
					 *   $tags
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class TagSetEvent extends Event {
 | 
				
			||||||
 | 
						var $image_id;
 | 
				
			||||||
 | 
						var $tags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function TagSetEvent($image_id, $tags) {
 | 
				
			||||||
 | 
							$this->image_id = $image_id;
 | 
				
			||||||
 | 
							$this->tags = tag_explode($tags);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TagEdit implements Extension {
 | 
					class TagEdit implements Extension {
 | 
				
			||||||
	var $theme;
 | 
						var $theme;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,28 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * DataUploadEvent:
 | 
				
			||||||
 | 
					 *   $user     -- the user uploading the data
 | 
				
			||||||
 | 
					 *   $tmpname  -- the temporary file used for upload
 | 
				
			||||||
 | 
					 *   $metadata -- info about the file, should contain at least "filename", "extension", "tags" and "source"
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Some data is being uploaded. Should be caught by a file handler.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class DataUploadEvent extends Event {
 | 
				
			||||||
 | 
						var $user, $tmpname, $metadata, $hash, $type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function DataUploadEvent($user, $tmpname, $metadata) {
 | 
				
			||||||
 | 
							$this->user = $user;
 | 
				
			||||||
 | 
							$this->tmpname = $tmpname;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$this->metadata = $metadata;
 | 
				
			||||||
 | 
							$this->metadata['hash'] = md5_file($tmpname);
 | 
				
			||||||
 | 
							$this->metadata['size'] = filesize($tmpname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// useful for most file handlers, so pull directly into fields
 | 
				
			||||||
 | 
							$this->hash = $this->metadata['hash'];
 | 
				
			||||||
 | 
							$this->type = strtolower($metadata['extension']);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Upload implements Extension {
 | 
					class Upload implements Extension {
 | 
				
			||||||
	var $theme;
 | 
						var $theme;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,25 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * DisplayingImageEvent:
 | 
				
			||||||
 | 
					 *   $image -- the image being displayed
 | 
				
			||||||
 | 
					 *   $page  -- the page to display on
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Sent when an image is ready to display. Extensions who
 | 
				
			||||||
 | 
					 * wish to appear on the "view" page should listen for this,
 | 
				
			||||||
 | 
					 * which only appears when an image actually exists.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class DisplayingImageEvent extends Event {
 | 
				
			||||||
 | 
						var $image, $page;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function DisplayingImageEvent($image, $page) {
 | 
				
			||||||
 | 
							$this->image = $image;
 | 
				
			||||||
 | 
							$this->page = $page;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public function get_image() {
 | 
				
			||||||
 | 
							return $this->image;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ImageInfoBoxBuildingEvent extends Event {
 | 
					class ImageInfoBoxBuildingEvent extends Event {
 | 
				
			||||||
	var $parts = array();
 | 
						var $parts = array();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user