summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
820cae2)
- hide the wallabag icon for logged out users
- set API V2 as default parameter
- fix URL encoding issue with special chars
Fixes #1147
'Please define the "WALLABAG_URL" setting in the plugin administration page.');
return array($error);
}
'Please define the "WALLABAG_URL" setting in the plugin administration page.');
return array($error);
}
+ $conf->setEmpty('plugins.WALLABAG_URL', '2');
function hook_wallabag_render_linklist($data, $conf)
{
$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
function hook_wallabag_render_linklist($data, $conf)
{
$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
- if (empty($wallabagUrl)) {
+ if (empty($wallabagUrl) || !$data['_LOGGEDIN_']) {
$wallabag = sprintf(
$wallabagHtml,
$wallabagInstance->getWallabagUrl(),
$wallabag = sprintf(
$wallabagHtml,
$wallabagInstance->getWallabagUrl(),
- urlencode($value['url']),
+ urlencode(unescape($value['url'])),
$conf = new ConfigManager('');
$conf->set('plugins.WALLABAG_URL', 'value');
$str = 'http://randomstr.com/test';
$conf = new ConfigManager('');
$conf->set('plugins.WALLABAG_URL', 'value');
$str = 'http://randomstr.com/test';
- 'links' => array(
- array(
+ ]
+ ],
+ '_LOGGEDIN_' => true,
+ ];
$data = hook_wallabag_render_linklist($data, $conf);
$link = $data['links'][0];
$data = hook_wallabag_render_linklist($data, $conf);
$link = $data['links'][0];
$this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str)));
$this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL')));
}
$this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str)));
$this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL')));
}
+
+ /**
+ * Test render_linklist hook while logged out: no change.
+ */
+ public function testWallabagLinklistLoggedOut(): void
+ {
+ $conf = new ConfigManager('');
+ $str = 'http://randomstr.com/test';
+ $data = [
+ 'title' => $str,
+ 'links' => [
+ [
+ 'url' => $str,
+ ]
+ ],
+ '_LOGGEDIN_' => false,
+ ];
+
+ $result = hook_wallabag_render_linklist($data, $conf);
+
+ static::assertSame($data, $result);
+ }