aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-12-23 19:50:33 +0100
committerVirtualTam <virtualtam@flibidi.net>2015-12-23 19:50:33 +0100
commitccb7cf9855a1842fbba4e48f05dad906402d4ca1 (patch)
tree70178dfe49f908d4992dbcd39ee8d498b7ef61f8
parent70a35e2a6dfeabcb657494a0f30eb630aeb57792 (diff)
parent49e62f22ad750d4d60936ec8437caee91809b179 (diff)
downloadShaarli-ccb7cf9855a1842fbba4e48f05dad906402d4ca1.tar.gz
Shaarli-ccb7cf9855a1842fbba4e48f05dad906402d4ca1.tar.zst
Shaarli-ccb7cf9855a1842fbba4e48f05dad906402d4ca1.zip
Merge pull request #418 from ArthurHoaro/qrcode-bug
QRCode plugin: use url instead of real_url
-rw-r--r--application/LinkDB.php4
-rw-r--r--plugins/qrcode/qrcode.php6
-rw-r--r--tests/plugins/PlugQrcodeTest.php4
3 files changed, 10 insertions, 4 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php
index f771ac8b..51fa926d 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -17,8 +17,10 @@
17 * - private: Is this link private? 0=no, other value=yes 17 * - private: Is this link private? 0=no, other value=yes
18 * - tags: tags attached to this entry (separated by spaces) 18 * - tags: tags attached to this entry (separated by spaces)
19 * - title Title of the link 19 * - title Title of the link
20 * - url URL of the link. Can be absolute or relative. 20 * - url URL of the link. Used for displayable links (no redirector, relative, etc.).
21 * Can be absolute or relative.
21 * Relative URLs are permalinks (e.g.'?m-ukcw') 22 * Relative URLs are permalinks (e.g.'?m-ukcw')
23 * - real_url Absolute processed URL.
22 * 24 *
23 * Implements 3 interfaces: 25 * Implements 3 interfaces:
24 * - ArrayAccess: behaves like an associative array; 26 * - ArrayAccess: behaves like an associative array;
diff --git a/plugins/qrcode/qrcode.php b/plugins/qrcode/qrcode.php
index a709abaa..8bc610d1 100644
--- a/plugins/qrcode/qrcode.php
+++ b/plugins/qrcode/qrcode.php
@@ -17,7 +17,11 @@ function hook_qrcode_render_linklist($data)
17 $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); 17 $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html');
18 18
19 foreach ($data['links'] as &$value) { 19 foreach ($data['links'] as &$value) {
20 $qrcode = sprintf($qrcode_html, $value['real_url'], $value['real_url'], PluginManager::$PLUGINS_PATH); 20 $qrcode = sprintf($qrcode_html,
21 urlencode($value['url']),
22 $value['url'],
23 PluginManager::$PLUGINS_PATH
24 );
21 $value['link_plugin'][] = $qrcode; 25 $value['link_plugin'][] = $qrcode;
22 } 26 }
23 27
diff --git a/tests/plugins/PlugQrcodeTest.php b/tests/plugins/PlugQrcodeTest.php
index c749fa86..86dc7f29 100644
--- a/tests/plugins/PlugQrcodeTest.php
+++ b/tests/plugins/PlugQrcodeTest.php
@@ -30,7 +30,7 @@ class PlugQrcodeTest extends PHPUnit_Framework_TestCase
30 'title' => $str, 30 'title' => $str,
31 'links' => array( 31 'links' => array(
32 array( 32 array(
33 'real_url' => $str, 33 'url' => $str,
34 ) 34 )
35 ) 35 )
36 ); 36 );
@@ -39,7 +39,7 @@ class PlugQrcodeTest extends PHPUnit_Framework_TestCase
39 $link = $data['links'][0]; 39 $link = $data['links'][0];
40 // data shouldn't be altered 40 // data shouldn't be altered
41 $this->assertEquals($str, $data['title']); 41 $this->assertEquals($str, $data['title']);
42 $this->assertEquals($str, $link['real_url']); 42 $this->assertEquals($str, $link['url']);
43 43
44 // plugin data 44 // plugin data
45 $this->assertEquals(1, count($link['link_plugin'])); 45 $this->assertEquals(1, count($link['link_plugin']));