Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dev:extensions:plugins [2006/11/07 02:36]
rvelices
— (current)
Line 1: Line 1:
-Plugins are intended to extend the functionnality of PhpWebGallery. 
-Plugins are available in PhpWebGallery starting with version 1.7. Starting with this version PhpWebGallery provides an architecture allowing plugins to hook themselves in the core. This version also allows site administrators to install/activate/deactivate and uninstall plugins. 
- 
-====== Managing plugins ====== 
- 
-====== Plugin developpement ====== 
- 
-===== Plugin architecture ===== 
-A plugin can hook into the core of PWG by registering **event handlers** with PWG. An **event handler** is nothing more than a function that PWG will call. 
-<code php>register_event_handler('delete_user', my_action_on_delete_user);</code> 
-In this case, 'delete_user' is the name of the event to which the plugin will hook. PWG will automatically call your function when a user is deleted. 
- 
-PWG will trigger **actions** and **events**. The only difference between **actions** and **events** from a coding perspective is that you are required to return a value in the case of an event (this return value will be used later by PWG).  
- 
-An example of **action** is 'delete_user' or 'delete_elements'. Your plugin can take any required actions when a user is deleted by registering an event handler for 'delete_user'. While handling actions you are not expected to directly return a value that will be used by PWG, but you can modify any global variable in order to change the general behaviour. 
- 
-An example of **event** is 'render_user_comment_content'. PWG will give in input the raw content of a comment, you can modify it at your will (for example allow bbcode or add smilies) and return the value: 
-<code php> 
-register_event_handler('render_user_comment_content', 'my_function'); 
-function my_function($content) 
-{ 
-  $content = str_replace(':)', 'http://example.com/icon_smile.gif', $content); 
-  return $content; //<-- NOTE: this is how you return the value to PWG  
-} 
-</code> 
- 
-===== Taxonomy of a plugin ===== 
-===== Advanced plugin development topics ===== 
-==== Adding content to the administration page ==== 
- 
- 
  
 
Back to top
dev/extensions/plugins.1162866986.txt.gz · Last modified: 2009/03/07 22:13 (external edit)
 
 
github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact