From b230bf207df576fa2ad165702184edf21f674ce7 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 7 May 2017 18:44:05 +0200 Subject: Bump version to v0.9.0 Signed-off-by: ArthurHoaro --- doc/Plugin-System.html | 117 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 105 insertions(+), 12 deletions(-) (limited to 'doc/Plugin-System.html') diff --git a/doc/Plugin-System.html b/doc/Plugin-System.html index 655536c6..123bf106 100644 --- a/doc/Plugin-System.html +++ b/doc/Plugin-System.html @@ -69,6 +69,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
  • Browsing and Searching
  • Firefox share
  • RSS feeds
  • +
  • REST API
  • How To

    Plugin System

    -
    -

    Note: Plugin current status - in development (not merged into master).

    -

    I am a developer. Developer API.

    I am a template designer. Guide for template designer.

    Developer API

    @@ -121,12 +120,21 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf | plugins/ |---| demo_plugin/ | |---| demo_plugin.php +

    Plugin initialization

    +

    At the beginning of Shaarli execution, all enabled plugins are loaded. At this point, the plugin system looks for an init() function to execute and run it if it exists. This function must be named this way, and takes the ConfigManager as parameter.

    +
    <plugin_name>_init($conf)
    +

    This function can be used to create initial data, load default settings, etc. But also to set plugin errors. If the initialization function returns an array of strings, they will be understand as errors, and displayed in the header to logged in users.

    Understanding hooks

    A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution.

    These functions need to be named with this pattern:

    -
    hook_<plugin_name>_<hook_name>
    +
    hook_<plugin_name>_<hook_name>($data, $conf)
    +

    Parameters:

    +

    For exemple, if my plugin want to add data to the header, this function is needed:

    -
    hook_demo_plugin_render_header()
    +
    hook_demo_plugin_render_header

    If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header.

    Plugin's data

    Parameters

    @@ -159,6 +167,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
    • description: plugin description
    • parameters: user parameter names, separated by a ;.
    • +
    • parameter.<PARAMETER_NAME>: add a text description the specified parameter.

    Note: In PHP, parse_ini_file() seems to want strings to be between by quotes " in the ini file.

    @@ -209,16 +218,28 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf render_tagcloud -Allow to add content at the top and bottom of the page. +Allow to add content at the top and bottom of the page, and after all tags. +render_taglist +Allow to add content at the top and bottom of the page, and after all tags. + + render_daily Allow to add content at the top and bottom of the page, the bottom of each link and to alter data. + +render_feed +Allow to do add tags in RSS and ATOM feeds. + -savelink +save_link Allow to alter the link being saved in the datastore. + +delete_link +Allow to do an action before a link is deleted from the datastore. +

    render_header

    @@ -376,17 +397,41 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
  • plugin_start_zone: before displaying the template content.

  • plugin_end_zone: after displaying the template content.

  • +

    For each tag, the following placeholder can be used:

    +
      +
    • tag_plugin: after each tag
    • +

    plugin_start_end_zone_example

    +

    render_taglist

    +

    Triggered when taglist is displayed.

    +

    Allow to add content at the top and bottom of the page.

    +
    Data
    +

    $data is an array containing:

    +
      +
    • _LOGGEDIN_: true if user is logged in, false otherwise.
    • +
    • All templates data.
    • +
    +
    Template placeholders
    +

    Items can be displayed in templates by adding an entry in $data['<placeholder>'] array.

    +

    List of placeholders:

    +
      +
    • plugin_start_zone: before displaying the template content.

    • +
    • plugin_end_zone: after displaying the template content.

    • +
    +

    For each tag, the following placeholder can be used:

    +
      +
    • tag_plugin: after each tag
    • +

    render_daily

    Triggered when tagcloud is displayed.

    Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.

    -
    Data
    +
    Data

    $data is an array containing:

    • _LOGGEDIN_: true if user is logged in, false otherwise.
    • All templates data, including links.
    -
    Template placeholders
    +
    Template placeholders

    Items can be displayed in templates by adding an entry in $data['<placeholder>'] array.

    List of placeholders:

      @@ -397,18 +442,57 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
    • plugin_start_zone: before displaying the template content.

    • plugin_end_zone: after displaying the template content.

    - +

    render_feed

    +

    Triggered when the ATOM or RSS feed is displayed.

    +

    Allow to add tags in the feed, either in the header or for each items. Items (links) can also be altered before being rendered.

    +
    Data
    +

    $data is an array containing:

    +
      +
    • _LOGGEDIN_: true if user is logged in, false otherwise.
    • +
    • _PAGE_: containing either rss or atom.
    • +
    • All templates data, including links.
    • +
    +
    Template placeholders
    +

    Tags can be added in feeds by adding an entry in $data['<placeholder>'] array.

    +

    List of placeholders:

    +
      +
    • feed_plugins_header: used as a header tag in the feed.
    • +
    +

    For each links:

    +
      +
    • feed_plugins: additional tag for every link entry.
    • +
    +

    Triggered when a link is save (new link or edit).

    Allow to alter the link being saved in the datastore.

    -
    Data
    +
    Data

    $data is an array containing the link being saved:

      +
    • id
    • title
    • url
    • +
    • shorturl
    • description
    • -
    • linkdate
    • private
    • tags
    • +
    • created
    • +
    • updated
    • +
    + +

    Triggered when a link is deleted.

    +

    Allow to execute any action before the link is actually removed from the datastore

    +
    Data
    +

    $data is an array containing the link being saved:

    +
      +
    • id
    • +
    • title
    • +
    • url
    • +
    • shorturl
    • +
    • description
    • +
    • private
    • +
    • tags
    • +
    • created
    • +
    • updated

    Guide for template designer

    Plugin administration

    @@ -537,5 +621,14 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf {$value} {/loop} </div> +

    feed.atom.xml and feed.rss.xml:

    +

    In headers tags section:

    +
    {loop="$feed_plugins_header"}
    +  {$value}
    +{/loop}
    +

    After each entry:

    +
    {loop="$value.feed_plugins"}
    +  {$value}
    +{/loop}
    -- cgit v1.2.3