aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-12-12 03:07:13 +0100
committerGitHub <noreply@github.com>2016-12-12 03:07:13 +0100
commita0d079141eb155c263ebfaa1aad2629382223e31 (patch)
treee72090d95310391fdbe155906eab050764a95c47
parentbea80e43a3714663b0c32879f7bdf4fd19161b2e (diff)
parentba0fd80732acbff0fcda57a0b31e4edfaa337001 (diff)
downloadShaarli-a0d079141eb155c263ebfaa1aad2629382223e31.tar.gz
Shaarli-a0d079141eb155c263ebfaa1aad2629382223e31.tar.zst
Shaarli-a0d079141eb155c263ebfaa1aad2629382223e31.zip
Merge pull request #679 from ArthurHoaro/plugins/header
Improve theme dependent plugin placeholders:
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.css4
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.html6
-rw-r--r--plugins/addlink_toolbar/addlink_toolbar.php22
-rw-r--r--plugins/demo_plugin/custom_demo.css4
-rw-r--r--plugins/demo_plugin/demo_plugin.php82
-rw-r--r--plugins/playvideos/playvideos.html1
-rw-r--r--plugins/playvideos/playvideos.php10
-rw-r--r--tpl/linklist.html12
-rw-r--r--tpl/linklist.paging.html9
-rw-r--r--tpl/page.header.html7
10 files changed, 130 insertions, 27 deletions
diff --git a/plugins/addlink_toolbar/addlink_toolbar.css b/plugins/addlink_toolbar/addlink_toolbar.css
deleted file mode 100644
index b6a612f0..00000000
--- a/plugins/addlink_toolbar/addlink_toolbar.css
+++ /dev/null
@@ -1,4 +0,0 @@
1#addlink_toolbar {
2 display: inline;
3 margin: 0 0 0 25px;
4} \ No newline at end of file
diff --git a/plugins/addlink_toolbar/addlink_toolbar.html b/plugins/addlink_toolbar/addlink_toolbar.html
deleted file mode 100644
index f38c41a0..00000000
--- a/plugins/addlink_toolbar/addlink_toolbar.html
+++ /dev/null
@@ -1,6 +0,0 @@
1<div id="addlink_toolbar">
2 <form method="GET" action="" name="addform" class="addform">
3 <input type="text" name="post" placeholder="URI">
4 <input type="submit" value="Add link" class="bigbutton">
5 </form>
6</div> \ No newline at end of file
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php
index cfd74207..bf8a198a 100644
--- a/plugins/addlink_toolbar/addlink_toolbar.php
+++ b/plugins/addlink_toolbar/addlink_toolbar.php
@@ -15,7 +15,27 @@
15function hook_addlink_toolbar_render_header($data) 15function hook_addlink_toolbar_render_header($data)
16{ 16{
17 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { 17 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) {
18 $data['fields_toolbar'][] = file_get_contents(PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.html'); 18 $form = array(
19 'attr' => array(
20 'method' => 'GET',
21 'action' => '',
22 'name' => 'addform',
23 'class' => 'addform',
24 ),
25 'inputs' => array(
26 array(
27 'type' => 'text',
28 'name' => 'post',
29 'placeholder' => 'URI',
30 ),
31 array(
32 'type' => 'submit',
33 'value' => 'Add link',
34 'class' => 'bigbutton',
35 ),
36 ),
37 );
38 $data['fields_toolbar'][] = $form;
19 } 39 }
20 40
21 return $data; 41 return $data;
diff --git a/plugins/demo_plugin/custom_demo.css b/plugins/demo_plugin/custom_demo.css
index af5e8bf9..95019e28 100644
--- a/plugins/demo_plugin/custom_demo.css
+++ b/plugins/demo_plugin/custom_demo.css
@@ -2,10 +2,6 @@
2 color: red; 2 color: red;
3} 3}
4 4
5.upper_plugin_demo {
6 float: left;
7}
8
9#demo_marquee { 5#demo_marquee {
10 background: darkmagenta; 6 background: darkmagenta;
11 color: white; 7 color: white;
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php
index 7335c9d4..8fdbf663 100644
--- a/plugins/demo_plugin/demo_plugin.php
+++ b/plugins/demo_plugin/demo_plugin.php
@@ -50,15 +50,68 @@ function hook_demo_plugin_render_header($data)
50 50
51 // If loggedin 51 // If loggedin
52 if ($data['_LOGGEDIN_'] === true) { 52 if ($data['_LOGGEDIN_'] === true) {
53 // Buttons in toolbar 53 /*
54 $data['buttons_toolbar'][] = '<li><a href="#">DEMO_buttons_toolbar</a></li>'; 54 * Links in toolbar:
55 * A link is an array of its attributes (key="value"),
56 * and a mandatory `html` key, which contains its value.
57 */
58 $button = array(
59 'attr' => array (
60 'href' => '#',
61 'class' => 'mybutton',
62 'title' => 'hover me',
63 ),
64 'html' => 'DEMO buttons toolbar',
65 );
66 $data['buttons_toolbar'][] = $button;
55 } 67 }
56 68
57 // Fields in toolbar 69 /*
58 $data['fields_toolbar'][] = 'DEMO_fields_toolbar'; 70 * Add additional input fields in the tools.
71 * A field is an array containing:
72 * [
73 * 'form-attribute-1' => 'form attribute 1 value',
74 * 'form-attribute-2' => 'form attribute 2 value',
75 * 'inputs' => [
76 * [
77 * 'input-1-attribute-1 => 'input 1 attribute 1 value',
78 * 'input-1-attribute-2 => 'input 1 attribute 2 value',
79 * ],
80 * [
81 * 'input-2-attribute-1 => 'input 2 attribute 1 value',
82 * ],
83 * ],
84 * ]
85 * This example renders as:
86 * <form form-attribute-1="form attribute 1 value" form-attribute-2="form attribute 2 value">
87 * <input input-1-attribute-1="input 1 attribute 1 value" input-1-attribute-2="input 1 attribute 2 value">
88 * <input input-2-attribute-1="input 2 attribute 1 value">
89 * </form>
90 */
91 $form = array(
92 'attr' => array(
93 'method' => 'GET',
94 'action' => '?',
95 'class' => 'addform',
96 ),
97 'inputs' => array(
98 array(
99 'type' => 'text',
100 'name' => 'demo',
101 'placeholder' => 'demo',
102 )
103 )
104 );
105 $data['fields_toolbar'][] = $form;
59 } 106 }
60 // Another button always displayed 107 // Another button always displayed
61 $data['buttons_toolbar'][] = '<li><a href="#">DEMO</a></li>'; 108 $button = array(
109 'attr' => array(
110 'href' => '#',
111 ),
112 'html' => 'Demo',
113 );
114 $data['buttons_toolbar'][] = $button;
62 115
63 return $data; 116 return $data;
64} 117}
@@ -143,8 +196,19 @@ function hook_demo_plugin_render_footer($data)
143 */ 196 */
144function hook_demo_plugin_render_linklist($data) 197function hook_demo_plugin_render_linklist($data)
145{ 198{
146 // action_plugin 199 /*
147 $data['action_plugin'][] = '<div class="upper_plugin_demo"><a href="?up" title="Uppercase!">←</a></div>'; 200 * Action links (action_plugin):
201 * A link is an array of its attributes (key="value"),
202 * and a mandatory `html` key, which contains its value.
203 * It's also recommended to add key 'on' or 'off' for theme rendering.
204 */
205 $action = array(
206 'attr' => array(
207 'href' => '?up',
208 'title' => 'Uppercase!',
209 ),
210 'html' => '←',
211 );
148 212
149 if (isset($_GET['up'])) { 213 if (isset($_GET['up'])) {
150 // Manipulate link data 214 // Manipulate link data
@@ -152,7 +216,11 @@ function hook_demo_plugin_render_linklist($data)
152 $value['description'] = strtoupper($value['description']); 216 $value['description'] = strtoupper($value['description']);
153 $value['title'] = strtoupper($value['title']); 217 $value['title'] = strtoupper($value['title']);
154 } 218 }
219 $action['on'] = true;
220 } else {
221 $action['off'] = true;
155 } 222 }
223 $data['action_plugin'][] = $action;
156 224
157 // link_plugin (for each link) 225 // link_plugin (for each link)
158 foreach ($data['links'] as &$value) { 226 foreach ($data['links'] as &$value) {
diff --git a/plugins/playvideos/playvideos.html b/plugins/playvideos/playvideos.html
deleted file mode 100644
index fda3d54f..00000000
--- a/plugins/playvideos/playvideos.html
+++ /dev/null
@@ -1 +0,0 @@
1<a href="#" id="playvideos">► Play Videos</a> \ No newline at end of file
diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php
index 7645b778..64484504 100644
--- a/plugins/playvideos/playvideos.php
+++ b/plugins/playvideos/playvideos.php
@@ -16,7 +16,15 @@
16function hook_playvideos_render_header($data) 16function hook_playvideos_render_header($data)
17{ 17{
18 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { 18 if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) {
19 $data['buttons_toolbar'][] = file_get_contents(PluginManager::$PLUGINS_PATH . '/playvideos/playvideos.html'); 19 $playvideo = array(
20 'attr' => array(
21 'href' => '#',
22 'title' => 'Video player',
23 'id' => 'playvideos',
24 ),
25 'html' => '► Play Videos'
26 );
27 $data['buttons_toolbar'][] = $playvideo;
20 } 28 }
21 29
22 return $data; 30 return $data;
diff --git a/tpl/linklist.html b/tpl/linklist.html
index ddfd729a..3fe86deb 100644
--- a/tpl/linklist.html
+++ b/tpl/linklist.html
@@ -28,7 +28,17 @@
28 <input type="submit" value="Search" class="bigbutton"> 28 <input type="submit" value="Search" class="bigbutton">
29 </form> 29 </form>
30 {loop="$plugins_header.fields_toolbar"} 30 {loop="$plugins_header.fields_toolbar"}
31 {$value} 31 <form
32 {loop="$value.attr"}
33 {$key}="{$value}"
34 {/loop}>
35 {loop="$value.inputs"}
36 <input
37 {loop="$value"}
38 {$key}="{$value}"
39 {/loop}>
40 {/loop}
41 </form>
32 {/loop} 42 {/loop}
33 </div> 43 </div>
34</div> 44</div>
diff --git a/tpl/linklist.paging.html b/tpl/linklist.paging.html
index e91c8f86..86019c01 100644
--- a/tpl/linklist.paging.html
+++ b/tpl/linklist.paging.html
@@ -13,7 +13,14 @@
13 </div> 13 </div>
14{/if} 14{/if}
15 {loop="$action_plugin"} 15 {loop="$action_plugin"}
16 {$value} 16 <div class="paging_privatelinks">
17 <a
18 {loop="$value.attr"}
19 {$key}="{$value}"
20 {/loop}>
21 {$value.html}
22 </a>
23 </div>
17 {/loop} 24 {/loop}
18 <div class="paging_linksperpage"> 25 <div class="paging_linksperpage">
19 Links per page: <a href="?linksperpage=20">20</a> <a href="?linksperpage=50">50</a> <a href="?linksperpage=100">100</a> 26 Links per page: <a href="?linksperpage=20">20</a> <a href="?linksperpage=50">50</a> <a href="?linksperpage=100">100</a>
diff --git a/tpl/page.header.html b/tpl/page.header.html
index eac2ed4a..cce61ec4 100644
--- a/tpl/page.header.html
+++ b/tpl/page.header.html
@@ -35,7 +35,12 @@
35 <li><a href="?do=picwall{$searchcrits}">Picture wall</a></li> 35 <li><a href="?do=picwall{$searchcrits}">Picture wall</a></li>
36 <li><a href="?do=daily">Daily</a></li> 36 <li><a href="?do=daily">Daily</a></li>
37 {loop="$plugins_header.buttons_toolbar"} 37 {loop="$plugins_header.buttons_toolbar"}
38 {$value} 38 <li><a
39 {loop="$value.attr"}
40 {$key}="{$value}"
41 {/loop}>
42 {$value.html}
43 </a></li>
39 {/loop} 44 {/loop}
40{/if} 45{/if}
41 </ul> 46 </ul>