March 22, 2010, 06:40:48 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Private messages disabled
Caused by the massive abuse of the PM system in the past, the sending of personal messages has been disabled for all regular users on the Coppermine forum.
[more]
   Home   Help Search Board rules Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: List of Plugin Hooks  (Read 17773 times)
0 Members and 1 Guest are viewing this topic.
jjhat1 Topic starter
Contributor
***
Gender: Male
Posts: 17


« on: June 10, 2006, 12: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, 09:03:35 pm by Paver » Logged
donnoman
Dev Team member
****
Gender: Male
Posts: 1614


From donovanbray.com


WWW
« Reply #1 on: June 26, 2006, 06: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, 06:26:16 am by donnoman » Logged

Sometimes, you see a quote and take it to heart for the rest of your days because it's meaning conveys wisdom beyond it's mere words. My quote for you; "Don't eat yellow snow."
donnoman
Dev Team member
****
Gender: Male
Posts: 1614


From donovanbray.com


WWW
« Reply #2 on: November 13, 2006, 03: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

Sometimes, you see a quote and take it to heart for the rest of your days because it's meaning conveys wisdom beyond it's mere words. My quote for you; "Don't eat yellow snow."
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 46249


aka "GauGau"


WWW
« Reply #3 on: October 18, 2007, 08: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


* plugin.visiblehookpoints.01.jpg (345.11 KB, 942x564 - viewed 933 times.)

* plugin.visiblehookpoints.02.jpg (59.53 KB, 566x194 - viewed 691 times.)

* plugin.visiblehookpoints.03.jpg (132.46 KB, 388x578 - viewed 911 times.)

* plugin.visiblehookpoints.04.jpg (129.31 KB, 525x571 - viewed 801 times.)

* plugin.visiblehookpoints.05.jpg (288.94 KB, 999x595 - viewed 915 times.)
« Last Edit: October 18, 2007, 09:01:56 am by GauGau » Logged
lurkalot
Coppermine regular visitor
**
Gender: Male
United Kingdom United Kingdom

Posts: 96


« Reply #4 on: November 28, 2009, 07:18:25 am »

The links on this FAQ thread are all dead.   Wink 

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 1.1.11 / Tinyportal 0.9.8, bridged with Coppermine 1.4.23, SMF Arcade 2.0.18, SMF Shop 3, SMF Chess, Avatar Onboard 2.0.  plus Copperminefetch 2.0, and various other blocks in use.

My Website Camera Craniums
Phill Luckhurst
Administrator
*****
Gender: Male
United Kingdom United Kingdom

Posts: 1949


WWW
« Reply #5 on: November 28, 2009, 08: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
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.066 seconds with 16 queries.