aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/Plugin-System.html
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-07-22 05:02:10 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-08-04 16:02:21 +0200
commit992af0b9d77cb4fbac2c37ef8d5896042d67a2a3 (patch)
tree4726baf18e7057eac3f9b6bdb5991fe6117814fc /doc/Plugin-System.html
parent96db105e4c0833324f7168edb5673278de8ccd54 (diff)
downloadShaarli-992af0b9d77cb4fbac2c37ef8d5896042d67a2a3.tar.gz
Shaarli-992af0b9d77cb4fbac2c37ef8d5896042d67a2a3.tar.zst
Shaarli-992af0b9d77cb4fbac2c37ef8d5896042d67a2a3.zip
Doc: sync from Wiki, generate HTML
Closes #291 Fixes #227 Modifications - HTML content: match the new Wiki structure - Makefile - generate a custom HTML sidebar - include the sidebar on all pages - infer and prepend page titles - handle relative links - add title metadata, e.g. Shaarli - <Page Name> Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'doc/Plugin-System.html')
-rw-r--r--doc/Plugin-System.html499
1 files changed, 499 insertions, 0 deletions
diff --git a/doc/Plugin-System.html b/doc/Plugin-System.html
new file mode 100644
index 00000000..6d08d859
--- /dev/null
+++ b/doc/Plugin-System.html
@@ -0,0 +1,499 @@
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="utf-8">
5 <meta name="generator" content="pandoc">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
7 <title>Shaarli - Plugin System</title>
8 <style type="text/css">code{white-space: pre;}</style>
9 <!--[if lt IE 9]>
10 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <style type="text/css">
13table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
14 margin: 0; padding: 0; vertical-align: baseline; border: none; }
15table.sourceCode { width: 100%; line-height: 100%; }
16td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
17td.sourceCode { padding-left: 5px; }
18code > span.kw { color: #007020; font-weight: bold; }
19code > span.dt { color: #902000; }
20code > span.dv { color: #40a070; }
21code > span.bn { color: #40a070; }
22code > span.fl { color: #40a070; }
23code > span.ch { color: #4070a0; }
24code > span.st { color: #4070a0; }
25code > span.co { color: #60a0b0; font-style: italic; }
26code > span.ot { color: #007020; }
27code > span.al { color: #ff0000; font-weight: bold; }
28code > span.fu { color: #06287e; }
29code > span.er { color: #ff0000; font-weight: bold; }
30 </style>
31 <link rel="stylesheet" href="github-markdown.css">
32</head>
33<body>
34<div id="local-sidebar">
35<ul>
36<li><a href="Home.html">Home</a></li>
37<li>Installation
38<ul>
39<li><a href="Server-requirements.html">Server requirements</a></li>
40<li><a href="Server-configuration.html">Server configuration</a></li>
41<li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
42</ul></li>
43<li><a href="Usage.html">Usage</a>
44<ul>
45<li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
46<li><a href="Firefox-share.html">Firefox share</a></li>
47<li><a href="RSS-feeds.html">RSS feeds</a></li>
48</ul></li>
49<li>How To
50<ul>
51<li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
52<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>
53<li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
54</ul></li>
55<li><a href="Troubleshooting.html">Troubleshooting</a></li>
56<li><a href="Development.html">Development</a>
57<ul>
58<li><a href="GnuPG-signature.html">GnuPG signature</a></li>
59<li><a href="Coding-guidelines.html">Coding guidelines</a></li>
60<li><a href="Directory-structure.html">Directory structure</a></li>
61<li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
62<li><a href="Plugin-System.html">Plugin System</a></li>
63<li><a href="Security.html">Security</a></li>
64<li><a href="Static-analysis.html">Static analysis</a></li>
65<li><a href="Theming.html">Theming</a></li>
66<li><a href="Unit-tests.html">Unit tests</a></li>
67</ul></li>
68<li>About
69<ul>
70<li><a href="FAQ.html">FAQ</a></li>
71<li><a href="Community-&amp;-Related-software.html">Community &amp; Related software</a></li>
72<li><a href="TODO.html">TODO</a></li>
73</ul></li>
74</ul>
75</div>
76<h1 id="plugin-system">Plugin System</h1>
77<blockquote>
78<p>Note: Plugin current status - in developpement (not merged into master).</p>
79</blockquote>
80<p><a href="#plugin-user-guide"><strong>I am a user.</strong> Plugin User Guide.</a><a href=".html"></a></p>
81<p><a href="#developper-api"><strong>I am a developper.</strong> Developper API.</a><a href=".html"></a></p>
82<p><a href="#guide-for-template-designer"><strong>I am a template designer.</strong> Guide for template designer.</a><a href=".html"></a></p>
83<h2 id="plugin-user-guide">Plugin User Guide</h2>
84<h3 id="manage-plugins">Manage plugins</h3>
85<p>In <code>config.php</code>, change $GLOBALS<a href="&#39;ENABLED_PLUGINS&#39;]-array:.html">'config'['ENABLED_PLUGINS'] array:</a></p>
86<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ENABLED_PLUGINS&#39;</span><span class="ot">]](</span><span class="st">&#39;ENABLED_PLUGINS&#39;</span><span class="ot">]</span>.html<span class="ot">)</span></code></pre>
87<p>Full list:</p>
88<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ENABLED_PLUGINS&#39;</span><span class="ot">]</span> = <span class="fu">array</span><span class="ot">(](</span><span class="st">&#39;ENABLED_PLUGINS&#39;</span><span class="ot">]</span>-=-<span class="fu">array</span><span class="ot">(</span>.html<span class="ot">)</span>
89 <span class="st">&#39;qrcode&#39;</span><span class="ot">,</span> <span class="st">&#39;archiveorg&#39;</span><span class="ot">,</span> <span class="st">&#39;readityourself&#39;</span><span class="ot">,</span> <span class="st">&#39;playvideos&#39;</span><span class="ot">,</span>
90 <span class="st">&#39;wallabag&#39;</span><span class="ot">,</span> <span class="st">&#39;markdown&#39;</span><span class="ot">,</span> <span class="st">&#39;addlink_toolbar&#39;</span><span class="ot">,</span>
91<span class="ot">);</span></code></pre>
92<h3 id="list-of-plugins">List of plugins</h3>
93<p>Plugin maintained by the community:</p>
94<ul>
95<li>Archive.org - add a clickable icon to every link to archive.org.</li>
96<li>Addlink in toolbar - add a field to paste new links URL in toolbar.</li>
97<li>Markdown - write and display Shaare in Markdown.</li>
98<li>Play videos - popup to play all videos displayed in linklist.</li>
99<li>QRCode - add a clickable icon generating a QRCode for every link.</li>
100<li>ReadItYourself - add a clickable icon for ReadItYourself.</li>
101<li>Wallabag - add a clickable icon for Wallabag.</li>
102</ul>
103<h2 id="developper-api">Developper API</h2>
104<h3 id="what-can-i-do-with-plugins">What can I do with plugins?</h3>
105<p>The plugin system let you:</p>
106<ul>
107<li>insert content into specific places across templates.</li>
108<li>alter data before templates rendering.</li>
109<li>alter data before saving new links.</li>
110</ul>
111<h3 id="how-can-i-create-a-plugin-for-shaarli">How can I create a plugin for Shaarli?</h3>
112<p>First, chose a plugin name, such as <code>demo_plugin</code>.</p>
113<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>
114<p>You should have the following tree view:</p>
115<pre><code>| index.php
116| plugins/
117|---| demo_plugin/
118| |---| demo_plugin.php</code></pre>
119<h3 id="understanding-hooks">Understanding hooks</h3>
120<p>A plugin is a set of functions. Each function will be triggered by the plugin system at certain point in Shaarli execution.</p>
121<p>These functions need to be named with this pattern:</p>
122<pre><code>hook_&lt;plugin_name&gt;_&lt;hook_name&gt;</code></pre>
123<p>For exemple, if my plugin want to add data to the header, this function is needed:</p>
124<pre><code>hook_demo_plugin_render_header()</code></pre>
125<p>If this function is declared, and the plugin enabled, it will be called every time Shaarli is rendering the header.</p>
126<h3 id="plugins-data">Plugin's data</h3>
127<h4 id="parameters">Parameters</h4>
128<p>Every hook function has a <code>$data</code> parameter. Its content differs for each hooks.</p>
129<p><strong>This parameter needs to be returned every time</strong>, otherwise data is lost.</p>
130<pre><code>return $data;</code></pre>
131<h4 id="filling-templates-placeholder">Filling templates placeholder</h4>
132<p>Template placeholders are displayed in template in specific places.</p>
133<p>RainTPL displays every element contained in the placeholder's array. These element can be added by plugins.</p>
134<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>
135<pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$data</span><span class="ot">[</span><span class="st">&#39;top_placeholder&#39;</span><span class="ot">[]</span> = <span class="st">&#39;My content&#39;</span><span class="ot">;](]</span>-=-<span class="st">&#39;My-content&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
136<span class="co"># OR</span>
137<span class="fu">array_push</span><span class="ot">(</span><span class="kw">$data</span><span class="ot">[</span><span class="st">&#39;top_placeholder&#39;</span><span class="ot">],</span> <span class="st">&#39;My&#39;</span><span class="ot">,</span> <span class="st">&#39;content&#39;</span><span class="ot">);[](</span>.html<span class="ot">)</span>
138
139<span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre>
140<h4 id="data-manipulation">Data manipulation</h4>
141<p>When a page is displayed, every variable send to the template engine is passed to plugins before that in <code>$data</code>.</p>
142<p>The data contained by this array can be altered before template rendering.</p>
143<p>For exemple, in linklist, it is possible to alter every title:</p>
144<pre class="sourceCode php"><code class="sourceCode php"><span class="co">// mind the reference if you want $data to be altered</span>
145<span class="kw">foreach</span> <span class="ot">(</span><span class="kw">$data</span><span class="ot">[</span><span class="st">&#39;links&#39;</span><span class="ot">]</span> <span class="kw">as</span> &amp;<span class="kw">$value</span><span class="ot">)</span> {<span class="ot">[](</span>.html<span class="ot">)</span>
146 <span class="co">// String reverse every title.</span>
147 <span class="kw">$value</span><span class="ot">[</span><span class="st">&#39;title&#39;</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">&#39;title&#39;</span><span class="ot">]);[](</span>.html<span class="ot">)</span>
148}
149
150<span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre>
151<h3 id="its-not-working">It's not working!</h3>
152<p>Use <code>demo_plugin</code> as a functional example. It covers most of the plugin system features.</p>
153<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>
154<h3 id="hooks">Hooks</h3>
155<table>
156<thead>
157<tr class="header">
158<th style="text-align: left;">Hooks</th>
159<th style="text-align: center;">Description</th>
160</tr>
161</thead>
162<tbody>
163<tr class="odd">
164<td style="text-align: left;"><a href="#render_header">render_header</a></td>
165<td style="text-align: center;">Allow plugin to add content in page headers.</td>
166</tr>
167<tr class="even">
168<td style="text-align: left;"><a href="#render_includes">render_includes</a></td>
169<td style="text-align: center;">Allow plugin to include their own CSS files.</td>
170</tr>
171<tr class="odd">
172<td style="text-align: left;"><a href="#render_footer">render_footer</a></td>
173<td style="text-align: center;">Allow plugin to add content in page footer and include their own JS files.</td>
174</tr>
175<tr class="even">
176<td style="text-align: left;"><a href="#render_linklist">render_linklist</a></td>
177<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>
178</tr>
179<tr class="odd">
180<td style="text-align: left;"><a href="#render_editlink">render_editlink</a></td>
181<td style="text-align: center;">Allow to add fields in the form, or display elements.</td>
182</tr>
183<tr class="even">
184<td style="text-align: left;"><a href="#render_tools">render_tools</a></td>
185<td style="text-align: center;">Allow to add content at the end of the page.</td>
186</tr>
187<tr class="odd">
188<td style="text-align: left;"><a href="#render_picwall">render_picwall</a></td>
189<td style="text-align: center;">Allow to add content at the top and bottom of the page.</td>
190</tr>
191<tr class="even">
192<td style="text-align: left;"><a href="#render_tagcloud">render_tagcloud</a></td>
193<td style="text-align: center;">Allow to add content at the top and bottom of the page.</td>
194</tr>
195<tr class="odd">
196<td style="text-align: left;"><a href="#render_daily">render_daily</a></td>
197<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>
198</tr>
199<tr class="even">
200<td style="text-align: left;"><a href="#savelink">savelink</a></td>
201<td style="text-align: center;">Allow to alter the link being saved in the datastore.</td>
202</tr>
203</tbody>
204</table>
205<h4 id="render_header">render_header</h4>
206<p>Triggered on every page.</p>
207<p>Allow plugin to add content in page headers.</p>
208<h5 id="data">Data</h5>
209<p><code>$data</code> is an array containing:</p>
210<ul>
211<li><code>_PAGE_</code>: current target page (eg: <code>linklist</code>, <code>picwall</code>, etc.).</li>
212<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
213</ul>
214<h5 id="template-placeholders">Template placeholders</h5>
215<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
216<p>List of placeholders:</p>
217<ul>
218<li><code>buttons_toolbar</code>: after the list of buttons in the header.</li>
219</ul>
220<p><img src="http://i.imgur.com/ssJUOrt.png" alt="buttons_toolbar_example" /><a href=".html"></a></p>
221<ul>
222<li><code>fields_toolbar</code>: after search fields in the header.</li>
223</ul>
224<blockquote>
225<p>Note: This will only be called in linklist.</p>
226</blockquote>
227<p><img src="http://i.imgur.com/3GMifI2.png" alt="fields_toolbar_example" /><a href=".html"></a></p>
228<h4 id="render_includes">render_includes</h4>
229<p>Triggered on every page.</p>
230<p>Allow plugin to include their own CSS files.</p>
231<h5 id="data-1">Data</h5>
232<p><code>$data</code> is an array containing:</p>
233<ul>
234<li><code>_PAGE_</code>: current target page (eg: <code>linklist</code>, <code>picwall</code>, etc.).</li>
235<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
236</ul>
237<h5 id="template-placeholders-1">Template placeholders</h5>
238<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
239<p>List of placeholders:</p>
240<ul>
241<li><code>css_files</code>: called after loading default CSS.</li>
242</ul>
243<blockquote>
244<p>Note: only add the path of the CSS file. E.g: <code>plugins/demo_plugin/custom_demo.css</code>.</p>
245</blockquote>
246<h4 id="render_footer">render_footer</h4>
247<p>Triggered on every page.</p>
248<p>Allow plugin to add content in page footer and include their own JS files.</p>
249<h5 id="data-2">Data</h5>
250<p><code>$data</code> is an array containing:</p>
251<ul>
252<li><code>_PAGE_</code>: current target page (eg: <code>linklist</code>, <code>picwall</code>, etc.).</li>
253<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
254</ul>
255<h5 id="template-placeholders-2">Template placeholders</h5>
256<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
257<p>List of placeholders:</p>
258<ul>
259<li><code>text</code>: called after the end of the footer text.</li>
260</ul>
261<p><img src="http://i.imgur.com/L5S2YEH.png" alt="text_example" /><a href=".html"></a></p>
262<ul>
263<li><code>js_files</code>: called at the end of the page, to include custom JS scripts.</li>
264</ul>
265<blockquote>
266<p>Note: only add the path of the JS file. E.g: <code>plugins/demo_plugin/custom_demo.js</code>.</p>
267</blockquote>
268<h4 id="render_linklist">render_linklist</h4>
269<p>Triggered when <code>linklist</code> is displayed (list of links, permalink, search, tag filtered, etc.).</p>
270<p>It allows to add content at the begining and end of the page, after every link displayed and to alter link data.</p>
271<h5 id="data-3">Data</h5>
272<p><code>$data</code> is an array containing:</p>
273<ul>
274<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
275<li>All templates data, including links.</li>
276</ul>
277<h5 id="template-placeholders-3">Template placeholders</h5>
278<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
279<p>List of placeholders:</p>
280<ul>
281<li><code>action_plugin</code>: next to the button &quot;private only&quot; at the top and bottom of the page.</li>
282</ul>
283<p><img src="http://i.imgur.com/Q12PWg0.png" alt="action_plugin_example" /><a href=".html"></a></p>
284<ul>
285<li><code>link_plugin</code>: for every link, between permalink and link URL.</li>
286</ul>
287<p><img src="http://i.imgur.com/3oDPhWx.png" alt="link_plugin_example" /><a href=".html"></a></p>
288<ul>
289<li><code>plugin_start_zone</code>: before displaying the template content.</li>
290</ul>
291<p><img src="http://i.imgur.com/OVBkGy3.png" alt="plugin_start_zone_example" /><a href=".html"></a></p>
292<ul>
293<li><code>plugin_end_zone</code>: after displaying the template content.</li>
294</ul>
295<p><img src="http://i.imgur.com/6IoRuop.png" alt="plugin_end_zone_example" /><a href=".html"></a></p>
296<h4 id="render_editlink">render_editlink</h4>
297<p>Triggered when the link edition form is displayed.</p>
298<p>Allow to add fields in the form, or display elements.</p>
299<h5 id="data-4">Data</h5>
300<p><code>$data</code> is an array containing:</p>
301<ul>
302<li>All templates data.</li>
303</ul>
304<h5 id="template-placeholders-4">Template placeholders</h5>
305<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
306<p>List of placeholders:</p>
307<ul>
308<li><code>edit_link_plugin</code>: after tags field.</li>
309</ul>
310<p><img src="http://i.imgur.com/5u17Ens.png" alt="edit_link_plugin_example" /><a href=".html"></a></p>
311<h4 id="render_tools">render_tools</h4>
312<p>Triggered when the &quot;tools&quot; page is displayed.</p>
313<p>Allow to add content at the end of the page.</p>
314<h5 id="data-5">Data</h5>
315<p><code>$data</code> is an array containing:</p>
316<ul>
317<li>All templates data.</li>
318</ul>
319<h5 id="template-placeholders-5">Template placeholders</h5>
320<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
321<p>List of placeholders:</p>
322<ul>
323<li><code>tools_plugin</code>: at the end of the page.</li>
324</ul>
325<p><img src="http://i.imgur.com/Bqhu9oQ.png" alt="tools_plugin_example" /><a href=".html"></a></p>
326<h4 id="render_picwall">render_picwall</h4>
327<p>Triggered when picwall is displayed.</p>
328<p>Allow to add content at the top and bottom of the page.</p>
329<h5 id="data-6">Data</h5>
330<p><code>$data</code> is an array containing:</p>
331<ul>
332<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
333<li>All templates data.</li>
334</ul>
335<h5 id="template-placeholders-6">Template placeholders</h5>
336<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
337<p>List of placeholders:</p>
338<ul>
339<li><p><code>plugin_start_zone</code>: before displaying the template content.</p></li>
340<li><p><code>plugin_end_zone</code>: after displaying the template content.</p></li>
341</ul>
342<p><img src="http://i.imgur.com/tVTQFER.png" alt="plugin_start_end_zone_example" /><a href=".html"></a></p>
343<h4 id="render_tagcloud">render_tagcloud</h4>
344<p>Triggered when tagcloud is displayed.</p>
345<p>Allow to add content at the top and bottom of the page.</p>
346<h5 id="data-7">Data</h5>
347<p><code>$data</code> is an array containing:</p>
348<ul>
349<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
350<li>All templates data.</li>
351</ul>
352<h5 id="template-placeholders-7">Template placeholders</h5>
353<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
354<p>List of placeholders:</p>
355<ul>
356<li><p><code>plugin_start_zone</code>: before displaying the template content.</p></li>
357<li><p><code>plugin_end_zone</code>: after displaying the template content.</p></li>
358</ul>
359<p><img src="http://i.imgur.com/vHmyT3a.png" alt="plugin_start_end_zone_example" /><a href=".html"></a></p>
360<h4 id="render_daily">render_daily</h4>
361<p>Triggered when tagcloud is displayed.</p>
362<p>Allow to add content at the top and bottom of the page, the bottom of each link and to alter data.</p>
363<h5 id="data-8">Data</h5>
364<p><code>$data</code> is an array containing:</p>
365<ul>
366<li><code>_LOGGEDIN_</code>: true if user is logged in, false otherwise.</li>
367<li>All templates data, including links.</li>
368</ul>
369<h5 id="template-placeholders-8">Template placeholders</h5>
370<p>Items can be displayed in templates by adding an entry in <code>$data['&lt;placeholder&gt;']</code> array.<a href=".html"></a></p>
371<p>List of placeholders:</p>
372<ul>
373<li><code>link_plugin</code>: used at bottom of each link.</li>
374</ul>
375<p><img src="http://i.imgur.com/hzhMfSZ.png" alt="link_plugin_example" /><a href=".html"></a></p>
376<ul>
377<li><p><code>plugin_start_zone</code>: before displaying the template content.</p></li>
378<li><p><code>plugin_end_zone</code>: after displaying the template content.</p></li>
379</ul>
380<h4 id="savelink">savelink</h4>
381<p>Triggered when a link is save (new link or edit).</p>
382<p>Allow to alter the link being saved in the datastore.</p>
383<h5 id="data-9">Data</h5>
384<p><code>$data</code> is an array containing the link being saved:</p>
385<ul>
386<li>title</li>
387<li>url</li>
388<li>description</li>
389<li>linkdate</li>
390<li>private</li>
391<li>tags</li>
392</ul>
393<h2 id="guide-for-template-designer">Guide for template designer</h2>
394<h3 id="placeholder-system">Placeholder system</h3>
395<p>In order to make plugins work with every custom themes, you need to add variable placeholder in your templates.</p>
396<p>It's a RainTPL loop like this:</p>
397<pre><code>{loop=&quot;$plugin_variable&quot;}
398 {$value}
399{/loop}</code></pre>
400<p>You should enable <code>demo_plugin</code> for testing purpose, since it uses every placeholder available.</p>
401<h3 id="list-of-placeholders">List of placeholders</h3>
402<p><strong>page.header.html</strong></p>
403<p>At the end of the menu:</p>
404<pre><code>{loop=&quot;$plugins_header.buttons_toolbar&quot;}
405 {$value}
406{/loop}</code></pre>
407<p><strong>includes.html</strong></p>
408<p>At the end of the file:</p>
409<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$plugins_includes.css_files&quot;}
410<span class="kw">&lt;link</span><span class="ot"> type=</span><span class="st">&quot;text/css&quot;</span><span class="ot"> rel=</span><span class="st">&quot;stylesheet&quot;</span><span class="ot"> href=</span><span class="st">&quot;{$value}#&quot;</span><span class="kw">/&gt;</span>
411{/loop}</code></pre>
412<p><strong>page.footer.html</strong></p>
413<p>At the end of your footer notes:</p>
414<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$plugins_footer.text&quot;}
415 {$value}
416{/loop}</code></pre>
417<p>At the end of file:</p>
418<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$plugins_footer.js_files&quot;}
419 <span class="kw">&lt;script</span><span class="ot"> src=</span><span class="st">&quot;{$value}#&quot;</span><span class="kw">&gt;&lt;/script&gt;</span>
420{/loop}</code></pre>
421<p><strong>linklist.html</strong></p>
422<p>After search fields:</p>
423<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$plugins_header.fields_toolbar&quot;}
424 {$value}
425{/loop}</code></pre>
426<p>Before displaying the link list (after paging):</p>
427<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$plugin_start_zone&quot;}
428 {$value}
429{/loop}</code></pre>
430<p>For every links (icons):</p>
431<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$value.link_plugin&quot;}
432 <span class="kw">&lt;span&gt;</span>{$value}<span class="kw">&lt;/span&gt;</span>
433{/loop}</code></pre>
434<p>Before end paging:</p>
435<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$plugin_end_zone&quot;}
436 {$value}
437{/loop}</code></pre>
438<p><strong>linklist.paging.html</strong></p>
439<p>After the &quot;private only&quot; icon:</p>
440<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$action_plugin&quot;}
441 {$value}
442{/loop}</code></pre>
443<p><strong>editlink.html</strong></p>
444<p>After tags field:</p>
445<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$edit_link_plugin&quot;}
446 {$value}
447{/loop}</code></pre>
448<p><strong>tools.html</strong></p>
449<p>After the last tool:</p>
450<pre class="sourceCode html"><code class="sourceCode html">{loop=&quot;$tools_plugin&quot;}
451 {$value}
452{/loop}</code></pre>
453<p><strong>picwall.html</strong></p>
454<p>Top:</p>
455<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;plugin_zone_start_picwall&quot;</span><span class="ot"> class=</span><span class="st">&quot;plugin_zone&quot;</span><span class="kw">&gt;</span>
456 {loop=&quot;$plugin_start_zone&quot;}
457 {$value}
458 {/loop}
459<span class="kw">&lt;/div&gt;</span></code></pre>
460<p>Bottom:</p>
461<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;plugin_zone_end_picwall&quot;</span><span class="ot"> class=</span><span class="st">&quot;plugin_zone&quot;</span><span class="kw">&gt;</span>
462 {loop=&quot;$plugin_end_zone&quot;}
463 {$value}
464 {/loop}
465<span class="kw">&lt;/div&gt;</span></code></pre>
466<p><strong>tagcloud.html</strong></p>
467<p>Top:</p>
468<pre class="sourceCode html"><code class="sourceCode html"> <span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;plugin_zone_start_tagcloud&quot;</span><span class="ot"> class=</span><span class="st">&quot;plugin_zone&quot;</span><span class="kw">&gt;</span>
469 {loop=&quot;$plugin_start_zone&quot;}
470 {$value}
471 {/loop}
472 <span class="kw">&lt;/div&gt;</span></code></pre>
473<p>Bottom:</p>
474<pre class="sourceCode html"><code class="sourceCode html"> <span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;plugin_zone_end_tagcloud&quot;</span><span class="ot"> class=</span><span class="st">&quot;plugin_zone&quot;</span><span class="kw">&gt;</span>
475 {loop=&quot;$plugin_end_zone&quot;}
476 {$value}
477 {/loop}
478 <span class="kw">&lt;/div&gt;</span></code></pre>
479<p><strong>daily.html</strong></p>
480<p>Top:</p>
481<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;plugin_zone_start_picwall&quot;</span><span class="ot"> class=</span><span class="st">&quot;plugin_zone&quot;</span><span class="kw">&gt;</span>
482 {loop=&quot;$plugin_start_zone&quot;}
483 {$value}
484 {/loop}
485<span class="kw">&lt;/div&gt;</span></code></pre>
486<p>After every link:</p>
487<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;div</span><span class="ot"> class=</span><span class="st">&quot;dailyEntryFooter&quot;</span><span class="kw">&gt;</span>
488 {loop=&quot;$link.link_plugin&quot;}
489 {$value}
490 {/loop}
491<span class="kw">&lt;/div&gt;</span></code></pre>
492<p>Bottom:</p>
493<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;div</span><span class="ot"> id=</span><span class="st">&quot;plugin_zone_end_picwall&quot;</span><span class="ot"> class=</span><span class="st">&quot;plugin_zone&quot;</span><span class="kw">&gt;</span>
494 {loop=&quot;$plugin_end_zone&quot;}
495 {$value}
496 {/loop}
497<span class="kw">&lt;/div&gt;</span></code></pre>
498</body>
499</html>