2015-07-22 05:02:10 +02:00
<!DOCTYPE html>
< html >
< head >
< meta charset = "utf-8" >
< meta name = "generator" content = "pandoc" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0, user-scalable=yes" >
2016-04-14 14:20:23 +02:00
< title > Shaarli – Plugin System< / title >
2015-07-22 05:02:10 +02:00
< style type = "text/css" > code { white-space : pre ; } < / style >
< style type = "text/css" >
2016-04-14 14:20:23 +02:00
div.sourceCode { overflow-x: auto; }
2015-07-22 05:02:10 +02:00
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
2016-04-14 14:20:23 +02:00
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
2015-07-22 05:02:10 +02:00
< / style >
< link rel = "stylesheet" href = "github-markdown.css" >
2016-04-14 14:20:23 +02:00
<!-- [if lt IE 9]>
< script src = "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js" > < / script >
<![endif]-->
2015-07-22 05:02:10 +02:00
< / head >
< body >
< div id = "local-sidebar" >
< ul >
< li > < a href = "Home.html" > Home< / a > < / li >
< li > Installation
< ul >
2015-09-04 21:25:47 +02:00
< li > < a href = "Download.html" > Download< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Server-requirements.html" > Server requirements< / a > < / li >
< li > < a href = "Server-configuration.html" > Server configuration< / a > < / li >
2016-04-14 14:20:23 +02:00
< li > < a href = "Server-security.html" > Server security< / a > < / li >
< li > < a href = "Shaarli-installation.html" > Shaarli installation< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Shaarli-configuration.html" > Shaarli configuration< / a > < / li >
2016-05-14 11:37:28 +02:00
< li > < a href = "Plugins.html" > Plugins< / a > < / li >
2015-07-22 05:02:10 +02:00
< / ul > < / li >
2016-04-14 14:20:23 +02:00
< li > < a href = "Docker.html" > Docker< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Usage.html" > Usage< / a >
< ul >
< li > < a href = "Sharing-button.html" > Sharing button< / a > (bookmarklet)< / li >
2016-04-14 14:20:23 +02:00
< li > < a href = "Browsing-and-Searching.html" > Browsing and Searching< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Firefox-share.html" > Firefox share< / a > < / li >
< li > < a href = "RSS-feeds.html" > RSS feeds< / a > < / li >
< / ul > < / li >
< li > How To
< ul >
< li > < a href = "Backup,-restore,-import-and-export.html" > Backup, restore, import and export< / a > < / li >
2016-04-14 14:20:23 +02:00
< li > < a href = "Upgrade-from-original-sebsauvage/Shaarli.html" > Upgrade from original sebsauvage/Shaarli< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Copy-an-existing-installation-over-SSH-and-serve-it-locally.html" > Copy an existing installation over SSH and serve it locally< / a > < / li >
2016-04-14 14:20:23 +02:00
< li > < a href = "Create-and-serve-multiple-Shaarlis-(farm).html" > Create and serve multiple Shaarlis (farm)< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Download-CSS-styles-from-an-OPML-list.html" > Download CSS styles from an OPML list< / a > < / li >
2015-08-18 00:33:25 +02:00
< li > < a href = "Datastore-hacks.html" > Datastore hacks< / a > < / li >
2015-07-22 05:02:10 +02:00
< / ul > < / li >
< li > < a href = "Troubleshooting.html" > Troubleshooting< / a > < / li >
< li > < a href = "Development.html" > Development< / a >
< ul >
< li > < a href = "GnuPG-signature.html" > GnuPG signature< / a > < / li >
< li > < a href = "Coding-guidelines.html" > Coding guidelines< / a > < / li >
< li > < a href = "Directory-structure.html" > Directory structure< / a > < / li >
< li > < a href = "3rd-party-libraries.html" > 3rd party libraries< / a > < / li >
< li > < a href = "Plugin-System.html" > Plugin System< / a > < / li >
2016-04-14 14:20:23 +02:00
< li > < a href = "Release-Shaarli.html" > Release Shaarli< / a > < / li >
2015-07-22 05:02:10 +02:00
< li > < a href = "Security.html" > Security< / a > < / li >
< li > < a href = "Static-analysis.html" > Static analysis< / a > < / li >
< li > < a href = "Theming.html" > Theming< / a > < / li >
< li > < a href = "Unit-tests.html" > Unit tests< / a > < / li >
< / ul > < / li >
< li > About
< ul >
< li > < a href = "FAQ.html" > FAQ< / a > < / li >
< li > < a href = "Community-&-Related-software.html" > Community & Related software< / a > < / li >
< li > < a href = "TODO.html" > TODO< / a > < / li >
< / ul > < / li >
< / ul >
< / div >
< h1 id = "plugin-system" > Plugin System< / h1 >
< blockquote >
2016-04-14 14:20:23 +02:00
< p > Note: Plugin current status - in development (not merged into master).< / p >
2015-07-22 05:02:10 +02:00
< / blockquote >
2016-04-14 14:20:23 +02:00
< p > < a href = "#developer-api" > < strong > I am a developer.< / strong > Developer API.< / a > < a href = ".html" > < / a > < / p >
2015-07-22 05:02:10 +02:00
< p > < a href = "#guide-for-template-designer" > < strong > I am a template designer.< / strong > Guide for template designer.< / a > < a href = ".html" > < / a > < / p >
2016-04-14 14:20:23 +02:00
< h2 id = "developer-api" > Developer API< / h2 >
2015-07-22 05:02:10 +02:00
< h3 id = "what-can-i-do-with-plugins" > What can I do with plugins?< / h3 >
< p > The plugin system let you:< / p >
< ul >
< li > insert content into specific places across templates.< / li >
< li > alter data before templates rendering.< / li >
< li > alter data before saving new links.< / li >
< / ul >
< h3 id = "how-can-i-create-a-plugin-for-shaarli" > How can I create a plugin for Shaarli?< / h3 >
< p > First, chose a plugin name, such as < code > demo_plugin< / code > .< / p >
< p > Under < code > plugin< / code > folder, create a folder named with your plugin name. Then create a < plugin_name > .php file in that folder.< / p >
< p > You should have the following tree view:< / p >
< pre > < code > | index.php
| plugins/
|---| demo_plugin/
| |---| demo_plugin.php< / code > < / pre >
< h3 id = "understanding-hooks" > Understanding hooks< / h3 >
< p > A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution.< / p >
< p > These functions need to be named with this pattern:< / p >
< pre > < code > hook_< plugin_name> _< hook_name> < / code > < / pre >
< p > For exemple, if my plugin want to add data to the header, this function is needed:< / p >
< pre > < code > hook_demo_plugin_render_header()< / code > < / pre >
< p > If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header.< / p >
< h3 id = "plugins-data" > Plugin's data< / h3 >
< h4 id = "parameters" > Parameters< / h4 >
< p > Every hook function has a < code > $data< / code > parameter. Its content differs for each hooks.< / p >
< p > < strong > This parameter needs to be returned every time< / strong > , otherwise data is lost.< / p >
< pre > < code > return $data;< / code > < / pre >
< h4 id = "filling-templates-placeholder" > Filling templates placeholder< / h4 >
< p > Template placeholders are displayed in template in specific places.< / p >
< p > RainTPL displays every element contained in the placeholder's array. These element can be added by plugins.< / p >
< p > For example, let's add a value in the placeholder < code > top_placeholder< / code > which is displayed at the top of my page:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode php" > < code class = "sourceCode php" > < span class = "kw" > $data< / span > < span class = "ot" > [< / span > < span class = "st" > ' top_placeholder' < / span > < span class = "ot" > []< / span > = < span class = "st" > ' My content' < / span > < span class = "ot" > ;](]< / span > -=-< span class = "st" > ' My-content' < / span > < span class = "ot" > ;< / span > .html< span class = "ot" > )< / span >
2015-07-22 05:02:10 +02:00
< span class = "co" > # OR< / span >
< span class = "fu" > array_push< / span > < span class = "ot" > (< / span > < span class = "kw" > $data< / span > < span class = "ot" > [< / span > < span class = "st" > ' top_placeholder' < / span > < span class = "ot" > ],< / span > < span class = "st" > ' My' < / span > < span class = "ot" > ,< / span > < span class = "st" > ' content' < / span > < span class = "ot" > );[](< / span > .html< span class = "ot" > )< / span >
2016-04-14 14:20:23 +02:00
< span class = "kw" > return< / span > < span class = "kw" > $data< / span > < span class = "ot" > ;< / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< h4 id = "data-manipulation" > Data manipulation< / h4 >
< p > When a page is displayed, every variable send to the template engine is passed to plugins before that in < code > $data< / code > .< / p >
< p > The data contained by this array can be altered before template rendering.< / p >
< p > For exemple, in linklist, it is possible to alter every title:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode php" > < code class = "sourceCode php" > < span class = "co" > // mind the reference if you want $data to be altered< / span >
2015-07-22 05:02:10 +02:00
< span class = "kw" > foreach< / span > < span class = "ot" > (< / span > < span class = "kw" > $data< / span > < span class = "ot" > [< / span > < span class = "st" > ' links' < / span > < span class = "ot" > ]< / span > < span class = "kw" > as< / span > & < span class = "kw" > $value< / span > < span class = "ot" > )< / span > {< span class = "ot" > [](< / span > .html< span class = "ot" > )< / span >
< span class = "co" > // String reverse every title.< / span >
< span class = "kw" > $value< / span > < span class = "ot" > [< / span > < span class = "st" > ' title' < / span > < span class = "ot" > ]< / span > = < span class = "fu" > strrev< / span > < span class = "ot" > (< / span > < span class = "kw" > $value< / span > < span class = "ot" > [< / span > < span class = "st" > ' title' < / span > < span class = "ot" > ]);[](< / span > .html< span class = "ot" > )< / span >
}
2016-04-14 14:20:23 +02:00
< span class = "kw" > return< / span > < span class = "kw" > $data< / span > < span class = "ot" > ;< / span > < / code > < / pre > < / div >
< h3 id = "metadata" > Metadata< / h3 >
< p > Every plugin needs a < code > < plugin_name> .meta< / code > file, which is in fact an < code > .ini< / code > file (< code > KEY=" VALUE" < / code > ), to be listed in plugin administration.< / p >
< p > Each file contain two keys:< / p >
< ul >
< li > < code > description< / code > : plugin description< / li >
< li > < code > parameters< / code > : user parameter names, separated by a < code > ;< / code > .< / li >
< / ul >
< blockquote >
< p > Note: In PHP, < code > parse_ini_file()< / code > seems to want strings to be between by quotes < code > " < / code > in the ini file.< / p >
< / blockquote >
2015-07-22 05:02:10 +02:00
< h3 id = "its-not-working" > It's not working!< / h3 >
< p > Use < code > demo_plugin< / code > as a functional example. It covers most of the plugin system features.< / p >
< p > If it's still not working, please < a href = "https://github.com/shaarli/Shaarli/issues/new" > open an issue< / a > .< a href = ".html" > < / a > < / p >
< h3 id = "hooks" > Hooks< / h3 >
2016-04-14 14:20:23 +02:00
< table style = "width:42%;" >
< colgroup >
< col style = "width: 19%" / >
< col style = "width: 22%" / >
< / colgroup >
2015-07-22 05:02:10 +02:00
< thead >
< tr class = "header" >
2016-04-14 14:20:23 +02:00
< th > Hooks< / th >
2015-07-22 05:02:10 +02:00
< th style = "text-align: center;" > Description< / th >
< / tr >
< / thead >
< tbody >
< tr class = "odd" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_header" > render_header< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow plugin to add content in page headers.< / td >
< / tr >
< tr class = "even" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_includes" > render_includes< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow plugin to include their own CSS files.< / td >
< / tr >
< tr class = "odd" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_footer" > render_footer< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow plugin to add content in page footer and include their own JS files.< / td >
< / tr >
< tr class = "even" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_linklist" > render_linklist< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > It allows to add content at the begining and end of the page, after every link displayed and to alter link data.< / td >
< / tr >
< tr class = "odd" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_editlink" > render_editlink< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow to add fields in the form, or display elements.< / td >
< / tr >
< tr class = "even" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_tools" > render_tools< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow to add content at the end of the page.< / td >
< / tr >
< tr class = "odd" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_picwall" > render_picwall< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow to add content at the top and bottom of the page.< / td >
< / tr >
< tr class = "even" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_tagcloud" > render_tagcloud< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow to add content at the top and bottom of the page.< / td >
< / tr >
< tr class = "odd" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#render_daily" > render_daily< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.< / td >
< / tr >
< tr class = "even" >
2016-04-14 14:20:23 +02:00
< td > < a href = "#savelink" > savelink< / a > < / td >
2015-07-22 05:02:10 +02:00
< td style = "text-align: center;" > Allow to alter the link being saved in the datastore.< / td >
< / tr >
< / tbody >
< / table >
< h4 id = "render_header" > render_header< / h4 >
< p > Triggered on every page.< / p >
< p > Allow plugin to add content in page headers.< / p >
< h5 id = "data" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _PAGE_< / code > : current target page (eg: < code > linklist< / code > , < code > picwall< / code > , etc.).< / li >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< / ul >
< h5 id = "template-placeholders" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > buttons_toolbar< / code > : after the list of buttons in the header.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/ssJUOrt.png" alt = "buttons_toolbar_example" / > < a href = ".html" > < / a > < / p >
< ul >
< li > < code > fields_toolbar< / code > : after search fields in the header.< / li >
< / ul >
< blockquote >
< p > Note: This will only be called in linklist.< / p >
< / blockquote >
< p > < img src = "http://i.imgur.com/3GMifI2.png" alt = "fields_toolbar_example" / > < a href = ".html" > < / a > < / p >
< h4 id = "render_includes" > render_includes< / h4 >
< p > Triggered on every page.< / p >
< p > Allow plugin to include their own CSS files.< / p >
< h5 id = "data-1" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _PAGE_< / code > : current target page (eg: < code > linklist< / code > , < code > picwall< / code > , etc.).< / li >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< / ul >
< h5 id = "template-placeholders-1" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > css_files< / code > : called after loading default CSS.< / li >
< / ul >
< blockquote >
< p > Note: only add the path of the CSS file. E.g: < code > plugins/demo_plugin/custom_demo.css< / code > .< / p >
< / blockquote >
< h4 id = "render_footer" > render_footer< / h4 >
< p > Triggered on every page.< / p >
< p > Allow plugin to add content in page footer and include their own JS files.< / p >
< h5 id = "data-2" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _PAGE_< / code > : current target page (eg: < code > linklist< / code > , < code > picwall< / code > , etc.).< / li >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< / ul >
< h5 id = "template-placeholders-2" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > text< / code > : called after the end of the footer text.< / li >
2016-05-14 11:37:28 +02:00
< li > < code > endofpage< / code > : called at the end of the page.< / li >
2015-07-22 05:02:10 +02:00
< / ul >
< p > < img src = "http://i.imgur.com/L5S2YEH.png" alt = "text_example" / > < a href = ".html" > < / a > < / p >
< ul >
< li > < code > js_files< / code > : called at the end of the page, to include custom JS scripts.< / li >
< / ul >
< blockquote >
< p > Note: only add the path of the JS file. E.g: < code > plugins/demo_plugin/custom_demo.js< / code > .< / p >
< / blockquote >
< h4 id = "render_linklist" > render_linklist< / h4 >
< p > Triggered when < code > linklist< / code > is displayed (list of links, permalink, search, tag filtered, etc.).< / p >
< p > It allows to add content at the begining and end of the page, after every link displayed and to alter link data.< / p >
< h5 id = "data-3" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< li > All templates data, including links.< / li >
< / ul >
< h5 id = "template-placeholders-3" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > action_plugin< / code > : next to the button " private only" at the top and bottom of the page.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/Q12PWg0.png" alt = "action_plugin_example" / > < a href = ".html" > < / a > < / p >
< ul >
< li > < code > link_plugin< / code > : for every link, between permalink and link URL.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/3oDPhWx.png" alt = "link_plugin_example" / > < a href = ".html" > < / a > < / p >
< ul >
< li > < code > plugin_start_zone< / code > : before displaying the template content.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/OVBkGy3.png" alt = "plugin_start_zone_example" / > < a href = ".html" > < / a > < / p >
< ul >
< li > < code > plugin_end_zone< / code > : after displaying the template content.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/6IoRuop.png" alt = "plugin_end_zone_example" / > < a href = ".html" > < / a > < / p >
< h4 id = "render_editlink" > render_editlink< / h4 >
< p > Triggered when the link edition form is displayed.< / p >
< p > Allow to add fields in the form, or display elements.< / p >
< h5 id = "data-4" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > All templates data.< / li >
< / ul >
< h5 id = "template-placeholders-4" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > edit_link_plugin< / code > : after tags field.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/5u17Ens.png" alt = "edit_link_plugin_example" / > < a href = ".html" > < / a > < / p >
< h4 id = "render_tools" > render_tools< / h4 >
< p > Triggered when the " tools" page is displayed.< / p >
< p > Allow to add content at the end of the page.< / p >
< h5 id = "data-5" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > All templates data.< / li >
< / ul >
< h5 id = "template-placeholders-5" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > tools_plugin< / code > : at the end of the page.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/Bqhu9oQ.png" alt = "tools_plugin_example" / > < a href = ".html" > < / a > < / p >
< h4 id = "render_picwall" > render_picwall< / h4 >
< p > Triggered when picwall is displayed.< / p >
< p > Allow to add content at the top and bottom of the page.< / p >
< h5 id = "data-6" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< li > All templates data.< / li >
< / ul >
< h5 id = "template-placeholders-6" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < p > < code > plugin_start_zone< / code > : before displaying the template content.< / p > < / li >
< li > < p > < code > plugin_end_zone< / code > : after displaying the template content.< / p > < / li >
< / ul >
< p > < img src = "http://i.imgur.com/tVTQFER.png" alt = "plugin_start_end_zone_example" / > < a href = ".html" > < / a > < / p >
< h4 id = "render_tagcloud" > render_tagcloud< / h4 >
< p > Triggered when tagcloud is displayed.< / p >
< p > Allow to add content at the top and bottom of the page.< / p >
< h5 id = "data-7" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< li > All templates data.< / li >
< / ul >
< h5 id = "template-placeholders-7" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < p > < code > plugin_start_zone< / code > : before displaying the template content.< / p > < / li >
< li > < p > < code > plugin_end_zone< / code > : after displaying the template content.< / p > < / li >
< / ul >
< p > < img src = "http://i.imgur.com/vHmyT3a.png" alt = "plugin_start_end_zone_example" / > < a href = ".html" > < / a > < / p >
< h4 id = "render_daily" > render_daily< / h4 >
< p > Triggered when tagcloud is displayed.< / p >
< p > Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.< / p >
< h5 id = "data-8" > Data< / h5 >
< p > < code > $data< / code > is an array containing:< / p >
< ul >
< li > < code > _LOGGEDIN_< / code > : true if user is logged in, false otherwise.< / li >
< li > All templates data, including links.< / li >
< / ul >
< h5 id = "template-placeholders-8" > Template placeholders< / h5 >
< p > Items can be displayed in templates by adding an entry in < code > $data['< placeholder> ']< / code > array.< a href = ".html" > < / a > < / p >
< p > List of placeholders:< / p >
< ul >
< li > < code > link_plugin< / code > : used at bottom of each link.< / li >
< / ul >
< p > < img src = "http://i.imgur.com/hzhMfSZ.png" alt = "link_plugin_example" / > < a href = ".html" > < / a > < / p >
< ul >
< li > < p > < code > plugin_start_zone< / code > : before displaying the template content.< / p > < / li >
< li > < p > < code > plugin_end_zone< / code > : after displaying the template content.< / p > < / li >
< / ul >
< h4 id = "savelink" > savelink< / h4 >
< p > Triggered when a link is save (new link or edit).< / p >
< p > Allow to alter the link being saved in the datastore.< / p >
< h5 id = "data-9" > Data< / h5 >
< p > < code > $data< / code > is an array containing the link being saved:< / p >
< ul >
< li > title< / li >
< li > url< / li >
< li > description< / li >
< li > linkdate< / li >
< li > private< / li >
< li > tags< / li >
< / ul >
< h2 id = "guide-for-template-designer" > Guide for template designer< / h2 >
2016-04-14 14:20:23 +02:00
< h3 id = "plugin-administration" > Plugin administration< / h3 >
< p > Your theme must include a plugin administration page: < code > pluginsadmin.html< / code > .< / p >
< blockquote >
< p > Note: repo's template link needs to be added when the PR is merged.< / p >
< / blockquote >
< p > Use the default one as an example.< / p >
< p > Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include < code > plugin_admin.js< / code > , only if:< / p >
< ul >
< li > you're using a table.< / li >
< li > you call orderUp() and orderUp() onclick on arrows.< / li >
< li > you add data-line and data-order to your rows.< / li >
< / ul >
< p > Otherwise, you can use your own JS as long as this field is send by the form:< / p >
< p > < input type = "hidden" name = "order_{$key}" value = "{$counter}" > < / p >
2015-07-22 05:02:10 +02:00
< h3 id = "placeholder-system" > Placeholder system< / h3 >
< p > In order to make plugins work with every custom themes, you need to add variable placeholder in your templates.< / p >
< p > It's a RainTPL loop like this:< / p >
< pre > < code > {loop=" $plugin_variable" }
{$value}
{/loop}< / code > < / pre >
< p > You should enable < code > demo_plugin< / code > for testing purpose, since it uses every placeholder available.< / p >
< h3 id = "list-of-placeholders" > List of placeholders< / h3 >
< p > < strong > page.header.html< / strong > < / p >
< p > At the end of the menu:< / p >
< pre > < code > {loop=" $plugins_header.buttons_toolbar" }
{$value}
{/loop}< / code > < / pre >
2016-04-14 14:20:23 +02:00
< p > At the end of file, before clearing floating blocks:< / p >
< pre > < code > {if=" !empty($plugin_errors) & & isLoggedIn()" }
< ul class=" errors" >
{loop=" plugin_errors" }
< li> {$value}< /li>
{/loop}
< /ul>
{/if}< / code > < / pre >
2015-07-22 05:02:10 +02:00
< p > < strong > includes.html< / strong > < / p >
< p > At the end of the file:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $plugins_includes.css_files" }
2015-07-22 05:02:10 +02:00
< span class = "kw" > < link< / span > < span class = "ot" > type=< / span > < span class = "st" > " text/css" < / span > < span class = "ot" > rel=< / span > < span class = "st" > " stylesheet" < / span > < span class = "ot" > href=< / span > < span class = "st" > " {$value}#" < / span > < span class = "kw" > /> < / span >
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > page.footer.html< / strong > < / p >
< p > At the end of your footer notes:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $plugins_footer.text" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > At the end of file:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $plugins_footer.js_files" }
2015-07-22 05:02:10 +02:00
< span class = "kw" > < script< / span > < span class = "ot" > src=< / span > < span class = "st" > " {$value}#" < / span > < span class = "kw" > > < /script> < / span >
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > linklist.html< / strong > < / p >
< p > After search fields:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $plugins_header.fields_toolbar" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > Before displaying the link list (after paging):< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $plugin_start_zone" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > For every links (icons):< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $value.link_plugin" }
2015-07-22 05:02:10 +02:00
< span class = "kw" > < span> < / span > {$value}< span class = "kw" > < /span> < / span >
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > Before end paging:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $plugin_end_zone" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > linklist.paging.html< / strong > < / p >
< p > After the " private only" icon:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $action_plugin" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > editlink.html< / strong > < / p >
< p > After tags field:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $edit_link_plugin" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > tools.html< / strong > < / p >
< p > After the last tool:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > {loop=" $tools_plugin" }
2015-07-22 05:02:10 +02:00
{$value}
2016-04-14 14:20:23 +02:00
{/loop}< / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > picwall.html< / strong > < / p >
< p > Top:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > id=< / span > < span class = "st" > " plugin_zone_start_picwall" < / span > < span class = "ot" > class=< / span > < span class = "st" > " plugin_zone" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $plugin_start_zone" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > Bottom:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > id=< / span > < span class = "st" > " plugin_zone_end_picwall" < / span > < span class = "ot" > class=< / span > < span class = "st" > " plugin_zone" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $plugin_end_zone" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > tagcloud.html< / strong > < / p >
< p > Top:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > id=< / span > < span class = "st" > " plugin_zone_start_tagcloud" < / span > < span class = "ot" > class=< / span > < span class = "st" > " plugin_zone" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $plugin_start_zone" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > Bottom:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > id=< / span > < span class = "st" > " plugin_zone_end_tagcloud" < / span > < span class = "ot" > class=< / span > < span class = "st" > " plugin_zone" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $plugin_end_zone" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > < strong > daily.html< / strong > < / p >
< p > Top:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > id=< / span > < span class = "st" > " plugin_zone_start_picwall" < / span > < span class = "ot" > class=< / span > < span class = "st" > " plugin_zone" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $plugin_start_zone" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > After every link:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > class=< / span > < span class = "st" > " dailyEntryFooter" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $link.link_plugin" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< p > Bottom:< / p >
2016-04-14 14:20:23 +02:00
< div class = "sourceCode" > < pre class = "sourceCode html" > < code class = "sourceCode html" > < span class = "kw" > < div< / span > < span class = "ot" > id=< / span > < span class = "st" > " plugin_zone_end_picwall" < / span > < span class = "ot" > class=< / span > < span class = "st" > " plugin_zone" < / span > < span class = "kw" > > < / span >
2015-07-22 05:02:10 +02:00
{loop=" $plugin_end_zone" }
{$value}
{/loop}
2016-04-14 14:20:23 +02:00
< span class = "kw" > < /div> < / span > < / code > < / pre > < / div >
2015-07-22 05:02:10 +02:00
< / body >
< / html >