Added more comments and changed others for better doxygen support.

This commit is contained in:
green-ponies (jgen) 2011-09-03 19:34:46 -04:00
parent 9c8da62ba0
commit 100dd6438e
2 changed files with 65 additions and 44 deletions

View File

@ -1,21 +1,27 @@
<?php <?php
/* /*
* Name: Image Manager * Name: Image Manager
* Author: Shish * Author: Shish <webmaster@shishnet.org>
* Modified by: jgen <jgen.tech@gmail.com>
* Description: Handle the image database * Description: Handle the image database
* Visibility: admin * Visibility: admin
*/ */
/* /**
* ImageAdditionEvent: * An image is being added to the database.
* $user -- the user adding the image
* $image -- the image being added
*
* An image is being added to the database
*/ */
class ImageAdditionEvent extends Event { class ImageAdditionEvent extends Event {
var $user, $image; var $user, $image;
/**
* Inserts a new image into the database with its associated
* information. Also calls TagSetEvent to set the tags for
* this new image.
*
* @sa TagSetEvent
* @param $user The user adding the image
* @param $image The new image to add.
*/
public function ImageAdditionEvent(User $user, Image $image) { public function ImageAdditionEvent(User $user, Image $image) {
$this->image = $image; $this->image = $image;
$this->user = $user; $this->user = $user;
@ -30,34 +36,41 @@ class ImageAdditionException extends SCoreException {
} }
} }
/* /**
* ImageDeletionEvent: * An image is being deleted.
* $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 { class ImageDeletionEvent extends Event {
var $image; var $image;
/**
* Deletes an image.
* Used by things like tags and comments handlers to
* clean out related rows in their tables.
*
* @param $image The image being deleted
*/
public function ImageDeletionEvent(Image $image) { public function ImageDeletionEvent(Image $image) {
$this->image = $image; $this->image = $image;
} }
} }
/* /**
* ImageReplaceEvent: * An image is being replaced.
* $id -- the ID of the image to replace
* $image -- the image object of the new image to use
*
* This function replaces an image. Effectively it only
* replaces the image file contents and leaves the tags
* and such the same.
*/ */
class ImageReplaceEvent extends Event { class ImageReplaceEvent extends Event {
var $id, $image; var $id, $image;
/**
* Replaces an image.
* Updates an existing ID in the database to use a new image
* file, leaving the tags and such unchanged. Also removes
* the old image file and thumbnail from the disk.
*
* @param $id
* The ID of the image to replace
* @param $image
* The image object of the new image to use
*/
public function ImageReplaceEvent($id, Image $image) { public function ImageReplaceEvent($id, Image $image) {
$this->id = $id; $this->id = $id;
$this->image = $image; $this->image = $image;
@ -72,15 +85,18 @@ class ImageReplaceException extends SCoreException {
} }
} }
/**
/* * Request a thumbnail be made for an image object.
* ThumbnailGenerationEvent:
* Request a thumb be made for an image
*/ */
class ThumbnailGenerationEvent extends Event { class ThumbnailGenerationEvent extends Event {
var $hash; var $hash, $type;
var $type;
/**
* Request a thumbnail be made for an image object
*
* @param $hash The unique hash of the image
* @param $type The type of the image
*/
public function ThumbnailGenerationEvent($hash, $type) { public function ThumbnailGenerationEvent($hash, $type) {
$this->hash = $hash; $this->hash = $hash;
$this->type = $type; $this->type = $type;
@ -95,8 +111,7 @@ class ThumbnailGenerationEvent extends Event {
* $image -- the image who's link is being parsed * $image -- the image who's link is being parsed
*/ */
class ParseLinkTemplateEvent extends Event { class ParseLinkTemplateEvent extends Event {
var $link, $original; var $link, $original, $image;
var $image;
public function ParseLinkTemplateEvent($link, Image $image) { public function ParseLinkTemplateEvent($link, Image $image) {
$this->link = $link; $this->link = $link;
@ -110,9 +125,8 @@ class ParseLinkTemplateEvent extends Event {
} }
/* /**
* A class to handle adding / getting / removing image * A class to handle adding / getting / removing image files from the disk.
* files from the disk
*/ */
class ImageIO extends SimpleExtension { class ImageIO extends SimpleExtension {
public function onInitExt($event) { public function onInitExt($event) {

View File

@ -5,17 +5,19 @@
* Description: Allows people to upload files to the website * Description: Allows people to upload files to the website
*/ */
/* /**
* DataUploadEvent: * Occurs when some data is being uploaded.
* $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 { class DataUploadEvent extends Event {
var $user, $tmpname, $metadata, $hash, $type, $image_id = -1; var $user, $tmpname, $metadata, $hash, $type, $image_id = -1;
/**
* Some data is being uploaded.
* This should be caught by a file handler.
* @param $user The user uploading the data.
* @param $tmpname The temporary file used for upload.
* @param $metadata Info about the file, should contain at least "filename", "extension", "tags" and "source".
*/
public function DataUploadEvent(User $user, $tmpname, $metadata) { public function DataUploadEvent(User $user, $tmpname, $metadata) {
assert(file_exists($tmpname)); assert(file_exists($tmpname));
@ -34,6 +36,11 @@ class DataUploadEvent extends Event {
class UploadException extends SCoreException {} class UploadException extends SCoreException {}
/**
* Main upload class.
* All files that are uploaded to the site are handled through this class.
* This also includes transloaded files as well.
*/
class Upload implements Extension { class Upload implements Extension {
var $theme; var $theme;
// event handling {{{ // event handling {{{