<?php
+
/**
* Demo Plugin.
*
* 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;
}
* <input input-2-attribute-1="input 2 attribute 1 value">
* </form>
*/
- $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;
function hook_demo_plugin_render_footer($data)
{
// Footer text
- $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
+ $data['text'][] = '<br>' . demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.');
// Free elements at the end of the page.
$data['endofpage'][] = '<marquee id="demo_marquee">' .
* 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
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'])) {