Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: List of Plugin Hooks  (Read 25908 times)

0 Members and 1 Guest are viewing this topic.

jjhat1

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 17
List of Plugin Hooks
« 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.
« Last Edit: June 27, 2006, 10:03:35 pm by Paver »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: List of Plugin Hooks
« Reply #1 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.

  • 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.
« Last Edit: November 01, 2006, 07:26:16 am by donnoman »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: List of Plugin Hooks
« Reply #2 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: List of Plugin Hooks
« Reply #3 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
« Last Edit: October 18, 2007, 10:01:56 am by GauGau »
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 824
  • +Tinyportal Support team.
Re: List of Plugin Hooks
« Reply #4 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
Logged
Running SMF 2.0.13  / Tinyportal 1.2, bridged with Coppermine 1.5.34, plus cpmfetch 2.0.0

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4456
    • Windsurf.me
Re: List of Plugin Hooks
« Reply #5 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/
Logged
It is a mistake to think you can solve any major problems just with potatoes.
Pages: [1]   Go Up
 

Page created in 0.042 seconds with 20 queries.