List of Plugin Hooks List of Plugin Hooks
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

List of Plugin Hooks

Started by jjhat1, June 10, 2006, 01:21:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jjhat1

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.

donnoman

#1
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.


  • The first marker is placed in the HTML at the hookpoints "echo" point.
  • If the hookpoint is an array then the marker has "_ARRAY" appended to it
  • If the hookpoint is not an array it has "_HTML" appended to it and the marker without any appendage is tacked onto the filtered var
  • In all cases a var_dump of that filtered variable is output to the source html as an html remark just below the echo point.

donnoman

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

Joachim Müller

#3
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

lurkalot

The links on this FAQ thread are all dead.   ;) 

They give a error
QuoteParse error: syntax error, unexpected $end in /home/cpgcontr/public_html/board/Sources/Subs.php on line 3524
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

phill104

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/
It is a mistake to think you can solve any major problems just with potatoes.