Merge pull request #418 from ArthurHoaro/qrcode-bug

QRCode plugin: use url instead of real_url
This commit is contained in:
VirtualTam 2015-12-23 19:50:33 +01:00
commit ccb7cf9855
3 changed files with 10 additions and 4 deletions

View file

@ -17,8 +17,10 @@
* - private: Is this link private? 0=no, other value=yes * - private: Is this link private? 0=no, other value=yes
* - tags: tags attached to this entry (separated by spaces) * - tags: tags attached to this entry (separated by spaces)
* - title Title of the link * - title Title of the link
* - url URL of the link. Can be absolute or relative. * - url URL of the link. Used for displayable links (no redirector, relative, etc.).
* Can be absolute or relative.
* Relative URLs are permalinks (e.g.'?m-ukcw') * Relative URLs are permalinks (e.g.'?m-ukcw')
* - real_url Absolute processed URL.
* *
* Implements 3 interfaces: * Implements 3 interfaces:
* - ArrayAccess: behaves like an associative array; * - ArrayAccess: behaves like an associative array;

View file

@ -17,7 +17,11 @@ function hook_qrcode_render_linklist($data)
$qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html'); $qrcode_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/qrcode/qrcode.html');
foreach ($data['links'] as &$value) { foreach ($data['links'] as &$value) {
$qrcode = sprintf($qrcode_html, $value['real_url'], $value['real_url'], PluginManager::$PLUGINS_PATH); $qrcode = sprintf($qrcode_html,
urlencode($value['url']),
$value['url'],
PluginManager::$PLUGINS_PATH
);
$value['link_plugin'][] = $qrcode; $value['link_plugin'][] = $qrcode;
} }

View file

@ -30,7 +30,7 @@ function testQrcodeLinklist()
'title' => $str, 'title' => $str,
'links' => array( 'links' => array(
array( array(
'real_url' => $str, 'url' => $str,
) )
) )
); );
@ -39,7 +39,7 @@ function testQrcodeLinklist()
$link = $data['links'][0]; $link = $data['links'][0];
// data shouldn't be altered // data shouldn't be altered
$this->assertEquals($str, $data['title']); $this->assertEquals($str, $data['title']);
$this->assertEquals($str, $link['real_url']); $this->assertEquals($str, $link['url']);
// plugin data // plugin data
$this->assertEquals(1, count($link['link_plugin'])); $this->assertEquals(1, count($link['link_plugin']));