aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--plugins/demo_plugin/demo_plugin.php23
1 files changed, 9 insertions, 14 deletions
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index 71ba7495..8ae1b479 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -2,8 +2,8 @@
2/** 2/**
3 * Demo Plugin. 3 * Demo Plugin.
4 * 4 *
5 * This plugin try to cover Shaarli's plugin API entirely. 5 * This plugin tries to completely cover Shaarli's plugin API.
6 * Can be used by plugin developper to make their own. 6 * Can be used by plugin developers to make their own plugin.
7 */ 7 */
8 8
9/* 9/*
@@ -61,7 +61,7 @@ function demo_plugin_init($conf)
61 61
62/** 62/**
63 * Hook render_header. 63 * Hook render_header.
64 * Executed on every page redering. 64 * Executed on every page render.
65 * 65 *
66 * Template placeholders: 66 * Template placeholders:
67 * - buttons_toolbar 67 * - buttons_toolbar
@@ -145,7 +145,7 @@ function hook_demo_plugin_render_header($data)
145 145
146/** 146/**
147 * Hook render_includes. 147 * Hook render_includes.
148 * Executed on every page redering. 148 * Executed on every page render.
149 * 149 *
150 * Template placeholders: 150 * Template placeholders:
151 * - css_files 151 * - css_files
@@ -169,7 +169,7 @@ function hook_demo_plugin_render_includes($data)
169 169
170/** 170/**
171 * Hook render_footer. 171 * Hook render_footer.
172 * Executed on every page redering. 172 * Executed on every page render.
173 * 173 *
174 * Template placeholders: 174 * Template placeholders:
175 * - text 175 * - text
@@ -186,7 +186,7 @@ function hook_demo_plugin_render_includes($data)
186 */ 186 */
187function hook_demo_plugin_render_footer($data) 187function hook_demo_plugin_render_footer($data)
188{ 188{
189 // footer text 189 // Footer text
190 $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); 190 $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
191 191
192 // Free elements at the end of the page. 192 // Free elements at the end of the page.
@@ -277,7 +277,7 @@ function hook_demo_plugin_render_editlink($data)
277 // Load HTML into a string 277 // Load HTML into a string
278 $html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html'); 278 $html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html');
279 279
280 // replace value in HTML if it exists in $data 280 // Replace value in HTML if it exists in $data
281 if (!empty($data['link']['stuff'])) { 281 if (!empty($data['link']['stuff'])) {
282 $html = sprintf($html, $data['link']['stuff']); 282 $html = sprintf($html, $data['link']['stuff']);
283 } else { 283 } else {
@@ -324,9 +324,7 @@ function hook_demo_plugin_render_tools($data)
324 */ 324 */
325function hook_demo_plugin_render_picwall($data) 325function hook_demo_plugin_render_picwall($data)
326{ 326{
327 // plugin_start_zone
328 $data['plugin_start_zone'][] = '<center>BEFORE</center>'; 327 $data['plugin_start_zone'][] = '<center>BEFORE</center>';
329 // plugin_end_zone
330 $data['plugin_end_zone'][] = '<center>AFTER</center>'; 328 $data['plugin_end_zone'][] = '<center>AFTER</center>';
331 329
332 return $data; 330 return $data;
@@ -348,9 +346,7 @@ function hook_demo_plugin_render_picwall($data)
348 */ 346 */
349function hook_demo_plugin_render_tagcloud($data) 347function hook_demo_plugin_render_tagcloud($data)
350{ 348{
351 // plugin_start_zone
352 $data['plugin_start_zone'][] = '<center>BEFORE</center>'; 349 $data['plugin_start_zone'][] = '<center>BEFORE</center>';
353 // plugin_end_zone
354 $data['plugin_end_zone'][] = '<center>AFTER</center>'; 350 $data['plugin_end_zone'][] = '<center>AFTER</center>';
355 351
356 return $data; 352 return $data;
@@ -372,9 +368,7 @@ function hook_demo_plugin_render_tagcloud($data)
372 */ 368 */
373function hook_demo_plugin_render_daily($data) 369function hook_demo_plugin_render_daily($data)
374{ 370{
375 // plugin_start_zone
376 $data['plugin_start_zone'][] = '<center>BEFORE</center>'; 371 $data['plugin_start_zone'][] = '<center>BEFORE</center>';
377 // plugin_end_zone
378 $data['plugin_end_zone'][] = '<center>AFTER</center>'; 372 $data['plugin_end_zone'][] = '<center>AFTER</center>';
379 373
380 374
@@ -465,7 +459,8 @@ function hook_demo_plugin_render_feed($data)
465 */ 459 */
466function hook_demo_plugin_save_plugin_parameters($data) 460function hook_demo_plugin_save_plugin_parameters($data)
467{ 461{
468 // Here we edit the provided value, but we can use this to generate config files, etc. 462 // Here we edit the provided value.
463 // This hook can also be used to generate config files, etc.
469 if (! empty($data['DEMO_PLUGIN_PARAMETER']) && ! endsWith($data['DEMO_PLUGIN_PARAMETER'], '_SUFFIX')) { 464 if (! empty($data['DEMO_PLUGIN_PARAMETER']) && ! endsWith($data['DEMO_PLUGIN_PARAMETER'], '_SUFFIX')) {
470 $data['DEMO_PLUGIN_PARAMETER'] .= '_SUFFIX'; 465 $data['DEMO_PLUGIN_PARAMETER'] .= '_SUFFIX';
471 } 466 }