X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fdemo_plugin%2Fdemo_plugin.php;h=22d27b6827f306ad3a3230ffd8361cd543a5bd6b;hb=302662797cb5e8ac6579a99297ceae301f7927a6;hp=8ae1b47969e15dafa1b142c68e98aaf19d8813b4;hpb=4b15c49198ef4be57b2ccb3d9033035a16d3b20c;p=github%2Fshaarli%2FShaarli.git diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index 8ae1b479..22d27b68 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php @@ -1,4 +1,5 @@ array ( + $button = [ + 'attr' => [ 'href' => '#', 'class' => 'mybutton', 'title' => 'hover me', - ), + ], 'html' => 'DEMO buttons toolbar', - ); + ]; $data['buttons_toolbar'][] = $button; } @@ -115,29 +116,29 @@ function hook_demo_plugin_render_header($data) * * */ - $form = array( - 'attr' => array( + $form = [ + 'attr' => [ 'method' => 'GET', - 'action' => '?', + 'action' => $data['_BASE_PATH_'] . '/', 'class' => 'addform', - ), - 'inputs' => array( - array( + ], + 'inputs' => [ + [ 'type' => 'text', 'name' => 'demo', 'placeholder' => 'demo', - ) - ) - ); + ] + ] + ]; $data['fields_toolbar'][] = $form; } // Another button always displayed - $button = array( - 'attr' => array( + $button = [ + 'attr' => [ 'href' => '#', - ), + ], 'html' => 'Demo', - ); + ]; $data['buttons_toolbar'][] = $button; return $data; @@ -187,7 +188,7 @@ function hook_demo_plugin_render_includes($data) function hook_demo_plugin_render_footer($data) { // Footer text - $data['text'][] = '
'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); + $data['text'][] = '
' . demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); // Free elements at the end of the page. $data['endofpage'][] = '' . @@ -229,13 +230,13 @@ function hook_demo_plugin_render_linklist($data) * and a mandatory `html` key, which contains its value. * It's also recommended to add key 'on' or 'off' for theme rendering. */ - $action = array( - 'attr' => array( + $action = [ + 'attr' => [ 'href' => '?up', 'title' => 'Uppercase!', - ), + ], 'html' => '←', - ); + ]; if (isset($_GET['up'])) { // Manipulate link data @@ -275,7 +276,7 @@ function hook_demo_plugin_render_linklist($data) function hook_demo_plugin_render_editlink($data) { // Load HTML into a string - $html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html'); + $html = file_get_contents(PluginManager::$PLUGINS_PATH . '/demo_plugin/field.html'); // Replace value in HTML if it exists in $data if (!empty($data['link']['stuff'])) { @@ -441,9 +442,9 @@ function hook_demo_plugin_delete_link($data) function hook_demo_plugin_render_feed($data) { foreach ($data['links'] as &$link) { - if ($data['_PAGE_'] == Router::$PAGE_FEED_ATOM) { + if ($data['_PAGE_'] == TemplatePage::FEED_ATOM) { $link['description'] .= ' - ATOM Feed' ; - } elseif ($data['_PAGE_'] == Router::$PAGE_FEED_RSS) { + } elseif ($data['_PAGE_'] == TemplatePage::FEED_RSS) { $link['description'] .= ' - RSS Feed'; } }