forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 plugins => Topic started by: jjhat1 on June 10, 2006, 01:21:11 am

Title: List of Plugin Hooks
Post by: jjhat1 on June 10, 2006, 01:21:11 am
This is just a list of the different existing plugin hooks supported in version 1.4.8 of Coppermine.  The following list is designed to aid in the creation of plugins by listing the hooks based on their different uses and properties.  This list does not explain how to use each hook but simply lists them so that they can be identified, further researched, and implemented.

Action

The first type of hook is an action hook.  Basically this allows for actions related to the plugin such as the following two hooks.

CPGPluginAPI::action('plugin_configure',$installed,CPG_EXEC_NEW);
CPGPluginAPI::action('plugin_cleanup',$uninstalled,$plugin_id);


These next two hooks are useful for running code that does not require anything to be exported.  These hooks have access to the global variables and functions inside of Coppermine.  These hooks will most likely be used to execute code that does not require an output.

CPGPluginAPI::action('page_start',null)
CPGPluginAPI::action('page_end',null);


Filter

This group of plugins is designed to manipulate data that will be used.  Normally this involves adding or removing data from the variable submitted to the filter.  This data can also be simply read from the variable.

This first group of filters are used in a variety of places and are each unique.

$info = CPGPluginAPI::filter('file_info',$info);
$params = CPGPluginAPI::filter('user_caption_params', array('{USER_NAME}' => $user['user_name'],
$matches = CPGPluginAPI::filter('plugin_block', $matches);
$anycontent = CPGPluginAPI::filter('anycontent',ob_get_contents());
$template = CPGPluginAPI::filter('template_html',$template);
$template_header = str_replace('{META}','{META}'.CPGPluginAPI::filter('page_meta',''),$template_header);


This group of filters is very specific for manipulating the data of the thumbnails.  These are named according to what they modify and are extremely obvious.

$rowset = CPGPluginAPI::filter('thumb_caption',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_regular',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_lastcom',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_lastcomby',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_lastup',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_lastupby',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_topn',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_toprated',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_lasthits',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_random',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_search',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_lastalb',$rowset);
$rowset = CPGPluginAPI::filter('thumb_caption_favpics',$rowset);
$pic_row = CPGPluginAPI::filter('thumb_data',$pic_row);


These two filters are used specifically to manipulate the data of a picture.

$CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data',$CURRENT_PIC_DATA);
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);


The breadcrumb plugin:

CPGPluginAPI::filter('post_breadcrumb',null);


This plugin is very powerful because it gives access to the entire body of HTML that will be then directly returned to the user.  This filter can be used to remove parts of code or modify links for example.

return CPGPluginAPI::filter('page_html',$html);


These two filters relate to headers.

echo CPGPluginAPI::filter('usermgr_header','');
$template_header .= CPGPluginAPI::filter('gallery_header','');


These two filters relate to footers.

echo CPGPluginAPI::filter('usermgr_footer','');
$template_footer = CPGPluginAPI::filter('gallery_footer','').substr($template, $gallery_pos);


Sorry for any mistakes I may have made in the above documentation.  I hope this helps someone.
Title: Re: List of Plugin Hooks
Post by: donnoman on June 26, 2006, 07:02:44 am
I put together a plugin to help plugin developers identify hookpoints, and what information each hookpoint is filtering.

http://cpg-contrib.org/board/index.php?board=27.0

In some cases the output of a hookpoint is not the same as it's "echo" point.  A good example of this is the 'gallery_footer'; it is processed very early and it's echo point is above the doctype declaration, while the hookpoints actual output is just above the "powered by" text at the bottom of the document.

Title: Re: List of Plugin Hooks
Post by: donnoman on November 13, 2006, 04:14:58 am
visiblehookpoints 2 released

This is a major upgrade.

All of the array information and hookpoint information is now displayed inline with the html, so you don't have to go digging into the html source to find the information.

There is now a statistics output showing how many times each hookpoint was called.   There is also a timeline of when each hookpoint was executed relative to the scripts start time.

http://cpg-contrib.org/board/index.php?topic=256.0
Title: Re: List of Plugin Hooks
Post by: Joachim Müller on October 18, 2007, 09:50:42 am
Version 3 of the plugin "Visible HookPoints" has been released - it comes with a config screen that let's you specify if the hookpoints are always visible or only when the parameter "hookpoint" is set in the URL.
Announcement: http://cpg-contrib.org/board/index.php?topic=419.0
Title: Re: List of Plugin Hooks
Post by: lurkalot on November 28, 2009, 08:18:25 am
The links on this FAQ thread are all dead.   ;) 

They give a error
Quote
Parse error: syntax error, unexpected $end in /home/cpgcontr/public_html/board/Sources/Subs.php on line 3524
Title: Re: List of Plugin Hooks
Post by: phill104 on November 28, 2009, 09:17:52 am
Yes, we know. Many people have commented that the cpg-contrib site is down. It is nothing we can do about an external site.

Check the downloads section for any plugins you might need

http://sourceforge.net/projects/coppermine/files/