From: Arthur Date: Sun, 8 Nov 2015 11:45:19 +0000 (+0100) Subject: Merge pull request #280 from ArthurHoaro/plugin-readityourself X-Git-Tag: v0.6.0~3^2~3 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=e760840feaf7eff6b3aae86545ff45231b9e3592;hp=00c25040c523104e1b845fd71d1cd134a1a5e7ff;p=github%2Fshaarli%2FShaarli.git Merge pull request #280 from ArthurHoaro/plugin-readityourself PLUGIN readityourself --- diff --git a/plugins/readityourself/book-open.png b/plugins/readityourself/book-open.png new file mode 100644 index 00000000..36513d7b Binary files /dev/null and b/plugins/readityourself/book-open.png differ diff --git a/plugins/readityourself/config.php.dist b/plugins/readityourself/config.php.dist new file mode 100644 index 00000000..d6b5cb85 --- /dev/null +++ b/plugins/readityourself/config.php.dist @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/plugins/readityourself/readityourself.php b/plugins/readityourself/readityourself.php new file mode 100644 index 00000000..ee7579c0 --- /dev/null +++ b/plugins/readityourself/readityourself.php @@ -0,0 +1,43 @@ + $str, + 'links' => array( + array( + 'url' => $str, + ) + ) + ); + + $data = hook_readityourself_render_linklist($data); + $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. + */ + function testReadityourselfLinklistWithoutConfig() + { + unset($GLOBALS['plugins']['READITYOUSELF_URL']); + $str = 'http://randomstr.com/test'; + $data = array( + 'title' => $str, + 'links' => array( + array( + 'url' => $str, + ) + ) + ); + + $data = hook_readityourself_render_linklist($data); + $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); + } +}