X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=plugins%2Fdemo_plugin%2Fdemo_plugin.php;h=15cfc2c51cd4889cc0d38f821e0ab856806a4167;hb=a6e9c08499f9f79dad88cb3ae9eacda0e0c34c96;hp=b80a2b6d5175bfb57d8dcf9774c4336357807c5b;hpb=0926d263902c184bd4f4c2036cb8ee90f81c5060;p=github%2Fshaarli%2FShaarli.git
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index b80a2b6d..15cfc2c5 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -1,11 +1,14 @@
'GET',
+ 'route' => '/custom',
+ 'callable' => 'Shaarli\DemoPlugin\DemoPluginController:index',
+ ],
+ ];
+}
+
/**
* Hook render_header.
- * Executed on every page redering.
+ * Executed on every page render.
*
* Template placeholders:
* - buttons_toolbar
@@ -72,8 +88,7 @@ function demo_plugin_init($conf)
function hook_demo_plugin_render_header($data)
{
// Only execute when linklist is rendered.
- if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
-
+ if ($data['_PAGE_'] == TemplatePage::LINKLIST) {
// If loggedin
if ($data['_LOGGEDIN_'] === true) {
/*
@@ -81,14 +96,14 @@ function hook_demo_plugin_render_header($data)
* A link is an array of its attributes (key="value"),
* and a mandatory `html` key, which contains its value.
*/
- $button = array(
- 'attr' => array (
+ $button = [
+ 'attr' => [
'href' => '#',
'class' => 'mybutton',
'title' => 'hover me',
- ),
+ ],
'html' => 'DEMO buttons toolbar',
- );
+ ];
$data['buttons_toolbar'][] = $button;
}
@@ -109,34 +124,34 @@ function hook_demo_plugin_render_header($data)
* ],
* ]
* This example renders as:
- *
+ *
*/
- $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;
@@ -144,7 +159,7 @@ function hook_demo_plugin_render_header($data)
/**
* Hook render_includes.
- * Executed on every page redering.
+ * Executed on every page render.
*
* Template placeholders:
* - css_files
@@ -168,7 +183,7 @@ function hook_demo_plugin_render_includes($data)
/**
* Hook render_footer.
- * Executed on every page redering.
+ * Executed on every page render.
*
* Template placeholders:
* - text
@@ -185,8 +200,8 @@ 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.');
+ // Footer text
+ $data['text'][] = '
' . demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
// Free elements at the end of the page.
$data['endofpage'][] = '