diff options
author | Arthur <arthur@hoa.ro> | 2016-12-12 03:07:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 03:07:13 +0100 |
commit | a0d079141eb155c263ebfaa1aad2629382223e31 (patch) | |
tree | e72090d95310391fdbe155906eab050764a95c47 /plugins | |
parent | bea80e43a3714663b0c32879f7bdf4fd19161b2e (diff) | |
parent | ba0fd80732acbff0fcda57a0b31e4edfaa337001 (diff) | |
download | Shaarli-a0d079141eb155c263ebfaa1aad2629382223e31.tar.gz Shaarli-a0d079141eb155c263ebfaa1aad2629382223e31.tar.zst Shaarli-a0d079141eb155c263ebfaa1aad2629382223e31.zip |
Merge pull request #679 from ArthurHoaro/plugins/header
Improve theme dependent plugin placeholders:
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.css | 4 | ||||
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.html | 6 | ||||
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.php | 22 | ||||
-rw-r--r-- | plugins/demo_plugin/custom_demo.css | 4 | ||||
-rw-r--r-- | plugins/demo_plugin/demo_plugin.php | 82 | ||||
-rw-r--r-- | plugins/playvideos/playvideos.html | 1 | ||||
-rw-r--r-- | plugins/playvideos/playvideos.php | 10 |
7 files changed, 105 insertions, 24 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 @@ | |||
15 | function hook_addlink_toolbar_render_header($data) | 15 | function 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 | */ |
144 | function hook_demo_plugin_render_linklist($data) | 197 | function 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 @@ | |||
16 | function hook_playvideos_render_header($data) | 16 | function 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; |