No quote available.

Plugin API - Event hooks

Here is a list of available internal plugin event hooks (current version relation: Serendipity 1.0-alpha1)

They are executed within your PHP code with a function like

serendipity_plugin_api::hook_event(
 'css', 
 $eventData, 
 $addData
);

The first parameter is the hook name, documented below. $eventData is a referenced array that can hold any input/output data for your plugin. $addData is a read-only array of additional information for this event.

The best way to see how an event plugin is implemented is, to search in the PHP files for that hook. So if you want to know how the 'frontend_configure' hook is executed specifically, you could find it like this (unix environment):

find -name \*.php \
  -exec grep -i -l -d skip \
  "serendipity_plugin_api::hook_event('frontend_configure'" \
  {} \;

This returns a list of files where the frontend_configure hook is called.

Plugin hooks can also be executed via Smarty template calls.

The List

Frontend hooks

  • css - The template's CSS code. Input Data: Contents of the CSS ready for modifying
  • frontend_configure - Called after s9y's configuration directives are loaded. The plugin can then override/edit configuration directives. Input data: Configuration directives.
  • entry_display - Called when displaying an entry, called for the full lists of entries. Input data: List of entries.
  • entries_header - Called when displaying a possible header to the entries listing.
  • entries_footer - Called when displaying a possible footer to the entries listing.
  • frontend_header - Called when showing a header on the full entries listing page
  • frontend_footer - Called when showing a footer on the full entries listing page
  • entry_groupdata - Called when the input array of entries is sorted by Date or some other criteria
  • frontend_fetchentries - Called when fetching a list of entries, allows to modify the SQL statement
  • frontend_fetchentry - Called when fetching a single entry, allows to modify the SQL statement
  • frontend_entryproperties - Called when the properties of entries are fetched
  • frontend_entryproperties_query - Called to add several SQL joins to fetch properties from the serendipity_entryproperties SQL table on all needed occasions
  • fetchcomments - Called when fetching the list of comments to an entry
  • frontend_display - Called before displaying an entry or comment. Input data: Item/Entry data.
  • frontend_display_cache - Called when it's allowed to show a cached version of an entry, to perform some non-caching logic
  • frontend_display:html_layout - Called while displaying an sidebar item entry. Input data: Display output.
  • frontend_comment - Called on the "enter comment" screen. Input data: Null.
  • frontend_display:rss-1.0:namespace - Called inside the RSS 1.0 feed. Input data: Data of all entries
  • frontend_display:rss-2.0:namespace - Called inside the RSS 2.0 feed. Input data: Data of all entries
  • frontend_display:rss-1.0:once - Called inside the RSS 1.0 feed. Input data: Data of all entries
  • frontend_display:html:per_entry - Called just before displaying an entry. Input data: Entry data
  • frontend_display:rss-2.0:per_entry - Called inside the RSS 2.0 feed for each item. Input data: Entry data
  • frontend_display:rss-1.0:per_entry - Called inside the RSS 1.0 feed for each item. Input data: Entry data
  • frontend_entries_rss - Called when RSS feeds of your entries are displayed
  • frontend_rss - Called when the header of RSS feeds are displayed
  • frontend_saveComment - Called when saving a comment, can be used for Spam-Prevention
  • frontend_generate_plugins - Called when generating the list of sidebar plugins. Can be used to hide certain plugins from the frontend depending on options
  • quicksearch_plugin: Allows to inject HTML code for the output of the Quicksearch plugin (used by the livesearch for example)
  • frontend_image_selector and several other frontend_image_* hooks are used by the Media Manager to inject specific HTML code for formatting the Media file selector
  • external_plugin - Allows plugins to register external URLs so that they can be called independently from the blog but using the Serendipity framework
  • genpage - Called when the Serendipity Smarty Framework is instanciated
  • frontend_calendar - Called when displaying the calendar items
  • frontend_xmlrpc - Called when XML-RPC API method calls are made to your blog
  • xmlrpc_deleteEntry - Called when a XML-RPC API call is made to delete an entry
  • xmlrpc_fetchEntry - Called when a XML-RPC API call is made to fetch/get an entry
  • xmlrpc_updertEntry - Called when a XML-RPC API call is made to update an entry

