diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-07-28 11:07:55 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-07-28 11:07:55 +0200 |
commit | 83faedadff76c5bdca036f39f13943f63b27e164 (patch) | |
tree | 6f44cede16ec6a60f10b9699e211e0818f06d2c8 /plugins/piwik/piwik.php | |
parent | 1d9eb22a3df85b67fe6652c0876cd7382c2fb525 (diff) | |
parent | 658988f3aeba7a5a938783249ccf2765251e5597 (diff) | |
download | Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.gz Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.tar.zst Shaarli-83faedadff76c5bdca036f39f13943f63b27e164.zip |
Merge tag 'v0.9.7' into stable
Release v0.9.7
Diffstat (limited to 'plugins/piwik/piwik.php')
-rw-r--r-- | plugins/piwik/piwik.php | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/plugins/piwik/piwik.php b/plugins/piwik/piwik.php index 7c44909c..ca00c2be 100644 --- a/plugins/piwik/piwik.php +++ b/plugins/piwik/piwik.php | |||
@@ -18,8 +18,8 @@ function piwik_init($conf) | |||
18 | $piwikUrl = $conf->get('plugins.PIWIK_URL'); | 18 | $piwikUrl = $conf->get('plugins.PIWIK_URL'); |
19 | $piwikSiteid = $conf->get('plugins.PIWIK_SITEID'); | 19 | $piwikSiteid = $conf->get('plugins.PIWIK_SITEID'); |
20 | if (empty($piwikUrl) || empty($piwikSiteid)) { | 20 | if (empty($piwikUrl) || empty($piwikSiteid)) { |
21 | $error = 'Piwik plugin error: ' . | 21 | $error = t('Piwik plugin error: ' . |
22 | 'Please define PIWIK_URL and PIWIK_SITEID in the plugin administration page.'; | 22 | 'Please define PIWIK_URL and PIWIK_SITEID in the plugin administration page.'); |
23 | return array($error); | 23 | return array($error); |
24 | } | 24 | } |
25 | } | 25 | } |
@@ -50,22 +50,24 @@ function hook_piwik_render_footer($data, $conf) | |||
50 | } | 50 | } |
51 | 51 | ||
52 | // Free elements at the end of the page. | 52 | // Free elements at the end of the page. |
53 | $data['endofpage'][] = '<!-- Piwik -->' . | 53 | $data['endofpage'][] = sprintf( |
54 | '<script type="text/javascript">' . | 54 | file_get_contents(PluginManager::$PLUGINS_PATH . '/piwik/piwik.html'), |
55 | ' var _paq = _paq || [];' . | 55 | $piwikUrl, |
56 | ' _paq.push([\'trackPageView\']);' . | 56 | $piwikSiteid, |
57 | ' _paq.push([\'enableLinkTracking\']);' . | 57 | $piwikUrl, |
58 | ' (function() {' . | 58 | $piwikSiteid |
59 | ' var u="//' . $piwikUrl . '/";' . | 59 | ); |
60 | ' _paq.push([\'setTrackerUrl\', u+\'piwik.php\']);' . | ||
61 | ' _paq.push([\'setSiteId\', \'' . $piwikSiteid . '\']);' . | ||
62 | ' var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0];' . | ||
63 | ' g.type=\'text/javascript\'; g.async=true; g.defer=true; g.src=u+\'piwik.js\'; s.parentNode.insertBefore(g,s);' . | ||
64 | ' })();' . | ||
65 | '</script>' . | ||
66 | '<noscript><p><img src="//' . $piwikUrl . '/piwik.php?idsite=' . $piwikSiteid . '" style="border:0;" alt="" /></p></noscript>' . | ||
67 | '<!-- End Piwik Code -->'; | ||
68 | 60 | ||
69 | return $data; | 61 | return $data; |
70 | } | 62 | } |
71 | 63 | ||
64 | /** | ||
65 | * This function is never called, but contains translation calls for GNU gettext extraction. | ||
66 | */ | ||
67 | function piwik_dummy_translation() | ||
68 | { | ||
69 | // meta | ||
70 | t('A plugin that adds Piwik tracking code to Shaarli pages.'); | ||
71 | t('Piwik URL'); | ||
72 | t('Piwik site ID'); | ||
73 | } | ||