From: Cash Costello Date: Sat, 3 Oct 2009 18:20:59 +0000 (+0000) Subject: cleaned up events and plugin hooks X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=82ed7baf78c3005309487fc4e8b075cba9249e8b;p=lorea%2Felgg.git cleaned up events and plugin hooks --- diff --git a/actions/delete.php b/actions/delete.php index 498c991c7..1a518af9e 100644 --- a/actions/delete.php +++ b/actions/delete.php @@ -38,14 +38,14 @@ $forward_url = $container->getURL(); //forward back to album after deleting pictures $images = array($entity); // plugins can register to be told when a Tidypics image has been deleted - trigger_elgg_event('upload', 'tp_album', $entity); + trigger_elgg_event('delete', 'tp_image', $entity); } else { //deleting an album $owner_guid = $entity->container_guid; $forward_url = 'pg/photos/owned/' . $container->username; //get all the images from this album as long as less than 999 images $images = get_entities("object", "image", $guid, '', 999); // plugins can register to be told when a Tidypics album has been deleted - trigger_elgg_event('upload', 'tp_album', $entity); + trigger_elgg_event('delete', 'tp_album', $entity); } // make sure we decrease the repo size for the size quota diff --git a/actions/edit.php b/actions/edit.php index e8f2e3aca..91c465828 100644 --- a/actions/edit.php +++ b/actions/edit.php @@ -74,7 +74,7 @@ } else { system_message(elgg_echo('images:edited')); // plugins can register to be told when a Tidypics image has been updated - trigger_elgg_event('update', 'tp_album', $entity); + trigger_elgg_event('update', 'tp_image', $entity); } forward($entity->getURL()); diff --git a/docs/extending_tidypics.txt b/docs/extending_tidypics.txt index 8d3674cbd..0fd544119 100644 --- a/docs/extending_tidypics.txt +++ b/docs/extending_tidypics.txt @@ -1,9 +1,26 @@ Extending Tidypics ----------------------------------- -We will include more information here in the future. For right now, we will -mention that we have included some code to make it easy to put the latest -photos on your front page. See tidypics/lib/tidypics.php and the function -tp_get_latest_photos(). +*** DISPLAYING THE LATEST PHOTOS *** +In tidypics/lib/tidypics.php, there is a function tp_get_latest_photos(). +It can be used to display the site-wide latest photos or an individual +user's latest photos. The documentation explains how you could use that +function to display the latest photos on your front page if you are using +the custom front page tutorial plugin from Curverider. - \ No newline at end of file + +*** MAKING TIDYPICS MATCH YOUR THEME *** +Please check the css guid found in this directory. This will list the +different css elements and where they are used. + + +*** TIDYPICS EVENTS *** +1. album created: 'add', 'tp_album' +2. album updated: 'update', 'tp_album' +3. album deleted: 'delete', 'tp_album' +4. photos uploaded: 'upload', 'tp_album' +5. photo edited: 'update', 'tp_image' +6. photo deleted: 'delete', 'tp_image' + +*** TIDYPICS PLUGIN HOOKS *** +1. album slideshow: 'tp_slideshow', 'album' - return false to not have a slideshow, otherwise return link to slideshow \ No newline at end of file diff --git a/pages/viewalbum.php b/pages/viewalbum.php index 4b3e6d703..3cc854c94 100644 --- a/pages/viewalbum.php +++ b/pages/viewalbum.php @@ -33,7 +33,7 @@ } // allow other plugins to override the slideshow - $slideshow_link = trigger_plugin_hook('tidypics:slideshow', 'album', $album, false); + $slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', $album, null); if ($slideshow_link) { add_submenu_item(elgg_echo('album:slideshow'), $slideshow_link, diff --git a/start.php b/start.php index 24189d44d..a15215118 100644 --- a/start.php +++ b/start.php @@ -72,7 +72,7 @@ } // slideshow plugin hook - register_plugin_hook('tidypics:slideshow', 'album', 'tidypics_slideshow'); + register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow'); } /** @@ -403,8 +403,8 @@ */ function tidypics_slideshow($hook, $entity_type, $returnvalue, $params) { - if ($returnvalue) { - // someone has already added a slideshow + if ($returnvalue !== null) { + // someone has already added a slideshow or requested that the slideshow is not used return $returnvalue; }