X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fdemo_plugin%2Fdemo_plugin.php;h=18834e5331d91cc9d217c18a284056097bcc23db;hb=1a84bf1e2bc45787d9cfa81fa427a11a3aba623a;hp=84763c2b25050e05b5afa692178536fe128c3c81;hpb=fd006c630b64146edc402b68d8503c716f8a55d6;p=github%2Fshaarli%2FShaarli.git diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php old mode 100755 new mode 100644 index 84763c2b..18834e53 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php @@ -40,6 +40,8 @@ function hook_demo_plugin_render_header($data) // Fields in toolbar $data['fields_toolbar'][] = 'DEMO_fields_toolbar'; } + // Another button always displayed + $data['buttons_toolbar'][] = '
  • DEMO
  • '; return $data; } @@ -74,6 +76,7 @@ function hook_demo_plugin_render_includes($data) * * Template placeholders: * - text + * - endofpage * - js_files * * Data: @@ -89,6 +92,11 @@ function hook_demo_plugin_render_footer($data) // footer text $data['text'][] = 'Shaarli is now enhanced by the awesome demo_plugin.'; + // Free elements at the end of the page. + $data['endofpage'][] = '' . + 'DEMO: it\'s 1999 all over again!' . + ''; + // List of plugin's JS files. // Note that you just need to specify CSS path. $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/demo_plugin/demo_plugin.js'; @@ -314,4 +322,29 @@ function hook_demo_plugin_delete_link($data) if (strpos($data['url'], 'youtube.com') !== false) { exit('You can not delete a YouTube link. Don\'t ask.'); } -} \ No newline at end of file +} + +/** + * Execute render_feed hook. + * Called with ATOM and RSS feed. + * + * Special data keys: + * - _PAGE_: current page + * - _LOGGEDIN_: true/false + * + * @param array $data data passed to plugin + * + * @return array altered $data. + */ +function hook_demo_plugin_render_feed($data) +{ + foreach ($data['links'] as &$link) { + if ($data['_PAGE_'] == Router::$PAGE_FEED_ATOM) { + $link['description'] .= ' - ATOM Feed' ; + } + elseif ($data['_PAGE_'] == Router::$PAGE_FEED_RSS) { + $link['description'] .= ' - RSS Feed'; + } + } + return $data; +}