diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.php | 16 | ||||
-rw-r--r-- | plugins/markdown/markdown.css | 2 | ||||
-rw-r--r-- | plugins/markdown/markdown.meta | 2 | ||||
-rw-r--r-- | plugins/piwik/piwik.html | 43 | ||||
-rw-r--r-- | plugins/piwik/piwik.php | 23 | ||||
-rw-r--r-- | plugins/playvideos/youtube_playlist.js | 28 | ||||
-rw-r--r-- | plugins/pubsubhubbub/README.md | 20 | ||||
-rw-r--r-- | plugins/pubsubhubbub/hub.atom.xml | 1 | ||||
-rw-r--r-- | plugins/pubsubhubbub/hub.rss.xml | 1 | ||||
-rw-r--r-- | plugins/pubsubhubbub/pubsubhubbub.meta | 2 | ||||
-rw-r--r-- | plugins/pubsubhubbub/pubsubhubbub.php | 101 | ||||
-rw-r--r-- | plugins/qrcode/shaarli-qrcode.js | 28 | ||||
-rw-r--r-- | plugins/readityourself/book-open.png | bin | 568 -> 0 bytes | |||
-rw-r--r-- | plugins/readityourself/readityourself.html | 1 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.meta | 2 | ||||
-rw-r--r-- | plugins/readityourself/readityourself.php | 51 | ||||
-rw-r--r-- | plugins/wallabag/WallabagInstance.php | 2 |
17 files changed, 234 insertions, 89 deletions
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php index bf8a198a..ddf50aaf 100644 --- a/plugins/addlink_toolbar/addlink_toolbar.php +++ b/plugins/addlink_toolbar/addlink_toolbar.php | |||
@@ -40,19 +40,3 @@ function hook_addlink_toolbar_render_header($data) | |||
40 | 40 | ||
41 | return $data; | 41 | return $data; |
42 | } | 42 | } |
43 | |||
44 | /** | ||
45 | * When link list is displayed, include markdown CSS. | ||
46 | * | ||
47 | * @param array $data - includes data. | ||
48 | * | ||
49 | * @return mixed - includes data with markdown CSS file added. | ||
50 | */ | ||
51 | function hook_addlink_toolbar_render_includes($data) | ||
52 | { | ||
53 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { | ||
54 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.css'; | ||
55 | } | ||
56 | |||
57 | return $data; | ||
58 | } | ||
diff --git a/plugins/markdown/markdown.css b/plugins/markdown/markdown.css index 6789ce84..ce19cd2a 100644 --- a/plugins/markdown/markdown.css +++ b/plugins/markdown/markdown.css | |||
@@ -150,7 +150,7 @@ | |||
150 | box-shadow: 0 -1px 0 #e5e5e5,0 0 1px rgba(0,0,0,0.12),0 1px 1px rgba(0,0,0,0.24); | 150 | box-shadow: 0 -1px 0 #e5e5e5,0 0 1px rgba(0,0,0,0.12),0 1px 1px rgba(0,0,0,0.24); |
151 | } | 151 | } |
152 | 152 | ||
153 | .md_help { | 153 | #pageheader .md_help { |
154 | color: white; | 154 | color: white; |
155 | } | 155 | } |
156 | 156 | ||
diff --git a/plugins/markdown/markdown.meta b/plugins/markdown/markdown.meta index 8df2ed0b..322856ea 100644 --- a/plugins/markdown/markdown.meta +++ b/plugins/markdown/markdown.meta | |||
@@ -1,4 +1,4 @@ | |||
1 | description="Render shaare description with Markdown syntax.<br><strong>Warning</strong>: | 1 | description="Render shaare description with Markdown syntax.<br><strong>Warning</strong>: |
2 | If your shaared descriptions containing HTML tags before enabling the markdown plugin, | 2 | If your shaared descriptions contained HTML tags before enabling the markdown plugin, |
3 | enabling it might break your page. | 3 | enabling it might break your page. |
4 | See the <a href=\"https://github.com/shaarli/Shaarli/tree/master/plugins/markdown#html-rendering\">README</a>." | 4 | See the <a href=\"https://github.com/shaarli/Shaarli/tree/master/plugins/markdown#html-rendering\">README</a>." |
diff --git a/plugins/piwik/piwik.html b/plugins/piwik/piwik.html new file mode 100644 index 00000000..f4bc358a --- /dev/null +++ b/plugins/piwik/piwik.html | |||
@@ -0,0 +1,43 @@ | |||
1 | <!-- Piwik --> | ||
2 | <script type="text/javascript"> | ||
3 | /** @licstart The following is the entire license notice for the | ||
4 | * JavaScript code in this page. | ||
5 | * | ||
6 | * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> | ||
7 | * (c) 2011-2017 The Shaarli Community, see AUTHORS | ||
8 | * | ||
9 | * This software is provided 'as-is', without any express or implied warranty. | ||
10 | * In no event will the authors be held liable for any damages arising from | ||
11 | * the use of this software. | ||
12 | * | ||
13 | * Permission is granted to anyone to use this software for any purpose, | ||
14 | * including commercial applications, and to alter it and redistribute it | ||
15 | * freely, subject to the following restrictions: | ||
16 | * | ||
17 | * 1. The origin of this software must not be misrepresented; you must not | ||
18 | * claim that you wrote the original software. If you use this software | ||
19 | * in a product, an acknowledgment in the product documentation would | ||
20 | * be appreciated but is not required. | ||
21 | * | ||
22 | * 2. Altered source versions must be plainly marked as such, and must | ||
23 | * not be misrepresented as being the original software. | ||
24 | * | ||
25 | * 3. This notice may not be removed or altered from any source distribution. | ||
26 | * | ||
27 | * @licend The above is the entire license notice | ||
28 | * for the JavaScript code in this page. | ||
29 | */ | ||
30 | |||
31 | var _paq = _paq || []; | ||
32 | _paq.push(['trackPageView']); | ||
33 | _paq.push(['enableLinkTracking']); | ||
34 | (function() { | ||
35 | var u="%s/"; | ||
36 | _paq.push(['setTrackerUrl', u+'piwik.php']); | ||
37 | _paq.push(['setSiteId', '%s']); | ||
38 | var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; | ||
39 | g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); | ||
40 | })(); | ||
41 | </script> | ||
42 | <noscript><p><img src="%s/piwik.php?idsite=%s" style="border:0;" alt="" /></p></noscript> | ||
43 | <!-- End Piwik Code --> \ No newline at end of file | ||
diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php index 7c44909c..4a2b48a1 100644 --- a/plugins/piwik/piwik.php +++ b/plugins/piwik/piwik.php | |||
@@ -50,22 +50,13 @@ function hook_piwik_render_footer($data, $conf) | |||
50 | } | 50 | } |
51 | 51 | ||
52 | // Free elements at the end of the page. | 52 | // Free elements at the end of the page. |
53 | $data['endofpage'][] = '<!-- Piwik -->' . | 53 | $data['endofpage'][] = sprintf( |
54 | '<script type="text/javascript">' . | 54 | file_get_contents(PluginManager::$PLUGINS_PATH . '/piwik/piwik.html'), |
55 | ' var _paq = _paq || [];' . | 55 | $piwikUrl, |
56 | ' _paq.push([\'trackPageView\']);' . | 56 | $piwikSiteid, |
57 | ' _paq.push([\'enableLinkTracking\']);' . | 57 | $piwikUrl, |
58 | ' (function() {' . | 58 | $piwikSiteid |
59 | ' var u="//' . $piwikUrl . '/";' . | 59 | ); |
60 | ' _paq.push([\'setTrackerUrl\', u+\'piwik.php\']);' . | ||
61 | ' _paq.push([\'setSiteId\', \'' . $piwikSiteid . '\']);' . | ||
62 | ' var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0];' . | ||
63 | ' g.type=\'text/javascript\'; g.async=true; g.defer=true; g.src=u+\'piwik.js\'; s.parentNode.insertBefore(g,s);' . | ||
64 | ' })();' . | ||
65 | '</script>' . | ||
66 | '<noscript><p><img src="//' . $piwikUrl . '/piwik.php?idsite=' . $piwikSiteid . '" style="border:0;" alt="" /></p></noscript>' . | ||
67 | '<!-- End Piwik Code -->'; | ||
68 | 60 | ||
69 | return $data; | 61 | return $data; |
70 | } | 62 | } |
71 | |||
diff --git a/plugins/playvideos/youtube_playlist.js b/plugins/playvideos/youtube_playlist.js index be8d63af..3b608a5d 100644 --- a/plugins/playvideos/youtube_playlist.js +++ b/plugins/playvideos/youtube_playlist.js | |||
@@ -1,3 +1,31 @@ | |||
1 | /** @licstart The following is the entire license notice for the | ||
2 | * JavaScript code in this page. | ||
3 | * | ||
4 | * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> | ||
5 | * (c) 2011-2017 The Shaarli Community, see AUTHORS | ||
6 | * | ||
7 | * This software is provided 'as-is', without any express or implied warranty. | ||
8 | * In no event will the authors be held liable for any damages arising from | ||
9 | * the use of this software. | ||
10 | * | ||
11 | * Permission is granted to anyone to use this software for any purpose, | ||
12 | * including commercial applications, and to alter it and redistribute it | ||
13 | * freely, subject to the following restrictions: | ||
14 | * | ||
15 | * 1. The origin of this software must not be misrepresented; you must not | ||
16 | * claim that you wrote the original software. If you use this software | ||
17 | * in a product, an acknowledgment in the product documentation would | ||
18 | * be appreciated but is not required. | ||
19 | * | ||
20 | * 2. Altered source versions must be plainly marked as such, and must | ||
21 | * not be misrepresented as being the original software. | ||
22 | * | ||
23 | * 3. This notice may not be removed or altered from any source distribution. | ||
24 | * | ||
25 | * @licend The above is the entire license notice | ||
26 | * for the JavaScript code in this page. | ||
27 | */ | ||
28 | |||
1 | var run_playideos = (function () { | 29 | var run_playideos = (function () { |
2 | var e, n, t, o, r, i = [].indexOf || function (e) { | 30 | var e, n, t, o, r, i = [].indexOf || function (e) { |
3 | for (var n = 0, t = this.length; n < t; n++) { | 31 | for (var n = 0, t = this.length; n < t; n++) { |
diff --git a/plugins/pubsubhubbub/README.md b/plugins/pubsubhubbub/README.md new file mode 100644 index 00000000..3a65492a --- /dev/null +++ b/plugins/pubsubhubbub/README.md | |||
@@ -0,0 +1,20 @@ | |||
1 | # PubSubHubbub plugin | ||
2 | |||
3 | Enable this plugin to notify a Hub everytime you add or edit a link. | ||
4 | |||
5 | This allow hub subcribers to receive update notifications in real time, | ||
6 | which is useful for feed syndication service which supports PubSubHubbub. | ||
7 | |||
8 | ## Public Hub | ||
9 | |||
10 | By default, Shaarli will use [Google's public hub](http://pubsubhubbub.appspot.com/). | ||
11 | |||
12 | [Here](https://github.com/pubsubhubbub/PubSubHubbub/wiki/Hubs) is a list of public hubs. | ||
13 | |||
14 | You can also host your own PubSubHubbub server implementation, such as [phubb](https://github.com/cweiske/phubb). | ||
15 | |||
16 | ## cURL | ||
17 | |||
18 | While there is a fallback function to notify the hub, it's recommended that | ||
19 | you have PHP cURL extension enabled to use this plugin. | ||
20 | |||
diff --git a/plugins/pubsubhubbub/hub.atom.xml b/plugins/pubsubhubbub/hub.atom.xml new file mode 100644 index 00000000..24d93d3e --- /dev/null +++ b/plugins/pubsubhubbub/hub.atom.xml | |||
@@ -0,0 +1 @@ | |||
<link rel="hub" href="%s" /> \ No newline at end of file | |||
diff --git a/plugins/pubsubhubbub/hub.rss.xml b/plugins/pubsubhubbub/hub.rss.xml new file mode 100644 index 00000000..27bf67a6 --- /dev/null +++ b/plugins/pubsubhubbub/hub.rss.xml | |||
@@ -0,0 +1 @@ | |||
<atom:link rel="hub" href="%s" /> \ No newline at end of file | |||
diff --git a/plugins/pubsubhubbub/pubsubhubbub.meta b/plugins/pubsubhubbub/pubsubhubbub.meta new file mode 100644 index 00000000..289f5cdb --- /dev/null +++ b/plugins/pubsubhubbub/pubsubhubbub.meta | |||
@@ -0,0 +1,2 @@ | |||
1 | description="Enable PubSubHubbub feed publishing." | ||
2 | parameters="PUBSUBHUB_URL" | ||
diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php new file mode 100644 index 00000000..03b6757b --- /dev/null +++ b/plugins/pubsubhubbub/pubsubhubbub.php | |||
@@ -0,0 +1,101 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * PubSubHubbub plugin. | ||
5 | * | ||
6 | * PubSub is a protocol which fasten up RSS fetching: | ||
7 | * - Every time a new link is posted, Shaarli notify the hub. | ||
8 | * - The hub notify all feed subscribers that a new link has been posted. | ||
9 | * - Subscribers retrieve the new link. | ||
10 | */ | ||
11 | |||
12 | use pubsubhubbub\publisher\Publisher; | ||
13 | |||
14 | /** | ||
15 | * Plugin init function - set the hub to the default appspot one. | ||
16 | * | ||
17 | * @param ConfigManager $conf instance. | ||
18 | */ | ||
19 | function pubsubhubbub_init($conf) | ||
20 | { | ||
21 | $hub = $conf->get('plugins.PUBSUBHUB_URL'); | ||
22 | if (empty($hub)) { | ||
23 | // Default hub. | ||
24 | $conf->set('plugins.PUBSUBHUB_URL', 'https://pubsubhubbub.appspot.com/'); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | |||
29 | /** | ||
30 | * Render feed hook. | ||
31 | * Adds the hub URL in ATOM and RSS feed. | ||
32 | * | ||
33 | * @param array $data Template data. | ||
34 | * @param ConfigManager $conf instance. | ||
35 | * | ||
36 | * @return array updated template data. | ||
37 | */ | ||
38 | function hook_pubsubhubbub_render_feed($data, $conf) | ||
39 | { | ||
40 | $feedType = $data['_PAGE_'] == Router::$PAGE_FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; | ||
41 | $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.'. $feedType .'.xml'); | ||
42 | $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL')); | ||
43 | |||
44 | return $data; | ||
45 | } | ||
46 | |||
47 | /** | ||
48 | * Save link hook. | ||
49 | * Publish to the hub when a link is saved. | ||
50 | * | ||
51 | * @param array $data Template data. | ||
52 | * @param ConfigManager $conf instance. | ||
53 | * | ||
54 | * @return array unaltered data. | ||
55 | */ | ||
56 | function hook_pubsubhubbub_save_link($data, $conf) | ||
57 | { | ||
58 | $feeds = array( | ||
59 | index_url($_SERVER) .'?do=atom', | ||
60 | index_url($_SERVER) .'?do=rss', | ||
61 | ); | ||
62 | |||
63 | $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post'; | ||
64 | try { | ||
65 | $p = new Publisher($conf->get('plugins.PUBSUBHUB_URL')); | ||
66 | $p->publish_update($feeds, $httpPost); | ||
67 | } catch (Exception $e) { | ||
68 | error_log('Could not publish to PubSubHubbub: ' . $e->getMessage()); | ||
69 | } | ||
70 | |||
71 | return $data; | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * Http function used to post to the hub endpoint without cURL extension. | ||
76 | * | ||
77 | * @param string $url Hub endpoint. | ||
78 | * @param string $postString String to POST. | ||
79 | * | ||
80 | * @return bool | ||
81 | * | ||
82 | * @throws Exception An error occurred. | ||
83 | */ | ||
84 | function nocurl_http_post($url, $postString) { | ||
85 | $params = array('http' => array( | ||
86 | 'method' => 'POST', | ||
87 | 'content' => $postString, | ||
88 | 'user_agent' => 'PubSubHubbub-Publisher-PHP/1.0', | ||
89 | )); | ||
90 | |||
91 | $context = stream_context_create($params); | ||
92 | $fp = @fopen($url, 'rb', false, $context); | ||
93 | if (!$fp) { | ||
94 | throw new Exception('Could not post to '. $url); | ||
95 | } | ||
96 | $response = @stream_get_contents($fp); | ||
97 | if ($response === false) { | ||
98 | throw new Exception('Bad response from the hub '. $url); | ||
99 | } | ||
100 | return $response; | ||
101 | } | ||
diff --git a/plugins/qrcode/shaarli-qrcode.js b/plugins/qrcode/shaarli-qrcode.js index 615f54c7..fe77c4cd 100644 --- a/plugins/qrcode/shaarli-qrcode.js +++ b/plugins/qrcode/shaarli-qrcode.js | |||
@@ -1,3 +1,31 @@ | |||
1 | /** @licstart The following is the entire license notice for the | ||
2 | * JavaScript code in this page. | ||
3 | * | ||
4 | * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> | ||
5 | * (c) 2011-2017 The Shaarli Community, see AUTHORS | ||
6 | * | ||
7 | * This software is provided 'as-is', without any express or implied warranty. | ||
8 | * In no event will the authors be held liable for any damages arising from | ||
9 | * the use of this software. | ||
10 | * | ||
11 | * Permission is granted to anyone to use this software for any purpose, | ||
12 | * including commercial applications, and to alter it and redistribute it | ||
13 | * freely, subject to the following restrictions: | ||
14 | * | ||
15 | * 1. The origin of this software must not be misrepresented; you must not | ||
16 | * claim that you wrote the original software. If you use this software | ||
17 | * in a product, an acknowledgment in the product documentation would | ||
18 | * be appreciated but is not required. | ||
19 | * | ||
20 | * 2. Altered source versions must be plainly marked as such, and must | ||
21 | * not be misrepresented as being the original software. | ||
22 | * | ||
23 | * 3. This notice may not be removed or altered from any source distribution. | ||
24 | * | ||
25 | * @licend The above is the entire license notice | ||
26 | * for the JavaScript code in this page. | ||
27 | */ | ||
28 | |||
1 | // Show the QR-Code of a permalink (when the QR-Code icon is clicked). | 29 | // Show the QR-Code of a permalink (when the QR-Code icon is clicked). |
2 | function showQrCode(caller,loading) | 30 | function showQrCode(caller,loading) |
3 | { | 31 | { |
diff --git a/plugins/readityourself/book-open.png b/plugins/readityourself/book-open.png deleted file mode 100644 index 36513d7b..00000000 --- a/plugins/readityourself/book-open.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/plugins/readityourself/readityourself.html b/plugins/readityourself/readityourself.html deleted file mode 100644 index 5e200715..00000000 --- a/plugins/readityourself/readityourself.html +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | <span><a href="%s?url=%s"><img class="linklist-plugin-icon" src="%s/readityourself/book-open.png" title="Read with Readityourself" alt="readityourself" /></a></span> | ||
diff --git a/plugins/readityourself/readityourself.meta b/plugins/readityourself/readityourself.meta deleted file mode 100644 index bd611dd0..00000000 --- a/plugins/readityourself/readityourself.meta +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | description="For each link, add a ReadItYourself icon to save the shaared URL." | ||
2 | parameters=READITYOUSELF_URL; \ No newline at end of file | ||
diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php deleted file mode 100644 index 961c5bda..00000000 --- a/plugins/readityourself/readityourself.php +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Plugin readityourself | ||
5 | */ | ||
6 | |||
7 | // If we're talking about https://github.com/memiks/readityourself | ||
8 | // it seems kinda dead. | ||
9 | // Not tested. | ||
10 | |||
11 | /** | ||
12 | * Init function, return an error if the server is not set. | ||
13 | * | ||
14 | * @param $conf ConfigManager instance. | ||
15 | * | ||
16 | * @return array Eventual error. | ||
17 | */ | ||
18 | function readityourself_init($conf) | ||
19 | { | ||
20 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
21 | if (empty($riyUrl)) { | ||
22 | $error = 'Readityourself plugin error: '. | ||
23 | 'Please define the "READITYOUSELF_URL" setting in the plugin administration page.'; | ||
24 | return array($error); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * Add readityourself icon to link_plugin when rendering linklist. | ||
30 | * | ||
31 | * @param mixed $data Linklist data. | ||
32 | * @param ConfigManager $conf Configuration Manager instance. | ||
33 | * | ||
34 | * @return mixed - linklist data with readityourself plugin. | ||
35 | */ | ||
36 | function hook_readityourself_render_linklist($data, $conf) | ||
37 | { | ||
38 | $riyUrl = $conf->get('plugins.READITYOUSELF_URL'); | ||
39 | if (empty($riyUrl)) { | ||
40 | return $data; | ||
41 | } | ||
42 | |||
43 | $readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html'); | ||
44 | |||
45 | foreach ($data['links'] as &$value) { | ||
46 | $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH); | ||
47 | $value['link_plugin'][] = $readityourself; | ||
48 | } | ||
49 | |||
50 | return $data; | ||
51 | } | ||
diff --git a/plugins/wallabag/WallabagInstance.php b/plugins/wallabag/WallabagInstance.php index 72cc2e5e..eb8ab618 100644 --- a/plugins/wallabag/WallabagInstance.php +++ b/plugins/wallabag/WallabagInstance.php | |||
@@ -35,7 +35,7 @@ class WallabagInstance | |||
35 | */ | 35 | */ |
36 | private $apiVersion; | 36 | private $apiVersion; |
37 | 37 | ||
38 | function __construct($instance, $version) | 38 | public function __construct($instance, $version) |
39 | { | 39 | { |
40 | if ($this->isVersionAllowed($version)) { | 40 | if ($this->isVersionAllowed($version)) { |
41 | $this->apiVersion = self::$wallabagVersions[$version]; | 41 | $this->apiVersion = self::$wallabagVersions[$version]; |