diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.php | 6 | ||||
-rw-r--r-- | plugins/archiveorg/archiveorg.html | 2 | ||||
-rw-r--r-- | plugins/archiveorg/archiveorg.php | 7 | ||||
-rw-r--r-- | plugins/default_colors/default_colors.php | 56 | ||||
-rw-r--r-- | plugins/demo_plugin/demo_plugin.php | 10 | ||||
-rw-r--r-- | plugins/isso/isso.php | 8 | ||||
-rw-r--r-- | plugins/isso/isso_button.html | 5 | ||||
-rw-r--r-- | plugins/playvideos/README.md | 9 | ||||
-rw-r--r-- | plugins/playvideos/playvideos.php | 6 | ||||
-rw-r--r-- | plugins/pubsubhubbub/pubsubhubbub.php | 8 | ||||
-rw-r--r-- | plugins/qrcode/qrcode.php | 9 | ||||
-rw-r--r-- | plugins/qrcode/shaarli-qrcode.js | 15 | ||||
-rw-r--r-- | plugins/wallabag/README.md | 2 | ||||
-rw-r--r-- | plugins/wallabag/wallabag.php | 4 |
14 files changed, 77 insertions, 70 deletions
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php index 8bf4ed46..ab6ed6de 100644 --- a/plugins/addlink_toolbar/addlink_toolbar.php +++ b/plugins/addlink_toolbar/addlink_toolbar.php | |||
@@ -5,7 +5,7 @@ | |||
5 | * Adds the addlink input on the linklist page. | 5 | * Adds the addlink input on the linklist page. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | use Shaarli\Router; | 8 | use Shaarli\Render\TemplatePage; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * When linklist is displayed, add play videos to header's toolbar. | 11 | * When linklist is displayed, add play videos to header's toolbar. |
@@ -16,11 +16,11 @@ use Shaarli\Router; | |||
16 | */ | 16 | */ |
17 | function hook_addlink_toolbar_render_header($data) | 17 | function hook_addlink_toolbar_render_header($data) |
18 | { | 18 | { |
19 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { | 19 | if ($data['_PAGE_'] == TemplatePage::LINKLIST && $data['_LOGGEDIN_'] === true) { |
20 | $form = array( | 20 | $form = array( |
21 | 'attr' => array( | 21 | 'attr' => array( |
22 | 'method' => 'GET', | 22 | 'method' => 'GET', |
23 | 'action' => '', | 23 | 'action' => $data['_BASE_PATH_'] . '/admin/shaare', |
24 | 'name' => 'addform', | 24 | 'name' => 'addform', |
25 | 'class' => 'addform', | 25 | 'class' => 'addform', |
26 | ), | 26 | ), |
diff --git a/plugins/archiveorg/archiveorg.html b/plugins/archiveorg/archiveorg.html index ad501f47..e37d887e 100644 --- a/plugins/archiveorg/archiveorg.html +++ b/plugins/archiveorg/archiveorg.html | |||
@@ -1,5 +1,5 @@ | |||
1 | <span> | 1 | <span> |
2 | <a href="https://web.archive.org/web/%s"> | 2 | <a href="https://web.archive.org/web/%s"> |
3 | <img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="%s" alt="archive.org" /> | 3 | <img class="linklist-plugin-icon" src="%s/archiveorg/internetarchive.png" title="%s" alt="archive.org" /> |
4 | </a> | 4 | </a> |
5 | </span> | 5 | </span> |
diff --git a/plugins/archiveorg/archiveorg.php b/plugins/archiveorg/archiveorg.php index 0ee1c73c..ed271532 100644 --- a/plugins/archiveorg/archiveorg.php +++ b/plugins/archiveorg/archiveorg.php | |||
@@ -17,12 +17,15 @@ use Shaarli\Plugin\PluginManager; | |||
17 | function hook_archiveorg_render_linklist($data) | 17 | function hook_archiveorg_render_linklist($data) |
18 | { | 18 | { |
19 | $archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html'); | 19 | $archive_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/archiveorg/archiveorg.html'); |
20 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | ||
20 | 21 | ||
21 | foreach ($data['links'] as &$value) { | 22 | foreach ($data['links'] as &$value) { |
22 | if ($value['private'] && preg_match('/^\?[a-zA-Z0-9-_@]{6}($|&|#)/', $value['real_url'])) { | 23 | $isNote = startsWith($value['real_url'], '/shaare/'); |
24 | if ($value['private'] && $isNote) { | ||
23 | continue; | 25 | continue; |
24 | } | 26 | } |
25 | $archive = sprintf($archive_html, $value['url'], t('View on archive.org')); | 27 | $url = $isNote ? rtrim(index_url($_SERVER), '/') . $value['real_url'] : $value['real_url']; |
28 | $archive = sprintf($archive_html, $url, $path, t('View on archive.org')); | ||
26 | $value['link_plugin'][] = $archive; | 29 | $value['link_plugin'][] = $archive; |
27 | } | 30 | } |
28 | 31 | ||
diff --git a/plugins/default_colors/default_colors.php b/plugins/default_colors/default_colors.php index 1928cc9f..e1fd5cfb 100644 --- a/plugins/default_colors/default_colors.php +++ b/plugins/default_colors/default_colors.php | |||
@@ -15,6 +15,8 @@ const DEFAULT_COLORS_PLACEHOLDERS = [ | |||
15 | 'DEFAULT_COLORS_DARK_MAIN', | 15 | 'DEFAULT_COLORS_DARK_MAIN', |
16 | ]; | 16 | ]; |
17 | 17 | ||
18 | const DEFAULT_COLORS_CSS_FILE = '/default_colors/default_colors.css'; | ||
19 | |||
18 | /** | 20 | /** |
19 | * Display an error if the plugin is active a no color is configured. | 21 | * Display an error if the plugin is active a no color is configured. |
20 | * | 22 | * |
@@ -24,58 +26,62 @@ const DEFAULT_COLORS_PLACEHOLDERS = [ | |||
24 | */ | 26 | */ |
25 | function default_colors_init($conf) | 27 | function default_colors_init($conf) |
26 | { | 28 | { |
27 | $params = ''; | 29 | $params = []; |
28 | foreach (DEFAULT_COLORS_PLACEHOLDERS as $placeholder) { | 30 | foreach (DEFAULT_COLORS_PLACEHOLDERS as $placeholder) { |
29 | $params .= trim($conf->get('plugins.'. $placeholder, '')); | 31 | $value = trim($conf->get('plugins.'. $placeholder, '')); |
32 | if (strlen($value) > 0) { | ||
33 | $params[$placeholder] = $value; | ||
34 | } | ||
30 | } | 35 | } |
31 | 36 | ||
32 | if (empty($params)) { | 37 | if (empty($params)) { |
33 | $error = t('Default colors plugin error: '. | 38 | $error = t('Default colors plugin error: '. |
34 | 'This plugin is active and no custom color is configured.'); | 39 | 'This plugin is active and no custom color is configured.'); |
35 | return array($error); | 40 | return [$error]; |
41 | } | ||
42 | |||
43 | // Colors are defined but the custom CSS file does not exist -> generate it | ||
44 | if (!file_exists(PluginManager::$PLUGINS_PATH . DEFAULT_COLORS_CSS_FILE)) { | ||
45 | default_colors_generate_css_file($params); | ||
36 | } | 46 | } |
37 | } | 47 | } |
38 | 48 | ||
39 | /** | 49 | /** |
40 | * When plugin parameters are saved, we regenerate the custom CSS file with provided settings. | 50 | * When linklist is displayed, include default_colors CSS file. |
41 | * | 51 | * |
42 | * @param array $data $_POST array | 52 | * @param array $data - header data. |
43 | * | 53 | * |
44 | * @return array Updated $_POST array | 54 | * @return mixed - header data with default_colors CSS file added. |
45 | */ | 55 | */ |
46 | function hook_default_colors_save_plugin_parameters($data) | 56 | function hook_default_colors_render_includes($data) |
47 | { | 57 | { |
48 | $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css'; | 58 | $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css'; |
49 | $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css.template'); | 59 | if (file_exists($file )) { |
50 | $content = ''; | 60 | $data['css_files'][] = $file ; |
51 | foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) { | ||
52 | $content .= ! empty($data[$rule]) | ||
53 | ? default_colors_format_css_rule($data, $rule) .';'. PHP_EOL | ||
54 | : ''; | ||
55 | } | ||
56 | |||
57 | if (! empty($content)) { | ||
58 | file_put_contents($file, sprintf($template, $content)); | ||
59 | } | 61 | } |
60 | 62 | ||
61 | return $data; | 63 | return $data; |
62 | } | 64 | } |
63 | 65 | ||
64 | /** | 66 | /** |
65 | * When linklist is displayed, include default_colors CSS file. | 67 | * Regenerate the custom CSS file with provided settings. |
66 | * | ||
67 | * @param array $data - header data. | ||
68 | * | 68 | * |
69 | * @return mixed - header data with default_colors CSS file added. | 69 | * @param array $params Plugin configuration (CSS rules) |
70 | */ | 70 | */ |
71 | function hook_default_colors_render_includes($data) | 71 | function default_colors_generate_css_file($params): void |
72 | { | 72 | { |
73 | $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css'; | 73 | $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css'; |
74 | if (file_exists($file )) { | 74 | $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css.template'); |
75 | $data['css_files'][] = $file ; | 75 | $content = ''; |
76 | foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) { | ||
77 | $content .= !empty($params[$rule]) | ||
78 | ? default_colors_format_css_rule($params, $rule) .';'. PHP_EOL | ||
79 | : ''; | ||
76 | } | 80 | } |
77 | 81 | ||
78 | return $data; | 82 | if (! empty($content)) { |
83 | file_put_contents($file, sprintf($template, $content)); | ||
84 | } | ||
79 | } | 85 | } |
80 | 86 | ||
81 | /** | 87 | /** |
diff --git a/plugins/demo_plugin/demo_plugin.php b/plugins/demo_plugin/demo_plugin.php index 8ae1b479..defb01f7 100644 --- a/plugins/demo_plugin/demo_plugin.php +++ b/plugins/demo_plugin/demo_plugin.php | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | use Shaarli\Config\ConfigManager; | 17 | use Shaarli\Config\ConfigManager; |
18 | use Shaarli\Plugin\PluginManager; | 18 | use Shaarli\Plugin\PluginManager; |
19 | use Shaarli\Router; | 19 | use Shaarli\Render\TemplatePage; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * In the footer hook, there is a working example of a translation extension for Shaarli. | 22 | * In the footer hook, there is a working example of a translation extension for Shaarli. |
@@ -74,7 +74,7 @@ function demo_plugin_init($conf) | |||
74 | function hook_demo_plugin_render_header($data) | 74 | function hook_demo_plugin_render_header($data) |
75 | { | 75 | { |
76 | // Only execute when linklist is rendered. | 76 | // Only execute when linklist is rendered. |
77 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | 77 | if ($data['_PAGE_'] == TemplatePage::LINKLIST) { |
78 | // If loggedin | 78 | // If loggedin |
79 | if ($data['_LOGGEDIN_'] === true) { | 79 | if ($data['_LOGGEDIN_'] === true) { |
80 | /* | 80 | /* |
@@ -118,7 +118,7 @@ function hook_demo_plugin_render_header($data) | |||
118 | $form = array( | 118 | $form = array( |
119 | 'attr' => array( | 119 | 'attr' => array( |
120 | 'method' => 'GET', | 120 | 'method' => 'GET', |
121 | 'action' => '?', | 121 | 'action' => $data['_BASE_PATH_'] . '/', |
122 | 'class' => 'addform', | 122 | 'class' => 'addform', |
123 | ), | 123 | ), |
124 | 'inputs' => array( | 124 | 'inputs' => array( |
@@ -441,9 +441,9 @@ function hook_demo_plugin_delete_link($data) | |||
441 | function hook_demo_plugin_render_feed($data) | 441 | function hook_demo_plugin_render_feed($data) |
442 | { | 442 | { |
443 | foreach ($data['links'] as &$link) { | 443 | foreach ($data['links'] as &$link) { |
444 | if ($data['_PAGE_'] == Router::$PAGE_FEED_ATOM) { | 444 | if ($data['_PAGE_'] == TemplatePage::FEED_ATOM) { |
445 | $link['description'] .= ' - ATOM Feed' ; | 445 | $link['description'] .= ' - ATOM Feed' ; |
446 | } elseif ($data['_PAGE_'] == Router::$PAGE_FEED_RSS) { | 446 | } elseif ($data['_PAGE_'] == TemplatePage::FEED_RSS) { |
447 | $link['description'] .= ' - RSS Feed'; | 447 | $link['description'] .= ' - RSS Feed'; |
448 | } | 448 | } |
449 | } | 449 | } |
diff --git a/plugins/isso/isso.php b/plugins/isso/isso.php index dab75dd5..d4632163 100644 --- a/plugins/isso/isso.php +++ b/plugins/isso/isso.php | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\Plugin\PluginManager; | 8 | use Shaarli\Plugin\PluginManager; |
9 | use Shaarli\Router; | 9 | use Shaarli\Render\TemplatePage; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Display an error everywhere if the plugin is enabled without configuration. | 12 | * Display an error everywhere if the plugin is enabled without configuration. |
@@ -49,12 +49,12 @@ function hook_isso_render_linklist($data, $conf) | |||
49 | $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); | 49 | $isso = sprintf($issoHtml, $issoUrl, $issoUrl, $link['id'], $link['id']); |
50 | $data['plugin_end_zone'][] = $isso; | 50 | $data['plugin_end_zone'][] = $isso; |
51 | } else { | 51 | } else { |
52 | $button = '<span><a href="?%s#isso-thread">'; | 52 | $button = '<span><a href="'. ($data['_BASE_PATH_'] ?? '') . '/shaare/%s#isso-thread">'; |
53 | // For the default theme we use a FontAwesome icon which is better than an image | 53 | // For the default theme we use a FontAwesome icon which is better than an image |
54 | if ($conf->get('resource.theme') === 'default') { | 54 | if ($conf->get('resource.theme') === 'default') { |
55 | $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>'; | 55 | $button .= '<i class="linklist-plugin-icon fa fa-comment"></i>'; |
56 | } else { | 56 | } else { |
57 | $button .= '<img class="linklist-plugin-icon" src="plugins/isso/comment.png" '; | 57 | $button .= '<img class="linklist-plugin-icon" src="'. $data['_ROOT_PATH_'].'/plugins/isso/comment.png" '; |
58 | $button .= 'title="Comment on this shaare" alt="Comments" />'; | 58 | $button .= 'title="Comment on this shaare" alt="Comments" />'; |
59 | } | 59 | } |
60 | $button .= '</a></span>'; | 60 | $button .= '</a></span>'; |
@@ -76,7 +76,7 @@ function hook_isso_render_linklist($data, $conf) | |||
76 | */ | 76 | */ |
77 | function hook_isso_render_includes($data) | 77 | function hook_isso_render_includes($data) |
78 | { | 78 | { |
79 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | 79 | if ($data['_PAGE_'] == TemplatePage::LINKLIST) { |
80 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css'; | 80 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/isso/isso.css'; |
81 | } | 81 | } |
82 | 82 | ||
diff --git a/plugins/isso/isso_button.html b/plugins/isso/isso_button.html deleted file mode 100644 index 3f828480..00000000 --- a/plugins/isso/isso_button.html +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | <span> | ||
2 | <a href="?%s#isso-thread"> | ||
3 | <img class="linklist-plugin-icon" src="plugins/archiveorg/internetarchive.png" title="%s" alt="archive.org" /> | ||
4 | </a> | ||
5 | </span> | ||
diff --git a/plugins/playvideos/README.md b/plugins/playvideos/README.md index ab4be22a..32a94e88 100644 --- a/plugins/playvideos/README.md +++ b/plugins/playvideos/README.md | |||
@@ -8,22 +8,21 @@ This uses code from https://zaius.github.io/youtube_playlist/ and is currently o | |||
8 | 8 | ||
9 | #### Installation and setup | 9 | #### Installation and setup |
10 | 10 | ||
11 | This is a default Shaarli plugin, you just have to enable it. See https://shaarli.readthedocs.io/en/master/Shaarli-configuration/ | 11 | This is a default Shaarli plugin, you just have to enable it. See [Shaarli configuration](../../doc/md/Shaarli-configuration.md). |
12 | 12 | ||
13 | 13 | ||
14 | #### Troubleshooting | 14 | #### Troubleshooting |
15 | 15 | ||
16 | If your server has [Content Security Policy](http://content-security-policy.com/) headers enabled, this may prevent the script from loading fully. You should relax the CSP in your server settings. Example CSP rule for apache2: | 16 | If your server has [Content Security Policy](http://content-security-policy.com/) headers enabled, this may prevent the script from loading fully. You should relax the CSP in your server settings. Example CSP rule for apache2: |
17 | |||
18 | In `/etc/apache2/conf-available/shaarli-csp.conf`: | ||
19 | 17 | ||
20 | ```apache | 18 | ```apache |
21 | <Directory /path/to/shaarli> | 19 | <Directory /path/to/shaarli> |
20 | # Required for playvideos plugin | ||
22 | Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' https://www.youtube.com https://s.ytimg.com 'unsafe-eval'" | 21 | Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' https://www.youtube.com https://s.ytimg.com 'unsafe-eval'" |
23 | </Directory> | 22 | </Directory> |
24 | ``` | 23 | ``` |
25 | 24 | ||
26 | Then run `a2enconf shaarli-csp; service apache2 reload` | 25 | You may place the `Header` directive in the `<Directory...` section of your [webserver configuration](../../doc/md/Server-configuration.md)/virtualhost file, or write the above snippet to `/etc/apache2/conf-available/shaarli-csp.conf`; then run `a2enconf shaarli-csp; service apache2 reload`. |
27 | 26 | ||
28 | ### License | 27 | ### License |
29 | ``` | 28 | ``` |
diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php index 0341ed59..91a9c1e5 100644 --- a/plugins/playvideos/playvideos.php +++ b/plugins/playvideos/playvideos.php | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | use Shaarli\Plugin\PluginManager; | 9 | use Shaarli\Plugin\PluginManager; |
10 | use Shaarli\Router; | 10 | use Shaarli\Render\TemplatePage; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * When linklist is displayed, add play videos to header's toolbar. | 13 | * When linklist is displayed, add play videos to header's toolbar. |
@@ -18,7 +18,7 @@ use Shaarli\Router; | |||
18 | */ | 18 | */ |
19 | function hook_playvideos_render_header($data) | 19 | function hook_playvideos_render_header($data) |
20 | { | 20 | { |
21 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | 21 | if ($data['_PAGE_'] == TemplatePage::LINKLIST) { |
22 | $playvideo = array( | 22 | $playvideo = array( |
23 | 'attr' => array( | 23 | 'attr' => array( |
24 | 'href' => '#', | 24 | 'href' => '#', |
@@ -42,7 +42,7 @@ function hook_playvideos_render_header($data) | |||
42 | */ | 42 | */ |
43 | function hook_playvideos_render_footer($data) | 43 | function hook_playvideos_render_footer($data) |
44 | { | 44 | { |
45 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | 45 | if ($data['_PAGE_'] == TemplatePage::LINKLIST) { |
46 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/jquery-1.11.2.min.js'; | 46 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/jquery-1.11.2.min.js'; |
47 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/youtube_playlist.js'; | 47 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/playvideos/youtube_playlist.js'; |
48 | } | 48 | } |
diff --git a/plugins/pubsubhubbub/pubsubhubbub.php b/plugins/pubsubhubbub/pubsubhubbub.php index 2878c050..8fe6799c 100644 --- a/plugins/pubsubhubbub/pubsubhubbub.php +++ b/plugins/pubsubhubbub/pubsubhubbub.php | |||
@@ -13,7 +13,7 @@ use pubsubhubbub\publisher\Publisher; | |||
13 | use Shaarli\Config\ConfigManager; | 13 | use Shaarli\Config\ConfigManager; |
14 | use Shaarli\Feed\FeedBuilder; | 14 | use Shaarli\Feed\FeedBuilder; |
15 | use Shaarli\Plugin\PluginManager; | 15 | use Shaarli\Plugin\PluginManager; |
16 | use Shaarli\Router; | 16 | use Shaarli\Render\TemplatePage; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Plugin init function - set the hub to the default appspot one. | 19 | * Plugin init function - set the hub to the default appspot one. |
@@ -41,7 +41,7 @@ function pubsubhubbub_init($conf) | |||
41 | */ | 41 | */ |
42 | function hook_pubsubhubbub_render_feed($data, $conf) | 42 | function hook_pubsubhubbub_render_feed($data, $conf) |
43 | { | 43 | { |
44 | $feedType = $data['_PAGE_'] == Router::$PAGE_FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; | 44 | $feedType = $data['_PAGE_'] == TemplatePage::FEED_RSS ? FeedBuilder::$FEED_RSS : FeedBuilder::$FEED_ATOM; |
45 | $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.'. $feedType .'.xml'); | 45 | $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/pubsubhubbub/hub.'. $feedType .'.xml'); |
46 | $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL')); | 46 | $data['feed_plugins_header'][] = sprintf($template, $conf->get('plugins.PUBSUBHUB_URL')); |
47 | 47 | ||
@@ -60,8 +60,8 @@ function hook_pubsubhubbub_render_feed($data, $conf) | |||
60 | function hook_pubsubhubbub_save_link($data, $conf) | 60 | function hook_pubsubhubbub_save_link($data, $conf) |
61 | { | 61 | { |
62 | $feeds = array( | 62 | $feeds = array( |
63 | index_url($_SERVER) .'?do=atom', | 63 | index_url($_SERVER) .'feed/atom', |
64 | index_url($_SERVER) .'?do=rss', | 64 | index_url($_SERVER) .'feed/rss', |
65 | ); | 65 | ); |
66 | 66 | ||
67 | $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post'; | 67 | $httpPost = function_exists('curl_version') ? false : 'nocurl_http_post'; |
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php index c1d237d5..24fd18ba 100644 --- a/plugins/qrcode/qrcode.php +++ b/plugins/qrcode/qrcode.php | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | use Shaarli\Plugin\PluginManager; | 8 | use Shaarli\Plugin\PluginManager; |
9 | use Shaarli\Router; | 9 | use Shaarli\Render\TemplatePage; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Add qrcode icon to link_plugin when rendering linklist. | 12 | * Add qrcode icon to link_plugin when rendering linklist. |
@@ -19,11 +19,12 @@ function hook_qrcode_render_linklist($data) | |||
19 | { | 19 | { |
20 | $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); | 20 | $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); |
21 | 21 | ||
22 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | ||
22 | foreach ($data['links'] as &$value) { | 23 | foreach ($data['links'] as &$value) { |
23 | $qrcode = sprintf( | 24 | $qrcode = sprintf( |
24 | $qrcode_html, | 25 | $qrcode_html, |
25 | $value['url'], | 26 | $value['url'], |
26 | PluginManager::$PLUGINS_PATH | 27 | $path |
27 | ); | 28 | ); |
28 | $value['link_plugin'][] = $qrcode; | 29 | $value['link_plugin'][] = $qrcode; |
29 | } | 30 | } |
@@ -40,7 +41,7 @@ function hook_qrcode_render_linklist($data) | |||
40 | */ | 41 | */ |
41 | function hook_qrcode_render_footer($data) | 42 | function hook_qrcode_render_footer($data) |
42 | { | 43 | { |
43 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | 44 | if ($data['_PAGE_'] == TemplatePage::LINKLIST) { |
44 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/shaarli-qrcode.js'; | 45 | $data['js_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/shaarli-qrcode.js'; |
45 | } | 46 | } |
46 | 47 | ||
@@ -56,7 +57,7 @@ function hook_qrcode_render_footer($data) | |||
56 | */ | 57 | */ |
57 | function hook_qrcode_render_includes($data) | 58 | function hook_qrcode_render_includes($data) |
58 | { | 59 | { |
59 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST) { | 60 | if ($data['_PAGE_'] == TemplatePage::LINKLIST) { |
60 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.css'; | 61 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.css'; |
61 | } | 62 | } |
62 | 63 | ||
diff --git a/plugins/qrcode/shaarli-qrcode.js b/plugins/qrcode/shaarli-qrcode.js index fe77c4cd..3316d6f6 100644 --- a/plugins/qrcode/shaarli-qrcode.js +++ b/plugins/qrcode/shaarli-qrcode.js | |||
@@ -28,14 +28,15 @@ | |||
28 | 28 | ||
29 | // 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). |
30 | function showQrCode(caller,loading) | 30 | function showQrCode(caller,loading) |
31 | { | 31 | { |
32 | // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked: | 32 | // Dynamic javascript lib loading: We only load qr.js if the QR code icon is clicked: |
33 | if (typeof(qr) == 'undefined') // Load qr.js only if not present. | 33 | if (typeof(qr) == 'undefined') // Load qr.js only if not present. |
34 | { | 34 | { |
35 | if (!loading) // If javascript lib is still loading, do not append script to body. | 35 | if (!loading) // If javascript lib is still loading, do not append script to body. |
36 | { | 36 | { |
37 | var element = document.createElement("script"); | 37 | var basePath = document.querySelector('input[name="js_base_path"]').value; |
38 | element.src = "plugins/qrcode/qr-1.1.3.min.js"; | 38 | var element = document.createElement("script"); |
39 | element.src = basePath + "/plugins/qrcode/qr-1.1.3.min.js"; | ||
39 | document.body.appendChild(element); | 40 | document.body.appendChild(element); |
40 | } | 41 | } |
41 | setTimeout(function() { showQrCode(caller,true);}, 200); // Retry in 200 milliseconds. | 42 | setTimeout(function() { showQrCode(caller,true);}, 200); // Retry in 200 milliseconds. |
@@ -44,7 +45,7 @@ function showQrCode(caller,loading) | |||
44 | 45 | ||
45 | // Remove previous qrcode if present. | 46 | // Remove previous qrcode if present. |
46 | removeQrcode(); | 47 | removeQrcode(); |
47 | 48 | ||
48 | // Build the div which contains the QR-Code: | 49 | // Build the div which contains the QR-Code: |
49 | var element = document.createElement('div'); | 50 | var element = document.createElement('div'); |
50 | element.id = 'permalinkQrcode'; | 51 | element.id = 'permalinkQrcode'; |
@@ -57,11 +58,11 @@ function showQrCode(caller,loading) | |||
57 | // Damn IE | 58 | // Damn IE |
58 | element.setAttribute('onclick', 'this.parentNode.removeChild(this);' ); | 59 | element.setAttribute('onclick', 'this.parentNode.removeChild(this);' ); |
59 | } | 60 | } |
60 | 61 | ||
61 | // Build the QR-Code: | 62 | // Build the QR-Code: |
62 | var image = qr.image({size: 8,value: caller.dataset.permalink}); | 63 | var image = qr.image({size: 8,value: caller.dataset.permalink}); |
63 | if (image) | 64 | if (image) |
64 | { | 65 | { |
65 | element.appendChild(image); | 66 | element.appendChild(image); |
66 | element.innerHTML += "<br>Click to close"; | 67 | element.innerHTML += "<br>Click to close"; |
67 | caller.parentNode.appendChild(element); | 68 | caller.parentNode.appendChild(element); |
@@ -87,4 +88,4 @@ function removeQrcode() | |||
87 | elem.parentNode.removeChild(elem); | 88 | elem.parentNode.removeChild(elem); |
88 | } | 89 | } |
89 | return false; | 90 | return false; |
90 | } \ No newline at end of file | 91 | } |
diff --git a/plugins/wallabag/README.md b/plugins/wallabag/README.md index ea21a519..c53a04d9 100644 --- a/plugins/wallabag/README.md +++ b/plugins/wallabag/README.md | |||
@@ -21,7 +21,7 @@ The directory structure should look like: | |||
21 | 21 | ||
22 | To enable the plugin, you can either: | 22 | To enable the plugin, you can either: |
23 | 23 | ||
24 | * enable it in the plugins administration page (`?do=pluginadmin`). | 24 | * enable it in the plugins administration page (`/admin/plugins`). |
25 | * add `wallabag` to your list of enabled plugins in `data/config.json.php` (`general.enabled_plugins` section). | 25 | * add `wallabag` to your list of enabled plugins in `data/config.json.php` (`general.enabled_plugins` section). |
26 | 26 | ||
27 | ### Configuration | 27 | ### Configuration |
diff --git a/plugins/wallabag/wallabag.php b/plugins/wallabag/wallabag.php index bc35df08..d0df3501 100644 --- a/plugins/wallabag/wallabag.php +++ b/plugins/wallabag/wallabag.php | |||
@@ -45,12 +45,14 @@ function hook_wallabag_render_linklist($data, $conf) | |||
45 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); | 45 | $wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html'); |
46 | 46 | ||
47 | $linkTitle = t('Save to wallabag'); | 47 | $linkTitle = t('Save to wallabag'); |
48 | $path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH; | ||
49 | |||
48 | foreach ($data['links'] as &$value) { | 50 | foreach ($data['links'] as &$value) { |
49 | $wallabag = sprintf( | 51 | $wallabag = sprintf( |
50 | $wallabagHtml, | 52 | $wallabagHtml, |
51 | $wallabagInstance->getWallabagUrl(), | 53 | $wallabagInstance->getWallabagUrl(), |
52 | urlencode($value['url']), | 54 | urlencode($value['url']), |
53 | PluginManager::$PLUGINS_PATH, | 55 | $path, |
54 | $linkTitle | 56 | $linkTitle |
55 | ); | 57 | ); |
56 | $value['link_plugin'][] = $wallabag; | 58 | $value['link_plugin'][] = $wallabag; |