Merge latest 0.12.2
This commit is contained in:
parent
984073a980
commit
23a5fc1eef
232 changed files with 27850 additions and 10113 deletions
plugins/wallabag
|
@ -21,7 +21,7 @@ The directory structure should look like:
|
|||
|
||||
To enable the plugin, you can either:
|
||||
|
||||
* enable it in the plugins administration page (`?do=pluginadmin`).
|
||||
* enable it in the plugins administration page (`/admin/plugins`).
|
||||
* add `wallabag` to your list of enabled plugins in `data/config.json.php` (`general.enabled_plugins` section).
|
||||
|
||||
### Configuration
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Shaarli\Plugin\Wallabag;
|
||||
|
||||
/**
|
||||
|
@ -11,20 +12,20 @@ class WallabagInstance
|
|||
* - key: version ID, must match plugin settings.
|
||||
* - value: version name.
|
||||
*/
|
||||
private static $wallabagVersions = array(
|
||||
private static $wallabagVersions = [
|
||||
1 => '1.x',
|
||||
2 => '2.x',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array Static reference to WB endpoint according to the API version.
|
||||
* - key: version name.
|
||||
* - value: endpoint.
|
||||
*/
|
||||
private static $wallabagEndpoints = array(
|
||||
private static $wallabagEndpoints = [
|
||||
'1.x' => '?plainurl=',
|
||||
'2.x' => 'bookmarklet?url=',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string Wallabag user instance URL.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Wallabag plugin
|
||||
*/
|
||||
|
@ -18,10 +19,11 @@ function wallabag_init($conf)
|
|||
{
|
||||
$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
|
||||
if (empty($wallabagUrl)) {
|
||||
$error = t('Wallabag plugin error: '.
|
||||
$error = t('Wallabag plugin error: ' .
|
||||
'Please define the "WALLABAG_URL" setting in the plugin administration page.');
|
||||
return array($error);
|
||||
return [$error];
|
||||
}
|
||||
$conf->setEmpty('plugins.WALLABAG_URL', '2');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +37,7 @@ function wallabag_init($conf)
|
|||
function hook_wallabag_render_linklist($data, $conf)
|
||||
{
|
||||
$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
|
||||
if (empty($wallabagUrl)) {
|
||||
if (empty($wallabagUrl) || !$data['_LOGGEDIN_']) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -45,12 +47,14 @@ function hook_wallabag_render_linklist($data, $conf)
|
|||
$wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
|
||||
|
||||
$linkTitle = t('Save to wallabag');
|
||||
$path = ($data['_ROOT_PATH_'] ?? '') . '/' . PluginManager::$PLUGINS_PATH;
|
||||
|
||||
foreach ($data['links'] as &$value) {
|
||||
$wallabag = sprintf(
|
||||
$wallabagHtml,
|
||||
$wallabagInstance->getWallabagUrl(),
|
||||
urlencode($value['url']),
|
||||
PluginManager::$PLUGINS_PATH,
|
||||
urlencode(unescape($value['url'])),
|
||||
$path,
|
||||
$linkTitle
|
||||
);
|
||||
$value['link_plugin'][] = $wallabag;
|
||||
|
@ -65,7 +69,7 @@ function hook_wallabag_render_linklist($data, $conf)
|
|||
function wallabag_dummy_translation()
|
||||
{
|
||||
// meta
|
||||
t('For each link, add a QRCode icon.');
|
||||
t("For each link, add a Wallabag icon to save it in your instance.");
|
||||
t('Wallabag API URL');
|
||||
t('Wallabag API version (1 or 2)');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue