diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-11-10 10:46:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-10 10:46:04 +0100 |
commit | 302662797cb5e8ac6579a99297ceae301f7927a6 (patch) | |
tree | 67f493a1cc6d3691742946f1d7e512bffe41e02f /plugins/demo_plugin/demo_plugin.php | |
parent | c94c32d1a3e86a479cb2582eadc668a5bb476fc6 (diff) | |
parent | 2f4df753041088d788d1923692a7d530167a6840 (diff) | |
download | Shaarli-302662797cb5e8ac6579a99297ceae301f7927a6.tar.gz Shaarli-302662797cb5e8ac6579a99297ceae301f7927a6.tar.zst Shaarli-302662797cb5e8ac6579a99297ceae301f7927a6.zip |
Merge pull request #1635 from ArthurHoaro/feature/phpcs
Diffstat (limited to 'plugins/demo_plugin/demo_plugin.php')
-rw-r--r-- | plugins/demo_plugin/demo_plugin.php | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index defb01f7..22d27b68 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
2 | /** | 3 | /** |
3 | * Demo Plugin. | 4 | * Demo Plugin. |
4 | * | 5 | * |
@@ -82,14 +83,14 @@ function hook_demo_plugin_render_header($data) | |||
82 | * A link is an array of its attributes (key="value"), | 83 | * A link is an array of its attributes (key="value"), |
83 | * and a mandatory `html` key, which contains its value. | 84 | * and a mandatory `html` key, which contains its value. |
84 | */ | 85 | */ |
85 | $button = array( | 86 | $button = [ |
86 | 'attr' => array ( | 87 | 'attr' => [ |
87 | 'href' => '#', | 88 | 'href' => '#', |
88 | 'class' => 'mybutton', | 89 | 'class' => 'mybutton', |
89 | 'title' => 'hover me', | 90 | 'title' => 'hover me', |
90 | ), | 91 | ], |
91 | 'html' => 'DEMO buttons toolbar', | 92 | 'html' => 'DEMO buttons toolbar', |
92 | ); | 93 | ]; |
93 | $data['buttons_toolbar'][] = $button; | 94 | $data['buttons_toolbar'][] = $button; |
94 | } | 95 | } |
95 | 96 | ||
@@ -115,29 +116,29 @@ function hook_demo_plugin_render_header($data) | |||
115 | * <input input-2-attribute-1="input 2 attribute 1 value"> | 116 | * <input input-2-attribute-1="input 2 attribute 1 value"> |
116 | * </form> | 117 | * </form> |
117 | */ | 118 | */ |
118 | $form = array( | 119 | $form = [ |
119 | 'attr' => array( | 120 | 'attr' => [ |
120 | 'method' => 'GET', | 121 | 'method' => 'GET', |
121 | 'action' => $data['_BASE_PATH_'] . '/', | 122 | 'action' => $data['_BASE_PATH_'] . '/', |
122 | 'class' => 'addform', | 123 | 'class' => 'addform', |
123 | ), | 124 | ], |
124 | 'inputs' => array( | 125 | 'inputs' => [ |
125 | array( | 126 | [ |
126 | 'type' => 'text', | 127 | 'type' => 'text', |
127 | 'name' => 'demo', | 128 | 'name' => 'demo', |
128 | 'placeholder' => 'demo', | 129 | 'placeholder' => 'demo', |
129 | ) | 130 | ] |
130 | ) | 131 | ] |
131 | ); | 132 | ]; |
132 | $data['fields_toolbar'][] = $form; | 133 | $data['fields_toolbar'][] = $form; |
133 | } | 134 | } |
134 | // Another button always displayed | 135 | // Another button always displayed |
135 | $button = array( | 136 | $button = [ |
136 | 'attr' => array( | 137 | 'attr' => [ |
137 | 'href' => '#', | 138 | 'href' => '#', |
138 | ), | 139 | ], |
139 | 'html' => 'Demo', | 140 | 'html' => 'Demo', |
140 | ); | 141 | ]; |
141 | $data['buttons_toolbar'][] = $button; | 142 | $data['buttons_toolbar'][] = $button; |
142 | 143 | ||
143 | return $data; | 144 | return $data; |
@@ -187,7 +188,7 @@ function hook_demo_plugin_render_includes($data) | |||
187 | function hook_demo_plugin_render_footer($data) | 188 | function hook_demo_plugin_render_footer($data) |
188 | { | 189 | { |
189 | // Footer text | 190 | // Footer text |
190 | $data['text'][] = '<br>'. demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); | 191 | $data['text'][] = '<br>' . demo_plugin_t('Shaarli is now enhanced by the awesome demo_plugin.'); |
191 | 192 | ||
192 | // Free elements at the end of the page. | 193 | // Free elements at the end of the page. |
193 | $data['endofpage'][] = '<marquee id="demo_marquee">' . | 194 | $data['endofpage'][] = '<marquee id="demo_marquee">' . |
@@ -229,13 +230,13 @@ function hook_demo_plugin_render_linklist($data) | |||
229 | * and a mandatory `html` key, which contains its value. | 230 | * and a mandatory `html` key, which contains its value. |
230 | * It's also recommended to add key 'on' or 'off' for theme rendering. | 231 | * It's also recommended to add key 'on' or 'off' for theme rendering. |
231 | */ | 232 | */ |
232 | $action = array( | 233 | $action = [ |
233 | 'attr' => array( | 234 | 'attr' => [ |
234 | 'href' => '?up', | 235 | 'href' => '?up', |
235 | 'title' => 'Uppercase!', | 236 | 'title' => 'Uppercase!', |
236 | ), | 237 | ], |
237 | 'html' => '←', | 238 | 'html' => '←', |
238 | ); | 239 | ]; |
239 | 240 | ||
240 | if (isset($_GET['up'])) { | 241 | if (isset($_GET['up'])) { |
241 | // Manipulate link data | 242 | // Manipulate link data |
@@ -275,7 +276,7 @@ function hook_demo_plugin_render_linklist($data) | |||
275 | function hook_demo_plugin_render_editlink($data) | 276 | function hook_demo_plugin_render_editlink($data) |
276 | { | 277 | { |
277 | // Load HTML into a string | 278 | // Load HTML into a string |
278 | $html = file_get_contents(PluginManager::$PLUGINS_PATH .'/demo_plugin/field.html'); | 279 | $html = file_get_contents(PluginManager::$PLUGINS_PATH . '/demo_plugin/field.html'); |
279 | 280 | ||
280 | // Replace value in HTML if it exists in $data | 281 | // Replace value in HTML if it exists in $data |
281 | if (!empty($data['link']['stuff'])) { | 282 | if (!empty($data['link']['stuff'])) { |