]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Remove readityourself plugin 842/head
authorArthurHoaro <arthur@hoa.ro>
Sat, 1 Apr 2017 10:26:31 +0000 (12:26 +0200)
committerArthurHoaro <arthur@hoa.ro>
Sat, 1 Apr 2017 10:32:43 +0000 (12:32 +0200)
Fixes #818

plugins/readityourself/book-open.png [deleted file]
plugins/readityourself/readityourself.html [deleted file]
plugins/readityourself/readityourself.meta [deleted file]
plugins/readityourself/readityourself.php [deleted file]
tests/plugins/PluginReadityourselfTest.php [deleted file]

diff --git a/plugins/readityourself/book-open.png b/plugins/readityourself/book-open.png
deleted file mode 100644 (file)
index 36513d7..0000000
Binary files a/plugins/readityourself/book-open.png and /dev/null differ
diff --git a/plugins/readityourself/readityourself.html b/plugins/readityourself/readityourself.html
deleted file mode 100644 (file)
index 5e20071..0000000
+++ /dev/null
@@ -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>
diff --git a/plugins/readityourself/readityourself.meta b/plugins/readityourself/readityourself.meta
deleted file mode 100644 (file)
index bd611dd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-description="For each link, add a ReadItYourself icon to save the shaared URL."
-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 (file)
index 961c5bd..0000000
+++ /dev/null
@@ -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;
-}
diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php
deleted file mode 100644 (file)
index bbba967..0000000
+++ /dev/null
@@ -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);
-    }
-}