Remove readityourself plugin

Fixes #818
This commit is contained in:
ArthurHoaro 2017-04-01 12:26:31 +02:00
parent 4b385d6c34
commit 8e33d0e767
5 changed files with 0 additions and 153 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 B

View file

@ -1 +0,0 @@
<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>

View file

@ -1,2 +0,0 @@
description="For each link, add a ReadItYourself icon to save the shaared URL."
parameters=READITYOUSELF_URL;

View file

@ -1,51 +0,0 @@
<?php
/**
* Plugin readityourself
*/
// If we're talking about https://github.com/memiks/readityourself
// it seems kinda dead.
// Not tested.
/**
* Init function, return an error if the server is not set.
*
* @param $conf ConfigManager instance.
*
* @return array Eventual error.
*/
function readityourself_init($conf)
{
$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
if (empty($riyUrl)) {
$error = 'Readityourself plugin error: '.
'Please define the "READITYOUSELF_URL" setting in the plugin administration page.';
return array($error);
}
}
/**
* Add readityourself icon to link_plugin when rendering linklist.
*
* @param mixed $data Linklist data.
* @param ConfigManager $conf Configuration Manager instance.
*
* @return mixed - linklist data with readityourself plugin.
*/
function hook_readityourself_render_linklist($data, $conf)
{
$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
if (empty($riyUrl)) {
return $data;
}
$readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
foreach ($data['links'] as &$value) {
$readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH);
$value['link_plugin'][] = $readityourself;
}
return $data;
}

View file

@ -1,99 +0,0 @@
<?php
use Shaarli\Config\ConfigManager;
/**
* PluginReadityourselfTest.php.php
*/
require_once 'plugins/readityourself/readityourself.php';
/**
* Class PluginWallabagTest
* Unit test for the Wallabag plugin
*/
class PluginReadityourselfTest extends PHPUnit_Framework_TestCase
{
/**
* Reset plugin path
*/
public function setUp()
{
PluginManager::$PLUGINS_PATH = 'plugins';
}
/**
* Test Readityourself init without errors.
*/
public function testReadityourselfInitNoError()
{
$conf = new ConfigManager('');
$conf->set('plugins.READITYOUSELF_URL', 'value');
$errors = readityourself_init($conf);
$this->assertEmpty($errors);
}
/**
* Test Readityourself init with errors.
*/
public function testReadityourselfInitError()
{
$conf = new ConfigManager('');
$errors = readityourself_init($conf);
$this->assertNotEmpty($errors);
}
/**
* Test render_linklist hook.
*/
public function testReadityourselfLinklist()
{
$conf = new ConfigManager('');
$conf->set('plugins.READITYOUSELF_URL', 'value');
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
'links' => array(
array(
'url' => $str,
)
)
);
$data = hook_readityourself_render_linklist($data, $conf);
$link = $data['links'][0];
// data shouldn't be altered
$this->assertEquals($str, $data['title']);
$this->assertEquals($str, $link['url']);
// plugin data
$this->assertEquals(1, count($link['link_plugin']));
$this->assertNotFalse(strpos($link['link_plugin'][0], $str));
}
/**
* Test without config: nothing should happened.
*/
public function testReadityourselfLinklistWithoutConfig()
{
$conf = new ConfigManager('');
$conf->set('plugins.READITYOUSELF_URL', null);
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
'links' => array(
array(
'url' => $str,
)
)
);
$data = hook_readityourself_render_linklist($data, $conf);
$link = $data['links'][0];
// data shouldn't be altered
$this->assertEquals($str, $data['title']);
$this->assertEquals($str, $link['url']);
// plugin data
$this->assertArrayNotHasKey('link_plugin', $link);
}
}