WP-Matomo (WP-Piwik) - Version 0.10.0.3

Version Description

  • Public beta of WP-Piwik 1.0
  • Full refactored code
  • Feature: Limit referral cookie lifetime
  • Feature: Enable content tracking
Download this release

Release Info

Developer Braekling
Plugin Icon 128x128 WP-Matomo (WP-Piwik)
Version 0.10.0.3
Comparing to
See all releases

Code changes from version 0.9.9.18 to 0.10.0.3

Files changed (104) hide show
  1. bitcoin.png +0 -0
  2. cache/.htaccess +0 -1
  3. classes/WP_Piwik.php +1158 -1462
  4. classes/WP_Piwik/Admin.php +26 -0
  5. classes/WP_Piwik/Admin/Network.php +25 -0
  6. classes/WP_Piwik/Admin/Settings.php +616 -0
  7. classes/WP_Piwik/Admin/Sitebrowser.php +93 -0
  8. classes/WP_Piwik/Admin/Statistics.php +53 -0
  9. classes/{WP_Piwik_Logger.php → WP_Piwik/Logger.php} +3 -1
  10. classes/WP_Piwik/Logger/Dummy.php +9 -0
  11. classes/{WP_Piwik_Logger_File.php → WP_Piwik/Logger/File.php} +4 -4
  12. classes/WP_Piwik/Logger/Screen.php +27 -0
  13. classes/WP_Piwik/Request.php +74 -0
  14. classes/WP_Piwik/Request/Php.php +45 -0
  15. classes/WP_Piwik/Request/Rest.php +66 -0
  16. classes/WP_Piwik/Settings.php +371 -0
  17. classes/WP_Piwik/Shortcode.php +23 -0
  18. classes/{WP_Piwik_Template.php → WP_Piwik/Template.php} +6 -7
  19. classes/WP_Piwik/Template/MetaBoxCustomVars.php +63 -0
  20. classes/WP_Piwik/TrackingCode.php +109 -0
  21. classes/WP_Piwik/Widget.php +355 -0
  22. classes/WP_Piwik/Widget/BrowserDetails.php +63 -0
  23. classes/WP_Piwik/Widget/Browsers.php +63 -0
  24. classes/WP_Piwik/Widget/Chart.php +76 -0
  25. classes/WP_Piwik/Widget/Keywords.php +21 -0
  26. classes/WP_Piwik/Widget/Noresult.php +37 -0
  27. classes/WP_Piwik/Widget/OptOut.php +17 -0
  28. classes/WP_Piwik/Widget/Overview.php +53 -0
  29. classes/WP_Piwik/Widget/Pages.php +21 -0
  30. classes/WP_Piwik/Widget/Plugins.php +37 -0
  31. classes/WP_Piwik/Widget/Post.php +51 -0
  32. classes/WP_Piwik/Widget/Referrers.php +21 -0
  33. classes/WP_Piwik/Widget/Screens.php +63 -0
  34. classes/WP_Piwik/Widget/Search.php +37 -0
  35. classes/WP_Piwik/Widget/Seo.php +31 -0
  36. classes/WP_Piwik/Widget/Systems.php +61 -0
  37. classes/WP_Piwik/Widget/Visitors.php +67 -0
  38. classes/WP_Piwik_Logger_Dummy.php +0 -9
  39. classes/WP_Piwik_MetaBox_PerPost_Stats.php +0 -47
  40. classes/WP_Piwik_Settings.php +0 -166
  41. classes/index.php +0 -2
  42. config.php +9 -10
  43. css/wp-piwik-spark.css +3 -1
  44. css/wp-piwik.css +14 -101
  45. dashboard/.htaccess +0 -1
  46. dashboard/browserdetails.php +0 -68
  47. dashboard/browsers.php +0 -69
  48. dashboard/index.php +0 -2
  49. dashboard/keywords.php +0 -30
  50. dashboard/noresult.php +0 -30
  51. dashboard/overview.php +0 -70
  52. dashboard/pages.php +0 -57
  53. dashboard/plugins.php +0 -58
  54. dashboard/screens.php +0 -68
  55. dashboard/search.php +0 -30
  56. dashboard/seo.php +0 -36
  57. dashboard/systems.php +0 -69
  58. dashboard/visitors.php +0 -99
  59. dashboard/websites.php +0 -34
  60. debug/.htaccess +0 -1
  61. debug/testscript.php +0 -86
  62. debug/testscript_standalone.php +0 -88
  63. js/wp-piwik.js +3 -2
  64. languages/wp-piwik-de_DE.mo +0 -0
  65. languages/wp-piwik-de_DE.po +922 -551
  66. languages/wp-piwik.pot +682 -637
  67. piwik.php +0 -8
  68. proxy/config.php +30 -13
  69. readme.txt +20 -12
  70. settings/.htaccess +0 -1
  71. settings/credits.php +0 -31
  72. settings/homepage.php +0 -11
  73. settings/index.php +0 -2
  74. settings/piwik.php +0 -128
  75. settings/sitebrowser.php +0 -99
  76. settings/support.php +0 -60
  77. settings/tracking.php +0 -169
  78. settings/views.php +0 -65
  79. shortcodes/.htaccess +0 -1
  80. shortcodes/overview.php +0 -50
  81. shortcodes/post.php +0 -9
  82. uninstall.php +93 -6
  83. update/100000.php +23 -0
  84. update/80403.php +82 -42
  85. update/80502.php +0 -2
  86. update/80602.php +0 -2
  87. update/80800.php +2 -2
  88. update/90001.php +9 -13
  89. update/90206.php +0 -2
  90. update/90405.php +0 -5
  91. update/90601.php +0 -3
  92. update/90700.php +0 -2
  93. update/90801.php +5 -7
  94. update/90821.php +0 -2
  95. update/90910.php +0 -3
  96. update/90920.php +0 -2
  97. update/90940.php +0 -2
  98. update/90961.php +0 -2
  99. update/90971.php +0 -3
  100. update/90980.php +0 -6
  101. update/91006.php +10 -3
  102. update/91007.php +0 -2
  103. update/index.php +0 -2
  104. wp-piwik.php +77 -1552
bitcoin.png DELETED
Binary file
cache/.htaccess DELETED
@@ -1 +0,0 @@
1
- Deny from all
 
classes/WP_Piwik.php CHANGED
@@ -1,1463 +1,1159 @@
1
- <?php
2
-
3
- class wp_piwik {
4
-
5
- private static
6
- $intRevisionId = 92000,
7
- $strVersion = '0.9.9.10',
8
- $blog_id,
9
- $intDashboardID = 30,
10
- $strPluginBasename = NULL,
11
- $bolJustActivated = false,
12
- $logger,
13
- $settings;
14
-
15
- private
16
- $intStatsPage = NULL,
17
- $bolNetwork = false,
18
- $aryAttributes = array(),
19
- $strResult = '';
20
-
21
- public function __construct() {
22
- global $blog_id;
23
- self::$blog_id = (isset($blog_id)?$blog_id:'n/a');
24
- $this->openLogger();
25
- $this->openSettings();
26
- $this->setup();
27
- $this->addFilters();
28
- $this->addActions();
29
- $this->addShortcodes();
30
- self::$settings->save();
31
- }
32
-
33
- public function __destruct() {
34
- $this->closeLogger();
35
- }
36
-
37
- private function setup() {
38
- self::$strPluginBasename = plugin_basename(__FILE__);
39
- register_activation_hook(__FILE__, array($this, 'installPlugin'));
40
- if ($this->isUpdated())
41
- $this->upgradePlugin();
42
- if ($this->isConfigSubmitted())
43
- $this->applySettings();
44
- if ($this->isPHPMode())
45
- self::definePiwikConstants();
46
- $this->loadLanguage();
47
- }
48
-
49
- private function addActions() {
50
- add_action('admin_menu', array($this, 'buildAdminMenu'));
51
- add_action('admin_post_save_wp-piwik_stats', array(&$this, 'onStatsPageSaveChanges'));
52
- add_action('load-post.php', array(&$this, 'postMetaboxes'));
53
- add_action('load-post-new.php', array(&$this, 'postMetaboxes'));
54
- if ($this->isNetworkMode())
55
- add_action('network_admin_menu', array($this, 'buildNetworkAdminMenu'));
56
- if ($this->isDashboardActive())
57
- add_action('wp_dashboard_setup', array($this, 'extendWordPressDashboard'));
58
- if ($this->isToolbarActive()) {
59
- add_action(is_admin()?'admin_head':'wp_head', array($this, 'loadToolbarRequirements'));
60
- add_action('admin_bar_menu', array(&$this, 'extendWordPressToolbar'), 1000);
61
- }
62
- if ($this->isTrackingActive()) {
63
- add_action(self::$settings->getGlobalOption('track_codeposition') == 'footer'?'wp_footer':'wp_head', array($this, 'addJavascriptCode'));
64
- if ($this->isAddNoScriptCode())
65
- add_action('wp_footer', array($this, 'addNoscriptCode'));
66
- if ($this->isAdminTrackingActive())
67
- add_action('admin_head', array($this, 'addAdminHeaderTracking'));
68
- }
69
- if (self::$settings->getGlobalOption('add_post_annotations'))
70
- add_action('transition_post_status', array($this, 'onPostStatusTransition'));
71
- }
72
-
73
- private function addFilters() {
74
- add_filter('plugin_row_meta', array($this, 'setPluginMeta'), 10, 2);
75
- add_filter('screen_layout_columns', array(&$this, 'onScreenLayoutColumns'), 10, 2);
76
- if ($this->isTrackingActive()) {
77
- if ($this->isTrackFeed()) {
78
- add_filter('the_excerpt_rss', array(&$this, 'addFeedTracking'));
79
- add_filter('the_content', array(&$this, 'addFeedTracking'));
80
- }
81
- if ($this->isAddFeedCampaign())
82
- add_filter('post_link', array(&$this, 'addFeedCampaign'));
83
- }
84
- }
85
-
86
- private function addShortcodes() {
87
- if ($this->isAddShortcode())
88
- add_shortcode('wp-piwik', array(&$this, 'shortcode'));
89
- }
90
-
91
- private function loadLanguage() {
92
- load_plugin_textdomain('wp-piwik', false, dirname(self::$strPluginBasename)."/../languages/");
93
- }
94
-
95
- function installPlugin() {
96
- self::$logger->log('Running WP-Piwik installation');
97
- add_action('admin_notices', array($this, 'updateMessage'));
98
- self::$bolJustActivated = true;
99
- self::$settings->setGlobalOption('revision', self::$intRevisionId);
100
- self::$settings->setGlobalOption('last_settings_update', time());
101
- }
102
-
103
- static function uninstallPlugin() {
104
- self::$logger->log('Running WP-Piwik uninstallation');
105
- if (!defined('WP_UNINSTALL_PLUGIN'))
106
- exit();
107
- self::$settings->resetSettings(true);
108
- }
109
-
110
- function upgradePlugin() {
111
- self::$logger->log('Upgrade WP-Piwik to '.self::$strVersion);
112
- add_action('admin_notices', array($this, 'updateMessage'));
113
- $patches = glob(dirname(__FILE__).DIRECTORY_SEPARATOR.'update'.DIRECTORY_SEPARATOR.'*.php');
114
- if (is_array($patches)) {
115
- sort($patches);
116
- foreach ($patches as $patch) {
117
- $patchVersion = (int) pathinfo($patch, PATHINFO_FILENAME);
118
- if ($patchVersion && self::$settings->getGlobalOption('revision') < $patchVersion)
119
- self::includeFile('update'.DIRECTORY_SEPARATOR.$patchVersion);
120
- }
121
- }
122
- $this->installPlugin();
123
- }
124
-
125
- function updateMessage() {
126
- $text = sprintf(__('%s %s installed.', 'wp-piwik'), self::$settings->getGlobalOption('plugin_display_name'), self::$strVersion);
127
- $notice = (!self::isConfigured()?
128
- __('Next you should connect to Piwik','wp-piwik'):
129
- __('Please validate your configuration','wp-piwik')
130
- );
131
- $link = sprintf('<a href="'.getSettingsURL.'?page=%s">%s</a>', self::$strPluginBasename, __('Settings', 'wp-piwik'));
132
- printf('<div class="updated fade"><p>%s<strong>%s:</strong> %s: %s</p></div>', $text, __('Important', 'wp-piwik'), $notice, $link);
133
- }
134
-
135
- function getSettingsURL() {
136
- return (self::$settings->checkNetworkActivation()?'settings':'options-general').'.php';
137
- }
138
-
139
- private function updateTrackingCode() {
140
- if (!self::$settings->getOption('site_id') || !self::$settings->getOption('tracking_code'))
141
- $this->addPiwikSite();
142
- if ($this->isCurrentTrackingCode()) {
143
- self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
144
- self::$settings->save();
145
- }
146
- }
147
-
148
- /* -- </REFACTORED><OLD> -- */
149
-
150
- function addJavascriptCode() {
151
- if ($this->isHiddenUser()) {
152
- self::$logger->log('Do not add tracking code to site header (user should not be tracked) Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
153
- return;
154
- }
155
- $this->updateTrackingCode();
156
-
157
- // Change code if 404
158
- if (is_404() && self::$settings->getGlobalOption('track_404')) {
159
- self::$logger->log('Apply 404 changes. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
160
- $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setDocumentTitle', '404/URL = '+String(document.location.pathname+document.location.search).replace(/\//g,'%2f') + '/From = ' + String(document.referrer).replace(/\//g,'%2f')]);\n_paq.push(['trackPageView']);", self::$settings->getOption('tracking_code'));
161
- }
162
- // Change code if search result
163
- elseif (is_search() && self::$settings->getGlobalOption('track_search')) {
164
- self::$logger->log('Apply search tracking changes. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
165
- $objSearch = new WP_Query("s=" . get_search_query() . '&showposts=-1');
166
- $intResultCount = $objSearch->post_count;
167
- $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','".get_search_query()."', false, ".$intResultCount."]);\n_paq.push(['trackPageView']);", self::$settings->getOption('tracking_code'));
168
- // Use default tracking code
169
- } else
170
- $strTrackingCode = self::$settings->getOption('tracking_code');
171
- // Send tracking code
172
- self::$logger->log('Add tracking code. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
173
- // Add custom variables if set:
174
- if (is_single()) {
175
- $strCustomVars = '';
176
- for ($i = 1; $i <= 5; $i++) {
177
- // Get post ID
178
- $intID = get_the_ID();
179
- // Get key
180
- $strMetaKey = get_post_meta($intID, 'wp-piwik_custom_cat'.$i, true);
181
- // Get value
182
- $strMetaVal = get_post_meta($intID, 'wp-piwik_custom_val'.$i, true);
183
- if (!empty($strMetaKey) && !empty($strMetaVal))
184
- $strCustomVars .= "_paq.push(['setCustomVariable',".$i.", '".$strMetaKey."', '".$strMetaVal."', 'page']);\n";
185
- }
186
- if (!empty($strCustomVars)) $strTrackingCode = str_replace("_paq.push(['trackPageView']);", $strCustomVars."_paq.push(['trackPageView']);", $strTrackingCode);
187
- }
188
- echo $strTrackingCode;
189
- $strName = get_bloginfo('name');
190
- if (self::$settings->getOption('name') != $strName)
191
- $this->updatePiwikSite();
192
- }
193
-
194
- function addNoscriptCode() {
195
- // Hotfix: Custom capability problem with WP multisite
196
- if (is_multisite()) {
197
- foreach (self::$settings->getGlobalOption('capability_stealth') as $strKey => $strVal)
198
- if ($strVal && current_user_can($strKey))
199
- return;
200
- // Don't add tracking code?
201
- } elseif (current_user_can('wp-piwik_stealth')) return;
202
- // Send tracking code
203
- self::$logger->log('Add noscript code. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
204
- echo self::$settings->getOption('noscript_code')."\n";
205
- }
206
-
207
- /**
208
- * Shortcode function
209
- **/
210
-
211
- function shortcode($aryAttributes) {
212
- $this->aryAttributes = shortcode_atts(
213
- array(
214
- 'title' => '',
215
- 'module' => 'overview',
216
- 'period' => 'day',
217
- 'date' => 'yesterday',
218
- 'limit' => 10,
219
- 'width' => '100%',
220
- 'height' => '200px',
221
- 'language' => 'en',
222
- 'range' => false,
223
- 'key' => 'sum_daily_nb_uniq_visitors'
224
- ), $aryAttributes);
225
- switch ($this->aryAttributes['module']) {
226
- case 'opt-out':
227
- $this->strResult = '<iframe frameborder="no" width="'.$this->aryAttributes['width'].'" height="'.$this->aryAttributes['height'].'" src="'.self::$settings->getGlobalOption('piwik_url').'index.php?module=CoreAdminHome&action=optOut&language='.$this->aryAttributes['language'].'"></iframe>';
228
- break;
229
- case 'post':
230
- self::includeFile('shortcodes/post');
231
- break;
232
- case 'overview':
233
- default:
234
- self::includeFile('shortcodes/overview');
235
- }
236
- return $this->strResult;
237
- }
238
-
239
- /**
240
- * Add metaboxes to posts
241
- */
242
- function postMetaboxes() {
243
- if (self::$settings->getGlobalOption('add_customvars_box')) {
244
- add_action('add_meta_boxes', array(&$this, 'postAddMetaboxes'));
245
- add_action('save_post', array(&$this, 'postCustomvarsSave'), 10, 2);
246
- }
247
- // Show per post stats if enabled
248
- if (self::$settings->getGlobalOption('perpost_stats')) {
249
- $this->includeFile('classes/WP_Piwik_MetaBox_PerPost_Stats');
250
- add_action('add_meta_boxes', array(new WP_Piwik_MetaBox_PerPost_Stats($this->subClassConfig()), 'addMetabox'));
251
- }
252
- }
253
-
254
- /**
255
- * Create post meta boxes
256
- */
257
- function postAddMetaboxes() {
258
- add_meta_box(
259
- 'wp-piwik_post_customvars',
260
- __('Piwik Custom Variables', 'wp-piwik'),
261
- array(&$this, 'postCustomvars'),
262
- 'post',
263
- 'side',
264
- 'default'
265
- );
266
- }
267
-
268
- /**
269
- * Display custom variables meta box
270
- */
271
- function postCustomvars($objPost, $objBox ) {
272
- wp_nonce_field(basename( __FILE__ ), 'wp-piwik_post_customvars_nonce'); ?>
273
- <table>
274
- <tr><th></th><th><?php _e('Name', 'wp-piwik'); ?></th><th><?php _e('Value', 'wp-piwik'); ?></th></tr>
275
- <?php for($i = 1; $i <= 5; $i++) { ?>
276
- <tr>
277
- <th><label for="wp-piwik_customvar1"><?php echo $i; ?>: </label></th>
278
- <td><input class="widefat" type="text" name="wp-piwik_custom_cat<?php echo $i; ?>" value="<?php echo esc_attr(get_post_meta($objPost->ID, 'wp-piwik_custom_cat'.$i, true ) ); ?>" size="200" /></td>
279
- <td><input class="widefat" type="text" name="wp-piwik_custom_val<?php echo $i; ?>" value="<?php echo esc_attr(get_post_meta($objPost->ID, 'wp-piwik_custom_val'.$i, true ) ); ?>" size="200" /></td>
280
- </tr>
281
- <?php } ?>
282
- </table>
283
- <p><?php _e('Set custom variables for a page view', 'wp-piwik'); ?>. (<a href="http://piwik.org/docs/custom-variables/"><?php _e('More information', 'wp-piwik'); ?></a>.)</p>
284
- <?php
285
- }
286
-
287
- /**
288
- * Save post custom variables
289
- */
290
- function postCustomvarsSave($intID, $objPost) {
291
- // Verify the nonce before proceeding.
292
- if (!isset( $_POST['wp-piwik_post_customvars_nonce'] ) || !wp_verify_nonce( $_POST['wp-piwik_post_customvars_nonce'], basename( __FILE__ ) ) )
293
- return $intID;
294
- // Get post type object
295
- $objPostType = get_post_type_object($objPost->post_type);
296
- // Check if the current user has permission to edit the post.
297
- if (!current_user_can($objPostType->cap->edit_post, $intID))
298
- return $intID;
299
- $aryNames = array('cat', 'val');
300
- for ($i = 1; $i <= 5; $i++)
301
- for ($j = 0; $j <= 1; $j++) {
302
- // Get data
303
- $strMetaVal = (isset($_POST['wp-piwik_custom_'.$aryNames[$j].$i])?htmlentities($_POST['wp-piwik_custom_'.$aryNames[$j].$i]):'');
304
- // Create key
305
- $strMetaKey = 'wp-piwik_custom_'.$aryNames[$j].$i;
306
- // Get the meta value of the custom field key
307
- $strCurVal = get_post_meta($intID, $strMetaKey, true);
308
- // Add meta val:
309
- if ($strMetaVal && '' == $strCurVal)
310
- add_post_meta($intID, $strMetaKey, $strMetaVal, true);
311
- // Update meta val:
312
- elseif ($strMetaVal && $strMetaVal != $strCurVal)
313
- update_post_meta($intID, $strMetaKey, $strMetaVal);
314
- // Delete meta val:
315
- elseif (''==$strMetaVal && $strCurVal)
316
- delete_post_meta($intID, $strMetaKey, $strCurVal);
317
- }
318
- }
319
-
320
- /**
321
- * Add pages to admin menu
322
- */
323
- function buildAdminMenu() {
324
- // Show stats dashboard page if WP-Piwik is configured
325
- if (self::isConfigured()) {
326
- // Add dashboard page
327
- $this->intStatsPage = add_dashboard_page(
328
- __('Piwik Statistics', 'wp-piwik'),
329
- self::$settings->getGlobalOption('plugin_display_name'),
330
- 'wp-piwik_read_stats',
331
- 'wp-piwik_stats',
332
- array($this, 'showStats')
333
- );
334
- // Add required scripts
335
- add_action('admin_print_scripts-'.$this->intStatsPage, array($this, 'loadStatsScripts'));
336
- // Add required styles
337
- add_action('admin_print_styles-'.$this->intStatsPage, array($this, 'addAdminStyle'));
338
- // Add required header tags
339
- add_action('admin_head-'.$this->intStatsPage, array($this, 'addAdminHeaderStats'));
340
- // Stats page onload callback
341
- add_action('load-'.$this->intStatsPage, array(&$this, 'onloadStatsPage'));
342
- }
343
- if (!self::$settings->checkNetworkActivation()) {
344
- // Add options page
345
- $intOptionsPage = add_options_page(
346
- self::$settings->getGlobalOption('plugin_display_name'),
347
- self::$settings->getGlobalOption('plugin_display_name'),
348
- 'activate_plugins',
349
- __FILE__,
350
- array($this, 'showSettings')
351
- );
352
- // Add required scripts
353
- add_action('admin_print_scripts-'.$this->intStatsPage, array($this, 'loadSettingsScripts'));
354
- // Add required header tags
355
- add_action('admin_head-'.$intOptionsPage, array($this, 'addAdminHeaderSettings'));
356
- // Add styles required by options page
357
- add_action('admin_print_styles-'.$intOptionsPage, array($this, 'addAdminStyle'));
358
- }
359
- }
360
-
361
- /**
362
- * Add pages to network admin menu
363
- */
364
- function buildNetworkAdminMenu() {
365
- // Show stats dashboard page if WP-Piwik is configured
366
- if (self::isConfigured()) {
367
- // Add dashboard page
368
- $this->intStatsPage = add_dashboard_page(
369
- __('Piwik Statistics', 'wp-piwik'),
370
- self::$settings->getGlobalOption('plugin_display_name'),
371
- 'manage_sites',
372
- 'wp-piwik_stats',
373
- array($this, 'showStatsNetwork')
374
- );
375
- // Add required scripts
376
- add_action('admin_print_scripts-'.$this->intStatsPage, array($this, 'loadStatsScripts'));
377
- // Add required styles
378
- add_action('admin_print_styles-'.$this->intStatsPage, array($this, 'addAdminStyle'));
379
- // Add required header tags
380
- add_action('admin_head-'.$this->intStatsPage, array($this, 'addAdminHeaderStats'));
381
- // Stats page onload callback
382
- add_action('load-'.$this->intStatsPage, array(&$this, 'onloadStatsPage'));
383
- }
384
- $intOptionsPage = add_submenu_page(
385
- 'settings.php',
386
- self::$settings->getGlobalOption('plugin_display_name'),
387
- self::$settings->getGlobalOption('plugin_display_name'),
388
- 'manage_sites',
389
- __FILE__,
390
- array($this, 'showSettings')
391
- );
392
-
393
- // Add styles required by options page
394
- add_action('admin_print_styles-'.$intOptionsPage, array($this, 'addAdminStyle'));
395
- add_action('admin_head-'.$intOptionsPage, array($this, 'addAdminHeaderSettings'));
396
- }
397
-
398
- /**
399
- * Support two columns
400
- * seen in Heiko Rabe's metabox demo plugin
401
- *
402
- * @see http://tinyurl.com/5r5vnzs
403
- */
404
- function onScreenLayoutColumns($aryColumns, $strScreen) {
405
- if ($strScreen == $this->intStatsPage)
406
- $aryColumns[$this->intStatsPage] = 3;
407
- return $aryColumns;
408
- }
409
-
410
- /**
411
- * Add widgets to WordPress dashboard
412
- */
413
- function extendWordPressDashboard() {
414
- // Is user allowed to see stats?
415
- if (current_user_can('wp-piwik_read_stats')) {
416
- // TODO: Use bitmask here
417
- // Add data widget if enabled
418
- if (self::$settings->getGlobalOption('dashboard_widget'))
419
- $this->addWordPressDashboardWidget();
420
- // Add chart widget if enabled
421
- if (self::$settings->getGlobalOption('dashboard_chart')) {
422
- // Add required scripts
423
- add_action('admin_print_scripts-index.php', array($this, 'loadStatsScripts'));
424
- // Add required styles
425
- add_action('admin_print_styles-index.php', array($this, 'addAdminStyle'));
426
- // Add required header tags
427
- add_action('admin_head-index.php', array($this, 'addAdminHeaderStats'));
428
- $this->addWordPressDashboardChart();
429
- }
430
- // Add SEO widget if enabled
431
- if (self::$settings->getGlobalOption('dashboard_seo'))
432
- $this->addWordPressDashboardSEO();
433
- }
434
- }
435
-
436
- /**
437
- * Add widgets to WordPress Toolbar
438
- */
439
- public function extendWordPressToolbar(&$objToolbar) {
440
- // Is user allowed to see stats?
441
- if (current_user_can('wp-piwik_read_stats') && is_admin_bar_showing()) {
442
- $aryUnique = $this->callPiwikAPI('VisitsSummary.getUniqueVisitors','day','last30',null);
443
- if (!is_array($aryUnique)) $aryUnique = array();
444
- $strGraph = '<script type="text/javascript">';
445
- $strGraph .= "var \$jSpark = jQuery.noConflict();\$jSpark(function() {var piwikSparkVals=[".implode(',',$aryUnique)."];\$jSpark('.wp-piwik_dynbar').sparkline(piwikSparkVals, {type: 'bar', barColor: '#ccc', barWidth:2});});";
446
- $strGraph .= '</script>';
447
- $strGraph .= '<span class="wp-piwik_dynbar">Loading...</span>';
448
- $objToolbar->add_menu(array(
449
- 'id' => 'wp-piwik_stats',
450
- 'title' => $strGraph,
451
- 'href' => admin_url().'?page=wp-piwik_stats'
452
- ));
453
- }
454
- }
455
-
456
- /**
457
- * Add a data widget to the WordPress dashboard
458
- */
459
- function addWordPressDashboardWidget() {
460
- $aryConfig = array(
461
- 'params' => array('period' => 'day','date' => self::$settings->getGlobalOption('dashboard_widget'),'limit' => null),
462
- 'inline' => true,
463
- );
464
- $strFile = 'overview';
465
- add_meta_box(
466
- 'wp-piwik_stats-dashboard-overview',
467
- self::$settings->getGlobalOption('plugin_display_name').' - '.__(self::$settings->getGlobalOption('dashboard_widget'), 'wp-piwik'),
468
- array(&$this, 'createDashboardWidget'),
469
- 'dashboard',
470
- 'side',
471
- 'high',
472
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
473
- );
474
- }
475
-
476
- /**
477
- * Add a visitor chart to the WordPress dashboard
478
- */
479
- function addWordPressDashboardChart() {
480
- $aryConfig = array(
481
- 'params' => array('period' => 'day','date' => 'last30','limit' => null),
482
- 'inline' => true,
483
- );
484
- $strFile = 'visitors';
485
- add_meta_box(
486
- 'wp-piwik_stats-dashboard-chart',
487
- self::$settings->getGlobalOption('plugin_display_name').' - '.__('Visitors', 'wp-piwik'),
488
- array(&$this, 'createDashboardWidget'),
489
- 'dashboard',
490
- 'side',
491
- 'high',
492
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
493
- );
494
- }
495
-
496
- /**
497
- * Add a SEO widget to the WordPress dashboard
498
- */
499
- function addWordPressDashboardSEO() {
500
- $aryConfig = array(
501
- 'params' => array('period' => 'day','date' => 'today','limit' => null),
502
- 'inline' => true,
503
- );
504
- $strFile = 'seo';
505
- add_meta_box(
506
- 'wp-piwik_stats-dashboard-seo',
507
- self::$settings->getGlobalOption('plugin_display_name').' - '.__('SEO', 'wp-piwik'),
508
- array(&$this, 'createDashboardWidget'),
509
- 'dashboard',
510
- 'side',
511
- 'high',
512
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
513
- );
514
- }
515
-
516
- /**
517
- * Add plugin meta links to plugin details
518
- *
519
- * @see http://wpengineer.com/1295/meta-links-for-wordpress-plugins/
520
- */
521
- function setPluginMeta($strLinks, $strFile) {
522
- // Get plugin basename
523
- $strPlugin = plugin_basename(__FILE__);
524
- // Add link just to this plugin's details
525
- if ($strFile == self::$strPluginBasename)
526
- return array_merge(
527
- $strLinks,
528
- array(
529
- sprintf('<a href="'.(self::$settings->checkNetworkActivation()?'settings':'options-general').'.php?page=%s">%s</a>', self::$strPluginBasename, __('Settings', 'wp-piwik'))
530
- )
531
- );
532
- // Don't affect other plugins details
533
- return $strLinks;
534
- }
535
-
536
- /**
537
- * Load required scripts to stats page
538
- */
539
- function loadStatsScripts() {
540
- // Load WP-Piwik script
541
- wp_enqueue_script('wp-piwik', $this->getPluginURL().'js/wp-piwik.js', array(), self::$strVersion, true);
542
- // Load jqPlot
543
- wp_enqueue_script('wp-piwik-jqplot',$this->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
544
- }
545
-
546
- /**
547
- * Load scripts required by Toolbar graphs
548
- */
549
- function loadToolbarRequirements() {
550
- // Only load if user is allowed to see stats
551
- if (current_user_can('wp-piwik_read_stats') && is_admin_bar_showing()) {
552
- // Load Sparklines
553
- wp_enqueue_script('wp-piwik-sparkline',$this->getPluginURL().'js/sparkline/jquery.sparkline.min.js',array('jquery'),'2.1.1');
554
- // Load CSS
555
- wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik-spark.css');
556
- }
557
- }
558
-
559
- /**
560
- * Load required scripts to settings page
561
- */
562
- function loadSettingsScripts() {
563
- wp_enqueue_script('jquery');
564
- }
565
-
566
- /**
567
- * Load required styles to admin pages
568
- */
569
- function addAdminStyle() {
570
- // Load WP-Piwik styles
571
- wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik.css',array(),self::$strVersion);
572
- }
573
-
574
- /**
575
- * Add tracking code to admin header
576
- */
577
- function addAdminHeaderTracking() {
578
- $this->site_header();
579
- }
580
-
581
- /**
582
- * Add tracking image to feeds
583
- **/
584
- function addFeedTracking($content) {
585
- global $post;
586
- if(is_feed()) {
587
- self::$logger->log('Add tracking image to feed entry.');
588
- if (!self::$settings->getOption('site_id'))
589
- self::addPiwikSite();
590
- $title = the_title(null,null,false);
591
- $posturl = get_permalink($post->ID);
592
- $urlref = get_bloginfo('rss2_url');
593
- $url = self::$settings->getGlobalOption('piwik_url');
594
- if (substr($url, -10, 10) == '/index.php')
595
- $url = str_replace('/index.php', '/piwik.php', $url);
596
- else $url .= 'piwik.php';
597
- $trackingImage = $url.'?idsite='.self::$settings->getOption('site_id').'&amp;rec=1'.
598
- '&amp;url='.urlencode($posturl).
599
- '&amp;action_name='.urlencode($title).
600
- '&amp;urlref='.urlencode($urlref);
601
- $content .= '<img src="'.$trackingImage.'" style="border:0;width:0;height:0" width="0" height="0" alt="" />';
602
- }
603
- return $content;
604
- }
605
-
606
- /**
607
- * Add tracking image to feeds
608
- **/
609
- function addFeedCampaign($permalink) {
610
- global $post;
611
- if(is_feed()) {
612
- self::$logger->log('Add campaign to feed permalink.');
613
- $sep = (strpos($permalink, '?') === false?'?':'&');
614
- $permalink .= $sep.'pk_campaign='.urlencode(self::$settings->getGlobalOption('track_feed_campaign')).'&pk_kwd='.urlencode($post->post_name);
615
- }
616
- return $permalink;
617
- }
618
-
619
- function addPiwikAnnotation($postID) {
620
- $this->callPiwikAPI('Annotations.add', '', date('Y-m-d'), '', false, false, 'PHP', '', false, 'Published: '.get_post($postID)->post_title.' - URL: '.get_permalink($postID));
621
- }
622
-
623
- /**
624
- * Add required header tags to stats page
625
- */
626
- function addAdminHeaderStats() {
627
- // Load jqPlot IE compatibility script
628
- echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.$this->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
629
- // Load jqPlot styles
630
- echo '<link rel="stylesheet" href="'.$this->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
631
- echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
632
- }
633
-
634
- /**
635
- * Add required header tags to settings page
636
- */
637
- function addAdminHeaderSettings() {
638
- echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
639
- }
640
-
641
- /**
642
- * Get this plugin's URL
643
- */
644
- function getPluginURL() {
645
- // Return plugins URL + /wp-piwik/
646
- return trailingslashit(plugins_url().'/wp-piwik/');
647
- }
648
-
649
- /**
650
- * Call REST API
651
- *
652
- * @param $strURL Remote file URL
653
- */
654
- function callREST($strURL) {
655
- $strPiwikURL = self::$settings->getGlobalOption('piwik_url');
656
- if (substr($strPiwikURL, -1, 1) != '/') $strPiwikURL .= '/';
657
- $strURL = $strPiwikURL.'?module=API'.$strURL;
658
- // Use cURL if available
659
- if (function_exists('curl_init')) {
660
- // Init cURL
661
- $c = curl_init($strURL);
662
- // Disable SSL peer verification if asked to
663
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, !self::$settings->getGlobalOption('disable_ssl_verify'));
664
- // Set user agent
665
- curl_setopt($c, CURLOPT_USERAGENT, self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string'));
666
- // Configure cURL CURLOPT_RETURNTRANSFER = 1
667
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
668
- // Configure cURL CURLOPT_HEADER = 0
669
- curl_setopt($c, CURLOPT_HEADER, 0);
670
- // Set cURL timeout
671
- curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout'));
672
- $httpProxyClass = new WP_HTTP_Proxy();
673
- if ($httpProxyClass->is_enabled() && $httpProxyClass->send_through_proxy($strURL)) {
674
- curl_setopt($c, CURLOPT_PROXY, $httpProxyClass->host());
675
- curl_setopt($c, CURLOPT_PROXYPORT, $httpProxyClass->port());
676
- if ($httpProxyClass->use_authentication())
677
- curl_setopt($c, CURLOPT_PROXYUSERPWD, $httpProxyClass->username().':'.$httpProxyClass->password());
678
- }
679
- // Get result
680
- $strResult = curl_exec($c);
681
- // Close connection
682
- curl_close($c);
683
- // cURL not available but url fopen allowed
684
- } elseif (ini_get('allow_url_fopen')) {
685
- // Set timeout
686
- $resContext = stream_context_create(array('http'=>array('timeout' => self::$settings->getGlobalOption('connection_timeout'))));
687
- // Get file using file_get_contents
688
- $strResult = @file_get_contents($strURL, false, $strContext);
689
- // Error: Not possible to get remote file
690
- } else $strResult = serialize(array(
691
- 'result' => 'error',
692
- 'message' => 'Remote access to Piwik not possible. Enable allow_url_fopen or CURL.'
693
- ));
694
- // Return result
695
- return $strResult;
696
- }
697
-
698
- /**
699
- * Call PHP API
700
- *
701
- * @param $strParams API call params
702
- */
703
- function callPHP($strParams) {
704
- if (!defined('PIWIK_INCLUDE_PATH'))
705
- return;
706
- if (PIWIK_INCLUDE_PATH === FALSE)
707
- return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' &quot;'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'&quot;: '.__('realpath() returns false','wp-piwik').'.'));
708
- if (file_exists(PIWIK_INCLUDE_PATH . "/index.php"))
709
- require_once PIWIK_INCLUDE_PATH . "/index.php";
710
- if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php"))
711
- require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
712
- if (class_exists('Piwik\FrontController'))
713
- Piwik\FrontController::getInstance()->init();
714
- else serialize(array('result' => 'error', 'message' => __('Class Piwik\FrontController does not exists.','wp-piwik')));
715
- if (class_exists('Piwik\API\Request'))
716
- $objRequest = new Piwik\API\Request($strParams);
717
- else serialize(array('result' => 'error', 'message' => __('Class Piwik\API\Request does not exists.','wp-piwik')));
718
- return $objRequest->process();
719
- }
720
-
721
- /**
722
- * Get remote file
723
- *
724
- * @param String $strURL Remote file URL
725
- */
726
- function getRemoteFile($strURL, $blogURL = '') {
727
- if (self::$settings->getGlobalOption('piwik_mode') == 'php')
728
- return $this->callPHP($strURL.($blogURL?'&url='.$blogURL:''));
729
- else
730
- return $this->callREST($strURL.($blogURL?'&url='.urlencode($blogURL):''));
731
- }
732
-
733
- /**
734
- * Add a new site to Piwik if a new blog was requested,
735
- * or get its ID by URL
736
- */
737
- function addPiwikSite() {
738
- if (isset($_GET['wpmu_show_stats']) && self::$settings->checkNetworkActivation()) {
739
- self::$logger->log('Switch blog ID: '.(int) $_GET['wpmu_show_stats']);
740
- switch_to_blog((int) $_GET['wpmu_show_stats']);
741
- }
742
- self::$logger->log('Get the blog\'s site ID by URL: '.get_bloginfo('url'));
743
- // Check if blog URL already known
744
- $strURL = '&method=SitesManager.getSitesIdFromSiteUrl';
745
- $strURL .= '&format=PHP';
746
- $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token');
747
- $aryResult = unserialize($this->getRemoteFile($strURL, get_bloginfo('url')));
748
- if (!empty($aryResult) && isset($aryResult[0]['idsite'])) {
749
- self::$settings->setOption('site_id', (int) $aryResult[0]['idsite']);
750
- // Otherwise create new site
751
- } elseif (self::isConfigured() && !empty($strURL)) {
752
- self::$logger->log('Blog not known yet - create new site');
753
- $strName = get_bloginfo('name');
754
- if (empty($strName)) $strName = get_bloginfo('url');
755
- self::$settings->setOption('name', $strName);
756
- $strURL .= '&method=SitesManager.addSite';
757
- $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode(get_bloginfo('url'));
758
- $strURL .= '&format=PHP';
759
- $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token');
760
- $strResult = unserialize($this->getRemoteFile($strURL, get_bloginfo('url')));
761
- if (!empty($strResult)) self::$settings->setOption('site_id', (int) $strResult);
762
- }
763
- // Store new data if site created
764
- if (self::$settings->getOption('site_id')) {
765
- self::$logger->log('Get the site\'s tracking code');
766
- self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
767
- } else self::$settings->getOption('tracking_code', '');
768
- self::$settings->save();
769
- if (isset($_GET['wpmu_show_stats']) && self::$settings->checkNetworkActivation()) {
770
- self::$logger->log('Back to current blog');
771
- restore_current_blog();
772
- }
773
- return array('js' => self::$settings->getOption('tracking_code'), 'id' => self::$settings->getOption('site_id'));
774
- }
775
-
776
- /**
777
- * Update a site
778
- */
779
- function updatePiwikSite() {
780
- $strBlogURL = get_bloginfo('url');
781
- // Check if blog URL already known
782
- $strName = get_bloginfo('name');
783
- if (empty($strName)) $strName = $strBlogURL;
784
- self::$settings->setOption('name', $strName);
785
- $strURL = '&method=SitesManager.updateSite';
786
- $strURL .= '&idSite='.self::$settings->getOption('site_id');
787
- $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode($strBlogURL);
788
- $strURL .= '&format=PHP';
789
- $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token');
790
- $strResult = unserialize($this->getRemoteFile($strURL));
791
- // Store new data
792
- self::$settings->getOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
793
- self::$settings->save();
794
- }
795
-
796
- /**
797
- * Apply configured Tracking Code changes
798
- */
799
- function applyJSCodeChanges($strCode) {
800
- self::$logger->log('Apply tracking code changes.');
801
- self::$settings->setOption('last_tracking_code_update', time());
802
- $strCode = html_entity_decode($strCode);
803
- // Change code if js/index.php should be used
804
- if (self::$settings->getGlobalOption('track_mode') == 1) {
805
- $strCode = str_replace('piwik.js', 'js/', $strCode);
806
- $strCode = str_replace('piwik.php', 'js/', $strCode);
807
- } elseif (self::$settings->getGlobalOption('track_mode') == 2) {
808
- $strCode = str_replace('piwik.js', 'piwik.php', $strCode);
809
- $strURL = str_replace('https://', '://', self::$settings->getGlobalOption('piwik_url'));
810
- $strURL = str_replace('http://', '://', $strURL);
811
- $strProxy = str_replace('https://', '://', plugins_url('wp-piwik'));
812
- $strProxy = str_replace('http://', '://', $strProxy);
813
- $strProxy .= '/';
814
- $strCode = str_replace($strURL, $strProxy, $strCode);
815
- }
816
- $strCode = str_replace('//";','/"',$strCode);
817
- if (self::$settings->getGlobalOption('track_cdnurl')||self::$settings->getGlobalOption('track_cdnurlssl')) {
818
- $strCode = str_replace("var d=doc", "var ucdn=(('https:' == document.location.protocol) ? 'https://".(self::$settings->getGlobalOption('track_cdnurlssl')?self::$settings->getGlobalOption('track_cdnurlssl'):self::$settings->getGlobalOption('track_cdnurl'))."/' : 'http://".(self::$settings->getGlobalOption('track_cdnurl')?self::$settings->getGlobalOption('track_cdnurl'):self::$settings->getGlobalOption('track_cdnurlssl'))."/');\nvar d=doc", $strCode);
819
- $strCode = str_replace("g.src=u+", "g.src=ucdn+", $strCode);
820
- }
821
- // Change code if POST is forced to be used
822
- if (self::$settings->getGlobalOption('track_post') && self::$settings->getGlobalOption('track_mode') != 2) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setRequestMethod', 'POST']);\n_paq.push(['trackPageView']);", $strCode);
823
- // Change code if cookies are disabled
824
- if (self::$settings->getGlobalOption('track_across')) {
825
- $referrerParsed = parse_url(get_bloginfo('url'));
826
- $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setCookieDomain', '*.".$referrerParsed['host']."']);\n_paq.push(['trackPageView']);", $strCode);
827
- }
828
- if (self::$settings->getGlobalOption('disable_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['disableCookies']);\n_paq.push(['trackPageView']);", $strCode);
829
- if (self::$settings->getGlobalOption('limit_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '".self::$settings->getGlobalOption('limit_cookies_visitor')."']);\n_paq.push(['setSessionCookieTimeout', '".self::$settings->getGlobalOption('limit_cookies_session')."']);\n_paq.push(['trackPageView']);", $strCode);
830
- // Store <noscript> code
831
- $aryNoscript = array();
832
- preg_match('/<noscript>(.*)<\/noscript>/', $strCode, $aryNoscript);
833
- if (isset($aryNoscript[0])) {
834
- if (self::$settings->getGlobalOption('track_nojavascript'))
835
- $aryNoscript[0] = str_replace('?idsite', '?rec=1&idsite', $aryNoscript[0]);
836
- self::$settings->setOption('noscript_code', $aryNoscript[0]);
837
- }
838
- if (self::$settings->getGlobalOption('track_datacfasync'))
839
- $strCode = str_replace('<script type', '<script data-cfasync="false" type', $strCode);
840
- // Remove <noscript> code
841
- $strCode = preg_replace('/<noscript>(.*)<\/noscript>/', '', $strCode);
842
- // Return code without empty lines
843
- return preg_replace('/\s+(\r\n|\r|\n)/', '$1', $strCode);
844
- }
845
-
846
- /**
847
- * Create a WordPress dashboard widget
848
- */
849
- function createDashboardWidget($objPost, $aryMetabox) {
850
- // Create description and ID
851
- $strDesc = $strID = '';
852
- $aryConfig = $aryMetabox['args']['aryConfig'];
853
- foreach ($aryConfig['params'] as $strParam)
854
- if (!empty($strParam)) {
855
- $strDesc .= $strParam.', ';
856
- $strID .= '_'.$strParam;
857
- }
858
- // Remove dots from filename
859
- $strFile = str_replace('.', '', $aryMetabox['args']['strFile']);
860
- // Finalize configuration
861
- $aryConf = array_merge($aryConfig, array(
862
- 'id' => $strFile.$strID,
863
- 'desc' => substr($strDesc, 0, -2)));
864
- // Include widget file
865
- if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'dashboard/'.$strFile.'.php'))
866
- include(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'dashboard/'.$strFile.'.php');
867
- }
868
-
869
- /**
870
- * Call Piwik's API
871
- */
872
- function callPiwikAPI($strMethod, $strPeriod='', $strDate='', $intLimit='',$bolExpanded=false, $intId = false, $strFormat = 'PHP', $strPageURL = '', $useCache = true, $strNote = '') {
873
- // Create unique cache key
874
- $strKey = 'wp-piwik_'.md5($strMethod.'_'.$strPeriod.'_'.$strDate.'_'.$intLimit.'_'.self::$settings->getGlobalOption('piwik_token').'_'.self::$settings->getGlobalOption('piwik_url').'_'.$intId.'_'.$strPageURL);
875
- // Call API if data not cached
876
- if (self::$settings->getGlobalOption('cache') && $useCache) {
877
- $result = get_transient($strKey);
878
- self::$logger->log('API method: '.$strMethod.' Fetch call from cache: '.$strKey);
879
- } else $result = false;
880
- if ($strMethod == "SitesManager.getSitesWithAtLeastViewAccess" || false === $result) {
881
- $strToken = self::$settings->getGlobalOption('piwik_token');
882
- // If multisite stats are shown, maybe the super admin wants to show other blog's stats.
883
- if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && function_exists('wp_get_current_user') && is_super_admin() && isset($_GET['wpmu_show_stats'])) {
884
- $aryOptions = get_blog_option((int) $_GET['wpmu_show_stats'], 'wp-piwik_settings' , array());
885
- if (!empty($aryOptions) && isset($aryOptions['site_id']))
886
- $intSite = $aryOptions['site_id'];
887
- else $intSite = self::$settings->getOption('site_id');
888
- // Otherwise use the current site's id.
889
- } else {
890
- if (!self::$settings->getOption('site_id'))
891
- self::addPiwikSite();
892
- $intSite = self::$settings->getOption('site_id');
893
- }
894
- //die($intSite);
895
- // Create error message if WP-Piwik isn't configured
896
- if (!self::isConfigured()) {
897
- $result = array(
898
- 'result' => 'error',
899
- 'message' => 'Piwik URL/path or auth token not set.'
900
- );
901
- return $result;
902
- }
903
- // Build URL
904
- $strURL = '&method='.$strMethod;
905
- $strURL .= '&idSite='.(int)$intSite.'&period='.$strPeriod.'&date='.$strDate;
906
- $strURL .= '&filter_limit='.$intLimit;
907
- $strURL .= '&token_auth='.$strToken;
908
- $strURL .= '&expanded='.$bolExpanded;
909
- $strURL .= '&format='.$strFormat;
910
- $strURL .= ($strPageURL?'&pageUrl='.urlencode($strPageURL):'');
911
- $strURL .= ($strNote?'&note='.urlencode($strNote):'');
912
- // Fetch data if site exists
913
- if (!empty($intSite) || $strMethod='SitesManager.getSitesWithAtLeastViewAccess') {
914
- self::$logger->log('API method: '.$strMethod.' API call: '.$strURL);
915
- $strResult = (string) $this->getRemoteFile($strURL, get_bloginfo('url'));
916
- $result = ($strFormat == 'PHP'?unserialize($strResult):$strResult);
917
- // Apply tracking code changes if configured
918
- if ($strMethod == 'SitesManager.getJavascriptTag' && !empty($result)) {
919
- $result = is_string($result)?$this->applyJSCodeChanges($result):'<!-- WP-Piwik ERROR: Tracking code not availbale -->'."\n";
920
- }
921
- // Otherwise return error message
922
- } else $result = array('result' => 'error', 'message' => 'Unknown site/blog.');
923
- if (
924
- $strMethod != 'SitesManager.getJavascriptTag' &&
925
- $strDate != 'today' && $strDate != date('Ymd') && substr($strDate, 0, 4) != 'last' &&
926
- self::$settings->getGlobalOption('cache') &&
927
- !(isset($result['result']) && $result['result'] == 'error')&&
928
- !empty($result)
929
- ) set_transient($strKey, $result, WEEK_IN_SECONDS);
930
- }
931
- return $result;
932
- }
933
-
934
- /* TODO: Add post stats
935
- * function display_post_unique_column($aryCols) {
936
- * $aryCols['wp-piwik_unique'] = __('Unique');
937
- * return $aryCols;
938
- * }
939
- *
940
- * function display_post_unique_content($strCol, $intID) {
941
- * if( $strCol == 'wp-piwik_unique' ) {
942
- * }
943
- * }
944
- */
945
-
946
- function onloadStatsPage() {
947
- wp_enqueue_script('common');
948
- wp_enqueue_script('wp-lists');
949
- wp_enqueue_script('postbox');
950
- $strToken = self::$settings->getGlobalOption('piwik_token');
951
- $strPiwikURL = self::$settings->getGlobalOption('piwik_url');
952
- $aryDashboard = array();
953
- // Set default configuration
954
- $arySortOrder = array(
955
- 'side' => array(
956
- 'overview' => array(__('Overview', 'wp-piwik'), 'day', 'yesterday'),
957
- 'seo' => array(__('SEO', 'wp-piwik'), 'day', 'yesterday'),
958
- 'pages' => array(__('Pages', 'wp-piwik'), 'day', 'yesterday'),
959
- 'keywords' => array(__('Keywords', 'wp-piwik'), 'day', 'yesterday', 10),
960
- 'websites' => array(__('Websites', 'wp-piwik'), 'day', 'yesterday', 10),
961
- 'plugins' => array(__('Plugins', 'wp-piwik'), 'day', 'yesterday'),
962
- 'search' => array(__('Site Search Keywords', 'wp-piwik'), 'day', 'yesterday', 10),
963
- 'noresult' => array(__('Site Search without Results', 'wp-piwik'), 'day', 'yesterday', 10),
964
- ),
965
- 'normal' => array(
966
- 'visitors' => array(__('Visitors', 'wp-piwik'), 'day', 'last30'),
967
- 'browsers' => array(__('Browser', 'wp-piwik'), 'day', 'yesterday'),
968
- 'browserdetails' => array(__('Browser Details', 'wp-piwik'), 'day', 'yesterday'),
969
- 'screens' => array(__('Resolution', 'wp-piwik'), 'day', 'yesterday'),
970
- 'systems' => array(__('Operating System', 'wp-piwik'), 'day', 'yesterday')
971
- )
972
- );
973
- // Don't show SEO stats if disabled
974
- if (!self::$settings->getGlobalOption('stats_seo'))
975
- unset($arySortOrder['side']['seo']);
976
-
977
- foreach ($arySortOrder as $strCol => $aryWidgets) {
978
- if (is_array($aryWidgets)) foreach ($aryWidgets as $strFile => $aryParams) {
979
- $aryDashboard[$strCol][$strFile] = array(
980
- 'params' => array(
981
- 'title' => (isset($aryParams[0])?$aryParams[0]:$strFile),
982
- 'period' => (isset($aryParams[1])?$aryParams[1]:''),
983
- 'date' => (isset($aryParams[2])?$aryParams[2]:''),
984
- 'limit' => (isset($aryParams[3])?$aryParams[3]:'')
985
- )
986
- );
987
- if (isset($_GET['date']) && preg_match('/^[0-9]{8}$/', $_GET['date']) && $strFile != 'visitors')
988
- $aryDashboard[$strCol][$strFile]['params']['date'] = $_GET['date'];
989
- elseif ($strFile != 'visitors')
990
- $aryDashboard[$strCol][$strFile]['params']['date'] = self::$settings->getGlobalOption('default_date');
991
- }
992
- }
993
- $intSideBoxCnt = $intContentBox = 0;
994
- foreach ($aryDashboard['side'] as $strFile => $aryConfig) {
995
- $intSideBoxCnt++;
996
- if (preg_match('/(\d{4})(\d{2})(\d{2})/', $aryConfig['params']['date'], $aryResult))
997
- $strDate = $aryResult[1]."-".$aryResult[2]."-".$aryResult[3];
998
- else $strDate = $aryConfig['params']['date'];
999
- add_meta_box(
1000
- 'wp-piwik_stats-sidebox-'.$intSideBoxCnt,
1001
- $aryConfig['params']['title'].' '.($aryConfig['params']['title']!='SEO'?__($strDate, 'wp-piwik'):''),
1002
- array(&$this, 'createDashboardWidget'),
1003
- $this->intStatsPage,
1004
- 'side',
1005
- 'core',
1006
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
1007
- );
1008
- }
1009
- foreach ($aryDashboard['normal'] as $strFile => $aryConfig) {
1010
- if (preg_match('/(\d{4})(\d{2})(\d{2})/', $aryConfig['params']['date'], $aryResult))
1011
- $strDate = $aryResult[1]."-".$aryResult[2]."-".$aryResult[3];
1012
- else $strDate = $aryConfig['params']['date'];
1013
- $intContentBox++;
1014
- add_meta_box(
1015
- 'wp-piwik_stats-contentbox-'.$intContentBox,
1016
- $aryConfig['params']['title'].' '.($aryConfig['params']['title']!='SEO'?__($strDate, 'wp-piwik'):''),
1017
- array(&$this, 'createDashboardWidget'),
1018
- $this->intStatsPage,
1019
- 'normal',
1020
- 'core',
1021
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
1022
- );
1023
- }
1024
- }
1025
-
1026
- // Open stats page as network admin
1027
- function showStatsNetwork() {
1028
- $this->bolNetwork = true;
1029
- $this->showStats();
1030
- }
1031
-
1032
- function showStats() {
1033
- // Disabled time limit if required
1034
- if (self::$settings->getGlobalOption('disable_timelimit') && self::$settings->getGlobalOption('disable_timelimit'))
1035
- set_time_limit(0);
1036
- //we need the global screen column value to be able to have a sidebar in WordPress 2.8
1037
- global $screen_layout_columns;
1038
- if (empty($screen_layout_columns)) $screen_layout_columns = 2;
1039
- /***************************************************************************/ ?>
1040
- <div id="wp-piwik-stats-general" class="wrap">
1041
- <?php screen_icon('options-general'); ?>
1042
- <h2><?php echo (self::$settings->getGlobalOption('plugin_display_name') == 'WP-Piwik'?'Piwik '.__('Statistics', 'wp-piwik'):self::$settings->getGlobalOption('plugin_display_name')); ?></h2>
1043
- <?php /************************************************************************/
1044
- if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin() && $this->bolNetwork) {
1045
- if (isset($_GET['wpmu_show_stats'])) {
1046
- switch_to_blog((int) $_GET['wpmu_show_stats']);
1047
- // TODO OPTIMIZE
1048
- } else {
1049
- $this->includeFile('settings/sitebrowser');
1050
- return;
1051
- }
1052
- echo '<p>'.__('Currently shown stats:').' <a href="'.get_bloginfo('url').'">'.(int) $_GET['wpmu_show_stats'].' - '.get_bloginfo('name').'</a>.'.' <a href="?page=wp-piwik_stats">Show site overview</a>.</p>'."\n";
1053
- echo '</form>'."\n";
1054
- }
1055
- /***************************************************************************/ ?>
1056
- <form action="admin-post.php" method="post">
1057
- <?php wp_nonce_field('wp-piwik_stats-general'); ?>
1058
- <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
1059
- <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
1060
- <input type="hidden" name="action" value="save_wp-piwik_stats_general" />
1061
- <div id="dashboard-widgets" class="metabox-holder columns-<?php echo $screen_layout_columns; ?><?php echo 2 <= $screen_layout_columns?' has-right-sidebar':''; ?>">
1062
- <div id='postbox-container-1' class='postbox-container'>
1063
- <?php $meta_boxes = do_meta_boxes($this->intStatsPage, 'normal', null); ?>
1064
- </div>
1065
-
1066
- <div id='postbox-container-2' class='postbox-container'>
1067
- <?php do_meta_boxes($this->intStatsPage, 'side', null); ?>
1068
- </div>
1069
-
1070
- <div id='postbox-container-3' class='postbox-container'>
1071
- <?php do_meta_boxes($this->intStatsPage, 'column3', null); ?>
1072
- </div>
1073
-
1074
- </div>
1075
- </form>
1076
- </div>
1077
- <script type="text/javascript">
1078
- //<![CDATA[
1079
- jQuery(document).ready( function($) {
1080
- // close postboxes that should be closed
1081
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
1082
- // postboxes setup
1083
- postboxes.add_postbox_toggles('<?php echo $this->intStatsPage; ?>');
1084
- });
1085
- //]]>
1086
- </script>
1087
- <?php /************************************************************************/
1088
- if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin()) {
1089
- restore_current_blog();
1090
- }
1091
- }
1092
-
1093
- /* Stats page changes by POST submit
1094
- seen in Heiko Rabe's metabox demo plugin
1095
- http://tinyurl.com/5r5vnzs */
1096
- function onStatsPageSaveChanges() {
1097
- //user permission check
1098
- if ( !current_user_can('manage_options') )
1099
- wp_die( __('Cheatin&#8217; uh?') );
1100
- //cross check the given referer
1101
- check_admin_referer('wp-piwik_stats');
1102
- //process here your on $_POST validation and / or option saving
1103
- //lets redirect the post request into get request (you may add additional params at the url, if you need to show save results
1104
- wp_redirect($_POST['_wp_http_referer']);
1105
- }
1106
-
1107
- /**
1108
- * Add tabs to settings page
1109
- * See http://wp.smashingmagazine.com/2011/10/20/create-tabs-wordpress-settings-pages/
1110
- */
1111
- function showSettingsTabs($bolFull = true, $strCurr = 'homepage') {
1112
- $aryTabs = ($bolFull?array(
1113
- 'homepage' => __('Home','wp-piwik'),
1114
- 'piwik' => __('Piwik Settings','wp-piwik'),
1115
- 'tracking' => __('Tracking','wp-piwik'),
1116
- 'views' => __('Statistics','wp-piwik'),
1117
- 'support' => __('Support','wp-piwik'),
1118
- 'credits' => __('Credits','wp-piwik')
1119
- ):array(
1120
- 'piwik' => __('Piwik Settings','wp-piwik'),
1121
- 'support' => __('Support','wp-piwik'),
1122
- 'credits' => __('Credits','wp-piwik')
1123
- ));
1124
- if (empty($strCurr)) $strCurr = 'homepage';
1125
- elseif (!isset($aryTabs[$strCurr]) && $strCurr != 'sitebrowser') $strCurr = 'piwik';
1126
- echo '<div id="icon-themes" class="icon32"><br></div>';
1127
- echo '<h2 class="nav-tab-wrapper">';
1128
- foreach($aryTabs as $strTab => $strName) {
1129
- $strClass = ($strTab == $strCurr?' nav-tab-active':'');
1130
- echo '<a class="nav-tab'.$strClass.'" href="?page=wp-piwik/classes/WP_Piwik.php&tab='.$strTab.'">'.$strName.'</a>';
1131
- }
1132
- echo '</h2>';
1133
- return $strCurr;
1134
- }
1135
-
1136
- /**
1137
- * Apply & store new settings
1138
- */
1139
- function applySettings() {
1140
- $strTab = (isset($_GET['tab'])?$_GET['tab']:'homepage');
1141
- self::$logger->log('Apply changes: '.$strTab);
1142
- switch ($strTab) {
1143
- case 'views':
1144
- self::$settings->setGlobalOption('plugin_display_name', (!empty($_POST['wp-piwik_displayname'])?htmlentities($_POST['wp-piwik_displayname']):'WP-Piwk'));
1145
- self::$settings->setGlobalOption('dashboard_widget',(isset($_POST['wp-piwik_dbwidget'])?$_POST['wp-piwik_dbwidget']:0));
1146
- self::$settings->setGlobalOption('dashboard_chart',(isset($_POST['wp-piwik_dbchart'])?$_POST['wp-piwik_dbchart']:false));
1147
- self::$settings->setGlobalOption('dashboard_seo',(isset($_POST['wp-piwik_dbseo'])?$_POST['wp-piwik_dbseo']:false));
1148
- self::$settings->setGlobalOption('stats_seo',(isset($_POST['wp-piwik_statsseo'])?$_POST['wp-piwik_statsseo']:false));
1149
- self::$settings->setGlobalOption('piwik_shortcut', (isset($_POST['wp-piwik_piwiklink'])?$_POST['wp-piwik_piwiklink']:false));
1150
- self::$settings->setGlobalOption('default_date', (isset($_POST['wp-piwik_default_date'])?$_POST['wp-piwik_default_date']:'yesterday'));
1151
- self::$settings->setGlobalOption('capability_read_stats', (isset($_POST['wp-piwik_displayto'])?$_POST['wp-piwik_displayto']:array()));
1152
- self::$settings->setGlobalOption('disable_timelimit', (isset($_POST['wp-piwik_disabletimelimit'])?$_POST['wp-piwik_disabletimelimit']:false));
1153
- self::$settings->setGlobalOption('toolbar', (isset($_POST['wp-piwik_toolbar'])?$_POST['wp-piwik_toolbar']:false));
1154
- self::$settings->setGlobalOption('shortcodes', (isset($_POST['wp-piwik_shortcodes'])?$_POST['wp-piwik_shortcodes']:false));
1155
- self::$settings->setGlobalOption('perpost_stats', (isset($_POST['wp-piwik_perpost'])?$_POST['wp-piwik_perpost']:false));
1156
- break;
1157
- case 'tracking':
1158
- self::$settings->setGlobalOption('add_tracking_code', (isset($_POST['wp-piwik_addjs'])?$_POST['wp-piwik_addjs']:false));
1159
- self::$settings->setGlobalOption('track_404', (isset($_POST['wp-piwik_404'])?$_POST['wp-piwik_404']:false));
1160
- self::$settings->setGlobalOption('track_search', (isset($_POST['wp-piwik_search'])?$_POST['wp-piwik_search']:false));
1161
- self::$settings->setGlobalOption('track_mode', (isset($_POST['wp-piwik_trackingmode'])?(int)$_POST['wp-piwik_trackingmode']:0));
1162
- self::$settings->setGlobalOption('track_post', (isset($_POST['wp-piwik_reqpost'])?$_POST['wp-piwik_reqpost']:false));
1163
- self::$settings->setGlobalOption('track_proxy', (isset($_POST['wp-piwik_proxy'])?$_POST['wp-piwik_proxy']:false));
1164
- self::$settings->setGlobalOption('track_cdnurl', trim(isset($_POST['wp-piwik_cdnurl'])?$_POST['wp-piwik_cdnurl']:''));
1165
- self::$settings->setGlobalOption('track_cdnurlssl', trim(isset($_POST['wp-piwik_cdnurlssl'])?$_POST['wp-piwik_cdnurlssl']:self::$settings->getGlobalOption('track_cdnurl')));
1166
- self::$settings->setGlobalOption('track_noscript', (isset($_POST['wp-piwik_noscript'])?$_POST['wp-piwik_noscript']:false));
1167
- self::$settings->setGlobalOption('track_codeposition', (isset($_POST['wp-piwik_codeposition'])?$_POST['wp-piwik_codeposition']:'footer'));
1168
- self::$settings->setGlobalOption('track_nojavascript', (isset($_POST['wp-piwik_nojavascript'])?$_POST['wp-piwik_nojavascript']:false));
1169
- self::$settings->setGlobalOption('track_admin', (isset($_POST['wp-piwik_trackadmin'])?$_POST['wp-piwik_trackadmin']:false));
1170
- self::$settings->setGlobalOption('track_feed', (isset($_POST['wp-piwik_trackfeed'])?$_POST['wp-piwik_trackfeed']:false));
1171
- self::$settings->setGlobalOption('track_feed_goal', (isset($_POST['wp-piwik_trackfeed_goal'])&&!empty($_POST['wp-piwik_trackfeed_goal'])?(int)$_POST['wp-piwik_trackfeed_goal']:''));
1172
- self::$settings->setGlobalOption('track_feed_revenue', (isset($_POST['wp-piwik_trackfeed_revenue'])&&!empty($_POST['wp-piwik_trackfeed_revenue'])?(int)$_POST['wp-piwik_trackfeed_revenue']:''));
1173
- self::$settings->setGlobalOption('track_feed_campaign', (isset($_POST['wp-piwik_trackfeed_campaign'])?$_POST['wp-piwik_trackfeed_campaign']:'feed'));
1174
- self::$settings->setGlobalOption('track_feed_addcampaign', (isset($_POST['wp-piwik_trackfeed_addcampaign'])?$_POST['wp-piwik_trackfeed_addcampaign']:false));
1175
- self::$settings->setGlobalOption('track_datacfasync', (isset($_POST['wp-piwik_datacfasync'])?$_POST['wp-piwik_datacfasync']:false));
1176
- self::$settings->setGlobalOption('track_across', (isset($_POST['wp-piwik_track_across'])?$_POST['wp-piwik_track_across']:false));
1177
- self::$settings->setGlobalOption('add_post_annotations', (isset($_POST['wp-piwik_annotations'])?$_POST['wp-piwik_annotations']:false));
1178
- self::$settings->setGlobalOption('add_customvars_box', (isset($_POST['wp-piwik_customvars'])?$_POST['wp-piwik_customvars']:false));
1179
- self::$settings->setGlobalOption('capability_stealth', (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array()));
1180
- self::$settings->setGlobalOption('disable_cookies', (isset($_POST['wp-piwik_disable_cookies'])?$_POST['wp-piwik_disable_cookies']:false));
1181
- self::$settings->setGlobalOption('limit_cookies', (isset($_POST['wp-piwik_limit_cookies'])?$_POST['wp-piwik_limit_cookies']:false));
1182
- self::$settings->setGlobalOption('limit_cookies_visitor', (isset($_POST['wp-piwik_limit_cookies_visitor'])?(int)$_POST['wp-piwik_limit_cookies_visitor']:1209600));
1183
- self::$settings->setGlobalOption('limit_cookies_session', (isset($_POST['wp-piwik_limit_cookies_session'])?(int)$_POST['wp-piwik_limit_cookies_session']:0));
1184
- self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
1185
- break;
1186
- case 'piwik':
1187
- self::$settings->setGlobalOption('piwik_token', (isset($_POST['wp-piwik_token'])?$_POST['wp-piwik_token']:''));
1188
- self::$settings->setGlobalOption('piwik_url', self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:'')));
1189
- self::$settings->setGlobalOption('piwik_path', (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path'])?realpath($_POST['wp-piwik_path']):''));
1190
- self::$settings->setGlobalOption('cache', (isset($_POST['wp-piwik_cache'])?$_POST['wp-piwik_cache']:false));
1191
- self::$settings->setGlobalOption('piwik_mode', (isset($_POST['wp-piwik_mode'])?$_POST['wp-piwik_mode']:'http'));
1192
- self::$settings->setGlobalOption('piwik_useragent', (isset($_POST['wp-piwik_useragent'])?$_POST['wp-piwik_useragent']:'php'));
1193
- self::$settings->setGlobalOption('connection_timeout', (isset($_POST['wp-piwik_timeout'])?(int)$_POST['wp-piwik_timeout']:5));
1194
- self::$settings->setGlobalOption('piwik_useragent_string', (isset($_POST['wp-piwik_useragent_string'])?$_POST['wp-piwik_useragent_string']:'WP-Piwik'));
1195
- self::$settings->setGlobalOption('disable_ssl_verify', (isset($_POST['wp-piwik_disable_ssl_verify'])?$_POST['wp-piwik_disable_ssl_verify']:false));
1196
- if (!self::$settings->checkNetworkActivation()) {
1197
- self::$settings->setGlobalOption('auto_site_config', (isset($_POST['wp-piwik_auto_site_config'])?$_POST['wp-piwik_auto_site_config']:false));
1198
- if (!self::$settings->getGlobalOption('auto_site_config'))
1199
- self::$settings->setOption('site_id', (isset($_POST['wp-piwik_siteid'])?$_POST['wp-piwik_siteid']:self::$settings->getOption('site_id')));
1200
- } else self::$settings->setGlobalOption('auto_site_config', true);
1201
- break;
1202
- }
1203
- if (self::$settings->getGlobalOption('auto_site_config') && self::isConfigured()) {
1204
- if (self::$settings->getGlobalOption('piwik_mode') == 'php' && !defined('PIWIK_INCLUDE_PATH'))
1205
- self::definePiwikConstants();
1206
- $aryReturn = $this->addPiwikSite();
1207
- self::$settings->getOption('tracking_code', $aryReturn['js']);
1208
- self::$settings->getOption('site_id', $aryReturn['id']);
1209
- }
1210
- self::$settings->setGlobalOption('last_settings_update', time());
1211
- }
1212
-
1213
- /**
1214
- * Check & prepare URL
1215
- */
1216
- static function checkURL($strURL) {
1217
- if (empty($strURL)) return '';
1218
- if (substr($strURL, -1, 1) != '/' && substr($strURL, -10, 10) != '/index.php')
1219
- $strURL .= '/';
1220
- return $strURL;
1221
- }
1222
-
1223
- /**
1224
- * Show settings page
1225
- */
1226
- function showSettings() {
1227
- // Define globals and get request vars
1228
- global $pagenow;
1229
- $strTab = (isset($_GET['tab'])?$_GET['tab']:'homepage');
1230
- // Show update message if stats saved
1231
- if (isset($_POST['wp-piwik_settings_submit']) && $_POST['wp-piwik_settings_submit'] == 'Y')
1232
- echo '<div id="message" class="updated fade"><p>'.__('Changes saved','wp-piwik').'</p></div>';
1233
- // Show settings page title
1234
- echo '<div class="wrap"><h2>'.self::$settings->getGlobalOption('plugin_display_name').' '.__('Settings', 'wp-piwik').'</h2>';
1235
- // Show tabs
1236
- $strTab = $this->showSettingsTabs(self::isConfigured(), $strTab);
1237
- if ($strTab != 'sitebrowser') {
1238
- /***************************************************************************/ ?>
1239
- <div class="wp-piwik-donate">
1240
- <p><strong><?php _e('Donate','wp-piwik'); ?></strong></p>
1241
- <p><?php _e('If you like WP-Piwik, you can support its development by a donation:', 'wp-piwik'); ?></p>
1242
- <div>
1243
- <script type="text/javascript">
1244
- var flattr_url = 'http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress';
1245
- </script>
1246
- <script src="http<?php echo (self::isSSL()?'s':''); ?>://api.flattr.com/button/load.js" type="text/javascript"></script>
1247
- </div>
1248
- <div>Paypal
1249
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1250
- <input type="hidden" name="cmd" value="_s-xclick" />
1251
- <input type="hidden" name="hosted_button_id" value="6046779" />
1252
- <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." />
1253
- <img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1" />
1254
- </form>
1255
- </div>
1256
- <div>
1257
- <a href="http://www.amazon.de/gp/registry/wishlist/111VUJT4HP1RA?reveal=unpurchased&amp;filter=all&amp;sort=priority&amp;layout=standard&amp;x=12&amp;y=14"><?php _e('My Amazon.de wishlist', 'wp-piwik'); ?></a>
1258
- </div>
1259
- <div>
1260
- <?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org Plugin Directory</a>.
1261
- </div>
1262
- </div>
1263
- <?php /***************************************************************************/
1264
- }
1265
- echo '<form class="'.($strTab != 'sitebrowser'?'wp-piwik-settings':'').'" method="post" action="'.admin_url(($pagenow == 'settings.php'?'network/':'').$pagenow.'?page=wp-piwik/classes/WP_Piwik.php&tab='.$strTab).'">';
1266
- echo '<input type="hidden" name="action" value="save_wp-piwik_settings" />';
1267
- wp_nonce_field('wp-piwik_settings');
1268
- // Show settings
1269
- if (($pagenow == 'options-general.php' || $pagenow == 'settings.php') && $_GET['page'] == 'wp-piwik/classes/WP_Piwik.php') {
1270
- echo '<table class="wp-piwik-form-table form-table">';
1271
- // Get tab contents
1272
- $this->includeFile('settings/'.$strTab);
1273
- // Show submit button
1274
- if (!in_array($strTab, array('homepage','credits','support','sitebrowser')))
1275
- echo '<tr><td><p class="submit" style="clear: both;padding:0;margin:0"><input type="submit" name="Submit" class="button-primary" value="'.__('Save settings', 'wp-piwik').'" /><input type="hidden" name="wp-piwik_settings_submit" value="Y" /></p></td></tr>';
1276
- echo '</table>';
1277
- }
1278
- // Close form
1279
- echo '</form></div>';
1280
- }
1281
-
1282
- /**
1283
- * Check if SSL is used
1284
- */
1285
- private static function isSSL() {
1286
- return (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off');
1287
- }
1288
-
1289
- /**
1290
- * Show an error message extended by a support site link
1291
- */
1292
- private static function showErrorMessage($strMessage) {
1293
- echo '<strong class="wp-piwik-error">'.__('An error occured', 'wp-piwik').':</strong> '.$strMessage.' [<a href="'.(self::$settings->checkNetworkActivation()?'network/settings':'options-general').'.php?page=wp-piwik/classes/WP_Piwik.php&tab=support">'.__('Support','wp-piwik').'</a>]';
1294
- }
1295
-
1296
- /**
1297
- * Read a RSS feed
1298
- */
1299
- private static function readRSSFeed($strFeedURL, $intCount = 5) {
1300
- $aryResult = array();
1301
- if (function_exists('simplexml_load_file') && !empty($strFeedURL)) {
1302
- $objXML = @simplexml_load_file($strFeedURL);
1303
- if (empty($strFeedURL) || !$objXML || !isset($objXML->channel[0]->item))
1304
- return array(array('title' => 'Can\'t read RSS feed.','url' => $strFeedURL));
1305
- foreach($objXML->channel[0]->item as $objItem) {
1306
- if( $intCount-- == 0 ) break;
1307
- $aryResult[] = array('title' => $objItem->title[0], 'url' => $objItem->link[0]);
1308
- }
1309
- }
1310
- return $aryResult;
1311
- }
1312
-
1313
- /**
1314
- * Execute test script
1315
- */
1316
- private static function loadTestscript() {
1317
- require_once('../debug/testscript.php');
1318
- }
1319
-
1320
- /**
1321
- * Get a blog's piwik ID
1322
- */
1323
- public static function getSiteID($intBlogID = null) {
1324
- $intResult = self::$settings->getOption('site_id');
1325
- if (self::$settings->checkNetworkActivation() && !empty($intBlogID)) {
1326
- $aryResult = get_blog_option($intBlogID, 'wp-piwik_settings');
1327
- $intResult = $aryResult['site_id'];
1328
- }
1329
- return (is_int($intResult)?$intResult:'n/a');
1330
- }
1331
-
1332
- public static function isConfigured() {
1333
- return (
1334
- self::$settings->getGlobalOption('piwik_token')
1335
- && (
1336
- (
1337
- (self::$settings->getGlobalOption('piwik_mode') == 'http') && (self::$settings->getGlobalOption('piwik_url'))
1338
- ) || (
1339
- (self::$settings->getGlobalOption('piwik_mode') == 'php') && (self::$settings->getGlobalOption('piwik_path'))
1340
- )
1341
- )
1342
- );
1343
- }
1344
-
1345
- private function isUpdated() {
1346
- return self::$settings->getGlobalOption('revision') && self::$settings->getGlobalOption('revision') < self::$intRevisionId;
1347
- }
1348
-
1349
- private function isConfigSubmitted() {
1350
- return isset($_POST['action']) && $_POST['action'] == 'save_wp-piwik_settings';
1351
- }
1352
-
1353
- private function isPHPMode() {
1354
- return self::$settings->getGlobalOption('piwik_mode') && self::$settings->getGlobalOption('piwik_mode') == 'php';
1355
- }
1356
-
1357
- private function isNetworkMode() {
1358
- return self::$settings->checkNetworkActivation();
1359
- }
1360
-
1361
- private function isDashboardActive() {
1362
- return self::$settings->getGlobalOption('dashboard_widget') || self::$settings->getGlobalOption('dashboard_chart') || self::$settings->getGlobalOption('dashboard_seo');
1363
- }
1364
-
1365
- private function isToolbarActive() {
1366
- return self::$settings->getGlobalOption('toolbar');
1367
- }
1368
-
1369
- private function isTrackingActive() {
1370
- return self::$settings->getGlobalOption('add_tracking_code');
1371
- }
1372
-
1373
- private function isAdminTrackingActive() {
1374
- return self::$settings->getGlobalOption('track_admin');
1375
- }
1376
-
1377
- private function isAddNoScriptCode() {
1378
- return self::$settings->getGlobalOption('track_noscript');
1379
- }
1380
-
1381
- private function isTrackFeed() {
1382
- return self::$settings->getGlobalOption('track_feed');
1383
- }
1384
-
1385
- private function isAddFeedCampaign() {
1386
- return self::$settings->getGlobalOption('track_feed_addcampaign');
1387
- }
1388
-
1389
- private function isAddShortcode() {
1390
- return self::$settings->getGlobalOption('shortcodes');
1391
- }
1392
-
1393
- private static function definePiwikConstants() {
1394
- define('PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption('piwik_path'));
1395
- define('PIWIK_USER_PATH', self::$settings->getGlobalOption('piwik_path'));
1396
- define('PIWIK_ENABLE_DISPATCH', false);
1397
- define('PIWIK_ENABLE_ERROR_HANDLER', false);
1398
- define('PIWIK_ENABLE_SESSION_START', false);
1399
- }
1400
-
1401
- private function openLogger() {
1402
- switch (WP_PIWIK_ACTIVATE_LOGGER) {
1403
- case 2:
1404
- require_once('WP_Piwik_Logger_File.php');
1405
- self::$logger = new WP_Piwik_Logger_File(__CLASS__);
1406
- break;
1407
- default:
1408
- require_once('WP_Piwik_Logger_Dummy.php');
1409
- self::$logger = new WP_Piwik_Logger_Dummy(__CLASS__);
1410
- }
1411
- }
1412
-
1413
- private function closeLogger() {
1414
- self::$logger = null;
1415
- }
1416
-
1417
- private function openSettings() {
1418
- $this->includeFile('classes/WP_Piwik_Settings');
1419
- self::$settings = new WP_Piwik_Settings(self::$logger);
1420
- }
1421
-
1422
- private function subClassConfig() {
1423
- return array(
1424
- 'wp_piwik' => $this,
1425
- 'logger' => self::$logger,
1426
- 'settings' => self::$settings
1427
- );
1428
- }
1429
-
1430
- private function includeFile($strFile) {
1431
- self::$logger->log('Include '.$strFile.'.php');
1432
- if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$strFile.'.php'))
1433
- include(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$strFile.'.php');
1434
- }
1435
-
1436
- private function isHiddenUser() {
1437
- if (is_multisite())
1438
- foreach (self::$settings->getGlobalOption('capability_stealth') as $key => $val)
1439
- if ($val && current_user_can($key)) return true;
1440
- return current_user_can('wp-piwik_stealth');
1441
- }
1442
-
1443
- private function isCurrentTrackingCode() {
1444
- return (self::$settings->getOption('last_tracking_code_update') < self::$settings->getGlobalOption('last_settings_update'));
1445
- }
1446
-
1447
- function site_header() {
1448
- self::$logger->log('Using deprecated function site_header');
1449
- $this->addJavascriptCode();
1450
- }
1451
-
1452
- function site_footer() {
1453
- self::$logger->log('Using deprecated function site_footer');
1454
- $this->addNoscriptCode();
1455
- }
1456
-
1457
- private function onPostStatusTransition($newStatus, $oldStatus = 'false', $post = null) {
1458
- if ($newStatus == 'publish' && $oldStatus != 'publish' ) {
1459
- add_action('publish_post', array($this, 'addPiwikAnnotation'));
1460
- }
1461
- }
1462
-
1463
  }
1
+ <?php
2
+
3
+ /**
4
+ * The main WP-Piwik class configures, registers and manages the plugin
5
+ *
6
+ * @author Andr&eacute; Br&auml;kling <webmaster@braekling.de>
7
+ * @package WP_Piwik
8
+ */
9
+ class WP_Piwik {
10
+
11
+ /**
12
+ *
13
+ * @var Runtime environment variables
14
+ */
15
+ private static $intRevisionId = 100000, $version = '0.10.0.3', $blog_id, $pluginBasename = NULL, $logger, $settings, $request;
16
+
17
+ /**
18
+ * Constructor class to configure and register all WP-Piwik components
19
+ */
20
+ public function __construct() {
21
+ global $blog_id;
22
+ self::$blog_id = (isset ( $blog_id ) ? $blog_id : 'n/a');
23
+ $this->openLogger ();
24
+ $this->openSettings ();
25
+ $this->setup ();
26
+ $this->addFilters ();
27
+ $this->addActions ();
28
+ $this->addShortcodes ();
29
+ self::$settings->save ();
30
+ }
31
+
32
+ /**
33
+ * Destructor class to finish logging
34
+ */
35
+ public function __destruct() {
36
+ $this->closeLogger ();
37
+ }
38
+
39
+ /**
40
+ * Setup class to prepare settings and check for installation and update
41
+ */
42
+ private function setup() {
43
+ self::$pluginBasename = plugin_basename ( __FILE__ );
44
+ if (! $this->isInstalled ())
45
+ $this->installPlugin ();
46
+ elseif ($this->isUpdated ())
47
+ $this->updatePlugin ();
48
+ if ($this->isConfigSubmitted ())
49
+ $this->applySettings ();
50
+ }
51
+
52
+ /**
53
+ * Register WordPress actions
54
+ */
55
+ private function addActions() {
56
+ if ( is_admin () ) {
57
+ add_action ( 'admin_notices', array (
58
+ $this,
59
+ 'showNotices'
60
+ ) );
61
+ add_action ( 'admin_menu', array (
62
+ $this,
63
+ 'buildAdminMenu'
64
+ ) );
65
+ add_action ( 'admin_post_save_wp-piwik_stats', array (
66
+ $this,
67
+ 'onStatsPageSaveChanges'
68
+ ) );
69
+ add_action ( 'load-post.php', array (
70
+ $this,
71
+ 'addPostMetaboxes'
72
+ ) );
73
+ add_action ( 'load-post-new.php', array (
74
+ $this,
75
+ 'addPostMetaboxes'
76
+ ) );
77
+ if ($this->isNetworkMode ()) {
78
+ add_action ( 'network_admin_menu', array (
79
+ $this,
80
+ 'buildNetworkAdminMenu'
81
+ ) );
82
+ add_action ( 'update_site_option_blogname', array (
83
+ $this,
84
+ 'onBlogNameChange'
85
+ ) );
86
+ add_action ( 'update_site_option_siteurl', array (
87
+ $this,
88
+ 'onSiteUrlChange'
89
+ ) );
90
+ } else {
91
+ add_action ( 'update_option_blogname', array (
92
+ $this,
93
+ 'onBlogNameChange'
94
+ ) );
95
+ add_action ( 'update_option_siteurl', array (
96
+ $this,
97
+ 'onSiteUrlChange'
98
+ ) );
99
+ }
100
+ if ($this->isDashboardActive ())
101
+ add_action ( 'wp_dashboard_setup', array (
102
+ $this,
103
+ 'extendWordPressDashboard'
104
+ ) );
105
+ if (self::$settings->getGlobalOption ( 'add_post_annotations' ))
106
+ add_action ( 'transition_post_status', array (
107
+ $this,
108
+ 'onPostStatusTransition'
109
+ ), 10, 3 );
110
+ }
111
+ if ($this->isToolbarActive ()) {
112
+ add_action ( is_admin () ? 'admin_head' : 'wp_head', array (
113
+ $this,
114
+ 'loadToolbarRequirements'
115
+ ) );
116
+ add_action ( 'admin_bar_menu', array (
117
+ $this,
118
+ 'extendWordPressToolbar'
119
+ ), 1000 );
120
+ }
121
+ if ($this->isTrackingActive ()) {
122
+ if ( !is_admin () ) {
123
+ add_action ( self::$settings->getGlobalOption ( 'track_codeposition' ) == 'footer' ? 'wp_footer' : 'wp_head', array (
124
+ $this,
125
+ 'addJavascriptCode'
126
+ ) );
127
+ if ($this->isAddNoScriptCode ())
128
+ add_action ( 'wp_footer', array (
129
+ $this,
130
+ 'addNoscriptCode'
131
+ ) );
132
+ } else if ($this->isAdminTrackingActive ())
133
+ add_action ( self::$settings->getGlobalOption ( 'track_codeposition' ) == 'footer' ? 'admin_footer' : 'admin_head', array (
134
+ $this,
135
+ 'addJavascriptCode'
136
+ ) );
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Register WordPress filters
142
+ */
143
+ private function addFilters() {
144
+ if (is_admin()) {
145
+ add_filter ( 'plugin_row_meta', array (
146
+ $this,
147
+ 'setPluginMeta'
148
+ ), 10, 2 );
149
+ add_filter ( 'screen_layout_columns', array (
150
+ $this,
151
+ 'onScreenLayoutColumns'
152
+ ), 10, 2 );
153
+ } elseif ($this->isTrackingActive ()) {
154
+ if ($this->isTrackFeed ()) {
155
+ add_filter ( 'the_excerpt_rss', array (
156
+ $this,
157
+ 'addFeedTracking'
158
+ ) );
159
+ add_filter ( 'the_content', array (
160
+ $this,
161
+ 'addFeedTracking'
162
+ ) );
163
+ }
164
+ if ($this->isAddFeedCampaign ())
165
+ add_filter ( 'post_link', array (
166
+ $this,
167
+ 'addFeedCampaign'
168
+ ) );
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Register WordPress shortcodes
174
+ */
175
+ private function addShortcodes() {
176
+ if ($this->isAddShortcode ())
177
+ add_shortcode ( 'wp-piwik', array (
178
+ $this,
179
+ 'shortcode'
180
+ ) );
181
+ }
182
+
183
+ /**
184
+ * Install WP-Piwik for the first time
185
+ */
186
+ private function installPlugin($isUpdate = false) {
187
+ self::$logger->log ( 'Running WP-Piwik installation' );
188
+ if (! $isUpdate)
189
+ $this->addNotice ( 'install', sprintf ( __ ( '%s %s installed.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$version ), __ ( 'Next you should connect to Piwik', 'wp-piwik' ) );
190
+ self::$settings->setGlobalOption ( 'revision', self::$intRevisionId );
191
+ self::$settings->setGlobalOption ( 'last_settings_update', time () );
192
+ }
193
+
194
+ /**
195
+ * Uninstall WP-Piwik
196
+ */
197
+ public static function uninstallPlugin() {
198
+ self::$logger->log ( 'Running WP-Piwik uninstallation' );
199
+ if (! defined ( 'WP_UNINSTALL_PLUGIN' ))
200
+ exit ();
201
+ delete_option ( 'wp-piwik-notices' );
202
+ self::$settings->resetSettings ( true );
203
+ }
204
+
205
+ /**
206
+ * Update WP-Piwik
207
+ */
208
+ private function updatePlugin() {
209
+ self::$logger->log ( 'Upgrade WP-Piwik to ' . self::$version );
210
+ $patches = glob ( dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'update' . DIRECTORY_SEPARATOR . '*.php' );
211
+ if (is_array ( $patches )) {
212
+ sort ( $patches );
213
+ foreach ( $patches as $patch ) {
214
+ $patchVersion = ( int ) pathinfo ( $patch, PATHINFO_FILENAME );
215
+ if ($patchVersion && self::$settings->getGlobalOption ( 'revision' ) < $patchVersion)
216
+ self::includeFile ( 'update' . DIRECTORY_SEPARATOR . $patchVersion );
217
+ }
218
+ }
219
+ $this->addNotice ( 'update', sprintf ( __ ( '%s updated to %s.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$version ), __ ( 'Please validate your configuration', 'wp-piwik' ) );
220
+ $this->installPlugin ( true );
221
+ }
222
+
223
+ /**
224
+ * Define a notice
225
+ *
226
+ * @param string $type
227
+ * identifier
228
+ * @param string $subject
229
+ * notice headline
230
+ * @param string $text
231
+ * notice content
232
+ * @param boolean $stay
233
+ * set to true if the message should persist (default: false)
234
+ */
235
+ private function addNotice($type, $subject, $text, $stay = false) {
236
+ $notices = get_option ( 'wp-piwik-notices', array () );
237
+ $notices [$type] = array (
238
+ 'subject' => $subject,
239
+ 'text' => $text,
240
+ 'stay' => $stay
241
+ );
242
+ update_option ( 'wp-piwik-notices', $notices );
243
+ }
244
+
245
+ /**
246
+ * Show all notices defined previously
247
+ *
248
+ * @see addNotice()
249
+ */
250
+ public function showNotices() {
251
+ $link = sprintf ( '<a href="' . $this->getSettingsURL () . '">%s</a>', __ ( 'Settings', 'wp-piwik' ) );
252
+ if ($notices = get_option ( 'wp-piwik-notices' )) {
253
+ foreach ( $notices as $type => $notice ) {
254
+ printf ( '<div class="updated fade"><p>%s <strong>%s:</strong> %s: %s</p></div>', $notice ['subject'], __ ( 'Important', 'wp-piwik' ), $notice ['text'], $link );
255
+ if (! $notice ['stay'])
256
+ unset ( $notices [$type] );
257
+ }
258
+ }
259
+ update_option ( 'wp-piwik-notices', $notices );
260
+ }
261
+
262
+ /**
263
+ * Get the settings page URL
264
+ *
265
+ * @return string settings page URL
266
+ */
267
+ private function getSettingsURL() {
268
+ return (self::$settings->checkNetworkActivation () ? 'settings' : 'options-general') . '.php?page=' . self::$pluginBasename;
269
+ }
270
+
271
+ /**
272
+ * Echo javascript tracking code
273
+ */
274
+ public function addJavascriptCode() {
275
+ if ($this->isHiddenUser ()) {
276
+ self::$logger->log ( 'Do not add tracking code to site (user should not be tracked) Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
277
+ return;
278
+ }
279
+ $trackingCode = new WP_Piwik\TrackingCode ( $this );
280
+ $trackingCode->is404 = (is_404 () && self::$settings->getGlobalOption ( 'track_404' ));
281
+ $trackingCode->isSearch = (is_search () && self::$settings->getGlobalOption ( 'track_search' ));
282
+ self::$logger->log ( 'Add tracking code. Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
283
+ if ($this->isNetworkMode () && self::$settings->getGlobalOption ( 'track_mode' ) == 'manually') {
284
+ $siteId = $this->getPiwikSiteId ();
285
+ if ($siteId != 'n/a')
286
+ echo str_replace ( '{ID}', $siteId, $trackingCode->getTrackingCode () );
287
+ else
288
+ echo '<!-- Site will be created and tracking code added on next request -->';
289
+ } else
290
+ echo $trackingCode->getTrackingCode ();
291
+ }
292
+
293
+ /**
294
+ * Echo noscript tracking code
295
+ */
296
+ public function addNoscriptCode() {
297
+ if (self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy')
298
+ return;
299
+ if ($this->isHiddenUser ()) {
300
+ self::$logger->log ( 'Do not add noscript code to site (user should not be tracked) Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
301
+ return;
302
+ }
303
+ self::$logger->log ( 'Add noscript code. Blog ID: ' . self::$blog_id . ' Site ID: ' . self::$settings->getOption ( 'site_id' ) );
304
+ echo self::$settings->getOption ( 'noscript_code' ) . "\n";
305
+ }
306
+
307
+ /**
308
+ * Register post view meta boxes
309
+ */
310
+ public function addPostMetaboxes() {
311
+ if (self::$settings->getGlobalOption ( 'add_customvars_box' )) {
312
+ add_action ( 'add_meta_boxes', array (
313
+ new WP_Piwik\Template\MetaBoxCustomVars ( $this, self::$settings ),
314
+ 'addMetabox'
315
+ ) );
316
+ add_action ( 'save_post', array (
317
+ new WP_Piwik\Template\MetaBoxCustomVars ( $this, self::$settings ),
318
+ 'saveCustomVars'
319
+ ), 10, 2 );
320
+ }
321
+ if (self::$settings->getGlobalOption ( 'perpost_stats' )) {
322
+ add_action ( 'add_meta_boxes', array (
323
+ $this,
324
+ 'onloadPostPage'
325
+ ) );
326
+ }
327
+ }
328
+
329
+ /**
330
+ * Register admin menu components
331
+ */
332
+ public function buildAdminMenu() {
333
+ if (self::isConfigured ()) {
334
+ $statsPage = new WP_Piwik\Admin\Statistics ( $this, self::$settings );
335
+ $this->statsPageId = add_dashboard_page ( __ ( 'Piwik Statistics', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'wp-piwik_read_stats', 'wp-piwik_stats', array (
336
+ $statsPage,
337
+ 'show'
338
+ ) );
339
+ $this->loadAdminStatsHeader ( $this->statsPageId, $statsPage );
340
+ }
341
+ if (! self::$settings->checkNetworkActivation ()) {
342
+ $optionsPage = new WP_Piwik\Admin\Settings ( $this, self::$settings );
343
+ $optionsPageId = add_options_page ( self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'activate_plugins', __FILE__, array (
344
+ $optionsPage,
345
+ 'show'
346
+ ) );
347
+ $this->loadAdminSettingsHeader ( $optionsPageId, $optionsPage );
348
+ }
349
+ }
350
+
351
+ /**
352
+ * Register network admin menu components
353
+ */
354
+ public function buildNetworkAdminMenu() {
355
+ if (self::isConfigured ()) {
356
+ $statsPage = new WP_Piwik\Admin\Network ( $this, self::$settings );
357
+ $this->statsPageId = add_dashboard_page ( __ ( 'Piwik Statistics', 'wp-piwik' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'manage_sites', 'wp-piwik_stats', array (
358
+ $statsPage,
359
+ 'show'
360
+ ) );
361
+ $this->loadAdminStatsHeader ( $this->statsPageId, $statsPage );
362
+ }
363
+ $optionsPage = new WP_Piwik\Admin\Settings ( $this, self::$settings );
364
+ $optionsPageId = add_submenu_page ( 'settings.php', self::$settings->getGlobalOption ( 'plugin_display_name' ), self::$settings->getGlobalOption ( 'plugin_display_name' ), 'manage_sites', __FILE__, array (
365
+ $optionsPage,
366
+ 'show'
367
+ ) );
368
+ $this->loadAdminSettingsHeader ( $optionsPageId, $optionsPage );
369
+ }
370
+
371
+ /**
372
+ * Register admin header extensions for stats page
373
+ *
374
+ * @param $optionsPageId options
375
+ * page id
376
+ * @param $optionsPage options
377
+ * page object
378
+ */
379
+ public function loadAdminStatsHeader($statsPageId, $statsPage) {
380
+ add_action ( 'admin_print_scripts-' . $statsPageId, array (
381
+ $statsPage,
382
+ 'printAdminScripts'
383
+ ) );
384
+ add_action ( 'admin_print_styles-' . $statsPageId, array (
385
+ $statsPage,
386
+ 'printAdminStyles'
387
+ ) );
388
+ add_action ( 'admin_head-' . $statsPageId, array (
389
+ $statsPage,
390
+ 'extendAdminHeader'
391
+ ) );
392
+ add_action ( 'load-' . $statsPageId, array (
393
+ $this,
394
+ 'onloadStatsPage'
395
+ ) );
396
+ }
397
+
398
+ /**
399
+ * Register admin header extensions for settings page
400
+ *
401
+ * @param $optionsPageId options
402
+ * page id
403
+ * @param $optionsPage options
404
+ * page object
405
+ */
406
+ public function loadAdminSettingsHeader($optionsPageId, $optionsPage) {
407
+ add_action ( 'admin_head-' . $optionsPageId, array (
408
+ $optionsPage,
409
+ 'extendAdminHeader'
410
+ ) );
411
+ add_action ( 'admin_print_styles-' . $optionsPageId, array (
412
+ $optionsPage,
413
+ 'printAdminStyles'
414
+ ) );
415
+ }
416
+
417
+ /**
418
+ * Register WordPress dashboard widgets
419
+ */
420
+ public function extendWordPressDashboard() {
421
+ if (current_user_can ( 'wp-piwik_read_stats' )) {
422
+ if (self::$settings->getGlobalOption ( 'dashboard_widget' ) != 'disabled')
423
+ new WP_Piwik\Widget\Overview ( $this, self::$settings, 'dashboard', 'side', 'default', array (
424
+ 'date' => self::$settings->getGlobalOption ( 'dashboard_widget' ),
425
+ 'period' => 'day'
426
+ ) );
427
+ if (self::$settings->getGlobalOption ( 'dashboard_chart' ))
428
+ new WP_Piwik\Widget\Chart ( $this, self::$settings );
429
+ if (self::$settings->getGlobalOption ( 'dashboard_seo' ))
430
+ new WP_Piwik\Widget\Seo ( $this, self::$settings );
431
+ }
432
+ }
433
+
434
+ /**
435
+ * Register WordPress toolbar components
436
+ */
437
+ public function extendWordPressToolbar($toolbar) {
438
+ if (current_user_can ( 'wp-piwik_read_stats' ) && is_admin_bar_showing ()) {
439
+ $id = WP_Piwik\Request::register ( 'VisitsSummary.getUniqueVisitors', array (
440
+ 'period' => 'day',
441
+ 'date' => 'last30'
442
+ ) );
443
+ $unique = $this->request ( $id );
444
+ if (is_array ( $unique )) {
445
+ $graph = "<script type='text/javascript'>var \$jSpark = jQuery.noConflict();\$jSpark(function() {var piwikSparkVals=[" . implode ( ',', $unique ) . "];\$jSpark('.wp-piwik_dynbar').sparkline(piwikSparkVals, {type: 'bar', barColor: '#ccc', barWidth:2});});</script><span class='wp-piwik_dynbar'>Loading...</span>";
446
+ $toolbar->add_menu ( array (
447
+ 'id' => 'wp-piwik_stats',
448
+ 'title' => $graph,
449
+ 'href' => $this->getStatsURL ()
450
+ ) );
451
+ }
452
+ }
453
+ }
454
+
455
+ /**
456
+ * Add plugin meta data
457
+ *
458
+ * @param array $links
459
+ * list of already defined plugin meta data
460
+ * @param string $file
461
+ * handled file
462
+ * @return array complete list of plugin meta data
463
+ */
464
+ public function setPluginMeta($links, $file) {
465
+ if ($file == 'wp-piwik/wp-piwik.php')
466
+ return array_merge ( $links, array (
467
+ sprintf ( '<a href="%s">%s</a>', self::getSettingsURL (), __ ( 'Settings', 'wp-piwik' ) )
468
+ ) );
469
+ return $links;
470
+ }
471
+
472
+ /**
473
+ * Prepare toolbar widget requirements
474
+ */
475
+ public function loadToolbarRequirements() {
476
+ if (is_admin_bar_showing ()) {
477
+ wp_enqueue_script ( 'wp-piwik-sparkline', $this->getPluginURL () . 'js/sparkline/jquery.sparkline.min.js', array (
478
+ 'jquery'
479
+ ), self::$version );
480
+ wp_enqueue_style ( 'wp-piwik', $this->getPluginURL () . 'css/wp-piwik-spark.css', array (), $this->getPluginVersion () );
481
+ }
482
+ }
483
+
484
+ /**
485
+ * Add tracking pixels to feed content
486
+ *
487
+ * @param string $content
488
+ * post content
489
+ * @return string post content extended by tracking pixel
490
+ */
491
+ public function addFeedTracking($content) {
492
+ global $post;
493
+ if (is_feed ()) {
494
+ self::$logger->log ( 'Add tracking image to feed entry.' );
495
+ if (! self::$settings->getOption ( 'site_id' )) {
496
+ $siteId = $this->requestPiwikSiteId ();
497
+ if ($siteId != 'n/a')
498
+ self::$settings->setOption ( 'site_id', $siteId );
499
+ else
500
+ return;
501
+ }
502
+ $title = the_title ( null, null, false );
503
+ $posturl = get_permalink ( $post->ID );
504
+ $urlref = get_bloginfo ( 'rss2_url' );
505
+ $url = self::$settings->getGlobalOption ( 'piwik_url' );
506
+ if (substr ( $url, - 10, 10 ) == '/index.php')
507
+ $url = str_replace ( '/index.php', '/piwik.php', $url );
508
+ else
509
+ $url .= 'piwik.php';
510
+ $trackingImage = $url . '?idsite=' . self::$settings->getOption ( 'site_id' ) . '&amp;rec=1&amp;url=' . urlencode ( $posturl ) . '&amp;action_name=' . urlencode ( $title ) . '&amp;urlref=' . urlencode ( $urlref );
511
+ $content .= '<img src="' . $trackingImage . '" style="border:0;width:0;height:0" width="0" height="0" alt="" />';
512
+ }
513
+ return $content;
514
+ }
515
+
516
+ /**
517
+ * Add a campaign parameter to feed permalink
518
+ *
519
+ * @param string $permalink
520
+ * permalink
521
+ * @return string permalink extended by campaign parameter
522
+ */
523
+ public function addFeedCampaign($permalink) {
524
+ global $post;
525
+ if (is_feed ()) {
526
+ self::$logger->log ( 'Add campaign to feed permalink.' );
527
+ $sep = (strpos ( $permalink, '?' ) === false ? '?' : '&');
528
+ $permalink .= $sep . 'pk_campaign=' . urlencode ( self::$settings->getGlobalOption ( 'track_feed_campaign' ) ) . '&pk_kwd=' . urlencode ( $post->post_name );
529
+ }
530
+ return $permalink;
531
+ }
532
+
533
+ /**
534
+ * Add a new post annotation in Piwik
535
+ *
536
+ * @param int $postID
537
+ * The new post's ID
538
+ */
539
+ public function addPiwikAnnotation($postID) {
540
+ $note = 'Published: ' . get_post ( $postID )->post_title . ' - URL: ' . get_permalink ( $postID );
541
+ $id = WP_Piwik\Request::register ( 'Annotations.add', array (
542
+ 'idSite' => $this->getPiwikSiteId (),
543
+ 'date' => date ( 'Y-m-d' ),
544
+ 'note' => $note
545
+ ) );
546
+ $result = $this->request ( $id );
547
+ self::$logger->log ( 'Add post annotation. ' . $note . ' - ' . serialize ( $result ) );
548
+ }
549
+
550
+ /**
551
+ * Apply settings update
552
+ *
553
+ * @return boolean settings update applied
554
+ */
555
+ private function applySettings() {
556
+ if (isset ( $_POST ) && isset ( $_POST ['wp-piwik'] )) {
557
+ self::$settings->applyChanges ( $_POST ['wp-piwik'] );
558
+ if (self::$settings->getGlobalOption ( 'auto_site_config' ) && self::isConfigured ()) {
559
+ if ($this->isPHPMode () && ! defined ( 'PIWIK_INCLUDE_PATH' ))
560
+ self::definePiwikConstants ();
561
+ $siteId = $this->requestPiwikSiteId ();
562
+ $trackingCode = $this->updateTrackingCode ( $siteId );
563
+ self::$settings->getOption ( 'site_id', $siteId );
564
+ }
565
+ return true;
566
+ }
567
+ return false;
568
+ }
569
+
570
+ /**
571
+ * Check if WP-Piwik is configured
572
+ *
573
+ * @return boolean Is WP-Piwik configured?
574
+ */
575
+ public static function isConfigured() {
576
+ return (self::$settings->getGlobalOption ( 'piwik_token' ) && (self::$settings->getGlobalOption ( 'piwik_mode' ) != 'disabled') && (((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'http') && (self::$settings->getGlobalOption ( 'piwik_url' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'php') && (self::$settings->getGlobalOption ( 'piwik_path' ))) || ((self::$settings->getGlobalOption ( 'piwik_mode' ) == 'pro') && (self::$settings->getGlobalOption ( 'piwik_user' )))));
577
+ }
578
+
579
+ /**
580
+ * Check if WP-Piwik was updated
581
+ *
582
+ * @return boolean Was WP-Piwik updated?
583
+ */
584
+ private function isUpdated() {
585
+ return self::$settings->getGlobalOption ( 'revision' ) && self::$settings->getGlobalOption ( 'revision' ) < self::$intRevisionId;
586
+ }
587
+
588
+ /**
589
+ * Check if WP-Piwik is already installed
590
+ *
591
+ * @return boolean Is WP-Piwik installed?
592
+ */
593
+ private function isInstalled() {
594
+ return self::$settings->getGlobalOption ( 'revision' );
595
+ }
596
+
597
+ /**
598
+ * Check if new settings were submitted
599
+ *
600
+ * @return boolean Are new settings submitted?
601
+ */
602
+ private function isConfigSubmitted() {
603
+ return isset ( $_POST ['action'] ) && $_POST ['action'] == 'save_wp-piwik_settings';
604
+ }
605
+
606
+ /**
607
+ * Check if PHP mode is chosen
608
+ *
609
+ * @return Is PHP mode chosen?
610
+ */
611
+ public function isPHPMode() {
612
+ return self::$settings->getGlobalOption ( 'piwik_mode' ) && self::$settings->getGlobalOption ( 'piwik_mode' ) == 'php';
613
+ }
614
+
615
+ /**
616
+ * Check if WordPress is running in network mode
617
+ *
618
+ * @return boolean Is WordPress running in network mode?
619
+ */
620
+ public function isNetworkMode() {
621
+ return self::$settings->checkNetworkActivation ();
622
+ }
623
+
624
+ /**
625
+ * Check if a WP-Piwik dashboard widget is enabled
626
+ *
627
+ * @return boolean Is a dashboard widget enabled?
628
+ */
629
+ private function isDashboardActive() {
630
+ return self::$settings->getGlobalOption ( 'dashboard_widget' ) || self::$settings->getGlobalOption ( 'dashboard_chart' ) || self::$settings->getGlobalOption ( 'dashboard_seo' );
631
+ }
632
+
633
+ /**
634
+ * Check if a WP-Piwik toolbar widget is enabled
635
+ *
636
+ * @return boolean Is a toolbar widget enabled?
637
+ */
638
+ private function isToolbarActive() {
639
+ return self::$settings->getGlobalOption ( 'toolbar' );
640
+ }
641
+
642
+ /**
643
+ * Check if WP-Piwik tracking code insertion is enabled
644
+ *
645
+ * @return boolean Insert tracking code?
646
+ */
647
+ private function isTrackingActive() {
648
+ return self::$settings->getGlobalOption ( 'track_mode' ) != 'disabled';
649
+ }
650
+
651
+ /**
652
+ * Check if admin tracking is enabled
653
+ *
654
+ * @return boolean Is admin tracking enabled?
655
+ */
656
+ private function isAdminTrackingActive() {
657
+ return self::$settings->getGlobalOption ( 'track_admin' ) && is_admin ();
658
+ }
659
+
660
+ /**
661
+ * Check if WP-Piwik noscript code insertion is enabled
662
+ *
663
+ * @return boolean Insert noscript code?
664
+ */
665
+ private function isAddNoScriptCode() {
666
+ return self::$settings->getGlobalOption ( 'track_noscript' );
667
+ }
668
+
669
+ /**
670
+ * Check if feed tracking is enabled
671
+ *
672
+ * @return boolean Is feed tracking enabled?
673
+ */
674
+ private function isTrackFeed() {
675
+ return self::$settings->getGlobalOption ( 'track_feed' );
676
+ }
677
+
678
+ /**
679
+ * Check if feed permalinks get a campaign parameter
680
+ *
681
+ * @return boolean Add campaign parameter to feed permalinks?
682
+ */
683
+ private function isAddFeedCampaign() {
684
+ return self::$settings->getGlobalOption ( 'track_feed_addcampaign' );
685
+ }
686
+
687
+ /**
688
+ * Check if WP-Piwik shortcodes are enabled
689
+ *
690
+ * @return boolean Are shortcodes enabled?
691
+ */
692
+ private function isAddShortcode() {
693
+ return self::$settings->getGlobalOption ( 'shortcodes' );
694
+ }
695
+
696
+ /**
697
+ * Define Piwik constants for PHP reporting API
698
+ */
699
+ public static function definePiwikConstants() {
700
+ if (! defined ( 'PIWIK_INCLUDE_PATH' )) {
701
+ @header ( 'Content-type: text/xml' );
702
+ define ( 'PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption ( 'piwik_path' ) );
703
+ define ( 'PIWIK_USER_PATH', self::$settings->getGlobalOption ( 'piwik_path' ) );
704
+ define ( 'PIWIK_ENABLE_DISPATCH', false );
705
+ define ( 'PIWIK_ENABLE_ERROR_HANDLER', false );
706
+ define ( 'PIWIK_ENABLE_SESSION_START', false );
707
+ }
708
+ }
709
+
710
+ /**
711
+ * Start chosen logging method
712
+ */
713
+ private function openLogger() {
714
+ switch (WP_PIWIK_ACTIVATE_LOGGER) {
715
+ case 1 :
716
+ self::$logger = new WP_Piwik\Logger\Screen ( __CLASS__ );
717
+ break;
718
+ case 2 :
719
+ self::$logger = new WP_Piwik\Logger\File ( __CLASS__ );
720
+ break;
721
+ default :
722
+ self::$logger = new WP_Piwik\Logger\Dummy ( __CLASS__ );
723
+ }
724
+ }
725
+
726
+ /**
727
+ * Log a message
728
+ *
729
+ * @param string $message
730
+ * logger message
731
+ */
732
+ public static function log($message) {
733
+ self::$logger->log ( $message );
734
+ }
735
+
736
+ /**
737
+ * End logging
738
+ */
739
+ private function closeLogger() {
740
+ self::$logger = null;
741
+ }
742
+
743
+ /**
744
+ * Load WP-Piwik settings
745
+ */
746
+ private function openSettings() {
747
+ self::$settings = new WP_Piwik\Settings ( $this, self::$logger );
748
+ if (! $this->applySettings () && $this->isPHPMode () && ! defined ( 'PIWIK_INCLUDE_PATH' ))
749
+ self::definePiwikConstants ();
750
+ }
751
+
752
+ /**
753
+ * Include a WP-Piwik file
754
+ */
755
+ private function includeFile($strFile) {
756
+ self::$logger->log ( 'Include ' . $strFile . '.php' );
757
+ if (WP_PIWIK_PATH . $strFile . '.php')
758
+ include (WP_PIWIK_PATH . $strFile . '.php');
759
+ }
760
+
761
+ /**
762
+ * Check if user should not be tracked
763
+ *
764
+ * @return boolean Do not track user?
765
+ */
766
+ private function isHiddenUser() {
767
+ if (is_multisite ())
768
+ foreach ( self::$settings->getGlobalOption ( 'capability_stealth' ) as $key => $val )
769
+ if ($val && current_user_can ( $key ))
770
+ return true;
771
+ return current_user_can ( 'wp-piwik_stealth' );
772
+ }
773
+
774
+ /**
775
+ * Check if tracking code is up to date
776
+ *
777
+ * @return boolean Is tracking code up to date?
778
+ */
779
+ public function isCurrentTrackingCode() {
780
+ return (self::$settings->getOption ( 'last_tracking_code_update' ) && self::$settings->getOption ( 'last_tracking_code_update' ) > self::$settings->getGlobalOption ( 'last_settings_update' ));
781
+ }
782
+
783
+ /**
784
+ * DEPRECTAED Add javascript code to site header
785
+ *
786
+ * @deprecated
787
+ *
788
+ */
789
+ public function site_header() {
790
+ self::$logger->log ( 'Using deprecated function site_header' );
791
+ $this->addJavascriptCode ();
792
+ }
793
+
794
+ /**
795
+ * DEPRECTAED Add javascript code to site footer
796
+ *
797
+ * @deprecated
798
+ *
799
+ */
800
+ public function site_footer() {
801
+ self::$logger->log ( 'Using deprecated function site_footer' );
802
+ $this->addNoscriptCode ();
803
+ }
804
+
805
+ /**
806
+ * Identify new posts if an annotation is required
807
+ *
808
+ * @param string $newStatus
809
+ * new post status
810
+ * @param strint $oldStatus
811
+ * new post status
812
+ * @param object $post
813
+ * current post object
814
+ */
815
+ public function onPostStatusTransition($newStatus, $oldStatus, $post) {
816
+ if ($newStatus == 'publish' && $oldStatus != 'publish') {
817
+ add_action ( 'publish_post', array (
818
+ $this,
819
+ 'addPiwikAnnotation'
820
+ ) );
821
+ }
822
+ }
823
+
824
+ /**
825
+ * Get WP-Piwik's URL
826
+ */
827
+ public function getPluginURL() {
828
+ return trailingslashit ( plugins_url () . '/wp-piwik/' );
829
+ }
830
+
831
+ /**
832
+ * Get WP-Piwik's version
833
+ */
834
+ public function getPluginVersion() {
835
+ return self::$version;
836
+ }
837
+
838
+ /**
839
+ * Enable three columns for WP-Piwik stats screen
840
+ *
841
+ * @param
842
+ * array full list of column settings
843
+ * @param
844
+ * mixed current screen id
845
+ * @return array updated list of column settings
846
+ */
847
+ public function onScreenLayoutColumns($columns, $screen) {
848
+ if ($screen == $this->statsPageId)
849
+ $columns [$this->statsPageId] = 3;
850
+ return $columns;
851
+ }
852
+
853
+ /**
854
+ * Add tracking code to admin header
855
+ */
856
+ function addAdminHeaderTracking() {
857
+ $this->addJavascriptCode ();
858
+ }
859
+
860
+ /**
861
+ * Get option value
862
+ *
863
+ * @param string $key
864
+ * option key
865
+ * @return mixed option value
866
+ */
867
+ public function getOption($key) {
868
+ return self::$settings->getOption ( $key );
869
+ }
870
+
871
+ /**
872
+ * Get global option value
873
+ *
874
+ * @param string $key
875
+ * global option key
876
+ * @return mixed global option value
877
+ */
878
+ public function getGlobalOption($key) {
879
+ return self::$settings->getGlobalOption ( $key );
880
+ }
881
+
882
+ /**
883
+ * Get stats page URL
884
+ *
885
+ * @return string stats page URL
886
+ */
887
+ public function getStatsURL() {
888
+ return admin_url () . '?page=wp-piwik_stats';
889
+ }
890
+
891
+ /**
892
+ * Execute WP-Piwik test script
893
+ */
894
+ private function loadTestscript() {
895
+ $this->includeFile ( 'debug' . DIRECTORY_SEPARATOR . 'testscript' );
896
+ }
897
+
898
+ /**
899
+ * Echo an error message
900
+ *
901
+ * @param string $message
902
+ * message content
903
+ */
904
+ private static function showErrorMessage($message) {
905
+ echo '<strong class="wp-piwik-error">' . __ ( 'An error occured', 'wp-piwik' ) . ':</strong> ' . $message . ' [<a href="' . (self::$settings->checkNetworkActivation () ? 'network/settings' : 'options-general') . '.php?page=wp-piwik/classes/WP_Piwik.php&tab=support">' . __ ( 'Support', 'wp-piwik' ) . '</a>]';
906
+ }
907
+
908
+ /**
909
+ * Perform a Piwik request
910
+ *
911
+ * @param string $id
912
+ * request ID
913
+ * @return mixed request result
914
+ */
915
+ public function request($id) {
916
+ if (! isset ( self::$request ))
917
+ self::$request = (self::$settings->getGlobalOption ( 'piwik_mode' ) == 'http' || self::$settings->getGlobalOption ( 'piwik_mode' ) == 'pro' ? new WP_Piwik\Request\Rest ( $this, self::$settings ) : new WP_Piwik\Request\Php ( $this, self::$settings ));
918
+ return self::$request->perform ( $id );
919
+ }
920
+
921
+ /**
922
+ * Execute WP-Piwik shortcode
923
+ *
924
+ * @param array $attributes
925
+ * attribute list
926
+ */
927
+ public function shortcode($attributes) {
928
+ load_plugin_textdomain ( 'wp-piwik', false, 'wp-piwik' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
929
+ shortcode_atts ( array (
930
+ 'title' => '',
931
+ 'module' => 'overview',
932
+ 'period' => 'day',
933
+ 'date' => 'yesterday',
934
+ 'limit' => 10,
935
+ 'width' => '100%',
936
+ 'height' => '200px',
937
+ 'language' => 'en',
938
+ 'range' => false,
939
+ 'key' => 'sum_daily_nb_uniq_visitors'
940
+ ), $attributes );
941
+ new \WP_Piwik\Shortcode ( $attributes, $this, self::$settings );
942
+ }
943
+
944
+ /**
945
+ * Get Piwik site ID by blog ID
946
+ *
947
+ * @param int $blogId
948
+ * which blog's Piwik site ID to get, default is the current blog
949
+ * @return mixed Piwik site ID or n/a
950
+ */
951
+ public function getPiwikSiteId($blogId = null) {
952
+ if (! $blogId && $this->isNetworkMode ())
953
+ $blogId = get_current_blog_id ();
954
+ $result = self::$settings->getOption ( 'site_id', $blogId );
955
+ return (! empty ( $result ) ? $result : $this->requestPiwikSiteId ( $blogId ));
956
+ }
957
+
958
+ /**
959
+ * Get a detailed list of all Piwik sites
960
+ *
961
+ * @return array Piwik sites
962
+ */
963
+ public function getPiwikSiteDetails() {
964
+ $id = WP_Piwik\Request::register ( 'SitesManager.getAllSites', array () );
965
+ $piwikSiteDetails = $this->request ( $id );
966
+ return $piwikSiteDetails;
967
+ }
968
+
969
+ /**
970
+ * Estimate a Piwik site ID by blog ID
971
+ *
972
+ * @param int $blogId
973
+ * which blog's Piwik site ID to estimate, default is the current blog
974
+ * @return mixed Piwik site ID or n/a
975
+ */
976
+ private function requestPiwikSiteId($blogId = null) {
977
+ $isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
978
+ if (self::$settings->getGlobalOption ( 'auto_site_config' )) {
979
+ $id = WP_Piwik\Request::register ( 'SitesManager.getSitesIdFromSiteUrl', array (
980
+ 'url' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl
981
+ ) );
982
+ $result = $this->request ( $id );
983
+ $this->log ( 'Tried to identify current site, result: ' . serialize ( $result ) );
984
+ if (empty ( $result ) || ! isset ( $result [0] ))
985
+ $result = $this->addPiwikSite ( $blogId );
986
+ else
987
+ $result = $result [0] ['idsite'];
988
+ } else
989
+ $result = null;
990
+ self::$logger->log ( 'Get Piwik ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Piwik ID ' . $result );
991
+ if ($result !== null) {
992
+ self::$settings->setOption ( 'site_id', $result, $blogId );
993
+ if (self::$settings->getGlobalOption ( 'track_mode' ) != 'disabled' && self::$settings->getGlobalOption ( 'track_mode' ) != 'manually') {
994
+ $code = $this->updateTrackingCode ( $result, $blogId );
995
+ }
996
+ $this::$settings->save ();
997
+ return $result;
998
+ }
999
+ return 'n/a';
1000
+ }
1001
+
1002
+ /**
1003
+ * Add a new Piwik
1004
+ *
1005
+ * @param int $blogId
1006
+ * which blog's Piwik site to create, default is the current blog
1007
+ * @return int Piwik site ID
1008
+ */
1009
+ public function addPiwikSite($blogId = null) {
1010
+ $isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
1011
+ // Do not add site if Piwik connection is unreliable
1012
+ if (! $this->request ( 'global.getPiwikVersion' ))
1013
+ return null;
1014
+ $id = WP_Piwik\Request::register ( 'SitesManager.addSite', array (
1015
+ 'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl,
1016
+ 'siteName' => $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->blogname
1017
+ ) );
1018
+ $result = $this->request ( $id );
1019
+ self::$logger->log ( 'Get Piwik ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Piwik ID ' . ( int ) $result );
1020
+ if (empty ( $result ) || ! isset ( $result [0] ))
1021
+ return null;
1022
+ else
1023
+ return $result [0] ['idsite'];
1024
+ }
1025
+
1026
+ /**
1027
+ * Update a Piwik site's detail information
1028
+ *
1029
+ * @param int $siteId
1030
+ * which Piwik site to updated
1031
+ * @param int $blogId
1032
+ * which blog's Piwik site ID to get, default is the current blog
1033
+ */
1034
+ private function updatePiwikSite($siteId, $blogId = null) {
1035
+ $isCurrent = ! self::$settings->checkNetworkActivation () || empty ( $blogId );
1036
+ $id = WP_Piwik\Request::register ( 'SitesManager.updateSite', array (
1037
+ 'idSite' => $siteId,
1038
+ 'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->$siteurl,
1039
+ 'siteName' => $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->$blogname
1040
+ ) );
1041
+ $result = $this->request ( $id );
1042
+ self::$logger->log ( 'Update Piwik site: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->$siteurl) );
1043
+ }
1044
+
1045
+ /**
1046
+ * Update a site's tracking code
1047
+ *
1048
+ * @param int $siteId
1049
+ * which Piwik site to updated
1050
+ * @param int $blogId
1051
+ * which blog's Piwik site ID to get, default is the current blog
1052
+ * @return string tracking code
1053
+ */
1054
+ public function updateTrackingCode($siteId = false, $blogId = null) {
1055
+ if (! $siteId)
1056
+ $siteId = $this->getPiwikSiteId ();
1057
+ if (self::$settings->getGlobalOption ( 'track_mode' ) == 'disabled' || self::$settings->getGlobalOption ( 'track_mode' ) == 'manually')
1058
+ return false;
1059
+ $id = WP_Piwik\Request::register ( 'SitesManager.getJavascriptTag', array (
1060
+ 'idSite' => $siteId,
1061
+ 'mergeSubdomains' => self::$settings->getGlobalOption ( 'track_across' ) ? 1 : 0,
1062
+ 'mergeAliasUrls' => self::$settings->getGlobalOption ( 'track_across_alias' ) ? 1 : 0,
1063
+ 'disableCookies' => self::$settings->getGlobalOption ( 'disable_cookies' ) ? 1 : 0
1064
+ ) );
1065
+ $result = html_entity_decode ( $this->request ( $id ) );
1066
+ self::$logger->log ( 'Delivered tracking code: ' . $result );
1067
+ $result = WP_Piwik\TrackingCode::prepareTrackingCode ( $result, self::$settings, self::$logger );
1068
+ self::$settings->setOption ( 'tracking_code', $result ['script'], $blogId );
1069
+ self::$settings->setOption ( 'noscript_code', $result ['noscript'], $blogId );
1070
+ return $result;
1071
+ }
1072
+
1073
+ /**
1074
+ * Update Piwik site if blog name changes
1075
+ *
1076
+ * @param string $oldValue
1077
+ * old blog name
1078
+ * @param string $newValue
1079
+ * new blog name
1080
+ */
1081
+ public function onBlogNameChange($oldValue, $newValue) {
1082
+ $this->updatePiwikSite ( self::$settings->getOption ( 'site_id' ) );
1083
+ }
1084
+
1085
+ /**
1086
+ * Update Piwik site if blog URL changes
1087
+ *
1088
+ * @param string $oldValue
1089
+ * old blog URL
1090
+ * @param string $newValue
1091
+ * new blog URL
1092
+ */
1093
+ public function onSiteUrlChange($oldValue, $newValue) {
1094
+ $this->updatePiwikSite ( self::$settings->getOption ( 'site_id' ) );
1095
+ }
1096
+
1097
+ /**
1098
+ * Register stats page meta boxes
1099
+ *
1100
+ * @param mixed $statsPageId
1101
+ * WordPress stats page ID
1102
+ */
1103
+ public function onloadStatsPage($statsPageId) {
1104
+ if (self::$settings->getGlobalOption ( 'disable_timelimit' ))
1105
+ set_time_limit ( 0 );
1106
+ wp_enqueue_script ( 'common' );
1107
+ wp_enqueue_script ( 'wp-lists' );
1108
+ wp_enqueue_script ( 'postbox' );
1109
+ wp_enqueue_script ( 'wp-piwik', $this->getPluginURL () . 'js/wp-piwik.js', array (), self::$version, true );
1110
+ wp_enqueue_script ( 'wp-piwik-jqplot', $this->getPluginURL () . 'js/jqplot/wp-piwik.jqplot.js', array (
1111
+ 'jquery'
1112
+ ), self::$version );
1113
+ new \WP_Piwik\Widget\Chart ( $this, self::$settings, $this->statsPageId );
1114
+ new \WP_Piwik\Widget\Visitors ( $this, self::$settings, $this->statsPageId );
1115
+ new \WP_Piwik\Widget\Overview ( $this, self::$settings, $this->statsPageId );
1116
+ if (self::$settings->getGlobalOption ( 'stats_seo' ))
1117
+ new \WP_Piwik\Widget\Seo ( $this, self::$settings, $this->statsPageId );
1118
+ new \WP_Piwik\Widget\Pages ( $this, self::$settings, $this->statsPageId );
1119
+ new \WP_Piwik\Widget\Keywords ( $this, self::$settings, $this->statsPageId );
1120
+ new \WP_Piwik\Widget\Referrers ( $this, self::$settings, $this->statsPageId );
1121
+ new \WP_Piwik\Widget\Plugins ( $this, self::$settings, $this->statsPageId );
1122
+ new \WP_Piwik\Widget\Search ( $this, self::$settings, $this->statsPageId );
1123
+ new \WP_Piwik\Widget\Noresult ( $this, self::$settings, $this->statsPageId );
1124
+ new \WP_Piwik\Widget\Browsers ( $this, self::$settings, $this->statsPageId );
1125
+ new \WP_Piwik\Widget\BrowserDetails ( $this, self::$settings, $this->statsPageId );
1126
+ new \WP_Piwik\Widget\Screens ( $this, self::$settings, $this->statsPageId );
1127
+ new \WP_Piwik\Widget\Systems ( $this, self::$settings, $this->statsPageId );
1128
+ }
1129
+
1130
+ /**
1131
+ * Add per post statistics to a post's page
1132
+ *
1133
+ * @param mixed $postPageId
1134
+ * WordPress post page ID
1135
+ */
1136
+ public function onloadPostPage($postPageId) {
1137
+ global $post;
1138
+ $postUrl = get_permalink ( $post->ID );
1139
+ $this->log ( 'Load per post statistics: ' . $postUrl );
1140
+ array (
1141
+ new \WP_Piwik\Widget\Post ( $this, self::$settings, 'post', 'side', 'default', array (
1142
+ 'url' => $postUrl
1143
+ ) ),
1144
+ 'show'
1145
+ );
1146
+ }
1147
+
1148
+ /**
1149
+ * Stats page changes by POST submit
1150
+ *
1151
+ * @see http://tinyurl.com/5r5vnzs
1152
+ */
1153
+ function onStatsPageSaveChanges() {
1154
+ if (! current_user_can ( 'manage_options' ))
1155
+ wp_die ( __ ( 'Cheatin&#8217; uh?' ) );
1156
+ check_admin_referer ( 'wp-piwik_stats' );
1157
+ wp_redirect ( $_POST ['_wp_http_referer'] );
1158
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1159
  }
classes/WP_Piwik/Admin.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik;
4
+
5
+ abstract class Admin {
6
+
7
+ protected static $wpPiwik, $pageID, $settings;
8
+
9
+ public function __construct($wpPiwik, $settings) {
10
+ self::$wpPiwik = $wpPiwik;
11
+ self::$settings = $settings;
12
+ }
13
+
14
+ abstract public function show();
15
+
16
+ abstract public function printAdminScripts();
17
+
18
+ abstract public function extendAdminHeader();
19
+
20
+ public function printAdminStyles() {
21
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css', array(), self::$wpPiwik->getPluginVersion());
22
+ }
23
+
24
+ public function onLoad() {}
25
+
26
+ }
classes/WP_Piwik/Admin/Network.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Admin;
4
+
5
+ class Network extends \WP_Piwik\Admin\Statistics {
6
+
7
+ public function show() {
8
+ parent::show(true);
9
+ }
10
+
11
+ public function printAdminScripts() {
12
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
13
+ wp_enqueue_script('wp-piwik-jqplot', self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'), self::$wpPiwik->getPluginVersion());
14
+ }
15
+
16
+ public function extendAdminHeader() {
17
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.(parent::$wpPiwik->getPluginURL()).'js/jqplot/excanvas.min.js"></script><![endif]-->';
18
+ echo '<link rel="stylesheet" href="'.(parent::$wpPiwik->getPluginURL()).'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
19
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
20
+ }
21
+
22
+ public function onLoad() {
23
+ self::$wpPiwik->onloadStatsPage(self::$pageID);
24
+ }
25
+ }
classes/WP_Piwik/Admin/Settings.php ADDED
@@ -0,0 +1,616 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Admin;
4
+
5
+ /**
6
+ * WordPress Admin settings page
7
+ *
8
+ * @package WP_Piwik\Admin
9
+ * @author Andr&eacute; Br&auml;kling <webmaster@braekling.de>
10
+ */
11
+ class Settings extends \WP_Piwik\Admin {
12
+
13
+ /**
14
+ * Builds and displays the settings page
15
+ */
16
+ public function show() {
17
+ if (isset($_GET['sitebrowser']) && $_GET['sitebrowser']) {
18
+ new \WP_Piwik\Admin\Sitebrowser(self::$wpPiwik);
19
+ return;
20
+ }
21
+ global $wp_roles;
22
+ if (isset ( $_POST ) && isset ( $_POST ['wp-piwik'] ))
23
+ $this->showBox ( 'updated', 'yes', __ ( 'Changes saved.' ) );
24
+ ?>
25
+ <div id="plugin-options-wrap" class="widefat">
26
+ <?php
27
+ echo $this->getHeadline ( 1, 'admin-generic', 'Settings', true );
28
+ if (isset($_GET['testscript']) && $_GET['testscript'])
29
+ $this->runTestscript();
30
+ ?>
31
+ <form method="post">
32
+ <input type="hidden" name="wp-piwik[revision]" value="<?php echo self::$settings->getGlobalOption('revision'); ?>" />
33
+ <?php wp_nonce_field('wp-piwik_settings'); ?>
34
+ <table class="wp-piwik-form">
35
+ <tbody>
36
+ <?php
37
+ $submitButton = '<tr><td colspan="2"><p class="submit"><input name="Submit" type="submit" class="button-primary" value="' . esc_attr__ ( 'Save Changes' ) . '" /></p></td></tr>';
38
+ printf ( '<tr><td colspan="2">%s</td></tr>', __ ( 'Thanks for using WP-Piwik!', 'wp-piwik' ) );
39
+ // $this->showDonation();
40
+ if (self::$wpPiwik->isConfigured ()) {
41
+ $piwikVersion = self::$wpPiwik->request ( 'global.getPiwikVersion' );
42
+ if (! empty ( $piwikVersion ) && ! is_array ( $piwikVersion ))
43
+ $this->showText ( sprintf ( __ ( 'WP-Piwik %s is successfully connected to Piwik %s.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion (), $piwikVersion ) . ' ' . (! self::$wpPiwik->isNetworkMode () ? sprintf ( __ ( 'You are running WordPress %s.', 'wp-piwik' ), get_bloginfo ( 'version' ) ) : sprintf ( __ ( 'You are running a WordPress %s blog network (WPMU). WP-Piwik will handle your sites as different websites.', 'wp-piwik' ), get_bloginfo ( 'version' ) )) );
44
+ else {
45
+ $this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Piwik %s was not able to connect to Piwik using your configuration. Check the &raquo;Connect to Piwik&laquo; section below.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion () ) );
46
+ }
47
+ } else
48
+ $this->showBox ( 'error', 'no', sprintf ( __ ( 'WP-Piwik %s has to be connected to Piwik first. Check the &raquo;Connect to Piwik&laquo; section below.', 'wp-piwik' ), self::$wpPiwik->getPluginVersion () ) );
49
+
50
+ $tabs ['connect'] = array (
51
+ 'icon' => 'admin-plugins',
52
+ 'name' => __('Connect to Piwik', 'wp-piwik')
53
+ );
54
+ if (self::$wpPiwik->isConfigured ()) {
55
+ $tabs ['statistics'] = array (
56
+ 'icon' => 'chart-pie',
57
+ 'name' => __('Show Statistics', 'wp-piwik')
58
+ );
59
+ $tabs ['tracking'] = array (
60
+ 'icon' => 'location-alt',
61
+ 'name' => __('Enable Tracking', 'wp-piwik')
62
+ );
63
+ }
64
+ $tabs ['expert'] = array (
65
+ 'icon' => 'shield',
66
+ 'name' => __('Expert Settings', 'wp-piwik')
67
+ );
68
+ $tabs ['support'] = array (
69
+ 'icon' => 'lightbulb',
70
+ 'name' => __('Support', 'wp-piwik')
71
+ );
72
+ $tabs ['credits'] = array (
73
+ 'icon' => 'groups',
74
+ 'name' => __('Credits', 'wp-piwik')
75
+ );
76
+
77
+ echo '<tr><td colspan="2"><h2 class="nav-tab-wrapper">';
78
+ foreach ( $tabs as $tab => $details ) {
79
+ $class = ($tab == 'connect') ? ' nav-tab-active' : '';
80
+ echo '<a style="cursor:pointer;" id="tab-' . $tab . '" class="nav-tab' . $class . '" onclick="javascript:$j(\'table.wp-piwik_menu-tab\').addClass(\'hidden\');$j(\'#' . $tab . '\').removeClass(\'hidden\');$j(\'a.nav-tab\').removeClass(\'nav-tab-active\');$j(\'#tab-' . $tab . '\').addClass(\'nav-tab-active\');">';
81
+ $this->showHeadline ( 0, $details ['icon'], $details ['name'] );
82
+ echo "</a>";
83
+ }
84
+ echo '</h2></td></tr></tbody></table><table id="connect" class="wp-piwik_menu-tab"><tbody>';
85
+
86
+ if (! self::$wpPiwik->isConfigured ())
87
+ $this->showBox ( 'updated', 'info', sprintf ( '%s <a href="%s">%s</a> %s <a href="%s">%s</a>.', __ ( 'WP-Piwik is a WordPress plugin to show a selection of Piwik stats in your WordPress admin dashboard and to add and configure your Piwik tracking code. To use this you will need your own Piwik instance. If you do not already have a Piwik setup, you have two simple options: use either', 'wp-piwik' ), 'http://piwik.org/', __ ( 'Self-hosted', 'wp-piwik' ), __ ( 'or', 'wp-piwik' ), 'http://piwik.org/hosting/', __ ( 'Cloud-hosted', 'wp-piwik' ) ) );
88
+
89
+ if (! function_exists ( 'curl_init' ) && ! ini_get ( 'allow_url_fopen' ))
90
+ $this->showBox ( 'error', 'no', __ ( 'Neither cURL nor fopen are available. So WP-Piwik can not use the HTTP API and not connect to Piwik Pro.' ) . ' ' . sprintf ( '<a href="%s">%s.</a>', 'https://wordpress.org/plugins/wp-piwik/faq/', __ ( 'More information', 'wp-piwik' ) ) );
91
+
92
+ $description = sprintf ( '%s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s', __ ( 'You can choose between three connection methods:', 'wp-piwik' ), __ ( 'Self-hosted (HTTP API, default)', 'wp-piwik' ), __ ( 'This is the default option for a self-hosted Piwik and should work for most configurations. WP-Piwik will connect to Piwk using http(s).', 'wp-piwik' ), __ ( 'Self-hosted (PHP API)', 'wp-piwik' ), __ ( 'Choose this, if your self-hosted Piwik and WordPress are running on the same machine and you know the full server path to your Piwik instance.', 'wp-piwik' ), __ ( 'Cloud-hosted (Piwik Pro)', 'wp-piwik' ), __ ( 'If you are using a cloud-hosted Piwik by Piwik Pro, you can simply use this option.', 'wp-piwik' ) );
93
+ $this->showSelect ( 'piwik_mode', __ ( 'Piwik Mode', 'wp-piwik' ), array (
94
+ 'disabled' => __ ( 'Disabled (WP-Piwik will not connect to Piwik)', 'wp-piwik' ),
95
+ 'http' => __ ( 'Self-hosted (HTTP API, default)', 'wp-piwik' ),
96
+ 'php' => __ ( 'Self-hosted (PHP API)', 'wp-piwik' ),
97
+ 'pro' => __ ( 'Cloud-hosted (Piwik Pro)', 'wp-piwik' )
98
+ ), $description, '$j(\'tr.wp-piwik-mode-option\').addClass(\'hidden\'); $j(\'#wp-piwik-mode-option-\' + $j(\'#piwik_mode\').val()).removeClass(\'hidden\');', false, '', self::$wpPiwik->isConfigured () );
99
+
100
+ $this->showInput ( 'piwik_url', __ ( 'Piwik URL', 'wp-piwik' ), __( 'Enter your Piwik URL. This is the same URL you use to access your Piwik instance, e.g. http://www.example.com/piwik/.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'http', 'wp-piwik-mode-option', 'http', self::$wpPiwik->isConfigured () );
101
+ $this->showInput ( 'piwik_path', __ ( 'Piwik path', 'wp-piwik' ), __( 'Enter the file path to your Piwik instance, e.g. /var/www/piwik/.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'php', 'wp-piwik-mode-option', 'php', self::$wpPiwik->isConfigured () );
102
+ $this->showInput ( 'piwik_user', __ ( 'Piwik user', 'wp-piwik' ), __( 'Enter your Piwik Pro username. It is also part of your URL: http://USERNAME.piwik.pro.', 'wp-piwik' ), self::$settings->getGlobalOption ( 'piwik_mode' ) != 'pro', 'wp-piwik-mode-option', 'pro', self::$wpPiwik->isConfigured () );
103
+ $this->showInput ( 'piwik_token', __ ( 'Auth token', 'wp-piwik' ), __( 'Enter your Piwik auth token here. It is an alphanumerical code like 0a1b2c34d56e78901fa2bc3d45678efa.', 'wp-piwik' ).' '.sprintf ( __ ( 'See %sWP-Piwik FAQ%s.', 'wp-piwik' ), '<a href="https://wordpress.org/plugins/wp-piwik/faq/">', '</a>' ), false, '', '', self::$wpPiwik->isConfigured () );
104
+
105
+ // Site configuration
106
+ $piwikSiteId = self::$wpPiwik->isConfigured () ? self::$wpPiwik->getPiwikSiteId () : false;
107
+ if (! self::$wpPiwik->isNetworkMode() ) {
108
+ $this->showCheckbox ( 'auto_site_config', __ ( 'Auto config', 'wp-piwik' ), __ ( 'Check this to automatically choose your blog from your Piwik sites by URL. If your blog is not added to Piwik yet, WP-Piwik will add a new site.', 'wp-piwik' ), false, '$j(\'tr.wp-piwik-auto-option\').toggle(\'hidden\');' . ($piwikSiteId ? '$j(\'#site_id\').val(' . $piwikSiteId . ');' : '') );
109
+ if (self::$wpPiwik->isConfigured ()) {
110
+ $piwikSiteDetails = self::$wpPiwik->getPiwikSiteDetails ();
111
+ if (($piwikSiteId == 'n/a'))
112
+ $piwikSiteDescription = 'n/a';
113
+ elseif (! self::$settings->getGlobalOption ( 'auto_site_config' ))
114
+ $piwikSiteDescription = __ ( 'Save settings to start estimation.', 'wp-piwik' );
115
+ else
116
+ $piwikSiteDescription = $piwikSiteDetails [$piwikSiteId] ['name'] . ' (' . $piwikSiteDetails [$piwikSiteId] ['main_url'] . ')';
117
+ echo '<tr class="wp-piwik-auto-option' . (! self::$settings->getGlobalOption ( 'auto_site_config' ) ? ' hidden' : '') . '"><th scope="row">' . __ ( 'Determined site', 'wp-piwik' ) . ':</th><td>' . $piwikSiteDescription . '</td></tr>';
118
+ if (is_array ( $piwikSiteDetails ))
119
+ foreach ( $piwikSiteDetails as $key => $siteData )
120
+ $siteList [$key] = $siteData ['name'] . ' (' . $siteData ['main_url'] . ')';
121
+ if (isset($siteList))
122
+ $this->showSelect ( 'site_id', __ ( 'Select site', 'wp-piwik' ), $siteList, 'Choose the Piwik site corresponding to this blog.', '', self::$settings->getGlobalOption ( 'auto_site_config' ), 'wp-piwik-auto-option', true, false );
123
+ }
124
+ } else echo '<tr class="hidden"><td colspan="2"><input type="hidden" name="wp-piwik[auto_site_config]" value="1" /></td></tr>';
125
+
126
+ echo $submitButton;
127
+
128
+ echo '</tbody></table><table id="statistics" class="wp-piwik_menu-tab hidden"><tbody>';
129
+ // Stats configuration
130
+ $this->showSelect ( 'default_date', __ ( 'Piwik default date', 'wp-piwik' ), array (
131
+ 'today' => __ ( 'Today', 'wp-piwik' ),
132
+ 'yesterday' => __ ( 'Yesterday', 'wp-piwik' ),
133
+ 'current_month' => __ ( 'Current month', 'wp-piwik' ),
134
+ 'last_month' => __ ( 'Last month', 'wp-piwik' ),
135
+ 'current_week' => __ ( 'Current week', 'wp-piwik' ),
136
+ 'last_week' => __ ( 'Last week', 'wp-piwik' )
137
+ ), __ ( 'Default date shown on statistics page.', 'wp-piwik' ) );
138
+
139
+ $this->showCheckbox ( 'stats_seo', __ ( 'Show SEO data', 'wp-piwik' ), __ ( 'Display SEO ranking data on statistics page.', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
140
+
141
+ $this->showSelect ( 'dashboard_widget', __ ( 'Dashboard overview', 'wp-piwik' ), array (
142
+ 'disabled' => __ ( 'Disabled', 'wp-piwik' ),
143
+ 'yesterday' => __ ( 'Yesterday', 'wp-piwik' ),
144
+ 'today' => __ ( 'Today', 'wp-piwik' ),
145
+ 'last30' => __ ( 'Last 30 days', 'wp-piwik' )
146
+ ), __ ( 'Enable WP-Piwik dashboard widget &quot;Overview&quot;.', 'wp-piwik' ) );
147
+
148
+ $this->showCheckbox ( 'dashboard_chart', __ ( 'Dashboard graph', 'wp-piwik' ), __ ( 'Enable WP-Piwik dashboard widget &quot;Graph&quot;.', 'wp-piwik' ) );
149
+
150
+ $this->showCheckbox ( 'dashboard_seo', __ ( 'Dashboard SEO', 'wp-piwik' ), __ ( 'Enable WP-Piwik dashboard widget &quot;SEO&quot;.', 'wp-piwik' ) . ' (' . __ ( 'Slow!', 'wp-piwik' ) . ')' );
151
+
152
+ $this->showCheckbox ( 'toolbar', __ ( 'Show graph on WordPress Toolbar', 'wp-piwik' ), __ ( 'Display a last 30 days visitor graph on WordPress\' toolbar.', 'wp-piwik' ) );
153
+
154
+ echo '<tr><th scope="row"><label for="capability_read_stats">' . __ ( 'Display stats to', 'wp-piwik' ) . '</label>:</th><td>';
155
+ $filter = self::$settings->getGlobalOption ( 'capability_read_stats' );
156
+ foreach ( $wp_roles->role_names as $key => $name ) {
157
+ echo '<input type="checkbox" ' . (isset ( $filter [$key] ) && $filter [$key] ? 'checked="checked" ' : '') . 'value="1" onchange="$j(\'#capability_read_stats-' . $key . '-input\').val(this.checked?1:0);" />';
158
+ echo '<input id="capability_read_stats-' . $key . '-input" type="hidden" name="wp-piwik[capability_read_stats][' . $key . ']" value="' . ( int ) (isset ( $filter [$key] ) && $filter [$key]) . '" />';
159
+ echo $name . ' &nbsp; ';
160
+ }
161
+ echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#capability_read_stats-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="capability_read_stats-desc">' . __ ( 'Choose user roles allowed to see the statistics page.', 'wp-piwik' ) . '</p></td></tr>';
162
+
163
+ $this->showCheckbox ( 'perpost_stats', __ ( 'Show per post stats', 'wp-piwik' ), __ ( 'Show stats about single posts at the post edit admin page.', 'wp-piwik' ) );
164
+
165
+ $this->showCheckbox ( 'piwik_shortcut', __ ( 'Piwik shortcut', 'wp-piwik' ), __ ( 'Display a shortcut to Piwik itself.', 'wp-piwik' ) );
166
+
167
+ $this->showInput ( 'plugin_display_name', __ ( 'WP-Piwik display name', 'wp-piwik' ), __ ( 'Plugin name shown in WordPress.', 'wp-piwik' ) );
168
+
169
+ $this->showCheckbox ( 'shortcodes', __ ( 'Enable shortcodes', 'wp-piwik' ), __ ( 'Enable shortcodes in post or page content.', 'wp-piwik' ) );
170
+
171
+ echo $submitButton;
172
+
173
+ echo '</tbody></table><table id="tracking" class="wp-piwik_menu-tab hidden"><tbody>';
174
+
175
+ // Tracking Configuration
176
+ $isNotTracking = self::$settings->getGlobalOption ( 'track_mode' ) == 'disabled';
177
+ $isNotGeneratedTracking = $isNotTracking || self::$settings->getGlobalOption ( 'track_mode' ) == 'manually';
178
+ $fullGeneratedTrackingGroup = 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy';
179
+
180
+ $description = sprintf ( '%s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s<br /><strong>%s:</strong> %s', __ ( 'You can choose between four tracking code modes:', 'wp-piwik' ), __ ( 'Disabled', 'wp-piwik' ), __ ( 'WP-Piwik will not add the tracking code. Use this, if you want to add the tracking code to your template files or you use another plugin to add the tracking code.', 'wp-piwik' ), __ ( 'Default tracking', 'wp-piwik' ), __ ( 'WP-Piwik will use Piwik\'s standard tracking code.', 'wp-piwik' ), __ ( 'Use js/index.php', 'wp-piwik' ), __ ( 'You can choose this tracking code, to deliver a minified proxy code and to avoid using the files called piwik.js or piwik.php.', 'wp-piwik' ).' '.sprintf( __( 'See %sreadme file%s.', 'wp-piwik' ), '<a href="http://demo.piwik.org/js/README">', '</a>'), __ ( 'Use proxy script', 'wp-piwik' ), __ ( 'Use this tracking code to not reveal the Piwik server URL.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/#faq_132">', '</a>' ) , __ ( 'Enter manually', 'wp-piwik' ), __ ( 'Enter your own tracking code manually. You can choose one of the prior options, pre-configure your tracking code and switch to manually editing at last.', 'wp-piwik' ).( self::$wpPiwik->isNetworkMode() ? ' '.__ ( 'Use the placeholder {ID} to add the Piwik site ID.', 'wp-piwik' ) : '' ) );
181
+ $this->showSelect ( 'track_mode', __ ( 'Add tracking code', 'wp-piwik' ), array (
182
+ 'disabled' => __ ( 'Disabled', 'wp-piwik' ),
183
+ 'default' => __ ( 'Default tracking', 'wp-piwik' ),
184
+ 'js' => __ ( 'Use js/index.php', 'wp-piwik' ),
185
+ 'proxy' => __ ( 'Use proxy script', 'wp-piwik' ),
186
+ 'manually' => __ ( 'Enter manually', 'wp-piwik' )
187
+ ), $description, '$j(\'tr.wp-piwik-track-option\').addClass(\'hidden\'); $j(\'tr.wp-piwik-track-option-\' + $j(\'#track_mode\').val()).removeClass(\'hidden\'); $j(\'#tracking_code, #noscript_code\').prop(\'readonly\', $j(\'#track_mode\').val() != \'manually\');' );
188
+
189
+ $this->showTextarea ( 'tracking_code', __ ( 'Tracking code', 'wp-piwik' ), 15, 'This is a preview of your current tracking code. If you choose to enter your tracking code manually, you can change it here.', $isNotTracking, 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy wp-piwik-track-option-manually', true, '', (self::$settings->getGlobalOption ( 'track_mode' ) != 'manually'), false );
190
+
191
+ $this->showSelect ( 'track_codeposition', __ ( 'JavaScript code position', 'wp-piwik' ), array (
192
+ 'footer' => __ ( 'Footer', 'wp-piwik' ),
193
+ 'header' => __ ( 'Header', 'wp-piwik' )
194
+ ), __ ( 'Choose whether the JavaScript code is added to the footer or the header.', 'wp-piwik' ), '', $isNotTracking, 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js wp-piwik-track-option-proxy wp-piwik-track-option-manually' );
195
+
196
+ $this->showTextarea ( 'noscript_code', __ ( 'Noscript code', 'wp-piwik' ), 2, 'This is a preview of your &lt;noscript&gt; code which is part of your tracking code.', $isNotGeneratedTracking || self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js', true, '', true, false );
197
+
198
+ $this->showCheckbox ( 'track_noscript', __ ( 'Add &lt;noscript&gt;', 'wp-piwik' ), __ ( 'Adds the &lt;noscript&gt; code to your footer.', 'wp-piwik' ) . ' ' . __ ( 'Disabled in proxy mode.', 'wp-piwik' ), $isNotGeneratedTracking || self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js' );
199
+
200
+ $this->showCheckbox ( 'track_nojavascript', __ ( 'Add rec parameter to noscript code', 'wp-piwik' ), __ ( 'Enable tracking for visitors without JavaScript (not recommended).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/#faq_176">', '</a>' ) . ' ' . __ ( 'Disabled in proxy mode.', 'wp-piwik' ), $isNotGeneratedTracking || self::$settings->getGlobalOption ( 'track_mode' ) == 'proxy', 'wp-piwik-track-option wp-piwik-track-option-default wp-piwik-track-option-js' );
201
+
202
+ $this->showSelect ( 'track_content', __ ( 'Enable content tracking', 'wp-piwik' ), array (
203
+ 'disabled' => __ ( 'Disabled', 'wp-piwik' ),
204
+ 'all' => __ ( 'Track all content blocks', 'wp-piwik' ),
205
+ 'visible' => __ ( 'Track only visible content blocks', 'wp-piwik' )
206
+ ), __ ( 'Content tracking allows you to track interaction with the content of a web page or application.' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/content-tracking">', '</a>' ), '', $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
207
+
208
+ $this->showCheckbox ( 'track_search', __ ( 'Track search', 'wp-piwik' ), __ ( 'Use Piwik\'s advanced Site Search Analytics feature.' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/site-search/#track-site-search-using-the-tracking-api-advanced-users-only">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
209
+
210
+ $this->showCheckbox ( 'track_404', __ ( 'Track 404', 'wp-piwik' ), __ ( 'WP-Piwik can automatically add a 404-category to track 404-page-visits.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik FAQ%s.', 'wp-piwik' ), '<a href="http://piwik.org/faq/how-to/faq_60/">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
211
+
212
+ $this->showCheckbox ( 'add_post_annotations', __ ( 'Add annotation on new post', 'wp-piwik' ), __ ( 'Add a Piwik annotation on each new post.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/annotations/">', '</a>' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
213
+
214
+ $this->showCheckbox ( 'add_customvars_box', __ ( 'Show custom variables box', 'wp-piwik' ), __ ( ' Show a &quot;custom variables&quot; edit box on post edit page.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/custom-variables/">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
215
+
216
+ $this->showInput ( 'add_download_extensions', __ ( 'Add new file types for download tracking', 'wp-piwik' ), __ ( 'Add file extensions for download tracking, divided by a vertical bar (&#124;).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#file-extensions-for-tracking-downloads">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
217
+
218
+ $this->showCheckbox ( 'disable_cookies', __ ( 'Disable cookies', 'wp-piwik' ), __ ( 'Disable all tracking cookies for a visitor.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
219
+
220
+ $this->showCheckbox ( 'limit_cookies', __ ( 'Limit cookie lifetime', 'wp-piwik' ), __ ( 'You can limit the cookie lifetime to avoid tracking your users over a longer period as necessary.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup, true, '$j(\'tr.wp-piwik-cookielifetime-option\').toggle(\'wp-piwik-hidden\');' );
221
+
222
+ $this->showInput ( 'limit_cookies_visitor', __ ( 'Visitor timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup.' wp-piwik-cookielifetime-option' );
223
+
224
+ $this->showInput ( 'limit_cookies_session', __ ( 'Session timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup . ' wp-piwik-cookielifetime-option' );
225
+
226
+ $this->showInput ( 'limit_cookies_referral', __ ( 'Referral timeout (seconds)', 'wp-piwik' ), false, $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'limit_cookies' ), $fullGeneratedTrackingGroup . ' wp-piwik-cookielifetime-option' );
227
+
228
+ $this->showCheckbox ( 'track_admin', __ ( 'Track admin pages', 'wp-piwik' ), __ ( 'Enable to track users on admin pages (remember to configure the tracking filter appropriately).', 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
229
+
230
+ echo '<tr class="' . $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' . ($isNotTracking ? ' hidden' : '') . '">';
231
+ echo '<th scope="row"><label for="capability_stealth">' . __ ( 'Tracking filter', 'wp-piwik' ) . '</label>:</th><td>';
232
+ $filter = self::$settings->getGlobalOption ( 'capability_stealth' );
233
+ foreach ( $wp_roles->role_names as $key => $name )
234
+ echo '<input type="checkbox" ' . (isset ( $filter [$key] ) && $filter [$key] ? 'checked="checked" ' : '') . 'value="1" name="wp-piwik[capability_stealth][' . $key . ']" /> ' . $name . ' &nbsp; ';
235
+ echo '<span class="dashicons dashicons-editor-help" onclick="$j(\'#capability_stealth-desc\').toggleClass(\'hidden\');"></span> <p class="description hidden" id="capability_stealth-desc">' . __ ( 'Choose users by user role you do <strong>not</strong> want to track.', 'wp-piwik' ) . '</p></td></tr>';
236
+
237
+ $this->showCheckbox ( 'track_across', __ ( 'Track subdomains in the same website', 'wp-piwik' ), __ ( 'Adds *.-prefix to cookie domain.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#tracking-subdomains-in-the-same-website">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
238
+
239
+ $this->showCheckbox ( 'track_across_alias', __ ( 'Do not count subdomians as outlink', 'wp-piwik' ), __ ( 'Adds *.-prefix to tracked domain.', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="https://developer.piwik.org/guides/tracking-javascript-guide#outlink-tracking-exclusions">', '</a>' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
240
+
241
+ $this->showCheckbox ( 'track_feed', __ ( 'Track RSS feeds', 'wp-piwik' ), __ ( 'Enable to track posts in feeds via tracking pixel.', 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually' );
242
+
243
+ $this->showCheckbox ( 'track_feed_addcampaign', __ ( 'Track RSS feed links as campaign', 'wp-piwik' ), __ ( 'This will add Piwik campaign parameters to the RSS feed links.' . ' ' . sprintf ( __ ( 'See %sPiwik documentation%s.', 'wp-piwik' ), '<a href="http://piwik.org/docs/tracking-campaigns/">', '</a>' ), 'wp-piwik' ), $isNotTracking, $fullGeneratedTrackingGroup . ' wp-piwik-track-option-manually', true, '$j(\'tr.wp-piwik-feed_campaign-option\').toggle(\'hidden\');' );
244
+
245
+ $this->showInput ( 'track_feed_campaign', __ ( 'RSS feed campaign', 'wp-piwik' ), __ ( 'Keyword: post name.', 'wp-piwik' ), $isNotGeneratedTracking || ! self::$settings->getGlobalOption ( 'track_feed_addcampaign' ), $fullGeneratedTrackingGroup . ' wp-piwik-feed_campaign-option' );
246
+
247
+ echo $submitButton;
248
+ echo '</tbody></table><table id="expert" class="wp-piwik_menu-tab hidden"><tbody>';
249
+
250
+ $this->showText ( __ ( 'Usually, you do not need to change these settings. If you want to do so, you should know what you do or you got an expert\'s advice.', 'wp-piwik' ) );
251
+
252
+ $this->showCheckbox ( 'cache', __ ( 'Enable cache', 'wp-piwik' ), __ ( 'Cache API calls, which not contain today\'s values, for a week.', 'wp-piwik' ) );
253
+
254
+ $this->showCheckbox ( 'disable_timelimit', __ ( 'Disable time limit', 'wp-piwik' ), __ ( 'Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik' ) );
255
+
256
+ $this->showInput ( 'connection_timeout', __ ( 'Connection timeout', 'wp-piwik' ), 'Define a connection timeout for all HTTP requests done by WP-Piwik in seconds.' );
257
+
258
+ $this->showCheckbox ( 'disable_ssl_verify', __ ( 'Disable SSL peer verification', 'wp-piwik' ), '(' . __ ( 'not recommended', 'wp-piwik' ) . ')' );
259
+
260
+ $this->showSelect ( 'piwik_useragent', __ ( 'User agent', 'wp-piwik' ), array (
261
+ 'php' => __ ( 'Use the PHP default user agent', 'wp-piwik' ) . (ini_get ( 'user_agent' ) ? '(' . ini_get ( 'user_agent' ) . ')' : ' (' . __ ( 'empty', 'wp-piwik' ) . ')'),
262
+ 'own' => __ ( 'Define a specific user agent', 'wp-piwik' )
263
+ ), 'WP-Piwik can send the default user agent defined by your PHP settings or use a specific user agent below. The user agent is send by WP-Piwik if HTTP requests are performed.', '$j(\'tr.wp-piwik-useragent-option\').toggleClass(\'hidden\');' );
264
+ $this->showInput ( 'piwik_useragent_string', __ ( 'Specific user agent', 'wp-piwik' ), 'Define a user agent description which is send by WP-Piwik if HTTP requests are performed.', self::$settings->getGlobalOption ( 'piwik_useragent' ) != 'own', 'wp-piwik-useragent-option' );
265
+
266
+ $this->showCheckbox ( 'track_datacfasync', __ ( 'Add data-cfasync=false', 'wp-piwik' ), __ ( 'Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to ignore the script.' . ' ' . sprintf ( __ ( 'See %sCloudFlare Knowledge Base%s.', 'wp-piwik' ), '<a href="https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-">', '</a>' ), 'wp-piwik' ) );
267
+
268
+ $this->showInput ( 'track_cdnurl', __ ( 'CDN URL', 'wp-piwik' ), 'Enter URL if you want to load the tracking code via CDN.' );
269
+
270
+ $this->showInput ( 'track_cdnurlssl', __ ( 'CDN URL (SSL)', 'wp-piwik' ), 'Enter URL if you want to load the tracking code via a separate SSL CDN.' );
271
+
272
+ $this->showSelect ( 'force_protocol', __ ( 'Force Piwik to use a specific protocol', 'wp-piwik' ), array (
273
+ 'disabled' => __ ( 'Disabled (default)', 'wp-piwik' ),
274
+ 'http' => __ ( 'http', 'wp-piwik' ),
275
+ 'https' => __ ( 'https (SSL)', 'wp-piwik' )
276
+ ), __ ( 'Choose if you want to explicitly force Piwik to use HTTP or HTTPS. Does not work with a CDN URL.', 'wp-piwik' ) );
277
+
278
+ echo $submitButton;
279
+ ?>
280
+ </tbody>
281
+ </table>
282
+ <table id="support" class="wp-piwik_menu-tab hidden">
283
+ <tbody>
284
+ <tr><td colspan="2"><?php
285
+ echo $this->showSupport();
286
+ ?></td></tr>
287
+ </tbody>
288
+ </table>
289
+ <table id="credits" class="wp-piwik_menu-tab hidden">
290
+ <tbody>
291
+ <tr><td colspan="2"><?php
292
+ echo $this->showCredits();
293
+ ?></td></tr>
294
+ </tbody>
295
+ </table>
296
+ <input type="hidden" name="wp-piwik[proxy_url]"
297
+ value="<?php echo self::$settings->getGlobalOption('proxy_url'); ?>" />
298
+ </form>
299
+ </div>
300
+ <?php
301
+ }
302
+
303
+ /**
304
+ * Show an option's description
305
+ *
306
+ * @param string $id option id
307
+ * @param string $description option description
308
+ * @param boolean $hideDescription set to false to show description initially (default: true)
309
+ * @return string full description HTML
310
+ */
311
+ private function getDescription($id, $description, $hideDescription = true) {
312
+ return sprintf ( '<span class="dashicons dashicons-editor-help" onclick="$j(\'#%s-desc\').toggleClass(\'hidden\');"></span> <p class="description' . ($hideDescription ? ' hidden' : '') . '" id="%1$s-desc">%s</p>', $id, $description );
313
+ }
314
+
315
+ /**
316
+ * Show a checkbox option
317
+ *
318
+ * @param string $id option id
319
+ * @param string $name descriptive option name
320
+ * @param string $description option description
321
+ * @param boolean $isHidden set to true to initially hide the option (default: false)
322
+ * @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
323
+ * @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
324
+ * @param string $onChange javascript for onchange event (default: empty)
325
+ */
326
+ private function showCheckbox($id, $name, $description, $isHidden = false, $groupName = '', $hideDescription = true, $onChange = '') {
327
+ printf ( '<tr class="' . $groupName . ($isHidden ? ' hidden' : '') . '"><th scope="row"><label for="%2$s">%s</label>:</th><td><input type="checkbox" value="1"' . (self::$settings->getGlobalOption ( $id ) ? ' checked="checked"' : '') . ' onchange="$j(\'#%s\').val(this.checked?1:0);%s" /><input id="%2$s" type="hidden" name="wp-piwik[%2$s]" value="' . ( int ) self::$settings->getGlobalOption ( $id ) . '" /> %s</td></tr>', $name, $id, $onChange, $this->getDescription ( $id, $description, $hideDescription ) );
328
+ }
329
+
330
+ /**
331
+ * Show a textarea option
332
+ *
333
+ * @param string $id option id
334
+ * @param string $name descriptive option name
335
+ * @param int $rows number of rows to show
336
+ * @param string $description option description
337
+ * @param boolean $isHidden set to true to initially hide the option (default: false)
338
+ * @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
339
+ * @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
340
+ * @param string $onChange javascript for onchange event (default: empty)
341
+ * @param boolean $isReadonly set textarea to read only (default: false)
342
+ * @param boolean $global set to false if the textarea shows a site-specific option (default: true)
343
+ */
344
+ private function showTextarea($id, $name, $rows, $description, $isHidden, $groupName, $hideDescription = true, $onChange = '', $isReadonly = false, $global = true) {
345
+ printf ( '<tr class="' . $groupName . ($isHidden ? ' hidden' : '') . '"><th scope="row"><label for="%2$s">%s</label>:</th><td><textarea cols="80" rows="' . $rows . '" id="%s" name="wp-piwik[%2$s]" onchange="%s"' . ($isReadonly ? ' readonly="readonly"' : '') . '>' . ($global ? self::$settings->getGlobalOption ( $id ) : self::$settings->getOption ( $id )) . '</textarea> %s</td></tr>', $name, $id, $onChange, $this->getDescription ( $id, $description, $hideDescription ) );
346
+ }
347
+
348
+ /**
349
+ * Show a simple text
350
+ *
351
+ * @param string $text Text to show
352
+ */
353
+ private function showText($text) {
354
+ printf ( '<tr><td colspan="2"><p>%s</p></td></tr>', $text );
355
+ }
356
+
357
+ /**
358
+ * Show an input option
359
+ *
360
+ * @param string $id option id
361
+ * @param string $name descriptive option name
362
+ * @param string $description option description
363
+ * @param boolean $isHidden set to true to initially hide the option (default: false)
364
+ * @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
365
+ * @param string $rowName define a class name to access the specific option row by javascript (default: empty)
366
+ * @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
367
+ */
368
+ private function showInput($id, $name, $description, $isHidden = false, $groupName = '', $rowName = false, $hideDescription = true) {
369
+ printf ( '<tr class="%s%s"%s><th scope="row"><label for="%5$s">%s:</label></th><td><input name="wp-piwik[%s]" id="%5$s" value="%s" /> %s</td></tr>', $isHidden ? 'hidden ' : '', $groupName ? $groupName : '', $rowName ? ' id="' . $groupName . '-' . $rowName . '"' : '', $name, $id, self::$settings->getGlobalOption ( $id ), !empty($description) ? $this->getDescription ( $id, $description, $hideDescription ) : '' );
370
+ }
371
+
372
+ /**
373
+ * Show a select box option
374
+ *
375
+ * @param string $id option id
376
+ * @param string $name descriptive option name
377
+ * @param array $options list of options to show array[](option id => descriptive name)
378
+ * @param string $description option description
379
+ * @param string $onChange javascript for onchange event (default: empty)
380
+ * @param boolean $isHidden set to true to initially hide the option (default: false)
381
+ * @param string $groupName define a class name to access a group of option rows by javascript (default: empty)
382
+ * @param boolean $hideDescription $hideDescription set to false to show description initially (default: true)
383
+ * @param boolean $global set to false if the textarea shows a site-specific option (default: true)
384
+ */
385
+ private function showSelect($id, $name, $options = array(), $description = '', $onChange = '', $isHidden = false, $groupName = '', $hideDescription = true, $global = true) {
386
+ $optionList = '';
387
+ $default = $global ? self::$settings->getGlobalOption ( $id ) : self::$settings->getOption ( $id );
388
+ if (is_array ( $options ))
389
+ foreach ( $options as $key => $value )
390
+ $optionList .= sprintf ( '<option value="%s"' . ($key == $default ? ' selected="selected"' : '') . '>%s</option>', $key, $value );
391
+ printf ( '<tr class="' . $groupName . ($isHidden ? ' hidden' : '') . '"><th scope="row"><label for="%2$s">%s:</label></th><td><select name="wp-piwik[%s]" id="%2$s" onchange="%s">%s</select> %s</td></tr>', $name, $id, $onChange, $optionList, $this->getDescription ( $id, $description, $hideDescription ) );
392
+ }
393
+
394
+ /**
395
+ * Show an info box
396
+ *
397
+ * @param string $type box style (e.g., updated, error)
398
+ * @param string $icon box icon, see https://developer.wordpress.org/resource/dashicons/
399
+ * @param string $content box message
400
+ */
401
+ private function showBox($type, $icon, $content) {
402
+ printf ( '<tr><td colspan="2"><div class="%s"><p><span class="dashicons dashicons-%s"></span> %s</p></div></td></tr>', $type, $icon, $content );
403
+ }
404
+
405
+ /**
406
+ * Show headline
407
+ * @param int $order headline order (h?-tag), set to 0 to avoid headline-tagging
408
+ * @param string $icon headline icon, see https://developer.wordpress.org/resource/dashicons/
409
+ * @param string $headline headline text
410
+ * @param string $addPluginName set to true to add the plugin name to the headline (default: false)
411
+ */
412
+ private function showHeadline($order, $icon, $headline, $addPluginName = false) {
413
+ echo $this->getHeadline ( $order, $icon, $headline, $addPluginName = false );
414
+ }
415
+
416
+ /**
417
+ * Get headline HTML
418
+ *
419
+ * @param int $order headline order (h?-tag), set to 0 to avoid headline-tagging
420
+ * @param string $icon headline icon, see https://developer.wordpress.org/resource/dashicons/
421
+ * @param string $headline headline text
422
+ * @param string $addPluginName set to true to add the plugin name to the headline (default: false)
423
+ */
424
+ private function getHeadline($order, $icon, $headline, $addPluginName = false) {
425
+ echo ($order > 0 ? "<h$order>" : '') . sprintf ( '<span class="dashicons dashicons-%s"></span> %s%s', $icon, ($addPluginName ? self::$settings->getGlobalOption ( 'plugin_display_name' ) . ' ' : ''), __ ( $headline, 'wp-piwik' ) ) . ($order > 0 ? "</h$order>" : '');
426
+ }
427
+
428
+ /**
429
+ * Show donation info
430
+ */
431
+ private function showDonation() {
432
+ ?>
433
+ <div class="wp-piwik-donate">
434
+ <p>
435
+ <strong><?php _e('Donate','wp-piwik'); ?></strong>
436
+ </p>
437
+ <p><?php _e('If you like WP-Piwik, you can support its development by a donation:', 'wp-piwik'); ?></p>
438
+ <script type="text/javascript">
439
+ /* <![CDATA[ */
440
+ window.onload = function() {
441
+ FlattrLoader.render({
442
+ 'uid': 'flattr',
443
+ 'url': 'http://wp.local',
444
+ 'title': 'Title of the thing',
445
+ 'description': 'Description of the thing'
446
+ }, 'element_id', 'replace');
447
+ }
448
+ /* ]]> */
449
+ </script>
450
+ <div>
451
+ <a class="FlattrButton" style="display: none;"
452
+ title="WordPress Plugin WP-Piwik"
453
+ rel="flattr;uid:braekling;category:software;tags:wordpress,piwik,plugin,statistics;"
454
+ href="https://www.braekling.de/wp-piwik-wpmu-piwik-wordpress">This
455
+ WordPress plugin adds a Piwik stats site to your WordPress dashboard.
456
+ It's also able to add the Piwik tracking code to your blog using
457
+ wp_footer. You need a running Piwik installation and at least view
458
+ access to your stats.</a>
459
+ </div>
460
+ <div>
461
+ Paypal
462
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
463
+ <input type="hidden" name="cmd" value="_s-xclick" /> <input
464
+ type="hidden" name="hosted_button_id" value="6046779" /> <input
465
+ type="image"
466
+ src="https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif"
467
+ name="submit" alt="PayPal - The safer, easier way to pay online." />
468
+ <img alt="" border="0"
469
+ src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1"
470
+ height="1" />
471
+ </form>
472
+ </div>
473
+ <div>
474
+ <a
475
+ href="http://www.amazon.de/gp/registry/wishlist/111VUJT4HP1RA?reveal=unpurchased&amp;filter=all&amp;sort=priority&amp;layout=standard&amp;x=12&amp;y=14"><?php _e('My Amazon.de wishlist', 'wp-piwik'); ?></a>
476
+ </div>
477
+ <div>
478
+ <?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a
479
+ href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org
480
+ Plugin Directory</a>.
481
+ </div>
482
+ </div><?php
483
+ }
484
+
485
+ /**
486
+ * Register admin scripts
487
+ *
488
+ * @see \WP_Piwik\Admin::printAdminScripts()
489
+ */
490
+ public function printAdminScripts() {
491
+ wp_enqueue_script ( 'jquery' );
492
+ }
493
+
494
+ /**
495
+ * Extend admin header
496
+ *
497
+ * @see \WP_Piwik\Admin::extendAdminHeader()
498
+ */
499
+ public function extendAdminHeader() {
500
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
501
+ echo '<script type="text/javascript">/* <![CDATA[ */(function() {var s = document.createElement(\'script\');var t = document.getElementsByTagName(\'script\')[0];s.type = \'text/javascript\';s.async = true;s.src = \'//api.flattr.com/js/0.6/load.js?mode=auto\';t.parentNode.insertBefore(s, t);})();/* ]]> */</script>';
502
+ }
503
+
504
+ /**
505
+ * Show credits
506
+ */
507
+ public function showCredits() {
508
+ ?>
509
+ <p><strong><?php _e('Thank you very much for your donation', 'wp-piwik'); ?>:</strong> Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., Oleg I., M. N., Daniel K., James L., Jochen K., Cyril P., Thomas K., <?php _e('the Piwik team itself','wp-piwik');?><?php _e(', and all people flattering this','wp-piwik'); ?>!</p>
510
+ <p><?php _e('Graphs powered by <a href="http://www.jqplot.com/">jqPlot</a> (License: GPL 2.0 and MIT) and <a href="http://omnipotent.net/jquery.sparkline/">jQuery Sparklines</a> (License: New BSD License).','wp-piwik'); ?></p>
511
+ <p><?php _e('Metabox support inspired by', 'wp-piwik'); echo ' <a href="http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins">Heiko Rabe\'s metabox demo plugin</a>.';?></p>
512
+ <p><?php _e('Tabbed settings page suggested by the', 'wp-piwik'); echo' <a href="http://wp.smashingmagazine.com/2011/10/20/create-tabs-wordpress-settings-pages/">Smashing Magazine</a>.';?></p>
513
+ <p><?php _e('Thank you very much','wp-piwik'); ?>, Besnik Bleta, FatCow, Rene, Fab, EzBizNiz, Gormer, Natalya, AggelioPolis, Web Hosting Geeks, Web Hosting Rating, Nata Strazda (Web Hosting Hub), Hossein (LibreOffice localization team), Ste &amp; Chris <?php _e('for your translation work','wp-piwik'); ?>!</p>
514
+ <p><?php _e('Thank you very much, all users who send me mails containing criticism, commendation, feature requests and bug reports! You help me to make WP-Piwik much better.','wp-piwik'); ?></p>
515
+ <p><?php _e('Thank <strong>you</strong> for using my plugin. It is the best commendation if my piece of code is really used!','wp-piwik'); ?></p>
516
+ <?php
517
+ }
518
+
519
+ /**
520
+ * Show support information
521
+ */
522
+ public function showSupport() {
523
+ ?><ul>
524
+ <li><?php _e('The best place to get help:', 'wp-piwik'); ?> <a href="https://wordpress.org/support/plugin/wp-piwik"><?php _e('WP-Piwik support forum','wp-piwik'); ?></a></li>
525
+ <li><?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org Plugin Directory</a>.</li>
526
+ </ul>
527
+ <h3><?php _e('Debugging', 'wp-piwik'); ?></h3>
528
+ <p><?php _e('Either allow_url_fopen has to be enabled <em>or</em> cURL has to be available:', 'wp-piwik'); ?></p>
529
+ <ol>
530
+ <li><?php
531
+ _e('cURL is','wp-piwik');
532
+ echo ' <strong>'.(function_exists('curl_init')?'':__('not','wp-piwik')).' ';
533
+ _e('available','wp-piwik');
534
+ ?></strong>.</li>
535
+ <li><?php
536
+ _e('allow_url_fopen is','wp-piwik');
537
+ echo ' <strong>'.(ini_get('allow_url_fopen')?'':__('not','wp-piwik')).' ';
538
+ _e('enabled','wp-piwik');
539
+ ?></strong>.</li>
540
+ </ol>
541
+ <p><a href="<?php echo admin_url( 'options-general.php?page='.$_GET['page'].'&testscript=1' ); ?>">Run testscript</a>. <a href="<?php echo admin_url( 'options-general.php?page='.$_GET['page'].'&sitebrowser=1' ); ?>">Sitebrowser</a>.</p>
542
+ <h3><?php _e('Latest support threads on WordPress.org', 'wp-piwik'); ?></h3><?php
543
+ $supportThreads = $this->readRSSFeed('http://wordpress.org/support/rss/plugin/wp-piwik');
544
+ if (!empty($supportThreads)) {
545
+ echo '<ol>';
546
+ foreach ($supportThreads as $supportThread)
547
+ echo '<li><a href="'.$supportThread['url'].'">'.$supportThread['title'].'</a></li>';
548
+ echo '</ol>';
549
+ }
550
+ }
551
+
552
+ /**
553
+ * Read RSS feed
554
+ *
555
+ * @param string $feed
556
+ * feed URL
557
+ * @param int $cnt
558
+ * item limit
559
+ * @return array feed items array[](title, url)
560
+ *
561
+ */
562
+ private function readRSSFeed($feed, $cnt = 5) {
563
+ $result = array ();
564
+ if (function_exists ( 'simplexml_load_file' ) && ! empty ( $feed )) {
565
+ $xml = @simplexml_load_file ( $feed );
566
+ if (! $xml || ! isset ( $xml->channel [0]->item ))
567
+ return array (
568
+ array (
569
+ 'title' => 'Can\'t read RSS feed.',
570
+ 'url' => $xml
571
+ )
572
+ );
573
+ foreach ( $xml->channel [0]->item as $item ) {
574
+ if ($cnt -- == 0)
575
+ break;
576
+ $result [] = array (
577
+ 'title' => $item->title [0],
578
+ 'url' => $item->link [0]
579
+ );
580
+ }
581
+ }
582
+ return $result;
583
+ }
584
+
585
+ /**
586
+ * Execute test script and display results
587
+ */
588
+ private function runTestscript() { ?>
589
+ <div class="wp-piwik-debug">
590
+ <h2>Testscript Result</h2>
591
+ <?php if (self::$wpPiwik->isConfigured()) { ?>
592
+ <textarea cols="80" rows="10"><?php
593
+ echo '`WP-Piwik '.self::$wpPiwik->getPluginVersion()."\nMode: ".self::$settings->getGlobalOption('piwik_mode')."\n\n";
594
+ ?>Test 1/3: global.getPiwikVersion<?php
595
+ $GLOBALS ['wp-piwik_debug'] = true;
596
+ $id = \WP_Piwik\Request::register ( 'API.getPiwikVersion' );
597
+ echo "\n\n"; var_dump( self::$wpPiwik->request( $id ) ); echo "\n";
598
+ $GLOBALS ['wp-piwik_debug'] = false;
599
+ ?>Test 2/3: SitesManager.getSitesWithAtLeastViewAccess<?php
600
+ $GLOBALS ['wp-piwik_debug'] = true;
601
+ $id = \WP_Piwik\Request::register ( 'SitesManager.getSitesWithAtLeastViewAccess' );
602
+ echo "\n\n"; var_dump( self::$wpPiwik->request( $id ) ); echo "\n";
603
+ $GLOBALS ['wp-piwik_debug'] = false;
604
+ ?>Test 3/3: SitesManager.getSitesWithAtLeastViewAccess<?php
605
+ $GLOBALS ['wp-piwik_debug'] = true;
606
+ $id = \WP_Piwik\Request::register ( 'SitesManager.getSitesIdFromSiteUrl', array (
607
+ 'url' => get_bloginfo ( 'url' )
608
+ ) );
609
+ echo "\n\n"; var_dump( self::$wpPiwik->request( $id ) ); echo "`";
610
+ $GLOBALS ['wp-piwik_debug'] = false;
611
+ ?></textarea>
612
+ <?php } else echo '<p>Please configure WP-Piwik first.</p>'; ?>
613
+ </div>
614
+ <?php }
615
+
616
+ }
classes/WP_Piwik/Admin/Sitebrowser.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Admin;
4
+
5
+ if (!class_exists('WP_List_Table'))
6
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
7
+
8
+ class Sitebrowser extends \WP_List_Table {
9
+
10
+ private $data = array(), $wpPiwik;
11
+
12
+ public function __construct($wpPiwik) {
13
+ $this->wpPiwik = $wpPiwik;
14
+ $cnt = $this->prepare_items();
15
+ global $status, $page;
16
+ parent::__construct( array(
17
+ 'singular' => __('site', 'wp-piwik'),
18
+ 'plural' => __('sites', 'wp-piwik'),
19
+ 'ajax' => false
20
+ ) );
21
+ if ($cnt > 0) $this->display();
22
+ else echo '<p>'.__('No site configured yet.', 'wp-piwik').'</p>';
23
+ }
24
+
25
+ public function get_columns(){
26
+ $columns = array(
27
+ 'id' => __('ID','wp-piwik'),
28
+ 'name' => __('Title','wp-piwik'),
29
+ 'siteurl' => __('URL','wp-piwik'),
30
+ 'piwikid' => __('Site ID (Piwik)','wp-piwik')
31
+ );
32
+ return $columns;
33
+ }
34
+
35
+ public function prepare_items() {
36
+ $current_page = $this->get_pagenum();
37
+ $per_page = 10;
38
+ global $blog_id;
39
+ global $wpdb;
40
+ global $pagenow;
41
+ if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) {
42
+ $total_items = $wpdb->get_var('SELECT COUNT(*) FROM '.$wpdb->blogs);
43
+ $blogs = $wpdb->get_results($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id LIMIT %d,%d',(($current_page-1)*$per_page),$per_page));
44
+ foreach ($blogs as $blog) {
45
+ $blogDetails = get_blog_details($blog->blog_id, true);
46
+ $this->data[] = array(
47
+ 'name' => $blogDetails->blogname,
48
+ 'id' => $blogDetails->blog_id,
49
+ 'siteurl' => $blogDetails->siteurl,
50
+ 'piwikid' => $this->wpPiwik->getPiwikSiteId($blogDetails->blog_id)
51
+ );
52
+ }
53
+ } else {
54
+ $blogDetails = get_bloginfo();
55
+ $this->data[] = array(
56
+ 'name' => get_bloginfo('name'),
57
+ 'id' => '-',
58
+ 'siteurl' => get_bloginfo('url'),
59
+ 'piwikid' => $this->wpPiwik->getPiwikSiteId()
60
+ );
61
+ $total_items = 1;
62
+ }
63
+ $columns = $this->get_columns();
64
+ $hidden = array();
65
+ $sortable = array();
66
+ $this->_column_headers = array($columns, $hidden, $sortable);
67
+ $this->set_pagination_args(array(
68
+ 'total_items' => $total_items,
69
+ 'per_page' => $per_page
70
+ ));
71
+ foreach ($this->data as $key => $dataset) {
72
+ if (empty($dataset['piwikid']) || $dataset['piwikid'] == 'n/a')
73
+ $this->data[$key]['piwikid'] = __('Site not created yet.', 'wp-piwik');
74
+ if ($this->wpPiwik->isNetworkMode())
75
+ $this->data[$key]['name'] = '<a href="?page=wp-piwik_stats&wpmu_show_stats='.$dataset['id'].'">'.$dataset['name'].'</a>';
76
+ }
77
+ $this->items = $this->data;
78
+ return count($this->items);
79
+ }
80
+
81
+ function column_default( $item, $column_name ) {
82
+ switch( $column_name ) {
83
+ case 'id':
84
+ case 'name':
85
+ case 'siteurl':
86
+ case 'piwikid':
87
+ return $item[$column_name];
88
+ default:
89
+ return print_r($item,true);
90
+ }
91
+ }
92
+
93
+ }
classes/WP_Piwik/Admin/Statistics.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Admin;
4
+
5
+ class Statistics extends \WP_Piwik\Admin {
6
+
7
+ public function show() {
8
+ global $screen_layout_columns;
9
+ if (empty($screen_layout_columns)) $screen_layout_columns = 2;
10
+ if (self::$settings->getGlobalOption('disable_timelimit')) set_time_limit(0);
11
+ echo '<div id="wp-piwik-stats-general" class="wrap">';
12
+ echo '<h2>'.(self::$settings->getGlobalOption('plugin_display_name') == 'WP-Piwik'?'Piwik '.__('Statistics', 'wp-piwik'):self::$settings->getGlobalOption('plugin_display_name')).'</h2>';
13
+ if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin()) {
14
+ if (isset($_GET['wpmu_show_stats'])) {
15
+ switch_to_blog((int) $_GET['wpmu_show_stats']);
16
+ } else {
17
+ new \WP_Piwik\Admin\Sitebrowser(self::$wpPiwik);
18
+ return;
19
+ }
20
+ echo '<p>'.__('Currently shown stats:').' <a href="'.get_bloginfo('url').'">'.(int) $_GET['wpmu_show_stats'].' - '.get_bloginfo('name').'</a>.'.' <a href="?page=wp-piwik_stats">Show site overview</a>.</p>';
21
+ echo '</form>'."\n";
22
+ }
23
+ echo '<form action="admin-post.php" method="post"><input type="hidden" name="action" value="save_wp-piwik_stats_general" /><div id="dashboard-widgets" class="metabox-holder columns-'.$screen_layout_columns.(2 <= $screen_layout_columns?' has-right-sidebar':'').'">';
24
+ wp_nonce_field('wp-piwik_stats-general');
25
+ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
26
+ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
27
+ $columns = array('normal', 'side', 'column3');
28
+ for ($i = 0; $i < 3; $i++) {
29
+ echo '<div id="postbox-container-'.($i+1).'" class="postbox-container">';
30
+ do_meta_boxes(self::$wpPiwik->statsPageId, $columns[$i], null);
31
+ echo '</div>';
32
+ }
33
+ echo '</div></form></div>';
34
+ echo '<script type="text/javascript">//<![CDATA['."\n";
35
+ echo 'jQuery(document).ready(function($) {$(".if-js-closed").removeClass("if-js-closed").addClass("closed"); postboxes.add_postbox_toggles("'.self::$wpPiwik->statsPageId.'");});'."\n";
36
+ echo '//]]></script>'."\n";
37
+ if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin()) {
38
+ restore_current_blog();
39
+ }
40
+ }
41
+
42
+ public function printAdminScripts() {
43
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
44
+ wp_enqueue_script('wp-piwik-jqplot', self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'), self::$wpPiwik->getPluginVersion());
45
+ }
46
+
47
+ public function extendAdminHeader() {
48
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.(self::$wpPiwik->getPluginURL()).'js/jqplot/excanvas.min.js"></script><![endif]-->';
49
+ echo '<link rel="stylesheet" href="'.(self::$wpPiwik->getPluginURL()).'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
50
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
51
+ }
52
+
53
+ }
classes/{WP_Piwik_Logger.php → WP_Piwik/Logger.php} RENAMED
@@ -1,6 +1,8 @@
1
  <?php
2
 
3
- abstract class WP_Piwik_Logger {
 
 
4
 
5
  private $loggerName = 'unnamed';
6
  private $loggerContent = array();
1
  <?php
2
 
3
+ namespace WP_Piwik;
4
+
5
+ abstract class Logger {
6
 
7
  private $loggerName = 'unnamed';
8
  private $loggerContent = array();
classes/WP_Piwik/Logger/Dummy.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Logger;
4
+
5
+ class Dummy extends \WP_Piwik\Logger {
6
+
7
+ public function loggerOutput($loggerTime, $loggerMessage) {}
8
+
9
+ }
classes/{WP_Piwik_Logger_File.php → WP_Piwik/Logger/File.php} RENAMED
@@ -1,8 +1,8 @@
1
  <?php
2
-
3
- require_once('WP_Piwik_Logger.php');
4
 
5
- class WP_Piwik_Logger_File extends WP_Piwik_Logger {
 
 
6
 
7
  private $loggerFile = null;
8
 
@@ -13,7 +13,7 @@
13
  }
14
 
15
  private function setFilename() {
16
- $this->loggerFile = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'logs'.DIRECTORY_SEPARATOR.
17
  date('Ymd').'_'.$this->encodeFilename($this->getName()).'.log';
18
  }
19
 
1
  <?php
 
 
2
 
3
+ namespace WP_Piwik\Logger;
4
+
5
+ class File extends \WP_Piwik\Logger {
6
 
7
  private $loggerFile = null;
8
 
13
  }
14
 
15
  private function setFilename() {
16
+ $this->loggerFile = WP_PIWIK_PATH.'logs'.DIRECTORY_SEPARATOR.
17
  date('Ymd').'_'.$this->encodeFilename($this->getName()).'.log';
18
  }
19
 
classes/WP_Piwik/Logger/Screen.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Logger;
4
+
5
+ class Screen extends \WP_Piwik\Logger {
6
+
7
+ private $logs = array();
8
+
9
+ private function formatMicrotime($loggerTime) {
10
+ return sprintf('[%6s sec]',number_format($loggerTime,3));
11
+ }
12
+
13
+ public function __construct($loggerName) {
14
+ add_action(is_admin()?'admin_footer':'wp_footer', array($this, 'echoResults'));
15
+ parent::__construct($loggerName);
16
+ }
17
+
18
+ public function loggerOutput($loggerTime, $loggerMessage) {
19
+ $this->logs[] = $this->formatMicrotime($loggerTime).' '.$loggerMessage;
20
+ }
21
+
22
+ public function echoResults() {
23
+ echo '<pre>';
24
+ print_r($this->logs);
25
+ echo '</pre>';
26
+ }
27
+ }
classes/WP_Piwik/Request.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik;
4
+
5
+ abstract class Request {
6
+
7
+ protected static $wpPiwik, $settings, $debug, $requests = array(), $results = array(), $isCacheable = array(), $piwikVersion;
8
+
9
+ public function __construct($wpPiwik, $settings) {
10
+ self::$wpPiwik = $wpPiwik;
11
+ self::$settings = $settings;
12
+ self::register('API.getPiwikVersion', array());
13
+ }
14
+
15
+ public static function register($method, $parameter) {
16
+ if ($method == 'API.getPiwikVersion')
17
+ $id = 'global.getPiwikVersion';
18
+ else
19
+ $id = 'method='.$method.self::parameterToString($parameter);
20
+ if (
21
+ in_array( $method, array( 'API.getPiwikVersion', 'SitesManager.getJavascriptTag', 'SitesManager.getAllSites', 'SitesManager.getSitesIdFromSiteUrl', 'SitesManager.addSite', 'SitesManager.updateSite', 'SitesManager.getSitesWithAtLeastViewAccess' ) ) ||
22
+ substr($parameter['date'], 0, 4) == 'last' ||
23
+ $parameter['date'] == 'today' ||
24
+ ( $parameter['period'] == 'day' && $parameter['date'] == date('Ymd') ) ||
25
+ ( $parameter['period'] == 'month' && $parameter['date'] == date('Ym') ) ||
26
+ ( $parameter['period'] == 'week' && $parameter['date'] == date( 'Ymd', strtotime( "last Monday" ) ) )
27
+ ) self::$isCacheable[$id] = false;
28
+ else self::$isCacheable[$id] = $method.'-'.$parameter['period'].'-'.$parameter['date'];
29
+ if (!isset(self::$requests[$id]))
30
+ self::$requests[$id] = array('method' => $method, 'parameter' => $parameter);
31
+ return $id;
32
+ }
33
+ private static function parameterToString($parameter) {
34
+ $return = '';
35
+ if (is_array($parameter))
36
+ foreach ($parameter as $key => $value)
37
+ $return .= '&'.$key.'='.$value;
38
+ return $return;
39
+ }
40
+
41
+ public function perform($id) {
42
+ if ( self::$settings->getGlobalOption('cache') && false !== ( $cached = get_transient( 'wp-piwik_c_'.md5(self::$isCacheable[$id] ) ) ) ) {
43
+ self::$wpPiwik->log("Deliver cached data: ".$id);
44
+ return $cached;
45
+ }
46
+ self::$wpPiwik->log("Perform request: ".$id);
47
+ if (!isset(self::$requests[$id]))
48
+ return array('result' => 'error', 'message' => 'Request '.$id.' was not registered.');
49
+ elseif (!isset(self::$results[$id])) {
50
+ $this->request($id);
51
+ }
52
+ if ( isset ( self::$results[$id] )) {
53
+ if ( self::$settings->getGlobalOption('cache') && self::$isCacheable[$id] ) {
54
+ set_transient( 'wp-piwik_c_'.md5(self::$isCacheable[$id]) , self::$results[$id], WEEK_IN_SECONDS );
55
+ }
56
+ return self::$results[$id];
57
+ } else return false;
58
+ }
59
+
60
+ protected function buildURL($config, $urlDecode = false) {
61
+ $url = 'method='.($config['method']).'&idSite='.self::$settings->getOption('site_id');
62
+ foreach ($config['parameter'] as $key => $value)
63
+ $url .= '&'.$key.'='.($urlDecode?urldecode($value):$value);
64
+ return $url;
65
+ }
66
+
67
+ protected function unserialize($str) {
68
+ self::$wpPiwik->log("Result string: ".$str);
69
+ return ($str == serialize(false) || @unserialize($str) !== false)?unserialize($str):array();
70
+ }
71
+
72
+ abstract protected function request($id);
73
+
74
+ }
classes/WP_Piwik/Request/Php.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Request;
4
+
5
+ class Php extends \WP_Piwik\Request {
6
+
7
+ protected function request($id) {
8
+ $count = 0;
9
+ $url = self::$settings->getGlobalOption('piwik_url');
10
+ foreach (self::$requests as $requestID => $config) {
11
+ if (!isset(self::$results[$requestID])) {
12
+ $params = 'module=API&format=php&'.$this->buildURL($config, true);
13
+ $map[$count] = $requestID;
14
+ $result = $this->call($url, $params);
15
+ self::$results[$map[$count]] = $result;
16
+ $count++;
17
+ }
18
+ }
19
+ }
20
+
21
+ private function call($url, $params) {
22
+ if (!defined('PIWIK_INCLUDE_PATH'))
23
+ return;
24
+ if (PIWIK_INCLUDE_PATH === FALSE)
25
+ return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' &quot;'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'&quot;: '.__('realpath() returns false','wp-piwik').'.'));
26
+ if (file_exists(PIWIK_INCLUDE_PATH . "/index.php"))
27
+ require_once PIWIK_INCLUDE_PATH . "/index.php";
28
+ if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php"))
29
+ require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
30
+ if (class_exists('Piwik\FrontController'))
31
+ \Piwik\FrontController::getInstance()->init();
32
+ else serialize(array('result' => 'error', 'message' => __('Class Piwik\FrontController does not exists.','wp-piwik')));
33
+ if (class_exists('Piwik\API\Request'))
34
+ $request = new \Piwik\API\Request($params.'&token_auth='.self::$settings->getGlobalOption('piwik_token'));
35
+ else serialize(array('result' => 'error', 'message' => __('Class Piwik\API\Request does not exists.','wp-piwik')));
36
+ if (isset($request))
37
+ $result = $request->process();
38
+ if (!headers_sent())
39
+ header("Content-Type: text/html", true);
40
+ $result = $this->unserialize($result);
41
+ if ($GLOBALS ['wp-piwik_debug'])
42
+ array_unshift($result, $params.'&token_auth=...');
43
+ return $result;
44
+ }
45
+ }
classes/WP_Piwik/Request/Rest.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Request;
4
+
5
+ class Rest extends \WP_Piwik\Request {
6
+
7
+ protected function request($id) {
8
+ $count = 0;
9
+ $url = self::$settings->getGlobalOption('piwik_mode') == 'http'?
10
+ self::$settings->getGlobalOption('piwik_url'):
11
+ 'https://'.self::$settings->getGlobalOption('piwik_user').'.piwik.pro/';
12
+ $params = 'module=API&method=API.getBulkRequest&format=php';
13
+ foreach (self::$requests as $requestID => $config) {
14
+ if (!isset(self::$results[$requestID])) {
15
+ $params .= '&urls['.$count.']='.urlencode($this->buildURL($config));
16
+ $map[$count] = $requestID;
17
+ $count++;
18
+ }
19
+ }
20
+ $results = (function_exists('curl_init')?$this->curl($url, $params):$this->fopen($url, $params));
21
+ if (is_array($results))
22
+ foreach ($results as $num => $result)
23
+ self::$results[$map[$num]] = $result;
24
+ }
25
+
26
+ private function curl($url, $params) {
27
+ $c = curl_init($url);
28
+ curl_setopt($c, CURLOPT_POST, 1);
29
+ curl_setopt($c, CURLOPT_POSTFIELDS, $params.'&token_auth='.self::$settings->getGlobalOption('piwik_token'));
30
+ curl_setopt($c, CURLOPT_SSL_VERIFYPEER, !self::$settings->getGlobalOption('disable_ssl_verify'));
31
+ curl_setopt($c, CURLOPT_USERAGENT, self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string'));
32
+ curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
33
+ curl_setopt($c, CURLOPT_HEADER, $GLOBALS ['wp-piwik_debug'] );
34
+ curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout'));
35
+ $httpProxyClass = new \WP_HTTP_Proxy();
36
+ if ($httpProxyClass->is_enabled() && $httpProxyClass->send_through_proxy($strURL)) {
37
+ curl_setopt($c, CURLOPT_PROXY, $httpProxyClass->host());
38
+ curl_setopt($c, CURLOPT_PROXYPORT, $httpProxyClass->port());
39
+ if ($httpProxyClass->use_authentication())
40
+ curl_setopt($c, CURLOPT_PROXYUSERPWD, $httpProxyClass->username().':'.$httpProxyClass->password());
41
+ }
42
+ $result = curl_exec($c);
43
+ if ($GLOBALS ['wp-piwik_debug']) {
44
+ $header_size = curl_getinfo($c, CURLINFO_HEADER_SIZE);
45
+ $header = substr($result, 0, $header_size);
46
+ $body = substr($result, $header_size);
47
+ $result = $this->unserialize($body);
48
+ array_unshift($result[0], $header);
49
+ array_unshift($result[0], $url.'?'.$params.'&token_auth=...');
50
+ } else $result = $this->unserialize($result);
51
+ curl_close($c);
52
+ return $result;
53
+ }
54
+
55
+ private function fopen($url, $params) {
56
+ $context = stream_context_create(array('http'=>array('timeout' => self::$settings->getGlobalOption('connection_timeout'))));
57
+ $fullUrl = $url.'?'.$params.'&token_auth='.self::$settings->getGlobalOption('piwik_token');
58
+ $result = $this->unserialize(@file_get_contents($fullUrl, false, $context));
59
+ if ($GLOBALS ['wp-piwik_debug']) {
60
+ $header = get_headers($fullUrl, 1);
61
+ array_unshift($result[0], $header);
62
+ array_unshift($result[0], $url.'?'.$params.'&token_auth=...');
63
+ }
64
+ return $result;
65
+ }
66
+ }
classes/WP_Piwik/Settings.php ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik;
4
+
5
+ /**
6
+ * Manage WP-Piwik settings
7
+ *
8
+ * @author Andr&eacute; Br&auml;kling
9
+ * @package WP_Piwik
10
+ */
11
+ class Settings {
12
+
13
+ /**
14
+ *
15
+ * @var Environment variables and default settings container
16
+ */
17
+ private static $wpPiwik, $defaultSettings;
18
+
19
+ /**
20
+ *
21
+ * @var Define callback functions for changed settings
22
+ */
23
+ private $checkSettings = array (
24
+ 'piwik_url' => 'checkPiwikUrl',
25
+ 'piwik_token' => 'checkPiwikToken',
26
+ 'tracking_code' => 'prepareTrackingCode',
27
+ 'noscript_code' => 'prepareNocscriptCode'
28
+ );
29
+
30
+ /**
31
+ *
32
+ * @var Register default configuration set
33
+ */
34
+ private $globalSettings = array (
35
+ // Plugin settings
36
+ 'revision' => 0,
37
+ 'last_settings_update' => 0,
38
+ // User settings: Piwik configuration
39
+ 'piwik_mode' => 'http',
40
+ 'piwik_url' => '',
41
+ 'piwik_path' => '',
42
+ 'piwik_user' => '',
43
+ 'piwik_token' => '',
44
+ 'auto_site_config' => true,
45
+ // User settings: Stats configuration
46
+ 'default_date' => 'yesterday',
47
+ 'stats_seo' => false,
48
+ 'dashboard_widget' => false,
49
+ 'dashboard_chart' => false,
50
+ 'dashboard_seo' => false,
51
+ 'toolbar' => false,
52
+ 'capability_read_stats' => array (
53
+ 'administrator' => true
54
+ ),
55
+ 'perpost_stats' => false,
56
+ 'plugin_display_name' => 'WP-Piwik',
57
+ 'piwik_shortcut' => false,
58
+ 'shortcodes' => false,
59
+ // User settings: Tracking configuration
60
+ 'track_mode' => 'disabled',
61
+ 'track_codeposition' => 'footer',
62
+ 'track_noscript' => false,
63
+ 'track_nojavascript' => false,
64
+ 'proxy_url' => '',
65
+ 'track_content' => 'disabled',
66
+ 'track_search' => false,
67
+ 'track_404' => false,
68
+ 'add_post_annotations' => false,
69
+ 'add_customvars_box' => false,
70
+ 'add_download_extensions' => '',
71
+ 'disable_cookies' => false,
72
+ 'limit_cookies' => false,
73
+ 'limit_cookies_visitor' => 34186669, // Piwik default 13 months
74
+ 'limit_cookies_session' => 1800, // Piwik default 30 minutes
75
+ 'limit_cookies_referral' => 15778463, // Piwik default 6 months
76
+ 'track_admin' => false,
77
+ 'capability_stealth' => array (),
78
+ 'track_across' => false,
79
+ 'track_across_alias' => false,
80
+ 'track_feed' => false,
81
+ 'track_feed_addcampaign' => false,
82
+ 'track_feed_campaign' => 'feed',
83
+ // User settings: Expert configuration
84
+ 'cache' => true,
85
+ 'disable_timelimit' => false,
86
+ 'connection_timeout' => 5,
87
+ 'disable_ssl_verify' => false,
88
+ 'piwik_useragent' => 'php',
89
+ 'piwik_useragent_string' => 'WP-Piwik',
90
+ 'track_datacfasync' => false,
91
+ 'track_cdnurl' => '',
92
+ 'track_cdnurlssl' => '',
93
+ 'force_protocol' => 'disabled'
94
+ ), $settings = array (
95
+ 'name' => '',
96
+ 'site_id' => NULL,
97
+ 'noscript_code' => '',
98
+ 'tracking_code' => '',
99
+ 'last_tracking_code_update' => 0,
100
+ 'dashboard_revision' => 0
101
+ ), $settingsChanged = false;
102
+
103
+ /**
104
+ * Constructor class to prepare settings manager
105
+ *
106
+ * @param WP_Piwik $wpPiwik
107
+ * active WP-Piwik instance
108
+ */
109
+ public function __construct($wpPiwik) {
110
+ self::$wpPiwik = $wpPiwik;
111
+ self::$wpPiwik->log ( 'Store default settings' );
112
+ self::$defaultSettings = array (
113
+ 'globalSettings' => $this->globalSettings,
114
+ 'settings' => $this->settings
115
+ );
116
+ self::$wpPiwik->log ( 'Load settings' );
117
+ foreach ( $this->globalSettings as $key => $default ) {
118
+ $this->globalSettings [$key] = ($this->checkNetworkActivation () ? get_site_option ( 'wp-piwik_global-' . $key, $default ) : get_option ( 'wp-piwik_global-' . $key, $default ));
119
+ }
120
+ foreach ( $this->settings as $key => $default )
121
+ $this->settings [$key] = get_option ( 'wp-piwik-' . $key, $default );
122
+ }
123
+
124
+ /**
125
+ * Save all settings as WordPress options
126
+ */
127
+ public function save() {
128
+ if (! $this->settingsChanged) {
129
+ self::$wpPiwik->log ( 'No settings changed yet' );
130
+ return;
131
+ }
132
+ self::$wpPiwik->log ( 'Save settings' );
133
+ foreach ( $this->globalSettings as $key => $value ) {
134
+ if (is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' ))
135
+ update_site_option ( 'wp-piwik_global-' . $key, $value );
136
+ else
137
+ update_option ( 'wp-piwik_global-' . $key, $value );
138
+ }
139
+ foreach ( $this->settings as $key => $value ) {
140
+ update_option ( 'wp-piwik-' . $key, $value );
141
+ }
142
+ global $wp_roles;
143
+ if (! is_object ( $wp_roles ))
144
+ $wp_roles = new \WP_Roles ();
145
+ if (! is_object ( $wp_roles ))
146
+ die ( "STILL NO OBJECT" );
147
+ foreach ( $wp_roles->role_names as $strKey => $strName ) {
148
+ $objRole = get_role ( $strKey );
149
+ foreach ( array (
150
+ 'stealth',
151
+ 'read_stats'
152
+ ) as $strCap ) {
153
+ $aryCaps = $this->getGlobalOption ( 'capability_' . $strCap );
154
+ if (isset ( $aryCaps [$strKey] ) && $aryCaps [$strKey])
155
+ $objRole->add_cap ( 'wp-piwik_' . $strCap );
156
+ else
157
+ $objRole->remove_cap ( 'wp-piwik_' . $strCap );
158
+ }
159
+ }
160
+ $this->settingsChanged = false;
161
+ }
162
+
163
+ /**
164
+ * Get a global option's value
165
+ *
166
+ * @param string $key
167
+ * option key
168
+ * @return string option value
169
+ */
170
+ public function getGlobalOption($key) {
171
+ return isset ( $this->globalSettings [$key] ) ? $this->globalSettings [$key] : self::$defaultSettings ['globalSettings'] [$key];
172
+ }
173
+
174
+ /**
175
+ * Get an option's value related to a specific blog
176
+ *
177
+ * @param string $key
178
+ * option key
179
+ * @param int $blogID
180
+ * blog ID (default: current blog)
181
+ * @return \WP_Piwik\Register
182
+ */
183
+ public function getOption($key, $blogID = null) {
184
+ if ($this->checkNetworkActivation () && ! empty ( $blogID )) {
185
+ return get_blog_option ( $blogID, $key );
186
+ }
187
+ return isset ( $this->settings [$key] ) ? $this->settings [$key] : self::$defaultSettings ['settings'] [$key];
188
+ }
189
+
190
+ /**
191
+ * Set a global option's value
192
+ *
193
+ * @param string $key
194
+ * option key
195
+ * @param string $value
196
+ * new option value
197
+ */
198
+ public function setGlobalOption($key, $value) {
199
+ $this->settingsChanged = true;
200
+ self::$wpPiwik->log ( 'Changed global option ' . $key . ': ' . (is_array ( $value ) ? serialize ( $value ) : $value) );
201
+ $this->globalSettings [$key] = $value;
202
+ }
203
+
204
+ /**
205
+ * Set an option's value related to a specific blog
206
+ *
207
+ * @param string $key
208
+ * option key
209
+ * @param int $blogID
210
+ * blog ID (default: current blog)
211
+ * @param string $value
212
+ * new option value
213
+ */
214
+ public function setOption($key, $value, $blogID = null) {
215
+ $this->settingsChanged = true;
216
+ self::$wpPiwik->log ( 'Changed option ' . $key . ': ' . $value );
217
+ if ($this->checkNetworkActivation () && ! empty ( $blogID )) {
218
+ add_blog_option ( $blogID, $key, $value );
219
+ } else
220
+ $this->settings [$key] = $value;
221
+ }
222
+
223
+ /**
224
+ * Reset settings to default
225
+ *
226
+ * @param bool $resetAll
227
+ * set to true to clear authentification settings, too
228
+ */
229
+ public function resetSettings($resetAll = false) {
230
+ self::$wpPiwik->log ( 'Reset WP-Piwik settings' );
231
+ global $wpdb;
232
+ $keepSettings = array (
233
+ 'piwik_token' => $this->getGlobalOption ( 'piwik_token' ),
234
+ 'piwik_url' => $this->getGlobalOption ( 'piwik_url' ),
235
+ 'piwik_path' => $this->getGlobalOption ( 'piwik_path' ),
236
+ 'piwik_mode' => $this->getGlobalOption ( 'piwik_mode' )
237
+ );
238
+ if (is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' )) {
239
+ delete_site_option ( 'wp-piwik_global-settings' );
240
+ $blogs = $wpdb->get_results ( 'SELECT blog_id FROM ' . $wpdb->blogs . ' ORDER BY blog_id' );
241
+ foreach ( $blogs as $blog )
242
+ foreach ( $this->settings as $key => $value )
243
+ delete_blog_option ( $blog->blog_id, 'wp-piwik-' . $key );
244
+ if (! $resetAll)
245
+ update_site_option ( 'wp-piwik_global-settings', $keepSettings );
246
+ } else {
247
+ foreach ( $this->globalSettings as $key => $value )
248
+ delete_option ( 'wp-piwik_global-' . $key );
249
+ foreach ( $this->settings as $key => $value )
250
+ delete_option ( 'wp-piwik-' . $key );
251
+ }
252
+ $this->globalSettings = self::$defaultSettings ['globalSettings'];
253
+ $this->settings = self::$defaultSettings ['settings'];
254
+ if (! $resetAll) {
255
+ self::$wpPiwik->log ( 'Restore connection settings' );
256
+ foreach ( $keepSettings as $key => $value )
257
+ $this->setGlobalOption ( $key, $value );
258
+ }
259
+ $this->save ();
260
+ }
261
+
262
+ /**
263
+ * Check if plugin is network activated
264
+ *
265
+ * @return boolean Is network activated?
266
+ */
267
+ public function checkNetworkActivation() {
268
+ if (! function_exists ( "is_plugin_active_for_network" ))
269
+ require_once (ABSPATH . 'wp-admin/includes/plugin.php');
270
+ return is_plugin_active_for_network ( 'wp-piwik/wp-piwik.php' );
271
+ }
272
+
273
+ /**
274
+ * Apply new configuration
275
+ *
276
+ * @param array $in
277
+ * new configuration set
278
+ */
279
+ public function applyChanges($in) {
280
+ $in = $this->checkSettings ( $in );
281
+ self::$wpPiwik->log ( 'Apply changed settings:' );
282
+ foreach ( self::$defaultSettings ['globalSettings'] as $key => $val )
283
+ $this->setGlobalOption ( $key, isset ( $in [$key] ) ? $in [$key] : $val );
284
+ foreach ( self::$defaultSettings ['settings'] as $key => $val )
285
+ $this->setOption ( $key, isset ( $in [$key] ) ? $in [$key] : $val );
286
+ $this->setGlobalOption ( 'last_settings_update', time () );
287
+ $this->save ();
288
+ }
289
+
290
+ /**
291
+ * Apply callback function on new settings
292
+ *
293
+ * @param array $in
294
+ * new configuration set
295
+ * @return array configuration set after callback functions were applied
296
+ */
297
+ private function checkSettings($in) {
298
+ foreach ( $this->checkSettings as $key => $value )
299
+ if (isset ( $in [$key] ))
300
+ $in [$key] = call_user_func_array ( array (
301
+ $this,
302
+ $value
303
+ ), array (
304
+ $in [$key],
305
+ $in
306
+ ) );
307
+ return $in;
308
+ }
309
+
310
+ /**
311
+ * Add slash to Piwik URL if necessary
312
+ *
313
+ * @param string $value
314
+ * Piwik URL
315
+ * @param array $in
316
+ * configuration set
317
+ * @return string Piwik URL
318
+ */
319
+ private function checkPiwikUrl($value, $in) {
320
+ return substr ( $value, - 1, 1 ) != '/' ? $value . '/' : $value;
321
+ }
322
+
323
+ /**
324
+ * Remove &amp;token_auth= from auth token
325
+ *
326
+ * @param string $value
327
+ * Piwik auth token
328
+ * @param array $in
329
+ * configuration set
330
+ * @return string Piwik auth token
331
+ */
332
+ private function checkPiwikToken($value, $in) {
333
+ return str_replace ( '&token_auth=', '', $value );
334
+ }
335
+
336
+ /**
337
+ * Prepare the tracking code
338
+ *
339
+ * @param string $value
340
+ * tracking code
341
+ * @param array $in
342
+ * configuration set
343
+ * @return string tracking code
344
+ */
345
+ private function prepareTrackingCode($value, $in) {
346
+ if ($in ['track_mode'] == 'manually' || $in ['track_mode'] == 'disabled') {
347
+ $value = stripslashes ( $value );
348
+ if ($this->checkNetworkActivation ())
349
+ add_site_option ( 'wp-piwik-manually', $value );
350
+ return $value;
351
+ }
352
+ $result = self::$wpPiwik->updateTrackingCode ();
353
+ $this->setOption ( 'noscript_code', $result ['noscript'] );
354
+ return $result ['script'];
355
+ }
356
+
357
+ /**
358
+ * Prepare the nocscript code
359
+ *
360
+ * @param string $value
361
+ * noscript code
362
+ * @param array $in
363
+ * configuration set
364
+ * @return string noscript code
365
+ */
366
+ private function prepareNocscriptCode($value, $in) {
367
+ if ($in ['track_mode'] == 'manually')
368
+ return stripslashes ( $value );
369
+ return $value;
370
+ }
371
+ }
classes/WP_Piwik/Shortcode.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik;
4
+
5
+ class Shortcode {
6
+
7
+ private $available = array(
8
+ 'opt-out' => 'OptOut',
9
+ 'post' => 'Post',
10
+ 'overview' => 'Overview'
11
+ );
12
+
13
+ public function __construct($attributes, $wpPiwik, $settings) {
14
+ $wpPiwik->log('Check requested shortcode widget '.$attributes['module']);
15
+ if (isset($attributes['module']) && isset($this->available[$attributes['module']])) {
16
+ $wpPiwik->log('Add shortcode widget '.$this->available[$attributes['module']]);
17
+ $class = '\\WP_Piwik\\Widget\\'.$this->available[$attributes['module']];
18
+ $widget = new $class($wpPiwik, $settings, null, null, null, $attributes, true);
19
+ $widget->show();
20
+ }
21
+ }
22
+
23
+ }
classes/{WP_Piwik_Template.php → WP_Piwik/Template.php} RENAMED
@@ -1,13 +1,14 @@
1
  <?php
2
 
3
- class WP_Piwik_Template {
 
 
4
 
5
  public static $logger, $settings, $wpPiwik;
6
 
7
- public function __construct($config) {
8
- self::$logger = $config['logger'];
9
- self::$settings = $config['settings'];
10
- self::$wpPiwik = $config['wp_piwik'];
11
  }
12
 
13
  public function output($array, $key, $default = '') {
@@ -26,7 +27,5 @@
26
  $end = time() + $diff;
27
  $start = time() - 2592000 + $diff;
28
  return date('Y-m-d', $start).','.date('Y-m-d', $end);
29
-
30
  }
31
-
32
  }
1
  <?php
2
 
3
+ namespace WP_Piwik;
4
+
5
+ class Template {
6
 
7
  public static $logger, $settings, $wpPiwik;
8
 
9
+ public function __construct($wpPiwik, $settings) {
10
+ self::$settings = $settings;
11
+ self::$wpPiwik = $wpPiwik;
 
12
  }
13
 
14
  public function output($array, $key, $default = '') {
27
  $end = time() + $diff;
28
  $start = time() - 2592000 + $diff;
29
  return date('Y-m-d', $start).','.date('Y-m-d', $end);
 
30
  }
 
31
  }
classes/WP_Piwik/Template/MetaBoxCustomVars.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Template;
4
+
5
+ class MetaBoxCustomVars extends \WP_Piwik\Template {
6
+
7
+ public function addMetabox() {
8
+ add_meta_box(
9
+ 'wp-piwik_post_customvars',
10
+ __('Piwik Custom Variables', 'wp-piwik'),
11
+ array(&$this, 'showCustomvars'),
12
+ 'post',
13
+ 'side',
14
+ 'default'
15
+ );
16
+ }
17
+
18
+ public function showCustomvars($objPost, $objBox ) {
19
+ wp_nonce_field(basename( __FILE__ ), 'wp-piwik_post_customvars_nonce'); ?>
20
+ <table>
21
+ <tr><th></th><th><?php _e('Name', 'wp-piwik'); ?></th><th><?php _e('Value', 'wp-piwik'); ?></th></tr>
22
+ <?php for($i = 1; $i <= 5; $i++) { ?>
23
+ <tr>
24
+ <th><label for="wp-piwik_customvar1"><?php echo $i; ?>: </label></th>
25
+ <td><input class="widefat" type="text" name="wp-piwik_custom_cat<?php echo $i; ?>" value="<?php echo esc_attr(get_post_meta($objPost->ID, 'wp-piwik_custom_cat'.$i, true ) ); ?>" size="200" /></td>
26
+ <td><input class="widefat" type="text" name="wp-piwik_custom_val<?php echo $i; ?>" value="<?php echo esc_attr(get_post_meta($objPost->ID, 'wp-piwik_custom_val'.$i, true ) ); ?>" size="200" /></td>
27
+ </tr>
28
+ <?php } ?>
29
+ </table>
30
+ <p><?php _e('Set custom variables for a page view', 'wp-piwik'); ?>. (<a href="http://piwik.org/docs/custom-variables/"><?php _e('More information', 'wp-piwik'); ?></a>.)</p>
31
+ <?php
32
+ }
33
+
34
+ public function saveCustomVars($intID, $objPost) {
35
+ // Verify the nonce before proceeding.
36
+ if (!isset( $_POST['wp-piwik_post_customvars_nonce'] ) || !wp_verify_nonce( $_POST['wp-piwik_post_customvars_nonce'], basename( __FILE__ ) ) )
37
+ return $intID;
38
+ // Get post type object
39
+ $objPostType = get_post_type_object($objPost->post_type);
40
+ // Check if the current user has permission to edit the post.
41
+ if (!current_user_can($objPostType->cap->edit_post, $intID))
42
+ return $intID;
43
+ $aryNames = array('cat', 'val');
44
+ for ($i = 1; $i <= 5; $i++)
45
+ for ($j = 0; $j <= 1; $j++) {
46
+ // Get data
47
+ $strMetaVal = (isset($_POST['wp-piwik_custom_'.$aryNames[$j].$i])?htmlentities($_POST['wp-piwik_custom_'.$aryNames[$j].$i]):'');
48
+ // Create key
49
+ $strMetaKey = 'wp-piwik_custom_'.$aryNames[$j].$i;
50
+ // Get the meta value of the custom field key
51
+ $strCurVal = get_post_meta($intID, $strMetaKey, true);
52
+ // Add meta val:
53
+ if ($strMetaVal && '' == $strCurVal)
54
+ add_post_meta($intID, $strMetaKey, $strMetaVal, true);
55
+ // Update meta val:
56
+ elseif ($strMetaVal && $strMetaVal != $strCurVal)
57
+ update_post_meta($intID, $strMetaKey, $strMetaVal);
58
+ // Delete meta val:
59
+ elseif (''==$strMetaVal && $strCurVal)
60
+ delete_post_meta($intID, $strMetaKey, $strCurVal);
61
+ }
62
+ }
63
+ }
classes/WP_Piwik/TrackingCode.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik;
4
+
5
+ class TrackingCode {
6
+
7
+ private static $wpPiwik, $piwikUrl = false;
8
+ private $trackingCode;
9
+
10
+ public $is404 = false, $isSearch = false;
11
+
12
+ public function __construct($wpPiwik) {
13
+ self::$wpPiwik = $wpPiwik;
14
+ if ( !self::$wpPiwik->isCurrentTrackingCode() || !self::$wpPiwik->getOption('tracking_code') )
15
+ self::$wpPiwik->updateTrackingCode();
16
+ $this->trackingCode = ( self::$wpPiwik->isNetworkMode() && self::$wpPiwik->getGlobalOption('track_mode') == 'manually' ) ? get_site_option( 'wp-piwik-manually' ) : self::$wpPiwik->getOption('tracking_code');
17
+ }
18
+
19
+ public function getTrackingCode() {
20
+ if ($this->is404) $this->apply404Changes();
21
+ if ($this->isSearch) $this->applySearchChanges();
22
+ if (is_single()) $this->addCustomValues();
23
+ return $this->trackingCode;
24
+ }
25
+
26
+ public static function prepareTrackingCode($code, $settings, $logger) {
27
+ $logger->log('Apply tracking code changes:');
28
+ $settings->setOption('last_tracking_code_update', time());
29
+ if ($settings->getGlobalOption('track_mode') == 'js')
30
+ $code = str_replace(array('piwik.js', 'piwik.php'), 'js/index.php', $code);
31
+ elseif ($settings->getGlobalOption('track_mode') == 'proxy') {
32
+ $code = str_replace('piwik.js', 'piwik.php', $code);
33
+ $proxy = str_replace(array('https://', 'http://'), '//', plugins_url('wp-piwik').'/proxy').'/';
34
+ if ( preg_match('/var u="([^"]*)";/', $code, $hits) ) {
35
+ $settings->setGlobalOption('proxy_url', $hits[1]);
36
+ }
37
+ $code = preg_replace('/var u="([^"]*)";/','var u="'.$proxy.'"',$code);
38
+ $code = preg_replace('/img src="([^"]*)piwik.php/','img src="'.$proxy.'piwik.php',$code);
39
+ }
40
+ if ($settings->getGlobalOption('track_cdnurl') || $settings->getGlobalOption('track_cdnurlssl'))
41
+ $code = str_replace(array("var d=doc","g.src=u+"), array("var ucdn=(('https:' == document.location.protocol) ? 'https://".($settings->getGlobalOption('track_cdnurlssl')?$settings->getGlobalOption('track_cdnurlssl'):$settings->getGlobalOption('track_cdnurl'))."/' : 'http://".($settings->getGlobalOption('track_cdnurl')?$settings->getGlobalOption('track_cdnurl'):$settings->getGlobalOption('track_cdnurlssl'))."/');\nvar d=doc", "g.src=ucdn+"), $code);
42
+
43
+ if ($settings->getGlobalOption('track_datacfasync'))
44
+ $code = str_replace('<script type', '<script data-cfasync="false" type', $code);
45
+ if ($settings->getGlobalOption('add_download_extensions'))
46
+ $code = str_replace("_paq.push(['trackPageView']);", "_paq.push(['addDownloadExtensions', '".($settings->getGlobalOption('add_download_extensions'))."']);\n_paq.push(['trackPageView']);", $code);
47
+ if ($settings->getGlobalOption('limit_cookies'))
48
+ $code = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '".$settings->getGlobalOption('limit_cookies_visitor')."']);\n_paq.push(['setSessionCookieTimeout', '".$settings->getGlobalOption('limit_cookies_session')."']);\n_paq.push(['setReferralCookieTimeout', '".$settings->getGlobalOption('limit_cookies_referral')."']);\n_paq.push(['trackPageView']);", $code);
49
+ if ($settings->getGlobalOption('force_protocol') != 'disabled')
50
+ $code = str_replace('"//', '"'.$settings->getGlobalOption('force_protocol').'://', $code);
51
+ if ($settings->getGlobalOption('track_content') == 'all')
52
+ $code = str_replace("_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackAllContentImpressions']);", $code);
53
+ elseif ($settings->getGlobalOption('track_content') == 'visible')
54
+ $code = str_replace("_paq.push(['trackPageView']);", "_paq.push(['trackPageView']);\n_paq.push(['trackVisibleContentImpressions']);", $code);
55
+
56
+ if ($settings->getGlobalOption('piwik_mode') == 'pro')
57
+ $code = str_replace('.piwik.pro', '.piwikpro.com', $code);
58
+
59
+ $noScript = array();
60
+ preg_match('/<noscript>(.*)<\/noscript>/', $code, $noScript);
61
+ if (isset($noScript[0])) {
62
+ if ($settings->getGlobalOption('track_nojavascript'))
63
+ $noScript[0] = str_replace('?idsite', '?rec=1&idsite', $noScript[0]);
64
+ $noScript = $noScript[0];
65
+ } else $noScript = '';
66
+ $script = preg_replace('/<noscript>(.*)<\/noscript>/', '', $code);
67
+ $script = preg_replace('/\s+(\r\n|\r|\n)/', '$1', $script);
68
+ $logger->log('Finished tracking code: '.$script);
69
+ $logger->log('Finished noscript code: '.$noScript);
70
+ return array('script' => $script, 'noscript' => $noScript);
71
+ }
72
+
73
+ private function apply404Changes() {
74
+ self::$wpPiwik->log('Apply 404 changes. Blog ID: '.get_current_blog_id().' Site ID: '.self::$wpPiwik->getOption('site_id'));
75
+ $this->trackingCode = str_replace(
76
+ "_paq.push(['trackPageView']);",
77
+ "_paq.push(['setDocumentTitle', '404/URL = '+String(document.location.pathname+document.location.search).replace(/\//g,'%2f') + '/From = ' + String(document.referrer).replace(/\//g,'%2f')]);\n_paq.push(['trackPageView']);",
78
+ $this->trackingCode
79
+ );
80
+ }
81
+
82
+ private function applySearchChanges() {
83
+ self::$wpPiwik->log('Apply search tracking changes. Blog ID: '.get_current_blog_id().' Site ID: '.self::$wpPiwik->getOption('site_id'));
84
+ $objSearch = new \WP_Query("s=" . get_search_query() . '&showposts=-1');
85
+ $intResultCount = $objSearch->post_count;
86
+ $this->trackingCode = str_replace(
87
+ "_paq.push(['trackPageView']);",
88
+ "_paq.push(['trackSiteSearch','".get_search_query()."', false, ".$intResultCount."]);\n_paq.push(['trackPageView']);",
89
+ $this->trackingCode
90
+ );
91
+ }
92
+
93
+ private function addCustomValues() {
94
+ $customVars = '';
95
+ for ($i = 1; $i <= 5; $i++) {
96
+ $postId = get_the_ID();
97
+ $metaKey = get_post_meta($postId, 'wp-piwik_custom_cat'.$i, true);
98
+ $metaVal = get_post_meta($postId, 'wp-piwik_custom_val'.$i, true);
99
+ if (!empty($metaKey) && !empty($metaVal))
100
+ $customVars .= "_paq.push(['setCustomVariable',".$i.", '".$metaKey."', '".$metaVal."', 'page']);\n";
101
+ }
102
+ if (!empty($customVars))
103
+ $this->trackingCode = str_replace(
104
+ "_paq.push(['trackPageView']);",
105
+ $customVars."_paq.push(['trackPageView']);",
106
+ $this->trackingCode
107
+ );
108
+ }
109
+ }
classes/WP_Piwik/Widget.php ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik;
4
+
5
+ /**
6
+ * Abstract widget class
7
+ *
8
+ * @author Andr&eacute; Br&auml;kling
9
+ * @package WP_Piwik
10
+ */
11
+ abstract class Widget {
12
+
13
+ /**
14
+ *
15
+ * @var Environment variables
16
+ */
17
+ protected static $wpPiwik, $settings;
18
+
19
+ /**
20
+ *
21
+ * @var Configuration parameters
22
+ */
23
+ protected $isShortcode = false, $method = '', $title = '', $context = 'side', $priority = 'core', $parameter = array (), $apiID = array (), $pageId = 'dashboard', $blogId = null, $name = 'Value', $limit = 10;
24
+
25
+ /**
26
+ * Widget constructor
27
+ *
28
+ * @param WP_Piwik $wpPiwik
29
+ * current WP-Piwik object
30
+ * @param WP_Piwik\Settings $settings
31
+ * current WP-Piwik settings
32
+ * @param string $pageId
33
+ * WordPress page ID (default: dashboard)
34
+ * @param string $context
35
+ * WordPress meta box context (defualt: side)
36
+ * @param string $priority
37
+ * WordPress meta box priority (default: default)
38
+ * @param array $params
39
+ * widget parameters (default: empty array)
40
+ * @param boolean $isShortcode
41
+ * is the widget shown inline? (default: false)
42
+ */
43
+ public function __construct($wpPiwik, $settings, $pageId = 'dashboard', $context = 'side', $priority = 'default', $params = array(), $isShortcode = false) {
44
+ self::$wpPiwik = $wpPiwik;
45
+ self::$settings = $settings;
46
+ $this->pageId = $pageId;
47
+ $this->context = $context;
48
+ $this->priority = $priority;
49
+ if (self::$settings->checkNetworkActivation () && function_exists ( 'is_super_admin' ) && is_super_admin () && isset ( $_GET ['wpmu_show_stats'] )) {
50
+ switch_to_blog ( ( int ) $_GET ['wpmu_show_stats'] );
51
+ $this->blogId = get_current_blog_id ();
52
+ restore_current_blog ();
53
+ }
54
+ $this->isShortcode = $isShortcode;
55
+ $prefix = ($this->pageId == 'dashboard' ? self::$settings->getGlobalOption ( 'plugin_display_name' ) . ' - ' : '');
56
+ $this->configure ( $prefix, $params );
57
+ if (is_array ( $this->method ))
58
+ foreach ( $this->method as $method ) {
59
+ $this->apiID [$method] = \WP_Piwik\Request::register ( $method, $this->parameter );
60
+ self::$wpPiwik->log ( "Register request: " . $this->apiID [$method] );
61
+ }
62
+ else {
63
+ $this->apiID [$this->method] = \WP_Piwik\Request::register ( $this->method, $this->parameter );
64
+ self::$wpPiwik->log ( "Register request: " . $this->apiID [$this->method] );
65
+ }
66
+ if ($this->isShortcode)
67
+ return;
68
+ add_meta_box ( $this->getName (), $this->title, array (
69
+ $this,
70
+ 'show'
71
+ ), $pageId, $this->context, $this->priority );
72
+ }
73
+
74
+ /**
75
+ * Conifguration dummy method
76
+ *
77
+ * @param string $prefix
78
+ * metabox title prefix (default: empty)
79
+ * @param array $params
80
+ * widget parameters (default: empty array)
81
+ */
82
+ protected function configure($prefix = '', $params = array()) {
83
+ }
84
+
85
+ /**
86
+ * Default show widget method, handles default Piwik output
87
+ */
88
+ public function show() {
89
+ $response = self::$wpPiwik->request ( $this->apiID [$this->method] );
90
+ if (! empty ( $response ['result'] ) && $response ['result'] = 'error')
91
+ echo '<strong>' . __ ( 'Piwik error', 'wp-piwik' ) . ':</strong> ' . htmlentities ( $response ['message'], ENT_QUOTES, 'utf-8' );
92
+ else {
93
+ if (isset ( $response [0] ['nb_uniq_visitors'] ))
94
+ $unique = 'nb_uniq_visitors';
95
+ else
96
+ $unique = 'sum_daily_nb_uniq_visitors';
97
+ $tableHead = array (
98
+ 'label' => __ ( $this->name, 'wp-piwik' )
99
+ );
100
+ $tableHead [$unique] = __ ( 'Unique', 'wp-piwik' );
101
+ if (isset ( $response [0] ['nb_visits'] ))
102
+ $tableHead ['nb_visits'] = __ ( 'Visits', 'wp-piwik' );
103
+ if (isset ( $response [0] ['nb_hits'] ))
104
+ $tableHead ['nb_hits'] = __ ( 'Hits', 'wp-piwik' );
105
+ if (isset ( $response [0] ['nb_actions'] ))
106
+ $tableHead ['nb_actions'] = __ ( 'Actions', 'wp-piwik' );
107
+ $tableBody = array ();
108
+ $count = 0;
109
+ foreach ( $response as $rowKey => $row ) {
110
+ $count ++;
111
+ $tableBody [$rowKey] = array ();
112
+ foreach ( $tableHead as $key => $value )
113
+ $tableBody [$rowKey] [] = isset ( $row [$key] ) ? $row [$key] : '-';
114
+ if ($count == 10)
115
+ break;
116
+ }
117
+ $this->table ( $tableHead, $tableBody, null );
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Display a HTML table
123
+ *
124
+ * @param array $thead
125
+ * table header content (array of cells)
126
+ * @param array $tbody
127
+ * table body content (array of rows)
128
+ * @param array $tfoot
129
+ * table footer content (array of cells)
130
+ * @param string $class
131
+ * CSSclass name to apply on table sections
132
+ * @param string $javaScript
133
+ * array of javascript code to apply on body rows
134
+ */
135
+ protected function table($thead, $tbody = array(), $tfoot = array(), $class = false, $javaScript = array()) {
136
+ echo '<div class="table"><table class="widefat wp-piwik-table">';
137
+ if ($this->isShortcode && $this->title)
138
+ echo '<tr><th colspan="10">' . $this->title . '</th></tr>';
139
+ if (! empty ( $thead ))
140
+ $this->tabHead ( $thead, $class );
141
+ if (! empty ( $tbody ))
142
+ $this->tabBody ( $tbody, $class, $javaScript );
143
+ else
144
+ echo '<tr><td colspan="10">' . __ ( 'No data available.', 'wp-piwik' ) . '</td></tr>';
145
+ if (! empty ( $tfoot ))
146
+ $this->tabFoot ( $tfoot, $class );
147
+ echo '</table></div>';
148
+ }
149
+
150
+ /**
151
+ * Display a HTML table header
152
+ *
153
+ * @param array $thead
154
+ * array of cells
155
+ * @param string $class
156
+ * CSS class to apply
157
+ */
158
+ private function tabHead($thead, $class = false) {
159
+ echo '<thead' . ($class ? ' class="' . $class . '"' : '') . '><tr>';
160
+ $count = 0;
161
+ foreach ( $thead as $value )
162
+ echo '<th' . ($count ++ ? ' class="right"' : '') . '>' . $value . '</th>';
163
+ echo '</tr></thead>';
164
+ }
165
+
166
+ /**
167
+ * Display a HTML table body
168
+ *
169
+ * @param array $tbody
170
+ * array of rows, each row containing an array of cells
171
+ * @param string $class
172
+ * CSS class to apply
173
+ * @param unknown $javaScript
174
+ * array of javascript code to apply (one item per row)
175
+ */
176
+ private function tabBody($tbody, $class = false, $javaScript = array()) {
177
+ echo '<tbody' . ($class ? ' class="' . $class . '"' : '') . '>';
178
+ foreach ( $tbody as $key => $trow )
179
+ $this->tabRow ( $trow, isset( $javaScript [$key] ) ?$javaScript [$key] : '');
180
+ echo '</tbody>';
181
+ }
182
+
183
+ /**
184
+ * Display a HTML table footer
185
+ *
186
+ * @param array $tfoor
187
+ * array of cells
188
+ * @param string $class
189
+ * CSS class to apply
190
+ */
191
+ private function tabFoot($tfoot, $class = false) {
192
+ echo '<tfoot' . ($class ? ' class="' . $class . '"' : '') . '><tr>';
193
+ $count = 0;
194
+ foreach ( $tfoot as $value )
195
+ echo '<td' . ($count ++ ? ' class="right"' : '') . '>' . $value . '</td>';
196
+ echo '</tr></tfoot>';
197
+ }
198
+
199
+ /**
200
+ * Display a HTML table row
201
+ *
202
+ * @param array $trow
203
+ * array of cells
204
+ * @param string $javaScript
205
+ * javascript code to apply
206
+ */
207
+ private function tabRow($trow, $javaScript = '') {
208
+ echo '<tr' . (! empty ( $javaScript ) ? ' onclick="' . $javaScript . '"' : '') . '>';
209
+ $count = 0;
210
+ foreach ( $trow as $tcell )
211
+ echo '<td' . ($count ++ ? ' class="right"' : '') . '>' . $tcell . '</td>';
212
+ echo '</tr>';
213
+ }
214
+
215
+ /**
216
+ * Get the current request's Piwik time settings
217
+ *
218
+ * @return array time settings: period => Piwik period, date => requested date, description => time description to show in widget title
219
+ */
220
+ protected function getTimeSettings() {
221
+ switch (self::$settings->getGlobalOption ( 'default_date' )) {
222
+ case 'today' :
223
+ $period = 'day';
224
+ $date = 'today';
225
+ $description = 'today';
226
+ break;
227
+ case 'current_month' :
228
+ $period = 'month';
229
+ $date = 'today';
230
+ $description = 'current month';
231
+ break;
232
+ case 'last_month' :
233
+ $period = 'month';
234
+ $date = date ( "Y-m-d", strtotime ( "last day of previous month" ) );
235
+ $description = 'last month';
236
+ break;
237
+ case 'current_week' :
238
+ $period = 'week';
239
+ $date = 'today';
240
+ $description = 'current week';
241
+ break;
242
+ case 'last_week' :
243
+ $period = 'week';
244
+ $date = date ( "Y-m-d", strtotime ( "-1 week" ) );
245
+ $description = 'last week';
246
+ break;
247
+ case 'yesterday' :
248
+ $period = 'day';
249
+ $date = 'yesterday';
250
+ $description = 'yesterday';
251
+ break;
252
+ default :
253
+ break;
254
+ }
255
+ return array (
256
+ 'period' => $period,
257
+ 'date' => isset ( $_GET ['date'] ) ? ( int ) $_GET ['date'] : $date,
258
+ 'description' => isset ( $_GET ['date'] ) ? $this->dateFormat ( $_GET ['date'], $period ) : $description
259
+ );
260
+ }
261
+
262
+ /**
263
+ * Format a date to show in widget
264
+ *
265
+ * @param string $date
266
+ * date string
267
+ * @param string $period
268
+ * Piwik period
269
+ * @return string formatted date
270
+ */
271
+ protected function dateFormat($date, $period = 'day') {
272
+ $prefix = '';
273
+ switch ($period) {
274
+ case 'week' :
275
+ $prefix = __ ( 'week', 'wp-piwik' ) . ' ';
276
+ $format = 'W/Y';
277
+ break;
278
+ case 'short_week' :
279
+ $format = 'W';
280
+ break;
281
+ case 'month' :
282
+ $format = 'F Y';
283
+ $date = date ( 'Y-m-d', strtotime ( $date ) );
284
+ break;
285
+ default :
286
+ $format = get_option ( 'date_format' );
287
+ }
288
+ return $prefix . date_i18n ( $format, strtotime ( $date ) );
289
+ }
290
+
291
+ /**
292
+ * Format time to show in widget
293
+ *
294
+ * @param int $time
295
+ * time in seconds
296
+ * @return string formatted time
297
+ */
298
+ protected function timeFormat($time) {
299
+ return floor ( $time / 3600 ) . 'h ' . floor ( ($time % 3600) / 60 ) . 'm ' . floor ( ($time % 3600) % 60 ) . 's';
300
+ }
301
+
302
+ /**
303
+ * Convert Piwik range into meaningful text
304
+ *
305
+ * @return string range description
306
+ */
307
+ public function rangeName() {
308
+ switch ($this->parameter ['date']) {
309
+ case 'last30' :
310
+ return 'last 30 days';
311
+ case 'last12' :
312
+ return 'last 12 ' . $this->parameter ['period'] . 's';
313
+ default :
314
+ return $this->parameter ['date'];
315
+ }
316
+ }
317
+
318
+ /**
319
+ * Get the widget name
320
+ *
321
+ * @return string widget name
322
+ */
323
+ public function getName() {
324
+ return str_replace ( '\\', '-', get_called_class () );
325
+ }
326
+
327
+ /**
328
+ * Display a pie chart
329
+ *
330
+ * @param
331
+ * array chart data array(array(0 => name, 1 => value))
332
+ */
333
+ public function pieChart($data) {
334
+ echo '<div id="wp-piwik_stats_' . $this->getName () . '_graph" style="height:310px;width:100%"></div>';
335
+ echo '<script type="text/javascript">$plotBrowsers = $j.jqplot("wp-piwik_stats_' . $this->getName () . '_graph", [[';
336
+ $list = '';
337
+ foreach ( $data as $dataSet )
338
+ $list .= '["' . $dataSet [0] . '", ' . $dataSet [1] . '],';
339
+ echo substr ( $list, 0, - 1 );
340
+ echo ']], {seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},legend:{show:true}});</script>';
341
+ }
342
+
343
+ /**
344
+ * Return an array value by key, return '-' if not set
345
+ *
346
+ * @param array $array
347
+ * array to get a value from
348
+ * @param string $key
349
+ * key of the value to get from array
350
+ * @return string found value or '-' as a placeholder
351
+ */
352
+ protected function value($array, $key) {
353
+ return (isset ( $array [$key] ) ? $array [$key] : '-');
354
+ }
355
+ }
classes/WP_Piwik/Widget/BrowserDetails.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class BrowserDetails extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Browser Details', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'UserSettings.getBrowserVersion';
18
+ $this->context = 'normal';
19
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
20
+ wp_enqueue_script('wp-piwik-jqplot',self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
21
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion());
22
+ add_action('admin_head-index.php', array($this, 'addHeaderLines'));
23
+ }
24
+
25
+ public function addHeaderLines() {
26
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.self::$wpPiwik->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
27
+ echo '<link rel="stylesheet" href="'.self::$wpPiwik->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
28
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
29
+ }
30
+
31
+ public function show() {
32
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
33
+ $tableBody = array();
34
+ if (!empty($response['result']) && $response['result'] ='error')
35
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
36
+ else {
37
+ $tableHead = array(__('Browser', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik'));
38
+ if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors';
39
+ else $unique = 'sum_daily_nb_uniq_visitors';
40
+ $count = 0;
41
+ $sum = 0;
42
+ foreach ($response as $row) {
43
+ $count++;
44
+ $sum += isset($row[$unique])?$row[$unique]:0;
45
+ if ($count < $this->limit)
46
+ $tableBody[$row['label']] = array($row['label'], $row[$unique], 0);
47
+ elseif (!isset($tableBody['Others']))
48
+ $tableBody['Others'] = array($row['label'], $row[$unique], 0);
49
+ else
50
+ $tableBody['Others'][1] += $row[$unique];
51
+ }
52
+ if ($count > $this->limit)
53
+ $tableBody['Others'][0] = __('Others', 'wp-piwik');
54
+
55
+ foreach ($tableBody as $key => $row)
56
+ $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%';
57
+
58
+ if (!empty($tableBody)) $this->pieChart($tableBody);
59
+ $this->table($tableHead, $tableBody, null);
60
+ }
61
+ }
62
+
63
+ }
classes/WP_Piwik/Widget/Browsers.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Browsers extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Browsers', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'UserSettings.getBrowser';
18
+ $this->context = 'normal';
19
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
20
+ wp_enqueue_script('wp-piwik-jqplot',self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
21
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion());
22
+ add_action('admin_head-index.php', array($this, 'addHeaderLines'));
23
+ }
24
+
25
+ public function addHeaderLines() {
26
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.self::$wpPiwik->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
27
+ echo '<link rel="stylesheet" href="'.self::$wpPiwik->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
28
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
29
+ }
30
+
31
+ public function show() {
32
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
33
+ $tableBody = array();
34
+ if (!empty($response['result']) && $response['result'] ='error')
35
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
36
+ else {
37
+ $tableHead = array(__('Browser', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik'));
38
+ if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors';
39
+ else $unique = 'sum_daily_nb_uniq_visitors';
40
+ $count = 0;
41
+ $sum = 0;
42
+ foreach ($response as $row) {
43
+ $count++;
44
+ $sum += isset($row[$unique])?$row[$unique]:0;
45
+ if ($count < $this->limit)
46
+ $tableBody[$row['label']] = array($row['label'], $row[$unique], 0);
47
+ elseif (!isset($tableBody['Others']))
48
+ $tableBody['Others'] = array($row['label'], $row[$unique], 0);
49
+ else
50
+ $tableBody['Others'][1] += $row[$unique];
51
+ }
52
+ if ($count > $this->limit)
53
+ $tableBody['Others'][0] = __('Others', 'wp-piwik');
54
+
55
+ foreach ($tableBody as $key => $row)
56
+ $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%';
57
+
58
+ if (!empty($tableBody)) $this->pieChart($tableBody);
59
+ $this->table($tableHead, $tableBody, null);
60
+ }
61
+ }
62
+
63
+ }
classes/WP_Piwik/Widget/Chart.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Chart extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => isset($params['period'])?$params['period']:$timeSettings['period'],
14
+ 'date' => 'last'.($timeSettings['period']=='day'?'30':'12'),
15
+ 'limit' => null
16
+ );
17
+ $this->title = $prefix.__('Visitors', 'wp-piwik').' ('.__($this->rangeName(),'wp-piwik').')';
18
+ $this->method = array('VisitsSummary.getVisits', 'VisitsSummary.getUniqueVisitors', 'VisitsSummary.getBounceCount', 'VisitsSummary.getActions');
19
+ $this->context = 'normal';
20
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
21
+ wp_enqueue_script('wp-piwik-jqplot',self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
22
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion());
23
+ add_action('admin_head-index.php', array($this, 'addHeaderLines'));
24
+ }
25
+
26
+ public function addHeaderLines() {
27
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.self::$wpPiwik->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
28
+ echo '<link rel="stylesheet" href="'.self::$wpPiwik->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
29
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
30
+ }
31
+
32
+ public function show() {
33
+ $response = array();
34
+ $success = true;
35
+ foreach ($this->method as $method) {
36
+ $response[$method] = self::$wpPiwik->request($this->apiID[$method]);
37
+ if (!empty($response[$method]['result']) && $response[$method]['result'] ='error')
38
+ $success = false;
39
+ }
40
+ if (!$success)
41
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response[$method]['message'], ENT_QUOTES, 'utf-8');
42
+ else {
43
+ $values = $labels = $bounced = $unique = '';
44
+ $count = $uniqueSum = 0;
45
+ if (is_array($response['VisitsSummary.getVisits']))
46
+ foreach ($response['VisitsSummary.getVisits'] as $date => $value) {
47
+ $count++;
48
+ $values .= $value.',';
49
+ $unique .= $response['VisitsSummary.getUniqueVisitors'][$date].',';
50
+ $bounced .= $response['VisitsSummary.getBounceCount'][$date].',';
51
+ if ($this->parameter['period'] == 'week') {
52
+ preg_match("/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/", $date, $dateList);
53
+ $textKey = $this->dateFormat($dateList[0], 'short_week');
54
+ } else $textKey = substr($date, -2);
55
+ $labels .= '['.$count.',"'.$textKey.'"],';
56
+ $uniqueSum += $response['VisitsSummary.getActions'][$date];
57
+ }
58
+ else {
59
+ $values = '0,';
60
+ $labels = '[0,"-"],';
61
+ $unique = '0,';
62
+ $bounced = '0,';
63
+ }
64
+ $average = round($uniqueSum/30,0);
65
+ $values = substr($values, 0, -1);
66
+ $unique = substr($unique, 0, -1);
67
+ $labels = substr($labels, 0, -1);
68
+ $bounced = substr($bounced, 0, -1);
69
+ echo '<div id="wp-piwik_stats_vistors_graph" style="height:220px;" title="'.__('The graph contains the values shown in the table below (visitors / unique / bounces). The red line show a linear trendline (unique).', 'wp-piwik').'"></div>';
70
+ echo '<script type="text/javascript">';
71
+ echo '$j.jqplot("wp-piwik_stats_vistors_graph", [['.$values.'],['.$unique.'],['.$bounced.']],{axes:{yaxis:{min:0, tickOptions:{formatString:"%.0f"}},xaxis:{min:1,max:30,ticks:['.$labels.']}},seriesDefaults:{showMarker:false,lineWidth:1,fill:true,fillAndStroke:true,fillAlpha:0.9,trendline:{show:false,color:"#C00",lineWidth:1.5,type:"exp"}},series:[{color:"#90AAD9",fillColor:"#D4E2ED"},{color:"#A3BCEA",fillColor:"#E4F2FD",trendline:{show:true,label:"Unique visitor trend"}},{color:"#E9A0BA",fillColor:"#FDE4F2"}],});';
72
+ echo '</script>';
73
+ }
74
+ }
75
+
76
+ }
classes/WP_Piwik/Widget/Keywords.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Keywords extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Keywords', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'Referrers.getKeywords';
18
+ $this->name = 'Keyword';
19
+ }
20
+
21
+ }
classes/WP_Piwik/Widget/Noresult.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Noresult extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Site Search', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'Actions.getSiteSearchNoResultKeywords';
18
+ }
19
+
20
+ public function show() {
21
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
22
+ if (!empty($response['result']) && $response['result'] ='error')
23
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
24
+ else {
25
+ $tableHead = array(__('Keyword', 'wp-piwik'), __('Requests', 'wp-piwik'), __('Bounced', 'wp-piwik'));
26
+ $tableBody = array();
27
+ $count = 0;
28
+ foreach ($response as $row) {
29
+ $count++;
30
+ $tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']);
31
+ if ($count == 10) break;
32
+ }
33
+ $this->table($tableHead, $tableBody, null);
34
+ }
35
+ }
36
+
37
+ }
classes/WP_Piwik/Widget/OptOut.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class OptOut extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $this->parameter = $params;
11
+ }
12
+
13
+ public function show() {
14
+ echo '<iframe frameborder="no" width="'.(isset($this->parameter['width'])?$this->parameter['width']:'').'" height="'.(isset($this->parameter['height'])?$this->parameter['height']:'').'" src="'.self::$settings->getGlobalOption('piwik_url').'index.php?module=CoreAdminHome&action=optOut&language='.(isset($this->parameter['language'])?$this->parameter['language']:'en').'"></iframe>';
15
+ }
16
+
17
+ }
classes/WP_Piwik/Widget/Overview.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Overview extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => isset($params['period'])?$params['period']:$timeSettings['period'],
14
+ 'date' => isset($params['date'])?$params['date']: $timeSettings['date'],
15
+ 'description' => $timeSettings['description']
16
+ );
17
+ $this->title = !$this->isShortcode?$prefix.__('Overview', 'wp-piwik').' ('.__($this->pageId == 'dashboard'?$this->rangeName():$timeSettings['description'],'wp-piwik').')':($params['title']?$params['title']:'');
18
+ $this->method = 'VisitsSummary.get';
19
+ }
20
+
21
+ public function show() {
22
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
23
+ if (!empty($response['result']) && $response['result'] ='error')
24
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
25
+ else {
26
+ if ($this->parameter['date'] == 'last30') {
27
+ $result = array();
28
+ foreach ($response as $data)
29
+ foreach ($data as $key => $value)
30
+ if (isset($result[$key]))
31
+ $result[$key] += $value;
32
+ else
33
+ $result[$key] = $value;
34
+ $response = $result;
35
+ }
36
+ $time = isset($response['sum_visit_length'])?$this->timeFormat($response['sum_visit_length']):'-';
37
+ $avgTime = isset($response['avg_time_on_site'])?$this->timeFormat($response['avg_time_on_site']):'-';
38
+ $tableHead = null;
39
+ $tableBody = array(
40
+ array(__('Visitors', 'wp-piwik').':', $this->value($response, 'nb_visits')),
41
+ array(__('Unique visitors', 'wp-piwik').':', $this->value($response, 'nb_uniq_visitors')),
42
+ array(__('Page views', 'wp-piwik').':', $this->value($response, 'nb_actions').' (&#216; '.$this->value($response, 'nb_actions_per_visit').')'),
43
+ array(__('Total time spent', 'wp-piwik').':', $time),
44
+ array(__('Bounce count', 'wp-piwik').':', $this->value($response, 'bounce_count').' ('.$this->value($response, 'bounce_rate').')')
45
+ );
46
+ if ($this->parameter['date'] != 'last30')
47
+ array_push($tableBody, array(__('Time/visit', 'wp-piwik').':', $avgTime), array(__('Max. page views in one visit', 'wp-piwik').':', $this->value($response, 'max_actions')));
48
+ $tableFoot = (self::$settings->getGlobalOption('piwik_shortcut')?array(__('Shortcut', 'wp-piwik').':', '<a href="'.self::$settings->getGlobalOption('piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik_stats">WP-Piwik</a>':'')):null);
49
+ $this->table($tableHead, $tableBody, $tableFoot);
50
+ }
51
+ }
52
+
53
+ }
classes/WP_Piwik/Widget/Pages.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Pages extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Pages', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'Actions.getPageTitles';
18
+ $this->name = 'Page';
19
+ }
20
+
21
+ }
classes/WP_Piwik/Widget/Plugins.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Plugins extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Plugins', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'UserSettings.getPlugin';
18
+ }
19
+
20
+ public function show() {
21
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
22
+ if (!empty($response['result']) && $response['result'] ='error')
23
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
24
+ else {
25
+ $tableHead = array(__('Plugin', 'wp-piwik'), __('Visits', 'wp-piwik'), __('Percent', 'wp-piwik'));
26
+ $tableBody = array();
27
+ $count = 0;
28
+ foreach ($response as $row) {
29
+ $count++;
30
+ $tableBody[] = array($row['label'], $row['nb_visits'], $row['nb_visits_percentage']);
31
+ if ($count == 10) break;
32
+ }
33
+ $this->table($tableHead, $tableBody, null);
34
+ }
35
+ }
36
+
37
+ }
classes/WP_Piwik/Widget/Post.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Post extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ global $post;
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => 'range',
14
+ 'date' => isset($params['range'])?$params['range']:'last30',
15
+ 'key' => isset($params['key'])?$params['key']:null,
16
+ 'pageUrl' => isset($params['url'])?$params['url']:urlencode(get_permalink($post->ID)),
17
+ );
18
+ $this->title = $prefix.__('Overview', 'wp-piwik').' ('.__($this->parameter['date'],'wp-piwik').')';
19
+ $this->method = 'Actions.getPageUrl';
20
+ }
21
+
22
+ public function show() {
23
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
24
+ if (!empty($response['result']) && $response['result'] ='error')
25
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
26
+ else {
27
+ if (isset($response[0]))
28
+ $response = $response[0];
29
+ if ($this->parameter['key']) {
30
+ echo isset($response[$this->parameter['key']])?$response[$this->parameter['key']]:'<em>not defined</em>';
31
+ return;
32
+ }
33
+ $time = isset($response['entry_sum_visit_length'])?$this->timeFormat($response['entry_sum_visit_length']):'-';
34
+ $avgTime = isset($response['avg_time_on_page'])?$this->timeFormat($response['avg_time_on_page']):'-';
35
+ $tableHead = null;
36
+ $tableBody = array(
37
+ array(__('Visitors', 'wp-piwik').':', $this->value($response, 'nb_visits')),
38
+ array(__('Unique visitors', 'wp-piwik').':', $this->value($response, 'sum_daily_nb_uniq_visitors')),
39
+ array(__('Page views', 'wp-piwik').':', $this->value($response, 'nb_hits').' (&#216; '.$this->value($response, 'entry_nb_actions').')'),
40
+ array(__('Total time spent', 'wp-piwik').':', $time),
41
+ array(__('Time/visit', 'wp-piwik').':', $avgTime),
42
+ array(__('Bounce count', 'wp-piwik').':', $this->value($response, 'entry_bounce_count').' ('.$this->value($response, 'bounce_rate').')'),
43
+ array(__('Min. generation time', 'wp-piwik').':', $this->value($response, 'min_time_generation')),
44
+ array(__('Max. generation time', 'wp-piwik').':', $this->value($response, 'max_time_generation'))
45
+ );
46
+ $tableFoot = (self::$settings->getGlobalOption('piwik_shortcut')?array(__('Shortcut', 'wp-piwik').':', '<a href="'.self::$settings->getGlobalOption('piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik_stats">WP-Piwik</a>':'')):null);
47
+ $this->table($tableHead, $tableBody, $tableFoot);
48
+ }
49
+ }
50
+
51
+ }
classes/WP_Piwik/Widget/Referrers.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Referrers extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Referrers', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'Referrers.getWebsites';
18
+ $this->name = 'Referrer';
19
+ }
20
+
21
+ }
classes/WP_Piwik/Widget/Screens.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Screens extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Resolutions', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'UserSettings.getResolution';
18
+ $this->context = 'normal';
19
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
20
+ wp_enqueue_script('wp-piwik-jqplot',self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
21
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion());
22
+ add_action('admin_head-index.php', array($this, 'addHeaderLines'));
23
+ }
24
+
25
+ public function addHeaderLines() {
26
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.self::$wpPiwik->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
27
+ echo '<link rel="stylesheet" href="'.self::$wpPiwik->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
28
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
29
+ }
30
+
31
+ public function show() {
32
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
33
+ $tableBody = array();
34
+ if (!empty($response['result']) && $response['result'] ='error')
35
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
36
+ else {
37
+ $tableHead = array(__('Resolution', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik'));
38
+ if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors';
39
+ else $unique = 'sum_daily_nb_uniq_visitors';
40
+ $count = 0;
41
+ $sum = 0;
42
+ foreach ($response as $row) {
43
+ $count++;
44
+ $sum += isset($row[$unique])?$row[$unique]:0;
45
+ if ($count < $this->limit)
46
+ $tableBody[$row['label']] = array($row['label'], $row[$unique], 0);
47
+ elseif (!isset($tableBody['Others']))
48
+ $tableBody['Others'] = array($row['label'], $row[$unique], 0);
49
+ else
50
+ $tableBody['Others'][1] += $row[$unique];
51
+ }
52
+ if ($count > $this->limit)
53
+ $tableBody['Others'][0] = __('Others', 'wp-piwik');
54
+
55
+ foreach ($tableBody as $key => $row)
56
+ $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%';
57
+
58
+ if (!empty($tableBody)) $this->pieChart($tableBody);
59
+ $this->table($tableHead, $tableBody, null);
60
+ }
61
+ }
62
+
63
+ }
classes/WP_Piwik/Widget/Search.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Search extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => $timeSettings['period'],
14
+ 'date' => $timeSettings['date']
15
+ );
16
+ $this->title = $prefix.__('Site Search', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
17
+ $this->method = 'Actions.getSiteSearchKeywords';
18
+ }
19
+
20
+ public function show() {
21
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
22
+ if (!empty($response['result']) && $response['result'] ='error')
23
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
24
+ else {
25
+ $tableHead = array(__('Keyword', 'wp-piwik'), __('Requests', 'wp-piwik'), __('Bounced', 'wp-piwik'));
26
+ $tableBody = array();
27
+ $count = 0;
28
+ foreach ($response as $row) {
29
+ $count++;
30
+ $tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']);
31
+ if ($count == 10) break;
32
+ }
33
+ $this->table($tableHead, $tableBody, null);
34
+ }
35
+ }
36
+
37
+ }
classes/WP_Piwik/Widget/Seo.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Seo extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $this->parameter = array(
11
+ 'url' => get_bloginfo('url')
12
+ );
13
+ $this->title = $prefix.__('SEO', 'wp-piwik');
14
+ $this->method = 'SEO.getRank';
15
+ }
16
+
17
+ public function show() {
18
+ $response = null; //self::$wpPiwik->request($this->apiID[$this->method]);
19
+ if (!empty($response['result']) && $response['result'] ='error')
20
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
21
+ else {
22
+ echo '<div class="table"><table class="widefat"><tbody>';
23
+ if (is_array($response))
24
+ foreach ($response as $val)
25
+ echo '<tr><td>'.$val[0].'</td><td>'.$val[1].'</td></tr>';
26
+ else echo '<tr><td>SEO module currently not available.</td></tr>';
27
+ echo '</tbody></table></div>';
28
+ }
29
+ }
30
+
31
+ }
classes/WP_Piwik/Widget/Systems.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Systems extends \WP_Piwik\Widget {
6
+
7
+ protected function configure($prefix = '', $params = array()) {
8
+ $timeSettings = $this->getTimeSettings();
9
+ $this->parameter = array(
10
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
11
+ 'period' => $timeSettings['period'],
12
+ 'date' => $timeSettings['date']
13
+ );
14
+ $this->title = $prefix.__('Operation Systems', 'wp-piwik').' ('.__($timeSettings['description'],'wp-piwik').')';
15
+ $this->method = 'UserSettings.getOS';
16
+ $this->context = 'normal';
17
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
18
+ wp_enqueue_script('wp-piwik-jqplot',self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
19
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion());
20
+ add_action('admin_head-index.php', array($this, 'addHeaderLines'));
21
+ }
22
+
23
+ public function addHeaderLines() {
24
+ echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.self::$wpPiwik->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
25
+ echo '<link rel="stylesheet" href="'.self::$wpPiwik->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
26
+ echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
27
+ }
28
+
29
+ public function show() {
30
+ $response = self::$wpPiwik->request($this->apiID[$this->method]);
31
+ $tableBody = array();
32
+ if (!empty($response['result']) && $response['result'] ='error')
33
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response['message'], ENT_QUOTES, 'utf-8');
34
+ else {
35
+ $tableHead = array(__('Operation System', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Percent', 'wp-piwik'));
36
+ if (isset($response[0]['nb_uniq_visitors'])) $unique = 'nb_uniq_visitors';
37
+ else $unique = 'sum_daily_nb_uniq_visitors';
38
+ $count = 0;
39
+ $sum = 0;
40
+ foreach ($response as $row) {
41
+ $count++;
42
+ $sum += isset($row[$unique])?$row[$unique]:0;
43
+ if ($count < $this->limit)
44
+ $tableBody[$row['label']] = array($row['label'], $row[$unique], 0);
45
+ elseif (!isset($tableBody['Others']))
46
+ $tableBody['Others'] = array($row['label'], $row[$unique], 0);
47
+ else
48
+ $tableBody['Others'][1] += $row[$unique];
49
+ }
50
+ if ($count > $this->limit)
51
+ $tableBody['Others'][0] = __('Others', 'wp-piwik');
52
+
53
+ foreach ($tableBody as $key => $row)
54
+ $tableBody[$key][2] = number_format($row[1]/$sum*100, 2).'%';
55
+
56
+ if (!empty($tableBody)) $this->pieChart($tableBody);
57
+ $this->table($tableHead, $tableBody, null);
58
+ }
59
+ }
60
+
61
+ }
classes/WP_Piwik/Widget/Visitors.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WP_Piwik\Widget;
4
+
5
+ class Visitors extends \WP_Piwik\Widget {
6
+
7
+ public $className = __CLASS__;
8
+
9
+ protected function configure($prefix = '', $params = array()) {
10
+ $timeSettings = $this->getTimeSettings();
11
+ $this->parameter = array(
12
+ 'idSite' => self::$wpPiwik->getPiwikSiteId($this->blogId),
13
+ 'period' => isset($params['period'])?$params['period']:$timeSettings['period'],
14
+ 'date' => 'last'.($timeSettings['period']=='day'?'30':'12'),
15
+ 'limit' => null
16
+ );
17
+ $this->title = $prefix.__('Visitors', 'wp-piwik').' ('.__($this->rangeName(),'wp-piwik').')';
18
+ $this->method = array('VisitsSummary.getVisits', 'VisitsSummary.getUniqueVisitors', 'VisitsSummary.getBounceCount', 'VisitsSummary.getActions');
19
+ $this->context = 'normal';
20
+ wp_enqueue_script('wp-piwik', self::$wpPiwik->getPluginURL().'js/wp-piwik.js', array(), self::$wpPiwik->getPluginVersion(), true);
21
+ wp_enqueue_script('wp-piwik-jqplot',self::$wpPiwik->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
22
+ wp_enqueue_style('wp-piwik', self::$wpPiwik->getPluginURL().'css/wp-piwik.css',array(),self::$wpPiwik->getPluginVersion());
23
+ add_action('admin_head-index.php', array($this, 'addHeaderLines'));
24
+ }
25
+
26
+ public function show() {
27
+ $response = array();
28
+ $success = true;
29
+ foreach ($this->method as $method) {
30
+ $response[$method] = self::$wpPiwik->request($this->apiID[$method]);
31
+ if (!empty($response[$method]['result']) && $response[$method]['result'] ='error')
32
+ $success = false;
33
+ }
34
+ if (!$success)
35
+ echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($response[$method]['message'], ENT_QUOTES, 'utf-8');
36
+ else {
37
+ $data = array();
38
+ foreach ($response['VisitsSummary.getVisits'] as $key => $value) {
39
+ if ($this->parameter['period'] == 'week') {
40
+ preg_match("/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/", $key, $dateList);
41
+ $jsKey = $dateList[0];
42
+ $textKey = $this->dateFormat($jsKey, 'week');
43
+ } elseif ($this->parameter['period'] == 'month') {
44
+ $jsKey = $key.'-01';
45
+ $textKey = $key;
46
+ } else $jsKey = $textKey = $key;
47
+ $data[] = array(
48
+ $textKey,
49
+ $value,
50
+ $response['VisitsSummary.getUniqueVisitors'][$key]?$response['VisitsSummary.getUniqueVisitors'][$key]:'-',
51
+ $response['VisitsSummary.getBounceCount'][$key]?$response['VisitsSummary.getBounceCount'][$key]:'-',
52
+ $response['VisitsSummary.getActions'][$key]?$response['VisitsSummary.getActions'][$key]:'-'
53
+ );
54
+ $javaScript[] = 'javascript:wp_piwik_datelink(\''.urlencode('wp-piwik_stats').'\',\''.str_replace('-', '', $jsKey).'\',\''.(isset($_GET['wpmu_show_stats'])?(int) $_GET['wpmu_show_stats']:'').'\');';
55
+ }
56
+ $this->table(
57
+ array(__('Date', 'wp-piwik'), __('Visits', 'wp-piwik'), __('Unique', 'wp-piwik'), __('Bounced', 'wp-piwik'), __('Page Views', 'wp-piwik')),
58
+ array_reverse($data),
59
+ array(),
60
+ 'clickable',
61
+ array_reverse($javaScript)
62
+ );
63
+ }
64
+
65
+ }
66
+
67
+ }
classes/WP_Piwik_Logger_Dummy.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- require_once('WP_Piwik_Logger.php');
4
-
5
- class WP_Piwik_Logger_Dummy extends WP_Piwik_Logger {
6
-
7
- public function loggerOutput($loggerTime, $loggerMessage) {}
8
-
9
- }
 
 
 
 
 
 
 
 
 
classes/WP_Piwik_MetaBox_PerPost_Stats.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- require_once('WP_Piwik_Template.php');
4
-
5
- class WP_Piwik_MetaBox_PerPost_Stats extends WP_Piwik_Template {
6
-
7
- function addMetabox() {
8
- add_meta_box(
9
- 'wp-piwik_post_perpoststats',
10
- __('Piwik Statistics (last 30 days)', 'wp-piwik'),
11
- array(&$this, 'showStats'),
12
- 'post',
13
- 'side',
14
- 'default'
15
- );
16
- }
17
-
18
- private function getStats($range = false) {
19
- global $post;
20
- $postURL = get_permalink($post->ID);
21
- $range = ($range?$range:$this->getRangeLast30());
22
- self::$logger->log('Load per post statistics: '.$postURL);
23
- return self::$wpPiwik->callPiwikAPI('Actions.getPageUrl', 'range', $range, null, false, false, 'PHP', $postURL, false);
24
- }
25
-
26
- function showStats() {
27
- $data = $this->getStats();
28
- if (!isset($data[0])) return;
29
- echo '<table>';
30
- $this->tabRow(__('Visitors', 'wp-piwik').':',$data[0]['nb_visits']);
31
- $this->tabRow(__('Unique visitors', 'wp-piwik').':', $data[0]['sum_daily_nb_uniq_visitors']);
32
- $this->tabRow(__('Page views', 'wp-piwik').':', $data[0]['nb_hits']);
33
- $this->tabRow(__('Time/visit', 'wp-piwik').':', $data[0]['avg_time_on_page']);
34
- $this->tabRow(__('Bounce count', 'wp-piwik').':', $this->output($data[0], 'entry_bounce_count', 0).' ('.$data[0]['bounce_rate'].')');
35
- $this->tabRow(__('Exit count', 'wp-piwik').':', $this->output($data[0], 'exit_nb_visits', 0).' ('.$data[0]['exit_rate'].')');
36
- if (isset($data[0]['avg_time_generation']))
37
- $this->tabRow(__('Avg. generation time', 'wp-piwik').':', $data[0]['avg_time_generation']);
38
- echo '</table>';
39
- }
40
-
41
- function getValue($range, $key) {
42
- $data = $this->getStats($range);
43
- if (!isset($data[0]) || !isset($data[0][$key])) return '-';
44
- else return $data[0][$key];
45
- }
46
-
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/WP_Piwik_Settings.php DELETED
@@ -1,166 +0,0 @@
1
- <?php
2
-
3
- class WP_Piwik_Settings {
4
-
5
- private static $logger, $defaultSettings;
6
-
7
- private $globalSettings = array(
8
- 'revision' => 90921,
9
- 'plugin_display_name' => 'WP-Piwik',
10
- 'add_tracking_code' => false,
11
- 'last_settings_update' => 0,
12
- 'piwik_token' => '',
13
- 'piwik_url' => '',
14
- 'piwik_path' => '',
15
- 'piwik_mode' => 'http',
16
- 'piwik_useragent' => 'php',
17
- 'piwik_useragent_string' => 'WP-Piwik',
18
- 'connection_timeout' => 5,
19
- 'dashboard_widget' => false,
20
- 'dashboard_chart' => false,
21
- 'dashboard_seo' => false,
22
- 'stats_seo' => false,
23
- 'capability_stealth' => array(),
24
- 'capability_read_stats' => array('administrator' => true),
25
- 'piwik_shortcut' => false,
26
- 'default_date' => 'yesterday',
27
- 'auto_site_config' => true,
28
- 'track_404' => false,
29
- 'track_search' => false,
30
- 'track_mode' => 0,
31
- 'track_post' => false,
32
- 'track_proxy' => false,
33
- 'track_admin' => false,
34
- 'track_feed' => false,
35
- 'track_feed_goal' => '',
36
- 'track_feed_revenue' => '',
37
- 'track_feed_campaign' => 'feed',
38
- 'track_feed_addcampaign' => 'false',
39
- 'track_cdnurl' => '',
40
- 'track_cdnurlssl' => '',
41
- 'track_noscript' => false,
42
- 'track_nojavascript' => false,
43
- 'track_codeposition' => 'footer',
44
- 'track_datacfasync' => false,
45
- 'track_across' => false,
46
- 'track_across_alias' => false,
47
- 'limit_cookies' => false,
48
- 'limit_cookies_visitor' => 1209600,
49
- 'limit_cookies_session' => 0,
50
- 'add_post_annotations' => false,
51
- 'add_customvars_box' => true,
52
- 'disable_timelimit' => false,
53
- 'disable_ssl_verify' => false,
54
- 'disable_cookies' => false,
55
- 'add_download_extensions' => '',
56
- 'force_protocol' => '',
57
- 'toolbar' => false,
58
- 'shortcodes' => false,
59
- 'cache' => true,
60
- 'perpost_stats' => false
61
- ),
62
- $settings = array(
63
- 'name' => '',
64
- 'tracking_code' => '',
65
- 'site_id' => NULL,
66
- 'last_tracking_code_update' => 0,
67
- 'dashboard_revision' => 0,
68
- 'noscript_code' => ''
69
- ),
70
- $settingsChanged = false;
71
-
72
- public function __construct($objLogger) {
73
- self::$logger = $objLogger;
74
- self::$logger->log('Store default settings');
75
- self::$defaultSettings = array('globalSettings' => $this->globalSettings, 'settings' => $this->settings);
76
- self::$logger->log('Load settings');
77
- $this->globalSettings = ($this->checkNetworkActivation()?
78
- get_site_option('wp-piwik_global-settings', $this->globalSettings):
79
- get_option('wp-piwik_global-settings', $this->globalSettings)
80
- );
81
- $this->settings = get_option('wp-piwik_settings',$this->settings);
82
- }
83
-
84
- public function save() {
85
- if (!$this->settingsChanged) {
86
- self::$logger->log('No settings changed yet');
87
- return;
88
- }
89
- self::$logger->log('Save settings');
90
- if (is_plugin_active_for_network('wp-piwik/wp-piwik.php'))
91
- update_site_option('wp-piwik_global-settings', $this->globalSettings);
92
- else
93
- update_option('wp-piwik_global-settings', $this->globalSettings);
94
- update_option('wp-piwik_settings', $this->settings);
95
- global $wp_roles;
96
- if (!is_object($wp_roles))
97
- $wp_roles = new WP_Roles();
98
- if (!is_object($wp_roles)) die("STILL NO OBJECT");
99
- foreach($wp_roles->role_names as $strKey => $strName) {
100
- $objRole = get_role($strKey);
101
- foreach (array('stealth', 'read_stats') as $strCap) {
102
- $aryCaps = $this->getGlobalOption('capability_'.$strCap);
103
- if (isset($aryCaps[$strKey]) && $aryCaps[$strKey])
104
- $objRole->add_cap('wp-piwik_'.$strCap);
105
- else $objRole->remove_cap('wp-piwik_'.$strCap);
106
- }
107
- }
108
- $this->settingsChanges = false;
109
- }
110
-
111
- public function getGlobalOption($key) {
112
- return isset($this->globalSettings[$key])?$this->globalSettings[$key]:self::$defaultSettings['globalSettings'][$key];
113
- }
114
-
115
- public function getOption($key) {
116
- return isset($this->settings[$key])?$this->settings[$key]:self::$defaultSettings['settings'][$key];
117
- }
118
-
119
- public function setGlobalOption($key, $value) {
120
- $this->settingsChanged = true;
121
- self::$logger->log('Changed global option '.$key.': '.(is_array($value)?serialize($value):$value));
122
- $this->globalSettings[$key] = $value;
123
- }
124
-
125
- public function setOption($key, $value) {
126
- $this->settingsChanged = true;
127
- self::$logger->log('Changed option '.$key.': '.$value);
128
- $this->settings[$key] = $value;
129
- }
130
-
131
- public function resetSettings($bolFull = false) {
132
- self::$logger->log('Reset WP-Piwik settings');
133
- global $wpdb;
134
- $keepSettings = array(
135
- 'piwik_token' => $this->getGlobalOption('piwik_token'),
136
- 'piwik_url' => $this->getGlobalOption('piwik_url'),
137
- 'piwik_path' => $this->getGlobalOption('piwik_path'),
138
- 'piwik_mode' => $this->getGlobalOption('piwik_mode')
139
- );
140
- if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) {
141
- delete_site_option('wp-piwik_global-settings');
142
- $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id');
143
- foreach ($aryBlogs as $aryBlog)
144
- delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings');
145
- if (!$bolFull) update_site_option('wp-piwik_global-settings', $keepSettings);
146
- } else {
147
- delete_option('wp-piwik_global-settings');
148
- delete_option('wp-piwik_settings');
149
- }
150
- $this->globalSettings = self::$defaultSettings['globalSettings'];
151
- $this->settings = self::$defaultSettings['settings'];
152
- if (!$bolFull) {
153
- self::$logger->log('Restore connection settings');
154
- foreach ($keepSettings as $key => $value)
155
- $this->setGlobalOption($key, $value);
156
- }
157
- $this->save();
158
- }
159
-
160
- public function checkNetworkActivation() {
161
- if (!function_exists("is_plugin_active_for_network")) {
162
- require_once(ABSPATH.'wp-admin/includes/plugin.php');
163
- }
164
- return is_plugin_active_for_network('wp-piwik/wp-piwik.php');
165
- }
166
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- // Nothing to see...
 
 
config.php CHANGED
@@ -1,10 +1,9 @@
1
- <?php
2
-
3
- /*
4
- Configure WP-Piwik Logger
5
- 0: Logger disabled
6
- 1: Log to screen
7
- 2: Log to file (logs/YYYYMMDD_wp-piwik.log)
8
- */
9
- if (!defined('WP_PIWIK_ACTIVATE_LOGGER'))
10
- define('WP_PIWIK_ACTIVATE_LOGGER', 0);
1
+ <?php
2
+
3
+ /******************************************************
4
+ * Configure WP-Piwik Logger
5
+ * 0: Logger disabled
6
+ * 1: Log to screen
7
+ * 2: Log to file (logs/YYYYMMDD_wp-piwik.log)
8
+ ******************************************************/
9
+ define ( 'WP_PIWIK_ACTIVATE_LOGGER', 0 );
 
css/wp-piwik-spark.css CHANGED
@@ -1 +1,3 @@
1
- .wp-piwik_dynbar canvas {padding-top:5px !important}
 
 
1
+ .wp-piwik_dynbar canvas {
2
+ padding-top: 5px !important
3
+ }
css/wp-piwik.css CHANGED
@@ -1,118 +1,31 @@
1
- span.wp-piwik-details {
2
- font-size:0.8em;
3
- font-weight:normal;
4
  }
5
 
6
- #wp-piwik_stats_vistors_graph{margin: 0 0 0 0}
7
-
8
- p.wp-piwik-eyecatcher {
9
- border:1px solid #c00;
10
- background:#ff0;
11
- padding:5px;
12
- }
13
-
14
- table.wp-piwik-table th.n, td.n {
15
  text-align: right;
16
  }
17
 
18
  table.wp-piwik-table tr:hover {
19
- background-color:#ccc;
20
- }
21
-
22
- form.wp-piwik-settings {
23
- margin-right:270px;
24
- }
25
-
26
- table.wp-piwik-form-table {
27
- clear:none !important;
28
- }
29
- table.wp-piwik-form-table-hide, label.wp-piwik-input-hide {
30
- display:none;
31
  }
32
 
33
- input.wp-piwik-input-hide {
34
- visibility:hidden;
35
  }
36
 
37
- div.wp-piwik-donate {
38
- float:right;
39
- width:220px;
40
- background:#ffc;
41
- padding:10px;
42
- border:1px solid black;
43
- margin-bottom:10px;
44
- margin-top:10px;
45
  }
46
 
47
- div.wp-piwik-donate div {
48
- width:190px;
49
- text-align:center;
50
- border:solid black;
51
- border-width:1px 0 0 0 ;
52
- padding:5px
53
  }
54
 
55
- div.wp-piwik-settings h4 {
56
- float:left;
57
- font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif !important;
58
- font-size:12px !important;
59
- font-weight:normal;
60
- padding-top:0px !important;
61
- text-align:right;
62
- width:160px;
63
- }
64
- div.wp-piwik-settings h4 label {
65
- margin-right:10px;
66
- vertical-align:middle;
67
- }
68
- div.wp-piwik-settings .input-text-wrap input,
69
- div.wp-piwik-settings .input-text-wrap select,
70
- div.wp-piwik-settings .input-text-wrap textarea {
71
- border:0 none;
72
- color:#333333;
73
- outline:medium none;
74
- padding:0;
75
- width:99%;
76
  }
77
 
78
- div.wp-piwik-settings .input-wrap {
79
- padding-top:0px;
80
- }
81
-
82
- div.wp-piwik-settings .input-wrap input {
83
- border:0 none;
84
- color:#333333;
85
- padding:0;
86
- }
87
-
88
- div.wp-piwik-settings .input-text-wrap {
89
- margin:0 0 1em 160px;
90
- border:1px solid #CCCCCC;
91
- }
92
-
93
- div.wp-piwik_desc {
94
- font-size:11px;
95
- margin:0 0 10px 160px;
96
- padding:0;
97
- }
98
-
99
- div.wp-piwik_desc strong {
100
- color:#f00;
101
- }
102
-
103
- strong.wp-piwik-error {color:#f00}
104
-
105
- .wp-list-table .column-id {width:20%}
106
- .wp-list-table .column-name {width:30%}
107
- .wp-list-table .column-siteurl {width:30%}
108
- .wp-list-table .column-piwikid {width:20%}
109
-
110
- .wp-piwik_dynbar canvas {padding-top:5px !important}
111
-
112
- .wp-piwik-wide-content {
113
- width:512px !important;
114
- }
115
-
116
- .wp-piwik-graph-wide {
117
- overflow:hidden;
118
  }
1
+ .wp-piwik-hidden {
2
+ display: none;
 
3
  }
4
 
5
+ table.wp-piwik-table th.right, td.right {
 
 
 
 
 
 
 
 
6
  text-align: right;
7
  }
8
 
9
  table.wp-piwik-table tr:hover {
10
+ background-color: #ccc;
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
+ table.wp-piwik-table tbody.clickable {
14
+ cursor: pointer;
15
  }
16
 
17
+ #wp-piwik_stats_vistors_graph {
18
+ overflow: hidden;
 
 
 
 
 
 
19
  }
20
 
21
+ .wp-piwik_dynbar canvas {
22
+ padding-top: 5px !important
 
 
 
 
23
  }
24
 
25
+ table.wp-piwik_menu-tab th {
26
+ vertical-align: top;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
+ div.wp-piwik-debug {
30
+ padding:10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
dashboard/.htaccess DELETED
@@ -1 +0,0 @@
1
- Deny from all
 
dashboard/browserdetails.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:BrowserDetails
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'UserSettings.getBrowserVersion',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Browser Details', 'wp-piwik');
13
- $strValues = '';
14
- $intCount = 0; $intMore = 0; $intSum = 0;
15
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] ='error')
16
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
17
- else {
18
- if (is_array($aryConf['data']))
19
- foreach ($aryConf['data'] as $key => $aryValues) {
20
- $intCount++;
21
- if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
22
- else $intMore += $aryValues['nb_uniq_visitors'];
23
- $intSum += $aryValues['nb_uniq_visitors'];
24
- }
25
- if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
26
- $strValues = substr($strValues, 0, -1);
27
- if ($intSum) {
28
- /***************************************************************************/ ?>
29
- <div class="wp-piwik-graph-wide">
30
- <div id="wp-piwik_stats_browserdetails_graph" style="height:310px;width:100%"></div>
31
- </div>
32
- <?php /************************************************************************/
33
- }
34
- /***************************************************************************/ ?>
35
- <div class="table">
36
- <table class="widefat wp-piwik-table">
37
- <thead>
38
- <tr>
39
- <th><?php _e('Browser', 'wp-piwik'); ?></th>
40
- <th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
41
- <th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
42
- </tr>
43
- </thead>
44
- <tbody>
45
- <?php /************************************************************************/
46
- if ($intSum)
47
- foreach ($aryConf['data'] as $aryValues)
48
- echo '<tr><td>'.
49
- $aryValues['label'].
50
- '</td><td class="n">'.
51
- $aryValues['nb_uniq_visitors'].
52
- '</td><td class="n">'.
53
- number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
54
- '%</td></tr>';
55
- else echo '<tr><td colspan="3">'.__('No data available.', 'wp-piwik').'</td></tr>';
56
- unset($aryTmp);
57
- /***************************************************************************/ ?>
58
- </tbody>
59
- </table>
60
- </div>
61
- <script type="text/javascript">
62
- $plotBrowsers = $j.jqplot('wp-piwik_stats_browserdetails_graph', [[<?php echo $strValues; ?>]], {
63
- seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
64
- legend:{show:true}
65
- });
66
- </script>
67
- <?php
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/browsers.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Browser
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'UserSettings.getBrowser',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
-
13
- $aryConf['title'] = __('Browser', 'wp-piwik');
14
- $strValues = '';
15
- $intCount = 0; $intMore = 0; $intSum = 0;
16
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] ='error')
17
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
18
- else {
19
- if (is_array($aryConf['data']))
20
- foreach ($aryConf['data'] as $key => $aryValues) {
21
- $intCount++;
22
- if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
23
- else $intMore += $aryValues['nb_uniq_visitors'];
24
- $intSum += $aryValues['nb_uniq_visitors'];
25
- }
26
- if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
27
- $strValues = substr($strValues, 0, -1);
28
- if ($intSum) {
29
- /***************************************************************************/ ?>
30
- <div class="wp-piwik-graph-wide">
31
- <div id="wp-piwik_stats_browsers_graph" style="height:310px;width:100%"></div>
32
- </div>
33
- <?php /************************************************************************/
34
- }
35
- /***************************************************************************/ ?>
36
- <div class="table">
37
- <table class="widefat wp-piwik-table">
38
- <thead>
39
- <tr>
40
- <th><?php _e('Browser', 'wp-piwik'); ?></th>
41
- <th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
42
- <th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
43
- </tr>
44
- </thead>
45
- <tbody>
46
- <?php /************************************************************************/
47
- if ($intSum)
48
- foreach ($aryConf['data'] as $aryValues)
49
- echo '<tr><td>'.
50
- $aryValues['label'].
51
- '</td><td class="n">'.
52
- $aryValues['nb_uniq_visitors'].
53
- '</td><td class="n">'.
54
- number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
55
- '%</td></tr>';
56
- else echo '<tr><td colspan="3">'.__('No data available.', 'wp-piwik').'</td></tr>';
57
- unset($aryTmp);
58
- /***************************************************************************/ ?>
59
- </tbody>
60
- </table>
61
- </div>
62
- <script type="text/javascript">
63
- $plotBrowsers = $j.jqplot('wp-piwik_stats_browsers_graph', [[<?php echo $strValues; ?>]], {
64
- seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
65
- legend:{show:true}
66
- });
67
- </script>
68
- <?php
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- // Nothing to see...
 
 
dashboard/keywords.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Keywords
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'Referers.getKeywords',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Keywords', 'wp-piwik');
13
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] = 'error')
14
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
15
- else {
16
- /***************************************************************************/ ?>
17
- <table class="widefat">
18
- <thead>
19
- <tr><th><?php _e('Keyword', 'wp-piwik'); ?></th><th><?php _e('Unique', 'wp-piwik'); ?></th></tr>
20
- </thead>
21
- <tbody>
22
- <?php /************************************************************************/
23
- if (is_array($aryConf['data'])) foreach ($aryConf['data'] as $aryValues)
24
- echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
25
- else echo '<tr><td colspan="2">'.__('No data available.', 'wp-piwik').'</td></tr>';
26
- /***************************************************************************/ ?>
27
- </tbody>
28
- </table>
29
- <?php /************************************************************************/
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/noresult.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:SiteSearchNoResults
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'Actions.getSiteSearchNoResultKeywords',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Site Search without Results', 'wp-piwik');
13
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] = 'error')
14
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
15
- else {
16
- /***************************************************************************/ ?>
17
- <table class="widefat">
18
- <thead>
19
- <tr><th><?php _e('Keyword', 'wp-piwik'); ?></th><th><?php _e('Requests', 'wp-piwik'); ?></th><th><?php _e('Bounced', 'wp-piwik'); ?></th></tr>
20
- </thead>
21
- <tbody>
22
- <?php /************************************************************************/
23
- if (is_array($aryConf['data'])) foreach ($aryConf['data'] as $aryValues)
24
- echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_visits'].'</td><td>'.$aryValues['bounce_rate'].'</td></tr>';
25
- else echo '<tr><td colspan="2">'.__('No data available.', 'wp-piwik').'</td></tr>';
26
- /***************************************************************************/ ?>
27
- </tbody>
28
- </table>
29
- <?php /************************************************************************/
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/overview.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Overview
4
- **********************************/
5
- $aryTmp = array(
6
- 'bounce_count' => 0,
7
- 'max_actions' => 0,
8
- 'nb_actions' => 0,
9
- 'nb_uniq_visitors' => 0,
10
- 'nb_visits' => 0,
11
- 'nb_visits_converted' => 0,
12
- 'sum_visit_length' => 0,
13
- 'bounce_rate' => 0,
14
- 'nb_actions_per_visit' => 0,
15
- 'avg_time_on_site' => 0
16
- );
17
- $aryConf['data'] = $this->callPiwikAPI(
18
- 'VisitsSummary.get',
19
- $aryConf['params']['period'],
20
- $aryConf['params']['date'],
21
- $aryConf['params']['limit']
22
- );
23
- $aryConf['title'] = __('Overview', 'wp-piwik');
24
-
25
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] ='error')
26
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
27
- else {
28
- if ($aryConf['params']['date'] == 'last30') {
29
- $intValCnt = 0;
30
- if (is_array($aryConf['data']))
31
- foreach ($aryConf['data'] as $aryDay)
32
- foreach ($aryDay as $strKey => $strValue) {
33
- $intValCnt++;
34
- if (!in_array($strKey, array('max_actions','bounce_rate','nb_actions_per_visit','avg_time_on_site')))
35
- { if (isset($aryTmp[$strKey])) $aryTmp[$strKey] += $strValue; }
36
- elseif ($aryTmp[$strKey] < $strValue)
37
- $aryTmp[$strKey] = $strValue;
38
- }
39
- $aryConf['data'] = $aryTmp;
40
- if ($intValCnt > 1 && $aryConf['data']['nb_visits'] >0) $aryConf['data']['bounce_rate'] = round($aryConf['data']['bounce_count']/$aryConf['data']['nb_visits']*100).'%';
41
- }
42
- if (empty($aryConf['data'])) $aryConf['data'] = $aryTmp;
43
- /***************************************************************************/ ?>
44
- <div class="table">
45
- <table class="widefat">
46
- <tbody>
47
- <?php /************************************************************************/
48
- $strTime =
49
- floor($aryConf['data']['sum_visit_length']/3600).'h '.
50
- floor(($aryConf['data']['sum_visit_length'] % 3600)/60).'m '.
51
- floor(($aryConf['data']['sum_visit_length'] % 3600) % 60).'s';
52
- $strAvgTime =
53
- floor($aryConf['data']['avg_time_on_site']/3600).'h '.
54
- floor(($aryConf['data']['avg_time_on_site'] % 3600)/60).'m '.
55
- floor(($aryConf['data']['avg_time_on_site'] % 3600) % 60).'s';
56
- echo '<tr><td>'.__('Visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_visits'].'</td></tr>';
57
- echo '<tr><td>'.__('Unique visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_uniq_visitors'].'</td></tr>';
58
- echo '<tr><td>'.__('Page views', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_actions'].' (&#216; '.$aryConf['data']['nb_actions_per_visit'].')</td></tr>';
59
- echo '<tr><td>'.__('Max. page views in one visit', 'wp-piwik').':</td><td>'.$aryConf['data']['max_actions'].'</td></tr>';
60
- echo '<tr><td>'.__('Total time spent', 'wp-piwik').':</td><td>'.$strTime.'</td></tr>';
61
- echo '<tr><td>'.__('Time/visit', 'wp-piwik').':</td><td>'.$strAvgTime.'</td></tr>';
62
- echo '<tr><td>'.__('Bounce count', 'wp-piwik').':</td><td>'.$aryConf['data']['bounce_count'].' ('.$aryConf['data']['bounce_rate'].')</td></tr>';
63
- if (self::$settings->getGlobalOption('piwik_shortcut'))
64
- echo '<tr><td>'.__('Shortcut', 'wp-piwik').':</td><td><a href="'.self::$settings->getGlobalOption('piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik_stats">WP-Piwik</a>':'').'</td></tr>';
65
- /***************************************************************************/ ?>
66
- </tbody>
67
- </table>
68
- </div>
69
- <?php /************************************************************************/
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/pages.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Pages
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'Actions.getPageTitles',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $intMax = 9;
13
- $aryConf['title'] = __('Pages', 'wp-piwik');
14
-
15
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] = 'error')
16
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
17
- else {
18
- /***************************************************************************/ ?>
19
- <div class="table">
20
- <table class="widefat wp-piwik-table">
21
- <thead>
22
- <tr>
23
- <th><?php _e('Page', 'wp-piwik'); ?></th>
24
- <th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
25
- <th class="n"><?php _e('Visits', 'wp-piwik'); ?></th>
26
- </tr>
27
- </thead>
28
- <tbody>
29
- <?php /************************************************************************/
30
- $intCount = 0; $aryOthers = array('u' => 0, 'v' => 0);
31
- if (is_array($aryConf['data'])) foreach ($aryConf['data'] as $aryValues) {
32
- $intCount++;
33
- if ($intCount > $intMax) {
34
- $aryOthers['u'] += (isset($aryValues['nb_uniq_visitors'])?$aryValues['nb_uniq_visitors']:0);
35
- $aryOthers['v'] += (isset($aryValues['nb_visits'])?$aryValues['nb_visits']:0);
36
- } else echo '<tr><td>'.
37
- $aryValues['label'].
38
- '</td><td class="n">'.
39
- $aryValues['nb_uniq_visitors'].
40
- '</td><td class="n">'.
41
- $aryValues['nb_visits'].
42
- '</td></tr>';
43
- } else echo '<tr><td colspan="3">'.__('No data available.', 'wp-piwik').'</td></tr>';
44
- if (!empty($aryOthers['v'])) echo '<tr><td>'.
45
- __('Others', 'wp-piwik').
46
- '</td><td class="n">'.
47
- $aryOthers['u'].
48
- '</td><td class="n">'.
49
- $aryOthers['v'].
50
- '</td></tr>';
51
-
52
- /***************************************************************************/ ?>
53
- </tbody>
54
- </table>
55
- </div>
56
- <?php /************************************************************************/
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/plugins.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Plugins
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'UserSettings.getPlugin',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Plugins', 'wp-piwik');
13
-
14
- $aryOverview = $this->callPiwikAPI(
15
- 'VisitsSummary.get',
16
- $aryConf['params']['period'],
17
- $aryConf['params']['date'],
18
- $aryConf['params']['limit']
19
- );
20
-
21
- $intTotalVisits = (isset($aryOverview['nb_visits'])?$aryOverview['nb_visits']:0);
22
-
23
- unset($aryOverview);
24
-
25
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] = 'error')
26
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
27
- else {
28
- /***************************************************************************/ ?>
29
- <div class="table">
30
- <table class="widefat wp-piwik-table">
31
- <thead>
32
- <tr>
33
- <th><?php _e('Plugins', 'wp-piwik'); ?></th>
34
- <th class="n"><?php _e('Visits', 'wp-piwik'); ?></th>
35
- <th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
36
- </tr>
37
- </thead>
38
- <tbody>
39
- <?php /************************************************************************/
40
- if (is_array($aryConf['data'])) foreach ($aryConf['data'] as $aryValues)
41
- echo '<tr><td>'.
42
- $aryValues['label'].
43
- '</td><td class="n">'.
44
- $aryValues['nb_visits'].
45
- '</td><td class="n">'.
46
- ($intTotalVisits != 0?
47
- number_format(($aryValues['nb_visits']/$intTotalVisits*100),2):
48
- '0.00%'
49
- ).
50
- '%</td></tr>';
51
- else echo '<tr><td colspan="3">'.__('No data available.', 'wp-piwik').'</td></tr>';
52
- unset($aryTmp);
53
- /***************************************************************************/ ?>
54
- </tbody>
55
- </table>
56
- </div>
57
- <?php /************************************************************************/
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/screens.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Screens
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'UserSettings.getResolution',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Resolution', 'wp-piwik');
13
- $strValues = '';
14
- $intCount = 0; $intMore = 0; $intSum = 0;
15
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] ='error')
16
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
17
- else {
18
- if (is_array($aryConf['data']))
19
- foreach ($aryConf['data'] as $key => $aryValues) {
20
- $intCount++;
21
- if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
22
- else $intMore += $aryValues['nb_uniq_visitors'];
23
- $intSum += $aryValues['nb_uniq_visitors'];
24
- }
25
- if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
26
- $strValues = substr($strValues, 0, -1);
27
- if ($intSum) {
28
- /***************************************************************************/ ?>
29
- <div class="wp-piwik-graph-wide">
30
- <div id="wp-piwik_stats_screens_graph" style="height:310px;width:100%"></div>
31
- </div>
32
- <?php /************************************************************************/
33
- }
34
- /***************************************************************************/ ?>
35
- <div class="table">
36
- <table class="widefat wp-piwik-table">
37
- <thead>
38
- <tr>
39
- <th><?php _e('Resolution', 'wp-piwik'); ?></th>
40
- <th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
41
- <th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
42
- </tr>
43
- </thead>
44
- <tbody>
45
- <?php /************************************************************************/
46
- if ($intSum)
47
- foreach ($aryConf['data'] as $aryValues)
48
- echo '<tr><td>'.
49
- $aryValues['label'].
50
- '</td><td class="n">'.
51
- $aryValues['nb_uniq_visitors'].
52
- '</td><td class="n">'.
53
- number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
54
- '%</td></tr>';
55
- else echo '<tr><td colspan="3">'.__('No data available.', 'wp-piwik').'</td></tr>';
56
- unset($aryTmp);
57
- /***************************************************************************/ ?>
58
- </tbody>
59
- </table>
60
- </div>
61
- <script type="text/javascript">
62
- $plotScreens = $j.jqplot('wp-piwik_stats_screens_graph', [[<?php echo $strValues; ?>]], {
63
- seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
64
- legend:{show:true}
65
- });
66
- </script>
67
- <?php
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/search.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:SiteSearch
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'Actions.getSiteSearchKeywords',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Site Search Keywords', 'wp-piwik');
13
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] = 'error')
14
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
15
- else {
16
- /***************************************************************************/ ?>
17
- <table class="widefat">
18
- <thead>
19
- <tr><th><?php _e('Keyword', 'wp-piwik'); ?></th><th><?php _e('Requests', 'wp-piwik'); ?></th><th><?php _e('Bounced', 'wp-piwik'); ?></th></tr>
20
- </thead>
21
- <tbody>
22
- <?php /************************************************************************/
23
- if (is_array($aryConf['data'])) foreach ($aryConf['data'] as $aryValues)
24
- echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_visits'].'</td><td>'.$aryValues['bounce_rate'].'</td></tr>';
25
- else echo '<tr><td colspan="2">'.__('No data available.', 'wp-piwik').'</td></tr>';
26
- /***************************************************************************/ ?>
27
- </tbody>
28
- </table>
29
- <?php /************************************************************************/
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/seo.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:SEO
4
- **********************************/
5
- $aryConf['data'] = $GLOBALS['wp_piwik']->callPiwikAPI(
6
- 'SEO.getRank',
7
- $aryConf['params']['period'],
8
- $aryConf['params']['date'],
9
- $aryConf['params']['limit'],
10
- false,
11
- false,
12
- 'csv'
13
- );
14
-
15
- if (substr($aryConf['data'], 0, 6) == 'Error:') {
16
- $strMessage = str_replace('Error:', '', $aryConf['data']);
17
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($strMessage, ENT_QUOTES, 'utf-8');
18
- } else {
19
-
20
- $aryConf['title'] = __('SEO', 'wp-piwik');
21
- $aryLines = explode("\n", $aryConf['data']);
22
- foreach ($aryLines as $strLine)
23
- $aryData[] = explode(',', $strLine);
24
- unset($aryData[0]);
25
- /***************************************************************************/ ?>
26
- <div class="table">
27
- <table class="widefat">
28
- <tbody>
29
- <?php foreach ($aryData as $aryVal) { ?>
30
- <tr><td><?php echo $aryVal[0]; ?></td><td><?php echo $aryVal[1]; ?></td></tr>
31
- <?php } ?>
32
- </tbody>
33
- </table>
34
- </div>
35
- <?php /************************************************************************/
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/systems.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Systems
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'UserSettings.getOS',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Operating System', 'wp-piwik');
13
- $strValues = '';
14
- $intCount = 0; $intMore = 0; $intSum = 0;
15
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] ='error')
16
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
17
- else {
18
- if (is_array($aryConf['data']))
19
- foreach ($aryConf['data'] as $key => $aryValues) {
20
- $intCount++;
21
- if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
22
- else $intMore += $aryValues['nb_uniq_visitors'];
23
- $intSum += $aryValues['nb_uniq_visitors'];
24
- }
25
- if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
26
- $strValues = substr($strValues, 0, -1);
27
-
28
- if ($intSum) {
29
- /***************************************************************************/ ?>
30
- <div class="wp-piwik-graph-wide">
31
- <div id="wp-piwik_stats_systems_graph" style="height:310px;width:100%"></div>
32
- </div>
33
- <?php /************************************************************************/
34
- }
35
- /***************************************************************************/ ?>
36
- <div class="table">
37
- <table class="widefat wp-piwik-table">
38
- <thead>
39
- <tr>
40
- <th><?php _e('Operating System', 'wp-piwik'); ?></th>
41
- <th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
42
- <th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
43
- </tr>
44
- </thead>
45
- <tbody>
46
- <?php /************************************************************************/
47
- if ($intSum)
48
- foreach ($aryConf['data'] as $aryValues)
49
- echo '<tr><td>'.
50
- $aryValues['label'].
51
- '</td><td class="n">'.
52
- $aryValues['nb_uniq_visitors'].
53
- '</td><td class="n">'.
54
- number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
55
- '%</td></tr>';
56
- else echo '<tr><td colspan="3">'.__('No data available.', 'wp-piwik').'</td></tr>';
57
- unset($aryTmp);
58
- /***************************************************************************/ ?>
59
- </tbody>
60
- </table>
61
- </div>
62
- <script type="text/javascript">
63
- $plotSystems = $j.jqplot('wp-piwik_stats_systems_graph', [[<?php echo $strValues; ?>]], {
64
- seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
65
- legend:{show:true}
66
- });
67
- </script>
68
- <?php
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/visitors.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Vistors
4
- **********************************/
5
-
6
- $aryConf['data']['Visitors'] = $this->callPiwikAPI(
7
- 'VisitsSummary.getVisits',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['data']['Unique'] = $this->callPiwikAPI(
13
- 'VisitsSummary.getUniqueVisitors',
14
- $aryConf['params']['period'],
15
- $aryConf['params']['date'],
16
- $aryConf['params']['limit']
17
- );
18
- $aryConf['data']['Bounced'] = $this->callPiwikAPI(
19
- 'VisitsSummary.getBounceCount',
20
- $aryConf['params']['period'],
21
- $aryConf['params']['date'],
22
- $aryConf['params']['limit']
23
- );
24
- $aryConf['data']['Actions'] = $this->callPiwikAPI(
25
- 'VisitsSummary.getActions',
26
- $aryConf['params']['period'],
27
- $aryConf['params']['date'],
28
- $aryConf['params']['limit']
29
- );
30
-
31
- if (isset($aryConf['data']['Visitors']['result']) && $aryConf['data']['Visitors']['result'] ='error')
32
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['Visitors']['message'], ENT_QUOTES, 'utf-8');
33
- else {
34
- $strValues = $strLabels = $strBounced = $strValuesU = $strCounter = '';
35
- $intUSum = $intCount = 0;
36
- if (is_array($aryConf['data']['Visitors']))
37
- foreach ($aryConf['data']['Visitors'] as $strDate => $intValue) {
38
- $intCount++;
39
- $strValues .= $intValue.',';
40
- $strValuesU .= $aryConf['data']['Unique'][$strDate].',';
41
- $strBounced .= $aryConf['data']['Bounced'][$strDate].',';
42
- $strLabels .= '['.$intCount.',"'.substr($strDate,-2).'"],';
43
- $intUSum += $aryConf['data']['Unique'][$strDate];
44
- }
45
- else {$strValues = '0,'; $strLabels = '[0,"-"],'; $strValuesU = '0,'; $strBounced = '0,'; }
46
- $intAvg = round($intUSum/30,0);
47
- $strValues = substr($strValues, 0, -1);
48
- $strValuesU = substr($strValuesU, 0, -1);
49
- $strLabels = substr($strLabels, 0, -1);
50
- $strBounced = substr($strBounced, 0, -1);
51
- $strCounter = substr($strCounter, 0, -1);
52
-
53
- /***************************************************************************/ ?>
54
- <div class="wp-piwik-graph-wide" title="<?php _e('The graph contains the values shown in the table below (visitors / unique / bounces). The red line show a linear trendline (unique).', 'wp-piwik'); ?>">
55
- <div id="wp-piwik_stats_vistors_graph" style="height:220px;<?php if (!isset($aryConf['inline']) || $aryConf['inline'] != true) { ?>width:100%<?php } ?>"></div>
56
- </div>
57
- <?php if (!isset($aryConf['inline']) || $aryConf['inline'] != true) { ?>
58
- <div class="table">
59
- <table class="widefat wp-piwik-table">
60
- <thead>
61
- <tr>
62
- <th><?php _e('Date', 'wp-piwik'); ?></th>
63
- <th class="n"><?php _e('Visits', 'wp-piwik'); ?></th>
64
- <th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
65
- <th class="n"><?php _e('Bounced', 'wp-piwik'); ?></th>
66
- <th class="n"><?php _e('Page Views', 'wp-piwik'); ?></th>
67
- </tr>
68
- </thead>
69
- <tbody style="cursor:pointer;">
70
- <?php /************************************************************************/
71
- if (is_array($aryConf['data']['Visitors'])) {
72
- $aryTmp = array_reverse($aryConf['data']['Visitors']);
73
- foreach ($aryTmp as $strDate => $intValue)
74
- echo '<tr onclick="javascript:datelink(\''.urlencode('wp-piwik_stats').'\',\''.str_replace('-', '', $strDate).'\',\''.(isset($_GET['wpmu_show_stats'])?(int) $_GET['wpmu_show_stats']:'').'\');"><td>'.$strDate.'</td><td class="n">'.
75
- $intValue.'</td><td class="n">'.
76
- $aryConf['data']['Unique'][$strDate].
77
- '</td><td class="n">'.
78
- $aryConf['data']['Bounced'][$strDate].
79
- '</td><td class="n">'.
80
- $aryConf['data']['Actions'][$strDate].
81
- '</td></tr>'."\n";
82
- }
83
- echo '<tr><td class="n" colspan="4"><strong>'.__('Unique TOTAL', 'wp-piwik').'</strong> '.__('Sum', 'wp-piwik').': '.$intUSum.' '.__('Avg', 'wp-piwik').': '.$intAvg.'</td></tr>';
84
- unset($aryTmp);
85
- /***************************************************************************/ ?>
86
- </tbody>
87
- </table>
88
- </div>
89
- <?php } ?>
90
- <script type="text/javascript">
91
- $plotVisitors = $j.jqplot('wp-piwik_stats_vistors_graph', [[<?php echo $strValues; ?>],[<?php echo $strValuesU; ?>],[<?php echo $strBounced;?>]],
92
- {
93
- axes:{yaxis:{min:0, tickOptions:{formatString:'%.0f'}},xaxis:{min:1,max:30,ticks:[<?php echo $strLabels; ?>]}},
94
- seriesDefaults:{showMarker:false,lineWidth:1,fill:true,fillAndStroke:true,fillAlpha:0.9,trendline:{show:false,color:'#C00',lineWidth:1.5,type:'exp'}},
95
- series:[{color:'#90AAD9',fillColor:'#D4E2ED'},{color:'#A3BCEA',fillColor:'#E4F2FD',trendline:{show:true,label:'Unique visitor trend'}},{color:'#E9A0BA',fillColor:'#FDE4F2'}],
96
- });
97
- </script>
98
- <?php
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dashboard/websites.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Stats:Websites
4
- **********************************/
5
-
6
- $aryConf['data'] = $this->callPiwikAPI(
7
- 'Referers.getWebsites',
8
- $aryConf['params']['period'],
9
- $aryConf['params']['date'],
10
- $aryConf['params']['limit']
11
- );
12
- $aryConf['title'] = __('Websites', 'wp-piwik');
13
-
14
- if (isset($aryConf['data']['result']) && $aryConf['data']['result'] = 'error')
15
- echo '<strong>'.__('Piwik error', 'wp-piwik').':</strong> '.htmlentities($aryConf['data']['message'], ENT_QUOTES, 'utf-8');
16
- else {
17
- /***************************************************************************/ ?>
18
- <table class="widefat">
19
- <thead>
20
- <tr>
21
- <th><?php _e('Website', 'wp-piwik'); ?></th>
22
- <th><?php _e('Unique', 'wp-piwik'); ?></th>
23
- </tr>
24
- </thead>
25
- <tbody>
26
- <?php /************************************************************************/
27
- if (is_array($aryConf['data'])) foreach ($aryConf['data'] as $aryValues)
28
- echo '<tr><td>'.$aryValues['label'].'</td><td>'.$aryValues['nb_uniq_visitors'].'</td></tr>';
29
- else echo '<tr><td colspan="2">'.__('No data available.', 'wp-piwik').'</td></tr>';
30
- /***************************************************************************/ ?>
31
- </tbody>
32
- </table>
33
- <?php /************************************************************************/
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
debug/.htaccess DELETED
@@ -1 +0,0 @@
1
- Deny from all
 
debug/testscript.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- /**
3
- * WP-Piwik
4
- * Piwik API call test script revision 4
5
- */
6
-
7
- /*****************
8
- * CONFIGURATION *
9
- *****************/
10
-
11
- // PIWIK URL, e.g. http://www.website.example/piwik
12
- $strPiwikURL = self::$settings->getGlobalOption('piwik_url');
13
- // PIWIK AUTH TOKEN, e.g. 1234a5cd6789e0a12345b678cd9012ef
14
- $strPiwikAuthToken = self::$settings->getGlobalOption('piwik_token');
15
- // YOUR BLOG'S URL, e.g. http://www.website.example
16
- $strPiwikYourBlogURL = get_bloginfo('url');
17
- // User agent
18
- $strUA = self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string');
19
-
20
- /* That's all, stop editing! */
21
-
22
- /**
23
- * Get remote file
24
- *
25
- * @param String $strURL Remote file URL
26
- */
27
- function getRemoteFile($strURL, $strToken, $bolSSL, $strUA) {
28
- // Use cURL if available
29
- if (function_exists('curl_init')) {
30
- // Init cURL
31
- $c = curl_init($strURL.$strToken);
32
- // Configure cURL CURLOPT_RETURNTRANSFER = 1
33
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
34
- // Verbose = 1
35
- curl_setopt($c, CURLOPT_VERBOSE, 1);
36
- // Configure cURL CURLOPT_HEADER = 1 & CURLINFO_HEADER_OUT = 1
37
- curl_setopt($c, CURLOPT_HEADER, 1);
38
- curl_setopt($c, CURLINFO_HEADER_OUT, 1);
39
- // Configure SSL peer verification
40
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, $bolSSL);
41
- // Set user agent
42
- curl_setopt($c, CURLOPT_USERAGENT, $strUA);
43
- // Get result
44
- $strResult = curl_exec($c);
45
- // Close connection
46
- curl_close($c);
47
- // cURL not available but url fopen allowed
48
- } elseif (ini_get('allow_url_fopen'))
49
- // Get file using file_get_contents
50
- $strResult = file_get_contents($strURL.$strToken);
51
- // Error: Not possible to get remote file
52
- else $strResult = serialize(array(
53
- 'result' => 'error',
54
- 'message' => 'Remote access to Piwik not possible. Enable allow_url_fopen or CURL.'
55
- ));
56
- // Return result
57
- return $strResult;
58
- }
59
-
60
- if (substr($strPiwikURL, -1, 1) != '/' && substr($strPiwikURL, -10, 10) != '/index.php')
61
- $strPiwikURL .= '/';
62
-
63
- $aryURLs = array();
64
- $aryURLs['SitesManager.getSitesWithAtLeastViewAccess'] = $strPiwikURL.'?module=API&method=SitesManager.getSitesWithAtLeastViewAccess&format=XML';
65
- $aryURLs['SitesManager.getSitesIdFromSiteUrl'] = $strPiwikURL.'?module=API&method=SitesManager.getSitesIdFromSiteUrl&url='.urlencode($strPiwikYourBlogURL).'&format=XML';
66
- $strToken = '&token_auth='.$strPiwikAuthToken;
67
- $intTest = 0;
68
- ?>
69
- <textarea readonly="readonly" rows="13" cols="100">
70
- <?php
71
- foreach ($aryURLs as $strMethod => $strURL) {
72
- $intTest++;
73
- echo '*** Test '.$intTest.'/'.count($aryURLs).': '.$strMethod.' ***'."\n";
74
- echo 'Using: '.(function_exists('curl_init')?'cURL':'fopen')."\n";
75
- echo 'SSL peer verification: '.(function_exists('curl_init') && !self::$settings->getGlobalOption('disable_ssl_verify')?'enabled':'disabled')."\n";
76
- echo 'User Agent: '.$strUA."\n";
77
- echo 'Call: '.$strURL.'&token_auth= + TOKEN'."\n";
78
- $x = microtime(true);
79
- $strResult = getRemoteFile($strURL,$strToken,!self::$settings->getGlobalOption('disable_ssl_verify'),$strUA);
80
- $x = microtime(true) - $x;
81
- echo 'Result:'."\n";
82
- echo htmlentities($strResult)."\n";
83
- echo 'Time: '.round($x,2).'s'.($intTest < count($aryURLs)?"\n\n":'');
84
- }
85
- ?>
86
- </textarea>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
debug/testscript_standalone.php DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
- /**
3
- * WP-Piwik
4
- * Piwik API call test script revision 4
5
- */
6
-
7
- /*****************
8
- * CONFIGURATION *
9
- *****************/
10
-
11
- // PIWIK URL, e.g. http://www.website.example/piwik
12
- $strPiwikURL = "";
13
- // PIWIK AUTH TOKEN, e.g. 1234a5cd6789e0a12345b678cd9012ef
14
- $strPiwikAuthToken = "";
15
- // YOUR BLOG'S URL, e.g. http://www.website.example
16
- $strPiwikYourBlogURL = "";
17
- // User agent
18
- $strUA = ini_get('user_agent');
19
- // SSL peer verification
20
- $bolDisableSSLVer = false;
21
-
22
- /* That's all, stop editing! */
23
-
24
- /**
25
- * Get remote file
26
- *
27
- * @param String $strURL Remote file URL
28
- */
29
- function getRemoteFile($strURL, $strToken, $bolSSL, $strUA) {
30
- // Use cURL if available
31
- if (function_exists('curl_init')) {
32
- // Init cURL
33
- $c = curl_init($strURL.$strToken);
34
- // Configure cURL CURLOPT_RETURNTRANSFER = 1
35
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
36
- // Verbose = 1
37
- curl_setopt($c, CURLOPT_VERBOSE, 1);
38
- // Configure cURL CURLOPT_HEADER = 1 & CURLINFO_HEADER_OUT = 1
39
- curl_setopt($c, CURLOPT_HEADER, 1);
40
- curl_setopt($c, CURLINFO_HEADER_OUT, 1);
41
- // Configure SSL peer verification
42
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, $bolSSL);
43
- // Set user agent
44
- curl_setopt($c, CURLOPT_USERAGENT, $strUA);
45
- // Get result
46
- $strResult = curl_exec($c);
47
- // Close connection
48
- curl_close($c);
49
- // cURL not available but url fopen allowed
50
- } elseif (ini_get('allow_url_fopen'))
51
- // Get file using file_get_contents
52
- $strResult = file_get_contents($strURL.$strToken);
53
- // Error: Not possible to get remote file
54
- else $strResult = serialize(array(
55
- 'result' => 'error',
56
- 'message' => 'Remote access to Piwik not possible. Enable allow_url_fopen or CURL.'
57
- ));
58
- // Return result
59
- return $strResult;
60
- }
61
-
62
- if (substr($strPiwikURL, -1, 1) != '/' && substr($strPiwikURL, -10, 10) != '/index.php')
63
- $strPiwikURL .= '/';
64
-
65
- $aryURLs = array();
66
- $aryURLs['SitesManager.getSitesWithAtLeastViewAccess'] = $strPiwikURL.'?module=API&method=SitesManager.getSitesWithAtLeastViewAccess&format=XML';
67
- $aryURLs['SitesManager.getSitesIdFromSiteUrl'] = $strPiwikURL.'?module=API&method=SitesManager.getSitesIdFromSiteUrl&url='.urlencode($strPiwikYourBlogURL).'&format=XML';
68
- $strToken = '&token_auth='.$strPiwikAuthToken;
69
- $intTest = 0;
70
- ?>
71
- <textarea readonly="readonly" rows="13" cols="100">
72
- <?php
73
- foreach ($aryURLs as $strMethod => $strURL) {
74
- $intTest++;
75
- echo '*** Test '.$intTest.'/'.count($aryURLs).': '.$strMethod.' ***'."\n";
76
- echo 'Using: '.(function_exists('curl_init')?'cURL':'fopen')."\n";
77
- echo 'SSL peer verification: '.(function_exists('curl_init') && !$bolDisableSSLVer?'enabled':'disabled')."\n";
78
- echo 'User Agent: '.$strUA."\n";
79
- echo 'Call: '.$strURL.'&token_auth= + TOKEN'."\n";
80
- $x = microtime(true);
81
- $strResult = getRemoteFile($strURL,$strToken,!$bolDisableSSLVer,$strUA);
82
- $x = microtime(true) - $x;
83
- echo 'Result:'."\n";
84
- echo htmlentities($strResult)."\n";
85
- echo 'Time: '.round($x,2).'s'.($intTest < count($aryURLs)?"\n\n":'');
86
- }
87
- ?>
88
- </textarea>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/wp-piwik.js CHANGED
@@ -1,3 +1,4 @@
1
- function datelink(strPage,strDate,intSite) {
2
- window.location.href='index.php?page='+strPage+'&date='+strDate+'&wpmu_show_stats='+intSite;
 
3
  }
1
+ function wp_piwik_datelink(strPage, strDate, intSite) {
2
+ window.location.href = 'index.php?page=' + strPage + '&date=' + strDate
3
+ + '&wpmu_show_stats=' + intSite;
4
  }
languages/wp-piwik-de_DE.mo CHANGED
Binary file
languages/wp-piwik-de_DE.po CHANGED
@@ -1,785 +1,1156 @@
1
- # Translation of the WordPress plugin WP-Piwik 0.8.0 by Andr&eacute; Br&auml;kling.
2
- # Copyright (C) 2010 Andr&eacute; Br&auml;kling
3
- # This file is distributed under the same license as the WP-Piwik package.
4
- # Andr&eacute; Br&auml;kling <webmaster@braekling.de>, 2011.
5
- #
6
- #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: WP-Piwik 0.8.4\n"
10
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-piwik\n"
11
- "POT-Creation-Date: 2010-07-19 18:06+0000\n"
12
- "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=utf-8\n"
17
  "Content-Transfer-Encoding: 8bit\n"
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- #: dashboard/browsers.php:12 dashboard/browsers.php:33
20
- msgid "Browser"
21
- msgstr "Browser"
22
 
23
- #: dashboard/browsers.php:22 dashboard/pages.php:43 dashboard/screens.php:22
24
- #: dashboard/systems.php:22
25
- msgid "Others"
26
- msgstr "Andere"
27
 
28
- #: dashboard/browsers.php:34 dashboard/keywords.php:17 dashboard/pages.php:22
29
- #: dashboard/screens.php:33 dashboard/systems.php:35 dashboard/visitors.php:53
30
- #: dashboard/websites.php:19 wp-piwik.php:305
31
- msgid "Unique"
32
- msgstr "Unique"
33
 
34
- #: dashboard/browsers.php:35 dashboard/plugins.php:33 dashboard/screens.php:34
35
- #: dashboard/systems.php:36
36
- msgid "Percent"
37
- msgstr "Prozent"
38
 
39
- #: dashboard/keywords.php:12
40
- msgid "Keywords"
41
- msgstr "Keywords"
42
 
43
- #: dashboard/keywords.php:17
44
- msgid "Keyword"
45
- msgstr "Keyword"
46
 
47
- #: dashboard/overview.php:12
48
- msgid "Overview"
49
- msgstr "&Uuml;bersicht"
50
 
51
- #: dashboard/overview.php:42 dashboard/visitors.php:24
52
- msgid "Visitors"
53
- msgstr "Besucher"
54
 
55
- #: dashboard/overview.php:43
56
- msgid "Unique visitors"
57
- msgstr "Eindeutige Besucher"
58
 
59
- #: dashboard/overview.php:44
60
- msgid "Page views"
61
- msgstr "Page Views"
62
 
63
- #: dashboard/overview.php:45
64
- msgid "Max. page views in one visit"
65
- msgstr "Max. Seiten/Besuch"
66
 
67
- #: dashboard/overview.php:46
68
- msgid "Total time spent"
69
- msgstr "Verbrachte Zeit"
 
70
 
71
- msgid "Time/visit"
72
- msgstr "Zeit/Besuch"
 
 
73
 
74
- #: dashboard/overview.php:47
75
- msgid "Bounce count"
76
- msgstr "Absprungrate"
 
 
 
77
 
78
- #: dashboard/overview.php:49 wp-piwik.php:563
79
- msgid "Shortcut"
80
- msgstr "Shortcut"
 
 
 
81
 
82
- #: dashboard/pages.php:13
83
- msgid "Pages"
84
- msgstr "Seiten"
 
 
 
85
 
86
- #: dashboard/pages.php:21
87
- msgid "Page"
88
- msgstr "Seite"
89
 
90
- #: dashboard/pages.php:23 dashboard/plugins.php:32 dashboard/visitors.php:52
91
- msgid "Visits"
92
- msgstr "Besuche"
93
 
94
- #: dashboard/plugins.php:12 dashboard/plugins.php:31
95
- msgid "Plugins"
96
- msgstr "Plugins"
97
 
98
- #: dashboard/screens.php:12 dashboard/screens.php:32
99
- msgid "Resolution"
100
- msgstr "Aufl&ouml;sung"
101
 
102
- #: dashboard/systems.php:12 dashboard/systems.php:34
103
- msgid "Operating System"
104
- msgstr "Betriebssystem"
105
 
106
- #: dashboard/visitors.php:51
107
- msgid "Date"
108
- msgstr "Datum"
 
 
 
 
109
 
110
- #: dashboard/visitors.php:54
111
- msgid "Bounced"
112
- msgstr "Abspr&uuml;nge"
113
 
114
- #: dashboard/visitors.php:67
115
- msgid "Unique TOTAL"
116
- msgstr "Unique GESAMT"
117
 
118
- #: dashboard/visitors.php:67
119
- msgid "Sum"
120
- msgstr "Summe"
121
 
122
- #: dashboard/visitors.php:67
123
- msgid "Avg"
124
- msgstr "Durchschnitt"
 
 
125
 
126
- #: dashboard/websites.php:12
127
- msgid "Websites"
128
- msgstr "Webseiten"
 
129
 
130
- #: dashboard/websites.php:18
131
- msgid "Website"
132
- msgstr "Webseite"
133
 
134
- #: wp-piwik.php:110 wp-piwik.php:365
135
- msgid "Piwik Statistics"
136
- msgstr "Piwik Statistiken"
 
137
 
138
- #. #-#-#-#-# plugin.pot (WP-Piwik 0.8.0) #-#-#-#-#
139
- #. Plugin Name of the plugin/theme
140
- #: wp-piwik.php:111 wp-piwik.php:122 wp-piwik.php:123 wp-piwik.php:146
141
- msgid "WP-Piwik"
142
- msgstr "WP-Piwik"
143
 
144
- #: wp-piwik.php:130 wp-piwik.php:131
145
- msgid "WPMU-Piwik"
146
- msgstr "WPMU-Piwik"
 
147
 
148
- #: wp-piwik.php:142 wp-piwik.php:557
149
- msgid "yesterday"
150
- msgstr "gestern"
 
 
151
 
152
- #: wp-piwik.php:143 wp-piwik.php:558
153
- msgid "today"
154
- msgstr "heute"
 
155
 
156
- #: wp-piwik.php:144 wp-piwik.php:559
157
- msgid "last30"
158
- msgstr "letzte 30 Tage"
 
 
159
 
160
- #: wp-piwik.php:144 wp-piwik.php:559
161
- msgid "last 30 days"
162
- msgstr "letzte 30 Tage"
163
 
164
- #: wp-piwik.php:179
165
- msgid "Settings"
166
- msgstr "Einstellungen"
167
 
168
- #: wp-piwik.php:381
169
- msgid "Change"
170
- msgstr "&Auml;ndern"
171
 
172
- #: wp-piwik.php:382
173
- msgid "Currently shown stats:"
174
- msgstr "Derzeit gezeigte Statistiken:"
 
 
175
 
176
- #: wp-piwik.php:383
177
- msgid "Current shown stats: <strong>Overall</strong>"
178
- msgstr "Derzeit gezeigte Statistiken: <strong>Gesamt</strong>"
179
 
180
- #: wp-piwik.php:448
181
- msgid "WP-Piwik Settings"
182
- msgstr ""
183
 
184
- #: wp-piwik.php:455 wp-piwik.php:617
185
- msgid "Account settings"
186
- msgstr "Account-Einstellungen"
187
 
188
- #: wp-piwik.php:457 wp-piwik.php:619
189
- msgid "Piwik URL"
190
- msgstr "Piwik URL"
 
 
191
 
192
- #: wp-piwik.php:461 wp-piwik.php:623
193
  msgid "Auth token"
194
  msgstr "Auth Token"
195
 
196
- #: wp-piwik.php:467 wp-piwik.php:628
197
- msgid "To enable Piwik statistics, please enter your Piwik"
198
- " base URL (like http://mydomain.com/piwik) and your"
199
- " personal authentification token. You can get the token"
200
- " on the API page inside your Piwik interface. It looks"
201
- " like &quot;1234a5cd6789e0a12345b678cd9012ef&quot;."
202
- msgstr "Um Piwik Statistiken abrufen zu können, musst Du die URL zu Deiner Piwik-Installation (z.B. http://mydomain.com/piwik) und deinen persönlichen Authentifizierungs-Schüssel (Token) angeben. Du findest den Token auf der API-Seite in Deinem Piwik-Interface. Er sieht z.B. so aus: &quot;1234a5cd6789e0a12345b678cd9012ef&quot;."
203
-
204
- #: wp-piwik.php:477
205
  msgid ""
206
- "<strong>Important note:</strong> If you do not host this blog on your own, "
207
- "your site admin is able to get your auth token from the database. So he is "
208
- "able to access your statistics. You should never use an auth token with more "
209
- "than simple view access!"
210
- msgstr "<strong>Wichtiger Hinweis:</strong> Wenn Du dieses Blog nicht selber hostest, kann Dein Site Admin Deinen Auth Token aus der Datenbank auslesen. Dadurch kann er auf Deine Statistiken zugreifen. Du solltest niemals einen Auth Token mit mehr als einfachen View-Rechten verwenden! "
211
 
212
- #: wp-piwik.php:485 wp-piwik.php:489
213
- msgid "An error occured"
214
- msgstr "Ein Fehler ist aufgetreten"
 
 
 
 
 
215
 
216
- #: wp-piwik.php:486
217
  msgid ""
218
- "Please check URL and auth token. You need at least view access to one site."
219
- msgstr "Bitte &uuml;berpr&uuml;fe die URL und den auth token. Du ben&ouml;tigst zumindest View-Zugriff auf eine Seite."
 
220
 
221
- #: wp-piwik.php:492
222
- msgid "Choose site"
223
- msgstr "Seite"
224
 
225
- #: wp-piwik.php:511 wp-piwik.php:547 wp-piwik.php:584 wp-piwik.php:658
226
- msgid "Save settings"
227
- msgstr "Einstellungen speichern"
228
 
229
- #: wp-piwik.php:515 wp-piwik.php:643
230
- msgid "Tracking settings"
231
- msgstr "Tracking-Einstellungen"
232
 
233
- #: wp-piwik.php:521
234
- msgid "Add script"
235
- msgstr "Tracking"
236
 
237
- #: wp-piwik.php:525
238
- msgid "If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog."
239
- msgstr "Wenn Dein Template wp_footer() verwendet, kann WP-Piwik den JavaScript Code automatisch in Dein Blog einf&uuml;gen."
 
240
 
241
- #: wp-piwik.php:528
242
- msgid "Track 404"
243
- msgstr "404-Tracking"
 
244
 
245
- #: wp-piwik.php:532
246
- msgid "WP-Piwik can automatically add a 404-category to track 404-page-visits."
247
- msgstr "WP-Piwik kann automatisch eine eigene Kategorie f&uuml;r 404-Seiten hinzuf&uuml;gen."
248
 
249
- #: wp-piwik.php:536 wp-piwik.php:644
250
- msgid "Tracking filter"
251
- msgstr "Tracking-Filter"
252
 
253
- msgid "Choose users by user role you do <strong>not</strong> want to track."
254
- msgstr "W&auml;hle diejenigen Nutzerrollen, die Du <strong>nicht</strong> erfassen willst."
 
255
 
256
- msgid "Choose users by user role you do <strong>not</strong> want to track. Requires enabled &quot;Add script&quot;-functionality."
257
- msgstr "W&auml;hle diejenigen Nutzerrollen, die Du <strong>nicht</strong> erfassen willst. Dazu muss die &quot;Tracking&quot;-Funktion aktiviert sein."
 
258
 
259
- #: wp-piwik.php:551
260
- msgid "Statistic view settings"
261
- msgstr "Statistik-Einstellungen"
262
 
263
- #: wp-piwik.php:554
264
- msgid "Dashboard"
265
- msgstr "Dashboard"
266
 
267
- #: wp-piwik.php:556
268
- msgid "No"
269
- msgstr "Nein"
270
 
271
- #: wp-piwik.php:557 wp-piwik.php:558 wp-piwik.php:559
272
- msgid "Yes"
273
- msgstr "Ja"
 
274
 
275
- #: wp-piwik.php:562
276
- msgid "Display a dashboard widget to your WordPress dashboard."
277
- msgstr "F&uuml;gt Deinem WordPress Dashboard ein Widget hinzu."
278
 
279
- #: wp-piwik.php:567
280
- msgid "Display a shortcut to Piwik itself."
281
- msgstr "Zeigt einen Shortcut zu Piwik an."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
 
283
- #: wp-piwik.php:568
284
- msgid "Display to"
285
- msgstr "Anzeigen f&uuml;r"
286
 
287
- #: wp-piwik.php:579
 
 
 
 
288
  msgid "Choose user roles allowed to see the statistics page."
289
  msgstr "W&auml;hle diejenigen Nutzerrollen, die sich die Statistiken ansehen d&uuml;rfen."
290
 
291
- #: wp-piwik.php:612
292
- msgid "WPMU-Piwik Settings"
293
- msgstr "WPMU-Piwik Einstellungen"
294
 
295
- #: wp-piwik.php:636
296
- msgid ""
297
- "<strong>Important note:</strong> You have to choose a token which provides "
298
- "administration access. WPMU-Piwik will create new Piwik sites for each blog "
299
- "if it is shown the first time and it is not added yet. All users can access "
300
- "their own statistics only, while site admins can access all statistics. To "
301
- "avoid conflicts, you should use a clean Piwik installation without other "
302
- "sites added. The provided themes should use wp_footer, because it adds the "
303
- "Piwik javascript code to each page."
304
- msgstr "<strong>Wichtiger Hinweis:</strong> Du solltest einen Token mit Adminstrator-Zugang angeben. WPMU-Piwik erstellt "
305
- "f&uuml;r jedes Blog eine eigene Piwik Site, sobald es zum ersten Mal angezeigt wird. Nutzer k&ouml;nnen nur ihre eigenen "
306
- "Statistiken einsehen, w&auml;hrend Site Admins Zugriff auf alle Statistiken haben. Um Konflikte zu vermeiden, solltest Du "
307
- "eine neue Piwik-Installation ohne andere Sites verwenden. Alle verwendeten Themes sollten wp_footer benutzen, da diese "
308
- "Funktion den Piwik JavaScript Code zu jeder Seite hinzuf&uuml;gt."
309
-
310
- #: wp-piwik.php:671
311
- msgid "If you like WP-Piwik, you can support its development by a donation:"
312
- msgstr "Wenn Dir WP-Piwik gef&auml;llt, kannst Du die weitere Entwicklung mit einer Spende f&ouml;rdern:"
313
 
314
- #: wp-piwik.php:687
315
- msgid "My Amazon.de wishlist (German)"
316
- msgstr "Meine Amazon.de Wunschliste (Deutsch)"
317
 
318
- #. Plugin URI of the plugin/theme
319
- msgid "http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress/"
320
- msgstr "http://www.braekling.de/wp-piwik-wpmu-piwik-wordpress/"
321
 
322
- #. Description of the plugin/theme
323
- msgid ""
324
- "Adds Piwik stats to your dashboard menu and Piwik code to your wordpress "
325
- "footer."
326
- msgstr "F&uuml;gt Piwik-Statistiken zu Deinem Dashboard-Men&uuml; hinzu und "
327
- "kann den Piwik-Tracking-Code in den Blog-Footer einf&uuml;gen."
328
 
329
- #. Author of the plugin/theme
330
- msgid "Andr&eacute; Br&auml;kling"
331
- msgstr "Andr&eacute; Br&auml;kling"
332
 
333
- #. Author URI of the plugin/theme
334
- msgid "http://www.braekling.de"
335
- msgstr "http://www.braekling.de"
336
 
337
- msgid "Credits"
338
- msgstr "Danksagungen"
 
339
 
340
- msgid "Thank you very much for your donation"
341
- msgstr "Vielen Dank f&uuml;r eure Spenden"
 
342
 
343
- msgid "and all people flattering this"
344
- msgstr "und alle Nutzern, die bei Flatter klicken"
 
 
 
 
345
 
346
- msgid "Graphs powered by <a href=\"http://www.jqplot.com/\">jqPlot</a>, an open source project by Chris Leonello. Give it a try! (License: GPL 2.0 and MIT)"
347
- msgstr "Die Graphen werden mit <a href=\"http://www.jqplot.com/\">jqPlot</a> erstellt, einem Open-Source-Projekt von Chris Leonello. Probiere es mal aus! (Lizenz: GPL 2.0 und MIT)"
 
 
348
 
349
- msgid "Thank you very much"
350
- msgstr "Vielen Dank"
 
351
 
352
- msgid ", and"
353
- msgstr " und"
 
 
354
 
355
- msgid "for your translation work"
356
- msgstr "f&uuml;r eure &Uuml;bersetzungsarbeit"
 
 
 
357
 
358
- msgid "Thank you very much, all users who send me mails containing criticism, commendation, feature requests and bug reports! You help me to make WP-Piwik much better."
359
- msgstr "Vielen Dank an alle Nutzer, die mir Mails mit Kritik, Lob, Featurew&uuml;nsche und Bugmeldungen senden. Ihr helft mir dabei, WP-Piwik viel besser zu machen."
 
 
360
 
361
- msgid "Thank <strong>you</strong> for using my plugin. It is the best commendation if my piece of code is really used!"
362
- msgstr "Vielen Dank an <strong>Dich</strong> f&uuml;r die Nutzung meines Plugins. Es ist das gr&ouml;&szlig;te Lob, wenn mein Code tats&auml;chlich benutzt wird!"
 
 
363
 
364
- msgid "Changes saved"
365
- msgstr "&Auml;nderungen gespeichert"
 
366
 
367
- msgid "%s %s installed."
368
- msgstr "%s %s installiert."
 
 
 
 
369
 
370
- msgid "Next you should connect to Piwik"
371
- msgstr "Als n&auml;chstes solltest Du eine Verbindung zu Piwik herstellen"
 
 
372
 
373
- msgid "Please validate your configuration"
374
- msgstr "Bitte &uuml;berpr&uuml;fe Deine Konfiguration"
 
 
 
 
375
 
376
- msgid "Default date"
377
- msgstr "Default-Datum"
 
378
 
379
- msgid "Default date shown on statistics page."
380
- msgstr "Default-Datum, das auf der Statistik-Seite gezeigt wird."
 
381
 
382
- msgid "Dashboard data"
383
- msgstr "Board-Daten"
 
384
 
385
- msgid "Display an overview widget to your WordPress dashboard."
386
- msgstr "Zeigt ein &Uuml;bersichts-Widget auf dem WordPress-Dashboard."
 
387
 
388
- msgid "Board chart"
389
- msgstr "Board-Chart"
 
390
 
391
- msgid "Display a visitor graph widget to your WordPress dashboard."
392
- msgstr "Zeigt einen Besucher-Graph als Widget auf dem WordPress-Dashboard."
 
393
 
394
- msgid "No data available."
395
- msgstr "Keine Daten vorhanden."
 
 
396
 
397
- msgid "Check this to automatically choose your blog from your Piwik sites by URL. If your blog is not added to Piwik yet, WP-Piwik will add a new site."
398
- msgstr "Aktiviere diesen Haken, um Dein Blog &uuml;ber seine URL automatisch aus Deinen Piwik-Seiten auszuw&auml;hlen. Wenn Dein Blog bisher nicht zu Piwik hinzugef&uuml;gt wurde, wird WP-Piwik eine neue Seite hinzuf&uuml;gen."
 
399
 
400
- msgid "If you add the Piwik javascript code by wp_footer(),"
401
- msgstr "Wenn Du den Piwik-Code per wp_footer() in Dein Blog einbindest,"
 
402
 
403
- msgid "WP-Piwik can automatically use js/index.php instead of piwik.js. See"
404
- msgstr "WP-Piwik kann automatisch js/index.php statt piwik.js verwenden. Siehe"
 
405
 
406
- msgid "WP-Piwik can automatically force the Tracking Code to sent data in POST. See"
407
- msgstr "WP-Piwik kann automatisch den Tracking Code zwingen, die Daten via POST zu senden. Siehe"
 
 
408
 
409
- msgid "Avoid mod_security"
410
- msgstr "Umgehe mod_security"
 
411
 
412
- msgid "Determined site"
413
- msgstr "Ermittelte Seite"
 
414
 
415
- msgid "Auto config"
416
- msgstr "Auto-Konfiguration"
 
417
 
418
- msgid "Use js/index.php"
419
- msgstr "Nutze js/index.php"
 
420
 
421
- msgid "Show overview"
422
- msgstr "Zeige &Uuml;bersicht"
 
423
 
424
- msgid "Hide overview"
425
- msgstr "Zeige keine &Uuml;bersicht"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
 
427
- msgid "SEO <em>(slow!)</em>"
428
- msgstr "SEO <em>(langsam!)</em>"
 
 
429
 
430
- msgid "Display SEO ranking data on statistics page. <em>(Slow!)</em>"
431
- msgstr "Zeige SEO-Rankingdaten auf der Statistik-Seite. <em>(Langsam!)</em>"
 
432
 
433
- msgid "Configure WP-Piwik widgets to be shown on your WordPress Home Dashboard."
434
- msgstr "Konfiguriere WP-Piwik-Widgets, die auf Deinem WordPress Home Dashboard erscheinen sollen."
 
435
 
436
- msgid "SEO data"
437
- msgstr "SEO-Daten"
 
438
 
439
- msgid "the Piwik team itself"
440
- msgstr "das Piwik-Team selbst"
 
441
 
442
- msgid "Metabox support inspired by"
443
- msgstr "Die Metabox-Unterst&uuml;tzung wurde inspiriert von"
 
444
 
445
- msgid "WP-Piwik support board"
446
- msgstr "WP-Piwik Support Board"
 
 
 
447
 
448
- msgid "no registration required, English &amp; German"
449
- msgstr "keine Registrierung erforderlich, Englisch &amp; Deutsch"
 
450
 
451
- msgid "WordPress.org forum about WP-Piwik"
452
- msgstr "WordPress.org Forum &uuml;ber WP-Piwik"
 
453
 
454
- msgid "WordPress.org registration required, English"
455
- msgstr "Registrierung bei WordPress.org notwendig, Englisch"
 
456
 
457
- msgid "Please don't forget to vote the compatibility at the"
458
- msgstr "Bitte denke daran, eine Kompatibilit&auml;tsbewertung abzugeben:"
 
 
 
459
 
460
- msgid "Donate"
461
- msgstr "Spenden"
 
462
 
463
- msgid "My Amazon.de wishlist"
464
- msgstr "Meine Wunschliste bei Amazon.de"
 
465
 
466
- msgid "Piwik error"
467
- msgstr "Piwik-Fehler"
 
468
 
469
- msgid "Important"
470
- msgstr "Wichtig"
 
471
 
472
- msgid "Thanks for using WP-Piwik!"
473
- msgstr "Vielen Dank f&uuml;r die Verwendung von WP-Piwik!"
 
 
 
474
 
475
- msgid "Auto site configuration is"
476
- msgstr "Die Auto-Konfiguration ist"
 
477
 
478
- msgid "Tracking code insertion is"
479
- msgstr "Das Einf&uuml;gen des Tracking-Codes ist"
 
480
 
481
- msgid "enabled"
482
- msgstr "aktiviert"
 
483
 
484
- msgid "disabled"
485
- msgstr "deaktiviert"
 
486
 
487
- msgid "You are using Piwik"
488
- msgstr "Du verwendest Piwik"
 
489
 
490
- msgid "and"
491
- msgstr "und"
 
492
 
493
- msgid "Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won't be able to connect to Piwik."
494
- msgstr "Fehler: cURL ist nicht aktiviert und fopen darf keine URLs &ouml;ffnen. WP-Piwik kann so keine Verbindung zu Piwik aufbauen."
 
495
 
496
- msgid "<strong>Important note:</strong> If you do not host this blog on your own, your site admin is able to get your auth token from the database."
497
- msgstr "<strong>Wichtiger Hinweis:</strong> Wenn Du dieses Blog nicht selber hostest, kann Dein Site Admin Deinen Auth Token aus der Datenbank auslesen."
 
498
 
499
- msgid "Add tracking code"
500
- msgstr "Tracking-Code einf&uuml;gen"
 
501
 
502
- msgid "Tracking code preview"
503
- msgstr "Tracking-Code Vorschau"
 
504
 
505
- msgid "Piwik Settings"
506
- msgstr "Piwik Einstellungen"
 
507
 
508
- msgid "Statistics"
509
- msgstr "Statistiken"
 
510
 
511
- msgid "Either allow_url_fopen has to be enabled <em>or</em> cURL has to be available:"
512
- msgstr "Entweder allow_url_fopen muss aktiviert <em>oder</em> cURL muss verf&uuml;gbar sein:"
 
 
 
513
 
514
- msgid "cURL is"
515
- msgstr "cURL ist"
 
516
 
517
- msgid "allow_url_fopen is"
518
- msgstr "allow_url_fopen ist"
 
519
 
520
- msgid "not"
521
- msgstr "nicht"
 
522
 
523
- msgid "available"
524
- msgstr "verf&uuml;gbar"
 
525
 
526
- msgid "Test script result"
527
- msgstr "Ergebnis des Testskripts"
 
528
 
529
- msgid "Please confirm your reset request"
530
- msgstr "Bitte best&auml;tige Deine Reset-Anweisung"
 
531
 
532
- msgid "YES, please reset <strong>all</strong> WP-Piwik settings <strong>except</strong> auth token and Piwi URL."
533
- msgstr "JA, bitte setze <strong>alle</strong> WP-Piwik Einstellung au&szlig;er Auth Token und Piwik URL zur&uuml;ck."
 
534
 
535
- msgid "WP-Piwik reset done"
536
- msgstr "WP-Piwik wurde zur&uuml;ckgesetzt"
 
537
 
538
- msgid "Get more debug information"
539
- msgstr "Erhalte weitere Debug-Informationen"
 
540
 
541
- msgid "Run test script"
542
- msgstr "Starte Testskript"
 
543
 
544
- msgid "Get site configuration details"
545
- msgstr "Ermittle Detailinformationen zur Seitenkonfiguration"
 
546
 
547
- msgid "Reset WP-Piwik settings except auth token and Piwik URL"
548
- msgstr "Setzte die Einstellungen von WP-Piwik mit Ausnahme von Auth Token und Piwik URL zur&uuml;ck."
 
549
 
550
- msgid "You have to enter your auth token and the Piwik URL before you can access more debug functions."
551
- msgstr "Du musst Deinen Auth Token und die Piwik URL eingeben, bevor Du auf weitere Debug-Funktionen zugreifen kannst."
 
552
 
553
- msgid "Latest support threads on WordPress.org"
554
- msgstr "Die letzten Support-Beitr&auml;ge auf WordPress.org"
 
 
555
 
556
- msgid "This will not affect Piwik itself. Resetting large networks may take some minutes."
557
- msgstr "Dies hat keinen Einfluss auf Piwik selbst. Das Zur&uuml;cksetzen gro&szlig;er Netzwerke kann einige Minuten dauern."
 
 
 
558
 
559
- msgid ", and all people flattering this"
560
- msgstr " und allen, die WP-Piwik flattrn"
 
561
 
562
- msgid "Disable time limit"
563
- msgstr "Zeitlimit deaktivieren"
 
564
 
565
- msgid "Use set_time_limit(0) if stats page causes a time out."
566
- msgstr "Verwende set_time_limit(0) falls die Statistik-Seite einen Timeout erzeugt."
 
567
 
568
- msgid "in network mode"
569
- msgstr "im Netzwerk-Modus"
 
570
 
571
- msgid "To enable Piwik statistics, please enter"
572
- msgstr "Um die Piwik-Statistiken zu aktivieren, gibt bitte die folgenden Daten ein:"
 
573
 
574
- msgid "your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server path (like /var/www/mydomain.com/httpdocs/piwik/)"
575
- msgstr "Die URL Deiner Piwik-Installation (z.B. http://mydomain.com/piwik) oder den Serverpfad zu Deiner Piwik-Installation (z.B. /var/www/mydomain.com/httpdocs/piwik/)"
 
576
 
577
- msgid "your personal Piwik authentification token. You can get the token on the API page inside your Piwik interface. It looks like &quot;1234a5cd6789e0a12345b678cd9012ef&quot;."
578
- msgstr "Deinen pers&ouml;nlichen Piwik Authentifikations-Token. Du findest ihn auf der API-Seite des Piwik-Interfaces. Er sieht z.B. so aus: &quot;1234a5cd6789e0a12345b678cd9012ef&quot;."
 
 
 
579
 
580
- msgid "No idea what I'm talking about?"
581
- msgstr "Keine Idee, wovon ich rede?"
 
582
 
583
- msgid "Get help."
584
- msgstr "Hier gibt es Hilfe."
 
585
 
586
- msgid "Piwik path"
587
- msgstr "Piwik Pfad"
 
588
 
589
- msgid "Disable cookies"
590
- msgstr "Cookies deaktivieren"
 
 
591
 
592
- msgid "Disable all tracking cookies for a visitor."
593
- msgstr "Schalte alle Tracking-Cookies f&uuml;r Besucher ab."
 
594
 
595
- msgid "Show graph on WordPress Toolbar"
596
- msgstr "Zeige einen Graphen in der WordPress Toolbar"
 
597
 
598
- msgid "Display the last 30 days visitor stats on WordPress Toolbar."
599
- msgstr "Zeige die Besucherstatistik der letzten 30 Tage in der WordPress Toolbar an."
 
600
 
601
- msgid "Graphs powered by <a href=\"http://www.jqplot.com/\">jqPlot</a> (License: GPL 2.0 and MIT) and <a href=\"http://omnipotent.net/jquery.sparkline/\">jQuery Sparklines</a> (License: New BSD License)."
 
 
 
 
 
602
  msgstr "Die Graphen werden mit <a href=\"http://www.jqplot.com/\">jqPlot</a> (Lizenz: GPL 2.0 and MIT) und <a href=\"http://omnipotent.net/jquery.sparkline/\">jQuery Sparklines</a> (Lizenz: New BSD License) erstellt."
603
 
 
 
 
 
 
604
  msgid "Tabbed settings page suggested by the"
605
  msgstr "Die Tabs f&uuml;r die Einstellungen wurden inspiriert von einem Artikel im"
606
 
607
- msgid "If you like to use the PHP API and also to enable tracking by WP-Piwik, please enter your Piwik URL, too. Otherwise your tracking code may be erroneous."
608
- msgstr "Falls Du die PHP API verwenden und das Tracking per WP-Piwik aktivieren willst, gib bitte auch Deine Piwik URL an. Andernfalls k&ouml;nnte Dein Tracking Code fehlerhaft sein."
 
609
 
610
- msgid "Title"
611
- msgstr "Titel"
 
612
 
613
- msgid "Site ID (Piwik)"
614
- msgstr "Seiten-ID (Piwik)"
 
 
 
 
615
 
616
- msgid "Expert Settings"
617
- msgstr "Expertenkonfiguration"
 
 
 
618
 
619
- msgid "Disable SSL peer verification"
620
- msgstr "SSL Peer-Verifikation deaktivieren"
 
621
 
622
- msgid "not recommended"
623
- msgstr "Nicht empfohlen"
 
624
 
625
- msgid "Invalid path. Please enter the file path to Piwik."
626
- msgstr "Ung&uuml;ltiger Pfad. Bitte gib den Dateipfad von Piwik an."
 
627
 
628
- msgid "Enable shortcodes in post or page content."
629
- msgstr "Aktiviere Shortcodes innerhalb von Artikeln und Seiten."
 
 
 
630
 
631
- msgid "Connection timeout"
632
- msgstr "Verbindungs-Timeout"
 
633
 
634
- msgid "User agent"
635
- msgstr "User Agent"
 
 
636
 
637
- msgid "Default tracking"
638
- msgstr "Standard-Tracking"
 
639
 
640
- msgid "Use proxy script"
641
- msgstr "Verwende Proxy-Skript"
 
642
 
643
- msgid "WP-Piwik uses the Piwik default tracking code."
644
- msgstr "WP-Piwik verwendet den normalen Tracking Code."
 
645
 
646
- msgid "WP-Piwik can automatically use js/index.php instead of piwik.js and piwik.php. See"
647
- msgstr "WP-Piwik kann automatisch js/index.php statt piwik.js und piwik.php verwenden. Siehe"
 
648
 
649
- msgid "WP-Piwik will use the piwik.php proxy script. See"
650
- msgstr "WP-Piwik benutzt das piwik.php-Proxy-Skript, siehe"
 
651
 
652
- msgid "Enable shortcodes"
653
- msgstr "Aktiviere Shortcodes"
 
654
 
655
- msgid "Requests"
656
- msgstr "Anfragen"
 
657
 
658
- msgid "Site Search Keywords"
659
- msgstr "Suchanfragen"
 
660
 
661
- msgid "Site Search without Results"
662
- msgstr "Suchanfragen ohne Ergebnisse"
 
663
 
664
- msgid "Disabled in proxy mode."
665
- msgstr "Im Proxy-Modus deaktiviert."
 
666
 
667
- msgid "Leave blank if you do not want to define a CDN URL or you do not know what this is."
668
- msgstr "Einfach freilassen, falls Du keine CDN URL definieren m&ouml;chtest oder nicht wei&szlig;t, worum es geht."
 
669
 
670
- msgid "Adds the &lt;noscript&gt; code to your footer."
671
- msgstr "F&uuml;gt den &lt;noscript&gt;-Code im Footer ein."
 
672
 
673
- msgid "Use Piwik's advanced Site Search Analytics feature. See"
674
- msgstr "Benutze Piwiks erweiterte Site Search Analyse. Siehe"
 
675
 
676
- msgid "Enable tracking for visitors without JavaScript (not recommended). See"
677
- msgstr "Aktiviere das Tracking von Besuchern ohne JavaScript (nicht empfohlen). Siehe"
 
678
 
679
- msgid "Add rec parameter to noscript code"
680
- msgstr "F&uuml;ge rec-Parameter zum noscript Code hinzu"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
681
 
682
- msgid "Add &lt;noscript&gt;"
683
- msgstr "F&uuml;ge &lt;noscript&gt; hinzu"
 
 
 
 
 
 
684
 
685
- msgid "Cache API calls, which not contain today's values, for a week"
686
- msgstr "Cache alle API-Aufrufe, die keine heutigen Daten enthalten, f&uuml;r eine Woche"
 
 
687
 
688
- msgid "Enable cache"
689
- msgstr "Cache einschalten"
 
690
 
691
- msgid "This will add Piwik campaign parameters to the RSS feed links."
692
- msgstr "Dadurch werden Piwik Kampagnen-Parameter an die Links des RSS-Feeds angehangen."
 
693
 
694
- msgid "Campaign"
695
- msgstr "Kampagne"
 
696
 
697
- msgid "Keyword: post name."
698
- msgstr "Schl&uuml;sselwort: Name des Beitrags."
 
699
 
700
- msgid "Enable to track posts in feeds via tracking pixel."
701
- msgstr "Aktivieren, um Beitr&auml;ge im Feed via Tracking-Pixel zu z&auml;hlen."
 
702
 
703
- msgid "Enable to track users on admin pages (remember to configure the tracking filter appropriately)."
704
- msgstr "Aktivieren, um Nutzer auf Admin-Seiten zu z&auml;hlen (bitte den Tracking Filter entsprechend konfigurieren)."
 
 
705
 
706
- msgid "Track RSS feed links as campaign"
707
- msgstr "Links in RSS-Feeds als Kampagne tracken"
 
 
 
 
 
708
 
709
- msgid "Show stats about single posts at the post edit admin page."
710
- msgstr "Zeige Statistiken zu einzelnen Beitr&auml;gen auf der Bearbeiten-Seite."
 
 
 
 
711
 
712
- msgid "Show per post stats"
713
- msgstr "Zeige Beitrags-Statistiken"
 
714
 
715
- msgid "Add data-cfasync=false"
716
- msgstr "data-cfasync=false einf&uuml;gen"
 
 
 
717
 
718
- msgid "Track admin pages"
719
- msgstr "Admin-Seiten tracken"
 
 
 
720
 
721
- msgid "Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to ignore the script."
722
- msgstr "Fügt data-cfasync=false zum Script-Tag hinzu, z.B. damit Rocket Loader das Skript ignoriert."
 
723
 
724
- msgid "Add annotation on new post"
725
- msgstr "Notiz bei neuem Post"
 
 
 
 
 
 
 
726
 
727
- msgid "Add a Piwik annotation on each new post, see"
728
- msgstr "F&uuml;gt in Piwik f&uuml;r jeden neuen Post eine Notiz hinzu, siehe"
 
 
729
 
730
- msgid "JavaScript code position"
731
- msgstr "Position des JavaScript-Codes"
 
 
 
732
 
733
- msgid "Choose whether the JavaScript code is added to the footer or the header."
734
- msgstr "W&auml;hle, ob der JavaScript-Code im Footer oder im Header eingef&uuml;gt werden soll."
 
735
 
736
- msgid "Show custom variables box"
737
- msgstr "Zeige Custom-Variables-Box"
 
738
 
739
- msgid "Show a custom vars edit box on post edit page."
740
- msgstr "Zeige eine Custom-Variables-Eingabebox auf den Edit-Post-Seiten."
 
741
 
742
- msgid "Limit cookie lifetime"
743
- msgstr "Cookie-Lebensdauer beschr&auml;nken"
 
744
 
745
- msgid "Limit cookie lifetime as follows"
746
- msgstr "Beschr&auml;nke die Cookie-Lebensdauer wie folgt"
 
747
 
748
- msgid "Session timeout (seconds)"
749
- msgstr "Session-Timeout (Sekunden)"
 
750
 
751
- msgid "Visitor timeout (seconds)"
752
- msgstr "Besucher-Timeout (Sekunden)"
 
753
 
754
- msgid "Track visitors across all subdomains"
755
- msgstr "Besucher &uuml;ber alle Subdomains aufzeichnen"
 
756
 
757
- msgid "Adds *.-prefix to cookie domain."
758
- msgstr "F&uuml;gt ein *.-Pr&auml;fix zur Cookie Domain hinzu."
 
759
 
760
- msgid "WP-Piwik requires at least PHP 5.3. You are using the deprecated version %s. Please update PHP to use WP-Piwik."
761
- msgstr "WP-Piwik ben&ouml;tigt zumindest PHP 5.3. Du verwendest die veraltete Version %s. Bitte aktualisiere PHP um WP-Piwik zu nutzen."
 
762
 
763
- msgid "Track visitors across all alias URLs"
764
- msgstr "Besucher &uuml;ber alle alternative URLs aufzeichnen"
 
765
 
766
- msgid "Adds *.-prefix to tracked domain."
767
- msgstr "F&uuml;gt ein *.-Pr&auml;fix zur getrackten Domain hinzu."
 
768
 
769
- msgid "Add new file types for download tracking"
770
- msgstr "Neue Dateitypen f&uuml;r das Download-Tracking hinzuf&uuml;gen"
 
771
 
772
- msgid "Add file extensions for download tracking, divided by a vertical bar (&#124;), see"
773
- msgstr "F&uuml;ge weitere Dateiendungen getrennt durch einen senkrechten Strich (&#124;) f&uuml;r das Download-Tracking hinzu, siehe"
 
774
 
775
- msgid "Force Piwik to use a specific protocol"
776
- msgstr "Zwinge Piwik ein konkretes Protokoll zu verwenden"
 
777
 
778
- msgid "Disabled (default)"
779
- msgstr "Deaktiviert (Standard)"
 
 
 
 
 
 
 
 
 
 
 
 
 
780
 
781
- msgid "Choose if you want to explicitly force Piwik to use HTTP or HTTPS. Does not work with a CDN URL."
782
- msgstr "Ausw&auml;hlen, um Piwik ausdr&uuml;cklich dazu zu zwingen, HTTP oder HTTPS zu verwenden. Funktioniert nicht mit einer CDN URL."
 
 
 
 
 
783
 
784
- msgid "To use this plugin you will need your own Piwik instance. If you do not already have a Piwik setup, you have two simple options: use either <a href='%s'>Self-hosted</a> or <a href='%s'>Cloud-hosted</a>."
785
- msgstr "Um dieses Plugin zu nutzen, wird eine Piwik-Instanz ben&ouml;tigt. Sofern Du &uuml;ber keine verf&uuml;gst, hast Du zwei einfache M&ouml;glichkeiten: entweder Du <a href='%s'>hostest Piwik selbst</a> oder Du <a href='%s'>verwendest die Cloud</a>."
 
 
 
 
 
 
 
 
1
+ #
2
+ # Translators:
3
+ # Andr&eacute; Br&auml;kling <webmaster@braekling.de>, 2011
4
+ # André Bräkling <andre@braekling.de>, 2015
 
 
5
  msgid ""
6
  msgstr ""
7
+ "Project-Id-Version: WP-Piwik\n"
8
+ "POT-Creation-Date: 2015-05-10 16:33+0100\n"
9
+ "PO-Revision-Date: 2015-05-10 14:45+0000\n"
10
+ "Last-Translator: André Bräkling <andre@braekling.de>\n"
11
+ "Language-Team: German (Germany) (http://www.transifex.com/projects/p/wp-piwik/language/de_DE/)\n"
 
12
  "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "Language: de_DE\n"
16
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "X-Generator: Poedit 1.7.5\n"
18
+ "X-Poedit-Basepath: .\n"
19
+ "X-Poedit-KeywordsList: __;_e\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-SourceCharset: UTF-8\n"
22
+
23
+ #: classes/WP_Piwik.php:185
24
+ #, php-format
25
+ msgid "%s %s installed."
26
+ msgstr "%s %s installiert."
27
 
28
+ #: classes/WP_Piwik.php:185
29
+ msgid "Next you should connect to Piwik"
30
+ msgstr "Als n&auml;chstes solltest Du eine Verbindung zu Piwik herstellen"
31
 
32
+ #: classes/WP_Piwik.php:215
33
+ #, php-format
34
+ msgid "%s updated to %s."
35
+ msgstr "%s aktualisiert auf %s."
36
 
37
+ #: classes/WP_Piwik.php:215
38
+ msgid "Please validate your configuration"
39
+ msgstr "Bitte &uuml;berpr&uuml;fe Deine Konfiguration"
 
 
40
 
41
+ #: classes/WP_Piwik.php:247 classes/WP_Piwik.php:463
42
+ msgid "Settings"
43
+ msgstr "Einstellungen"
 
44
 
45
+ #: classes/WP_Piwik.php:250
46
+ msgid "Important"
47
+ msgstr "Wichtig"
48
 
49
+ #: classes/WP_Piwik.php:331 classes/WP_Piwik.php:353
50
+ msgid "Piwik Statistics"
51
+ msgstr "Piwik Statistiken"
52
 
53
+ #: classes/WP_Piwik.php:901
54
+ msgid "An error occured"
55
+ msgstr "Ein Fehler ist aufgetreten"
56
 
57
+ #: classes/WP_Piwik.php:901 classes/WP_Piwik/Admin/Settings.php:62
58
+ msgid "Support"
59
+ msgstr "Support"
60
 
61
+ #: classes/WP_Piwik.php:1150
62
+ msgid "Cheatin&#8217; uh?"
63
+ msgstr "Schummelst wohl?"
64
 
65
+ #: classes/WP_Piwik/Admin/Settings.php:19
66
+ msgid "Changes saved."
67
+ msgstr "&Auml;nderungen gespeichert"
68
 
69
+ #: classes/WP_Piwik/Admin/Settings.php:30
70
+ msgid "Thanks for using WP-Piwik!"
71
+ msgstr "Vielen Dank f&uuml;r die Verwendung von WP-Piwik!"
72
 
73
+ #: classes/WP_Piwik/Admin/Settings.php:35
74
+ #, php-format
75
+ msgid "WP-Piwik %s is successfully connected to Piwik %s."
76
+ msgstr "WP-Piwik %s wurde erfolgreich mit Piwik %s verbunden."
77
 
78
+ #: classes/WP_Piwik/Admin/Settings.php:35
79
+ #, php-format
80
+ msgid "You are running WordPress %s."
81
+ msgstr "Du verwendest WordPress %s."
82
 
83
+ #: classes/WP_Piwik/Admin/Settings.php:35
84
+ #, php-format
85
+ msgid ""
86
+ "You are running a WordPress %s blog network (WPMU). WP-Piwik will handle "
87
+ "your sites as different websites."
88
+ msgstr "Du verwendest ein WordPress %s Blog Netzwerk (WPMU). WP-Piwik wird Deine Seiten als unterschiedliche Webseiten behandeln."
89
 
90
+ #: classes/WP_Piwik/Admin/Settings.php:37
91
+ #, php-format
92
+ msgid ""
93
+ "WP-Piwik %s was not able to connect to Piwik using your configuration. Check"
94
+ " the &raquo;Connect to Piwik&laquo; section below."
95
+ msgstr "WP-Piwik %s konnte sich mit Deiner Konfiguration nicht mit Piwik verbinden. Bitte &uuml;berprf&uuml;fe die &raquo;Mit Piwik verbinden&laquo;-Sektion unten."
96
 
97
+ #: classes/WP_Piwik/Admin/Settings.php:40
98
+ #, php-format
99
+ msgid ""
100
+ "WP-Piwik %s has to be connected to Piwik first. Check the &raquo;Connect to "
101
+ "Piwik&laquo; section below."
102
+ msgstr "WP-Piwik %s muss zun&auml;chst mit Piwik verbunden werden. Bitte &uuml;berprf&uuml;fe die &raquo;Mit Piwik verbinden&laquo;-Sektion unten."
103
 
104
+ #: classes/WP_Piwik/Admin/Settings.php:44
105
+ msgid "Connect to Piwik"
106
+ msgstr "Mit Piwik verbinden"
107
 
108
+ #: classes/WP_Piwik/Admin/Settings.php:49
109
+ msgid "Show Statistics"
110
+ msgstr "Zeige Statistiken"
111
 
112
+ #: classes/WP_Piwik/Admin/Settings.php:53
113
+ msgid "Enable Tracking"
114
+ msgstr "Aktiviere Tracking"
115
 
116
+ #: classes/WP_Piwik/Admin/Settings.php:58
117
+ msgid "Expert Settings"
118
+ msgstr "Expertenkonfiguration"
119
 
120
+ #: classes/WP_Piwik/Admin/Settings.php:66
121
+ msgid "Credits"
122
+ msgstr "Danksagungen"
123
 
124
+ #: classes/WP_Piwik/Admin/Settings.php:79
125
+ msgid ""
126
+ "WP-Piwik is a WordPress plugin to show a selection of Piwik stats in your "
127
+ "WordPress admin dashboard and to add and configure your Piwik tracking code."
128
+ " To use this you will need your own Piwik instance. If you do not already "
129
+ "have a Piwik setup, you have two simple options: use either"
130
+ msgstr "WP-Piwik ist ein WordPress Plugin, um eine Auswahl von Piwik-Statistiken in Deinem WordPress Admin-Dashboard anzuzeigen, und um Deinen Piwik-Tracking-Code hinzuzufügen und zu konfigurieren. Um es zu verwenden, musst Du zunächst eine Piwik-Installation haben. Es gibt zwei M&ouml;glichkeiten: Betreibe Piwik entweder "
131
 
132
+ #: classes/WP_Piwik/Admin/Settings.php:79
133
+ msgid "Self-hosted"
134
+ msgstr "selbst-gehostet"
135
 
136
+ #: classes/WP_Piwik/Admin/Settings.php:79
137
+ msgid "or"
138
+ msgstr "oder"
139
 
140
+ #: classes/WP_Piwik/Admin/Settings.php:79
141
+ msgid "Cloud-hosted"
142
+ msgstr "in der Cloud"
143
 
144
+ #: classes/WP_Piwik/Admin/Settings.php:82
145
+ msgid ""
146
+ "Neither cURL nor fopen are available. So WP-Piwik can not use the HTTP API "
147
+ "and not connect to Piwik Pro."
148
+ msgstr "Weder cURL noch fopen ist verfügbar. Deswegen kann WP-Piwik die HTTP-API nicht verwenden und auch nicht zu Piwik Pro verbinden."
149
 
150
+ #: classes/WP_Piwik/Admin/Settings.php:82
151
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:30
152
+ msgid "More information"
153
+ msgstr "Weitere Informationen"
154
 
155
+ #: classes/WP_Piwik/Admin/Settings.php:84
156
+ msgid "You can choose between three connection methods:"
157
+ msgstr "Du kannst zwischen drei Verbindungsmöglichkeiten wählen:"
158
 
159
+ #: classes/WP_Piwik/Admin/Settings.php:84
160
+ #: classes/WP_Piwik/Admin/Settings.php:87
161
+ msgid "Self-hosted (HTTP API, default)"
162
+ msgstr "Selbst-gehostet (HTTP API, Standard)"
163
 
164
+ #: classes/WP_Piwik/Admin/Settings.php:84
165
+ msgid ""
166
+ "This is the default option for a self-hosted Piwik and should work for most "
167
+ "configurations. WP-Piwik will connect to Piwk using http(s)."
168
+ msgstr "Dies ist die Standard-Einstellung für ein selbst-gehostetes Piwik und sollte in den meisten Konfigurationen funktionieren. WP-Piwik verbindet sich mit Piwik &uuml;ber http(s)."
169
 
170
+ #: classes/WP_Piwik/Admin/Settings.php:84
171
+ #: classes/WP_Piwik/Admin/Settings.php:88
172
+ msgid "Self-hosted (PHP API)"
173
+ msgstr "Selbst-gehostet (PHP AP)"
174
 
175
+ #: classes/WP_Piwik/Admin/Settings.php:84
176
+ msgid ""
177
+ "Choose this, if your self-hosted Piwik and WordPress are running on the same"
178
+ " machine and you know the full server path to your Piwik instance."
179
+ msgstr "W&auml;hle diese Option, wenn Dein selbst-gehostetes Piwik und WordPress auf dem gleichen Server laufen und Du den vollen Serverpfad zu Deiner Piwik-Installation kennst."
180
 
181
+ #: classes/WP_Piwik/Admin/Settings.php:84
182
+ #: classes/WP_Piwik/Admin/Settings.php:89
183
+ msgid "Cloud-hosted (Piwik Pro)"
184
+ msgstr "In der Cloud (Piwik Pro)"
185
 
186
+ #: classes/WP_Piwik/Admin/Settings.php:84
187
+ msgid ""
188
+ "If you are using a cloud-hosted Piwik by Piwik Pro, you can simply use this "
189
+ "option."
190
+ msgstr "Wenn Du ein Piwik in der Cloud von Piwik Pro verwendest, kannst Du einfach diese Option w&auml;hlen."
191
 
192
+ #: classes/WP_Piwik/Admin/Settings.php:85
193
+ msgid "Piwik Mode"
194
+ msgstr "Piwik-Modus"
195
 
196
+ #: classes/WP_Piwik/Admin/Settings.php:86
197
+ msgid "Disabled (WP-Piwik will not connect to Piwik)"
198
+ msgstr "Deaktiviert (WP-Piwik wird sich nicht mit Piwik verbinden)"
199
 
200
+ #: classes/WP_Piwik/Admin/Settings.php:92
201
+ msgid "Piwik URL"
202
+ msgstr "Piwik URL"
203
 
204
+ #: classes/WP_Piwik/Admin/Settings.php:92
205
+ msgid ""
206
+ "Enter your Piwik URL. This is the same URL you use to access your Piwik "
207
+ "instance, e.g. http://www.example.com/piwik/."
208
+ msgstr "Gebe Deine Piwik-URL ein. Es handelt sich um die gleiche URL, die Du auch verwendest, um Dein Piwik zu &ouml;ffnen, z.B. http://www.example.com/piwik/."
209
 
210
+ #: classes/WP_Piwik/Admin/Settings.php:93
211
+ msgid "Piwik path"
212
+ msgstr "Piwik Pfad"
213
 
214
+ #: classes/WP_Piwik/Admin/Settings.php:93
215
+ msgid "Enter the file path to your Piwik instance, e.g. /var/www/piwik/."
216
+ msgstr "Gib den Dateipfad zu Deiner Piwik-Installation an, z.B. /var/www/piwik/."
217
 
218
+ #: classes/WP_Piwik/Admin/Settings.php:94
219
+ msgid "Piwik user"
220
+ msgstr "Piwik-Benutzer"
221
 
222
+ #: classes/WP_Piwik/Admin/Settings.php:94
223
+ msgid ""
224
+ "Enter your Piwik Pro username. It is also part of your URL: "
225
+ "http://USERNAME.piwik.pro."
226
+ msgstr "Gib hier Deinen Piwik Pro Benutzernamen an. Er ist auch Teil Deiner URL: http://USERNAME.piwik.pro."
227
 
228
+ #: classes/WP_Piwik/Admin/Settings.php:95
229
  msgid "Auth token"
230
  msgstr "Auth Token"
231
 
232
+ #: classes/WP_Piwik/Admin/Settings.php:95
 
 
 
 
 
 
 
 
233
  msgid ""
234
+ "Enter your Piwik auth token here. It is an alphanumerical code like "
235
+ "0a1b2c34d56e78901fa2bc3d45678efa."
236
+ msgstr "Gib hier Dein Piwik Auth Token an. Es ist ein alphanumerische Code wie 0a1b2c34d56e78901fa2bc3d45678efa."
 
 
237
 
238
+ #: classes/WP_Piwik/Admin/Settings.php:95
239
+ #, php-format
240
+ msgid "See %sWP-Piwik FAQ%s."
241
+ msgstr "Siehe %sdie WP-Piwik FAQ%s"
242
+
243
+ #: classes/WP_Piwik/Admin/Settings.php:100
244
+ msgid "Auto config"
245
+ msgstr "Auto-Konfiguration"
246
 
247
+ #: classes/WP_Piwik/Admin/Settings.php:100
248
  msgid ""
249
+ "Check this to automatically choose your blog from your Piwik sites by URL. "
250
+ "If your blog is not added to Piwik yet, WP-Piwik will add a new site."
251
+ msgstr "Aktiviere diesen Haken, um Dein Blog &uuml;ber seine URL automatisch aus Deinen Piwik-Seiten auszuw&auml;hlen. Wenn Dein Blog bisher nicht zu Piwik hinzugef&uuml;gt wurde, wird WP-Piwik eine neue Seite hinzuf&uuml;gen."
252
 
253
+ #: classes/WP_Piwik/Admin/Settings.php:106
254
+ msgid "Save settings to start estimation."
255
+ msgstr "Speichere die Einstellungen, um die Ermittlung zu starten."
256
 
257
+ #: classes/WP_Piwik/Admin/Settings.php:109
258
+ msgid "Determined site"
259
+ msgstr "Ermittelte Seite"
260
 
261
+ #: classes/WP_Piwik/Admin/Settings.php:114
262
+ msgid "Select site"
263
+ msgstr "W&auml;hle die Seite"
264
 
265
+ #: classes/WP_Piwik/Admin/Settings.php:122
266
+ msgid "Piwik default date"
267
+ msgstr "Piwik Standard-Datum"
268
 
269
+ #: classes/WP_Piwik/Admin/Settings.php:123
270
+ #: classes/WP_Piwik/Admin/Settings.php:136
271
+ msgid "Today"
272
+ msgstr "Heute"
273
 
274
+ #: classes/WP_Piwik/Admin/Settings.php:124
275
+ #: classes/WP_Piwik/Admin/Settings.php:135
276
+ msgid "Yesterday"
277
+ msgstr "Gestern"
278
 
279
+ #: classes/WP_Piwik/Admin/Settings.php:125
280
+ msgid "Current month"
281
+ msgstr "Aktueller Monat"
282
 
283
+ #: classes/WP_Piwik/Admin/Settings.php:126
284
+ msgid "Last month"
285
+ msgstr "Letzter Monat"
286
 
287
+ #: classes/WP_Piwik/Admin/Settings.php:127
288
+ msgid "Current week"
289
+ msgstr "Aktuelle Woche"
290
 
291
+ #: classes/WP_Piwik/Admin/Settings.php:128
292
+ msgid "Last week"
293
+ msgstr "Letzte Woche"
294
 
295
+ #: classes/WP_Piwik/Admin/Settings.php:129
296
+ msgid "Default date shown on statistics page."
297
+ msgstr "Default-Datum, das auf der Statistik-Seite gezeigt wird."
298
 
299
+ #: classes/WP_Piwik/Admin/Settings.php:131
300
+ msgid "Show SEO data"
301
+ msgstr "Zeige SEO-Daten"
302
 
303
+ #: classes/WP_Piwik/Admin/Settings.php:131
304
+ msgid "Display SEO ranking data on statistics page."
305
+ msgstr "Zeige SEO-Ranking-Daten auf der Statistiken-Seite."
306
 
307
+ #: classes/WP_Piwik/Admin/Settings.php:131
308
+ #: classes/WP_Piwik/Admin/Settings.php:142
309
+ msgid "Slow!"
310
+ msgstr "Langsam!"
311
 
312
+ #: classes/WP_Piwik/Admin/Settings.php:133
313
+ msgid "Dashboard overview"
314
+ msgstr "Dashboard Übersicht"
315
 
316
+ #: classes/WP_Piwik/Admin/Settings.php:134
317
+ #: classes/WP_Piwik/Admin/Settings.php:172
318
+ #: classes/WP_Piwik/Admin/Settings.php:174
319
+ #: classes/WP_Piwik/Admin/Settings.php:195
320
+ msgid "Disabled"
321
+ msgstr "Deaktiviert"
322
+
323
+ #: classes/WP_Piwik/Admin/Settings.php:137
324
+ msgid "Last 30 days"
325
+ msgstr "Letzte 30 Tage"
326
+
327
+ #: classes/WP_Piwik/Admin/Settings.php:138
328
+ msgid "Enable WP-Piwik dashboard widget &quot;Overview&quot;."
329
+ msgstr "Aktiviere das WP-Piwik Dashboard Widget &quot;Übersicht&quot;."
330
+
331
+ #: classes/WP_Piwik/Admin/Settings.php:140
332
+ msgid "Dashboard graph"
333
+ msgstr "Dashboard-Graph"
334
+
335
+ #: classes/WP_Piwik/Admin/Settings.php:140
336
+ msgid "Enable WP-Piwik dashboard widget &quot;Graph&quot;."
337
+ msgstr "Aktiviere das WP-Piwik Dashboard Widget &quot;Graph&quot;."
338
+
339
+ #: classes/WP_Piwik/Admin/Settings.php:142
340
+ msgid "Dashboard SEO"
341
+ msgstr "Dashboard SEO"
342
+
343
+ #: classes/WP_Piwik/Admin/Settings.php:142
344
+ msgid "Enable WP-Piwik dashboard widget &quot;SEO&quot;."
345
+ msgstr "Aktiviere das WP-Piwik Dashboard Widget &quot;SEO&quot;."
346
+
347
+ #: classes/WP_Piwik/Admin/Settings.php:144
348
+ msgid "Show graph on WordPress Toolbar"
349
+ msgstr "Zeige einen Graphen in der WordPress Toolbar"
350
 
351
+ #: classes/WP_Piwik/Admin/Settings.php:144
352
+ msgid "Display a last 30 days visitor graph on WordPress' toolbar."
353
+ msgstr "Zeige einen Besuchergraph der letzten 30 Tage in der WordPress' Toolbar."
354
 
355
+ #: classes/WP_Piwik/Admin/Settings.php:146
356
+ msgid "Display stats to"
357
+ msgstr "Zeige Statistiken für"
358
+
359
+ #: classes/WP_Piwik/Admin/Settings.php:153
360
  msgid "Choose user roles allowed to see the statistics page."
361
  msgstr "W&auml;hle diejenigen Nutzerrollen, die sich die Statistiken ansehen d&uuml;rfen."
362
 
363
+ #: classes/WP_Piwik/Admin/Settings.php:155
364
+ msgid "Show per post stats"
365
+ msgstr "Zeige Beitrags-Statistiken"
366
 
367
+ #: classes/WP_Piwik/Admin/Settings.php:155
368
+ msgid "Show stats about single posts at the post edit admin page."
369
+ msgstr "Zeige Statistiken zu einzelnen Beitr&auml;gen auf der Bearbeiten-Seite."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
+ #: classes/WP_Piwik/Admin/Settings.php:157
372
+ msgid "Piwik shortcut"
373
+ msgstr "Piwik-Verlinkung"
374
 
375
+ #: classes/WP_Piwik/Admin/Settings.php:157
376
+ msgid "Display a shortcut to Piwik itself."
377
+ msgstr "Zeigt einen Shortcut zu Piwik an."
378
 
379
+ #: classes/WP_Piwik/Admin/Settings.php:159
380
+ msgid "WP-Piwik display name"
381
+ msgstr "Anzeigename f&uuml;r WP-Piwik"
 
 
 
382
 
383
+ #: classes/WP_Piwik/Admin/Settings.php:159
384
+ msgid "Plugin name shown in WordPress."
385
+ msgstr "Der Name, mit dem das Plugin in WordPress angezeigt wird."
386
 
387
+ #: classes/WP_Piwik/Admin/Settings.php:161
388
+ msgid "Enable shortcodes"
389
+ msgstr "Aktiviere Shortcodes"
390
 
391
+ #: classes/WP_Piwik/Admin/Settings.php:161
392
+ msgid "Enable shortcodes in post or page content."
393
+ msgstr "Aktiviere Shortcodes innerhalb von Artikeln und Seiten."
394
 
395
+ #: classes/WP_Piwik/Admin/Settings.php:172
396
+ msgid "You can choose between four tracking code modes:"
397
+ msgstr "Du kannst zwischen vier Tracking-Code-Varianten wählen:"
398
 
399
+ #: classes/WP_Piwik/Admin/Settings.php:172
400
+ msgid ""
401
+ "WP-Piwik will not add the tracking code. Use this, if you want to add the "
402
+ "tracking code to your template files or you use another plugin to add the "
403
+ "tracking code."
404
+ msgstr "WP-Piwik wird den Tracking-Code nicht hinzuf&uuml;gen. Benutze dies, wenn Du den Tracking-Code direkt in Deinem Template oder &uuml;ber ein anderes Plugin einfügen willst."
405
 
406
+ #: classes/WP_Piwik/Admin/Settings.php:172
407
+ #: classes/WP_Piwik/Admin/Settings.php:175
408
+ msgid "Default tracking"
409
+ msgstr "Standard-Tracking"
410
 
411
+ #: classes/WP_Piwik/Admin/Settings.php:172
412
+ msgid "WP-Piwik will use Piwik's standard tracking code."
413
+ msgstr "WP-Piwik verwendet den Standard Tracking-Code von Piwik."
414
 
415
+ #: classes/WP_Piwik/Admin/Settings.php:172
416
+ #: classes/WP_Piwik/Admin/Settings.php:176
417
+ msgid "Use js/index.php"
418
+ msgstr "Nutze js/index.php"
419
 
420
+ #: classes/WP_Piwik/Admin/Settings.php:172
421
+ msgid ""
422
+ "You can choose this tracking code, to deliver a minified proxy code and to "
423
+ "avoid using the files called piwik.js or piwik.php."
424
+ msgstr "Du kannst diesen Tracking-Code w&auml;hlen, um einen minimierten Proxy-Code auszuliefern und dabei zu vermeiden, dass die Dateien mit dem Namen piwik.js oder piwik.php verwendet werden."
425
 
426
+ #: classes/WP_Piwik/Admin/Settings.php:172
427
+ #, php-format
428
+ msgid "See %sreadme file%s."
429
+ msgstr "Siehe %sReadme-Datei%s."
430
 
431
+ #: classes/WP_Piwik/Admin/Settings.php:172
432
+ #: classes/WP_Piwik/Admin/Settings.php:177
433
+ msgid "Use proxy script"
434
+ msgstr "Verwende Proxy-Skript"
435
 
436
+ #: classes/WP_Piwik/Admin/Settings.php:172
437
+ msgid "Use this tracking code to not reveal the Piwik server URL."
438
+ msgstr "Verwende diesen Tracking-Code, um die URL zu Deinem Piwik-Sever nicht offenzulegen."
439
 
440
+ #: classes/WP_Piwik/Admin/Settings.php:172
441
+ #: classes/WP_Piwik/Admin/Settings.php:192
442
+ #: classes/WP_Piwik/Admin/Settings.php:202
443
+ #, php-format
444
+ msgid "See %sPiwik FAQ%s."
445
+ msgstr "Siehe %sPiwik FAQ%s."
446
 
447
+ #: classes/WP_Piwik/Admin/Settings.php:172
448
+ #: classes/WP_Piwik/Admin/Settings.php:178
449
+ msgid "Enter manually"
450
+ msgstr "Manuelle Eingabe"
451
 
452
+ #: classes/WP_Piwik/Admin/Settings.php:172
453
+ msgid ""
454
+ "Enter your own tracking code manually. You can choose one of the prior "
455
+ "options, pre-configure your tracking code and switch to manually editing at "
456
+ "last."
457
+ msgstr "Gebe manuell Deinen eigenen Tracking-Code ein. Du kannst eine der vorhergehenden Optionen nutzen, Deinen Tracking-Code vorkonfigurieren und abschlie&szlig;end auf die manuelle Bearbeitung wechseln."
458
 
459
+ #: classes/WP_Piwik/Admin/Settings.php:172
460
+ msgid "Use the placeholder {ID} to add the Piwik site ID."
461
+ msgstr "Verwende den Platzhalter {ID}, um Piwiks Site-ID einzuf&uuml;gen."
462
 
463
+ #: classes/WP_Piwik/Admin/Settings.php:173
464
+ msgid "Add tracking code"
465
+ msgstr "Tracking-Code einf&uuml;gen"
466
 
467
+ #: classes/WP_Piwik/Admin/Settings.php:181
468
+ msgid "Tracking code"
469
+ msgstr "Tracking-Code"
470
 
471
+ #: classes/WP_Piwik/Admin/Settings.php:183
472
+ msgid "JavaScript code position"
473
+ msgstr "Position des JavaScript-Codes"
474
 
475
+ #: classes/WP_Piwik/Admin/Settings.php:184
476
+ msgid "Footer"
477
+ msgstr "Fußbereich"
478
 
479
+ #: classes/WP_Piwik/Admin/Settings.php:185
480
+ msgid "Header"
481
+ msgstr "Kopfbereich"
482
 
483
+ #: classes/WP_Piwik/Admin/Settings.php:186
484
+ msgid ""
485
+ "Choose whether the JavaScript code is added to the footer or the header."
486
+ msgstr "W&auml;hle, ob der JavaScript-Code im Footer oder im Header eingef&uuml;gt werden soll."
487
 
488
+ #: classes/WP_Piwik/Admin/Settings.php:188
489
+ msgid "Noscript code"
490
+ msgstr "Noscript-Code"
491
 
492
+ #: classes/WP_Piwik/Admin/Settings.php:190
493
+ msgid "Add &lt;noscript&gt;"
494
+ msgstr "F&uuml;ge &lt;noscript&gt; hinzu"
495
 
496
+ #: classes/WP_Piwik/Admin/Settings.php:190
497
+ msgid "Adds the &lt;noscript&gt; code to your footer."
498
+ msgstr "F&uuml;gt den &lt;noscript&gt;-Code im Footer ein."
499
 
500
+ #: classes/WP_Piwik/Admin/Settings.php:190
501
+ #: classes/WP_Piwik/Admin/Settings.php:192
502
+ msgid "Disabled in proxy mode."
503
+ msgstr "Im Proxy-Modus deaktiviert."
504
 
505
+ #: classes/WP_Piwik/Admin/Settings.php:192
506
+ msgid "Add rec parameter to noscript code"
507
+ msgstr "F&uuml;ge rec-Parameter zum noscript Code hinzu"
508
 
509
+ #: classes/WP_Piwik/Admin/Settings.php:192
510
+ msgid "Enable tracking for visitors without JavaScript (not recommended)."
511
+ msgstr "Aktiviere das Tracking für Besucher ohne JavaScript (nicht empfohlen)."
512
 
513
+ #: classes/WP_Piwik/Admin/Settings.php:194
514
+ msgid "Enable content tracking"
515
+ msgstr "Aktiviere Content-Tracking"
516
 
517
+ #: classes/WP_Piwik/Admin/Settings.php:196
518
+ msgid "Track all content blocks"
519
+ msgstr "Tracke alle Content-Bereiche"
520
 
521
+ #: classes/WP_Piwik/Admin/Settings.php:197
522
+ msgid "Track only visible content blocks"
523
+ msgstr "Tracke nur sichtbare Content-Bereiche"
524
 
525
+ #: classes/WP_Piwik/Admin/Settings.php:198
526
+ msgid ""
527
+ "Content tracking allows you to track interaction with the content of a web "
528
+ "page or application."
529
+ msgstr "Das Content-Tracking erlaubt es Dir, Interaktionen mit dem Inhalt einer Webseite oder -anwendung zu tracken."
530
+
531
+ #: classes/WP_Piwik/Admin/Settings.php:198
532
+ #: classes/WP_Piwik/Admin/Settings.php:200
533
+ #: classes/WP_Piwik/Admin/Settings.php:204
534
+ #: classes/WP_Piwik/Admin/Settings.php:206
535
+ #: classes/WP_Piwik/Admin/Settings.php:208
536
+ #: classes/WP_Piwik/Admin/Settings.php:229
537
+ #: classes/WP_Piwik/Admin/Settings.php:231
538
+ #: classes/WP_Piwik/Admin/Settings.php:235
539
+ #, php-format
540
+ msgid "See %sPiwik documentation%s."
541
+ msgstr "Siehe %sPiwik-Dokumentation%s."
542
+
543
+ #: classes/WP_Piwik/Admin/Settings.php:200
544
+ msgid "Track search"
545
+ msgstr "Tracke Suchanfragen"
546
+
547
+ #: classes/WP_Piwik/Admin/Settings.php:200
548
+ msgid "Use Piwik's advanced Site Search Analytics feature."
549
+ msgstr "Nutze Piwiks Site Search Funktion, um interne Suchen zu tracken."
550
+
551
+ #: classes/WP_Piwik/Admin/Settings.php:202
552
+ msgid "Track 404"
553
+ msgstr "404-Tracking"
554
 
555
+ #: classes/WP_Piwik/Admin/Settings.php:202
556
+ msgid ""
557
+ "WP-Piwik can automatically add a 404-category to track 404-page-visits."
558
+ msgstr "WP-Piwik kann automatisch eine eigene Kategorie f&uuml;r 404-Seiten hinzuf&uuml;gen."
559
 
560
+ #: classes/WP_Piwik/Admin/Settings.php:204
561
+ msgid "Add annotation on new post"
562
+ msgstr "Notiz bei neuem Post"
563
 
564
+ #: classes/WP_Piwik/Admin/Settings.php:204
565
+ msgid "Add a Piwik annotation on each new post."
566
+ msgstr "F&uuml;ge eine Piwik-Notiz bei jedem neuen Post hinzu."
567
 
568
+ #: classes/WP_Piwik/Admin/Settings.php:206
569
+ msgid "Show custom variables box"
570
+ msgstr "Zeige Custom-Variables-Box"
571
 
572
+ #: classes/WP_Piwik/Admin/Settings.php:206
573
+ msgid " Show a &quot;custom variables&quot; edit box on post edit page."
574
+ msgstr "Zeige eine Eingabebox für &quot;custom variables&quot; auf der Seite zum Bearbeiten von Posts."
575
 
576
+ #: classes/WP_Piwik/Admin/Settings.php:208
577
+ msgid "Add new file types for download tracking"
578
+ msgstr "F&uuml;ge weitere Dateitypen f&uuml;r das Download-Tracking hinzu."
579
 
580
+ #: classes/WP_Piwik/Admin/Settings.php:208
581
+ msgid ""
582
+ "Add file extensions for download tracking, divided by a vertical bar "
583
+ "(&#124;)."
584
+ msgstr "F&uuml;ge Dateierweiterung zum Download-Tracking hinzu. Trenne mehrere Erweiterung durch einen senkrechten Strich (&#124;)."
585
 
586
+ #: classes/WP_Piwik/Admin/Settings.php:210
587
+ msgid "Disable cookies"
588
+ msgstr "Cookies deaktivieren"
589
 
590
+ #: classes/WP_Piwik/Admin/Settings.php:210
591
+ msgid "Disable all tracking cookies for a visitor."
592
+ msgstr "Schalte alle Tracking-Cookies f&uuml;r Besucher ab."
593
 
594
+ #: classes/WP_Piwik/Admin/Settings.php:212
595
+ msgid "Limit cookie lifetime"
596
+ msgstr "Cookie-Lebensdauer beschr&auml;nken"
597
 
598
+ #: classes/WP_Piwik/Admin/Settings.php:212
599
+ msgid ""
600
+ "You can limit the cookie lifetime to avoid tracking your users over a longer"
601
+ " period as necessary."
602
+ msgstr "Du kannst die Cookie-Lebenszeit begrenzen, um Deine Besucher nicht länger als notwendig zu tracken."
603
 
604
+ #: classes/WP_Piwik/Admin/Settings.php:214
605
+ msgid "Visitor timeout (seconds)"
606
+ msgstr "Besucher-Timeout (Sekunden)"
607
 
608
+ #: classes/WP_Piwik/Admin/Settings.php:216
609
+ msgid "Session timeout (seconds)"
610
+ msgstr "Session-Timeout (Sekunden)"
611
 
612
+ #: classes/WP_Piwik/Admin/Settings.php:218
613
+ msgid "Referral timeout (seconds)"
614
+ msgstr "Referral-Timeout (Sekunden)"
615
 
616
+ #: classes/WP_Piwik/Admin/Settings.php:220
617
+ msgid "Track admin pages"
618
+ msgstr "Admin-Seiten tracken"
619
 
620
+ #: classes/WP_Piwik/Admin/Settings.php:220
621
+ msgid ""
622
+ "Enable to track users on admin pages (remember to configure the tracking "
623
+ "filter appropriately)."
624
+ msgstr "Aktivieren, um Nutzer auf Admin-Seiten zu z&auml;hlen (bitte den Tracking Filter entsprechend konfigurieren)."
625
 
626
+ #: classes/WP_Piwik/Admin/Settings.php:223
627
+ msgid "Tracking filter"
628
+ msgstr "Tracking-Filter"
629
 
630
+ #: classes/WP_Piwik/Admin/Settings.php:227
631
+ msgid "Choose users by user role you do <strong>not</strong> want to track."
632
+ msgstr "W&auml;hle diejenigen Nutzerrollen, die Du <strong>nicht</strong> erfassen willst."
633
 
634
+ #: classes/WP_Piwik/Admin/Settings.php:229
635
+ msgid "Track subdomains in the same website"
636
+ msgstr "Tracke Subdomains innerhalb der gleichen Webseite"
637
 
638
+ #: classes/WP_Piwik/Admin/Settings.php:229
639
+ msgid "Adds *.-prefix to cookie domain."
640
+ msgstr "F&uuml;gt ein *.-Pr&auml;fix zur Cookie Domain hinzu."
641
 
642
+ #: classes/WP_Piwik/Admin/Settings.php:231
643
+ msgid "Do not count subdomians as outlink"
644
+ msgstr "Werte Subdomains nicht als ausgehenden Link"
645
 
646
+ #: classes/WP_Piwik/Admin/Settings.php:231
647
+ msgid "Adds *.-prefix to tracked domain."
648
+ msgstr "F&uuml;gt ein *.-Pr&auml;fix zur getrackten Domain hinzu."
649
 
650
+ #: classes/WP_Piwik/Admin/Settings.php:233
651
+ msgid "Track RSS feeds"
652
+ msgstr "Tracke RSS-Feeds"
653
 
654
+ #: classes/WP_Piwik/Admin/Settings.php:233
655
+ msgid "Enable to track posts in feeds via tracking pixel."
656
+ msgstr "Aktivieren, um Beir&auml;ge im Feed via Tracking-Pixel zu z&auml;hlen."
657
 
658
+ #: classes/WP_Piwik/Admin/Settings.php:235
659
+ msgid "Track RSS feed links as campaign"
660
+ msgstr "Links in RSS-Feeds als Kampagne tracken"
661
 
662
+ #: classes/WP_Piwik/Admin/Settings.php:235
663
+ msgid "This will add Piwik campaign parameters to the RSS feed links. "
664
+ msgstr "Dies f&uuml;gt einen Piwik-Kampagnen-Parameter zu den RSS-Feed-Links hinzu."
665
 
666
+ #: classes/WP_Piwik/Admin/Settings.php:237
667
+ msgid "RSS feed campaign"
668
+ msgstr "RSS-Feed Kampagne"
669
 
670
+ #: classes/WP_Piwik/Admin/Settings.php:237
671
+ msgid "Keyword: post name."
672
+ msgstr "Schl&uuml;sselwort: Name des Beitrags."
673
 
674
+ #: classes/WP_Piwik/Admin/Settings.php:242
675
+ msgid ""
676
+ "Usually, you do not need to change these settings. If you want to do so, you"
677
+ " should know what you do or you got an expert's advice."
678
+ msgstr "Normalerweise solltest Du diese Einstellungen nicht ändern müssen. Solltest Du hier doch etwas ändern wollen, solltest Du wissen was Du tust oder dies auf Anleitung eines Experten tun."
679
 
680
+ #: classes/WP_Piwik/Admin/Settings.php:244
681
+ msgid "Enable cache"
682
+ msgstr "Cache einschalten"
683
 
684
+ #: classes/WP_Piwik/Admin/Settings.php:244
685
+ msgid "Cache API calls, which not contain today's values, for a week."
686
+ msgstr "Cache API-Anfragen, die keine heutigen Werte enthalten, für eine Woche."
687
 
688
+ #: classes/WP_Piwik/Admin/Settings.php:246
689
+ msgid "Disable time limit"
690
+ msgstr "Zeitlimit deaktivieren"
691
 
692
+ #: classes/WP_Piwik/Admin/Settings.php:246
693
+ msgid "Use set_time_limit(0) if stats page causes a time out."
694
+ msgstr "Verwende set_time_limit(0) falls die Statistik-Seite einen Timeout erzeugt."
695
 
696
+ #: classes/WP_Piwik/Admin/Settings.php:248
697
+ msgid "Connection timeout"
698
+ msgstr "Verbindungs-Timeout"
699
 
700
+ #: classes/WP_Piwik/Admin/Settings.php:250
701
+ msgid "Disable SSL peer verification"
702
+ msgstr "SSL Peer-Verifikation deaktivieren"
703
 
704
+ #: classes/WP_Piwik/Admin/Settings.php:250
705
+ msgid "not recommended"
706
+ msgstr "Nicht empfohlen"
707
 
708
+ #: classes/WP_Piwik/Admin/Settings.php:252
709
+ msgid "User agent"
710
+ msgstr "User Agent"
711
 
712
+ #: classes/WP_Piwik/Admin/Settings.php:253
713
+ msgid "Use the PHP default user agent"
714
+ msgstr "Verwende den PHP-Standard User-Agent"
715
 
716
+ #: classes/WP_Piwik/Admin/Settings.php:253
717
+ msgid "empty"
718
+ msgstr "leer"
719
 
720
+ #: classes/WP_Piwik/Admin/Settings.php:254
721
+ msgid "Define a specific user agent"
722
+ msgstr "Lege einen spezifischen User-Agent fest"
723
 
724
+ #: classes/WP_Piwik/Admin/Settings.php:256
725
+ msgid "Specific user agent"
726
+ msgstr "Spezifischer User-Agent"
727
 
728
+ #: classes/WP_Piwik/Admin/Settings.php:258
729
+ msgid "Add data-cfasync=false"
730
+ msgstr "data-cfasync=false einf&uuml;gen"
731
 
732
+ #: classes/WP_Piwik/Admin/Settings.php:258
733
+ #, php-format
734
+ msgid "See %sCloudFlare Knowledge Base%s."
735
+ msgstr "Siehe %sdie CloudFlare Knowledge Base%s."
736
 
737
+ #: classes/WP_Piwik/Admin/Settings.php:258
738
+ msgid ""
739
+ "Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to "
740
+ "ignore the script. "
741
+ msgstr "F&uuml;ge data-cfasync=false zum Script-Tag hinzu. Damit wird z.B. Rocket Loader aufgefordert, das Skript zu ignorieren."
742
 
743
+ #: classes/WP_Piwik/Admin/Settings.php:260
744
+ msgid "CDN URL"
745
+ msgstr "CDN URL"
746
 
747
+ #: classes/WP_Piwik/Admin/Settings.php:262
748
+ msgid "CDN URL (SSL)"
749
+ msgstr "CDN URL (SSL)"
750
 
751
+ #: classes/WP_Piwik/Admin/Settings.php:264
752
+ msgid "Force Piwik to use a specific protocol"
753
+ msgstr "Zwinge Piwik, ein bestimmtes Protokoll zu verwenden"
754
 
755
+ #: classes/WP_Piwik/Admin/Settings.php:265
756
+ msgid "Disabled (default)"
757
+ msgstr "Deaktiviert (Standard)"
758
 
759
+ #: classes/WP_Piwik/Admin/Settings.php:266
760
+ msgid "http"
761
+ msgstr "http"
762
 
763
+ #: classes/WP_Piwik/Admin/Settings.php:267
764
+ msgid "https (SSL)"
765
+ msgstr "https (SSL)"
766
 
767
+ #: classes/WP_Piwik/Admin/Settings.php:268
768
+ msgid ""
769
+ "Choose if you want to explicitly force Piwik to use HTTP or HTTPS. Does not "
770
+ "work with a CDN URL."
771
+ msgstr "W&auml;hle aus, ob Du Piwik ausdr&uuml;cklich zwingen willst, HTTP oder HTTPS zu verwenden. Funktioniert nicht mit einer CDN URL."
772
 
773
+ #: classes/WP_Piwik/Admin/Settings.php:427
774
+ msgid "Donate"
775
+ msgstr "Spenden"
776
 
777
+ #: classes/WP_Piwik/Admin/Settings.php:429
778
+ msgid "If you like WP-Piwik, you can support its development by a donation:"
779
+ msgstr "Wenn Dir WP-Piwik gef&auml;llt, kannst Du die weitere Entwicklung mit einer Spende f&ouml;rdern:"
780
 
781
+ #: classes/WP_Piwik/Admin/Settings.php:467
782
+ msgid "My Amazon.de wishlist"
783
+ msgstr "Meine Wunschliste bei Amazon.de"
784
 
785
+ #: classes/WP_Piwik/Admin/Settings.php:470
786
+ #: classes/WP_Piwik/Admin/Settings.php:517
787
+ msgid "Please don't forget to vote the compatibility at the"
788
+ msgstr "Bitte denke daran, eine Kompatibilit&auml;tsbewertung abzugeben:"
789
 
790
+ #: classes/WP_Piwik/Admin/Settings.php:501
791
+ msgid "Thank you very much for your donation"
792
+ msgstr "Vielen Dank f&uuml;r eure Spenden"
793
 
794
+ #: classes/WP_Piwik/Admin/Settings.php:501
795
+ msgid "the Piwik team itself"
796
+ msgstr "das Piwik-Team selbst"
797
 
798
+ #: classes/WP_Piwik/Admin/Settings.php:501
799
+ msgid ", and all people flattering this"
800
+ msgstr " und allen, die WP-Piwik flattrn"
801
 
802
+ #: classes/WP_Piwik/Admin/Settings.php:502
803
+ msgid ""
804
+ "Graphs powered by <a href=\"http://www.jqplot.com/\">jqPlot</a> (License: "
805
+ "GPL 2.0 and MIT) and <a "
806
+ "href=\"http://omnipotent.net/jquery.sparkline/\">jQuery Sparklines</a> "
807
+ "(License: New BSD License)."
808
  msgstr "Die Graphen werden mit <a href=\"http://www.jqplot.com/\">jqPlot</a> (Lizenz: GPL 2.0 and MIT) und <a href=\"http://omnipotent.net/jquery.sparkline/\">jQuery Sparklines</a> (Lizenz: New BSD License) erstellt."
809
 
810
+ #: classes/WP_Piwik/Admin/Settings.php:503
811
+ msgid "Metabox support inspired by"
812
+ msgstr "Die Metabox-Unterst&uuml;tzung wurde inspiriert von"
813
+
814
+ #: classes/WP_Piwik/Admin/Settings.php:504
815
  msgid "Tabbed settings page suggested by the"
816
  msgstr "Die Tabs f&uuml;r die Einstellungen wurden inspiriert von einem Artikel im"
817
 
818
+ #: classes/WP_Piwik/Admin/Settings.php:505
819
+ msgid "Thank you very much"
820
+ msgstr "Vielen Dank"
821
 
822
+ #: classes/WP_Piwik/Admin/Settings.php:505
823
+ msgid "for your translation work"
824
+ msgstr "f&uuml;r eure &Uuml;bersetzungsarbeit"
825
 
826
+ #: classes/WP_Piwik/Admin/Settings.php:506
827
+ msgid ""
828
+ "Thank you very much, all users who send me mails containing criticism, "
829
+ "commendation, feature requests and bug reports! You help me to make WP-Piwik"
830
+ " much better."
831
+ msgstr "Vielen Dank an alle Nutzer, die mir Mails mit Kritik, Lob, Featurew&uuml;nsche und Bugmeldungen senden. Ihr helft mir dabei, WP-Piwik viel besser zu machen."
832
 
833
+ #: classes/WP_Piwik/Admin/Settings.php:507
834
+ msgid ""
835
+ "Thank <strong>you</strong> for using my plugin. It is the best commendation "
836
+ "if my piece of code is really used!"
837
+ msgstr "Vielen Dank an <strong>Dich</strong> f&uuml;r die Nutzung meines Plugins. Es ist das gr&ouml;&szlig;te Lob, wenn mein Code tats&auml;chlich benutzt wird!"
838
 
839
+ #: classes/WP_Piwik/Admin/Settings.php:516
840
+ msgid "The best place to get help:"
841
+ msgstr "Der beste Platz, um Hilfe zu bekommen:"
842
 
843
+ #: classes/WP_Piwik/Admin/Settings.php:516
844
+ msgid "WP-Piwik support forum"
845
+ msgstr "WP-Piwik Support-Forum"
846
 
847
+ #: classes/WP_Piwik/Admin/Settings.php:519
848
+ msgid "Debugging"
849
+ msgstr "Fehlersuche"
850
 
851
+ #: classes/WP_Piwik/Admin/Settings.php:520
852
+ msgid ""
853
+ "Either allow_url_fopen has to be enabled <em>or</em> cURL has to be "
854
+ "available:"
855
+ msgstr "Entweder allow_url_fopen muss aktiviert <em>oder</em> cURL muss verf&uuml;gbar sein:"
856
 
857
+ #: classes/WP_Piwik/Admin/Settings.php:523
858
+ msgid "cURL is"
859
+ msgstr "cURL ist"
860
 
861
+ #: classes/WP_Piwik/Admin/Settings.php:524
862
+ #: classes/WP_Piwik/Admin/Settings.php:529
863
+ msgid "not"
864
+ msgstr "nicht"
865
 
866
+ #: classes/WP_Piwik/Admin/Settings.php:525
867
+ msgid "available"
868
+ msgstr "verf&uuml;gbar"
869
 
870
+ #: classes/WP_Piwik/Admin/Settings.php:528
871
+ msgid "allow_url_fopen is"
872
+ msgstr "allow_url_fopen ist"
873
 
874
+ #: classes/WP_Piwik/Admin/Settings.php:530
875
+ msgid "enabled"
876
+ msgstr "aktiviert"
877
 
878
+ #: classes/WP_Piwik/Admin/Settings.php:533
879
+ msgid "Latest support threads on WordPress.org"
880
+ msgstr "Die letzten Support-Beitr&auml;ge auf WordPress.org"
881
 
882
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:17
883
+ msgid "site"
884
+ msgstr "Seite"
885
 
886
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:18
887
+ msgid "sites"
888
+ msgstr "Seiten"
889
 
890
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:22
891
+ msgid "No site configured yet."
892
+ msgstr "Noch keine Seite konfiguriert."
893
 
894
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:27
895
+ msgid "ID"
896
+ msgstr "ID"
897
 
898
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:28
899
+ msgid "Title"
900
+ msgstr "Titel"
901
 
902
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:29
903
+ msgid "URL"
904
+ msgstr "URL"
905
 
906
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:30
907
+ msgid "Site ID (Piwik)"
908
+ msgstr "Seiten-ID (Piwik)"
909
 
910
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:73
911
+ msgid "Site not created yet."
912
+ msgstr "Seite noch nicht erstellt."
913
 
914
+ #: classes/WP_Piwik/Admin/Statistics.php:12
915
+ msgid "Statistics"
916
+ msgstr "Statistiken"
917
 
918
+ #: classes/WP_Piwik/Admin/Statistics.php:20
919
+ msgid "Currently shown stats:"
920
+ msgstr "Derzeit gezeigte Statistiken:"
921
 
922
+ #: classes/WP_Piwik/Request/Php.php:25
923
+ msgid "Could not resolve"
924
+ msgstr "Keine Verbindung zu"
925
+
926
+ #: classes/WP_Piwik/Request/Php.php:25
927
+ msgid "realpath() returns false"
928
+ msgstr "realpath() gibt false zur&uuml;ck"
929
+
930
+ #: classes/WP_Piwik/Request/Php.php:32
931
+ msgid "Class Piwik\\FrontController does not exists."
932
+ msgstr "Die Klasse Piwik\\FrontController existiert nicht."
933
+
934
+ #: classes/WP_Piwik/Request/Php.php:35
935
+ msgid "Class Piwik\\API\\Request does not exists."
936
+ msgstr "Die Klasse Piwik\\API\\Request existiert nicht."
937
+
938
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:10
939
+ msgid "Piwik Custom Variables"
940
+ msgstr "Piwik Custom Variables"
941
+
942
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:21
943
+ msgid "Name"
944
+ msgstr "Name"
945
+
946
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:21
947
+ msgid "Value"
948
+ msgstr "Wert"
949
+
950
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:30
951
+ msgid "Set custom variables for a page view"
952
+ msgstr "Definiere custom variables f&uuml;r einen Seitenaufruf."
953
+
954
+ #: classes/WP_Piwik/Widget.php:91
955
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:35
956
+ #: classes/WP_Piwik/Widget/Browsers.php:35
957
+ #: classes/WP_Piwik/Widget/Chart.php:41
958
+ #: classes/WP_Piwik/Widget/Noresult.php:23
959
+ #: classes/WP_Piwik/Widget/Overview.php:24
960
+ #: classes/WP_Piwik/Widget/Plugins.php:23 classes/WP_Piwik/Widget/Post.php:25
961
+ #: classes/WP_Piwik/Widget/Screens.php:35
962
+ #: classes/WP_Piwik/Widget/Search.php:23 classes/WP_Piwik/Widget/Seo.php:20
963
+ #: classes/WP_Piwik/Widget/Systems.php:33
964
+ #: classes/WP_Piwik/Widget/Visitors.php:35
965
+ msgid "Piwik error"
966
+ msgstr "Piwik-Fehler"
967
 
968
+ #: classes/WP_Piwik/Widget.php:100
969
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:37
970
+ #: classes/WP_Piwik/Widget/Browsers.php:37
971
+ #: classes/WP_Piwik/Widget/Screens.php:37
972
+ #: classes/WP_Piwik/Widget/Systems.php:35
973
+ #: classes/WP_Piwik/Widget/Visitors.php:57
974
+ msgid "Unique"
975
+ msgstr "Unique"
976
 
977
+ #: classes/WP_Piwik/Widget.php:102 classes/WP_Piwik/Widget/Plugins.php:25
978
+ #: classes/WP_Piwik/Widget/Visitors.php:57
979
+ msgid "Visits"
980
+ msgstr "Besuche"
981
 
982
+ #: classes/WP_Piwik/Widget.php:104
983
+ msgid "Hits"
984
+ msgstr "Aufrufe"
985
 
986
+ #: classes/WP_Piwik/Widget.php:106
987
+ msgid "Actions"
988
+ msgstr "Aktionen"
989
 
990
+ #: classes/WP_Piwik/Widget.php:144
991
+ msgid "No data available."
992
+ msgstr "Keine Daten vorhanden."
993
 
994
+ #: classes/WP_Piwik/Widget.php:275
995
+ msgid "week"
996
+ msgstr "Woche"
997
 
998
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:16
999
+ msgid "Browser Details"
1000
+ msgstr "Browser-Details"
1001
 
1002
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:37
1003
+ #: classes/WP_Piwik/Widget/Browsers.php:37
1004
+ msgid "Browser"
1005
+ msgstr "Browser"
1006
 
1007
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:37
1008
+ #: classes/WP_Piwik/Widget/Browsers.php:37
1009
+ #: classes/WP_Piwik/Widget/Plugins.php:25
1010
+ #: classes/WP_Piwik/Widget/Screens.php:37
1011
+ #: classes/WP_Piwik/Widget/Systems.php:35
1012
+ msgid "Percent"
1013
+ msgstr "Prozent"
1014
 
1015
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:53
1016
+ #: classes/WP_Piwik/Widget/Browsers.php:53
1017
+ #: classes/WP_Piwik/Widget/Screens.php:53
1018
+ #: classes/WP_Piwik/Widget/Systems.php:51
1019
+ msgid "Others"
1020
+ msgstr "Andere"
1021
 
1022
+ #: classes/WP_Piwik/Widget/Browsers.php:16
1023
+ msgid "Browsers"
1024
+ msgstr "Browser"
1025
 
1026
+ #: classes/WP_Piwik/Widget/Chart.php:17
1027
+ #: classes/WP_Piwik/Widget/Overview.php:40 classes/WP_Piwik/Widget/Post.php:37
1028
+ #: classes/WP_Piwik/Widget/Visitors.php:17
1029
+ msgid "Visitors"
1030
+ msgstr "Besucher"
1031
 
1032
+ #: classes/WP_Piwik/Widget/Chart.php:69
1033
+ msgid ""
1034
+ "The graph contains the values shown in the table below (visitors / unique / "
1035
+ "bounces). The red line show a linear trendline (unique)."
1036
+ msgstr "Der Graph zeigt die Werte aus der Besucher-Tabelle (Besucher / Unique / Abspr&uuml;nge). Die rote Linie zeigt eine lineare Trendlinie (Unique)."
1037
 
1038
+ #: classes/WP_Piwik/Widget/Keywords.php:16
1039
+ msgid "Keywords"
1040
+ msgstr "Keywords"
1041
 
1042
+ #: classes/WP_Piwik/Widget/Noresult.php:16
1043
+ #: classes/WP_Piwik/Widget/Search.php:16
1044
+ msgid "Site Search"
1045
+ msgstr "Seitensuche"
1046
+
1047
+ #: classes/WP_Piwik/Widget/Noresult.php:25
1048
+ #: classes/WP_Piwik/Widget/Search.php:25
1049
+ msgid "Keyword"
1050
+ msgstr "Keyword"
1051
 
1052
+ #: classes/WP_Piwik/Widget/Noresult.php:25
1053
+ #: classes/WP_Piwik/Widget/Search.php:25
1054
+ msgid "Requests"
1055
+ msgstr "Anfragen"
1056
 
1057
+ #: classes/WP_Piwik/Widget/Noresult.php:25
1058
+ #: classes/WP_Piwik/Widget/Search.php:25
1059
+ #: classes/WP_Piwik/Widget/Visitors.php:57
1060
+ msgid "Bounced"
1061
+ msgstr "Abspr&uuml;nge"
1062
 
1063
+ #: classes/WP_Piwik/Widget/Overview.php:17 classes/WP_Piwik/Widget/Post.php:18
1064
+ msgid "Overview"
1065
+ msgstr "&Uuml;bersicht"
1066
 
1067
+ #: classes/WP_Piwik/Widget/Overview.php:17
1068
+ msgid "dashboard"
1069
+ msgstr "Dashboard"
1070
 
1071
+ #: classes/WP_Piwik/Widget/Overview.php:41 classes/WP_Piwik/Widget/Post.php:38
1072
+ msgid "Unique visitors"
1073
+ msgstr "Eindeutige Besucher"
1074
 
1075
+ #: classes/WP_Piwik/Widget/Overview.php:42 classes/WP_Piwik/Widget/Post.php:39
1076
+ msgid "Page views"
1077
+ msgstr "Page Views"
1078
 
1079
+ #: classes/WP_Piwik/Widget/Overview.php:43 classes/WP_Piwik/Widget/Post.php:40
1080
+ msgid "Total time spent"
1081
+ msgstr "Verbrachte Zeit"
1082
 
1083
+ #: classes/WP_Piwik/Widget/Overview.php:44 classes/WP_Piwik/Widget/Post.php:42
1084
+ msgid "Bounce count"
1085
+ msgstr "Absprungrate"
1086
 
1087
+ #: classes/WP_Piwik/Widget/Overview.php:47 classes/WP_Piwik/Widget/Post.php:41
1088
+ msgid "Time/visit"
1089
+ msgstr "Zeit/Besuch"
1090
 
1091
+ #: classes/WP_Piwik/Widget/Overview.php:47
1092
+ msgid "Max. page views in one visit"
1093
+ msgstr "Max. Seiten/Besuch"
1094
 
1095
+ #: classes/WP_Piwik/Widget/Overview.php:48 classes/WP_Piwik/Widget/Post.php:46
1096
+ msgid "Shortcut"
1097
+ msgstr "Shortcut"
1098
 
1099
+ #: classes/WP_Piwik/Widget/Pages.php:16
1100
+ msgid "Pages"
1101
+ msgstr "Seiten"
1102
 
1103
+ #: classes/WP_Piwik/Widget/Plugins.php:16
1104
+ msgid "Plugins"
1105
+ msgstr "Plugins"
1106
 
1107
+ #: classes/WP_Piwik/Widget/Plugins.php:25
1108
+ msgid "Plugin"
1109
+ msgstr "Plugin"
1110
 
1111
+ #: classes/WP_Piwik/Widget/Post.php:43
1112
+ msgid "Min. generation time"
1113
+ msgstr "Min. Zeit zur Generierung"
1114
 
1115
+ #: classes/WP_Piwik/Widget/Post.php:44
1116
+ msgid "Max. generation time"
1117
+ msgstr "Max. Zeit zur Generierung"
1118
 
1119
+ #: classes/WP_Piwik/Widget/Referrers.php:16
1120
+ msgid "Referrers"
1121
+ msgstr "Referrer"
1122
 
1123
+ #: classes/WP_Piwik/Widget/Screens.php:16
1124
+ msgid "Resolutions"
1125
+ msgstr "Aufl&ouml;sungen"
1126
+
1127
+ #: classes/WP_Piwik/Widget/Screens.php:37
1128
+ msgid "Resolution"
1129
+ msgstr "Aufl&ouml;sung"
1130
+
1131
+ #: classes/WP_Piwik/Widget/Seo.php:13
1132
+ msgid "SEO"
1133
+ msgstr "SEO"
1134
+
1135
+ #: classes/WP_Piwik/Widget/Systems.php:14
1136
+ msgid "Operation Systems"
1137
+ msgstr "Betriebssysteme"
1138
 
1139
+ #: classes/WP_Piwik/Widget/Systems.php:35
1140
+ msgid "Operation System"
1141
+ msgstr "Betriebssystem"
1142
+
1143
+ #: classes/WP_Piwik/Widget/Visitors.php:57
1144
+ msgid "Date"
1145
+ msgstr "Datum"
1146
 
1147
+ #: classes/WP_Piwik/Widget/Visitors.php:57
1148
+ msgid "Page Views"
1149
+ msgstr "Seitenansichten"
1150
+
1151
+ #: wp-piwik.php:60
1152
+ #, php-format
1153
+ msgid ""
1154
+ "WP-Piwik requires at least PHP 5.3. You are using the deprecated version %s."
1155
+ " Please update PHP to use WP-Piwik."
1156
+ msgstr "WP-Piwik ben&ouml;tigt zumindest PHP 5.3. Du verwendest die veraltete Version %s. Bitte aktualisiere PHP um WP-Piwik zu nutzen."
languages/wp-piwik.pot CHANGED
@@ -1,1105 +1,1150 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP-Piwik\n"
4
- "POT-Creation-Date: 2015-04-08 23:28+0100\n"
5
- "PO-Revision-Date: 2015-04-08 23:28+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
-
13
- #: wp-piwik/classes/WP_Piwik.php:126
14
- #: wp-piwik/wp-piwik.php:174
 
 
 
 
 
15
  #, php-format
16
  msgid "%s %s installed."
17
  msgstr ""
18
 
19
- #: wp-piwik/classes/WP_Piwik.php:128
20
- #: wp-piwik/wp-piwik.php:176
21
  msgid "Next you should connect to Piwik"
22
  msgstr ""
23
 
24
- #: wp-piwik/classes/WP_Piwik.php:129
25
- #: wp-piwik/wp-piwik.php:177
 
 
 
 
26
  msgid "Please validate your configuration"
27
  msgstr ""
28
 
29
- #: wp-piwik/classes/WP_Piwik.php:131
30
- #: wp-piwik/classes/WP_Piwik.php:529
31
- #: wp-piwik/classes/WP_Piwik.php:1234
32
- #: wp-piwik/wp-piwik.php:179
33
- #: wp-piwik/wp-piwik.php:577
34
- #: wp-piwik/wp-piwik.php:1300
35
  msgid "Settings"
36
  msgstr ""
37
 
38
- #: wp-piwik/classes/WP_Piwik.php:132
39
- #: wp-piwik/wp-piwik.php:180
40
  msgid "Important"
41
  msgstr ""
42
 
43
- #: wp-piwik/classes/WP_Piwik.php:260
44
- #: wp-piwik/wp-piwik.php:308
45
- msgid "Piwik Custom Variables"
46
  msgstr ""
47
 
48
- #: wp-piwik/classes/WP_Piwik.php:274
49
- #: wp-piwik/wp-piwik.php:322
50
- msgid "Name"
51
  msgstr ""
52
 
53
- #: wp-piwik/classes/WP_Piwik.php:274
54
- #: wp-piwik/wp-piwik.php:322
55
- msgid "Value"
56
  msgstr ""
57
 
58
- #: wp-piwik/classes/WP_Piwik.php:283
59
- #: wp-piwik/wp-piwik.php:331
60
- msgid "Set custom variables for a page view"
61
  msgstr ""
62
 
63
- #: wp-piwik/classes/WP_Piwik.php:283
64
- #: wp-piwik/wp-piwik.php:331
65
- msgid "More information"
66
  msgstr ""
67
 
68
- #: wp-piwik/classes/WP_Piwik.php:328
69
- #: wp-piwik/classes/WP_Piwik.php:369
70
- #: wp-piwik/wp-piwik.php:376
71
- #: wp-piwik/wp-piwik.php:417
72
- msgid "Piwik Statistics"
73
  msgstr ""
74
 
75
- #: wp-piwik/classes/WP_Piwik.php:487
76
- #: wp-piwik/classes/WP_Piwik.php:966
77
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:30
78
- #: wp-piwik/dashboard/overview.php:56
79
- #: wp-piwik/shortcodes/overview.php:40
80
- #: wp-piwik/wp-piwik.php:535
81
- #: wp-piwik/wp-piwik.php:1028
82
- msgid "Visitors"
83
  msgstr ""
84
 
85
- #: wp-piwik/classes/WP_Piwik.php:507
86
- #: wp-piwik/classes/WP_Piwik.php:957
87
- #: wp-piwik/dashboard/seo.php:20
88
- #: wp-piwik/wp-piwik.php:555
89
- #: wp-piwik/wp-piwik.php:1019
90
- msgid "SEO"
91
  msgstr ""
92
 
93
- #: wp-piwik/classes/WP_Piwik.php:707
94
- #: wp-piwik/wp-piwik.php:756
95
- msgid "Could not resolve"
 
 
96
  msgstr ""
97
 
98
- #: wp-piwik/classes/WP_Piwik.php:707
99
- #: wp-piwik/wp-piwik.php:756
100
- msgid "realpath() returns false"
 
 
101
  msgstr ""
102
 
103
- #: wp-piwik/classes/WP_Piwik.php:714
104
- #: wp-piwik/wp-piwik.php:763
105
- msgid "Class Piwik\\FrontController does not exists."
 
 
106
  msgstr ""
107
 
108
- #: wp-piwik/classes/WP_Piwik.php:717
109
- #: wp-piwik/wp-piwik.php:766
110
- msgid "Class Piwik\\API\\Request does not exists."
111
  msgstr ""
112
 
113
- #: wp-piwik/classes/WP_Piwik.php:956
114
- #: wp-piwik/dashboard/overview.php:23
115
- #: wp-piwik/shortcodes/overview.php:11
116
- #: wp-piwik/wp-piwik.php:1018
117
- msgid "Overview"
118
  msgstr ""
119
 
120
- #: wp-piwik/classes/WP_Piwik.php:958
121
- #: wp-piwik/dashboard/pages.php:13
122
- #: wp-piwik/wp-piwik.php:1020
123
- msgid "Pages"
124
  msgstr ""
125
 
126
- #: wp-piwik/classes/WP_Piwik.php:959
127
- #: wp-piwik/dashboard/keywords.php:12
128
- #: wp-piwik/wp-piwik.php:1021
129
- msgid "Keywords"
130
  msgstr ""
131
 
132
- #: wp-piwik/classes/WP_Piwik.php:960
133
- #: wp-piwik/dashboard/websites.php:12
134
- #: wp-piwik/wp-piwik.php:1022
135
- msgid "Websites"
136
  msgstr ""
137
 
138
- #: wp-piwik/classes/WP_Piwik.php:961
139
- #: wp-piwik/dashboard/plugins.php:12
140
- #: wp-piwik/dashboard/plugins.php:33
141
- #: wp-piwik/wp-piwik.php:1023
142
- msgid "Plugins"
 
143
  msgstr ""
144
 
145
- #: wp-piwik/classes/WP_Piwik.php:962
146
- #: wp-piwik/dashboard/search.php:12
147
- #: wp-piwik/wp-piwik.php:1024
148
- msgid "Site Search Keywords"
149
  msgstr ""
150
 
151
- #: wp-piwik/classes/WP_Piwik.php:963
152
- #: wp-piwik/dashboard/noresult.php:12
153
- #: wp-piwik/wp-piwik.php:1025
154
- msgid "Site Search without Results"
155
  msgstr ""
156
 
157
- #: wp-piwik/classes/WP_Piwik.php:967
158
- #: wp-piwik/dashboard/browserdetails.php:39
159
- #: wp-piwik/dashboard/browsers.php:13
160
- #: wp-piwik/dashboard/browsers.php:40
161
- #: wp-piwik/wp-piwik.php:1029
162
- msgid "Browser"
163
  msgstr ""
164
 
165
- #: wp-piwik/classes/WP_Piwik.php:968
166
- #: wp-piwik/dashboard/browserdetails.php:12
167
- #: wp-piwik/wp-piwik.php:1030
168
- msgid "Browser Details"
169
  msgstr ""
170
 
171
- #: wp-piwik/classes/WP_Piwik.php:969
172
- #: wp-piwik/dashboard/screens.php:12
173
- #: wp-piwik/dashboard/screens.php:39
174
- #: wp-piwik/wp-piwik.php:1031
175
- msgid "Resolution"
176
  msgstr ""
177
 
178
- #: wp-piwik/classes/WP_Piwik.php:970
179
- #: wp-piwik/dashboard/systems.php:12
180
- #: wp-piwik/dashboard/systems.php:40
181
- #: wp-piwik/wp-piwik.php:1032
182
- msgid "Operating System"
183
  msgstr ""
184
 
185
- #: wp-piwik/classes/WP_Piwik.php:1042
186
- #: wp-piwik/classes/WP_Piwik.php:1116
187
- #: wp-piwik/wp-piwik.php:1104
188
- #: wp-piwik/wp-piwik.php:1178
189
- msgid "Statistics"
190
  msgstr ""
191
 
192
- #: wp-piwik/classes/WP_Piwik.php:1052
193
- #: wp-piwik/wp-piwik.php:1114
194
- msgid "Currently shown stats:"
 
195
  msgstr ""
196
 
197
- #: wp-piwik/classes/WP_Piwik.php:1099
198
- #: wp-piwik/wp-piwik.php:1161
199
- msgid "Cheatin&#8217; uh?"
200
  msgstr ""
201
 
202
- #: wp-piwik/classes/WP_Piwik.php:1113
203
- #: wp-piwik/wp-piwik.php:1175
204
- msgid "Home"
 
205
  msgstr ""
206
 
207
- #: wp-piwik/classes/WP_Piwik.php:1114
208
- #: wp-piwik/classes/WP_Piwik.php:1120
209
- #: wp-piwik/wp-piwik.php:1176
210
- #: wp-piwik/wp-piwik.php:1182
211
- msgid "Piwik Settings"
212
  msgstr ""
213
 
214
- #: wp-piwik/classes/WP_Piwik.php:1115
215
- #: wp-piwik/wp-piwik.php:1177
216
- msgid "Tracking"
 
217
  msgstr ""
218
 
219
- #: wp-piwik/classes/WP_Piwik.php:1117
220
- #: wp-piwik/classes/WP_Piwik.php:1121
221
- #: wp-piwik/classes/WP_Piwik.php:1293
222
- #: wp-piwik/wp-piwik.php:1179
223
- #: wp-piwik/wp-piwik.php:1183
224
- #: wp-piwik/wp-piwik.php:1372
225
- msgid "Support"
226
  msgstr ""
227
 
228
- #: wp-piwik/classes/WP_Piwik.php:1118
229
- #: wp-piwik/classes/WP_Piwik.php:1122
230
- #: wp-piwik/wp-piwik.php:1180
231
- #: wp-piwik/wp-piwik.php:1184
232
- msgid "Credits"
233
  msgstr ""
234
 
235
- #: wp-piwik/classes/WP_Piwik.php:1232
236
- #: wp-piwik/wp-piwik.php:1298
237
- msgid "Changes saved"
238
  msgstr ""
239
 
240
- #: wp-piwik/classes/WP_Piwik.php:1240
241
- #: wp-piwik/wp-piwik.php:1306
242
- msgid "Donate"
 
243
  msgstr ""
244
 
245
- #: wp-piwik/classes/WP_Piwik.php:1241
246
- #: wp-piwik/wp-piwik.php:1307
247
- msgid "If you like WP-Piwik, you can support its development by a donation:"
248
  msgstr ""
249
 
250
- #: wp-piwik/classes/WP_Piwik.php:1257
251
- #: wp-piwik/wp-piwik.php:1336
252
- msgid "My Amazon.de wishlist"
253
  msgstr ""
254
 
255
- #: wp-piwik/classes/WP_Piwik.php:1260
256
- #: wp-piwik/settings/support.php:5
257
- #: wp-piwik/wp-piwik.php:1339
258
- msgid "Please don't forget to vote the compatibility at the"
259
  msgstr ""
260
 
261
- #: wp-piwik/classes/WP_Piwik.php:1275
262
- #: wp-piwik/wp-piwik.php:1354
263
- msgid "Save settings"
 
264
  msgstr ""
265
 
266
- #: wp-piwik/classes/WP_Piwik.php:1293
267
- #: wp-piwik/wp-piwik.php:1372
268
- msgid "An error occured"
269
  msgstr ""
270
 
271
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:10
272
- msgid "Piwik Statistics (last 30 days)"
 
 
273
  msgstr ""
274
 
275
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:31
276
- #: wp-piwik/dashboard/overview.php:57
277
- #: wp-piwik/shortcodes/overview.php:41
278
- msgid "Unique visitors"
279
  msgstr ""
280
 
281
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:32
282
- #: wp-piwik/dashboard/overview.php:58
283
- #: wp-piwik/shortcodes/overview.php:42
284
- msgid "Page views"
285
  msgstr ""
286
 
287
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:33
288
- #: wp-piwik/dashboard/overview.php:61
289
- #: wp-piwik/shortcodes/overview.php:45
290
- msgid "Time/visit"
291
  msgstr ""
292
 
293
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:34
294
- #: wp-piwik/dashboard/overview.php:62
295
- #: wp-piwik/shortcodes/overview.php:46
296
- msgid "Bounce count"
297
  msgstr ""
298
 
299
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:35
300
- msgid "Exit count"
301
  msgstr ""
302
 
303
- #: wp-piwik/classes/WP_Piwik_MetaBox_PerPost_Stats.php:37
304
- msgid "Avg. generation time"
305
  msgstr ""
306
 
307
- #: wp-piwik/dashboard/browserdetails.php:16
308
- #: wp-piwik/dashboard/browsers.php:17
309
- #: wp-piwik/dashboard/keywords.php:14
310
- #: wp-piwik/dashboard/noresult.php:14
311
- #: wp-piwik/dashboard/overview.php:26
312
- #: wp-piwik/dashboard/pages.php:16
313
- #: wp-piwik/dashboard/plugins.php:26
314
- #: wp-piwik/dashboard/screens.php:16
315
- #: wp-piwik/dashboard/search.php:14
316
- #: wp-piwik/dashboard/seo.php:17
317
- #: wp-piwik/dashboard/systems.php:16
318
- #: wp-piwik/dashboard/visitors.php:32
319
- #: wp-piwik/dashboard/websites.php:15
320
- msgid "Piwik error"
321
  msgstr ""
322
 
323
- #: wp-piwik/dashboard/browserdetails.php:25
324
- #: wp-piwik/dashboard/browsers.php:26
325
- #: wp-piwik/dashboard/pages.php:45
326
- #: wp-piwik/dashboard/screens.php:25
327
- #: wp-piwik/dashboard/systems.php:25
328
- msgid "Others"
329
  msgstr ""
330
 
331
- #: wp-piwik/dashboard/browserdetails.php:40
332
- #: wp-piwik/dashboard/browsers.php:41
333
- #: wp-piwik/dashboard/keywords.php:19
334
- #: wp-piwik/dashboard/pages.php:24
335
- #: wp-piwik/dashboard/screens.php:40
336
- #: wp-piwik/dashboard/systems.php:41
337
- #: wp-piwik/dashboard/visitors.php:64
338
- #: wp-piwik/dashboard/websites.php:22
339
- msgid "Unique"
340
  msgstr ""
341
 
342
- #: wp-piwik/dashboard/browserdetails.php:41
343
- #: wp-piwik/dashboard/browsers.php:42
344
- #: wp-piwik/dashboard/plugins.php:35
345
- #: wp-piwik/dashboard/screens.php:41
346
- #: wp-piwik/dashboard/systems.php:42
347
- msgid "Percent"
348
  msgstr ""
349
 
350
- #: wp-piwik/dashboard/browserdetails.php:55
351
- #: wp-piwik/dashboard/browsers.php:56
352
- #: wp-piwik/dashboard/keywords.php:25
353
- #: wp-piwik/dashboard/noresult.php:25
354
- #: wp-piwik/dashboard/pages.php:43
355
- #: wp-piwik/dashboard/plugins.php:51
356
- #: wp-piwik/dashboard/screens.php:55
357
- #: wp-piwik/dashboard/search.php:25
358
- #: wp-piwik/dashboard/systems.php:56
359
- #: wp-piwik/dashboard/websites.php:29
360
- msgid "No data available."
361
  msgstr ""
362
 
363
- #: wp-piwik/dashboard/keywords.php:19
364
- #: wp-piwik/dashboard/noresult.php:19
365
- #: wp-piwik/dashboard/search.php:19
366
- msgid "Keyword"
367
  msgstr ""
368
 
369
- #: wp-piwik/dashboard/noresult.php:19
370
- #: wp-piwik/dashboard/search.php:19
371
- msgid "Requests"
372
  msgstr ""
373
 
374
- #: wp-piwik/dashboard/noresult.php:19
375
- #: wp-piwik/dashboard/search.php:19
376
- #: wp-piwik/dashboard/visitors.php:65
377
- msgid "Bounced"
378
  msgstr ""
379
 
380
- #: wp-piwik/dashboard/overview.php:59
381
- #: wp-piwik/shortcodes/overview.php:43
382
- msgid "Max. page views in one visit"
383
  msgstr ""
384
 
385
- #: wp-piwik/dashboard/overview.php:60
386
- #: wp-piwik/shortcodes/overview.php:44
387
- msgid "Total time spent"
388
  msgstr ""
389
 
390
- #: wp-piwik/dashboard/overview.php:64
391
- #: wp-piwik/settings/views.php:40
392
- msgid "Shortcut"
393
  msgstr ""
394
 
395
- #: wp-piwik/dashboard/pages.php:23
396
- msgid "Page"
397
  msgstr ""
398
 
399
- #: wp-piwik/dashboard/pages.php:25
400
- #: wp-piwik/dashboard/plugins.php:34
401
- #: wp-piwik/dashboard/visitors.php:63
402
- msgid "Visits"
 
403
  msgstr ""
404
 
405
- #: wp-piwik/dashboard/visitors.php:54
406
- msgid ""
407
- "The graph contains the values shown in the table below (visitors / unique / "
408
- "bounces). The red line show a linear trendline (unique)."
409
  msgstr ""
410
 
411
- #: wp-piwik/dashboard/visitors.php:62
412
- msgid "Date"
413
  msgstr ""
414
 
415
- #: wp-piwik/dashboard/visitors.php:66
416
- msgid "Page Views"
417
  msgstr ""
418
 
419
- #: wp-piwik/dashboard/visitors.php:83
420
- msgid "Unique TOTAL"
421
  msgstr ""
422
 
423
- #: wp-piwik/dashboard/visitors.php:83
424
- msgid "Sum"
425
  msgstr ""
426
 
427
- #: wp-piwik/dashboard/visitors.php:83
428
- msgid "Avg"
429
  msgstr ""
430
 
431
- #: wp-piwik/dashboard/websites.php:21
432
- msgid "Website"
433
  msgstr ""
434
 
435
- #: wp-piwik/settings/credits.php:3
436
- msgid "Thank you very much for your donation"
437
  msgstr ""
438
 
439
- #: wp-piwik/settings/credits.php:3
440
- msgid "the Piwik team itself"
441
  msgstr ""
442
 
443
- #: wp-piwik/settings/credits.php:3
444
- msgid ", and all people flattering this"
445
  msgstr ""
446
 
447
- #: wp-piwik/settings/credits.php:8
448
- msgid ""
449
- "Graphs powered by <a href=\"http://www.jqplot.com/\">jqPlot</a> (License: "
450
- "GPL 2.0 and MIT) and <a href=\"http://omnipotent.net/jquery.sparkline/"
451
- "\">jQuery Sparklines</a> (License: New BSD License)."
452
  msgstr ""
453
 
454
- #: wp-piwik/settings/credits.php:13
455
- msgid "Metabox support inspired by"
456
  msgstr ""
457
 
458
- #: wp-piwik/settings/credits.php:14
459
- msgid "Tabbed settings page suggested by the"
460
  msgstr ""
461
 
462
- #: wp-piwik/settings/credits.php:19
463
- msgid "Thank you very much"
464
  msgstr ""
465
 
466
- #: wp-piwik/settings/credits.php:19
467
- msgid ", and"
468
  msgstr ""
469
 
470
- #: wp-piwik/settings/credits.php:19
471
- msgid "for your translation work"
472
  msgstr ""
473
 
474
- #: wp-piwik/settings/credits.php:24
475
- msgid ""
476
- "Thank you very much, all users who send me mails containing criticism, "
477
- "commendation, feature requests and bug reports! You help me to make WP-Piwik "
478
- "much better."
479
  msgstr ""
480
 
481
- #: wp-piwik/settings/credits.php:29
482
- msgid ""
483
- "Thank <strong>you</strong> for using my plugin. It is the best commendation "
484
- "if my piece of code is really used!"
485
  msgstr ""
486
 
487
- #: wp-piwik/settings/homepage.php:4
488
- msgid "Thanks for using WP-Piwik!"
489
  msgstr ""
490
 
491
- #: wp-piwik/settings/homepage.php:8
492
- msgid "You are using Piwik"
 
 
 
493
  msgstr ""
494
 
495
- #: wp-piwik/settings/homepage.php:8
496
- msgid "and"
 
497
  msgstr ""
498
 
499
- #: wp-piwik/settings/homepage.php:8
500
- msgid "in network mode"
501
  msgstr ""
502
 
503
- #: wp-piwik/settings/homepage.php:10
504
- msgid "Auto site configuration is"
 
505
  msgstr ""
506
 
507
- #: wp-piwik/settings/homepage.php:10
508
- #: wp-piwik/settings/homepage.php:11
509
- #: wp-piwik/settings/support.php:20
510
- msgid "enabled"
511
  msgstr ""
512
 
513
- #: wp-piwik/settings/homepage.php:10
514
- #: wp-piwik/settings/homepage.php:11
515
- msgid "disabled"
516
  msgstr ""
517
 
518
- #: wp-piwik/settings/homepage.php:11
519
- msgid "Tracking code insertion is"
 
520
  msgstr ""
521
 
522
- #: wp-piwik/settings/piwik.php:7
523
- #: wp-piwik/settings/sitebrowser.php:7
524
- #: wp-piwik/settings/tracking.php:7
525
- #: wp-piwik/settings/views.php:7
526
- msgid ""
527
- "Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik "
528
- "won't be able to connect to Piwik."
529
  msgstr ""
530
 
531
- #: wp-piwik/settings/piwik.php:11
 
 
532
  #, php-format
533
- msgid ""
534
- "To use this plugin you will need your own Piwik instance. If you do not "
535
- "already have a Piwik setup, you have two simple options: use either <a "
536
- "href='%s'>Self-hosted</a> or <a href='%s'>Cloud-hosted</a>."
537
  msgstr ""
538
 
539
- #: wp-piwik/settings/piwik.php:16
540
- msgid "To enable Piwik statistics, please enter"
 
541
  msgstr ""
542
 
543
- #: wp-piwik/settings/piwik.php:18
544
  msgid ""
545
- "your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server "
546
- "path (like /var/www/mydomain.com/httpdocs/piwik/)"
 
547
  msgstr ""
548
 
549
- #: wp-piwik/settings/piwik.php:19
550
- msgid ""
551
- "your personal Piwik authentification token. You can get the token on the API "
552
- "page inside your Piwik interface. It looks like "
553
- "&quot;1234a5cd6789e0a12345b678cd9012ef&quot;."
 
 
 
 
 
 
 
 
 
554
  msgstr ""
555
 
556
- #: wp-piwik/settings/piwik.php:21
557
- msgid "No idea what I'm talking about?"
558
  msgstr ""
559
 
560
- #: wp-piwik/settings/piwik.php:21
561
- msgid "Get help."
562
  msgstr ""
563
 
564
- #: wp-piwik/settings/piwik.php:23
565
  msgid ""
566
- "<strong>Important note:</strong> If you do not host this blog on your own, "
567
- "your site admin is able to get your auth token from the database."
568
  msgstr ""
569
 
570
- #: wp-piwik/settings/piwik.php:27
571
- msgid "Piwik URL"
572
  msgstr ""
573
 
574
- #: wp-piwik/settings/piwik.php:33
575
- msgid "Piwik path"
576
  msgstr ""
577
 
578
- #: wp-piwik/settings/piwik.php:39
579
- msgid "Invalid path. Please enter the file path to Piwik."
580
  msgstr ""
581
 
582
- #: wp-piwik/settings/piwik.php:43
583
- msgid "Auth token"
 
584
  msgstr ""
585
 
586
- #: wp-piwik/settings/piwik.php:48
587
- msgid "Enable cache"
588
  msgstr ""
589
 
590
- #: wp-piwik/settings/piwik.php:50
591
- msgid "Cache API calls, which not contain today's values, for a week"
592
  msgstr ""
593
 
594
- #: wp-piwik/settings/piwik.php:54
595
- msgid "Auto config"
596
  msgstr ""
597
 
598
- #: wp-piwik/settings/piwik.php:57
599
- msgid ""
600
- "Check this to automatically choose your blog from your Piwik sites by URL. "
601
- "If your blog is not added to Piwik yet, WP-Piwik will add a new site."
 
 
602
  msgstr ""
603
 
604
- #: wp-piwik/settings/piwik.php:65
605
  msgid ""
606
- "Please check URL and auth token. You need at least view access to one site."
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  msgstr ""
608
 
609
- #: wp-piwik/settings/piwik.php:73
610
- msgid "Choose site"
611
  msgstr ""
612
 
613
- #: wp-piwik/settings/piwik.php:87
614
- msgid "Determined site"
615
  msgstr ""
616
 
617
- #: wp-piwik/settings/piwik.php:100
618
- msgid "Expert Settings"
619
  msgstr ""
620
 
621
- #: wp-piwik/settings/piwik.php:102
622
- msgid "Connection timeout"
623
  msgstr ""
624
 
625
- #: wp-piwik/settings/piwik.php:109
626
- msgid "Disable SSL peer verification"
627
  msgstr ""
628
 
629
- #: wp-piwik/settings/piwik.php:111
630
- msgid "not recommended"
631
  msgstr ""
632
 
633
- #: wp-piwik/settings/piwik.php:114
634
- msgid "User agent"
 
 
 
 
 
 
 
 
635
  msgstr ""
636
 
637
- #: wp-piwik/settings/piwik.php:126
638
  msgid ""
639
- "Further expert settings require cURL. See <a href=\"http://www.php.net/"
640
- "manual/curl.setup.php\">PHP manual</a>"
641
  msgstr ""
642
 
643
- #: wp-piwik/settings/sitebrowser.php:26
644
- msgid "ID"
645
  msgstr ""
646
 
647
- #: wp-piwik/settings/sitebrowser.php:27
648
- msgid "Title"
649
  msgstr ""
650
 
651
- #: wp-piwik/settings/sitebrowser.php:28
652
- msgid "URL"
653
  msgstr ""
654
 
655
- #: wp-piwik/settings/sitebrowser.php:29
656
- msgid "Site ID (Piwik)"
 
 
657
  msgstr ""
658
 
659
- #: wp-piwik/settings/support.php:2
660
- msgid "WordPress.org forum about WP-Piwik"
661
  msgstr ""
662
 
663
- #: wp-piwik/settings/support.php:9
664
- msgid "Debugging"
 
 
 
 
 
 
 
 
665
  msgstr ""
666
 
667
- #: wp-piwik/settings/support.php:10
668
  msgid ""
669
- "Either allow_url_fopen has to be enabled <em>or</em> cURL has to be "
670
- "available:"
671
  msgstr ""
672
 
673
- #: wp-piwik/settings/support.php:13
674
- msgid "cURL is"
675
  msgstr ""
676
 
677
- #: wp-piwik/settings/support.php:14
678
- #: wp-piwik/settings/support.php:19
679
- msgid "not"
680
  msgstr ""
681
 
682
- #: wp-piwik/settings/support.php:15
683
- msgid "available"
684
  msgstr ""
685
 
686
- #: wp-piwik/settings/support.php:18
687
- msgid "allow_url_fopen is"
688
  msgstr ""
689
 
690
- #: wp-piwik/settings/support.php:28
691
- msgid "Test script result"
692
  msgstr ""
693
 
694
- #: wp-piwik/settings/support.php:32
695
- msgid "Please confirm your reset request"
696
  msgstr ""
697
 
698
- #: wp-piwik/settings/support.php:32
699
- msgid ""
700
- "YES, please reset <strong>all</strong> WP-Piwik settings <strong>except</"
701
- "strong> auth token and Piwi URL."
702
  msgstr ""
703
 
704
- #: wp-piwik/settings/support.php:38
705
- msgid "WP-Piwik reset done"
706
  msgstr ""
707
 
708
- #: wp-piwik/settings/support.php:43
709
- msgid "Get more debug information"
710
  msgstr ""
711
 
712
- #: wp-piwik/settings/support.php:45
713
- msgid "Run test script"
714
  msgstr ""
715
 
716
- #: wp-piwik/settings/support.php:46
717
- msgid "Get site configuration details"
718
  msgstr ""
719
 
720
- #: wp-piwik/settings/support.php:47
721
- msgid "Reset WP-Piwik settings except auth token and Piwik URL"
722
  msgstr ""
723
 
724
- #: wp-piwik/settings/support.php:47
725
  msgid ""
726
- "This will not affect Piwik itself. Resetting large networks may take some "
727
- "minutes."
728
  msgstr ""
729
 
730
- #: wp-piwik/settings/support.php:49
731
- msgid ""
732
- "You have to enter your auth token and the Piwik URL before you can access "
733
- "more debug functions."
734
  msgstr ""
735
 
736
- #: wp-piwik/settings/support.php:52
737
- msgid "Latest support threads on WordPress.org"
738
  msgstr ""
739
 
740
- #: wp-piwik/settings/tracking.php:10
741
- msgid "Add tracking code"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
742
  msgstr ""
743
 
744
- #: wp-piwik/settings/tracking.php:14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745
  msgid ""
746
- "If your template uses wp_footer(), WP-Piwik can automatically add the Piwik "
747
- "javascript code to your blog."
748
  msgstr ""
749
 
750
- #: wp-piwik/settings/tracking.php:31
751
- msgid "Tracking code preview"
752
  msgstr ""
753
 
754
- #: wp-piwik/settings/tracking.php:37
755
- msgid "&lt;noscript&gt; code preview"
756
  msgstr ""
757
 
758
- #: wp-piwik/settings/tracking.php:43
759
- msgid "Default tracking"
760
  msgstr ""
761
 
762
- #: wp-piwik/settings/tracking.php:45
763
- msgid "WP-Piwik uses the Piwik default tracking code."
764
  msgstr ""
765
 
766
- #: wp-piwik/settings/tracking.php:48
767
- msgid "Use js/index.php"
 
 
 
 
768
  msgstr ""
769
 
770
- #: wp-piwik/settings/tracking.php:50
771
  msgid ""
772
- "WP-Piwik can automatically use js/index.php instead of piwik.js and piwik."
773
- "php. See"
774
  msgstr ""
775
 
776
- #: wp-piwik/settings/tracking.php:53
777
- msgid "Use proxy script"
778
  msgstr ""
779
 
780
- #: wp-piwik/settings/tracking.php:55
781
- msgid "WP-Piwik will use the piwik.php proxy script. See"
782
  msgstr ""
783
 
784
- #: wp-piwik/settings/tracking.php:58
785
- msgid "JavaScript code position"
786
  msgstr ""
787
 
788
- #: wp-piwik/settings/tracking.php:60
789
- msgid "Footer"
 
790
  msgstr ""
791
 
792
- #: wp-piwik/settings/tracking.php:61
793
- msgid "Header"
 
 
 
 
794
  msgstr ""
795
 
796
- #: wp-piwik/settings/tracking.php:63
 
 
 
 
797
  msgid ""
798
- "Choose whether the JavaScript code is added to the footer or the header."
 
 
799
  msgstr ""
800
 
801
- #: wp-piwik/settings/tracking.php:66
802
- msgid "Add &lt;noscript&gt;"
803
  msgstr ""
804
 
805
- #: wp-piwik/settings/tracking.php:68
806
- msgid "Adds the &lt;noscript&gt; code to your footer."
807
  msgstr ""
808
 
809
- #: wp-piwik/settings/tracking.php:68
810
- #: wp-piwik/settings/tracking.php:73
811
- #: wp-piwik/settings/tracking.php:123
812
- msgid "Disabled in proxy mode."
813
  msgstr ""
814
 
815
- #: wp-piwik/settings/tracking.php:71
816
- msgid "Add rec parameter to noscript code"
817
  msgstr ""
818
 
819
- #: wp-piwik/settings/tracking.php:73
820
- msgid "Enable tracking for visitors without JavaScript (not recommended). See"
 
 
 
821
  msgstr ""
822
 
823
- #: wp-piwik/settings/tracking.php:76
824
- msgid "Disable cookies"
 
 
825
  msgstr ""
826
 
827
- #: wp-piwik/settings/tracking.php:78
828
- msgid "Disable all tracking cookies for a visitor."
829
  msgstr ""
830
 
831
- #: wp-piwik/settings/tracking.php:81
832
- msgid "Limit cookie lifetime"
833
  msgstr ""
834
 
835
- #: wp-piwik/settings/tracking.php:83
836
- msgid "Limit cookie lifetime as follows"
837
  msgstr ""
838
 
839
- #: wp-piwik/settings/tracking.php:84
840
- msgid "Visitor timeout (seconds)"
 
 
841
  msgstr ""
842
 
843
- #: wp-piwik/settings/tracking.php:84
844
- msgid "Session timeout (seconds)"
845
  msgstr ""
846
 
847
- #: wp-piwik/settings/tracking.php:86
848
- msgid "Track visitors across all subdomains"
 
849
  msgstr ""
850
 
851
- #: wp-piwik/settings/tracking.php:88
852
- msgid "Adds *.-prefix to cookie domain."
853
  msgstr ""
854
 
855
- #: wp-piwik/settings/tracking.php:91
856
- msgid "Track visitors across all alias URLs"
857
  msgstr ""
858
 
859
- #: wp-piwik/settings/tracking.php:93
860
- msgid "Adds *.-prefix to tracked domain."
861
  msgstr ""
862
 
863
- #: wp-piwik/settings/tracking.php:96
864
- msgid "Track search"
865
  msgstr ""
866
 
867
- #: wp-piwik/settings/tracking.php:98
868
- msgid "Use Piwik's advanced Site Search Analytics feature. See"
869
  msgstr ""
870
 
871
- #: wp-piwik/settings/tracking.php:101
872
- msgid "Track 404"
873
  msgstr ""
874
 
875
- #: wp-piwik/settings/tracking.php:103
876
- msgid "WP-Piwik can automatically add a 404-category to track 404-page-visits."
877
  msgstr ""
878
 
879
- #: wp-piwik/settings/tracking.php:106
880
- msgid "Add annotation on new post"
881
  msgstr ""
882
 
883
- #: wp-piwik/settings/tracking.php:108
884
- msgid "Add a Piwik annotation on each new post, see"
885
  msgstr ""
886
 
887
- #: wp-piwik/settings/tracking.php:111
888
- msgid "Add new file types for download tracking"
889
  msgstr ""
890
 
891
- #: wp-piwik/settings/tracking.php:113
892
- msgid ""
893
- "Add file extensions for download tracking, divided by a vertical bar "
894
- "(&#124;), see"
895
  msgstr ""
896
 
897
- #: wp-piwik/settings/tracking.php:116
898
- msgid "Show custom variables box"
899
  msgstr ""
900
 
901
- #: wp-piwik/settings/tracking.php:118
902
- msgid "Show a custom vars edit box on post edit page."
903
  msgstr ""
904
 
905
- #: wp-piwik/settings/tracking.php:121
906
- msgid "Avoid mod_security"
907
  msgstr ""
908
 
909
- #: wp-piwik/settings/tracking.php:123
910
- msgid ""
911
- "WP-Piwik can automatically force the Tracking Code to sent data in POST. See"
912
  msgstr ""
913
 
914
- #: wp-piwik/settings/tracking.php:126
915
- msgid "Add data-cfasync=false"
916
  msgstr ""
917
 
918
- #: wp-piwik/settings/tracking.php:128
919
- msgid ""
920
- "Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to "
921
- "ignore the script."
922
  msgstr ""
923
 
924
- #: wp-piwik/settings/tracking.php:131
925
- msgid "CDN URL"
926
  msgstr ""
927
 
928
- #: wp-piwik/settings/tracking.php:133
929
- msgid ""
930
- "Leave blank if you do not want to define a CDN URL or you do not know what "
931
- "this is."
932
  msgstr ""
933
 
934
- #: wp-piwik/settings/tracking.php:136
935
- msgid "Force Piwik to use a specific protocol"
936
  msgstr ""
937
 
938
- #: wp-piwik/settings/tracking.php:137
939
- msgid "Disabled (default)"
940
  msgstr ""
941
 
942
- #: wp-piwik/settings/tracking.php:140
943
- msgid ""
944
- "Choose if you want to explicitly force Piwik to use HTTP or HTTPS. Does not "
945
- "work with a CDN URL."
946
  msgstr ""
947
 
948
- #: wp-piwik/settings/tracking.php:143
949
- msgid "Track admin pages"
 
 
 
 
 
 
 
 
 
 
950
  msgstr ""
951
 
952
- #: wp-piwik/settings/tracking.php:145
953
- msgid ""
954
- "Enable to track users on admin pages (remember to configure the tracking "
955
- "filter appropriately)."
 
 
 
956
  msgstr ""
957
 
958
- #: wp-piwik/settings/tracking.php:148
959
- msgid "Track RSS feeds"
 
960
  msgstr ""
961
 
962
- #: wp-piwik/settings/tracking.php:150
963
- msgid "Enable to track posts in feeds via tracking pixel."
964
  msgstr ""
965
 
966
- #: wp-piwik/settings/tracking.php:153
967
- msgid "Track RSS feed links as campaign"
968
  msgstr ""
969
 
970
- #: wp-piwik/settings/tracking.php:155
971
- msgid "This will add Piwik campaign parameters to the RSS feed links."
972
  msgstr ""
973
 
974
- #: wp-piwik/settings/tracking.php:156
975
- msgid "Campaign"
976
  msgstr ""
977
 
978
- #: wp-piwik/settings/tracking.php:156
979
- msgid "Keyword: post name."
980
  msgstr ""
981
 
982
- #: wp-piwik/settings/tracking.php:159
983
- msgid "Tracking filter"
 
984
  msgstr ""
985
 
986
- #: wp-piwik/settings/tracking.php:166
987
- msgid "Choose users by user role you do <strong>not</strong> want to track."
 
 
 
 
988
  msgstr ""
989
 
990
- #: wp-piwik/settings/views.php:10
991
- msgid "WP-Piwik display name"
 
 
 
992
  msgstr ""
993
 
994
- #: wp-piwik/settings/views.php:12
995
- msgid "Plugin name shown in WordPress."
996
  msgstr ""
997
 
998
- #: wp-piwik/settings/views.php:14
999
- msgid "Default date"
 
 
1000
  msgstr ""
1001
 
1002
- #: wp-piwik/settings/views.php:16
1003
- #: wp-piwik/settings/views.php:24
1004
- msgid "yesterday"
 
1005
  msgstr ""
1006
 
1007
- #: wp-piwik/settings/views.php:17
1008
- #: wp-piwik/settings/views.php:25
1009
- msgid "today"
1010
  msgstr ""
1011
 
1012
- #: wp-piwik/settings/views.php:19
1013
- msgid "Default date shown on statistics page."
 
1014
  msgstr ""
1015
 
1016
- #: wp-piwik/settings/views.php:21
1017
- msgid "Home Dashboard"
 
1018
  msgstr ""
1019
 
1020
- #: wp-piwik/settings/views.php:23
1021
- msgid "Hide overview"
 
1022
  msgstr ""
1023
 
1024
- #: wp-piwik/settings/views.php:24
1025
- #: wp-piwik/settings/views.php:25
1026
- #: wp-piwik/settings/views.php:26
1027
- msgid "Show overview"
1028
  msgstr ""
1029
 
1030
- #: wp-piwik/settings/views.php:26
1031
- msgid "last 30 days"
1032
  msgstr ""
1033
 
1034
- #: wp-piwik/settings/views.php:28
1035
- msgid "Chart"
1036
  msgstr ""
1037
 
1038
- #: wp-piwik/settings/views.php:29
1039
- msgid "SEO <em>(slow!)</em>"
1040
  msgstr ""
1041
 
1042
- #: wp-piwik/settings/views.php:30
1043
- msgid ""
1044
- "Configure WP-Piwik widgets to be shown on your WordPress Home Dashboard."
1045
  msgstr ""
1046
 
1047
- #: wp-piwik/settings/views.php:32
1048
- msgid "Show graph on WordPress Toolbar"
1049
  msgstr ""
1050
 
1051
- #: wp-piwik/settings/views.php:34
1052
- msgid "Display the last 30 days visitor stats on WordPress Toolbar."
1053
  msgstr ""
1054
 
1055
- #: wp-piwik/settings/views.php:36
1056
- msgid "SEO data"
1057
  msgstr ""
1058
 
1059
- #: wp-piwik/settings/views.php:38
1060
- msgid "Display SEO ranking data on statistics page. <em>(Slow!)</em>"
1061
  msgstr ""
1062
 
1063
- #: wp-piwik/settings/views.php:42
1064
- msgid "Display a shortcut to Piwik itself."
1065
  msgstr ""
1066
 
1067
- #: wp-piwik/settings/views.php:44
1068
- msgid "Display to"
1069
  msgstr ""
1070
 
1071
- #: wp-piwik/settings/views.php:51
1072
- msgid "Choose user roles allowed to see the statistics page."
1073
  msgstr ""
1074
 
1075
- #: wp-piwik/settings/views.php:53
1076
- msgid "Disable time limit"
1077
  msgstr ""
1078
 
1079
- #: wp-piwik/settings/views.php:55
1080
- msgid "Use set_time_limit(0) if stats page causes a time out."
1081
  msgstr ""
1082
 
1083
- #: wp-piwik/settings/views.php:57
1084
- msgid "Show per post stats"
1085
  msgstr ""
1086
 
1087
- #: wp-piwik/settings/views.php:59
1088
- msgid "Show stats about single posts at the post edit admin page."
1089
  msgstr ""
1090
 
1091
- #: wp-piwik/settings/views.php:61
1092
- msgid "Enable shortcodes"
1093
  msgstr ""
1094
 
1095
- #: wp-piwik/settings/views.php:63
1096
- msgid "Enable shortcodes in post or page content."
 
 
 
 
 
 
 
 
 
 
 
 
1097
  msgstr ""
1098
 
1099
- #: wp-piwik/shortcodes/overview.php:28
1100
- msgid "Error"
 
 
 
 
1101
  msgstr ""
1102
 
1103
- #: wp-piwik/shortcodes/overview.php:48
1104
- msgid "No data available"
 
 
 
1105
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP-Piwik\n"
4
+ "POT-Creation-Date: 2015-05-10 16:33+0100\n"
5
+ "PO-Revision-Date: 2015-05-10 16:34+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.5\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-KeywordsList: __;_e\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: classes/WP_Piwik.php:185
20
  #, php-format
21
  msgid "%s %s installed."
22
  msgstr ""
23
 
24
+ #: classes/WP_Piwik.php:185
 
25
  msgid "Next you should connect to Piwik"
26
  msgstr ""
27
 
28
+ #: classes/WP_Piwik.php:215
29
+ #, php-format
30
+ msgid "%s updated to %s."
31
+ msgstr ""
32
+
33
+ #: classes/WP_Piwik.php:215
34
  msgid "Please validate your configuration"
35
  msgstr ""
36
 
37
+ #: classes/WP_Piwik.php:247 classes/WP_Piwik.php:463
 
 
 
 
 
38
  msgid "Settings"
39
  msgstr ""
40
 
41
+ #: classes/WP_Piwik.php:250
 
42
  msgid "Important"
43
  msgstr ""
44
 
45
+ #: classes/WP_Piwik.php:331 classes/WP_Piwik.php:353
46
+ msgid "Piwik Statistics"
 
47
  msgstr ""
48
 
49
+ #: classes/WP_Piwik.php:901
50
+ msgid "An error occured"
 
51
  msgstr ""
52
 
53
+ #: classes/WP_Piwik.php:901 classes/WP_Piwik/Admin/Settings.php:62
54
+ msgid "Support"
 
55
  msgstr ""
56
 
57
+ #: classes/WP_Piwik.php:1150
58
+ msgid "Cheatin&#8217; uh?"
 
59
  msgstr ""
60
 
61
+ #: classes/WP_Piwik/Admin/Settings.php:19
62
+ msgid "Changes saved."
 
63
  msgstr ""
64
 
65
+ #: classes/WP_Piwik/Admin/Settings.php:30
66
+ msgid "Thanks for using WP-Piwik!"
 
 
 
67
  msgstr ""
68
 
69
+ #: classes/WP_Piwik/Admin/Settings.php:35
70
+ #, php-format
71
+ msgid "WP-Piwik %s is successfully connected to Piwik %s."
 
 
 
 
 
72
  msgstr ""
73
 
74
+ #: classes/WP_Piwik/Admin/Settings.php:35
75
+ #, php-format
76
+ msgid "You are running WordPress %s."
 
 
 
77
  msgstr ""
78
 
79
+ #: classes/WP_Piwik/Admin/Settings.php:35
80
+ #, php-format
81
+ msgid ""
82
+ "You are running a WordPress %s blog network (WPMU). WP-Piwik will handle "
83
+ "your sites as different websites."
84
  msgstr ""
85
 
86
+ #: classes/WP_Piwik/Admin/Settings.php:37
87
+ #, php-format
88
+ msgid ""
89
+ "WP-Piwik %s was not able to connect to Piwik using your configuration. Check "
90
+ "the &raquo;Connect to Piwik&laquo; section below."
91
  msgstr ""
92
 
93
+ #: classes/WP_Piwik/Admin/Settings.php:40
94
+ #, php-format
95
+ msgid ""
96
+ "WP-Piwik %s has to be connected to Piwik first. Check the &raquo;Connect to "
97
+ "Piwik&laquo; section below."
98
  msgstr ""
99
 
100
+ #: classes/WP_Piwik/Admin/Settings.php:44
101
+ msgid "Connect to Piwik"
 
102
  msgstr ""
103
 
104
+ #: classes/WP_Piwik/Admin/Settings.php:49
105
+ msgid "Show Statistics"
 
 
 
106
  msgstr ""
107
 
108
+ #: classes/WP_Piwik/Admin/Settings.php:53
109
+ msgid "Enable Tracking"
 
 
110
  msgstr ""
111
 
112
+ #: classes/WP_Piwik/Admin/Settings.php:58
113
+ msgid "Expert Settings"
 
 
114
  msgstr ""
115
 
116
+ #: classes/WP_Piwik/Admin/Settings.php:66
117
+ msgid "Credits"
 
 
118
  msgstr ""
119
 
120
+ #: classes/WP_Piwik/Admin/Settings.php:79
121
+ msgid ""
122
+ "WP-Piwik is a WordPress plugin to show a selection of Piwik stats in your "
123
+ "WordPress admin dashboard and to add and configure your Piwik tracking code. "
124
+ "To use this you will need your own Piwik instance. If you do not already "
125
+ "have a Piwik setup, you have two simple options: use either"
126
  msgstr ""
127
 
128
+ #: classes/WP_Piwik/Admin/Settings.php:79
129
+ msgid "Self-hosted"
 
 
130
  msgstr ""
131
 
132
+ #: classes/WP_Piwik/Admin/Settings.php:79
133
+ msgid "or"
 
 
134
  msgstr ""
135
 
136
+ #: classes/WP_Piwik/Admin/Settings.php:79
137
+ msgid "Cloud-hosted"
 
 
 
 
138
  msgstr ""
139
 
140
+ #: classes/WP_Piwik/Admin/Settings.php:82
141
+ msgid ""
142
+ "Neither cURL nor fopen are available. So WP-Piwik can not use the HTTP API "
143
+ "and not connect to Piwik Pro."
144
  msgstr ""
145
 
146
+ #: classes/WP_Piwik/Admin/Settings.php:82
147
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:30
148
+ msgid "More information"
 
 
149
  msgstr ""
150
 
151
+ #: classes/WP_Piwik/Admin/Settings.php:84
152
+ msgid "You can choose between three connection methods:"
 
 
 
153
  msgstr ""
154
 
155
+ #: classes/WP_Piwik/Admin/Settings.php:84
156
+ #: classes/WP_Piwik/Admin/Settings.php:87
157
+ msgid "Self-hosted (HTTP API, default)"
 
 
158
  msgstr ""
159
 
160
+ #: classes/WP_Piwik/Admin/Settings.php:84
161
+ msgid ""
162
+ "This is the default option for a self-hosted Piwik and should work for most "
163
+ "configurations. WP-Piwik will connect to Piwk using http(s)."
164
  msgstr ""
165
 
166
+ #: classes/WP_Piwik/Admin/Settings.php:84
167
+ #: classes/WP_Piwik/Admin/Settings.php:88
168
+ msgid "Self-hosted (PHP API)"
169
  msgstr ""
170
 
171
+ #: classes/WP_Piwik/Admin/Settings.php:84
172
+ msgid ""
173
+ "Choose this, if your self-hosted Piwik and WordPress are running on the same "
174
+ "machine and you know the full server path to your Piwik instance."
175
  msgstr ""
176
 
177
+ #: classes/WP_Piwik/Admin/Settings.php:84
178
+ #: classes/WP_Piwik/Admin/Settings.php:89
179
+ msgid "Cloud-hosted (Piwik Pro)"
 
 
180
  msgstr ""
181
 
182
+ #: classes/WP_Piwik/Admin/Settings.php:84
183
+ msgid ""
184
+ "If you are using a cloud-hosted Piwik by Piwik Pro, you can simply use this "
185
+ "option."
186
  msgstr ""
187
 
188
+ #: classes/WP_Piwik/Admin/Settings.php:85
189
+ msgid "Piwik Mode"
 
 
 
 
 
190
  msgstr ""
191
 
192
+ #: classes/WP_Piwik/Admin/Settings.php:86
193
+ msgid "Disabled (WP-Piwik will not connect to Piwik)"
 
 
 
194
  msgstr ""
195
 
196
+ #: classes/WP_Piwik/Admin/Settings.php:92
197
+ msgid "Piwik URL"
 
198
  msgstr ""
199
 
200
+ #: classes/WP_Piwik/Admin/Settings.php:92
201
+ msgid ""
202
+ "Enter your Piwik URL. This is the same URL you use to access your Piwik "
203
+ "instance, e.g. http://www.example.com/piwik/."
204
  msgstr ""
205
 
206
+ #: classes/WP_Piwik/Admin/Settings.php:93
207
+ msgid "Piwik path"
 
208
  msgstr ""
209
 
210
+ #: classes/WP_Piwik/Admin/Settings.php:93
211
+ msgid "Enter the file path to your Piwik instance, e.g. /var/www/piwik/."
 
212
  msgstr ""
213
 
214
+ #: classes/WP_Piwik/Admin/Settings.php:94
215
+ msgid "Piwik user"
 
 
216
  msgstr ""
217
 
218
+ #: classes/WP_Piwik/Admin/Settings.php:94
219
+ msgid ""
220
+ "Enter your Piwik Pro username. It is also part of your URL: http://USERNAME."
221
+ "piwik.pro."
222
  msgstr ""
223
 
224
+ #: classes/WP_Piwik/Admin/Settings.php:95
225
+ msgid "Auth token"
 
226
  msgstr ""
227
 
228
+ #: classes/WP_Piwik/Admin/Settings.php:95
229
+ msgid ""
230
+ "Enter your Piwik auth token here. It is an alphanumerical code like "
231
+ "0a1b2c34d56e78901fa2bc3d45678efa."
232
  msgstr ""
233
 
234
+ #: classes/WP_Piwik/Admin/Settings.php:95
235
+ #, php-format
236
+ msgid "See %sWP-Piwik FAQ%s."
 
237
  msgstr ""
238
 
239
+ #: classes/WP_Piwik/Admin/Settings.php:100
240
+ msgid "Auto config"
 
 
241
  msgstr ""
242
 
243
+ #: classes/WP_Piwik/Admin/Settings.php:100
244
+ msgid ""
245
+ "Check this to automatically choose your blog from your Piwik sites by URL. "
246
+ "If your blog is not added to Piwik yet, WP-Piwik will add a new site."
247
  msgstr ""
248
 
249
+ #: classes/WP_Piwik/Admin/Settings.php:106
250
+ msgid "Save settings to start estimation."
 
 
251
  msgstr ""
252
 
253
+ #: classes/WP_Piwik/Admin/Settings.php:109
254
+ msgid "Determined site"
255
  msgstr ""
256
 
257
+ #: classes/WP_Piwik/Admin/Settings.php:114
258
+ msgid "Select site"
259
  msgstr ""
260
 
261
+ #: classes/WP_Piwik/Admin/Settings.php:122
262
+ msgid "Piwik default date"
 
 
 
 
 
 
 
 
 
 
 
 
263
  msgstr ""
264
 
265
+ #: classes/WP_Piwik/Admin/Settings.php:123
266
+ #: classes/WP_Piwik/Admin/Settings.php:136
267
+ msgid "Today"
 
 
 
268
  msgstr ""
269
 
270
+ #: classes/WP_Piwik/Admin/Settings.php:124
271
+ #: classes/WP_Piwik/Admin/Settings.php:135
272
+ msgid "Yesterday"
 
 
 
 
 
 
273
  msgstr ""
274
 
275
+ #: classes/WP_Piwik/Admin/Settings.php:125
276
+ msgid "Current month"
 
 
 
 
277
  msgstr ""
278
 
279
+ #: classes/WP_Piwik/Admin/Settings.php:126
280
+ msgid "Last month"
 
 
 
 
 
 
 
 
 
281
  msgstr ""
282
 
283
+ #: classes/WP_Piwik/Admin/Settings.php:127
284
+ msgid "Current week"
 
 
285
  msgstr ""
286
 
287
+ #: classes/WP_Piwik/Admin/Settings.php:128
288
+ msgid "Last week"
 
289
  msgstr ""
290
 
291
+ #: classes/WP_Piwik/Admin/Settings.php:129
292
+ msgid "Default date shown on statistics page."
 
 
293
  msgstr ""
294
 
295
+ #: classes/WP_Piwik/Admin/Settings.php:131
296
+ msgid "Show SEO data"
 
297
  msgstr ""
298
 
299
+ #: classes/WP_Piwik/Admin/Settings.php:131
300
+ msgid "Display SEO ranking data on statistics page."
 
301
  msgstr ""
302
 
303
+ #: classes/WP_Piwik/Admin/Settings.php:131
304
+ #: classes/WP_Piwik/Admin/Settings.php:142
305
+ msgid "Slow!"
306
  msgstr ""
307
 
308
+ #: classes/WP_Piwik/Admin/Settings.php:133
309
+ msgid "Dashboard overview"
310
  msgstr ""
311
 
312
+ #: classes/WP_Piwik/Admin/Settings.php:134
313
+ #: classes/WP_Piwik/Admin/Settings.php:172
314
+ #: classes/WP_Piwik/Admin/Settings.php:174
315
+ #: classes/WP_Piwik/Admin/Settings.php:195
316
+ msgid "Disabled"
317
  msgstr ""
318
 
319
+ #: classes/WP_Piwik/Admin/Settings.php:137
320
+ msgid "Last 30 days"
 
 
321
  msgstr ""
322
 
323
+ #: classes/WP_Piwik/Admin/Settings.php:138
324
+ msgid "Enable WP-Piwik dashboard widget &quot;Overview&quot;."
325
  msgstr ""
326
 
327
+ #: classes/WP_Piwik/Admin/Settings.php:140
328
+ msgid "Dashboard graph"
329
  msgstr ""
330
 
331
+ #: classes/WP_Piwik/Admin/Settings.php:140
332
+ msgid "Enable WP-Piwik dashboard widget &quot;Graph&quot;."
333
  msgstr ""
334
 
335
+ #: classes/WP_Piwik/Admin/Settings.php:142
336
+ msgid "Dashboard SEO"
337
  msgstr ""
338
 
339
+ #: classes/WP_Piwik/Admin/Settings.php:142
340
+ msgid "Enable WP-Piwik dashboard widget &quot;SEO&quot;."
341
  msgstr ""
342
 
343
+ #: classes/WP_Piwik/Admin/Settings.php:144
344
+ msgid "Show graph on WordPress Toolbar"
345
  msgstr ""
346
 
347
+ #: classes/WP_Piwik/Admin/Settings.php:144
348
+ msgid "Display a last 30 days visitor graph on WordPress' toolbar."
349
  msgstr ""
350
 
351
+ #: classes/WP_Piwik/Admin/Settings.php:146
352
+ msgid "Display stats to"
353
  msgstr ""
354
 
355
+ #: classes/WP_Piwik/Admin/Settings.php:153
356
+ msgid "Choose user roles allowed to see the statistics page."
357
  msgstr ""
358
 
359
+ #: classes/WP_Piwik/Admin/Settings.php:155
360
+ msgid "Show per post stats"
 
 
 
361
  msgstr ""
362
 
363
+ #: classes/WP_Piwik/Admin/Settings.php:155
364
+ msgid "Show stats about single posts at the post edit admin page."
365
  msgstr ""
366
 
367
+ #: classes/WP_Piwik/Admin/Settings.php:157
368
+ msgid "Piwik shortcut"
369
  msgstr ""
370
 
371
+ #: classes/WP_Piwik/Admin/Settings.php:157
372
+ msgid "Display a shortcut to Piwik itself."
373
  msgstr ""
374
 
375
+ #: classes/WP_Piwik/Admin/Settings.php:159
376
+ msgid "WP-Piwik display name"
377
  msgstr ""
378
 
379
+ #: classes/WP_Piwik/Admin/Settings.php:159
380
+ msgid "Plugin name shown in WordPress."
381
  msgstr ""
382
 
383
+ #: classes/WP_Piwik/Admin/Settings.php:161
384
+ msgid "Enable shortcodes"
 
 
 
385
  msgstr ""
386
 
387
+ #: classes/WP_Piwik/Admin/Settings.php:161
388
+ msgid "Enable shortcodes in post or page content."
 
 
389
  msgstr ""
390
 
391
+ #: classes/WP_Piwik/Admin/Settings.php:172
392
+ msgid "You can choose between four tracking code modes:"
393
  msgstr ""
394
 
395
+ #: classes/WP_Piwik/Admin/Settings.php:172
396
+ msgid ""
397
+ "WP-Piwik will not add the tracking code. Use this, if you want to add the "
398
+ "tracking code to your template files or you use another plugin to add the "
399
+ "tracking code."
400
  msgstr ""
401
 
402
+ #: classes/WP_Piwik/Admin/Settings.php:172
403
+ #: classes/WP_Piwik/Admin/Settings.php:175
404
+ msgid "Default tracking"
405
  msgstr ""
406
 
407
+ #: classes/WP_Piwik/Admin/Settings.php:172
408
+ msgid "WP-Piwik will use Piwik's standard tracking code."
409
  msgstr ""
410
 
411
+ #: classes/WP_Piwik/Admin/Settings.php:172
412
+ #: classes/WP_Piwik/Admin/Settings.php:176
413
+ msgid "Use js/index.php"
414
  msgstr ""
415
 
416
+ #: classes/WP_Piwik/Admin/Settings.php:172
417
+ msgid ""
418
+ "You can choose this tracking code, to deliver a minified proxy code and to "
419
+ "avoid using the files called piwik.js or piwik.php."
420
  msgstr ""
421
 
422
+ #: classes/WP_Piwik/Admin/Settings.php:172
423
+ #, php-format
424
+ msgid "See %sreadme file%s."
425
  msgstr ""
426
 
427
+ #: classes/WP_Piwik/Admin/Settings.php:172
428
+ #: classes/WP_Piwik/Admin/Settings.php:177
429
+ msgid "Use proxy script"
430
  msgstr ""
431
 
432
+ #: classes/WP_Piwik/Admin/Settings.php:172
433
+ msgid "Use this tracking code to not reveal the Piwik server URL."
 
 
 
 
 
434
  msgstr ""
435
 
436
+ #: classes/WP_Piwik/Admin/Settings.php:172
437
+ #: classes/WP_Piwik/Admin/Settings.php:192
438
+ #: classes/WP_Piwik/Admin/Settings.php:202
439
  #, php-format
440
+ msgid "See %sPiwik FAQ%s."
 
 
 
441
  msgstr ""
442
 
443
+ #: classes/WP_Piwik/Admin/Settings.php:172
444
+ #: classes/WP_Piwik/Admin/Settings.php:178
445
+ msgid "Enter manually"
446
  msgstr ""
447
 
448
+ #: classes/WP_Piwik/Admin/Settings.php:172
449
  msgid ""
450
+ "Enter your own tracking code manually. You can choose one of the prior "
451
+ "options, pre-configure your tracking code and switch to manually editing at "
452
+ "last."
453
  msgstr ""
454
 
455
+ #: classes/WP_Piwik/Admin/Settings.php:172
456
+ msgid "Use the placeholder {ID} to add the Piwik site ID."
457
+ msgstr ""
458
+
459
+ #: classes/WP_Piwik/Admin/Settings.php:173
460
+ msgid "Add tracking code"
461
+ msgstr ""
462
+
463
+ #: classes/WP_Piwik/Admin/Settings.php:181
464
+ msgid "Tracking code"
465
+ msgstr ""
466
+
467
+ #: classes/WP_Piwik/Admin/Settings.php:183
468
+ msgid "JavaScript code position"
469
  msgstr ""
470
 
471
+ #: classes/WP_Piwik/Admin/Settings.php:184
472
+ msgid "Footer"
473
  msgstr ""
474
 
475
+ #: classes/WP_Piwik/Admin/Settings.php:185
476
+ msgid "Header"
477
  msgstr ""
478
 
479
+ #: classes/WP_Piwik/Admin/Settings.php:186
480
  msgid ""
481
+ "Choose whether the JavaScript code is added to the footer or the header."
 
482
  msgstr ""
483
 
484
+ #: classes/WP_Piwik/Admin/Settings.php:188
485
+ msgid "Noscript code"
486
  msgstr ""
487
 
488
+ #: classes/WP_Piwik/Admin/Settings.php:190
489
+ msgid "Add &lt;noscript&gt;"
490
  msgstr ""
491
 
492
+ #: classes/WP_Piwik/Admin/Settings.php:190
493
+ msgid "Adds the &lt;noscript&gt; code to your footer."
494
  msgstr ""
495
 
496
+ #: classes/WP_Piwik/Admin/Settings.php:190
497
+ #: classes/WP_Piwik/Admin/Settings.php:192
498
+ msgid "Disabled in proxy mode."
499
  msgstr ""
500
 
501
+ #: classes/WP_Piwik/Admin/Settings.php:192
502
+ msgid "Add rec parameter to noscript code"
503
  msgstr ""
504
 
505
+ #: classes/WP_Piwik/Admin/Settings.php:192
506
+ msgid "Enable tracking for visitors without JavaScript (not recommended)."
507
  msgstr ""
508
 
509
+ #: classes/WP_Piwik/Admin/Settings.php:194
510
+ msgid "Enable content tracking"
511
  msgstr ""
512
 
513
+ #: classes/WP_Piwik/Admin/Settings.php:196
514
+ msgid "Track all content blocks"
515
+ msgstr ""
516
+
517
+ #: classes/WP_Piwik/Admin/Settings.php:197
518
+ msgid "Track only visible content blocks"
519
  msgstr ""
520
 
521
+ #: classes/WP_Piwik/Admin/Settings.php:198
522
  msgid ""
523
+ "Content tracking allows you to track interaction with the content of a web "
524
+ "page or application."
525
+ msgstr ""
526
+
527
+ #: classes/WP_Piwik/Admin/Settings.php:198
528
+ #: classes/WP_Piwik/Admin/Settings.php:200
529
+ #: classes/WP_Piwik/Admin/Settings.php:204
530
+ #: classes/WP_Piwik/Admin/Settings.php:206
531
+ #: classes/WP_Piwik/Admin/Settings.php:208
532
+ #: classes/WP_Piwik/Admin/Settings.php:229
533
+ #: classes/WP_Piwik/Admin/Settings.php:231
534
+ #: classes/WP_Piwik/Admin/Settings.php:235
535
+ #, php-format
536
+ msgid "See %sPiwik documentation%s."
537
  msgstr ""
538
 
539
+ #: classes/WP_Piwik/Admin/Settings.php:200
540
+ msgid "Track search"
541
  msgstr ""
542
 
543
+ #: classes/WP_Piwik/Admin/Settings.php:200
544
+ msgid "Use Piwik's advanced Site Search Analytics feature."
545
  msgstr ""
546
 
547
+ #: classes/WP_Piwik/Admin/Settings.php:202
548
+ msgid "Track 404"
549
  msgstr ""
550
 
551
+ #: classes/WP_Piwik/Admin/Settings.php:202
552
+ msgid "WP-Piwik can automatically add a 404-category to track 404-page-visits."
553
  msgstr ""
554
 
555
+ #: classes/WP_Piwik/Admin/Settings.php:204
556
+ msgid "Add annotation on new post"
557
  msgstr ""
558
 
559
+ #: classes/WP_Piwik/Admin/Settings.php:204
560
+ msgid "Add a Piwik annotation on each new post."
561
  msgstr ""
562
 
563
+ #: classes/WP_Piwik/Admin/Settings.php:206
564
+ msgid "Show custom variables box"
565
+ msgstr ""
566
+
567
+ #: classes/WP_Piwik/Admin/Settings.php:206
568
+ msgid " Show a &quot;custom variables&quot; edit box on post edit page."
569
+ msgstr ""
570
+
571
+ #: classes/WP_Piwik/Admin/Settings.php:208
572
+ msgid "Add new file types for download tracking"
573
  msgstr ""
574
 
575
+ #: classes/WP_Piwik/Admin/Settings.php:208
576
  msgid ""
577
+ "Add file extensions for download tracking, divided by a vertical bar "
578
+ "(&#124;)."
579
  msgstr ""
580
 
581
+ #: classes/WP_Piwik/Admin/Settings.php:210
582
+ msgid "Disable cookies"
583
  msgstr ""
584
 
585
+ #: classes/WP_Piwik/Admin/Settings.php:210
586
+ msgid "Disable all tracking cookies for a visitor."
587
  msgstr ""
588
 
589
+ #: classes/WP_Piwik/Admin/Settings.php:212
590
+ msgid "Limit cookie lifetime"
591
  msgstr ""
592
 
593
+ #: classes/WP_Piwik/Admin/Settings.php:212
594
+ msgid ""
595
+ "You can limit the cookie lifetime to avoid tracking your users over a longer "
596
+ "period as necessary."
597
  msgstr ""
598
 
599
+ #: classes/WP_Piwik/Admin/Settings.php:214
600
+ msgid "Visitor timeout (seconds)"
601
  msgstr ""
602
 
603
+ #: classes/WP_Piwik/Admin/Settings.php:216
604
+ msgid "Session timeout (seconds)"
605
+ msgstr ""
606
+
607
+ #: classes/WP_Piwik/Admin/Settings.php:218
608
+ msgid "Referral timeout (seconds)"
609
+ msgstr ""
610
+
611
+ #: classes/WP_Piwik/Admin/Settings.php:220
612
+ msgid "Track admin pages"
613
  msgstr ""
614
 
615
+ #: classes/WP_Piwik/Admin/Settings.php:220
616
  msgid ""
617
+ "Enable to track users on admin pages (remember to configure the tracking "
618
+ "filter appropriately)."
619
  msgstr ""
620
 
621
+ #: classes/WP_Piwik/Admin/Settings.php:223
622
+ msgid "Tracking filter"
623
  msgstr ""
624
 
625
+ #: classes/WP_Piwik/Admin/Settings.php:227
626
+ msgid "Choose users by user role you do <strong>not</strong> want to track."
 
627
  msgstr ""
628
 
629
+ #: classes/WP_Piwik/Admin/Settings.php:229
630
+ msgid "Track subdomains in the same website"
631
  msgstr ""
632
 
633
+ #: classes/WP_Piwik/Admin/Settings.php:229
634
+ msgid "Adds *.-prefix to cookie domain."
635
  msgstr ""
636
 
637
+ #: classes/WP_Piwik/Admin/Settings.php:231
638
+ msgid "Do not count subdomians as outlink"
639
  msgstr ""
640
 
641
+ #: classes/WP_Piwik/Admin/Settings.php:231
642
+ msgid "Adds *.-prefix to tracked domain."
643
  msgstr ""
644
 
645
+ #: classes/WP_Piwik/Admin/Settings.php:233
646
+ msgid "Track RSS feeds"
 
 
647
  msgstr ""
648
 
649
+ #: classes/WP_Piwik/Admin/Settings.php:233
650
+ msgid "Enable to track posts in feeds via tracking pixel."
651
  msgstr ""
652
 
653
+ #: classes/WP_Piwik/Admin/Settings.php:235
654
+ msgid "Track RSS feed links as campaign"
655
  msgstr ""
656
 
657
+ #: classes/WP_Piwik/Admin/Settings.php:235
658
+ msgid "This will add Piwik campaign parameters to the RSS feed links. "
659
  msgstr ""
660
 
661
+ #: classes/WP_Piwik/Admin/Settings.php:237
662
+ msgid "RSS feed campaign"
663
  msgstr ""
664
 
665
+ #: classes/WP_Piwik/Admin/Settings.php:237
666
+ msgid "Keyword: post name."
667
  msgstr ""
668
 
669
+ #: classes/WP_Piwik/Admin/Settings.php:242
670
  msgid ""
671
+ "Usually, you do not need to change these settings. If you want to do so, you "
672
+ "should know what you do or you got an expert's advice."
673
  msgstr ""
674
 
675
+ #: classes/WP_Piwik/Admin/Settings.php:244
676
+ msgid "Enable cache"
 
 
677
  msgstr ""
678
 
679
+ #: classes/WP_Piwik/Admin/Settings.php:244
680
+ msgid "Cache API calls, which not contain today's values, for a week."
681
  msgstr ""
682
 
683
+ #: classes/WP_Piwik/Admin/Settings.php:246
684
+ msgid "Disable time limit"
685
+ msgstr ""
686
+
687
+ #: classes/WP_Piwik/Admin/Settings.php:246
688
+ msgid "Use set_time_limit(0) if stats page causes a time out."
689
+ msgstr ""
690
+
691
+ #: classes/WP_Piwik/Admin/Settings.php:248
692
+ msgid "Connection timeout"
693
+ msgstr ""
694
+
695
+ #: classes/WP_Piwik/Admin/Settings.php:250
696
+ msgid "Disable SSL peer verification"
697
+ msgstr ""
698
+
699
+ #: classes/WP_Piwik/Admin/Settings.php:250
700
+ msgid "not recommended"
701
+ msgstr ""
702
+
703
+ #: classes/WP_Piwik/Admin/Settings.php:252
704
+ msgid "User agent"
705
  msgstr ""
706
 
707
+ #: classes/WP_Piwik/Admin/Settings.php:253
708
+ msgid "Use the PHP default user agent"
709
+ msgstr ""
710
+
711
+ #: classes/WP_Piwik/Admin/Settings.php:253
712
+ msgid "empty"
713
+ msgstr ""
714
+
715
+ #: classes/WP_Piwik/Admin/Settings.php:254
716
+ msgid "Define a specific user agent"
717
+ msgstr ""
718
+
719
+ #: classes/WP_Piwik/Admin/Settings.php:256
720
+ msgid "Specific user agent"
721
+ msgstr ""
722
+
723
+ #: classes/WP_Piwik/Admin/Settings.php:258
724
+ msgid "Add data-cfasync=false"
725
+ msgstr ""
726
+
727
+ #: classes/WP_Piwik/Admin/Settings.php:258
728
+ #, php-format
729
+ msgid "See %sCloudFlare Knowledge Base%s."
730
+ msgstr ""
731
+
732
+ #: classes/WP_Piwik/Admin/Settings.php:258
733
  msgid ""
734
+ "Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to "
735
+ "ignore the script. "
736
  msgstr ""
737
 
738
+ #: classes/WP_Piwik/Admin/Settings.php:260
739
+ msgid "CDN URL"
740
  msgstr ""
741
 
742
+ #: classes/WP_Piwik/Admin/Settings.php:262
743
+ msgid "CDN URL (SSL)"
744
  msgstr ""
745
 
746
+ #: classes/WP_Piwik/Admin/Settings.php:264
747
+ msgid "Force Piwik to use a specific protocol"
748
  msgstr ""
749
 
750
+ #: classes/WP_Piwik/Admin/Settings.php:265
751
+ msgid "Disabled (default)"
752
  msgstr ""
753
 
754
+ #: classes/WP_Piwik/Admin/Settings.php:266
755
+ msgid "http"
756
+ msgstr ""
757
+
758
+ #: classes/WP_Piwik/Admin/Settings.php:267
759
+ msgid "https (SSL)"
760
  msgstr ""
761
 
762
+ #: classes/WP_Piwik/Admin/Settings.php:268
763
  msgid ""
764
+ "Choose if you want to explicitly force Piwik to use HTTP or HTTPS. Does not "
765
+ "work with a CDN URL."
766
  msgstr ""
767
 
768
+ #: classes/WP_Piwik/Admin/Settings.php:427
769
+ msgid "Donate"
770
  msgstr ""
771
 
772
+ #: classes/WP_Piwik/Admin/Settings.php:429
773
+ msgid "If you like WP-Piwik, you can support its development by a donation:"
774
  msgstr ""
775
 
776
+ #: classes/WP_Piwik/Admin/Settings.php:467
777
+ msgid "My Amazon.de wishlist"
778
  msgstr ""
779
 
780
+ #: classes/WP_Piwik/Admin/Settings.php:470
781
+ #: classes/WP_Piwik/Admin/Settings.php:517
782
+ msgid "Please don't forget to vote the compatibility at the"
783
  msgstr ""
784
 
785
+ #: classes/WP_Piwik/Admin/Settings.php:501
786
+ msgid "Thank you very much for your donation"
787
+ msgstr ""
788
+
789
+ #: classes/WP_Piwik/Admin/Settings.php:501
790
+ msgid "the Piwik team itself"
791
  msgstr ""
792
 
793
+ #: classes/WP_Piwik/Admin/Settings.php:501
794
+ msgid ", and all people flattering this"
795
+ msgstr ""
796
+
797
+ #: classes/WP_Piwik/Admin/Settings.php:502
798
  msgid ""
799
+ "Graphs powered by <a href=\"http://www.jqplot.com/\">jqPlot</a> (License: "
800
+ "GPL 2.0 and MIT) and <a href=\"http://omnipotent.net/jquery.sparkline/"
801
+ "\">jQuery Sparklines</a> (License: New BSD License)."
802
  msgstr ""
803
 
804
+ #: classes/WP_Piwik/Admin/Settings.php:503
805
+ msgid "Metabox support inspired by"
806
  msgstr ""
807
 
808
+ #: classes/WP_Piwik/Admin/Settings.php:504
809
+ msgid "Tabbed settings page suggested by the"
810
  msgstr ""
811
 
812
+ #: classes/WP_Piwik/Admin/Settings.php:505
813
+ msgid "Thank you very much"
 
 
814
  msgstr ""
815
 
816
+ #: classes/WP_Piwik/Admin/Settings.php:505
817
+ msgid "for your translation work"
818
  msgstr ""
819
 
820
+ #: classes/WP_Piwik/Admin/Settings.php:506
821
+ msgid ""
822
+ "Thank you very much, all users who send me mails containing criticism, "
823
+ "commendation, feature requests and bug reports! You help me to make WP-Piwik "
824
+ "much better."
825
  msgstr ""
826
 
827
+ #: classes/WP_Piwik/Admin/Settings.php:507
828
+ msgid ""
829
+ "Thank <strong>you</strong> for using my plugin. It is the best commendation "
830
+ "if my piece of code is really used!"
831
  msgstr ""
832
 
833
+ #: classes/WP_Piwik/Admin/Settings.php:516
834
+ msgid "The best place to get help:"
835
  msgstr ""
836
 
837
+ #: classes/WP_Piwik/Admin/Settings.php:516
838
+ msgid "WP-Piwik support forum"
839
  msgstr ""
840
 
841
+ #: classes/WP_Piwik/Admin/Settings.php:519
842
+ msgid "Debugging"
843
  msgstr ""
844
 
845
+ #: classes/WP_Piwik/Admin/Settings.php:520
846
+ msgid ""
847
+ "Either allow_url_fopen has to be enabled <em>or</em> cURL has to be "
848
+ "available:"
849
  msgstr ""
850
 
851
+ #: classes/WP_Piwik/Admin/Settings.php:523
852
+ msgid "cURL is"
853
  msgstr ""
854
 
855
+ #: classes/WP_Piwik/Admin/Settings.php:524
856
+ #: classes/WP_Piwik/Admin/Settings.php:529
857
+ msgid "not"
858
  msgstr ""
859
 
860
+ #: classes/WP_Piwik/Admin/Settings.php:525
861
+ msgid "available"
862
  msgstr ""
863
 
864
+ #: classes/WP_Piwik/Admin/Settings.php:528
865
+ msgid "allow_url_fopen is"
866
  msgstr ""
867
 
868
+ #: classes/WP_Piwik/Admin/Settings.php:530
869
+ msgid "enabled"
870
  msgstr ""
871
 
872
+ #: classes/WP_Piwik/Admin/Settings.php:533
873
+ msgid "Latest support threads on WordPress.org"
874
  msgstr ""
875
 
876
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:17
877
+ msgid "site"
878
  msgstr ""
879
 
880
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:18
881
+ msgid "sites"
882
  msgstr ""
883
 
884
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:22
885
+ msgid "No site configured yet."
886
  msgstr ""
887
 
888
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:27
889
+ msgid "ID"
890
  msgstr ""
891
 
892
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:28
893
+ msgid "Title"
894
  msgstr ""
895
 
896
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:29
897
+ msgid "URL"
898
  msgstr ""
899
 
900
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:30
901
+ msgid "Site ID (Piwik)"
 
 
902
  msgstr ""
903
 
904
+ #: classes/WP_Piwik/Admin/Sitebrowser.php:73
905
+ msgid "Site not created yet."
906
  msgstr ""
907
 
908
+ #: classes/WP_Piwik/Admin/Statistics.php:12
909
+ msgid "Statistics"
910
  msgstr ""
911
 
912
+ #: classes/WP_Piwik/Admin/Statistics.php:20
913
+ msgid "Currently shown stats:"
914
  msgstr ""
915
 
916
+ #: classes/WP_Piwik/Request/Php.php:25
917
+ msgid "Could not resolve"
 
918
  msgstr ""
919
 
920
+ #: classes/WP_Piwik/Request/Php.php:25
921
+ msgid "realpath() returns false"
922
  msgstr ""
923
 
924
+ #: classes/WP_Piwik/Request/Php.php:32
925
+ msgid "Class Piwik\\FrontController does not exists."
 
 
926
  msgstr ""
927
 
928
+ #: classes/WP_Piwik/Request/Php.php:35
929
+ msgid "Class Piwik\\API\\Request does not exists."
930
  msgstr ""
931
 
932
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:10
933
+ msgid "Piwik Custom Variables"
 
 
934
  msgstr ""
935
 
936
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:21
937
+ msgid "Name"
938
  msgstr ""
939
 
940
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:21
941
+ msgid "Value"
942
  msgstr ""
943
 
944
+ #: classes/WP_Piwik/Template/MetaBoxCustomVars.php:30
945
+ msgid "Set custom variables for a page view"
 
 
946
  msgstr ""
947
 
948
+ #: classes/WP_Piwik/Widget.php:91
949
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:35
950
+ #: classes/WP_Piwik/Widget/Browsers.php:35
951
+ #: classes/WP_Piwik/Widget/Chart.php:41
952
+ #: classes/WP_Piwik/Widget/Noresult.php:23
953
+ #: classes/WP_Piwik/Widget/Overview.php:24
954
+ #: classes/WP_Piwik/Widget/Plugins.php:23 classes/WP_Piwik/Widget/Post.php:25
955
+ #: classes/WP_Piwik/Widget/Screens.php:35
956
+ #: classes/WP_Piwik/Widget/Search.php:23 classes/WP_Piwik/Widget/Seo.php:20
957
+ #: classes/WP_Piwik/Widget/Systems.php:33
958
+ #: classes/WP_Piwik/Widget/Visitors.php:35
959
+ msgid "Piwik error"
960
  msgstr ""
961
 
962
+ #: classes/WP_Piwik/Widget.php:100
963
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:37
964
+ #: classes/WP_Piwik/Widget/Browsers.php:37
965
+ #: classes/WP_Piwik/Widget/Screens.php:37
966
+ #: classes/WP_Piwik/Widget/Systems.php:35
967
+ #: classes/WP_Piwik/Widget/Visitors.php:57
968
+ msgid "Unique"
969
  msgstr ""
970
 
971
+ #: classes/WP_Piwik/Widget.php:102 classes/WP_Piwik/Widget/Plugins.php:25
972
+ #: classes/WP_Piwik/Widget/Visitors.php:57
973
+ msgid "Visits"
974
  msgstr ""
975
 
976
+ #: classes/WP_Piwik/Widget.php:104
977
+ msgid "Hits"
978
  msgstr ""
979
 
980
+ #: classes/WP_Piwik/Widget.php:106
981
+ msgid "Actions"
982
  msgstr ""
983
 
984
+ #: classes/WP_Piwik/Widget.php:144
985
+ msgid "No data available."
986
  msgstr ""
987
 
988
+ #: classes/WP_Piwik/Widget.php:275
989
+ msgid "week"
990
  msgstr ""
991
 
992
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:16
993
+ msgid "Browser Details"
994
  msgstr ""
995
 
996
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:37
997
+ #: classes/WP_Piwik/Widget/Browsers.php:37
998
+ msgid "Browser"
999
  msgstr ""
1000
 
1001
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:37
1002
+ #: classes/WP_Piwik/Widget/Browsers.php:37
1003
+ #: classes/WP_Piwik/Widget/Plugins.php:25
1004
+ #: classes/WP_Piwik/Widget/Screens.php:37
1005
+ #: classes/WP_Piwik/Widget/Systems.php:35
1006
+ msgid "Percent"
1007
  msgstr ""
1008
 
1009
+ #: classes/WP_Piwik/Widget/BrowserDetails.php:53
1010
+ #: classes/WP_Piwik/Widget/Browsers.php:53
1011
+ #: classes/WP_Piwik/Widget/Screens.php:53
1012
+ #: classes/WP_Piwik/Widget/Systems.php:51
1013
+ msgid "Others"
1014
  msgstr ""
1015
 
1016
+ #: classes/WP_Piwik/Widget/Browsers.php:16
1017
+ msgid "Browsers"
1018
  msgstr ""
1019
 
1020
+ #: classes/WP_Piwik/Widget/Chart.php:17
1021
+ #: classes/WP_Piwik/Widget/Overview.php:40 classes/WP_Piwik/Widget/Post.php:37
1022
+ #: classes/WP_Piwik/Widget/Visitors.php:17
1023
+ msgid "Visitors"
1024
  msgstr ""
1025
 
1026
+ #: classes/WP_Piwik/Widget/Chart.php:69
1027
+ msgid ""
1028
+ "The graph contains the values shown in the table below (visitors / unique / "
1029
+ "bounces). The red line show a linear trendline (unique)."
1030
  msgstr ""
1031
 
1032
+ #: classes/WP_Piwik/Widget/Keywords.php:16
1033
+ msgid "Keywords"
 
1034
  msgstr ""
1035
 
1036
+ #: classes/WP_Piwik/Widget/Noresult.php:16
1037
+ #: classes/WP_Piwik/Widget/Search.php:16
1038
+ msgid "Site Search"
1039
  msgstr ""
1040
 
1041
+ #: classes/WP_Piwik/Widget/Noresult.php:25
1042
+ #: classes/WP_Piwik/Widget/Search.php:25
1043
+ msgid "Keyword"
1044
  msgstr ""
1045
 
1046
+ #: classes/WP_Piwik/Widget/Noresult.php:25
1047
+ #: classes/WP_Piwik/Widget/Search.php:25
1048
+ msgid "Requests"
1049
  msgstr ""
1050
 
1051
+ #: classes/WP_Piwik/Widget/Noresult.php:25
1052
+ #: classes/WP_Piwik/Widget/Search.php:25
1053
+ #: classes/WP_Piwik/Widget/Visitors.php:57
1054
+ msgid "Bounced"
1055
  msgstr ""
1056
 
1057
+ #: classes/WP_Piwik/Widget/Overview.php:17 classes/WP_Piwik/Widget/Post.php:18
1058
+ msgid "Overview"
1059
  msgstr ""
1060
 
1061
+ #: classes/WP_Piwik/Widget/Overview.php:17
1062
+ msgid "dashboard"
1063
  msgstr ""
1064
 
1065
+ #: classes/WP_Piwik/Widget/Overview.php:41 classes/WP_Piwik/Widget/Post.php:38
1066
+ msgid "Unique visitors"
1067
  msgstr ""
1068
 
1069
+ #: classes/WP_Piwik/Widget/Overview.php:42 classes/WP_Piwik/Widget/Post.php:39
1070
+ msgid "Page views"
 
1071
  msgstr ""
1072
 
1073
+ #: classes/WP_Piwik/Widget/Overview.php:43 classes/WP_Piwik/Widget/Post.php:40
1074
+ msgid "Total time spent"
1075
  msgstr ""
1076
 
1077
+ #: classes/WP_Piwik/Widget/Overview.php:44 classes/WP_Piwik/Widget/Post.php:42
1078
+ msgid "Bounce count"
1079
  msgstr ""
1080
 
1081
+ #: classes/WP_Piwik/Widget/Overview.php:47 classes/WP_Piwik/Widget/Post.php:41
1082
+ msgid "Time/visit"
1083
  msgstr ""
1084
 
1085
+ #: classes/WP_Piwik/Widget/Overview.php:47
1086
+ msgid "Max. page views in one visit"
1087
  msgstr ""
1088
 
1089
+ #: classes/WP_Piwik/Widget/Overview.php:48 classes/WP_Piwik/Widget/Post.php:46
1090
+ msgid "Shortcut"
1091
  msgstr ""
1092
 
1093
+ #: classes/WP_Piwik/Widget/Pages.php:16
1094
+ msgid "Pages"
1095
  msgstr ""
1096
 
1097
+ #: classes/WP_Piwik/Widget/Plugins.php:16
1098
+ msgid "Plugins"
1099
  msgstr ""
1100
 
1101
+ #: classes/WP_Piwik/Widget/Plugins.php:25
1102
+ msgid "Plugin"
1103
  msgstr ""
1104
 
1105
+ #: classes/WP_Piwik/Widget/Post.php:43
1106
+ msgid "Min. generation time"
1107
  msgstr ""
1108
 
1109
+ #: classes/WP_Piwik/Widget/Post.php:44
1110
+ msgid "Max. generation time"
1111
  msgstr ""
1112
 
1113
+ #: classes/WP_Piwik/Widget/Referrers.php:16
1114
+ msgid "Referrers"
1115
  msgstr ""
1116
 
1117
+ #: classes/WP_Piwik/Widget/Screens.php:16
1118
+ msgid "Resolutions"
1119
  msgstr ""
1120
 
1121
+ #: classes/WP_Piwik/Widget/Screens.php:37
1122
+ msgid "Resolution"
1123
+ msgstr ""
1124
+
1125
+ #: classes/WP_Piwik/Widget/Seo.php:13
1126
+ msgid "SEO"
1127
+ msgstr ""
1128
+
1129
+ #: classes/WP_Piwik/Widget/Systems.php:14
1130
+ msgid "Operation Systems"
1131
+ msgstr ""
1132
+
1133
+ #: classes/WP_Piwik/Widget/Systems.php:35
1134
+ msgid "Operation System"
1135
  msgstr ""
1136
 
1137
+ #: classes/WP_Piwik/Widget/Visitors.php:57
1138
+ msgid "Date"
1139
+ msgstr ""
1140
+
1141
+ #: classes/WP_Piwik/Widget/Visitors.php:57
1142
+ msgid "Page Views"
1143
  msgstr ""
1144
 
1145
+ #: wp-piwik.php:60
1146
+ #, php-format
1147
+ msgid ""
1148
+ "WP-Piwik requires at least PHP 5.3. You are using the deprecated version %s. "
1149
+ "Please update PHP to use WP-Piwik."
1150
  msgstr ""
piwik.php DELETED
@@ -1,8 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * [!] Deprecated proxy script. Use proxy/piwik.php instead.
5
- */
6
-
7
- header("Location: proxy/piwik.php");
8
- die();
 
 
 
 
 
 
 
 
proxy/config.php CHANGED
@@ -1,13 +1,30 @@
1
- <?php
2
-
3
- require('../../../../wp-load.php');
4
- require_once('../classes/WP_Piwik_Settings.php');
5
- require_once('../classes/WP_Piwik_Logger_Dummy.php');
6
-
7
- $logger = new WP_Piwik_Logger_Dummy(__CLASS__);
8
- $settings = new WP_Piwik_Settings($logger);
9
-
10
- $PIWIK_URL = $settings->getGlobalOption('piwik_url');
11
- $TOKEN_AUTH = $settings->getGlobalOption('piwik_token');
12
- $timeout = $settings->getGlobalOption('connection_timeout');
13
- ini_set('display_errors',0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require ('../../../../wp-load.php');
3
+
4
+ require_once ('../classes/WP_Piwik/Settings.php');
5
+ require_once ('../classes/WP_Piwik/Logger.php');
6
+ require_once ('../classes/WP_Piwik/Logger/Dummy.php');
7
+
8
+ $logger = new WP_Piwik\Logger\Dummy ( __CLASS__ );
9
+ $settings = new WP_Piwik\Settings ( $logger );
10
+
11
+ $protocol = (isset ( $_SERVER ['HTTPS'] ) && $_SERVER ['HTTPS'] != 'off') ? 'https' : 'http';
12
+
13
+ switch ($settings->getGlobalOption ( 'piwik_mode' )) {
14
+ case 'php' :
15
+ $PIWIK_URL = $protocol . ':' . $settings->getGlobalOption ( 'proxy_url' );
16
+ break;
17
+ case 'pro' :
18
+ $PIWIK_URL = 'https://' . $settings->getGlobalOption ( 'piwik_user' ) . '.piwik.pro/';
19
+ break;
20
+ default :
21
+ $PIWIK_URL = $settings->getGlobalOption ( 'piwik_url' );
22
+ }
23
+
24
+ if (substr ( $PIWIK_URL, 0, 2 ) == '//')
25
+ $PIWIK_URL = (isset ( $_SERVER ['HTTPS'] ) ? 'https:' : 'http:') . $PIWIK_URL;
26
+
27
+ $TOKEN_AUTH = $settings->getGlobalOption ( 'piwik_token' );
28
+ $timeout = $settings->getGlobalOption ( 'connection_timeout' );
29
+
30
+ ini_set ( 'display_errors', 0 );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
 
3
  Contributors: Braekling
4
  Requires at least: 4.0
5
- Tested up to: 4.2
6
- Stable tag: 0.9.9.18
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
8
  Tags: statistics, stats, analytics, piwik, wpmu
9
 
@@ -49,7 +49,7 @@ See section "Installation".
49
  * Graphs powered by [jqPlot](http://www.jqplot.com/) (GPL 2.0 and MIT) and and [jQuery Sparklines](http://omnipotent.net/jquery.sparkline/) (New BSD License).
50
  * Metabox support inspired by [Heiko Rabe's metabox demo plugin](http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins).
51
  * Translation credits see plugin settings
52
- * Donations: Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., Oleg I., M. N., Daniel K., James L., Jochen K., the Piwik team itself, and all people flattering this.
53
  * All users who send me mails containing criticism, commendation, feature requests and bug reports - you help me to make WP-Piwik much better!
54
 
55
  Thank you all!
@@ -60,11 +60,17 @@ Thank you all!
60
 
61
  To use this plugin you will need your own Piwik instance. If you do not already have a Piwik setup, you have two simple options: use either [Self-hosted](http://piwik.org/) or [Cloud-hosted](http://piwik.org/hosting/).
62
 
63
- As soon as Piwik works, you'll be able to configure WP-Piwik: The Piwik URL is the same URL you use to access your Piwik, e.g. for the demo site: http://demo.piwik.org. The auth token is some kind of secret password, which allows WP-Piwik to get the necessary data from Piwik. To get your auth token, log in to Piwik, click at your user name (top right) and click at "API" (left sidebar menu). E.g., on (this demo site)[http://demo.piwik.org/index.php?module=API&action=listAllAPI&idSite=7&period=day&date=yesterday] you can see the auth token "anonymous".
64
 
65
- = How to reset/remove all WP-Piwik settings without uninstalling? =
66
 
67
- Login to your admin dashboard and open http://YOUR_BLOG_URL/wp-admin/options-general.php?page=wp-piwik/wp-piwik.php&tab=support&mode=resetconfirmed&full=1
 
 
 
 
 
 
68
 
69
  = Tracking does not work on HostGator! / The test script shows an empty response. =
70
 
@@ -75,12 +81,8 @@ Try to enable the "avoid mod_security" option (WP-Piwik settings, Tracking tab)
75
  See [this support thread](http://wordpress.org/support/topic/plugin-wp-piwik-https-ssl-support?replies=3).
76
 
77
  = Overview shortcode shows no unique visitors using a yearly range. =
78
- See [Piwik FAQ](http://piwik.org/faq/how-to/#faq_113).
79
 
80
- = Can I also access some Piwik values using a PHP call? =
81
-
82
- Yes, you can access also available shortcodes using PHP, too. See this example:
83
- echo $GLOBALS['wp_piwik']->shortcode(array('module' => 'post', 'range' => 'last300', 'key' => 'sum_daily_nb_uniq_visitors'));
84
 
85
  == Installation ==
86
 
@@ -121,10 +123,16 @@ Add WP-Piwik to your /wp-content/plugins folder and enable it as [Network Plugin
121
 
122
  == Upgrade Notice ==
123
 
124
- Please update Piwik if not done yet (Piwik 2.7 or higher is recommended).
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
128
  = 0.9.9.18 =
129
  * Improvement: Define additional file extensions for tracking downloads
130
  * Improvement: Added a POT file to support translators (Note: 1.0 will change a lot, so please don't spend too much time in translating the current version, e.g., by creating an all new translation. With 1.0 I will also offer a translation platform to support your work.)
2
 
3
  Contributors: Braekling
4
  Requires at least: 4.0
5
+ Tested up to: 4.2.2
6
+ Stable tag: 0.10.0.3
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6046779
8
  Tags: statistics, stats, analytics, piwik, wpmu
9
 
49
  * Graphs powered by [jqPlot](http://www.jqplot.com/) (GPL 2.0 and MIT) and and [jQuery Sparklines](http://omnipotent.net/jquery.sparkline/) (New BSD License).
50
  * Metabox support inspired by [Heiko Rabe's metabox demo plugin](http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins).
51
  * Translation credits see plugin settings
52
+ * Donations: Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., Oleg I., M. N., Daniel K., James L., Jochen K., Cyril P., Thomas K., the Piwik team itself, and all people flattering this.
53
  * All users who send me mails containing criticism, commendation, feature requests and bug reports - you help me to make WP-Piwik much better!
54
 
55
  Thank you all!
60
 
61
  To use this plugin you will need your own Piwik instance. If you do not already have a Piwik setup, you have two simple options: use either [Self-hosted](http://piwik.org/) or [Cloud-hosted](http://piwik.org/hosting/).
62
 
63
+ As soon as Piwik works, you'll be able to configure WP-Piwik: The Piwik URL is the same URL you use to access your Piwik, e.g. for the demo site: http://demo.piwik.org. The auth token is some kind of secret password, which allows WP-Piwik to get the necessary data from Piwik. To get your auth token, log in to Piwik, click at your user name (top right) and click at "API" (left sidebar menu).
64
 
65
+ = Can I contribute to WP-Piwik as translator? =
66
 
67
+ You like to contribute to WP-Piwik translations? Please use the [Transifex translation community](https://www.transifex.com/projects/p/wp-piwik/).
68
+
69
+ Of course, I will add missing languages if requested, and I will also upload the existing language files of older WP-Piwik releases.
70
+
71
+ If you can't (or don not want to) use transifex, you can also translate languages/wp-piwik.pot delivered with WP-Piwik.
72
+
73
+ Thank you very much! :-)
74
 
75
  = Tracking does not work on HostGator! / The test script shows an empty response. =
76
 
81
  See [this support thread](http://wordpress.org/support/topic/plugin-wp-piwik-https-ssl-support?replies=3).
82
 
83
  = Overview shortcode shows no unique visitors using a yearly range. =
 
84
 
85
+ See [Piwik FAQ](http://piwik.org/faq/how-to/#faq_113).
 
 
 
86
 
87
  == Installation ==
88
 
123
 
124
  == Upgrade Notice ==
125
 
126
+ This is a full refactored version of WP-Piwik. Please check your settings after updating and make sure everything is working as expected.
127
 
128
  == Changelog ==
129
 
130
+ = 0.10.0.3 =
131
+ * Public beta of WP-Piwik 1.0
132
+ * Full refactored code
133
+ * Feature: Limit referral cookie lifetime
134
+ * Feature: Enable content tracking
135
+
136
  = 0.9.9.18 =
137
  * Improvement: Define additional file extensions for tracking downloads
138
  * Improvement: Added a POT file to support translators (Note: 1.0 will change a lot, so please don't spend too much time in translating the current version, e.g., by creating an all new translation. With 1.0 I will also offer a translation platform to support your work.)
settings/.htaccess DELETED
@@ -1 +0,0 @@
1
- Deny from all
 
settings/credits.php DELETED
@@ -1,31 +0,0 @@
1
- <tr>
2
- <td>
3
- <strong><?php _e('Thank you very much for your donation', 'wp-piwik'); ?>:</strong> Marco L., Rolf W., Tobias U., Lars K., Donna F., Kevin D., Ramos S., Thomas M., John C., Andreas G., Ben M., Myra R. I., Carlos U. R.-S., Oleg I., M. N., Daniel K., James L., Jochen K., <?php _e('the Piwik team itself','wp-piwik');?><?php _e(', and all people flattering this','wp-piwik'); ?>!
4
- </td>
5
- </tr>
6
- <tr>
7
- <td>
8
- <?php _e('Graphs powered by <a href="http://www.jqplot.com/">jqPlot</a> (License: GPL 2.0 and MIT) and <a href="http://omnipotent.net/jquery.sparkline/">jQuery Sparklines</a> (License: New BSD License).','wp-piwik'); ?>
9
- </td>
10
- </tr>
11
- <tr>
12
- <td>
13
- <?php _e('Metabox support inspired by', 'wp-piwik'); echo ' <a href="http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins">Heiko Rabe\'s metabox demo plugin</a>.';?>
14
- <?php _e('Tabbed settings page suggested by the', 'wp-piwik'); echo' <a href="http://wp.smashingmagazine.com/2011/10/20/create-tabs-wordpress-settings-pages/">Smashing Magazine</a>.';?>
15
- </td>
16
- </tr>
17
- <tr>
18
- <td>
19
- <?php _e('Thank you very much','wp-piwik'); ?>, <a href="http://blogu.programeshqip.org/">Besnik Bleta</a>, <a href="http://www.fatcow.com/">FatCow</a>, <a href="http://www.pamukkaleturkey.com/">Rene</a>, Fab, <a href="http://ezbizniz.com/">EzBizNiz</a>, Gormer, Natalya, <a href="www.aggeliopolis.gr">AggelioPolis</a><?php _e(', and', 'wp-piwik'); ?> <a href="http://wwww.webhostinggeeks.com">Web Hosting Geeks</a>, <a href="http://www.webhostingrating.com">Web Hosting Rating</a>, <a href="http://www.webhostinghub.com">Nata Strazda (Web Hosting Hub)</a>, <a href="http://www.libreoffice.ir">Hossein, LibreOffice localization team</a>, <a href="http://www.vogliaditerra.com">Ste</a> &amp; Chris <?php _e('for your translation work','wp-piwik'); ?>!
20
- </td>
21
- </tr>
22
- <tr>
23
- <td>
24
- <?php _e('Thank you very much, all users who send me mails containing criticism, commendation, feature requests and bug reports! You help me to make WP-Piwik much better.','wp-piwik'); ?>
25
- </td>
26
- </tr>
27
- <tr>
28
- <td>
29
- <?php _e('Thank <strong>you</strong> for using my plugin. It is the best commendation if my piece of code is really used!','wp-piwik'); ?>
30
- </td>
31
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings/homepage.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- $strVersion = $this->callPiwikAPI('API.getPiwikVersion');
3
- // http://wordpress.org/support/rss/tags/wp-piwik
4
- ?><tr><td><strong><?php _e('Thanks for using WP-Piwik!', 'wp-piwik'); ?></strong></td></tr>
5
- <tr><td><?php
6
- if (is_array($strVersion) && $strVersion['result'] == 'error') self::showErrorMessage($strVersion['message']);
7
- elseif (empty($strVersion)) self::showErrorMessage('Piwik did not answer. Please check your entered Piwik URL.');
8
- else echo __('You are using Piwik','wp-piwik').' '.$strVersion.' '.__('and', 'wp-piwik').' WP-Piwik '.self::$strVersion.(is_plugin_active_for_network('wp-piwik/wp-piwik.php')?' '.__('in network mode', 'wp-piwik'):'').'.';
9
- ?></td></tr>
10
- <tr><td><?php _e('Auto site configuration is','wp-piwik'); ?> <strong><?php echo (self::$settings->getGlobalOption('auto_site_config')?__('enabled','wp-piwik'):__('disabled','wp-piwik')); ?>.</strong></td></tr>
11
- <tr><td><?php _e('Tracking code insertion is','wp-piwik'); ?> <strong><?php echo (self::$settings->getGlobalOption('add_tracking_code')?__('enabled','wp-piwik'):__('disabled','wp-piwik')); ?>.</strong></td></tr>
 
 
 
 
 
 
 
 
 
 
 
settings/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- // Nothing to see...
 
 
settings/piwik.php DELETED
@@ -1,128 +0,0 @@
1
- <?php
2
- $bolCURL = function_exists('curl_init');
3
- $bolFOpen = ini_get('allow_url_fopen');
4
- if (!$bolFOpen && !$bolCURL) {
5
- ?><tr>
6
- <td colspan="2">
7
- <strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.', 'wp-piwik'); ?></strong>
8
- </td>
9
- </tr><?php } else { ?><tr>
10
- <td colspan="2">
11
- <?php printf(__("To use this plugin you will need your own Piwik instance. If you do not already have a Piwik setup, you have two simple options: use either <a href='%s'>Self-hosted</a> or <a href='%s'>Cloud-hosted</a>.", 'wp-piwik'), 'http://piwik.org/', 'http://piwik.org/hosting/'); ?>
12
- </td>
13
- </tr>
14
- <tr>
15
- <td colspan="2">
16
- <?php _e('To enable Piwik statistics, please enter', 'wp-piwik'); ?>:
17
- <ol>
18
- <li><?php _e('your Piwik base URL (like http://mydomain.com/piwik) or your Piwik server path (like /var/www/mydomain.com/httpdocs/piwik/)', 'wp-piwik'); ?></li>
19
- <li><?php _e('your personal Piwik authentification token. You can get the token on the API page inside your Piwik interface. It looks like &quot;1234a5cd6789e0a12345b678cd9012ef&quot;.', 'wp-piwik'); ?></li>
20
- </ol>
21
- <?php _e('No idea what I\'m talking about?', 'wp-piwik'); ?> <a href="https://wordpress.org/plugins/wp-piwik/faq/"><?php _e('Get help.', 'wp-piwik'); ?></a>
22
- <?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?>
23
- <p><?php _e('<strong>Important note:</strong> If you do not host this blog on your own, your site admin is able to get your auth token from the database.', 'wp-piwik'); ?></p>
24
- <?php } ?>
25
- </td>
26
- </tr><tr>
27
- <th><?php _e('Piwik URL', 'wp-piwik'); ?> (REST API):</th>
28
- <td>
29
- <input type="radio" name="wp-piwik_mode" onchange="javascript:$j('#wp-piwik_path,#wp-piwik_url').toggleClass('wp-piwik-input-hide');" value="http" <?php echo (self::$settings->getGlobalOption('piwik_mode')=='http'?'checked="checked" ':''); ?>/>
30
- <input <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_url" name="wp-piwik_url" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_url'); ?>" />
31
- </td>
32
- </tr><tr>
33
- <th><?php _e('Piwik path', 'wp-piwik'); ?> (PHP API, beta):</th>
34
- <td>
35
- <input type="radio" name="wp-piwik_mode" onchange="javascript:$j('#wp-piwik_path,#wp-piwik_url').toggleClass('wp-piwik-input-hide');" value="php" <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'checked="checked" ':''); ?>/>
36
- <input <?php echo (self::$settings->getGlobalOption('piwik_mode')!='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_path" name="wp-piwik_path" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_path'); ?>" />
37
- <?php
38
- if (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path']) && realpath($_POST['wp-piwik_path']) === false)
39
- echo '<p class="wp-piwik-eyecatcher">'.__('Invalid path. Please enter the file path to Piwik.', 'wp-piwik').'</p>';
40
- ?>
41
- </td>
42
- </tr><tr>
43
- <th><?php _e('Auth token', 'wp-piwik'); ?>:</th>
44
- <td>
45
- <input name="wp-piwik_token" id="wp-piwik_token" type="text" value="<?php echo self::$settings->getGlobalOption('piwik_token'); ?>" />
46
- <label for="wp-piwik_token"></label>
47
- </td>
48
- </tr><tr><th><?php _e('Enable cache', 'wp-piwik'); ?>:</th><td>
49
- <input type="checkbox" value="1" id="wp-piwik_cache" name="wp-piwik_cache"<?php echo (self::$settings->getGlobalOption('cache')?' checked="checked"':''); ?> />
50
- <label for="wp-piwik_cache"><?php _e('Cache API calls, which not contain today\'s values, for a week', 'wp-piwik'); ?>.</label>
51
- </td></tr>
52
-
53
- <?php if (!is_plugin_active_for_network('wp-piwik/wp-piwik.php')) { ?><tr>
54
- <th><?php _e('Auto config', 'wp-piwik'); ?>:</th>
55
- <td>
56
- <input name="wp-piwik_auto_site_config" id="wp-piwik_auto_site_config" value="1" type="checkbox"<?php echo (self::$settings->getGlobalOption('auto_site_config')?' checked="checked"':'') ?>/>
57
- <label for="wp-piwik_auto_site_config"><?php _e('Check this to automatically choose your blog from your Piwik sites by URL. If your blog is not added to Piwik yet, WP-Piwik will add a new site.', 'wp-piwik') ?></label>
58
- </td>
59
- </tr>
60
- <?php
61
- if (self::$settings->getGlobalOption('piwik_url') && self::$settings->getGlobalOption('piwik_token')) {
62
- $aryData = $this->callPiwikAPI('SitesManager.getSitesWithAtLeastViewAccess');
63
- if (empty($aryData)) {
64
- echo '<tr><td colspan="2">';
65
- self::showErrorMessage(__('Please check URL and auth token. You need at least view access to one site.', 'wp-piwik'));
66
- echo '</td></tr>';
67
- }
68
- elseif (isset($aryData['result']) && $aryData['result'] == 'error') {
69
- echo '<tr><td colspan="2">';
70
- self::showErrorMessage($aryData['message']);
71
- echo '</td></tr>';
72
- } elseif (!self::$settings->getGlobalOption('auto_site_config')) {
73
- echo '<tr><th>'.__('Choose site', 'wp-piwik').':</th><td>';
74
- echo '<select name="wp-piwik_siteid" id="wp-piwik_siteid">';
75
- $aryOptions = array();
76
- foreach ($aryData as $arySite)
77
- $aryOptions[$arySite['name'].'#'.$arySite['idsite']] = '<option value="'.$arySite['idsite'].
78
- '"'.($arySite['idsite']==self::$settings->getOption('site_id')?' selected="selected"':'').
79
- '>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8').
80
- '</option>';
81
- ksort($aryOptions);
82
- foreach ($aryOptions as $strOption) echo $strOption;
83
- echo '</select></td></tr>';
84
- } else {
85
- if (!self::$settings->getOption('site_id'))
86
- $this->addPiwikSite();
87
- echo '<tr><th>'.__('Determined site', 'wp-piwik').':</th><td>';
88
- echo '<div class="input-text-wrap">';
89
- $siteId = self::$settings->getOption('site_id');
90
- if (is_array($siteId) && $siteId['result'] == 'error')
91
- self::showErrorMessage($siteId['message']);
92
- else foreach ($aryData as $arySite)
93
- if ($arySite['idsite'] == $siteId) {echo '<em>'.htmlentities($arySite['name'], ENT_QUOTES, 'utf-8').'</em>'; break;}
94
- echo '<input type="hidden" name="wp-piwik_siteid" id="wp-piwik_siteid" value="'.(int)$siteId.'" /></td></tr>';
95
- }
96
- }
97
- }}
98
- // Expert settings (cURL only)
99
- ?><tr>
100
- <th colspan="2"><strong><?php _e('Expert Settings', 'wp-piwik'); ?>:</strong></th>
101
- </tr><tr>
102
- <th><label><?php _e('Connection timeout', 'wp-piwik'); ?>:</label></th>
103
- <td>
104
- <input style="width:50px;" type="text" name="wp-piwik_timeout" value="<?php echo self::$settings->getGlobalOption('connection_timeout'); ?>" />
105
- </td>
106
- </tr>
107
- <?php if (function_exists('curl_init')) { ?>
108
- <tr>
109
- <th><label <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_disable_ssl_verify-label"><?php _e('Disable SSL peer verification', 'wp-piwik'); ?>:</label></th>
110
- <td>
111
- <input <?php echo (self::$settings->getGlobalOption('piwik_mode')=='php'?'class="wp-piwik-input-hide" ':''); ?>id="wp-piwik_disable_ssl_verify" name="wp-piwik_disable_ssl_verify" type="checkbox"<?php echo (self::$settings->getGlobalOption('disable_ssl_verify')?'checked="checked"':''); ?> /> (<?php _e('not recommended','wp-piwik'); ?>)
112
- </td>
113
- </tr><tr>
114
- <th><label><?php _e('User agent', 'wp-piwik'); ?>:</label></th>
115
- <td>
116
- <input type="radio" onchange="javascript:$j('#wp-piwik-useragent').toggleClass('readonly="readonly"');" name="wp-piwik_useragent" value="php" <?php echo (self::$settings->getGlobalOption('piwik_useragent')=='php'?'checked="checked" ':''); ?>/> PHP default (<?php echo ini_get('user_agent'); ?>)
117
- </td>
118
- </tr><tr>
119
- <th></th>
120
- <td>
121
- <input type="radio" onchange="javascript:$j('#wp-piwik-useragent').toggleClass('wp-piwik-useragent-disable');" name="wp-piwik_useragent" value="own" <?php echo (self::$settings->getGlobalOption('piwik_useragent')=='own'?'checked="checked" ':''); ?>/> <input type="text" id="wp-piwik-useragent" name="wp-piwik_useragent_string" value="<?php echo self::$settings->getGlobalOption('piwik_useragent_string'); ?>" />
122
- </td>
123
- </tr>
124
- <?php } else { ?>
125
- <tr>
126
- <td colspan="2"><?php _e('Further expert settings require cURL. See <a href="http://www.php.net/manual/curl.setup.php">PHP manual</a>', 'wp-piwik'); ?>.</td>
127
- </tr>
128
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings/sitebrowser.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
- $bolCURL = function_exists('curl_init');
3
- $bolFOpen = ini_get('allow_url_fopen');
4
- if (!$bolFOpen && !$bolCURL) {
5
- ?><tr>
6
- <td colspan="2">
7
- <strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong>
8
- </td>
9
- </tr><?php } else { ?>
10
- </table>
11
- <?php
12
- if (!class_exists('WP_List_Table'))
13
- require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
14
-
15
- if (isset($_GET['wpmu_show_stats']) && ($_GET['wpmu_show_stats'] == (int) $_GET['wpmu_show_stats'])) {
16
- $this->addPiwikSite();
17
- }
18
-
19
- // See wpengineer.com/2426/wp_list_table-a-step-by-step-guide/
20
- class SiteBrowser extends WP_List_Table {
21
-
22
- var $aryData = array();
23
-
24
- function get_columns(){
25
- $columns = array(
26
- 'id' => __('ID','wp-piwik'),
27
- 'name' => __('Title','wp-piwik'),
28
- 'siteurl' => __('URL','wp-piwik'),
29
- 'piwikid' => __('Site ID (Piwik)','wp-piwik')
30
- );
31
- return $columns;
32
- }
33
-
34
- function prepare_items($bolNetwork = false) {
35
- $current_page = $this->get_pagenum();
36
- $per_page = 10;
37
- global $blog_id;
38
- global $wpdb;
39
- global $pagenow;
40
- if (is_plugin_active_for_network('wp-piwik/wp-piwik.php')) {
41
- $total_items = $wpdb->get_var('SELECT COUNT(*) FROM '.$wpdb->blogs);
42
- $aryBlogs = $wpdb->get_results($wpdb->prepare('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id LIMIT %d,%d',(($current_page-1)*$per_page),$per_page));
43
- foreach ($aryBlogs as $aryBlog) {
44
- $objBlog = get_blog_details($aryBlog->blog_id, true);
45
- $this->aryData[] = array(
46
- 'name' => $objBlog->blogname,
47
- 'id' => $objBlog->blog_id,
48
- 'siteurl' => $objBlog->siteurl,
49
- 'piwikid' => WP_Piwik::getSiteID($objBlog->blog_id)
50
- );
51
- }
52
- } else {
53
- $objBlog = get_bloginfo();
54
- $this->aryData[] = array(
55
- 'name' => get_bloginfo('name'),
56
- 'id' => '-',
57
- 'siteurl' => get_bloginfo('url'),
58
- 'piwikid' => WP_Piwik::getSiteID()
59
- );
60
- $total_items = 1;
61
- }
62
- $columns = $this->get_columns();
63
- $hidden = array();
64
- $sortable = array();
65
- $this->_column_headers = array($columns, $hidden, $sortable);
66
- $this->set_pagination_args(array(
67
- 'total_items' => $total_items,
68
- 'per_page' => $per_page
69
- ));
70
- if ($bolNetwork) $pagenow = 'settings.php';
71
- foreach ($this->aryData as $intKey => $aryDataset) {
72
- if (empty($aryDataset['piwikid']) || !is_int($aryDataset['piwikid']))
73
- $this->aryData[$intKey]['piwikid'] = '<a href="'.admin_url(($pagenow == 'settings.php'?'network/':'')).$pagenow.'?page=wp-piwik/wp-piwik.php&tab=sitebrowser'.($aryDataset['id'] != '-'?'&wpmu_show_stats='.$aryDataset['id']:'').'">Create Piwik site</a>';
74
- if ($bolNetwork)
75
- $this->aryData[$intKey]['name'] = '<a href="?page=wp-piwik_stats&wpmu_show_stats='.$aryDataset['id'].'">'.$aryDataset['name'].'</a>';
76
- }
77
- $this->items = $this->aryData;
78
- return count($this->items);
79
- }
80
-
81
- function column_default( $item, $column_name ) {
82
- switch( $column_name ) {
83
- case 'id':
84
- case 'name':
85
- case 'siteurl':
86
- case 'piwikid':
87
- return $item[$column_name];
88
- default:
89
- return print_r($item,true);
90
- }
91
- }
92
- }
93
- $objSiteBrowser = new SiteBrowser();
94
- $intCnt = $objSiteBrowser->prepare_items($this->bolNetwork);
95
- if ($intCnt > 0) $objSiteBrowser->display();
96
- else echo '<p>No site configured yet.</p>'
97
- ?>
98
- <table>
99
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings/support.php DELETED
@@ -1,60 +0,0 @@
1
- <tr>
2
- <td><a href="http://wordpress.org/tags/wp-piwik?forum_id=10"><?php _e('WordPress.org forum about WP-Piwik','wp-piwik'); ?></a></td>
3
- </tr>
4
- <tr>
5
- <td><?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org Plugin Directory</a>.</td>
6
- </tr>
7
- <tr>
8
- <td>
9
- <h3><?php _e('Debugging', 'wp-piwik'); ?></h3>
10
- <p><?php _e('Either allow_url_fopen has to be enabled <em>or</em> cURL has to be available:', 'wp-piwik'); ?></p>
11
- <ol>
12
- <li><?php
13
- _e('cURL is','wp-piwik');
14
- echo ' <strong>'.(function_exists('curl_init')?'':__('not','wp-piwik')).' ';
15
- _e('available','wp-piwik');
16
- ?></strong>.</li>
17
- <li><?php
18
- _e('allow_url_fopen is','wp-piwik');
19
- echo ' <strong>'.(ini_get('allow_url_fopen')?'':__('not','wp-piwik')).' ';
20
- _e('enabled','wp-piwik');
21
- ?></strong>.</li>
22
- </ol>
23
- <?php if (self::$settings->getGlobalOption('piwik_token') && self::$settings->getGlobalOption('piwik_url')) { ?>
24
- <?php
25
- if (isset($_GET['mode'])) {
26
- switch ($_GET['mode']) {
27
- case 'testscript':
28
- echo '<p><strong>'.__('Test script result','wp-piwik').'</strong></p>';
29
- self::loadTestscript();
30
- break;
31
- case 'reset':
32
- echo '<p class="wp-piwik-eyecatcher"><strong class="wp-piwik-error">'.__('Please confirm your reset request','wp-piwik').':</strong> <a href="?page=wp-piwik/wp-piwik.php&tab=support&mode=resetconfirmed">'.__('YES, please reset <strong>all</strong> WP-Piwik settings <strong>except</strong> auth token and Piwi URL.', 'wp-piwik').'</a></p>';
33
- break;
34
- case 'resetconfirmed':
35
- // Increase time limit before resetting
36
- set_time_limit(0);
37
- self::$settings->resetSettings((isset($_GET['full']) && $_GET['full']));
38
- echo '<p class="wp-piwik-eyecatcher"><strong>'.__('WP-Piwik reset done','wp-piwik').'</strong></p>';
39
- default:
40
- }
41
- }
42
- ?>
43
- <p><strong><?php _e('Get more debug information', 'wp-piwik'); ?>:</strong></p>
44
- <ol>
45
- <li><a href="?page=wp-piwik/wp-piwik.php&tab=support&mode=testscript"><?php _e('Run test script','wp-piwik'); ?></a></li>
46
- <li><a href="?page=wp-piwik/wp-piwik.php&tab=sitebrowser"><?php _e('Get site configuration details','wp-piwik'); ?></a></li>
47
- <li><a href="?page=wp-piwik/wp-piwik.php&tab=support&mode=reset"><?php _e('Reset WP-Piwik settings except auth token and Piwik URL','wp-piwik'); ?></a> (<?php _e('This will not affect Piwik itself. Resetting large networks may take some minutes.', 'wp-piwik'); ?>)</li>
48
- </ol>
49
- <?php } else echo '<p>'.__('You have to enter your auth token and the Piwik URL before you can access more debug functions.', 'wp-piwik').'</p>'; ?>
50
- </td>
51
- </tr>
52
- <tr><td><h3><?php _e('Latest support threads on WordPress.org', 'wp-piwik'); ?></h3>
53
- <?php
54
- $arySupportThreads = self::readRSSFeed('http://wordpress.org/support/rss/plugin/wp-piwik');
55
- if (!empty($arySupportThreads)) {
56
- echo '<ol>';
57
- foreach ($arySupportThreads as $arySupportThread) echo '<li><a href="'.$arySupportThread['url'].'">'.$arySupportThread['title'].'</a></li>';
58
- echo '</ol>';
59
- }
60
- ?></td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings/tracking.php DELETED
@@ -1,169 +0,0 @@
1
- <?php
2
- $bolCURL = function_exists('curl_init');
3
- $bolFOpen = ini_get('allow_url_fopen');
4
- if (!$bolFOpen && !$bolCURL) {
5
- ?><tr>
6
- <td colspan="2">
7
- <strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong>
8
- </td>
9
- </tr><?php } else { ?>
10
- <tr><td colspan="2"><?php _e('Add tracking code', 'wp-piwik'); ?>: &nbsp;
11
- <input
12
- onchange="javascript:$j('#wp-piwik-tracking-settings').toggleClass('wp-piwik-form-table-hide');"
13
- type="checkbox" value="1" id="wp-piwik_addjs" name="wp-piwik_addjs"<?php echo (self::$settings->getGlobalOption('add_tracking_code')?' checked="checked"':''); ?> />
14
- <label for="wp-piwik_addjs"><?php _e('If your template uses wp_footer(), WP-Piwik can automatically add the Piwik javascript code to your blog.', 'wp-piwik'); ?></label>
15
- </td></tr>
16
- </table>
17
- <?php
18
- if (self::$settings->getGlobalOption('add_tracking_code')) {
19
- $strJavaScript = $this->callPiwikAPI('SitesManager.getJavascriptTag');
20
- if (is_array($strJavaScript)) {
21
- if (isset($strJavaScript['result']) && $strJavaScript['result'] == 'error')
22
- self::showErrorMessage(__($strJavaScript['message'],'wp-piwik'));
23
- } else {
24
- // Save javascript code
25
- self::$settings->setOption('tracking_code', $strJavaScript);
26
- }
27
- self::$settings->save();
28
- }
29
- ?>
30
- <table id="wp-piwik-tracking-settings" class="wp-piwik-form-table form-table<?php echo (!self::$settings->getGlobalOption('add_tracking_code')?' wp-piwik-form-table-hide':''); ?>">
31
- <tr><th><?php _e('Tracking code preview', 'wp-piwik'); ?>:</th><td>
32
- <textarea id="wp-piwik_jscode" name="wp-piwik_jscode" readonly="readonly" rows="13" cols="80">
33
- <?php echo (is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'*** SITE SPECIFIC EXAMPLE CODE ***'."\n":'').htmlentities(self::$settings->getOption('tracking_code')); ?>
34
- </textarea>
35
- </td></tr>
36
-
37
- <tr><th><?php _e('&lt;noscript&gt; code preview', 'wp-piwik'); ?>:</th><td>
38
- <textarea id="wp-piwik_nocode" name="wp-piwik_nocode" readonly="readonly" rows="2" cols="80">
39
- <?php echo (is_plugin_active_for_network('wp-piwik/wp-piwik.php')?'*** SITE SPECIFIC EXAMPLE CODE ***'."\n":'').htmlentities(self::$settings->getOption('noscript_code')); ?>
40
- </textarea>
41
- </td></tr>
42
-
43
- <tr><th><?php _e('Default tracking', 'wp-piwik'); ?>:</th><td>
44
- <input type="radio" value="0" id="wp-piwik_default" name="wp-piwik_trackingmode"<?php echo (self::$settings->getGlobalOption('track_mode')==0?' checked="checked"':''); ?> />
45
- <label for="wp-piwik_compress"><?php _e('WP-Piwik uses the Piwik default tracking code.', 'wp-piwik'); ?> <a href="http://demo.piwik.org/js/README">js/README</a>.</label>
46
- </td></tr>
47
-
48
- <tr><th><?php _e('Use js/index.php', 'wp-piwik'); ?>:</th><td>
49
- <input type="radio" value="1" id="wp-piwik_compress" name="wp-piwik_trackingmode"<?php echo (self::$settings->getGlobalOption('track_mode')==1?' checked="checked"':''); ?> />
50
- <label for="wp-piwik_compress"><?php _e('WP-Piwik can automatically use js/index.php instead of piwik.js and piwik.php. See', 'wp-piwik'); ?> <a href="http://demo.piwik.org/js/README">js/README</a>.</label>
51
- </td></tr>
52
-
53
- <tr><th><?php _e('Use proxy script', 'wp-piwik'); ?>:</th><td>
54
- <input type="radio" value="2" id="wp-piwik_proxy" name="wp-piwik_trackingmode"<?php echo (self::$settings->getGlobalOption('track_mode')==2?' checked="checked"':''); ?> />
55
- <label for="wp-piwik_proxy"><?php _e('WP-Piwik will use the piwik.php proxy script. See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/how-to/#faq_132">Piwik FAQ</a>.</label>
56
- </td></tr>
57
-
58
- <tr><th><?php _e('JavaScript code position', 'wp-piwik'); ?>:</th><td>
59
- <select id="wp-piwik_codeposition" name="wp-piwik_codeposition"<?php echo (self::$settings->getGlobalOption('track_codeposition')?' checked="checked"':''); ?>>
60
- <option value="footer"<?php echo (self::$settings->getGlobalOption('track_codeposition') == 'footer'?' selected="selected"':''); ?>><?php _e('Footer', 'wp-piwik'); ?></option>
61
- <option value="header"<?php echo (self::$settings->getGlobalOption('track_codeposition') == 'header'?' selected="selected"':''); ?>><?php _e('Header', 'wp-piwik'); ?></option>
62
- </select>
63
- <label for="wp-piwik_codeposition"><?php echo _e('Choose whether the JavaScript code is added to the footer or the header.', 'wp-piwik'); ?></label>
64
- </td></tr>
65
-
66
- <tr><th><?php _e('Add &lt;noscript&gt;', 'wp-piwik'); ?>:</th><td>
67
- <input type="checkbox" value="1" id="wp-piwik_noscript" name="wp-piwik_noscript"<?php echo (self::$settings->getGlobalOption('track_noscript')?' checked="checked"':''); ?> />
68
- <label for="wp-piwik_noscript"><?php echo _e('Adds the &lt;noscript&gt; code to your footer.', 'wp-piwik'); ?> <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label>
69
- </td></tr>
70
-
71
- <tr><th><?php _e('Add rec parameter to noscript code', 'wp-piwik'); ?>:</th><td>
72
- <input type="checkbox" value="1" id="wp-piwik_nojavascript" name="wp-piwik_nojavascript"<?php echo (self::$settings->getGlobalOption('track_nojavascript')?' checked="checked"':''); ?> />
73
- <label for="wp-piwik_nojavascript"><?php echo _e('Enable tracking for visitors without JavaScript (not recommended). See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/how-to/#faq_176">Piwik FAQ</a>. <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label>
74
- </td></tr>
75
-
76
- <tr><th><?php _e('Disable cookies', 'wp-piwik'); ?>:</th><td>
77
- <input type="checkbox" value="1" id="wp-piwik_disable_cookies" name="wp-piwik_disable_cookies"<?php echo (self::$settings->getGlobalOption('disable_cookies')?' checked="checked"':''); ?> />
78
- <label for="wp-piwik_disable_cookies"><?php echo _e('Disable all tracking cookies for a visitor.', 'wp-piwik'); ?></label>
79
- </td></tr>
80
-
81
- <tr><th><?php _e('Limit cookie lifetime', 'wp-piwik'); ?>:</th><td>
82
- <input type="checkbox" value="1" id="wp-piwik_limit_cookies" name="wp-piwik_limit_cookies"<?php echo (self::$settings->getGlobalOption('limit_cookies')?' checked="checked"':''); ?> />
83
- <label for="wp-piwik_limit_cookies"><?php echo _e('Limit cookie lifetime as follows', 'wp-piwik'); ?>:</label><br />
84
- <?php echo _e('Visitor timeout (seconds)', 'wp-piwik'); ?>: <input type="text" name="wp-piwik_limit_cookies_visitor" value="<?php echo self::$settings->getGlobalOption('limit_cookies_visitor'); ?>" /><br /><?php echo _e('Session timeout (seconds)', 'wp-piwik'); ?>: <input type="text" name="wp-piwik_limit_cookies_session" value="<?php echo self::$settings->getGlobalOption('limit_cookies_session'); ?>" /></td></tr>
85
-
86
- <tr><th><?php _e('Track visitors across all subdomains', 'wp-piwik'); ?>:</th><td>
87
- <input type="checkbox" value="1" id="wp-piwik_track_across" name="wp-piwik_track_across"<?php echo (self::$settings->getGlobalOption('track_across')?' checked="checked"':''); ?> />
88
- <label for="wp-piwik_track_across"><?php echo _e('Adds *.-prefix to cookie domain.', 'wp-piwik'); ?></label>
89
- </td></tr>
90
-
91
- <tr><th><?php _e('Track visitors across all alias URLs', 'wp-piwik'); ?>:</th><td>
92
- <input type="checkbox" value="1" id="wp-piwik_track_across_alias" name="wp-piwik_track_across_alias"<?php echo (self::$settings->getGlobalOption('track_across_alias')?' checked="checked"':''); ?> />
93
- <label for="wp-piwik_track_across_alias"><?php echo _e('Adds *.-prefix to tracked domain.', 'wp-piwik'); ?></label>
94
- </td></tr>
95
-
96
- <tr><th><?php _e('Track search', 'wp-piwik'); ?>:</th><td>
97
- <input type="checkbox" value="1" id="wp-piwik_search" name="wp-piwik_search"<?php echo (self::$settings->getGlobalOption('track_search')?' checked="checked"':''); ?> />
98
- <label for="wp-piwik_search"><?php echo _e('Use Piwik\'s advanced Site Search Analytics feature. See', 'wp-piwik'); ?> <a href="http://piwik.org/docs/javascript-tracking/#toc-tracking-internal-search-keywords-categories-and-no-result-search-keywords">Piwik Docs</a>.</label>
99
- </td></tr>
100
-
101
- <tr><th><?php _e('Track 404', 'wp-piwik'); ?>:</th><td>
102
- <input type="checkbox" value="1" id="wp-piwik_404" name="wp-piwik_404"<?php echo (self::$settings->getGlobalOption('track_404')?' checked="checked"':''); ?> />
103
- <label for="wp-piwik_404"><?php echo _e('WP-Piwik can automatically add a 404-category to track 404-page-visits.', 'wp-piwik'); ?></label>
104
- </td></tr>
105
-
106
- <tr><th><?php _e('Add annotation on new post', 'wp-piwik'); ?>:</th><td>
107
- <input type="checkbox" value="1" id="wp-piwik_annotations" name="wp-piwik_annotations"<?php echo (self::$settings->getGlobalOption('add_post_annotations')?' checked="checked"':''); ?> />
108
- <label for="wp-piwik_annotations"><?php echo _e('Add a Piwik annotation on each new post, see', 'wp-piwik'); ?> <a href="http://piwik.org/docs/annotations/">Piwik Docs</a>.</label>
109
- </td></tr>
110
-
111
- <tr><th><?php _e('Add new file types for download tracking', 'wp-piwik'); ?>:</th><td>
112
- <input type="text" name="wp-piwik_add_download_extensions" value="<?php echo self::$settings->getGlobalOption('add_download_extensions'); ?>" />
113
- <label for="wp-piwik_annotations"><?php echo _e('Add file extensions for download tracking, divided by a vertical bar (&#124;), see', 'wp-piwik'); ?> <a href="https://developer.piwik.org/guides/tracking-javascript-guide#file-extensions-for-tracking-downloads">Piwik Docs</a>.</label>
114
- </td></tr>
115
-
116
- <tr><th><?php _e('Show custom variables box', 'wp-piwik'); ?>:</th><td>
117
- <input type="checkbox" value="1" id="wp-piwik_customvars" name="wp-piwik_customvars"<?php echo (self::$settings->getGlobalOption('add_customvars_box')?' checked="checked"':''); ?> />
118
- <label for="wp-piwik_customvars"><?php echo _e('Show a custom vars edit box on post edit page.', 'wp-piwik'); ?></label>
119
- </td></tr>
120
-
121
- <tr><th><?php _e('Avoid mod_security', 'wp-piwik'); ?>:</th><td>
122
- <input type="checkbox" value="1" id="wp-piwik_reqpost" name="wp-piwik_reqpost"<?php echo (self::$settings->getGlobalOption('track_post')?' checked="checked"':''); ?> />
123
- <label for="wp-piwik_reqpost"><?php _e('WP-Piwik can automatically force the Tracking Code to sent data in POST. See', 'wp-piwik'); ?> <a href="http://piwik.org/faq/troubleshooting/#faq_100">Piwik FAQ</a>. <?php _e('Disabled in proxy mode.', 'wp-piwik'); ?></label>
124
- </td></tr>
125
-
126
- <tr><th><?php _e('Add data-cfasync=false', 'wp-piwik'); ?>:</th><td>
127
- <input type="checkbox" value="1" id="wp-piwik_datacfasync" name="wp-piwik_datacfasync"<?php echo (self::$settings->getGlobalOption('track_datacfasync')?' checked="checked"':''); ?> />
128
- <label for="wp-piwik_datacfasync"><?php _e('Adds data-cfasync=false to the script tag, e.g., to ask Rocket Loader to ignore the script.', 'wp-piwik'); ?>
129
- </td></tr>
130
-
131
- <tr><th><?php _e('CDN URL', 'wp-piwik'); ?>:</th><td>
132
- http://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurl'); ?>" id="wp-piwik_cdnurl" name="wp-piwik_cdnurl" /> https://<input type="text" value="<?php echo self::$settings->getGlobalOption('track_cdnurlssl'); ?>" id="wp-piwik_cdnurlssl" name="wp-piwik_cdnurlssl" /><br />
133
- <label for="wp-piwik_reqpost"><?php _e('Leave blank if you do not want to define a CDN URL or you do not know what this is.', 'wp-piwik'); ?></label>
134
- </td></tr>
135
-
136
- <tr><th><?php _e('Force Piwik to use a specific protocol', 'wp-piwik'); ?>:</th><td>
137
- <input type="radio" value="" id="wp-piwik_force_protocol_none" name="wp-piwik_force_protocol"<?php echo (!self::$settings->getGlobalOption('force_protocol')?' checked="checked"':''); ?> /> <?php _e('Disabled (default)', 'wp-piwik'); ?> &nbsp; &nbsp;
138
- <input type="radio" value="http" id="wp-piwik_force_protocol_http" name="wp-piwik_force_protocol"<?php echo (self::$settings->getGlobalOption('force_protocol')=="http"?' checked="checked"':''); ?> /> HTTP &nbsp; &nbsp;
139
- <input type="radio" value="https" id="wp-piwik_force_protocol_https" name="wp-piwik_force_protocol"<?php echo (self::$settings->getGlobalOption('force_protocol')=="https"?' checked="checked"':''); ?> /> HTTPS (SSL) <br />
140
- <label for="wp-piwik_force_protocol_none"><?php _e('Choose if you want to explicitly force Piwik to use HTTP or HTTPS. Does not work with a CDN URL.', 'wp-piwik'); ?></label>
141
- </td></tr>
142
-
143
- <tr><th><?php _e('Track admin pages', 'wp-piwik'); ?>:</th><td>
144
- <input type="checkbox" value="1" id="wp-piwik_trackadmin" name="wp-piwik_trackadmin"<?php echo (self::$settings->getGlobalOption('track_admin')?' checked="checked"':''); ?> />
145
- <label for="wp-piwik_trackadmin"><?php _e('Enable to track users on admin pages (remember to configure the tracking filter appropriately).', 'wp-piwik'); ?></label>
146
- </td></tr>
147
-
148
- <tr><th><?php _e('Track RSS feeds', 'wp-piwik'); ?>:</th><td>
149
- <input type="checkbox" value="1" id="wp-piwik_trackfeed" name="wp-piwik_trackfeed"<?php echo (self::$settings->getGlobalOption('track_feed')?' checked="checked"':''); ?> />
150
- <label for="wp-piwik_trackfeed"><?php _e('Enable to track posts in feeds via tracking pixel.', 'wp-piwik'); ?></label>
151
- </td></tr>
152
-
153
- <tr><th><?php _e('Track RSS feed links as campaign', 'wp-piwik'); ?>:</th><td>
154
- <input type="checkbox" value="1" id="wp-piwik_trackfeed_addcampaign" name="wp-piwik_trackfeed_addcampaign"<?php echo (self::$settings->getGlobalOption('track_feed_addcampaign')?' checked="checked"':''); ?> />
155
- <label for="wp-piwik_trackfeed_addcampaign"><?php _e('This will add Piwik campaign parameters to the RSS feed links.', 'wp-piwik'); ?> (<a href="https://piwik.org/docs/tracking-campaigns/">Piwik: Tracking campaign</a>)</label><br />
156
- <?php _e('Campaign', 'wp-piwik'); ?>: <input type="text" value="<?php echo self::$settings->getGlobalOption('track_feed_campaign'); ?>" id="wp-piwik_trackfeed_campaign" name="wp-piwik_trackfeed_campaign"> <?php _e('Keyword: post name.', 'wp-piwik'); ?>
157
- </td></tr>
158
-
159
- <tr><th><?php _e('Tracking filter', 'wp-piwik'); ?>:</th><td>
160
- <?php
161
- global $wp_roles;
162
- $aryFilter = self::$settings->getGlobalOption('capability_stealth');
163
- foreach($wp_roles->role_names as $strKey => $strName) {
164
- echo '<input type="checkbox" '.(isset($aryFilter[$strKey]) && $aryFilter[$strKey]?'checked="checked" ':'').'value="1" name="wp-piwik_filter['.$strKey.']" /> '.$strName.' &nbsp; ';
165
- }
166
- ?><br><?php _e('Choose users by user role you do <strong>not</strong> want to track.','wp-piwik'); ?></td></tr>
167
- </table>
168
- <table class="wp-piwik-form-table form-table">
169
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
settings/views.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- $bolCURL = function_exists('curl_init');
3
- $bolFOpen = ini_get('allow_url_fopen');
4
- if (!$bolFOpen && !$bolCURL) {
5
- ?><tr>
6
- <td colspan="2">
7
- <strong><?php _e('Error: cURL is not enabled and fopen is not allowed to open URLs. WP-Piwik won\'t be able to connect to Piwik.'); ?></strong>
8
- </td>
9
- </tr><?php } else { ?>
10
- <tr><th><?php _e('WP-Piwik display name', 'wp-piwik'); ?>:</th><td>
11
- <input type="text" id="wp-piwik_displayname" name="wp-piwik_displayname" value="<?php echo self::$settings->getGlobalOption('plugin_display_name'); ?>" />
12
- <label for="wp-piwik_displayname"><?php echo _e('Plugin name shown in WordPress.', 'wp-piwik'); ?></label>
13
- </td></tr>
14
- <tr><th>Piwik <?php _e('Default date', 'wp-piwik'); ?>:</th><td>
15
- <select id="wp-piwik_default_date" name="wp-piwik_default_date">
16
- <option value="yesterday"<?php echo (self::$settings->getGlobalOption('default_date') == 'yesterday'?' selected="selected"':'');?>> <?php _e('yesterday', 'wp-piwik');?></option>
17
- <option value="today"<?php echo (self::$settings->getGlobalOption('default_date') == 'today'?' selected="selected"':'');?>> <?php _e('today', 'wp-piwik');?></option>
18
- </select>
19
- <label for="wp-piwik_default_date"><?php echo _e('Default date shown on statistics page.', 'wp-piwik'); ?></label>
20
- </td></tr>
21
- <tr><th><?php _e('Home Dashboard', 'wp-piwik'); ?>:</th><td>
22
- <select id="wp-piwik_dbwidget" name="wp-piwik_dbwidget">
23
- <option value="0"'<?php echo (!self::$settings->getGlobalOption('dashboard_widget')?' selected="selected"':''); ?>><?php _e('Hide overview', 'wp-piwik'); ?></option>
24
- <option value="yesterday"<?php echo (self::$settings->getGlobalOption('dashboard_widget') == 'yesterday'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('yesterday', 'wp-piwik').')'; ?></option>
25
- <option value="today"<?php echo (self::$settings->getGlobalOption('dashboard_widget') == 'today'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('today', 'wp-piwik').')'; ?></option>
26
- <option value="last30"<?php echo (self::$settings->getGlobalOption('dashboard_widget') == 'last30'?' selected="selected"':''); ?>><?php echo __('Show overview','wp-piwik').' ('.__('last 30 days','wp-piwik').')'; ?></option>
27
- </select>
28
- <input type="checkbox" value="1" name="wp-piwik_dbchart" id="wp-piwik_dbchart"<?php echo (self::$settings->getGlobalOption('dashboard_chart')?' checked="checked"':""); ?>/> <?php _e('Chart', 'wp-piwik'); ?>
29
- <input type="checkbox" value="1" name="wp-piwik_dbseo" id="wp-piwik_dbseo"<?php echo (self::$settings->getGlobalOption('dashboard_seo')?' checked="checked"':""); ?>/> <?php _e('SEO <em>(slow!)</em>', 'wp-piwik'); ?>
30
- <br><?php _e('Configure WP-Piwik widgets to be shown on your WordPress Home Dashboard.', 'wp-piwik'); ?>
31
- </td></tr>
32
- <tr><th><?php _e('Show graph on WordPress Toolbar', 'wp-piwik'); ?>:</th><td>
33
- <input type="checkbox" value="1" id="wp-piwik_toolbar" name="wp-piwik_toolbar"<?php echo (self::$settings->getGlobalOption('toolbar')?' checked="checked"':''); ?> />
34
- <label for="wp-piwik_toolbar"><?php echo _e('Display the last 30 days visitor stats on WordPress Toolbar.', 'wp-piwik'); ?></label>
35
- </td></tr>
36
- <tr><th><?php _e('SEO data', 'wp-piwik'); ?>:</th><td>
37
- <input type="checkbox" value="1" id="wp-piwik_statsseo" name="wp-piwik_statsseo"<?php echo (self::$settings->getGlobalOption('stats_seo')?' checked="checked"':''); ?> />
38
- <label for="wp-piwik_statsseo"><?php echo _e('Display SEO ranking data on statistics page. <em>(Slow!)</em>', 'wp-piwik'); ?></label>
39
- </td></tr>
40
- <tr><th>Piwik <?php _e('Shortcut', 'wp-piwik'); ?>:</th><td>
41
- <input type="checkbox" value="1" id="wp-piwik_piwiklink" name="wp-piwik_piwiklink"<?php echo (self::$settings->getGlobalOption('piwik_shortcut')?' checked="checked"':''); ?> />
42
- <label for="wp-piwik_piwiklink"><?php echo _e('Display a shortcut to Piwik itself.', 'wp-piwik'); ?></label>
43
- </td></tr>
44
- <tr><th>Piwik <?php _e('Display to', 'wp-piwik'); ?>:</th><td>
45
- <?php
46
- global $wp_roles;
47
- $aryCapability = self::$settings->getGlobalOption('capability_read_stats');
48
- foreach($wp_roles->role_names as $strKey => $strName)
49
- echo '<input name="wp-piwik_displayto['.$strKey.']" type="checkbox" value="1"'.(isset($aryCapability[$strKey]) && $aryCapability[$strKey]?' checked="checked"':'').'/> '.$strName.' &nbsp; ';
50
- ?>
51
- <br><?php echo _e('Choose user roles allowed to see the statistics page.', 'wp-piwik'); ?>
52
- </td></tr>
53
- <tr><th><?php _e('Disable time limit', 'wp-piwik'); ?>:</th><td>
54
- <input type="checkbox" value="1" id="wp-piwik_disabletimelimit" name="wp-piwik_disabletimelimit"<?php echo (self::$settings->getGlobalOption('disable_timelimit')?' checked="checked"':''); ?> />
55
- <label for="wp-piwik_disabletimelimit"><?php echo _e('Use set_time_limit(0) if stats page causes a time out.', 'wp-piwik'); ?></label>
56
- </td></tr>
57
- <tr><th><?php _e('Show per post stats', 'wp-piwik'); ?>:</th><td>
58
- <input type="checkbox" value="1" id="wp-piwik_perpost" name="wp-piwik_perpost"<?php echo (self::$settings->getGlobalOption('perpost_stats')?' checked="checked"':''); ?> />
59
- <label for="wp-piwik_perpost"><?php echo _e('Show stats about single posts at the post edit admin page.', 'wp-piwik'); ?></label>
60
- </td></tr>
61
- <tr><th><?php _e('Enable shortcodes', 'wp-piwik'); ?>:</th><td>
62
- <input type="checkbox" value="1" id="wp-piwik_shortcodes" name="wp-piwik_shortcodes"<?php echo (self::$settings->getGlobalOption('shortcodes')?' checked="checked"':''); ?> />
63
- <label for="wp-piwik_shortcodes"><?php echo _e('Enable shortcodes in post or page content.', 'wp-piwik'); ?></label>
64
- </td></tr>
65
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
shortcodes/.htaccess DELETED
@@ -1 +0,0 @@
1
- Deny from all
 
shortcodes/overview.php DELETED
@@ -1,50 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Short:Overview
4
- **********************************/
5
- $aryData = $this->callPiwikAPI('VisitsSummary.get',
6
- $this->aryAttributes['period'],
7
- $this->aryAttributes['date'],
8
- $this->aryAttributes['limit']
9
- );
10
-
11
- $this->strResult = '<table><tr><th colspan="2">'.__('Overview', 'wp-piwik').($this->aryAttributes['title']?' '.$this->aryAttributes['title']:'').'</th></tr>';
12
-
13
- if (!function_exists('summize')) {
14
- function summize($aryData) {
15
- $aryTmp = array();
16
- foreach ($aryData as $aryValues)
17
- foreach($aryValues as $strKey => $intValue)
18
- if (isset($aryTmp[$strKey])) $aryTmp[$strKey] += $intValue;
19
- else $aryTmp[$strKey] = $intValue;
20
- $aryTmp['bounce_rate'] = ($aryTmp['nb_uniq_visitors']==0?0:round($aryTmp['bounce_count']/$aryTmp['nb_visits']*100,2)).'%';
21
-
22
- return $aryTmp;
23
- }
24
- }
25
-
26
- if (is_array($aryData)) {
27
- if (isset($aryData['result']) && $aryData['result'] == 'error')
28
- $this->strResult .= '<tr><td>'.__('Error', 'wp-piwik').':'.'</td><td>'.$aryData['message'].'</td></tr>';
29
- else {
30
- if (is_array(current($aryData)))
31
- $aryData = summize($aryData);
32
- $strTime =
33
- floor($aryData['sum_visit_length']/3600).'h '.
34
- floor(($aryData['sum_visit_length'] % 3600)/60).'m '.
35
- floor(($aryData['sum_visit_length'] % 3600) % 60).'s';
36
- $strAvgTime =
37
- floor($aryData['avg_time_on_site']/3600).'h '.
38
- floor(($aryData['avg_time_on_site'] % 3600)/60).'m '.
39
- floor(($aryData['avg_time_on_site'] % 3600) % 60).'s';
40
- $this->strResult .= '<tr><td>'.__('Visitors', 'wp-piwik').':'.'</td><td>'.$aryData['nb_visits'].'</td></tr>';
41
- $this->strResult .= '<tr><td>'.__('Unique visitors', 'wp-piwik').':'.'</td><td>'.$aryData['nb_uniq_visitors'].'</td></tr>';
42
- $this->strResult .= '<tr><td>'.__('Page views', 'wp-piwik').':'.'</td><td>'.$aryData['nb_actions'].' (&#216; '.$aryData['nb_actions_per_visit'].')</td></tr>';
43
- $this->strResult .= '<tr><td>'.__('Max. page views in one visit', 'wp-piwik').':'.'</td><td>'.$aryData['max_actions'].'</td></tr>';
44
- $this->strResult .= '<tr><td>'.__('Total time spent', 'wp-piwik').':'.'</td><td>'.$strTime.'</td></tr>';
45
- $this->strResult .= '<tr><td>'.__('Time/visit', 'wp-piwik').':'.'</td><td>'.$strAvgTime.'</td></tr>';
46
- $this->strResult .= '<tr><td>'.__('Bounce count', 'wp-piwik').':'.'</td><td>'.$aryData['bounce_count'].' ('.$aryData['bounce_rate'].')</td></tr>';
47
- }
48
- } else $this->strResult .= '<tr><td>'.__('No data available', 'wp-piwik').'</td></tr>';
49
-
50
- $this->strResult .= '</table>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
shortcodes/post.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- /*********************************
3
- WP-Piwik::Short:Post
4
- **********************************/
5
- if (!class_exists('WP_Piwik_MetaBox_PerPost_Stats'))
6
- $this->includeFile('classes/WP_Piwik_MetaBox_PerPost_Stats');
7
-
8
- $perPostClass = new WP_Piwik_MetaBox_PerPost_Stats($this->subClassConfig());
9
- $this->strResult = $perPostClass->getValue($this->aryAttributes['range'], $this->aryAttributes['key']);
 
 
 
 
 
 
 
 
 
uninstall.php CHANGED
@@ -1,17 +1,104 @@
1
  <?php
2
 
3
  // Check if uninstall call is valid
4
- if (!defined('WP_UNINSTALL_PLUGIN')) exit();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  global $wpdb;
7
 
8
  if (function_exists('is_multisite') && is_multisite()) {
9
- delete_site_option('wp-piwik_global-settings');
10
  $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id');
11
  if (is_array($aryBlogs))
12
- foreach ($aryBlogs as $aryBlog)
13
- delete_blog_option($aryBlog->blog_id, 'wp-piwik_settings');
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
- delete_option('wp-piwik_global-settings');
17
- delete_option('wp-piwik_settings');
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
  // Check if uninstall call is valid
4
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
5
+ exit();
6
+
7
+ $globalSettings = array(
8
+ 'revision',
9
+ 'last_settings_update',
10
+ 'piwik_mode',
11
+ 'piwik_url',
12
+ 'piwik_path',
13
+ 'piwik_user',
14
+ 'piwik_token',
15
+ 'auto_site_config',
16
+ 'default_date',
17
+ 'stats_seo',
18
+ 'dashboard_widget',
19
+ 'dashboard_chart',
20
+ 'dashboard_seo',
21
+ 'toolbar',
22
+ 'capability_read_stats',
23
+ 'perpost_stats',
24
+ 'plugin_display_name',
25
+ 'piwik_shortcut',
26
+ 'shortcodes',
27
+ 'track_mode',
28
+ 'track_codeposition',
29
+ 'track_noscript',
30
+ 'track_nojavascript',
31
+ 'proxy_url',
32
+ 'track_content',
33
+ 'track_search',
34
+ 'track_404',
35
+ 'add_post_annotations',
36
+ 'add_customvars_box',
37
+ 'add_download_extensions',
38
+ 'disable_cookies',
39
+ 'limit_cookies',
40
+ 'limit_cookies_visitor',
41
+ 'limit_cookies_session',
42
+ 'limit_cookies_referral',
43
+ 'track_admin',
44
+ 'capability_stealth',
45
+ 'track_across',
46
+ 'track_across_alias',
47
+ 'track_feed',
48
+ 'track_feed_addcampaign',
49
+ 'track_feed_campaign',
50
+ 'cache',
51
+ 'disable_timelimit',
52
+ 'connection_timeout',
53
+ 'disable_ssl_verify',
54
+ 'piwik_useragent',
55
+ 'piwik_useragent_string',
56
+ 'track_datacfasync',
57
+ 'track_cdnurl',
58
+ 'track_cdnurlssl',
59
+ 'force_protocol'
60
+ );
61
+
62
+ $settings = array (
63
+ 'name',
64
+ 'site_id',
65
+ 'noscript_code',
66
+ 'tracking_code',
67
+ 'last_tracking_code_update',
68
+ 'dashboard_revision'
69
+ );
70
 
71
  global $wpdb;
72
 
73
  if (function_exists('is_multisite') && is_multisite()) {
 
74
  $aryBlogs = $wpdb->get_results('SELECT blog_id FROM '.$wpdb->blogs.' ORDER BY blog_id');
75
  if (is_array($aryBlogs))
76
+ foreach ($aryBlogs as $aryBlog) {
77
+ foreach ($settings as $key) {
78
+ delete_blog_option($aryBlog->blog_id, 'wp-piwik-'.$key);
79
+ }
80
+ switch_to_blog($aryBlog->blog_id);
81
+ $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'wp-piwik_%'");
82
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_wp-piwik_%'");
83
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_wp-piwik_%'");
84
+ restore_current_blog();
85
+
86
+ }
87
+ foreach ($globalSettings as $key)
88
+ delete_site_option('wp-piwik_global-'.$key);
89
+ delete_site_option('wp-piwik-manually');
90
+ delete_site_option('wp-piwik-notices');
91
  }
92
 
93
+ foreach ($settings as $key)
94
+ delete_option('wp-piwik-'.$key);
95
+
96
+ foreach ($globalSettings as $key)
97
+ delete_option('wp-piwik_global-'.$key);
98
+
99
+ delete_option('wp-piwik-manually');
100
+ delete_option('wp-piwik-notices');
101
+
102
+ $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key LIKE 'wp-piwik-%'");
103
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_wp-piwik_%'");
104
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_wp-piwik_%'");
update/100000.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Get & delete old version's options
3
+ if (self::$settings->checkNetworkActivation ()) {
4
+ $oldGlobalOptions = get_site_option ( 'wp-piwik_global-settings', array () );
5
+ delete_site_option ( 'wp-piwik_global-settings' );
6
+ } else {
7
+ $oldGlobalOptions = get_option ( 'wp-piwik_global-settings', array () );
8
+ delete_option ( 'wp-piwik_global-settings' );
9
+ }
10
+ $oldOptions = get_option ( 'wp-piwik_settings', array () );
11
+ delete_option ( 'wp-piwik_settings' );
12
+
13
+ if (!$oldGlobalOptions['add_tracking_code']) $oldGlobalOptions['track_mode'] = 'disabled';
14
+ elseif ($oldGlobalOptions['track_mode'] == 0) $oldGlobalOptions['track_mode'] = 'default';
15
+ elseif ($oldGlobalOptions['track_mode'] == 1) $oldGlobalOptions['track_mode'] = 'js';
16
+ elseif ($oldGlobalOptions['track_mode'] == 2) $oldGlobalOptions['track_mode'] = 'proxy';
17
+
18
+ // Store old values in new settings
19
+ foreach ( $oldGlobalOptions as $key => $value )
20
+ self::$settings->setGlobalOption ( $key, $value );
21
+ foreach ( $oldOptions as $key => $value )
22
+ self::$settings->setOption ( $key, $value );
23
+ self::$settings->save ();
update/80403.php CHANGED
@@ -1,49 +1,89 @@
1
  <?php
2
  // Capability read stats: Translate level to role
3
- $aryTranslate = array(
4
- 'level_10' => array('administrator' => true),
5
- 'level_7' => array('editor' => true, 'administrator' => true),
6
- 'level_2' => array('author' => true, 'editor' => true, 'administrator' => true),
7
- 'level_1' => array('contributor' => true, 'author' => true, 'editor' => true, 'administrator' => true),
8
- 'level_0' => array('subscriber' => true, 'contributor' => true, 'author' => true, 'editor' => true, 'administrator' => true)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  );
10
- $strDisplayToLevel = get_option('wp-piwik_displayto','level_10');
11
- if (!is_array($strDisplayToLevel) && isset($aryTranslate[$strDisplayToLevel])) $aryDisplayToCap = $aryTranslate[$strDisplayToLevel];
12
- else $aryDisplayToCap = array('administrator' => true);
13
- // Build settings arrays
14
- $aryDashboardWidgetRange = array(0 => false, 1 => 'yesterday', 2 => 'today', 3 => 'last30');
15
- if (self::$bolWPMU) $aryGlobal = array(
16
- 'revision' => get_site_option('wpmu-piwik_revision', 0),
17
- 'add_tracking_code' => true,
18
- 'last_settings_update' => get_site_option('wpmu-piwik_settingsupdate', time()),
19
- 'piwik_token' => get_site_option('wpmu-piwik_token', ''),
20
- 'piwik_url' => get_site_option('wpmu-piwik_url', ''),
21
- 'dashboard_widget' => false,
22
- 'capability_stealth' => get_site_option('wpmu-piwik_filter', array()),
23
- 'capability_read_stats' => $aryDisplayToCap,
24
- 'piwik_shortcut' => false,
25
- );
26
- else $aryGlobal = array(
27
- 'revision' => get_option('wp-piwik_revision',0),
28
- 'add_tracking_code' => get_option('wp-piwik_addjs'),
29
- 'last_settings_update' => get_option('wp-piwik_settingsupdate', time()),
30
- 'piwik_token' => get_option('wp-piwik_token', ''),
31
- 'piwik_url' => get_option('wp-piwik_url', ''),
32
- 'dashboard_widget' => $aryDashboardWidgetRange[get_option('wp-piwik_dbwidget', 0)],
33
- 'capability_stealth' => get_option('wp-piwik_filter', array()),
34
- 'capability_read_stats' => $aryDisplayToCap,
35
- 'piwik_shortcut' => get_option('wp-piwik_piwiklink',false),
36
  );
37
- $this->installSite(false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  // Remove deprecated option values
39
- $aryRemoveOptions = array(
40
- 'wp-piwik_disable_gapi','wp-piwik_displayto',
41
- 'wp-piwik_revision','wp-piwik_addjs','wp-piwik_settingsupdate','wp-piwik_token',
42
- 'wp-piwik_url','wp-piwik_dbwidget','wp-piwik_filter','wp-piwik_piwiklink'
 
 
 
 
 
 
 
43
  );
44
- foreach ($aryRemoveOptions as $strRemoveOption) {
45
- if (self::$bolWPMU) delete_site_option($strRemoveOption);
46
- else delete_option($strRemoveOption);
 
 
47
  }
48
- foreach ($aryGlobal as $key => $value)
49
- self::$settings->setGlobalOption($key, $value);
1
  <?php
2
  // Capability read stats: Translate level to role
3
+ $aryTranslate = array (
4
+ 'level_10' => array (
5
+ 'administrator' => true
6
+ ),
7
+ 'level_7' => array (
8
+ 'editor' => true,
9
+ 'administrator' => true
10
+ ),
11
+ 'level_2' => array (
12
+ 'author' => true,
13
+ 'editor' => true,
14
+ 'administrator' => true
15
+ ),
16
+ 'level_1' => array (
17
+ 'contributor' => true,
18
+ 'author' => true,
19
+ 'editor' => true,
20
+ 'administrator' => true
21
+ ),
22
+ 'level_0' => array (
23
+ 'subscriber' => true,
24
+ 'contributor' => true,
25
+ 'author' => true,
26
+ 'editor' => true,
27
+ 'administrator' => true
28
+ )
29
  );
30
+ $strDisplayToLevel = get_option ( 'wp-piwik_displayto', 'level_10' );
31
+ if (! is_array ( $strDisplayToLevel ) && isset ( $aryTranslate [$strDisplayToLevel] ))
32
+ $aryDisplayToCap = $aryTranslate [$strDisplayToLevel];
33
+ else
34
+ $aryDisplayToCap = array (
35
+ 'administrator' => true
36
+ );
37
+ // Build settings arrays
38
+ $aryDashboardWidgetRange = array (
39
+ 0 => false,
40
+ 1 => 'yesterday',
41
+ 2 => 'today',
42
+ 3 => 'last30'
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  );
44
+ if (self::$bolWPMU)
45
+ $aryGlobal = array (
46
+ 'revision' => get_site_option ( 'wpmu-piwik_revision', 0 ),
47
+ 'add_tracking_code' => true,
48
+ 'last_settings_update' => get_site_option ( 'wpmu-piwik_settingsupdate', time () ),
49
+ 'piwik_token' => get_site_option ( 'wpmu-piwik_token', '' ),
50
+ 'piwik_url' => get_site_option ( 'wpmu-piwik_url', '' ),
51
+ 'dashboard_widget' => false,
52
+ 'capability_stealth' => get_site_option ( 'wpmu-piwik_filter', array () ),
53
+ 'capability_read_stats' => $aryDisplayToCap,
54
+ 'piwik_shortcut' => false
55
+ );
56
+ else
57
+ $aryGlobal = array (
58
+ 'revision' => get_option ( 'wp-piwik_revision', 0 ),
59
+ 'add_tracking_code' => get_option ( 'wp-piwik_addjs' ),
60
+ 'last_settings_update' => get_option ( 'wp-piwik_settingsupdate', time () ),
61
+ 'piwik_token' => get_option ( 'wp-piwik_token', '' ),
62
+ 'piwik_url' => get_option ( 'wp-piwik_url', '' ),
63
+ 'dashboard_widget' => $aryDashboardWidgetRange [get_option ( 'wp-piwik_dbwidget', 0 )],
64
+ 'capability_stealth' => get_option ( 'wp-piwik_filter', array () ),
65
+ 'capability_read_stats' => $aryDisplayToCap,
66
+ 'piwik_shortcut' => get_option ( 'wp-piwik_piwiklink', false )
67
+ );
68
+ $this->installSite ( false );
69
  // Remove deprecated option values
70
+ $aryRemoveOptions = array (
71
+ 'wp-piwik_disable_gapi',
72
+ 'wp-piwik_displayto',
73
+ 'wp-piwik_revision',
74
+ 'wp-piwik_addjs',
75
+ 'wp-piwik_settingsupdate',
76
+ 'wp-piwik_token',
77
+ 'wp-piwik_url',
78
+ 'wp-piwik_dbwidget',
79
+ 'wp-piwik_filter',
80
+ 'wp-piwik_piwiklink'
81
  );
82
+ foreach ( $aryRemoveOptions as $strRemoveOption ) {
83
+ if (self::$bolWPMU)
84
+ delete_site_option ( $strRemoveOption );
85
+ else
86
+ delete_option ( $strRemoveOption );
87
  }
88
+ foreach ( $aryGlobal as $key => $value )
89
+ self::$settings->setGlobalOption ( $key, $value );
update/80502.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('default_date', 'yesterday');
 
 
update/80602.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('dashboard_chart', false);
 
 
update/80800.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
- self::$settings->setGlobalOption('piwik_url', self::checkURL(self::$settings->getGlobalOption('piwik_url')));
1
+ <?php
2
+ self::$settings->setGlobalOption ( 'piwik_url', self::$settings->getGlobalOption ( 'piwik_url' ) . ((substr ( $strURL, - 1, 1 ) != '/' && substr ( $strURL, - 10, 10 ) != '/index.php') ? '/' : '') );
update/90001.php CHANGED
@@ -1,13 +1,9 @@
1
- <?php
2
- $aryWPMUConfig = get_site_option('wpmu-piwik_global-settings',false);
3
- if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && $aryWPMUConfig) {
4
- foreach ($aryWPMUConfig as $key => $value)
5
- self::$settings->setGlobalOption($key, $value);
6
- delete_site_option('wpmu-piwik_global-settings');
7
- self::$settings->setGlobalOption('auto_site_config', true);
8
- } else self::$settings->setGlobalOption('auto_site_config', false);
9
- self::$settings->setGlobalOption('dashboard_seo', false);
10
- self::$settings->setGlobalOption('stats_seo', false);
11
- self::$settings->setGlobalOption('track_404', self::$settings->getOption('track_404'));
12
- self::$settings->setGlobalOption('track_compress', false);
13
- self::$settings->setGlobalOption('track_post', false);
1
+ <?php
2
+ $aryWPMUConfig = get_site_option ( 'wpmu-piwik_global-settings', false );
3
+ if (self::$settings->checkNetworkActivation () && $aryWPMUConfig) {
4
+ foreach ( $aryWPMUConfig as $key => $value )
5
+ self::$settings->setGlobalOption ( $key, $value );
6
+ delete_site_option ( 'wpmu-piwik_global-settings' );
7
+ self::$settings->setGlobalOption ( 'auto_site_config', true );
8
+ } else
9
+ self::$settings->setGlobalOption ( 'auto_site_config', false );
 
 
 
 
update/90206.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('disable_timelimit', false);
 
 
update/90405.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('piwik_mode', 'http');
3
- self::$settings->setGlobalOption('piwik_path', '');
4
- self::$settings->setGlobalOption('toolbar', false);
5
- self::$settings->setGlobalOption('disable_cookies', false);
 
 
 
 
 
update/90601.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('piwik_useragent', 'php');
3
- self::$settings->setGlobalOption('piwik_useragent_string', 'WP-Piwik');
 
 
 
update/90700.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('shortcodes', false);
 
 
update/90801.php CHANGED
@@ -1,7 +1,5 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_search', false);
3
- self::$settings->setGlobalOption('connection_timeout', 5);
4
- if (self::$settings->getGlobalOption('track_compress'))
5
- self::$settings->setGlobalOption('track_mode', 1);
6
- else
7
- self::$settings->setGlobalOption('track_mode', 0);
1
+ <?php
2
+ if (self::$settings->getGlobalOption ( 'track_compress' ))
3
+ self::$settings->setGlobalOption ( 'track_mode', 1 );
4
+ else
5
+ self::$settings->setGlobalOption ( 'track_mode', 0 );
 
 
update/90821.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_cdnurl', '');
 
 
update/90910.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_cdnurlssl', self::$settings->getGlobalOption('track_cdnurl'));
3
- self::$settings->setGlobalOption('track_noscript', false);
 
 
 
update/90920.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('plugin_display_name', 'WP-Piwik');
 
 
update/90940.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_nojavascript', false);
 
 
update/90961.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('cache', true);
 
 
update/90971.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_admin', false);
3
- self::$settings->setGlobalOption('perpost_stats', false);
 
 
 
update/90980.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_feed', false);
3
- self::$settings->setGlobalOption('track_feed_goal', false);
4
- self::$settings->setGlobalOption('track_feed_revenue', false);
5
- self::$settings->setGlobalOption('track_feed_campaign', 'feed');
6
- self::$settings->setGlobalOption('track_feed_addcampaign', false);
 
 
 
 
 
 
update/91006.php CHANGED
@@ -1,3 +1,10 @@
1
- <?php
2
- $aryRemoveOptions = array('wp-piwik_siteid','wp-piwik_404','wp-piwik_scriptupdate','wp-piwik_dashboardid','wp-piwik_jscode');
3
- foreach ($aryRemoveOptions as $strRemoveOption) delete_option($strRemoveOption);
 
 
 
 
 
 
 
1
+ <?php
2
+ $aryRemoveOptions = array (
3
+ 'wp-piwik_siteid',
4
+ 'wp-piwik_404',
5
+ 'wp-piwik_scriptupdate',
6
+ 'wp-piwik_dashboardid',
7
+ 'wp-piwik_jscode'
8
+ );
9
+ foreach ( $aryRemoveOptions as $strRemoveOption )
10
+ delete_option ( $strRemoveOption );
update/91007.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- self::$settings->setGlobalOption('track_codeposition', 'footer');
 
 
update/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- // Nothing to see...
 
 
wp-piwik.php CHANGED
@@ -1,1552 +1,77 @@
1
- <?php
2
- /*
3
- Plugin Name: WP-Piwik
4
-
5
- Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
6
-
7
- Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header.
8
-
9
- Version: 0.9.9.18
10
- Author: Andr&eacute; Br&auml;kling
11
- Author URI: http://www.braekling.de
12
-
13
- ******************************************************************************************
14
- Copyright (C) 2009-2015 Andre Braekling (email: webmaster@braekling.de)
15
-
16
- This program is free software: you can redistribute it and/or modify
17
- it under the terms of the GNU General Public License as published by
18
- the Free Software Foundation, either version 3 of the License, or
19
- at your option) any later version.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program. If not, see <http://www.gnu.org/licenses/>.
28
- *******************************************************************************************/
29
-
30
- if (!function_exists ('add_action')) {
31
- header('Status: 403 Forbidden');
32
- header('HTTP/1.1 403 Forbidden');
33
- exit();
34
- }
35
-
36
- //require_once(ABSPATH.'wp-includes/pluggable.php');
37
-
38
- if (!class_exists('wp_piwik')) {
39
- class wp_piwik {
40
-
41
- private static
42
- $intRevisionId = 98004,
43
- $strVersion = '0.9.9.18',
44
- $blog_id,
45
- $intDashboardID = 30,
46
- $strPluginBasename = NULL,
47
- $bolJustActivated = false,
48
- $logger,
49
- $settings;
50
-
51
- private
52
- $intStatsPage = NULL,
53
- $bolNetwork = false,
54
- $aryAttributes = array(),
55
- $strResult = '';
56
-
57
- public function __construct() {
58
- global $blog_id;
59
- self::$blog_id = (isset($blog_id)?$blog_id:'n/a');
60
- $this->openLogger();
61
- $this->openSettings();
62
- $this->setup();
63
- $this->addFilters();
64
- $this->addActions();
65
- $this->addShortcodes();
66
- self::$settings->save();
67
- }
68
-
69
- public function __destruct() {
70
- $this->closeLogger();
71
- }
72
-
73
- private function setup() {
74
- self::$strPluginBasename = plugin_basename(__FILE__);
75
- register_activation_hook(__FILE__, array($this, 'installPlugin'));
76
- if ($this->isUpdated())
77
- $this->upgradePlugin();
78
- if ($this->isConfigSubmitted())
79
- $this->applySettings();
80
- if ($this->isPHPMode())
81
- self::definePiwikConstants();
82
- if (is_admin() || $this->isAddShortcode())
83
- $this->loadLanguage();
84
- }
85
-
86
- private function addActions() {
87
- if (is_admin()) {
88
- add_action('admin_menu', array($this, 'buildAdminMenu'));
89
- add_action('admin_post_save_wp-piwik_stats', array(&$this, 'onStatsPageSaveChanges'));
90
- add_action('load-post.php', array(&$this, 'postMetaboxes'));
91
- add_action('load-post-new.php', array(&$this, 'postMetaboxes'));
92
- if ($this->isNetworkMode())
93
- add_action('network_admin_menu', array($this, 'buildNetworkAdminMenu'));
94
- if ($this->isDashboardActive())
95
- add_action('wp_dashboard_setup', array($this, 'extendWordPressDashboard'));
96
- if (self::$settings->getGlobalOption('add_post_annotations'))
97
- add_action('transition_post_status', array($this, 'onPostStatusTransition'),10,3);
98
- }
99
- if ($this->isToolbarActive()) {
100
- // is_admin_bar_showing() would be great to use, but it will break P3 Plugin Performance Profiler (https://wordpress.org/plugins/p3-profiler/)
101
- add_action(is_admin()?'admin_head':'wp_head', array($this, 'loadToolbarRequirements'));
102
- add_action('admin_bar_menu', array(&$this, 'extendWordPressToolbar'), 1000);
103
- }
104
- if ($this->isTrackingActive()) {
105
- if (!is_admin()) {
106
- add_action(self::$settings->getGlobalOption('track_codeposition') == 'footer'?'wp_footer':'wp_head', array($this, 'addJavascriptCode'));
107
- if ($this->isAddNoScriptCode())
108
- add_action('wp_footer', array($this, 'addNoscriptCode'));
109
- }
110
- else {
111
- if ($this->isAdminTrackingActive())
112
- add_action('admin_head', array($this, 'addAdminHeaderTracking'));
113
- }
114
- }
115
- }
116
-
117
- private function addFilters() {
118
- if (is_admin()) {
119
- add_filter('plugin_row_meta', array($this, 'setPluginMeta'), 10, 2);
120
- add_filter('screen_layout_columns', array(&$this, 'onScreenLayoutColumns'), 10, 2);
121
- }
122
- else {
123
- if ($this->isTrackingActive()) {
124
- if ($this->isTrackFeed()) {
125
- add_filter('the_excerpt_rss', array(&$this, 'addFeedTracking'));
126
- add_filter('the_content', array(&$this, 'addFeedTracking'));
127
- }
128
- if ($this->isAddFeedCampaign())
129
- add_filter('post_link', array(&$this, 'addFeedCampaign'));
130
- }
131
- }
132
- }
133
-
134
- private function addShortcodes() {
135
- if ($this->isAddShortcode())
136
- add_shortcode('wp-piwik', array(&$this, 'shortcode'));
137
- }
138
-
139
- private function loadLanguage() {
140
- load_plugin_textdomain('wp-piwik', false, dirname(self::$strPluginBasename)."/languages/");
141
- }
142
-
143
- function installPlugin() {
144
- self::$logger->log('Running WP-Piwik installation');
145
- add_action('admin_notices', array($this, 'updateMessage'));
146
- self::$bolJustActivated = true;
147
- self::$settings->setGlobalOption('revision', self::$intRevisionId);
148
- self::$settings->setGlobalOption('last_settings_update', time());
149
- }
150
-
151
- static function uninstallPlugin() {
152
- self::$logger->log('Running WP-Piwik uninstallation');
153
- if (!defined('WP_UNINSTALL_PLUGIN'))
154
- exit();
155
- self::$settings->resetSettings(true);
156
- }
157
-
158
- function upgradePlugin() {
159
- self::$logger->log('Upgrade WP-Piwik to '.self::$strVersion);
160
- add_action('admin_notices', array($this, 'updateMessage'));
161
- $patches = glob(dirname(__FILE__).DIRECTORY_SEPARATOR.'update'.DIRECTORY_SEPARATOR.'*.php');
162
- if (is_array($patches)) {
163
- sort($patches);
164
- foreach ($patches as $patch) {
165
- $patchVersion = (int) pathinfo($patch, PATHINFO_FILENAME);
166
- if ($patchVersion && self::$settings->getGlobalOption('revision') < $patchVersion)
167
- self::includeFile('update'.DIRECTORY_SEPARATOR.$patchVersion);
168
- }
169
- }
170
- $this->installPlugin();
171
- }
172
-
173
- function updateMessage() {
174
- $text = sprintf(__('%s %s installed.', 'wp-piwik'), self::$settings->getGlobalOption('plugin_display_name'), self::$strVersion);
175
- $notice = (!self::isConfigured()?
176
- __('Next you should connect to Piwik','wp-piwik'):
177
- __('Please validate your configuration','wp-piwik')
178
- );
179
- $link = sprintf('<a href="'.$this->getSettingsURL().'?page=%s">%s</a>', self::$strPluginBasename, __('Settings', 'wp-piwik'));
180
- printf('<div class="updated fade"><p>%s<strong>%s:</strong> %s: %s</p></div>', $text, __('Important', 'wp-piwik'), $notice, $link);
181
- }
182
-
183
- function getSettingsURL() {
184
- return (self::$settings->checkNetworkActivation()?'settings':'options-general').'.php';
185
- }
186
-
187
- private function updateTrackingCode() {
188
- if (!self::$settings->getOption('site_id') || !self::$settings->getOption('tracking_code'))
189
- $this->addPiwikSite();
190
- if ($this->isCurrentTrackingCode()) {
191
- self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
192
- self::$settings->save();
193
- }
194
- }
195
-
196
- /* -- </REFACTORED><OLD> -- */
197
-
198
- function addJavascriptCode() {
199
- if ($this->isHiddenUser()) {
200
- self::$logger->log('Do not add tracking code to site header (user should not be tracked) Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
201
- return;
202
- }
203
- $this->updateTrackingCode();
204
-
205
- // Change code if 404
206
- if (is_404() && self::$settings->getGlobalOption('track_404')) {
207
- self::$logger->log('Apply 404 changes. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
208
- $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setDocumentTitle', '404/URL = '+String(document.location.pathname+document.location.search).replace(/\//g,'%2f') + '/From = ' + String(document.referrer).replace(/\//g,'%2f')]);\n_paq.push(['trackPageView']);", self::$settings->getOption('tracking_code'));
209
- }
210
- // Change code if search result
211
- elseif (is_search() && self::$settings->getGlobalOption('track_search')) {
212
- self::$logger->log('Apply search tracking changes. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
213
- $objSearch = new WP_Query("s=" . get_search_query() . '&showposts=-1');
214
- $intResultCount = $objSearch->post_count;
215
- $strTrackingCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['trackSiteSearch','".get_search_query()."', false, ".$intResultCount."]);\n_paq.push(['trackPageView']);", self::$settings->getOption('tracking_code'));
216
- // Use default tracking code
217
- } else
218
- $strTrackingCode = self::$settings->getOption('tracking_code');
219
- // Send tracking code
220
- self::$logger->log('Add tracking code. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
221
- // Add custom variables if set:
222
- if (is_single()) {
223
- $strCustomVars = '';
224
- for ($i = 1; $i <= 5; $i++) {
225
- // Get post ID
226
- $intID = get_the_ID();
227
- // Get key
228
- $strMetaKey = get_post_meta($intID, 'wp-piwik_custom_cat'.$i, true);
229
- // Get value
230
- $strMetaVal = get_post_meta($intID, 'wp-piwik_custom_val'.$i, true);
231
- if (!empty($strMetaKey) && !empty($strMetaVal))
232
- $strCustomVars .= "_paq.push(['setCustomVariable',".$i.", '".$strMetaKey."', '".$strMetaVal."', 'page']);\n";
233
- }
234
- if (!empty($strCustomVars)) $strTrackingCode = str_replace("_paq.push(['trackPageView']);", $strCustomVars."_paq.push(['trackPageView']);", $strTrackingCode);
235
- }
236
- echo $strTrackingCode;
237
- $strName = get_bloginfo('name');
238
- if (self::$settings->getOption('name') != $strName)
239
- $this->updatePiwikSite();
240
- }
241
-
242
- function addNoscriptCode() {
243
- // Hotfix: Custom capability problem with WP multisite
244
- if (is_multisite()) {
245
- foreach (self::$settings->getGlobalOption('capability_stealth') as $strKey => $strVal)
246
- if ($strVal && current_user_can($strKey))
247
- return;
248
- // Don't add tracking code?
249
- } elseif (current_user_can('wp-piwik_stealth')) return;
250
- // Send tracking code
251
- self::$logger->log('Add noscript code. Blog ID: '.self::$blog_id.' Site ID: '.self::$settings->getOption('site_id'));
252
- echo self::$settings->getOption('noscript_code')."\n";
253
- }
254
-
255
- /**
256
- * Shortcode function
257
- **/
258
-
259
- function shortcode($aryAttributes) {
260
- $this->aryAttributes = shortcode_atts(
261
- array(
262
- 'title' => '',
263
- 'module' => 'overview',
264
- 'period' => 'day',
265
- 'date' => 'yesterday',
266
- 'limit' => 10,
267
- 'width' => '100%',
268
- 'height' => '200px',
269
- 'language' => 'en',
270
- 'range' => false,
271
- 'key' => 'sum_daily_nb_uniq_visitors'
272
- ), $aryAttributes);
273
- switch ($this->aryAttributes['module']) {
274
- case 'opt-out':
275
- $this->strResult = '<iframe frameborder="no" width="'.$this->aryAttributes['width'].'" height="'.$this->aryAttributes['height'].'" src="'.self::$settings->getGlobalOption('piwik_url').'index.php?module=CoreAdminHome&action=optOut&language='.$this->aryAttributes['language'].'"></iframe>';
276
- break;
277
- case 'post':
278
- self::includeFile('shortcodes/post');
279
- break;
280
- case 'overview':
281
- default:
282
- self::includeFile('shortcodes/overview');
283
- }
284
- return $this->strResult;
285
- }
286
-
287
- /**
288
- * Add metaboxes to posts
289
- */
290
- function postMetaboxes() {
291
- if (self::$settings->getGlobalOption('add_customvars_box')) {
292
- add_action('add_meta_boxes', array(&$this, 'postAddMetaboxes'));
293
- add_action('save_post', array(&$this, 'postCustomvarsSave'), 10, 2);
294
- }
295
- // Show per post stats if enabled
296
- if (self::$settings->getGlobalOption('perpost_stats')) {
297
- $this->includeFile('classes/WP_Piwik_MetaBox_PerPost_Stats');
298
- add_action('add_meta_boxes', array(new WP_Piwik_MetaBox_PerPost_Stats($this->subClassConfig()), 'addMetabox'));
299
- }
300
- }
301
-
302
- /**
303
- * Create post meta boxes
304
- */
305
- function postAddMetaboxes() {
306
- add_meta_box(
307
- 'wp-piwik_post_customvars',
308
- __('Piwik Custom Variables', 'wp-piwik'),
309
- array(&$this, 'postCustomvars'),
310
- 'post',
311
- 'side',
312
- 'default'
313
- );
314
- }
315
-
316
- /**
317
- * Display custom variables meta box
318
- */
319
- function postCustomvars($objPost, $objBox ) {
320
- wp_nonce_field(basename( __FILE__ ), 'wp-piwik_post_customvars_nonce'); ?>
321
- <table>
322
- <tr><th></th><th><?php _e('Name', 'wp-piwik'); ?></th><th><?php _e('Value', 'wp-piwik'); ?></th></tr>
323
- <?php for($i = 1; $i <= 5; $i++) { ?>
324
- <tr>
325
- <th><label for="wp-piwik_customvar1"><?php echo $i; ?>: </label></th>
326
- <td><input class="widefat" type="text" name="wp-piwik_custom_cat<?php echo $i; ?>" value="<?php echo esc_attr(get_post_meta($objPost->ID, 'wp-piwik_custom_cat'.$i, true ) ); ?>" size="200" /></td>
327
- <td><input class="widefat" type="text" name="wp-piwik_custom_val<?php echo $i; ?>" value="<?php echo esc_attr(get_post_meta($objPost->ID, 'wp-piwik_custom_val'.$i, true ) ); ?>" size="200" /></td>
328
- </tr>
329
- <?php } ?>
330
- </table>
331
- <p><?php _e('Set custom variables for a page view', 'wp-piwik'); ?>. (<a href="http://piwik.org/docs/custom-variables/"><?php _e('More information', 'wp-piwik'); ?></a>.)</p>
332
- <?php
333
- }
334
-
335
- /**
336
- * Save post custom variables
337
- */
338
- function postCustomvarsSave($intID, $objPost) {
339
- // Verify the nonce before proceeding.
340
- if (!isset( $_POST['wp-piwik_post_customvars_nonce'] ) || !wp_verify_nonce( $_POST['wp-piwik_post_customvars_nonce'], basename( __FILE__ ) ) )
341
- return $intID;
342
- // Get post type object
343
- $objPostType = get_post_type_object($objPost->post_type);
344
- // Check if the current user has permission to edit the post.
345
- if (!current_user_can($objPostType->cap->edit_post, $intID))
346
- return $intID;
347
- $aryNames = array('cat', 'val');
348
- for ($i = 1; $i <= 5; $i++)
349
- for ($j = 0; $j <= 1; $j++) {
350
- // Get data
351
- $strMetaVal = (isset($_POST['wp-piwik_custom_'.$aryNames[$j].$i])?htmlentities($_POST['wp-piwik_custom_'.$aryNames[$j].$i]):'');
352
- // Create key
353
- $strMetaKey = 'wp-piwik_custom_'.$aryNames[$j].$i;
354
- // Get the meta value of the custom field key
355
- $strCurVal = get_post_meta($intID, $strMetaKey, true);
356
- // Add meta val:
357
- if ($strMetaVal && '' == $strCurVal)
358
- add_post_meta($intID, $strMetaKey, $strMetaVal, true);
359
- // Update meta val:
360
- elseif ($strMetaVal && $strMetaVal != $strCurVal)
361
- update_post_meta($intID, $strMetaKey, $strMetaVal);
362
- // Delete meta val:
363
- elseif (''==$strMetaVal && $strCurVal)
364
- delete_post_meta($intID, $strMetaKey, $strCurVal);
365
- }
366
- }
367
-
368
- /**
369
- * Add pages to admin menu
370
- */
371
- function buildAdminMenu() {
372
- // Show stats dashboard page if WP-Piwik is configured
373
- if (self::isConfigured()) {
374
- // Add dashboard page
375
- $this->intStatsPage = add_dashboard_page(
376
- __('Piwik Statistics', 'wp-piwik'),
377
- self::$settings->getGlobalOption('plugin_display_name'),
378
- 'wp-piwik_read_stats',
379
- 'wp-piwik_stats',
380
- array($this, 'showStats')
381
- );
382
- // Add required scripts
383
- add_action('admin_print_scripts-'.$this->intStatsPage, array($this, 'loadStatsScripts'));
384
- // Add required styles
385
- add_action('admin_print_styles-'.$this->intStatsPage, array($this, 'addAdminStyle'));
386
- // Add required header tags
387
- add_action('admin_head-'.$this->intStatsPage, array($this, 'addAdminHeaderStats'));
388
- // Stats page onload callback
389
- add_action('load-'.$this->intStatsPage, array(&$this, 'onloadStatsPage'));
390
- }
391
- if (!self::$settings->checkNetworkActivation()) {
392
- // Add options page
393
- $intOptionsPage = add_options_page(
394
- self::$settings->getGlobalOption('plugin_display_name'),
395
- self::$settings->getGlobalOption('plugin_display_name'),
396
- 'activate_plugins',
397
- __FILE__,
398
- array($this, 'showSettings')
399
- );
400
- // Add required scripts
401
- add_action('admin_print_scripts-'.$this->intStatsPage, array($this, 'loadSettingsScripts'));
402
- // Add required header tags
403
- add_action('admin_head-'.$intOptionsPage, array($this, 'addAdminHeaderSettings'));
404
- // Add styles required by options page
405
- add_action('admin_print_styles-'.$intOptionsPage, array($this, 'addAdminStyle'));
406
- }
407
- }
408
-
409
- /**
410
- * Add pages to network admin menu
411
- */
412
- function buildNetworkAdminMenu() {
413
- // Show stats dashboard page if WP-Piwik is configured
414
- if (self::isConfigured()) {
415
- // Add dashboard page
416
- $this->intStatsPage = add_dashboard_page(
417
- __('Piwik Statistics', 'wp-piwik'),
418
- self::$settings->getGlobalOption('plugin_display_name'),
419
- 'manage_sites',
420
- 'wp-piwik_stats',
421
- array($this, 'showStatsNetwork')
422
- );
423
- // Add required scripts
424
- add_action('admin_print_scripts-'.$this->intStatsPage, array($this, 'loadStatsScripts'));
425
- // Add required styles
426
- add_action('admin_print_styles-'.$this->intStatsPage, array($this, 'addAdminStyle'));
427
- // Add required header tags
428
- add_action('admin_head-'.$this->intStatsPage, array($this, 'addAdminHeaderStats'));
429
- // Stats page onload callback
430
- add_action('load-'.$this->intStatsPage, array(&$this, 'onloadStatsPage'));
431
- }
432
- $intOptionsPage = add_submenu_page(
433
- 'settings.php',
434
- self::$settings->getGlobalOption('plugin_display_name'),
435
- self::$settings->getGlobalOption('plugin_display_name'),
436
- 'manage_sites',
437
- __FILE__,
438
- array($this, 'showSettings')
439
- );
440
-
441
- // Add styles required by options page
442
- add_action('admin_print_styles-'.$intOptionsPage, array($this, 'addAdminStyle'));
443
- add_action('admin_head-'.$intOptionsPage, array($this, 'addAdminHeaderSettings'));
444
- }
445
-
446
- /**
447
- * Support two columns
448
- * seen in Heiko Rabe's metabox demo plugin
449
- *
450
- * @see http://tinyurl.com/5r5vnzs
451
- */
452
- function onScreenLayoutColumns($aryColumns, $strScreen) {
453
- if ($strScreen == $this->intStatsPage)
454
- $aryColumns[$this->intStatsPage] = 3;
455
- return $aryColumns;
456
- }
457
-
458
- /**
459
- * Add widgets to WordPress dashboard
460
- */
461
- function extendWordPressDashboard() {
462
- // Is user allowed to see stats?
463
- if (current_user_can('wp-piwik_read_stats')) {
464
- // TODO: Use bitmask here
465
- // Add data widget if enabled
466
- if (self::$settings->getGlobalOption('dashboard_widget'))
467
- $this->addWordPressDashboardWidget();
468
- // Add chart widget if enabled
469
- if (self::$settings->getGlobalOption('dashboard_chart')) {
470
- // Add required scripts
471
- add_action('admin_print_scripts-index.php', array($this, 'loadStatsScripts'));
472
- // Add required styles
473
- add_action('admin_print_styles-index.php', array($this, 'addAdminStyle'));
474
- // Add required header tags
475
- add_action('admin_head-index.php', array($this, 'addAdminHeaderStats'));
476
- $this->addWordPressDashboardChart();
477
- }
478
- // Add SEO widget if enabled
479
- if (self::$settings->getGlobalOption('dashboard_seo'))
480
- $this->addWordPressDashboardSEO();
481
- }
482
- }
483
-
484
- /**
485
- * Add widgets to WordPress Toolbar
486
- */
487
- public function extendWordPressToolbar(&$objToolbar) {
488
- // Is user allowed to see stats?
489
- if (current_user_can('wp-piwik_read_stats') && is_admin_bar_showing()) {
490
- $aryUnique = $this->callPiwikAPI('VisitsSummary.getUniqueVisitors','day','last30',null);
491
- if (!is_array($aryUnique)) $aryUnique = array();
492
- $strGraph = '<script type="text/javascript">';
493
- $strGraph .= "var \$jSpark = jQuery.noConflict();\$jSpark(function() {var piwikSparkVals=[".implode(',',$aryUnique)."];\$jSpark('.wp-piwik_dynbar').sparkline(piwikSparkVals, {type: 'bar', barColor: '#ccc', barWidth:2});});";
494
- $strGraph .= '</script>';
495
- $strGraph .= '<span class="wp-piwik_dynbar">Loading...</span>';
496
- $objToolbar->add_menu(array(
497
- 'id' => 'wp-piwik_stats',
498
- 'title' => $strGraph,
499
- 'href' => admin_url().'?page=wp-piwik_stats'
500
- ));
501
- }
502
- }
503
-
504
- /**
505
- * Add a data widget to the WordPress dashboard
506
- */
507
- function addWordPressDashboardWidget() {
508
- $aryConfig = array(
509
- 'params' => array('period' => 'day','date' => self::$settings->getGlobalOption('dashboard_widget'),'limit' => null),
510
- 'inline' => true,
511
- );
512
- $strFile = 'overview';
513
- add_meta_box(
514
- 'wp-piwik_stats-dashboard-overview',
515
- self::$settings->getGlobalOption('plugin_display_name').' - '.__(self::$settings->getGlobalOption('dashboard_widget'), 'wp-piwik'),
516
- array(&$this, 'createDashboardWidget'),
517
- 'dashboard',
518
- 'side',
519
- 'high',
520
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
521
- );
522
- }
523
-
524
- /**
525
- * Add a visitor chart to the WordPress dashboard
526
- */
527
- function addWordPressDashboardChart() {
528
- $aryConfig = array(
529
- 'params' => array('period' => 'day','date' => 'last30','limit' => null),
530
- 'inline' => true,
531
- );
532
- $strFile = 'visitors';
533
- add_meta_box(
534
- 'wp-piwik_stats-dashboard-chart',
535
- self::$settings->getGlobalOption('plugin_display_name').' - '.__('Visitors', 'wp-piwik'),
536
- array(&$this, 'createDashboardWidget'),
537
- 'dashboard',
538
- 'side',
539
- 'high',
540
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
541
- );
542
- }
543
-
544
- /**
545
- * Add a SEO widget to the WordPress dashboard
546
- */
547
- function addWordPressDashboardSEO() {
548
- $aryConfig = array(
549
- 'params' => array('period' => 'day','date' => 'today','limit' => null),
550
- 'inline' => true,
551
- );
552
- $strFile = 'seo';
553
- add_meta_box(
554
- 'wp-piwik_stats-dashboard-seo',
555
- self::$settings->getGlobalOption('plugin_display_name').' - '.__('SEO', 'wp-piwik'),
556
- array(&$this, 'createDashboardWidget'),
557
- 'dashboard',
558
- 'side',
559
- 'high',
560
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
561
- );
562
- }
563
-
564
- /**
565
- * Add plugin meta links to plugin details
566
- *
567
- * @see http://wpengineer.com/1295/meta-links-for-wordpress-plugins/
568
- */
569
- function setPluginMeta($strLinks, $strFile) {
570
- // Get plugin basename
571
- $strPlugin = plugin_basename(__FILE__);
572
- // Add link just to this plugin's details
573
- if ($strFile == self::$strPluginBasename)
574
- return array_merge(
575
- $strLinks,
576
- array(
577
- sprintf('<a href="'.(self::$settings->checkNetworkActivation()?'settings':'options-general').'.php?page=%s">%s</a>', self::$strPluginBasename, __('Settings', 'wp-piwik'))
578
- )
579
- );
580
- // Don't affect other plugins details
581
- return $strLinks;
582
- }
583
-
584
- /**
585
- * Load required scripts to stats page
586
- */
587
- function loadStatsScripts() {
588
- // Load WP-Piwik script
589
- wp_enqueue_script('wp-piwik', $this->getPluginURL().'js/wp-piwik.js', array(), self::$strVersion, true);
590
- // Load jqPlot
591
- wp_enqueue_script('wp-piwik-jqplot',$this->getPluginURL().'js/jqplot/wp-piwik.jqplot.js',array('jquery'));
592
- }
593
-
594
- /**
595
- * Load scripts required by Toolbar graphs
596
- */
597
- function loadToolbarRequirements() {
598
- // Only load if user is allowed to see stats
599
- if (current_user_can('wp-piwik_read_stats') && is_admin_bar_showing()) {
600
- // Load Sparklines
601
- wp_enqueue_script('wp-piwik-sparkline',$this->getPluginURL().'js/sparkline/jquery.sparkline.min.js',array('jquery'),'2.1.1');
602
- // Load CSS
603
- wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik-spark.css');
604
- }
605
- }
606
-
607
- /**
608
- * Load required scripts to settings page
609
- */
610
- function loadSettingsScripts() {
611
- wp_enqueue_script('jquery');
612
- }
613
-
614
- /**
615
- * Load required styles to admin pages
616
- */
617
- function addAdminStyle() {
618
- // Load WP-Piwik styles
619
- wp_enqueue_style('wp-piwik', $this->getPluginURL().'css/wp-piwik.css',array(),self::$strVersion);
620
- }
621
-
622
- /**
623
- * Add tracking code to admin header
624
- */
625
- function addAdminHeaderTracking() {
626
- $this->site_header();
627
- }
628
-
629
- /**
630
- * Add tracking image to feeds
631
- **/
632
- function addFeedTracking($content) {
633
- global $post;
634
- if(is_feed()) {
635
- self::$logger->log('Add tracking image to feed entry.');
636
- if (!self::$settings->getOption('site_id'))
637
- self::addPiwikSite();
638
- $title = the_title(null,null,false);
639
- $posturl = get_permalink($post->ID);
640
- $urlref = get_bloginfo('rss2_url');
641
- $url = self::$settings->getGlobalOption('piwik_url');
642
- if (substr($url, -10, 10) == '/index.php')
643
- $url = str_replace('/index.php', '/piwik.php', $url);
644
- else $url .= 'piwik.php';
645
- $trackingImage = $url.'?idsite='.self::$settings->getOption('site_id').'&amp;rec=1'.
646
- '&amp;url='.urlencode($posturl).
647
- '&amp;action_name='.urlencode($title).
648
- '&amp;urlref='.urlencode($urlref);
649
- $content .= '<img src="'.$trackingImage.'" style="border:0;width:0;height:0" width="0" height="0" alt="" />';
650
- }
651
- return $content;
652
- }
653
-
654
- /**
655
- * Add tracking image to feeds
656
- **/
657
- function addFeedCampaign($permalink) {
658
- global $post;
659
- if(is_feed()) {
660
- self::$logger->log('Add campaign to feed permalink.');
661
- $sep = (strpos($permalink, '?') === false?'?':'&');
662
- $permalink .= $sep.'pk_campaign='.urlencode(self::$settings->getGlobalOption('track_feed_campaign')).'&pk_kwd='.urlencode($post->post_name);
663
- }
664
- return $permalink;
665
- }
666
-
667
- function addPiwikAnnotation($postID) {
668
- $this->callPiwikAPI('Annotations.add', '', date('Y-m-d'), '', false, false, 'PHP', '', false, 'Published: '.get_post($postID)->post_title.' - URL: '.get_permalink($postID));
669
- }
670
-
671
- /**
672
- * Add required header tags to stats page
673
- */
674
- function addAdminHeaderStats() {
675
- // Load jqPlot IE compatibility script
676
- echo '<!--[if IE]><script language="javascript" type="text/javascript" src="'.$this->getPluginURL().'js/jqplot/excanvas.min.js"></script><![endif]-->';
677
- // Load jqPlot styles
678
- echo '<link rel="stylesheet" href="'.$this->getPluginURL().'js/jqplot/jquery.jqplot.min.css" type="text/css"/>';
679
- echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
680
- }
681
-
682
- /**
683
- * Add required header tags to settings page
684
- */
685
- function addAdminHeaderSettings() {
686
- echo '<script type="text/javascript">var $j = jQuery.noConflict();</script>';
687
- echo '<script type="text/javascript">/* <![CDATA[ */(function() {var s = document.createElement(\'script\');var t = document.getElementsByTagName(\'script\')[0];s.type = \'text/javascript\';s.async = true;s.src = \'//api.flattr.com/js/0.6/load.js?mode=auto\';t.parentNode.insertBefore(s, t);})();/* ]]> */</script>';
688
- }
689
-
690
- /**
691
- * Get this plugin's URL
692
- */
693
- function getPluginURL() {
694
- // Return plugins URL + /wp-piwik/
695
- return trailingslashit(plugins_url().'/wp-piwik/');
696
- }
697
-
698
- /**
699
- * Call REST API
700
- *
701
- * @param $strURL Remote file URL
702
- */
703
- function callREST($strURL) {
704
- $strPiwikURL = self::$settings->getGlobalOption('piwik_url');
705
- if (substr($strPiwikURL, -1, 1) != '/') $strPiwikURL .= '/';
706
- $strURL = $strPiwikURL.'?module=API'.$strURL;
707
- // Use cURL if available
708
- if (function_exists('curl_init')) {
709
- // Init cURL
710
- $c = curl_init($strURL);
711
- // Disable SSL peer verification if asked to
712
- curl_setopt($c, CURLOPT_SSL_VERIFYPEER, !self::$settings->getGlobalOption('disable_ssl_verify'));
713
- // Set user agent
714
- curl_setopt($c, CURLOPT_USERAGENT, self::$settings->getGlobalOption('piwik_useragent')=='php'?ini_get('user_agent'):self::$settings->getGlobalOption('piwik_useragent_string'));
715
- // Configure cURL CURLOPT_RETURNTRANSFER = 1
716
- curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
717
- // Configure cURL CURLOPT_HEADER = 0
718
- curl_setopt($c, CURLOPT_HEADER, 0);
719
- // Set cURL timeout
720
- curl_setopt($c, CURLOPT_TIMEOUT, self::$settings->getGlobalOption('connection_timeout'));
721
- $httpProxyClass = new WP_HTTP_Proxy();
722
- if ($httpProxyClass->is_enabled() && $httpProxyClass->send_through_proxy($strURL)) {
723
- curl_setopt($c, CURLOPT_PROXY, $httpProxyClass->host());
724
- curl_setopt($c, CURLOPT_PROXYPORT, $httpProxyClass->port());
725
- if ($httpProxyClass->use_authentication())
726
- curl_setopt($c, CURLOPT_PROXYUSERPWD, $httpProxyClass->username().':'.$httpProxyClass->password());
727
- }
728
- // Get result
729
- $strResult = curl_exec($c);
730
- // Close connection
731
- curl_close($c);
732
- // cURL not available but url fopen allowed
733
- } elseif (ini_get('allow_url_fopen')) {
734
- // Set timeout
735
- $resContext = stream_context_create(array('http'=>array('timeout' => self::$settings->getGlobalOption('connection_timeout'))));
736
- // Get file using file_get_contents
737
- $strResult = @file_get_contents($strURL, false, $strContext);
738
- // Error: Not possible to get remote file
739
- } else $strResult = serialize(array(
740
- 'result' => 'error',
741
- 'message' => 'Remote access to Piwik not possible. Enable allow_url_fopen or CURL.'
742
- ));
743
- // Return result
744
- return $strResult;
745
- }
746
-
747
- /**
748
- * Call PHP API
749
- *
750
- * @param $strParams API call params
751
- */
752
- function callPHP($strParams) {
753
- if (!defined('PIWIK_INCLUDE_PATH'))
754
- return;
755
- if (PIWIK_INCLUDE_PATH === FALSE)
756
- return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' &quot;'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'&quot;: '.__('realpath() returns false','wp-piwik').'.'));
757
- if (file_exists(PIWIK_INCLUDE_PATH . "/index.php"))
758
- require_once PIWIK_INCLUDE_PATH . "/index.php";
759
- if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php"))
760
- require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
761
- if (class_exists('Piwik\FrontController'))
762
- Piwik\FrontController::getInstance()->init();
763
- else serialize(array('result' => 'error', 'message' => __('Class Piwik\FrontController does not exists.','wp-piwik')));
764
- if (class_exists('Piwik\API\Request'))
765
- $objRequest = new Piwik\API\Request($strParams);
766
- else serialize(array('result' => 'error', 'message' => __('Class Piwik\API\Request does not exists.','wp-piwik')));
767
- $result = $objRequest->process();
768
- if (!headers_sent()) {
769
- header("Content-Type: text/html", true);
770
- }
771
- return $result;
772
- }
773
-
774
- /**
775
- * Get remote file
776
- *
777
- * @param String $strURL Remote file URL
778
- */
779
- function getRemoteFile($strURL, $blogURL = '') {
780
- if (self::$settings->getGlobalOption('piwik_mode') == 'php')
781
- return $this->callPHP($strURL.($blogURL?'&url='.$blogURL:''));
782
- else
783
- return $this->callREST($strURL.($blogURL?'&url='.urlencode($blogURL):''));
784
- }
785
-
786
- /**
787
- * Add a new site to Piwik if a new blog was requested,
788
- * or get its ID by URL
789
- */
790
- function addPiwikSite() {
791
- if (isset($_GET['wpmu_show_stats']) && self::$settings->checkNetworkActivation()) {
792
- self::$logger->log('Switch blog ID: '.(int) $_GET['wpmu_show_stats']);
793
- switch_to_blog((int) $_GET['wpmu_show_stats']);
794
- }
795
- self::$logger->log('Get the blog\'s site ID by URL: '.get_bloginfo('url'));
796
- // Check if blog URL already known
797
- $strURL = '&method=SitesManager.getSitesIdFromSiteUrl';
798
- $strURL .= '&format=PHP';
799
- $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token');
800
- $aryResult = unserialize($this->getRemoteFile($strURL, get_bloginfo('url')));
801
- if (!empty($aryResult) && isset($aryResult[0]['idsite'])) {
802
- self::$settings->setOption('site_id', (int) $aryResult[0]['idsite']);
803
- // Otherwise create new site
804
- } elseif (self::isConfigured() && !empty($strURL)) {
805
- self::$logger->log('Blog not known yet - create new site');
806
- $strName = get_bloginfo('name');
807
- if (empty($strName)) $strName = get_bloginfo('url');
808
- self::$settings->setOption('name', $strName);
809
- $strURL .= '&method=SitesManager.addSite';
810
- $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode(get_bloginfo('url'));
811
- $strURL .= '&format=PHP';
812
- $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token');
813
- $strResult = unserialize($this->getRemoteFile($strURL, get_bloginfo('url')));
814
- if (!empty($strResult)) self::$settings->setOption('site_id', (int) $strResult);
815
- }
816
- // Store new data if site created
817
- if (self::$settings->getOption('site_id')) {
818
- self::$logger->log('Get the site\'s tracking code');
819
- self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
820
- } else self::$settings->getOption('tracking_code', '');
821
- self::$settings->save();
822
- if (isset($_GET['wpmu_show_stats']) && self::$settings->checkNetworkActivation()) {
823
- self::$logger->log('Back to current blog');
824
- restore_current_blog();
825
- }
826
- return array('js' => self::$settings->getOption('tracking_code'), 'id' => self::$settings->getOption('site_id'));
827
- }
828
-
829
- /**
830
- * Update a site
831
- */
832
- function updatePiwikSite() {
833
- $strBlogURL = get_bloginfo('url');
834
- // Check if blog URL already known
835
- $strName = get_bloginfo('name');
836
- if (empty($strName)) $strName = $strBlogURL;
837
- self::$settings->setOption('name', $strName);
838
- $strURL = '&method=SitesManager.updateSite';
839
- $strURL .= '&idSite='.self::$settings->getOption('site_id');
840
- $strURL .= '&siteName='.urlencode($strName).'&urls='.urlencode($strBlogURL);
841
- $strURL .= '&format=PHP';
842
- $strURL .= '&token_auth='.self::$settings->getGlobalOption('piwik_token');
843
- $strResult = unserialize($this->getRemoteFile($strURL));
844
- // Store new data
845
- self::$settings->getOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
846
- self::$settings->save();
847
- }
848
-
849
- /**
850
- * Apply configured Tracking Code changes
851
- */
852
- function applyJSCodeChanges($strCode) {
853
- self::$logger->log('Apply tracking code changes.');
854
- self::$settings->setOption('last_tracking_code_update', time());
855
- $strCode = html_entity_decode($strCode);
856
- // Change code if js/index.php should be used
857
- if (self::$settings->getGlobalOption('track_mode') == 1) {
858
- $strCode = str_replace('piwik.js', 'js/index.php', $strCode);
859
- $strCode = str_replace('piwik.php', 'js/index.php', $strCode);
860
- } elseif (self::$settings->getGlobalOption('track_mode') == 2) {
861
- $strCode = str_replace('piwik.js', 'piwik.php', $strCode);
862
- $strURL = str_replace('https://', '//', self::$settings->getGlobalOption('piwik_url'));
863
- $strURL = str_replace('http://', '//', $strURL);
864
- $strProxy = str_replace('https://', '//', plugins_url('wp-piwik').'/proxy');
865
- $strProxy = str_replace('http://', '//', $strProxy);
866
- $strProxy .= '/';
867
- $strCode = str_replace($strURL, $strProxy, $strCode);
868
- }
869
- $strCode = str_replace('//";','/"',$strCode);
870
- if (self::$settings->getGlobalOption('force_protocol')) {
871
- $strCode = str_replace('"//', '"'.self::$settings->getGlobalOption('force_protocol').'://',$strCode);
872
- }
873
- if (self::$settings->getGlobalOption('track_cdnurl')||self::$settings->getGlobalOption('track_cdnurlssl')) {
874
- $strCode = str_replace("var d=doc", "var ucdn=(('https:' == document.location.protocol) ? 'https://".(self::$settings->getGlobalOption('track_cdnurlssl')?self::$settings->getGlobalOption('track_cdnurlssl'):self::$settings->getGlobalOption('track_cdnurl'))."/' : 'http://".(self::$settings->getGlobalOption('track_cdnurl')?self::$settings->getGlobalOption('track_cdnurl'):self::$settings->getGlobalOption('track_cdnurlssl'))."/');\nvar d=doc", $strCode);
875
- $strCode = str_replace("g.src=u+", "g.src=ucdn+", $strCode);
876
- }
877
- // Change code if file extensions for download tracking are added
878
- if (self::$settings->getGlobalOption('add_download_extensions')) {
879
- $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['addDownloadExtensions', '".(self::$settings->getGlobalOption('add_download_extensions'))."']);\n_paq.push(['trackPageView']);", $strCode);
880
- }
881
- // Change code if POST is forced to be used
882
- if (self::$settings->getGlobalOption('track_post') && self::$settings->getGlobalOption('track_mode') != 2) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setRequestMethod', 'POST']);\n_paq.push(['trackPageView']);", $strCode);
883
- // Change code if cookies are disabled
884
- if (self::$settings->getGlobalOption('disable_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['disableCookies']);\n_paq.push(['trackPageView']);", $strCode);
885
- if (self::$settings->getGlobalOption('limit_cookies')) $strCode = str_replace("_paq.push(['trackPageView']);", "_paq.push(['setVisitorCookieTimeout', '".self::$settings->getGlobalOption('limit_cookies_visitor')."']);\n_paq.push(['setSessionCookieTimeout', '".self::$settings->getGlobalOption('limit_cookies_session')."']);\n_paq.push(['trackPageView']);", $strCode);
886
- // Store <noscript> code
887
- $aryNoscript = array();
888
- preg_match('/<noscript>(.*)<\/noscript>/', $strCode, $aryNoscript);
889
- if (isset($aryNoscript[0])) {
890
- if (self::$settings->getGlobalOption('track_nojavascript'))
891
- $aryNoscript[0] = str_replace('?idsite', '?rec=1&idsite', $aryNoscript[0]);
892
- self::$settings->setOption('noscript_code', $aryNoscript[0]);
893
- }
894
- if (self::$settings->getGlobalOption('track_datacfasync'))
895
- $strCode = str_replace('<script type', '<script data-cfasync="false" type', $strCode);
896
- // Remove <noscript> code
897
- $strCode = preg_replace('/<noscript>(.*)<\/noscript>/', '', $strCode);
898
- // Return code without empty lines
899
- return preg_replace('/\s+(\r\n|\r|\n)/', '$1', $strCode);
900
- }
901
-
902
- /**
903
- * Create a WordPress dashboard widget
904
- */
905
- function createDashboardWidget($objPost, $aryMetabox) {
906
- // Create description and ID
907
- $strDesc = $strID = '';
908
- $aryConfig = $aryMetabox['args']['aryConfig'];
909
- foreach ($aryConfig['params'] as $strParam)
910
- if (!empty($strParam)) {
911
- $strDesc .= $strParam.', ';
912
- $strID .= '_'.$strParam;
913
- }
914
- // Remove dots from filename
915
- $strFile = str_replace('.', '', $aryMetabox['args']['strFile']);
916
- // Finalize configuration
917
- $aryConf = array_merge($aryConfig, array(
918
- 'id' => $strFile.$strID,
919
- 'desc' => substr($strDesc, 0, -2)));
920
- // Include widget file
921
- if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'dashboard/'.$strFile.'.php'))
922
- include(dirname(__FILE__).DIRECTORY_SEPARATOR.'dashboard/'.$strFile.'.php');
923
- }
924
-
925
- /**
926
- * Call Piwik's API
927
- */
928
- function callPiwikAPI($strMethod, $strPeriod='', $strDate='', $intLimit='',$bolExpanded=false, $intId = false, $strFormat = 'PHP', $strPageURL = '', $useCache = true, $strNote = '') {
929
- // Create unique cache key
930
- $strKey = 'wp-piwik_'.md5($strMethod.'_'.$strPeriod.'_'.$strDate.'_'.$intLimit.'_'.self::$settings->getGlobalOption('piwik_token').'_'.self::$settings->getGlobalOption('piwik_url').'_'.$intId.'_'.$strPageURL);
931
- // Call API if data not cached
932
- if (self::$settings->getGlobalOption('cache') && $useCache) {
933
- $result = get_transient($strKey);
934
- self::$logger->log('API method: '.$strMethod.' Fetch call from cache: '.$strKey);
935
- } else $result = false;
936
- if ($strMethod == "SitesManager.getSitesWithAtLeastViewAccess" || false === $result) {
937
- $strToken = self::$settings->getGlobalOption('piwik_token');
938
- // If multisite stats are shown, maybe the super admin wants to show other blog's stats.
939
- if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && function_exists('wp_get_current_user') && is_super_admin() && isset($_GET['wpmu_show_stats'])) {
940
- $aryOptions = get_blog_option((int) $_GET['wpmu_show_stats'], 'wp-piwik_settings' , array());
941
- if (!empty($aryOptions) && isset($aryOptions['site_id']))
942
- $intSite = $aryOptions['site_id'];
943
- else $intSite = self::$settings->getOption('site_id');
944
- // Otherwise use the current site's id.
945
- } else {
946
- if (!self::$settings->getOption('site_id'))
947
- self::addPiwikSite();
948
- $intSite = self::$settings->getOption('site_id');
949
- }
950
- //die($intSite);
951
- // Create error message if WP-Piwik isn't configured
952
- if (!self::isConfigured()) {
953
- $result = array(
954
- 'result' => 'error',
955
- 'message' => 'Piwik URL/path or auth token not set.'
956
- );
957
- return $result;
958
- }
959
- // Build URL
960
- $strURL = '&method='.$strMethod;
961
- $strURL .= '&idSite='.(int)$intSite.'&period='.$strPeriod.'&date='.$strDate;
962
- $strURL .= '&filter_limit='.$intLimit;
963
- $strURL .= '&token_auth='.$strToken;
964
- $strURL .= '&expanded='.$bolExpanded;
965
- $strURL .= '&format='.$strFormat;
966
- $strURL .= ($strPageURL?'&pageUrl='.urlencode($strPageURL):'');
967
- $strURL .= ($strNote?'&note='.urlencode($strNote):'');
968
- if (self::$settings->getGlobalOption('track_across') && $strMethod == 'SitesManager.getJavascriptTag') {
969
- $strURL .= '&mergeSubdomains=1';
970
- }
971
- if (self::$settings->getGlobalOption('track_across_alias') && $strMethod == 'SitesManager.getJavascriptTag') {
972
- $strURL .= '&mergeAliasUrls=1';
973
- }
974
- // Fetch data if site exists
975
- if (!empty($intSite) || $strMethod=='SitesManager.getSitesWithAtLeastViewAccess') {
976
- self::$logger->log('API method: '.$strMethod.' API call: '.$strURL);
977
- $strResult = (string) $this->getRemoteFile($strURL, get_bloginfo('url'));
978
- $result = ($strFormat == 'PHP'?unserialize($strResult):$strResult);
979
- // Apply tracking code changes if configured
980
- if ($strMethod == 'SitesManager.getJavascriptTag' && !empty($result)) {
981
- $result = is_string($result)?$this->applyJSCodeChanges($result):'<!-- WP-Piwik ERROR: Tracking code not availbale -->'."\n";
982
- }
983
- // Otherwise return error message
984
- } else $result = array('result' => 'error', 'message' => 'Unknown site/blog.');
985
- if (
986
- $strMethod != 'SitesManager.getJavascriptTag' &&
987
- $strDate != 'today' && $strDate != date('Ymd') && substr($strDate, 0, 4) != 'last' &&
988
- self::$settings->getGlobalOption('cache') &&
989
- !(isset($result['result']) && $result['result'] == 'error')&&
990
- !empty($result)
991
- ) set_transient($strKey, $result, WEEK_IN_SECONDS);
992
- }
993
- return $result;
994
- }
995
-
996
- /* TODO: Add post stats
997
- * function display_post_unique_column($aryCols) {
998
- * $aryCols['wp-piwik_unique'] = __('Unique');
999
- * return $aryCols;
1000
- * }
1001
- *
1002
- * function display_post_unique_content($strCol, $intID) {
1003
- * if( $strCol == 'wp-piwik_unique' ) {
1004
- * }
1005
- * }
1006
- */
1007
-
1008
- function onloadStatsPage() {
1009
- wp_enqueue_script('common');
1010
- wp_enqueue_script('wp-lists');
1011
- wp_enqueue_script('postbox');
1012
- $strToken = self::$settings->getGlobalOption('piwik_token');
1013
- $strPiwikURL = self::$settings->getGlobalOption('piwik_url');
1014
- $aryDashboard = array();
1015
- // Set default configuration
1016
- $arySortOrder = array(
1017
- 'side' => array(
1018
- 'overview' => array(__('Overview', 'wp-piwik'), 'day', 'yesterday'),
1019
- 'seo' => array(__('SEO', 'wp-piwik'), 'day', 'yesterday'),
1020
- 'pages' => array(__('Pages', 'wp-piwik'), 'day', 'yesterday'),
1021
- 'keywords' => array(__('Keywords', 'wp-piwik'), 'day', 'yesterday', 10),
1022
- 'websites' => array(__('Websites', 'wp-piwik'), 'day', 'yesterday', 10),
1023
- 'plugins' => array(__('Plugins', 'wp-piwik'), 'day', 'yesterday'),
1024
- 'search' => array(__('Site Search Keywords', 'wp-piwik'), 'day', 'yesterday', 10),
1025
- 'noresult' => array(__('Site Search without Results', 'wp-piwik'), 'day', 'yesterday', 10),
1026
- ),
1027
- 'normal' => array(
1028
- 'visitors' => array(__('Visitors', 'wp-piwik'), 'day', 'last30'),
1029
- 'browsers' => array(__('Browser', 'wp-piwik'), 'day', 'yesterday'),
1030
- 'browserdetails' => array(__('Browser Details', 'wp-piwik'), 'day', 'yesterday'),
1031
- 'screens' => array(__('Resolution', 'wp-piwik'), 'day', 'yesterday'),
1032
- 'systems' => array(__('Operating System', 'wp-piwik'), 'day', 'yesterday')
1033
- )
1034
- );
1035
- // Don't show SEO stats if disabled
1036
- if (!self::$settings->getGlobalOption('stats_seo'))
1037
- unset($arySortOrder['side']['seo']);
1038
-
1039
- foreach ($arySortOrder as $strCol => $aryWidgets) {
1040
- if (is_array($aryWidgets)) foreach ($aryWidgets as $strFile => $aryParams) {
1041
- $aryDashboard[$strCol][$strFile] = array(
1042
- 'params' => array(
1043
- 'title' => (isset($aryParams[0])?$aryParams[0]:$strFile),
1044
- 'period' => (isset($aryParams[1])?$aryParams[1]:''),
1045
- 'date' => (isset($aryParams[2])?$aryParams[2]:''),
1046
- 'limit' => (isset($aryParams[3])?$aryParams[3]:'')
1047
- )
1048
- );
1049
- if (isset($_GET['date']) && preg_match('/^[0-9]{8}$/', $_GET['date']) && $strFile != 'visitors')
1050
- $aryDashboard[$strCol][$strFile]['params']['date'] = $_GET['date'];
1051
- elseif ($strFile != 'visitors')
1052
- $aryDashboard[$strCol][$strFile]['params']['date'] = self::$settings->getGlobalOption('default_date');
1053
- }
1054
- }
1055
- $intSideBoxCnt = $intContentBox = 0;
1056
- foreach ($aryDashboard['side'] as $strFile => $aryConfig) {
1057
- $intSideBoxCnt++;
1058
- if (preg_match('/(\d{4})(\d{2})(\d{2})/', $aryConfig['params']['date'], $aryResult))
1059
- $strDate = $aryResult[1]."-".$aryResult[2]."-".$aryResult[3];
1060
- else $strDate = $aryConfig['params']['date'];
1061
- add_meta_box(
1062
- 'wp-piwik_stats-sidebox-'.$intSideBoxCnt,
1063
- $aryConfig['params']['title'].' '.($aryConfig['params']['title']!='SEO'?__($strDate, 'wp-piwik'):''),
1064
- array(&$this, 'createDashboardWidget'),
1065
- $this->intStatsPage,
1066
- 'side',
1067
- 'core',
1068
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
1069
- );
1070
- }
1071
- foreach ($aryDashboard['normal'] as $strFile => $aryConfig) {
1072
- if (preg_match('/(\d{4})(\d{2})(\d{2})/', $aryConfig['params']['date'], $aryResult))
1073
- $strDate = $aryResult[1]."-".$aryResult[2]."-".$aryResult[3];
1074
- else $strDate = $aryConfig['params']['date'];
1075
- $intContentBox++;
1076
- add_meta_box(
1077
- 'wp-piwik_stats-contentbox-'.$intContentBox,
1078
- $aryConfig['params']['title'].' '.($aryConfig['params']['title']!='SEO'?__($strDate, 'wp-piwik'):''),
1079
- array(&$this, 'createDashboardWidget'),
1080
- $this->intStatsPage,
1081
- 'normal',
1082
- 'core',
1083
- array('strFile' => $strFile, 'aryConfig' => $aryConfig)
1084
- );
1085
- }
1086
- }
1087
-
1088
- // Open stats page as network admin
1089
- function showStatsNetwork() {
1090
- $this->bolNetwork = true;
1091
- $this->showStats();
1092
- }
1093
-
1094
- function showStats() {
1095
- // Disabled time limit if required
1096
- if (self::$settings->getGlobalOption('disable_timelimit') && self::$settings->getGlobalOption('disable_timelimit'))
1097
- set_time_limit(0);
1098
- //we need the global screen column value to be able to have a sidebar in WordPress 2.8
1099
- global $screen_layout_columns;
1100
- if (empty($screen_layout_columns)) $screen_layout_columns = 2;
1101
- /***************************************************************************/ ?>
1102
- <div id="wp-piwik-stats-general" class="wrap">
1103
- <?php screen_icon('options-general'); ?>
1104
- <h2><?php echo (self::$settings->getGlobalOption('plugin_display_name') == 'WP-Piwik'?'Piwik '.__('Statistics', 'wp-piwik'):self::$settings->getGlobalOption('plugin_display_name')); ?></h2>
1105
- <?php /************************************************************************/
1106
- if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin() && $this->bolNetwork) {
1107
- if (isset($_GET['wpmu_show_stats'])) {
1108
- switch_to_blog((int) $_GET['wpmu_show_stats']);
1109
- // TODO OPTIMIZE
1110
- } else {
1111
- $this->includeFile('settings/sitebrowser');
1112
- return;
1113
- }
1114
- echo '<p>'.__('Currently shown stats:').' <a href="'.get_bloginfo('url').'">'.(int) $_GET['wpmu_show_stats'].' - '.get_bloginfo('name').'</a>.'.' <a href="?page=wp-piwik_stats">Show site overview</a>.</p>'."\n";
1115
- echo '</form>'."\n";
1116
- }
1117
- /***************************************************************************/ ?>
1118
- <form action="admin-post.php" method="post">
1119
- <?php wp_nonce_field('wp-piwik_stats-general'); ?>
1120
- <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
1121
- <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
1122
- <input type="hidden" name="action" value="save_wp-piwik_stats_general" />
1123
- <div id="dashboard-widgets" class="metabox-holder columns-<?php echo $screen_layout_columns; ?><?php echo 2 <= $screen_layout_columns?' has-right-sidebar':''; ?>">
1124
- <div id='postbox-container-1' class='postbox-container'>
1125
- <?php $meta_boxes = do_meta_boxes($this->intStatsPage, 'normal', null); ?>
1126
- </div>
1127
-
1128
- <div id='postbox-container-2' class='postbox-container'>
1129
- <?php do_meta_boxes($this->intStatsPage, 'side', null); ?>
1130
- </div>
1131
-
1132
- <div id='postbox-container-3' class='postbox-container'>
1133
- <?php do_meta_boxes($this->intStatsPage, 'column3', null); ?>
1134
- </div>
1135
-
1136
- </div>
1137
- </form>
1138
- </div>
1139
- <script type="text/javascript">
1140
- //<![CDATA[
1141
- jQuery(document).ready( function($) {
1142
- // close postboxes that should be closed
1143
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
1144
- // postboxes setup
1145
- postboxes.add_postbox_toggles('<?php echo $this->intStatsPage; ?>');
1146
- });
1147
- //]]>
1148
- </script>
1149
- <?php /************************************************************************/
1150
- if (self::$settings->checkNetworkActivation() && function_exists('is_super_admin') && is_super_admin()) {
1151
- restore_current_blog();
1152
- }
1153
- }
1154
-
1155
- /* Stats page changes by POST submit
1156
- seen in Heiko Rabe's metabox demo plugin
1157
- http://tinyurl.com/5r5vnzs */
1158
- function onStatsPageSaveChanges() {
1159
- //user permission check
1160
- if ( !current_user_can('manage_options') )
1161
- wp_die( __('Cheatin&#8217; uh?') );
1162
- //cross check the given referer
1163
- check_admin_referer('wp-piwik_stats');
1164
- //process here your on $_POST validation and / or option saving
1165
- //lets redirect the post request into get request (you may add additional params at the url, if you need to show save results
1166
- wp_redirect($_POST['_wp_http_referer']);
1167
- }
1168
-
1169
- /**
1170
- * Add tabs to settings page
1171
- * See http://wp.smashingmagazine.com/2011/10/20/create-tabs-wordpress-settings-pages/
1172
- */
1173
- function showSettingsTabs($bolFull = true, $strCurr = 'homepage') {
1174
- $aryTabs = ($bolFull?array(
1175
- 'homepage' => __('Home','wp-piwik'),
1176
- 'piwik' => __('Piwik Settings','wp-piwik'),
1177
- 'tracking' => __('Tracking','wp-piwik'),
1178
- 'views' => __('Statistics','wp-piwik'),
1179
- 'support' => __('Support','wp-piwik'),
1180
- 'credits' => __('Credits','wp-piwik')
1181
- ):array(
1182
- 'piwik' => __('Piwik Settings','wp-piwik'),
1183
- 'support' => __('Support','wp-piwik'),
1184
- 'credits' => __('Credits','wp-piwik')
1185
- ));
1186
- if (empty($strCurr)) $strCurr = 'homepage';
1187
- elseif (!isset($aryTabs[$strCurr]) && $strCurr != 'sitebrowser') $strCurr = 'piwik';
1188
- echo '<div id="icon-themes" class="icon32"><br></div>';
1189
- echo '<h2 class="nav-tab-wrapper">';
1190
- foreach($aryTabs as $strTab => $strName) {
1191
- $strClass = ($strTab == $strCurr?' nav-tab-active':'');
1192
- echo '<a class="nav-tab'.$strClass.'" href="?page=wp-piwik/wp-piwik.php&tab='.$strTab.'">'.$strName.'</a>';
1193
- }
1194
- echo '</h2>';
1195
- return $strCurr;
1196
- }
1197
-
1198
- /**
1199
- * Apply & store new settings
1200
- */
1201
- function applySettings() {
1202
- $strTab = (isset($_GET['tab'])?$_GET['tab']:'homepage');
1203
- self::$logger->log('Apply changes: '.$strTab);
1204
- switch ($strTab) {
1205
- case 'views':
1206
- self::$settings->setGlobalOption('plugin_display_name', (!empty($_POST['wp-piwik_displayname'])?htmlentities($_POST['wp-piwik_displayname']):'WP-Piwk'));
1207
- self::$settings->setGlobalOption('dashboard_widget',(isset($_POST['wp-piwik_dbwidget'])?$_POST['wp-piwik_dbwidget']:0));
1208
- self::$settings->setGlobalOption('dashboard_chart',(isset($_POST['wp-piwik_dbchart'])?$_POST['wp-piwik_dbchart']:false));
1209
- self::$settings->setGlobalOption('dashboard_seo',(isset($_POST['wp-piwik_dbseo'])?$_POST['wp-piwik_dbseo']:false));
1210
- self::$settings->setGlobalOption('stats_seo',(isset($_POST['wp-piwik_statsseo'])?$_POST['wp-piwik_statsseo']:false));
1211
- self::$settings->setGlobalOption('piwik_shortcut', (isset($_POST['wp-piwik_piwiklink'])?$_POST['wp-piwik_piwiklink']:false));
1212
- self::$settings->setGlobalOption('default_date', (isset($_POST['wp-piwik_default_date'])?$_POST['wp-piwik_default_date']:'yesterday'));
1213
- self::$settings->setGlobalOption('capability_read_stats', (isset($_POST['wp-piwik_displayto'])?$_POST['wp-piwik_displayto']:array()));
1214
- self::$settings->setGlobalOption('disable_timelimit', (isset($_POST['wp-piwik_disabletimelimit'])?$_POST['wp-piwik_disabletimelimit']:false));
1215
- self::$settings->setGlobalOption('toolbar', (isset($_POST['wp-piwik_toolbar'])?$_POST['wp-piwik_toolbar']:false));
1216
- self::$settings->setGlobalOption('shortcodes', (isset($_POST['wp-piwik_shortcodes'])?$_POST['wp-piwik_shortcodes']:false));
1217
- self::$settings->setGlobalOption('perpost_stats', (isset($_POST['wp-piwik_perpost'])?$_POST['wp-piwik_perpost']:false));
1218
- break;
1219
- case 'tracking':
1220
- self::$settings->setGlobalOption('add_tracking_code', (isset($_POST['wp-piwik_addjs'])?$_POST['wp-piwik_addjs']:false));
1221
- self::$settings->setGlobalOption('track_404', (isset($_POST['wp-piwik_404'])?$_POST['wp-piwik_404']:false));
1222
- self::$settings->setGlobalOption('track_search', (isset($_POST['wp-piwik_search'])?$_POST['wp-piwik_search']:false));
1223
- self::$settings->setGlobalOption('track_mode', (isset($_POST['wp-piwik_trackingmode'])?(int)$_POST['wp-piwik_trackingmode']:0));
1224
- self::$settings->setGlobalOption('track_post', (isset($_POST['wp-piwik_reqpost'])?$_POST['wp-piwik_reqpost']:false));
1225
- self::$settings->setGlobalOption('track_proxy', (isset($_POST['wp-piwik_proxy'])?$_POST['wp-piwik_proxy']:false));
1226
- self::$settings->setGlobalOption('track_cdnurl', trim(isset($_POST['wp-piwik_cdnurl'])?$_POST['wp-piwik_cdnurl']:''));
1227
- self::$settings->setGlobalOption('track_cdnurlssl', trim(isset($_POST['wp-piwik_cdnurlssl'])?$_POST['wp-piwik_cdnurlssl']:self::$settings->getGlobalOption('track_cdnurl')));
1228
- self::$settings->setGlobalOption('track_noscript', (isset($_POST['wp-piwik_noscript'])?$_POST['wp-piwik_noscript']:false));
1229
- self::$settings->setGlobalOption('track_codeposition', (isset($_POST['wp-piwik_codeposition'])?$_POST['wp-piwik_codeposition']:'footer'));
1230
- self::$settings->setGlobalOption('track_nojavascript', (isset($_POST['wp-piwik_nojavascript'])?$_POST['wp-piwik_nojavascript']:false));
1231
- self::$settings->setGlobalOption('track_admin', (isset($_POST['wp-piwik_trackadmin'])?$_POST['wp-piwik_trackadmin']:false));
1232
- self::$settings->setGlobalOption('track_feed', (isset($_POST['wp-piwik_trackfeed'])?$_POST['wp-piwik_trackfeed']:false));
1233
- self::$settings->setGlobalOption('track_feed_goal', (isset($_POST['wp-piwik_trackfeed_goal'])&&!empty($_POST['wp-piwik_trackfeed_goal'])?(int)$_POST['wp-piwik_trackfeed_goal']:''));
1234
- self::$settings->setGlobalOption('track_feed_revenue', (isset($_POST['wp-piwik_trackfeed_revenue'])&&!empty($_POST['wp-piwik_trackfeed_revenue'])?(int)$_POST['wp-piwik_trackfeed_revenue']:''));
1235
- self::$settings->setGlobalOption('track_feed_campaign', (isset($_POST['wp-piwik_trackfeed_campaign'])?$_POST['wp-piwik_trackfeed_campaign']:'feed'));
1236
- self::$settings->setGlobalOption('track_feed_addcampaign', (isset($_POST['wp-piwik_trackfeed_addcampaign'])?$_POST['wp-piwik_trackfeed_addcampaign']:false));
1237
- self::$settings->setGlobalOption('track_datacfasync', (isset($_POST['wp-piwik_datacfasync'])?$_POST['wp-piwik_datacfasync']:false));
1238
- self::$settings->setGlobalOption('track_across', (isset($_POST['wp-piwik_track_across'])?$_POST['wp-piwik_track_across']:false));
1239
- self::$settings->setGlobalOption('track_across_alias', (isset($_POST['wp-piwik_track_across_alias'])?$_POST['wp-piwik_track_across_alias']:false));
1240
- self::$settings->setGlobalOption('add_post_annotations', (isset($_POST['wp-piwik_annotations'])?$_POST['wp-piwik_annotations']:false));
1241
- self::$settings->setGlobalOption('add_customvars_box', (isset($_POST['wp-piwik_customvars'])?$_POST['wp-piwik_customvars']:false));
1242
- self::$settings->setGlobalOption('capability_stealth', (isset($_POST['wp-piwik_filter'])?$_POST['wp-piwik_filter']:array()));
1243
- self::$settings->setGlobalOption('disable_cookies', (isset($_POST['wp-piwik_disable_cookies'])?$_POST['wp-piwik_disable_cookies']:false));
1244
- self::$settings->setGlobalOption('limit_cookies', (isset($_POST['wp-piwik_limit_cookies'])?$_POST['wp-piwik_limit_cookies']:false));
1245
- self::$settings->setGlobalOption('limit_cookies_visitor', (isset($_POST['wp-piwik_limit_cookies_visitor'])?(int)$_POST['wp-piwik_limit_cookies_visitor']:1209600));
1246
- self::$settings->setGlobalOption('limit_cookies_session', (isset($_POST['wp-piwik_limit_cookies_session'])?(int)$_POST['wp-piwik_limit_cookies_session']:0));
1247
- self::$settings->setGlobalOption('add_download_extensions', (isset($_POST['wp-piwik_add_download_extensions'])?trim($_POST['wp-piwik_add_download_extensions']):''));
1248
- self::$settings->setGlobalOption('force_protocol', (isset($_POST['wp-piwik_force_protocol'])?trim($_POST['wp-piwik_force_protocol']):''));
1249
- self::$settings->setOption('tracking_code', $this->callPiwikAPI('SitesManager.getJavascriptTag'));
1250
- break;
1251
- case 'homepage':
1252
- case 'piwik':
1253
- self::$settings->setGlobalOption('piwik_token', (isset($_POST['wp-piwik_token'])?$_POST['wp-piwik_token']:''));
1254
- self::$settings->setGlobalOption('piwik_url', self::checkURL((isset($_POST['wp-piwik_url'])?$_POST['wp-piwik_url']:'')));
1255
- self::$settings->setGlobalOption('piwik_path', (isset($_POST['wp-piwik_path']) && !empty($_POST['wp-piwik_path'])?realpath($_POST['wp-piwik_path']):''));
1256
- self::$settings->setGlobalOption('cache', (isset($_POST['wp-piwik_cache'])?$_POST['wp-piwik_cache']:false));
1257
- self::$settings->setGlobalOption('piwik_mode', (isset($_POST['wp-piwik_mode'])?$_POST['wp-piwik_mode']:'http'));
1258
- self::$settings->setGlobalOption('piwik_useragent', (isset($_POST['wp-piwik_useragent'])?$_POST['wp-piwik_useragent']:'php'));
1259
- self::$settings->setGlobalOption('connection_timeout', (isset($_POST['wp-piwik_timeout'])?(int)$_POST['wp-piwik_timeout']:5));
1260
- self::$settings->setGlobalOption('piwik_useragent_string', (isset($_POST['wp-piwik_useragent_string'])?$_POST['wp-piwik_useragent_string']:'WP-Piwik'));
1261
- self::$settings->setGlobalOption('disable_ssl_verify', (isset($_POST['wp-piwik_disable_ssl_verify'])?$_POST['wp-piwik_disable_ssl_verify']:false));
1262
- if (!self::$settings->checkNetworkActivation()) {
1263
- self::$settings->setGlobalOption('auto_site_config', (isset($_POST['wp-piwik_auto_site_config'])?$_POST['wp-piwik_auto_site_config']:false));
1264
- if (!self::$settings->getGlobalOption('auto_site_config'))
1265
- self::$settings->setOption('site_id', (isset($_POST['wp-piwik_siteid'])?$_POST['wp-piwik_siteid']:self::$settings->getOption('site_id')));
1266
- } else self::$settings->setGlobalOption('auto_site_config', true);
1267
- break;
1268
- }
1269
- if (self::$settings->getGlobalOption('auto_site_config') && self::isConfigured()) {
1270
- if (self::$settings->getGlobalOption('piwik_mode') == 'php' && !defined('PIWIK_INCLUDE_PATH'))
1271
- self::definePiwikConstants();
1272
- $aryReturn = $this->addPiwikSite();
1273
- self::$settings->getOption('tracking_code', $aryReturn['js']);
1274
- self::$settings->getOption('site_id', $aryReturn['id']);
1275
- }
1276
- self::$settings->setGlobalOption('last_settings_update', time());
1277
- }
1278
-
1279
- /**
1280
- * Check & prepare URL
1281
- */
1282
- static function checkURL($strURL) {
1283
- if (empty($strURL)) return '';
1284
- if (substr($strURL, -1, 1) != '/' && substr($strURL, -10, 10) != '/index.php')
1285
- $strURL .= '/';
1286
- return $strURL;
1287
- }
1288
-
1289
- /**
1290
- * Show settings page
1291
- */
1292
- function showSettings() {
1293
- // Define globals and get request vars
1294
- global $pagenow;
1295
- $strTab = (isset($_GET['tab'])?$_GET['tab']:'homepage');
1296
- // Show update message if stats saved
1297
- if (isset($_POST['wp-piwik_settings_submit']) && $_POST['wp-piwik_settings_submit'] == 'Y')
1298
- echo '<div id="message" class="updated fade"><p>'.__('Changes saved','wp-piwik').'</p></div>';
1299
- // Show settings page title
1300
- echo '<div class="wrap"><h2>'.self::$settings->getGlobalOption('plugin_display_name').' '.__('Settings', 'wp-piwik').'</h2>';
1301
- // Show tabs
1302
- $strTab = $this->showSettingsTabs(self::isConfigured(), $strTab);
1303
- if ($strTab != 'sitebrowser') {
1304
- /***************************************************************************/ ?>
1305
- <div class="wp-piwik-donate">
1306
- <p><strong><?php _e('Donate','wp-piwik'); ?></strong></p>
1307
- <p><?php _e('If you like WP-Piwik, you can support its development by a donation:', 'wp-piwik'); ?></p>
1308
- <script type="text/javascript">
1309
- /* <![CDATA[ */
1310
- window.onload = function() {
1311
- FlattrLoader.render({
1312
- 'uid': 'flattr',
1313
- 'url': 'http://wp.local',
1314
- 'title': 'Title of the thing',
1315
- 'description': 'Description of the thing'
1316
- }, 'element_id', 'replace');
1317
- }
1318
- /* ]]> */
1319
- </script>
1320
- <div>
1321
- <a class="FlattrButton" style="display:none;" title="WordPress Plugin WP-Piwik" rel="flattr;uid:braekling;category:software;tags:wordpress,piwik,plugin,statistics;" href="https://www.braekling.de/wp-piwik-wpmu-piwik-wordpress">This WordPress plugin adds a Piwik stats site to your WordPress dashboard. It's also able to add the Piwik tracking code to your blog using wp_footer. You need a running Piwik installation and at least view access to your stats.</a>
1322
- </div>
1323
- <div>Paypal
1324
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1325
- <input type="hidden" name="cmd" value="_s-xclick" />
1326
- <input type="hidden" name="hosted_button_id" value="6046779" />
1327
- <input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." />
1328
- <img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1" />
1329
- </form>
1330
- </div>
1331
- <div>
1332
- <a href="bitcoin:3N8od4UQA3jDpP5KodkxSqENaRSMWEaTHp">Bitcoin<br />
1333
- <img style="border:none;" src="<?php echo $this->getPluginURL(); ?>bitcoin.png" width="100" height="100" alt="Bitcoin Address" title="3N8od4UQA3jDpP5KodkxSqENaRSMWEaTHp" /></a>
1334
- </div>
1335
- <div>
1336
- <a href="http://www.amazon.de/gp/registry/wishlist/111VUJT4HP1RA?reveal=unpurchased&amp;filter=all&amp;sort=priority&amp;layout=standard&amp;x=12&amp;y=14"><?php _e('My Amazon.de wishlist', 'wp-piwik'); ?></a>
1337
- </div>
1338
- <div>
1339
- <?php _e('Please don\'t forget to vote the compatibility at the','wp-piwik'); ?> <a href="http://wordpress.org/extend/plugins/wp-piwik/">WordPress.org Plugin Directory</a>.
1340
- </div>
1341
- </div>
1342
- <?php /***************************************************************************/
1343
- }
1344
- echo '<form class="'.($strTab != 'sitebrowser'?'wp-piwik-settings':'').'" method="post">';
1345
- echo '<input type="hidden" name="action" value="save_wp-piwik_settings" />';
1346
- wp_nonce_field('wp-piwik_settings');
1347
- // Show settings
1348
- if (($pagenow == 'options-general.php' || $pagenow == 'settings.php') && $_GET['page'] == 'wp-piwik/wp-piwik.php') {
1349
- echo '<table class="wp-piwik-form-table form-table">';
1350
- // Get tab contents
1351
- require_once('settings/'.$strTab.'.php');
1352
- // Show submit button
1353
- if (!in_array($strTab, array('homepage','credits','support','sitebrowser')))
1354
- echo '<tr><td><p class="submit" style="clear: both;padding:0;margin:0"><input type="submit" name="Submit" class="button-primary" value="'.__('Save settings', 'wp-piwik').'" /><input type="hidden" name="wp-piwik_settings_submit" value="Y" /></p></td></tr>';
1355
- echo '</table>';
1356
- }
1357
- // Close form
1358
- echo '</form></div>';
1359
- }
1360
-
1361
- /**
1362
- * Check if SSL is used
1363
- */
1364
- private static function isSSL() {
1365
- return (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off');
1366
- }
1367
-
1368
- /**
1369
- * Show an error message extended by a support site link
1370
- */
1371
- private static function showErrorMessage($strMessage) {
1372
- echo '<strong class="wp-piwik-error">'.__('An error occured', 'wp-piwik').':</strong> '.$strMessage.' [<a href="'.(self::$settings->checkNetworkActivation()?'network/settings':'options-general').'.php?page=wp-piwik/wp-piwik.php&tab=support">'.__('Support','wp-piwik').'</a>]';
1373
- }
1374
-
1375
- /**
1376
- * Read a RSS feed
1377
- */
1378
- private static function readRSSFeed($strFeedURL, $intCount = 5) {
1379
- $aryResult = array();
1380
- if (function_exists('simplexml_load_file') && !empty($strFeedURL)) {
1381
- $objXML = @simplexml_load_file($strFeedURL);
1382
- if (empty($strFeedURL) || !$objXML || !isset($objXML->channel[0]->item))
1383
- return array(array('title' => 'Can\'t read RSS feed.','url' => $strFeedURL));
1384
- foreach($objXML->channel[0]->item as $objItem) {
1385
- if( $intCount-- == 0 ) break;
1386
- $aryResult[] = array('title' => $objItem->title[0], 'url' => $objItem->link[0]);
1387
- }
1388
- }
1389
- return $aryResult;
1390
- }
1391
-
1392
- /**
1393
- * Execute test script
1394
- */
1395
- private static function loadTestscript() {
1396
- require_once('debug/testscript.php');
1397
- }
1398
-
1399
- /**
1400
- * Get a blog's piwik ID
1401
- */
1402
- public static function getSiteID($intBlogID = null) {
1403
- $intResult = self::$settings->getOption('site_id');
1404
- if (self::$settings->checkNetworkActivation() && !empty($intBlogID)) {
1405
- $aryResult = get_blog_option($intBlogID, 'wp-piwik_settings');
1406
- $intResult = $aryResult['site_id'];
1407
- }
1408
- return (is_int($intResult)?$intResult:'n/a');
1409
- }
1410
-
1411
- public static function isConfigured() {
1412
- return (
1413
- self::$settings->getGlobalOption('piwik_token')
1414
- && (
1415
- (
1416
- (self::$settings->getGlobalOption('piwik_mode') == 'http') && (self::$settings->getGlobalOption('piwik_url'))
1417
- ) || (
1418
- (self::$settings->getGlobalOption('piwik_mode') == 'php') && (self::$settings->getGlobalOption('piwik_path'))
1419
- )
1420
- )
1421
- );
1422
- }
1423
-
1424
- private function isUpdated() {
1425
- return self::$settings->getGlobalOption('revision') && self::$settings->getGlobalOption('revision') < self::$intRevisionId;
1426
- }
1427
-
1428
- private function isConfigSubmitted() {
1429
- return isset($_POST['action']) && $_POST['action'] == 'save_wp-piwik_settings';
1430
- }
1431
-
1432
- private function isPHPMode() {
1433
- return self::$settings->getGlobalOption('piwik_mode') && self::$settings->getGlobalOption('piwik_mode') == 'php';
1434
- }
1435
-
1436
- private function isNetworkMode() {
1437
- return self::$settings->checkNetworkActivation();
1438
- }
1439
-
1440
- private function isDashboardActive() {
1441
- return self::$settings->getGlobalOption('dashboard_widget') || self::$settings->getGlobalOption('dashboard_chart') || self::$settings->getGlobalOption('dashboard_seo');
1442
- }
1443
-
1444
- private function isToolbarActive() {
1445
- return self::$settings->getGlobalOption('toolbar');
1446
- }
1447
-
1448
- private function isTrackingActive() {
1449
- return self::$settings->getGlobalOption('add_tracking_code');
1450
- }
1451
-
1452
- private function isAdminTrackingActive() {
1453
- return self::$settings->getGlobalOption('track_admin');
1454
- }
1455
-
1456
- private function isAddNoScriptCode() {
1457
- return self::$settings->getGlobalOption('track_noscript');
1458
- }
1459
-
1460
- private function isTrackFeed() {
1461
- return self::$settings->getGlobalOption('track_feed');
1462
- }
1463
-
1464
- private function isAddFeedCampaign() {
1465
- return self::$settings->getGlobalOption('track_feed_addcampaign');
1466
- }
1467
-
1468
- private function isAddShortcode() {
1469
- return self::$settings->getGlobalOption('shortcodes');
1470
- }
1471
-
1472
- private static function definePiwikConstants() {
1473
- if (!defined('PIWIK_INCLUDE_PATH')) {
1474
- define('PIWIK_INCLUDE_PATH', self::$settings->getGlobalOption('piwik_path'));
1475
- define('PIWIK_USER_PATH', self::$settings->getGlobalOption('piwik_path'));
1476
- define('PIWIK_ENABLE_DISPATCH', false);
1477
- define('PIWIK_ENABLE_ERROR_HANDLER', false);
1478
- define('PIWIK_ENABLE_SESSION_START', false);
1479
- }
1480
- }
1481
-
1482
- private function openLogger() {
1483
- switch (WP_PIWIK_ACTIVATE_LOGGER) {
1484
- case 2:
1485
- require_once('classes/WP_Piwik_Logger_File.php');
1486
- self::$logger = new WP_Piwik_Logger_File(__CLASS__);
1487
- break;
1488
- default:
1489
- require_once('classes/WP_Piwik_Logger_Dummy.php');
1490
- self::$logger = new WP_Piwik_Logger_Dummy(__CLASS__);
1491
- }
1492
- }
1493
-
1494
- private function closeLogger() {
1495
- self::$logger = null;
1496
- }
1497
-
1498
- private function openSettings() {
1499
- $this->includeFile('classes/WP_Piwik_Settings');
1500
- self::$settings = new WP_Piwik_Settings(self::$logger);
1501
- }
1502
-
1503
- private function subClassConfig() {
1504
- return array(
1505
- 'wp_piwik' => $this,
1506
- 'logger' => self::$logger,
1507
- 'settings' => self::$settings
1508
- );
1509
- }
1510
-
1511
- private function includeFile($strFile) {
1512
- self::$logger->log('Include '.$strFile.'.php');
1513
- if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.$strFile.'.php'))
1514
- include(dirname(__FILE__).DIRECTORY_SEPARATOR.$strFile.'.php');
1515
- }
1516
-
1517
- private function isHiddenUser() {
1518
- if (is_multisite())
1519
- foreach (self::$settings->getGlobalOption('capability_stealth') as $key => $val)
1520
- if ($val && current_user_can($key)) return true;
1521
- return current_user_can('wp-piwik_stealth');
1522
- }
1523
-
1524
- private function isCurrentTrackingCode() {
1525
- return (self::$settings->getOption('last_tracking_code_update') < self::$settings->getGlobalOption('last_settings_update'));
1526
- }
1527
-
1528
- function site_header() {
1529
- self::$logger->log('Using deprecated function site_header');
1530
- $this->addJavascriptCode();
1531
- }
1532
-
1533
- function site_footer() {
1534
- self::$logger->log('Using deprecated function site_footer');
1535
- $this->addNoscriptCode();
1536
- }
1537
-
1538
- public function onPostStatusTransition($newStatus, $oldStatus, $post) {
1539
- if ($newStatus == 'publish' && $oldStatus != 'publish' ) {
1540
- add_action('publish_post', array($this, 'addPiwikAnnotation'));
1541
- }
1542
- }
1543
-
1544
- }
1545
- }
1546
-
1547
- require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.php');
1548
-
1549
- if (class_exists('wp_piwik'))
1550
- $GLOBALS['wp_piwik'] = new wp_piwik();
1551
-
1552
- /* EOF */
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-Piwik
4
+
5
+ Plugin URI: http://wordpress.org/extend/plugins/wp-piwik/
6
+
7
+ Description: Adds Piwik stats to your dashboard menu and Piwik code to your wordpress header.
8
+
9
+ Version: 0.10.0.3
10
+ Author: Andr&eacute; Br&auml;kling
11
+ Author URI: http://www.braekling.de
12
+ Text Domain: wp-piwik
13
+ Domain Path: /languages/
14
+ License: GPL3
15
+
16
+ ******************************************************************************************
17
+ Copyright (C) 2009-2015 Andre Braekling (email: webmaster@braekling.de)
18
+
19
+ This program is free software: you can redistribute it and/or modify
20
+ it under the terms of the GNU General Public License as published by
21
+ the Free Software Foundation, either version 3 of the License, or
22
+ at your option) any later version.
23
+
24
+ This program is distributed in the hope that it will be useful,
25
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ GNU General Public License for more details.
28
+
29
+ You should have received a copy of the GNU General Public License
30
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
31
+ *******************************************************************************************/
32
+
33
+ if (! function_exists ( 'add_action' )) {
34
+ header ( 'Status: 403 Forbidden' );
35
+ header ( 'HTTP/1.1 403 Forbidden' );
36
+ exit ();
37
+ }
38
+
39
+ if (! defined ( 'NAMESPACE_SEPARATOR' ))
40
+ define ( 'NAMESPACE_SEPARATOR', '\\' );
41
+
42
+ /**
43
+ * Define WP-Piwik autoloader
44
+ *
45
+ * @param string $class
46
+ * class name
47
+ */
48
+ function wp_piwik_autoloader($class) {
49
+ if (substr ( $class, 0, 9 ) == 'WP_Piwik' . NAMESPACE_SEPARATOR) {
50
+ $class = str_replace ( '.', '', str_replace ( NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, substr ( $class, 9 ) ) );
51
+ require_once ('classes' . DIRECTORY_SEPARATOR . 'WP_Piwik' . DIRECTORY_SEPARATOR . $class . '.php');
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Show notice about outdated PHP version
57
+ */
58
+ function wp_piwik_phperror() {
59
+ echo '<div class="error"><p>';
60
+ printf ( __ ( 'WP-Piwik requires at least PHP 5.3. You are using the deprecated version %s. Please update PHP to use WP-Piwik.', 'wp-piwik' ), PHP_VERSION );
61
+ echo '</p></div>';
62
+ }
63
+
64
+ if (is_admin())
65
+ load_plugin_textdomain ( 'wp-piwik', false, 'wp-piwik' . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR );
66
+
67
+ if (version_compare ( PHP_VERSION, '5.3.0', '<' ))
68
+ add_action ( 'admin_notices', 'wp_piwik_phperror' );
69
+ else {
70
+ define ( 'WP_PIWIK_PATH', dirname ( __FILE__ ) . DIRECTORY_SEPARATOR );
71
+ require_once (WP_PIWIK_PATH . 'config.php');
72
+ require_once (WP_PIWIK_PATH . 'classes' . DIRECTORY_SEPARATOR . 'WP_Piwik.php');
73
+ spl_autoload_register ( 'wp_piwik_autoloader' );
74
+ $GLOBALS ['wp-piwik_debug'] = false;
75
+ if (class_exists ( 'WP_Piwik' ))
76
+ $GLOBALS ['wp-piwik'] = new WP_Piwik ();
77
+ }