4 * Add QRCode containing URL for each links.
5 * Display a QRCode icon in link list.
8 use Shaarli\Plugin\PluginManager
;
9 use Shaarli\Render\TemplatePage
;
12 * Add qrcode icon to link_plugin when rendering linklist.
14 * @param array $data - linklist data.
16 * @return mixed - linklist data with qrcode plugin.
18 function hook_qrcode_render_linklist($data)
20 $qrcode_html = file_get_contents(PluginManager
::$PLUGINS_PATH . '/qrcode/qrcode.html');
22 foreach ($data['links'] as &$value) {
26 PluginManager
::$PLUGINS_PATH
28 $value['link_plugin'][] = $qrcode;
35 * When linklist is displayed, include qrcode JS files.
37 * @param array $data - footer data.
39 * @return mixed - footer data with qrcode JS files added.
41 function hook_qrcode_render_footer($data)
43 if ($data['_PAGE_'] == TemplatePage
::LINKLIST
) {
44 $data['js_files'][] = PluginManager
::$PLUGINS_PATH . '/qrcode/shaarli-qrcode.js';
51 * When linklist is displayed, include qrcode CSS file.
53 * @param array $data - header data.
55 * @return mixed - header data with qrcode CSS file added.
57 function hook_qrcode_render_includes($data)
59 if ($data['_PAGE_'] == TemplatePage
::LINKLIST
) {
60 $data['css_files'][] = PluginManager
::$PLUGINS_PATH . '/qrcode/qrcode.css';
67 * This function is never called, but contains translation calls for GNU gettext extraction.
69 function qrcode_dummy_translation()
72 t('For each link, add a QRCode icon.');