diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-04-14 14:20:23 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-04-14 15:18:25 +0200 |
commit | 5409ade28c5f0acf99dbadd4d95e6f8efda5d395 (patch) | |
tree | 4c8b55010ad02d91b524b0cb8cc02ddf318fcaa2 /doc/Plugin-System.html | |
parent | 9f400b0dad68b82d65692bd6ab6190f6a787fa89 (diff) | |
download | Shaarli-5409ade28c5f0acf99dbadd4d95e6f8efda5d395.tar.gz Shaarli-5409ade28c5f0acf99dbadd4d95e6f8efda5d395.tar.zst Shaarli-5409ade28c5f0acf99dbadd4d95e6f8efda5d395.zip |
Update docs from Wiki
Diffstat (limited to 'doc/Plugin-System.html')
-rw-r--r-- | doc/Plugin-System.html | 222 |
1 files changed, 132 insertions, 90 deletions
diff --git a/doc/Plugin-System.html b/doc/Plugin-System.html index cb1cb746..2a660c49 100644 --- a/doc/Plugin-System.html +++ b/doc/Plugin-System.html | |||
@@ -4,31 +4,49 @@ | |||
4 | <meta charset="utf-8"> | 4 | <meta charset="utf-8"> |
5 | <meta name="generator" content="pandoc"> | 5 | <meta name="generator" content="pandoc"> |
6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> |
7 | <title>Shaarli - Plugin System</title> | 7 | <title>Shaarli – Plugin System</title> |
8 | <style type="text/css">code{white-space: pre;}</style> | 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"> | 9 | <style type="text/css"> |
10 | div.sourceCode { overflow-x: auto; } | ||
13 | table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { | 11 | table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { |
14 | margin: 0; padding: 0; vertical-align: baseline; border: none; } | 12 | margin: 0; padding: 0; vertical-align: baseline; border: none; } |
15 | table.sourceCode { width: 100%; line-height: 100%; } | 13 | 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; } | 14 | td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } |
17 | td.sourceCode { padding-left: 5px; } | 15 | td.sourceCode { padding-left: 5px; } |
18 | code > span.kw { color: #007020; font-weight: bold; } | 16 | code > span.kw { color: #007020; font-weight: bold; } /* Keyword */ |
19 | code > span.dt { color: #902000; } | 17 | code > span.dt { color: #902000; } /* DataType */ |
20 | code > span.dv { color: #40a070; } | 18 | code > span.dv { color: #40a070; } /* DecVal */ |
21 | code > span.bn { color: #40a070; } | 19 | code > span.bn { color: #40a070; } /* BaseN */ |
22 | code > span.fl { color: #40a070; } | 20 | code > span.fl { color: #40a070; } /* Float */ |
23 | code > span.ch { color: #4070a0; } | 21 | code > span.ch { color: #4070a0; } /* Char */ |
24 | code > span.st { color: #4070a0; } | 22 | code > span.st { color: #4070a0; } /* String */ |
25 | code > span.co { color: #60a0b0; font-style: italic; } | 23 | code > span.co { color: #60a0b0; font-style: italic; } /* Comment */ |
26 | code > span.ot { color: #007020; } | 24 | code > span.ot { color: #007020; } /* Other */ |
27 | code > span.al { color: #ff0000; font-weight: bold; } | 25 | code > span.al { color: #ff0000; font-weight: bold; } /* Alert */ |
28 | code > span.fu { color: #06287e; } | 26 | code > span.fu { color: #06287e; } /* Function */ |
29 | code > span.er { color: #ff0000; font-weight: bold; } | 27 | code > span.er { color: #ff0000; font-weight: bold; } /* Error */ |
28 | code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ | ||
29 | code > span.cn { color: #880000; } /* Constant */ | ||
30 | code > span.sc { color: #4070a0; } /* SpecialChar */ | ||
31 | code > span.vs { color: #4070a0; } /* VerbatimString */ | ||
32 | code > span.ss { color: #bb6688; } /* SpecialString */ | ||
33 | code > span.im { } /* Import */ | ||
34 | code > span.va { color: #19177c; } /* Variable */ | ||
35 | code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ | ||
36 | code > span.op { color: #666666; } /* Operator */ | ||
37 | code > span.bu { } /* BuiltIn */ | ||
38 | code > span.ex { } /* Extension */ | ||
39 | code > span.pp { color: #bc7a00; } /* Preprocessor */ | ||
40 | code > span.at { color: #7d9029; } /* Attribute */ | ||
41 | code > span.do { color: #ba2121; font-style: italic; } /* Documentation */ | ||
42 | code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ | ||
43 | code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ | ||
44 | code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ | ||
30 | </style> | 45 | </style> |
31 | <link rel="stylesheet" href="github-markdown.css"> | 46 | <link rel="stylesheet" href="github-markdown.css"> |
47 | <!--[if lt IE 9]> | ||
48 | <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> | ||
49 | <![endif]--> | ||
32 | </head> | 50 | </head> |
33 | <body> | 51 | <body> |
34 | <div id="local-sidebar"> | 52 | <div id="local-sidebar"> |
@@ -39,18 +57,26 @@ code > span.er { color: #ff0000; font-weight: bold; } | |||
39 | <li><a href="Download.html">Download</a></li> | 57 | <li><a href="Download.html">Download</a></li> |
40 | <li><a href="Server-requirements.html">Server requirements</a></li> | 58 | <li><a href="Server-requirements.html">Server requirements</a></li> |
41 | <li><a href="Server-configuration.html">Server configuration</a></li> | 59 | <li><a href="Server-configuration.html">Server configuration</a></li> |
60 | <li><a href="Server-security.html">Server security</a></li> | ||
61 | <li><a href="Shaarli-installation.html">Shaarli installation</a></li> | ||
42 | <li><a href="Shaarli-configuration.html">Shaarli configuration</a></li> | 62 | <li><a href="Shaarli-configuration.html">Shaarli configuration</a></li> |
63 | <li><a href="Plugin-installation-&-configuration.html">Plugin installation & configuration</a></li> | ||
43 | </ul></li> | 64 | </ul></li> |
65 | <li><a href="Docker.html">Docker</a></li> | ||
66 | <li><a href="Plugin-list.html">Plugin list</a></li> | ||
44 | <li><a href="Usage.html">Usage</a> | 67 | <li><a href="Usage.html">Usage</a> |
45 | <ul> | 68 | <ul> |
46 | <li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li> | 69 | <li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li> |
70 | <li><a href="Browsing-and-Searching.html">Browsing and Searching</a></li> | ||
47 | <li><a href="Firefox-share.html">Firefox share</a></li> | 71 | <li><a href="Firefox-share.html">Firefox share</a></li> |
48 | <li><a href="RSS-feeds.html">RSS feeds</a></li> | 72 | <li><a href="RSS-feeds.html">RSS feeds</a></li> |
49 | </ul></li> | 73 | </ul></li> |
50 | <li>How To | 74 | <li>How To |
51 | <ul> | 75 | <ul> |
52 | <li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li> | 76 | <li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li> |
77 | <li><a href="Upgrade-from-original-sebsauvage/Shaarli.html">Upgrade from original sebsauvage/Shaarli</a></li> | ||
53 | <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> | 78 | <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> |
79 | <li><a href="Create-and-serve-multiple-Shaarlis-(farm).html">Create and serve multiple Shaarlis (farm)</a></li> | ||
54 | <li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li> | 80 | <li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li> |
55 | <li><a href="Datastore-hacks.html">Datastore hacks</a></li> | 81 | <li><a href="Datastore-hacks.html">Datastore hacks</a></li> |
56 | </ul></li> | 82 | </ul></li> |
@@ -62,6 +88,7 @@ code > span.er { color: #ff0000; font-weight: bold; } | |||
62 | <li><a href="Directory-structure.html">Directory structure</a></li> | 88 | <li><a href="Directory-structure.html">Directory structure</a></li> |
63 | <li><a href="3rd-party-libraries.html">3rd party libraries</a></li> | 89 | <li><a href="3rd-party-libraries.html">3rd party libraries</a></li> |
64 | <li><a href="Plugin-System.html">Plugin System</a></li> | 90 | <li><a href="Plugin-System.html">Plugin System</a></li> |
91 | <li><a href="Release-Shaarli.html">Release Shaarli</a></li> | ||
65 | <li><a href="Security.html">Security</a></li> | 92 | <li><a href="Security.html">Security</a></li> |
66 | <li><a href="Static-analysis.html">Static analysis</a></li> | 93 | <li><a href="Static-analysis.html">Static analysis</a></li> |
67 | <li><a href="Theming.html">Theming</a></li> | 94 | <li><a href="Theming.html">Theming</a></li> |
@@ -77,32 +104,11 @@ code > span.er { color: #ff0000; font-weight: bold; } | |||
77 | </div> | 104 | </div> |
78 | <h1 id="plugin-system">Plugin System</h1> | 105 | <h1 id="plugin-system">Plugin System</h1> |
79 | <blockquote> | 106 | <blockquote> |
80 | <p>Note: Plugin current status - in developpement (not merged into master).</p> | 107 | <p>Note: Plugin current status - in development (not merged into master).</p> |
81 | </blockquote> | 108 | </blockquote> |
82 | <p><a href="#plugin-user-guide"><strong>I am a user.</strong> Plugin User Guide.</a><a href=".html"></a></p> | 109 | <p><a href="#developer-api"><strong>I am a developer.</strong> Developer API.</a><a href=".html"></a></p> |
83 | <p><a href="#developper-api"><strong>I am a developper.</strong> Developper API.</a><a href=".html"></a></p> | ||
84 | <p><a href="#guide-for-template-designer"><strong>I am a template designer.</strong> Guide for template designer.</a><a href=".html"></a></p> | 110 | <p><a href="#guide-for-template-designer"><strong>I am a template designer.</strong> Guide for template designer.</a><a href=".html"></a></p> |
85 | <h2 id="plugin-user-guide">Plugin User Guide</h2> | 111 | <h2 id="developer-api">Developer API</h2> |
86 | <h3 id="manage-plugins">Manage plugins</h3> | ||
87 | <p>In <code>config.php</code>, change $GLOBALS<a href="'ENABLED_PLUGINS']-array:.html">'config'['ENABLED_PLUGINS'] array:</a></p> | ||
88 | <pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]](</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]</span>.html<span class="ot">)</span></code></pre> | ||
89 | <p>Full list:</p> | ||
90 | <pre class="sourceCode php"><code class="sourceCode php"><span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">'config'</span><span class="ot">[</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]</span> = <span class="fu">array</span><span class="ot">(](</span><span class="st">'ENABLED_PLUGINS'</span><span class="ot">]</span>-=-<span class="fu">array</span><span class="ot">(</span>.html<span class="ot">)</span> | ||
91 | <span class="st">'qrcode'</span><span class="ot">,</span> <span class="st">'archiveorg'</span><span class="ot">,</span> <span class="st">'readityourself'</span><span class="ot">,</span> <span class="st">'playvideos'</span><span class="ot">,</span> | ||
92 | <span class="st">'wallabag'</span><span class="ot">,</span> <span class="st">'markdown'</span><span class="ot">,</span> <span class="st">'addlink_toolbar'</span><span class="ot">,</span> | ||
93 | <span class="ot">);</span></code></pre> | ||
94 | <h3 id="list-of-plugins">List of plugins</h3> | ||
95 | <p>Plugin maintained by the community:</p> | ||
96 | <ul> | ||
97 | <li>Archive.org - add a clickable icon to every link to archive.org.</li> | ||
98 | <li>Addlink in toolbar - add a field to paste new links URL in toolbar.</li> | ||
99 | <li>Markdown - write and display Shaare in Markdown.</li> | ||
100 | <li>Play videos - popup to play all videos displayed in linklist.</li> | ||
101 | <li>QRCode - add a clickable icon generating a QRCode for every link.</li> | ||
102 | <li>ReadItYourself - add a clickable icon for ReadItYourself.</li> | ||
103 | <li>Wallabag - add a clickable icon for Wallabag.</li> | ||
104 | </ul> | ||
105 | <h2 id="developper-api">Developper API</h2> | ||
106 | <h3 id="what-can-i-do-with-plugins">What can I do with plugins?</h3> | 112 | <h3 id="what-can-i-do-with-plugins">What can I do with plugins?</h3> |
107 | <p>The plugin system let you:</p> | 113 | <p>The plugin system let you:</p> |
108 | <ul> | 114 | <ul> |
@@ -134,72 +140,86 @@ code > span.er { color: #ff0000; font-weight: bold; } | |||
134 | <p>Template placeholders are displayed in template in specific places.</p> | 140 | <p>Template placeholders are displayed in template in specific places.</p> |
135 | <p>RainTPL displays every element contained in the placeholder's array. These element can be added by plugins.</p> | 141 | <p>RainTPL displays every element contained in the placeholder's array. These element can be added by plugins.</p> |
136 | <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> | 142 | <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> |
137 | <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> | 143 | <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> |
138 | <span class="co"># OR</span> | 144 | <span class="co"># OR</span> |
139 | <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> | 145 | <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> |
140 | 146 | ||
141 | <span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre> | 147 | <span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre></div> |
142 | <h4 id="data-manipulation">Data manipulation</h4> | 148 | <h4 id="data-manipulation">Data manipulation</h4> |
143 | <p>When a page is displayed, every variable send to the template engine is passed to plugins before that in <code>$data</code>.</p> | 149 | <p>When a page is displayed, every variable send to the template engine is passed to plugins before that in <code>$data</code>.</p> |
144 | <p>The data contained by this array can be altered before template rendering.</p> | 150 | <p>The data contained by this array can be altered before template rendering.</p> |
145 | <p>For exemple, in linklist, it is possible to alter every title:</p> | 151 | <p>For exemple, in linklist, it is possible to alter every title:</p> |
146 | <pre class="sourceCode php"><code class="sourceCode php"><span class="co">// mind the reference if you want $data to be altered</span> | 152 | <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> |
147 | <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> | 153 | <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> |
148 | <span class="co">// String reverse every title.</span> | 154 | <span class="co">// String reverse every title.</span> |
149 | <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> | 155 | <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> |
150 | } | 156 | } |
151 | 157 | ||
152 | <span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre> | 158 | <span class="kw">return</span> <span class="kw">$data</span><span class="ot">;</span></code></pre></div> |
159 | <h3 id="metadata">Metadata</h3> | ||
160 | <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> | ||
161 | <p>Each file contain two keys:</p> | ||
162 | <ul> | ||
163 | <li><code>description</code>: plugin description</li> | ||
164 | <li><code>parameters</code>: user parameter names, separated by a <code>;</code>.</li> | ||
165 | </ul> | ||
166 | <blockquote> | ||
167 | <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> | ||
168 | </blockquote> | ||
153 | <h3 id="its-not-working">It's not working!</h3> | 169 | <h3 id="its-not-working">It's not working!</h3> |
154 | <p>Use <code>demo_plugin</code> as a functional example. It covers most of the plugin system features.</p> | 170 | <p>Use <code>demo_plugin</code> as a functional example. It covers most of the plugin system features.</p> |
155 | <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> | 171 | <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> |
156 | <h3 id="hooks">Hooks</h3> | 172 | <h3 id="hooks">Hooks</h3> |
157 | <table> | 173 | <table style="width:42%;"> |
174 | <colgroup> | ||
175 | <col style="width: 19%" /> | ||
176 | <col style="width: 22%" /> | ||
177 | </colgroup> | ||
158 | <thead> | 178 | <thead> |
159 | <tr class="header"> | 179 | <tr class="header"> |
160 | <th style="text-align: left;">Hooks</th> | 180 | <th>Hooks</th> |
161 | <th style="text-align: center;">Description</th> | 181 | <th style="text-align: center;">Description</th> |
162 | </tr> | 182 | </tr> |
163 | </thead> | 183 | </thead> |
164 | <tbody> | 184 | <tbody> |
165 | <tr class="odd"> | 185 | <tr class="odd"> |
166 | <td style="text-align: left;"><a href="#render_header">render_header</a></td> | 186 | <td><a href="#render_header">render_header</a></td> |
167 | <td style="text-align: center;">Allow plugin to add content in page headers.</td> | 187 | <td style="text-align: center;">Allow plugin to add content in page headers.</td> |
168 | </tr> | 188 | </tr> |
169 | <tr class="even"> | 189 | <tr class="even"> |
170 | <td style="text-align: left;"><a href="#render_includes">render_includes</a></td> | 190 | <td><a href="#render_includes">render_includes</a></td> |
171 | <td style="text-align: center;">Allow plugin to include their own CSS files.</td> | 191 | <td style="text-align: center;">Allow plugin to include their own CSS files.</td> |
172 | </tr> | 192 | </tr> |
173 | <tr class="odd"> | 193 | <tr class="odd"> |
174 | <td style="text-align: left;"><a href="#render_footer">render_footer</a></td> | 194 | <td><a href="#render_footer">render_footer</a></td> |
175 | <td style="text-align: center;">Allow plugin to add content in page footer and include their own JS files.</td> | 195 | <td style="text-align: center;">Allow plugin to add content in page footer and include their own JS files.</td> |
176 | </tr> | 196 | </tr> |
177 | <tr class="even"> | 197 | <tr class="even"> |
178 | <td style="text-align: left;"><a href="#render_linklist">render_linklist</a></td> | 198 | <td><a href="#render_linklist">render_linklist</a></td> |
179 | <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> | 199 | <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> |
180 | </tr> | 200 | </tr> |
181 | <tr class="odd"> | 201 | <tr class="odd"> |
182 | <td style="text-align: left;"><a href="#render_editlink">render_editlink</a></td> | 202 | <td><a href="#render_editlink">render_editlink</a></td> |
183 | <td style="text-align: center;">Allow to add fields in the form, or display elements.</td> | 203 | <td style="text-align: center;">Allow to add fields in the form, or display elements.</td> |
184 | </tr> | 204 | </tr> |
185 | <tr class="even"> | 205 | <tr class="even"> |
186 | <td style="text-align: left;"><a href="#render_tools">render_tools</a></td> | 206 | <td><a href="#render_tools">render_tools</a></td> |
187 | <td style="text-align: center;">Allow to add content at the end of the page.</td> | 207 | <td style="text-align: center;">Allow to add content at the end of the page.</td> |
188 | </tr> | 208 | </tr> |
189 | <tr class="odd"> | 209 | <tr class="odd"> |
190 | <td style="text-align: left;"><a href="#render_picwall">render_picwall</a></td> | 210 | <td><a href="#render_picwall">render_picwall</a></td> |
191 | <td style="text-align: center;">Allow to add content at the top and bottom of the page.</td> | 211 | <td style="text-align: center;">Allow to add content at the top and bottom of the page.</td> |
192 | </tr> | 212 | </tr> |
193 | <tr class="even"> | 213 | <tr class="even"> |
194 | <td style="text-align: left;"><a href="#render_tagcloud">render_tagcloud</a></td> | 214 | <td><a href="#render_tagcloud">render_tagcloud</a></td> |
195 | <td style="text-align: center;">Allow to add content at the top and bottom of the page.</td> | 215 | <td style="text-align: center;">Allow to add content at the top and bottom of the page.</td> |
196 | </tr> | 216 | </tr> |
197 | <tr class="odd"> | 217 | <tr class="odd"> |
198 | <td style="text-align: left;"><a href="#render_daily">render_daily</a></td> | 218 | <td><a href="#render_daily">render_daily</a></td> |
199 | <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> | 219 | <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> |
200 | </tr> | 220 | </tr> |
201 | <tr class="even"> | 221 | <tr class="even"> |
202 | <td style="text-align: left;"><a href="#savelink">savelink</a></td> | 222 | <td><a href="#savelink">savelink</a></td> |
203 | <td style="text-align: center;">Allow to alter the link being saved in the datastore.</td> | 223 | <td style="text-align: center;">Allow to alter the link being saved in the datastore.</td> |
204 | </tr> | 224 | </tr> |
205 | </tbody> | 225 | </tbody> |
@@ -393,6 +413,20 @@ code > span.er { color: #ff0000; font-weight: bold; } | |||
393 | <li>tags</li> | 413 | <li>tags</li> |
394 | </ul> | 414 | </ul> |
395 | <h2 id="guide-for-template-designer">Guide for template designer</h2> | 415 | <h2 id="guide-for-template-designer">Guide for template designer</h2> |
416 | <h3 id="plugin-administration">Plugin administration</h3> | ||
417 | <p>Your theme must include a plugin administration page: <code>pluginsadmin.html</code>.</p> | ||
418 | <blockquote> | ||
419 | <p>Note: repo's template link needs to be added when the PR is merged.</p> | ||
420 | </blockquote> | ||
421 | <p>Use the default one as an example.</p> | ||
422 | <p>Aside from classic RainTPL loops, plugins order is handle by JavaScript. You can just include <code>plugin_admin.js</code>, only if:</p> | ||
423 | <ul> | ||
424 | <li>you're using a table.</li> | ||
425 | <li>you call orderUp() and orderUp() onclick on arrows.</li> | ||
426 | <li>you add data-line and data-order to your rows.</li> | ||
427 | </ul> | ||
428 | <p>Otherwise, you can use your own JS as long as this field is send by the form:</p> | ||
429 | <p><input type="hidden" name="order_{$key}" value="{$counter}"></p> | ||
396 | <h3 id="placeholder-system">Placeholder system</h3> | 430 | <h3 id="placeholder-system">Placeholder system</h3> |
397 | <p>In order to make plugins work with every custom themes, you need to add variable placeholder in your templates.</p> | 431 | <p>In order to make plugins work with every custom themes, you need to add variable placeholder in your templates.</p> |
398 | <p>It's a RainTPL loop like this:</p> | 432 | <p>It's a RainTPL loop like this:</p> |
@@ -406,96 +440,104 @@ code > span.er { color: #ff0000; font-weight: bold; } | |||
406 | <pre><code>{loop="$plugins_header.buttons_toolbar"} | 440 | <pre><code>{loop="$plugins_header.buttons_toolbar"} |
407 | {$value} | 441 | {$value} |
408 | {/loop}</code></pre> | 442 | {/loop}</code></pre> |
443 | <p>At the end of file, before clearing floating blocks:</p> | ||
444 | <pre><code>{if="!empty($plugin_errors) && isLoggedIn()"} | ||
445 | <ul class="errors"> | ||
446 | {loop="plugin_errors"} | ||
447 | <li>{$value}</li> | ||
448 | {/loop} | ||
449 | </ul> | ||
450 | {/if}</code></pre> | ||
409 | <p><strong>includes.html</strong></p> | 451 | <p><strong>includes.html</strong></p> |
410 | <p>At the end of the file:</p> | 452 | <p>At the end of the file:</p> |
411 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_includes.css_files"} | 453 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_includes.css_files"} |
412 | <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> | 454 | <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> |
413 | {/loop}</code></pre> | 455 | {/loop}</code></pre></div> |
414 | <p><strong>page.footer.html</strong></p> | 456 | <p><strong>page.footer.html</strong></p> |
415 | <p>At the end of your footer notes:</p> | 457 | <p>At the end of your footer notes:</p> |
416 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_footer.text"} | 458 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_footer.text"} |
417 | {$value} | 459 | {$value} |
418 | {/loop}</code></pre> | 460 | {/loop}</code></pre></div> |
419 | <p>At the end of file:</p> | 461 | <p>At the end of file:</p> |
420 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_footer.js_files"} | 462 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_footer.js_files"} |
421 | <span class="kw"><script</span><span class="ot"> src=</span><span class="st">"{$value}#"</span><span class="kw">></script></span> | 463 | <span class="kw"><script</span><span class="ot"> src=</span><span class="st">"{$value}#"</span><span class="kw">></script></span> |
422 | {/loop}</code></pre> | 464 | {/loop}</code></pre></div> |
423 | <p><strong>linklist.html</strong></p> | 465 | <p><strong>linklist.html</strong></p> |
424 | <p>After search fields:</p> | 466 | <p>After search fields:</p> |
425 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_header.fields_toolbar"} | 467 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$plugins_header.fields_toolbar"} |
426 | {$value} | 468 | {$value} |
427 | {/loop}</code></pre> | 469 | {/loop}</code></pre></div> |
428 | <p>Before displaying the link list (after paging):</p> | 470 | <p>Before displaying the link list (after paging):</p> |
429 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$plugin_start_zone"} | 471 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$plugin_start_zone"} |
430 | {$value} | 472 | {$value} |
431 | {/loop}</code></pre> | 473 | {/loop}</code></pre></div> |
432 | <p>For every links (icons):</p> | 474 | <p>For every links (icons):</p> |
433 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$value.link_plugin"} | 475 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$value.link_plugin"} |
434 | <span class="kw"><span></span>{$value}<span class="kw"></span></span> | 476 | <span class="kw"><span></span>{$value}<span class="kw"></span></span> |
435 | {/loop}</code></pre> | 477 | {/loop}</code></pre></div> |
436 | <p>Before end paging:</p> | 478 | <p>Before end paging:</p> |
437 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$plugin_end_zone"} | 479 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$plugin_end_zone"} |
438 | {$value} | 480 | {$value} |
439 | {/loop}</code></pre> | 481 | {/loop}</code></pre></div> |
440 | <p><strong>linklist.paging.html</strong></p> | 482 | <p><strong>linklist.paging.html</strong></p> |
441 | <p>After the "private only" icon:</p> | 483 | <p>After the "private only" icon:</p> |
442 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$action_plugin"} | 484 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$action_plugin"} |
443 | {$value} | 485 | {$value} |
444 | {/loop}</code></pre> | 486 | {/loop}</code></pre></div> |
445 | <p><strong>editlink.html</strong></p> | 487 | <p><strong>editlink.html</strong></p> |
446 | <p>After tags field:</p> | 488 | <p>After tags field:</p> |
447 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$edit_link_plugin"} | 489 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$edit_link_plugin"} |
448 | {$value} | 490 | {$value} |
449 | {/loop}</code></pre> | 491 | {/loop}</code></pre></div> |
450 | <p><strong>tools.html</strong></p> | 492 | <p><strong>tools.html</strong></p> |
451 | <p>After the last tool:</p> | 493 | <p>After the last tool:</p> |
452 | <pre class="sourceCode html"><code class="sourceCode html">{loop="$tools_plugin"} | 494 | <div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html">{loop="$tools_plugin"} |
453 | {$value} | 495 | {$value} |
454 | {/loop}</code></pre> | 496 | {/loop}</code></pre></div> |
455 | <p><strong>picwall.html</strong></p> | 497 | <p><strong>picwall.html</strong></p> |
456 | <p>Top:</p> | 498 | <p>Top:</p> |
457 | <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> | 499 | <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> |
458 | {loop="$plugin_start_zone"} | 500 | {loop="$plugin_start_zone"} |
459 | {$value} | 501 | {$value} |
460 | {/loop} | 502 | {/loop} |
461 | <span class="kw"></div></span></code></pre> | 503 | <span class="kw"></div></span></code></pre></div> |
462 | <p>Bottom:</p> | 504 | <p>Bottom:</p> |
463 | <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> | 505 | <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> |
464 | {loop="$plugin_end_zone"} | 506 | {loop="$plugin_end_zone"} |
465 | {$value} | 507 | {$value} |
466 | {/loop} | 508 | {/loop} |
467 | <span class="kw"></div></span></code></pre> | 509 | <span class="kw"></div></span></code></pre></div> |
468 | <p><strong>tagcloud.html</strong></p> | 510 | <p><strong>tagcloud.html</strong></p> |
469 | <p>Top:</p> | 511 | <p>Top:</p> |
470 | <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> | 512 | <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> |
471 | {loop="$plugin_start_zone"} | 513 | {loop="$plugin_start_zone"} |
472 | {$value} | 514 | {$value} |
473 | {/loop} | 515 | {/loop} |
474 | <span class="kw"></div></span></code></pre> | 516 | <span class="kw"></div></span></code></pre></div> |
475 | <p>Bottom:</p> | 517 | <p>Bottom:</p> |
476 | <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> | 518 | <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> |
477 | {loop="$plugin_end_zone"} | 519 | {loop="$plugin_end_zone"} |
478 | {$value} | 520 | {$value} |
479 | {/loop} | 521 | {/loop} |
480 | <span class="kw"></div></span></code></pre> | 522 | <span class="kw"></div></span></code></pre></div> |
481 | <p><strong>daily.html</strong></p> | 523 | <p><strong>daily.html</strong></p> |
482 | <p>Top:</p> | 524 | <p>Top:</p> |
483 | <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> | 525 | <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> |
484 | {loop="$plugin_start_zone"} | 526 | {loop="$plugin_start_zone"} |
485 | {$value} | 527 | {$value} |
486 | {/loop} | 528 | {/loop} |
487 | <span class="kw"></div></span></code></pre> | 529 | <span class="kw"></div></span></code></pre></div> |
488 | <p>After every link:</p> | 530 | <p>After every link:</p> |
489 | <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> | 531 | <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> |
490 | {loop="$link.link_plugin"} | 532 | {loop="$link.link_plugin"} |
491 | {$value} | 533 | {$value} |
492 | {/loop} | 534 | {/loop} |
493 | <span class="kw"></div></span></code></pre> | 535 | <span class="kw"></div></span></code></pre></div> |
494 | <p>Bottom:</p> | 536 | <p>Bottom:</p> |
495 | <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> | 537 | <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> |
496 | {loop="$plugin_end_zone"} | 538 | {loop="$plugin_end_zone"} |
497 | {$value} | 539 | {$value} |
498 | {/loop} | 540 | {/loop} |
499 | <span class="kw"></div></span></code></pre> | 541 | <span class="kw"></div></span></code></pre></div> |
500 | </body> | 542 | </body> |
501 | </html> | 543 | </html> |