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