Backend hooks

  • css_backend - The backend template CSS code. Input Data: CSS content
  • backend_auth - Performed when authenticated a user. Input Data: Userdata
  • backend_category_addNew - Performed when adding a new category. Input Data: Category data
  • backend_category_delete - Performed when deleting a category. Input Data: Category data/id
  • backend_category_showForm - Called when showing the properties of a category. Input Data: List of categories
  • backend_category_update - Performed when updating a category. Input Data: Category data
  • backend_users_add - Called when adding a user
  • backend_users_delete - Called when deleting a user
  • backend_users_edit - Called when deleting a user
  • backend_comments_top - Called when displaying comments to your entries in the backend "comment" section.
  • backend_view_comment - Called when viewing a comment in your backend "comment" section.
  • backend_wysiwyg - Called when showing a WYSIWYG editor item in the backend
  • backend_wysiwyg_finish - Called when the initializing of the WYSIWYG editor item in the backend is finished
  • backend_wysiwyg_nuggets - Called when initializing multiple input WYSIWYG nuggets on a page
  • backend_configure - Called when intializing the serendipity Backend. Input data: Configuration data
  • backend_delete_entry - Called when deleting an entry. Input data: Entry data
  • backend_preview - Called when previewing an entry. Input data: Entry data.
  • backend_publish - Called when publishing an entry. Input data: Entry data.
  • backend_save - Called when saving an antry in draft state. Input data: Entry data.
  • backend_display - Called when displaying an entry for editing. Input data: Entry data.
  • backend_trackbacks - Called when the list of Links to send a trackback to is gathered
  • backend_trackback_check - Called when checking a certain link if it is a trackback link
  • backend_entryform - Called to display the form for editing/creating an entry
  • backend_sidebar_entries - Called when building the menu list for the admin suite, section "Entries". Input data: Configuration directives.
  • backend_sidebar_entries_images - Called when building the menu list for the admin suite, section "Media".
  • backend_sidebar_admin_appearance - Called when building the menu list for the admin suite, section "Appearance".
  • backend_sidebar_admin - Called when building the menu list for the admin suite, section "Administration".
  • backend_entry_checkSave - Executed before saving trying to save an entry
  • backend_entry_presave - Executed immediately before an entry is inserted into the Database
  • backend_entry_updertEntry - Called to gather a list of error messages when creating/saving an article has failed. Input data: Error messages
  • backend_cache_purge - Called when the cache of an entry needs to be purged (Entryproperties plugin)
  • backend_cache_entries - Called to cache a list of entries (Entryproperties plugin)
  • backend_import_entry - Called during the import process after a new entry has been created and added to the backend. Input data: Entry data. Additional data: Array containing some additional properties for the current entry (currently just nl2br set to true or false to define whether the entry should have converted line-breaks or not). This hook currently is only available in the current CVS HEAD.
  • backend_image_add - Called when adding a new media item. Input data: Media item
  • backend_image_addHotling - Called when adding a notlinked media item. Input data: Media item
  • backend_image_addform - Called when displaying the form to add new images. Input data: Media data
  • backend_login_page - Called when displaying the loginform to the s9y backend. Input data: Config data
  • backend_entry_toolbar_body - Can output user interface widgets for the Admin interface's Entry screen above the Body portion
  • backend_entry_toolbar_extended - Can output user interface widgets for the Admin interface's Entry screen above the Extended Entry portion
  • backend_plugins_fetchlist - Can override the list of available plugins. SPARTACUS makes use of this.
  • backend_plugins_fetchplugin - Calls the plugin's introspection facilities. Can be used to override introspecting a local plugin, used by SPARTACUS.
  • backend_plugins_new_instance - Called when a new plugin is added. Used by SPARTACUS
  • backend_plugins_event_header - Called before displaying the list of available plugins. Input data: Plugins
  • backend_plugins_sidebar_header - Called when displaying the list of Sidebar plugin icons, used by SPARTACUS
  • backend_template_fetchlist - Called when fetching the list of available themes, used by SPARTACUS
  • backend_template_fetchtemplate - Called when fetching a specific theme, used by SPARTACUS
  • event_additional_statistics - Used by the Statistics plugin to let other plugins also emit statistics
  • backend_frontpage_display - Called for the right start page on the Admin panel