Statify - Version 1.4.0

Version Description

/ 16.04.2014 = * WordPress 4.2 support * Plugin-wide code refactoring * Translations for English and Russian * GitHub Repository

Download this release

Release Info

Developer sergej.mueller
Plugin Icon 128x128 Statify
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.0 to 1.4.0

css/dashboard.css CHANGED
@@ -1,52 +1,56 @@
1
  /* @group Front page */
2
 
3
  #statify_chart {
4
- color: #aaa;
5
- height: 140px;
6
- margin: 0 -4px;
7
- text-align: center;
8
  }
9
  #statify_chart_data {
10
- display: none;
11
  }
12
 
13
  #statify_dashboard .inside {
14
- height: 1%;
15
- margin: 0;
16
- padding-bottom: 0;
17
- overflow: hidden;
18
- position: relative;
19
- white-space: nowrap;
20
  }
21
 
22
  #statify_dashboard .table {
23
- padding-bottom: 12px;
24
  }
25
  #statify_dashboard .table p.sub {
26
- color: #BBB;
27
- margin: 0 0 -4px;
28
  }
29
  #statify_dashboard .table div {
30
- overflow: hidden;
31
  }
32
 
33
  #statify_dashboard .table.referrer {
34
- float: left;
35
- width: 45%;
36
  }
37
  #statify_dashboard .table.target {
38
- float: right;
39
- width: 55%;
40
  }
41
 
42
  #statify_dashboard td {
43
- padding: 8px 0 0;
44
- line-height: 1.4em;
45
  }
46
  #statify_dashboard td.b {
47
- text-align: right;
48
- padding-right: 4px;
49
- color: #777;
 
 
 
 
50
  }
51
 
52
  /* @end group */
@@ -55,16 +59,16 @@
55
  /* @group Back stage */
56
 
57
  #statify_dashboard .dashboard-widget-control-form {
58
- padding: 0 0 18px;
59
  }
60
  #statify_dashboard .dashboard-widget-control-form select {
61
- width: 100px;
62
  }
63
 
64
  #statify_dashboard .meta-links {
65
- float: right;
66
- margin: 0;
67
- line-height: 28px;
68
  }
69
 
70
  /* @end group */
1
  /* @group Front page */
2
 
3
  #statify_chart {
4
+ color: #aaa;
5
+ height: 140px;
6
+ margin: 0 -4px;
7
+ text-align: center;
8
  }
9
  #statify_chart_data {
10
+ display: none;
11
  }
12
 
13
  #statify_dashboard .inside {
14
+ height: 1%;
15
+ margin: 0;
16
+ padding-bottom: 0;
17
+ overflow: hidden;
18
+ position: relative;
19
+ white-space: nowrap;
20
  }
21
 
22
  #statify_dashboard .table {
23
+ padding-bottom: 12px;
24
  }
25
  #statify_dashboard .table p.sub {
26
+ color: #BBB;
27
+ margin: 0 0 -4px;
28
  }
29
  #statify_dashboard .table div {
30
+ overflow: hidden;
31
  }
32
 
33
  #statify_dashboard .table.referrer {
34
+ float: left;
35
+ width: 45%;
36
  }
37
  #statify_dashboard .table.target {
38
+ float: right;
39
+ width: 55%;
40
  }
41
 
42
  #statify_dashboard td {
43
+ padding: 8px 0 0;
44
+ line-height: 1.4em;
45
  }
46
  #statify_dashboard td.b {
47
+ text-align: right;
48
+ padding-right: 4px;
49
+ color: #777;
50
+ }
51
+ #statify_dashboard label {
52
+ display: block;
53
+ margin-bottom: 1.1em !important;
54
  }
55
 
56
  /* @end group */
59
  /* @group Back stage */
60
 
61
  #statify_dashboard .dashboard-widget-control-form {
62
+ padding: 0 0 18px;
63
  }
64
  #statify_dashboard .dashboard-widget-control-form select {
65
+ width: 100px;
66
  }
67
 
68
  #statify_dashboard .meta-links {
69
+ float: right;
70
+ margin: 0;
71
+ line-height: 28px;
72
  }
73
 
74
  /* @end group */
css/dashboard.min.css CHANGED
@@ -1 +1 @@
1
- #statify_chart{color:#aaa;height:140px;text-align:center;margin:0 -4px}#statify_chart_data{display:none}#statify_dashboard .inside{height:1%;padding-bottom:0;overflow:hidden;position:relative;white-space:nowrap;margin:0}#statify_dashboard .table{padding-bottom:12px}#statify_dashboard .table p.sub{color:#BBB;margin:0 0 -4px}#statify_dashboard .table div{overflow:hidden}#statify_dashboard .table.referrer{float:left;width:45%}#statify_dashboard .table.target{float:right;width:55%}#statify_dashboard td{line-height:1.4em;padding:8px 0 0}#statify_dashboard td.b{text-align:right;padding-right:4px;color:#777}#statify_dashboard .dashboard-widget-control-form{padding:0 0 18px}#statify_dashboard .dashboard-widget-control-form select{width:100px}#statify_dashboard .meta-links{float:right;line-height:28px;margin:0}
1
+ #statify_chart{color:#aaa;height:140px;margin:0 -4px;text-align:center}#statify_chart_data{display:none}#statify_dashboard .inside{height:1%;margin:0;padding-bottom:0;overflow:hidden;position:relative;white-space:nowrap}#statify_dashboard .table{padding-bottom:12px}#statify_dashboard .table p.sub{color:#BBB;margin:0 0 -4px}#statify_dashboard .table div{overflow:hidden}#statify_dashboard .table.referrer{float:left;width:45%}#statify_dashboard .table.target{float:right;width:55%}#statify_dashboard td{padding:8px 0 0;line-height:1.4em}#statify_dashboard td.b{text-align:right;padding-right:4px;color:#777}#statify_dashboard label{display:block;margin-bottom:1.1em!important}#statify_dashboard .dashboard-widget-control-form{padding:0 0 18px}#statify_dashboard .dashboard-widget-control-form select{width:100px}#statify_dashboard .meta-links{float:right;margin:0;line-height:28px}
inc/statify.class.php CHANGED
@@ -15,15 +15,17 @@ class Statify
15
  {
16
 
17
 
18
- /* Default */
19
- private static $_days = 14;
20
- private static $_limit = 3;
21
- private static $_today = 0;
22
- private static $_snippet = 0;
 
 
23
 
24
 
25
  /**
26
- * Pseudo-Konstruktor der Klasse
27
  *
28
  * @since 0.1.0
29
  * @change 0.1.0
@@ -36,22 +38,33 @@ class Statify
36
 
37
 
38
  /**
39
- * Konstruktor der Klasse
40
  *
41
  * @since 0.1.0
42
- * @change 1.1.0
43
  */
44
 
45
  public function __construct()
46
  {
47
- /* Filter */
48
- if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) or (defined('DOING_CRON') && DOING_CRON) or (defined('DOING_AJAX') && DOING_AJAX) ) {
49
  return;
50
  }
51
 
52
- /* Tabelle Init */
53
  Statify_Table::init();
54
 
 
 
 
 
 
 
 
 
 
 
 
55
  /* XMLRPC */
56
  if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
57
  add_filter(
@@ -62,7 +75,17 @@ class Statify
62
  )
63
  );
64
 
65
- /* BE */
 
 
 
 
 
 
 
 
 
 
66
  } else if ( is_admin() ) {
67
  add_action(
68
  'wpmu_new_blog',
@@ -88,7 +111,7 @@ class Statify
88
  add_filter(
89
  'plugin_row_meta',
90
  array(
91
- __CLASS__,
92
  'add_meta_link'
93
  ),
94
  10,
@@ -97,349 +120,34 @@ class Statify
97
  add_filter(
98
  'plugin_action_links_' .STATIFY_BASE,
99
  array(
100
- __CLASS__,
101
  'add_action_link'
102
  )
103
  );
104
 
105
- /* FE */
106
  } else {
107
  add_action(
108
  'template_redirect',
109
  array(
110
- __CLASS__,
111
  'track_visit'
112
  )
113
  );
114
  add_filter(
115
  'query_vars',
116
  array(
117
- __CLASS__,
118
  'query_vars'
119
  )
120
  );
121
  add_action(
122
  'wp_footer',
123
  array(
124
- __CLASS__,
125
  'wp_footer'
126
  )
127
  );
128
  }
129
  }
130
-
131
-
132
- /**
133
- * Hinzufügen der Meta-Links
134
- *
135
- * @since 0.1.0
136
- * @change 1.1.0
137
- *
138
- * @param array $input Array mit Links
139
- * @param string $file Name des Plugins
140
- * @return array Array mit erweitertem Link
141
- */
142
-
143
- public static function add_meta_link($input, $file)
144
- {
145
- /* Restliche Plugins? */
146
- if ( $file !== STATIFY_BASE ) {
147
- return $input;
148
- }
149
-
150
- return array_merge(
151
- $input,
152
- array(
153
- '<a href="https://flattr.com/t/1733733" target="_blank">Flattr</a>',
154
- '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=5RDDW9FEHGLG6" target="_blank">PayPal</a>'
155
- )
156
- );
157
- }
158
-
159
-
160
- /**
161
- * Hinzufügen des Action-Links
162
- *
163
- * @since 0.1.0
164
- * @change 1.1.0
165
- */
166
-
167
- public static function add_action_link($input)
168
- {
169
- /* Rechte? */
170
- if ( ! current_user_can('manage_options') ) {
171
- return $input;
172
- }
173
-
174
- /* Zusammenführen */
175
- return array_merge(
176
- $input,
177
- array(
178
- sprintf(
179
- '<a href="%s">%s</a>',
180
- add_query_arg(
181
- array(
182
- 'edit' => 'statify_dashboard#statify_dashboard'
183
- ),
184
- admin_url('/')
185
- ),
186
- __('Settings')
187
- )
188
- )
189
- );
190
- }
191
-
192
-
193
- /**
194
- * Speicherung der Plugin-Optionen
195
- *
196
- * @since 1.1.0
197
- * @change 1.1.0
198
- *
199
- * @param array $options Array mit Optionen
200
- */
201
-
202
- public static function set_options($options)
203
- {
204
- /* In die DB */
205
- update_option(
206
- 'statify',
207
- $options
208
- );
209
-
210
- /* Ins Cache */
211
- wp_cache_set(
212
- 'statify',
213
- $options
214
- );
215
- }
216
-
217
-
218
- /**
219
- * Rückgabe der Plugin-Optionen
220
- *
221
- * @since 1.1.0
222
- * @change 1.1.0
223
- *
224
- * @return array $options Array mit Optionen
225
- */
226
-
227
- public static function get_options()
228
- {
229
- /* Im Cache */
230
- if ( $options = wp_cache_get('statify') ) {
231
- return $options;
232
- }
233
-
234
- /* Zusammenführen */
235
- $options = wp_parse_args(
236
- get_option('statify'),
237
- array(
238
- 'days' => self::$_days,
239
- 'limit' => self::$_limit,
240
- 'today' => self::$_today,
241
- 'snippet' => self::$_snippet
242
- )
243
- );
244
-
245
- /* Ins Cache */
246
- wp_cache_set(
247
- 'statify',
248
- $options
249
- );
250
-
251
- return $options;
252
- }
253
-
254
-
255
- /**
256
- * Rückgabe einer bestimmten Plugin-Option
257
- *
258
- * @since 1.1.0
259
- * @change 1.1.0
260
- *
261
- * @param string $key Array-Key für Optionen
262
- * @return mixed Wert der angeforderten Option
263
- */
264
-
265
- public static function get_option($key)
266
- {
267
- /* Optionen */
268
- $options = self::get_options();
269
-
270
- return ( empty($options[$key]) ? '' : $options[$key] );
271
- }
272
-
273
-
274
- /**
275
- * Speicherung des Aufrufes in der DB
276
- *
277
- * @since 0.1.0
278
- * @change 1.3.0
279
- */
280
-
281
- public static function track_visit()
282
- {
283
- /* JS-Snippet? */
284
- $use_snippet = self::get_option('snippet');
285
- $is_snippet = $use_snippet && get_query_var('statify_target');
286
-
287
- /* Snippet? */
288
- if ( $is_snippet ) {
289
- $target = urldecode( get_query_var('statify_target') );
290
- $referrer = urldecode( get_query_var('statify_referrer') );
291
- } else if ( ! $use_snippet) {
292
- $target = ( empty($_SERVER['REQUEST_URI']) ? '/' : $_SERVER['REQUEST_URI'] );
293
- $referrer = ( empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'] );
294
- } else {
295
- return;
296
- }
297
-
298
- /* Kein Ziel? */
299
- if ( empty($target) ) {
300
- return self::_jump_out($is_snippet);
301
- }
302
-
303
- /* Bot? */
304
- if ( empty($_SERVER['HTTP_USER_AGENT']) OR ! preg_match('/(?:Windows|Macintosh|Linux|iPhone|iPad)/', $_SERVER['HTTP_USER_AGENT']) ) {
305
- return self::_jump_out($is_snippet);
306
- }
307
-
308
- /* Filter */
309
- if ( self::_skip_tracking() ) {
310
- return self::_jump_out($is_snippet);
311
- }
312
-
313
- /* Global */
314
- global $wpdb, $wp_rewrite;
315
-
316
- /* Init */
317
- $data = array(
318
- 'created' => '',
319
- 'referrer' => '',
320
- 'target' => ''
321
- );
322
-
323
- /* Timestamp */
324
- $data['created'] = strftime(
325
- '%Y-%m-%d',
326
- current_time('timestamp')
327
- );
328
-
329
- /* Referrer */
330
- if ( ! empty($referrer) && strpos( $referrer, home_url() ) === false ) {
331
- $data['referrer'] = esc_url_raw($referrer);
332
- }
333
-
334
- /* Ziel */
335
- $data['target'] = home_url($target, 'relative');
336
-
337
- /* Parameter entfernen */
338
- if ( $wp_rewrite->permalink_structure && ! is_search() ) {
339
- $data['target'] = parse_url($data['target'], PHP_URL_PATH);
340
- }
341
-
342
- /* Absichern */
343
- $data['target'] = esc_url_raw($data['target']);
344
-
345
- /* Insert */
346
- $wpdb->insert(
347
- $wpdb->statify,
348
- $data
349
- );
350
-
351
- /* Beenden */
352
- return self::_jump_out($is_snippet);
353
- }
354
-
355
-
356
- /**
357
- * Steuerung des Tracking-Mechanismus
358
- *
359
- * @since 1.2.6
360
- * @change 1.2.6
361
- *
362
- * @hook boolean statify_skip_tracking
363
- *
364
- * @return boolean $skip_hook TRUE, wenn KEIN Tracking des Seitenaufrufes erfolgen soll
365
- */
366
-
367
- private static function _skip_tracking() {
368
- if ( ( $skip_hook = apply_filters('statify_skip_tracking', NULL) ) !== NULL ) {
369
- return $skip_hook;
370
- }
371
-
372
- return ( is_feed() OR is_trackback() OR is_robots() OR is_preview() OR is_user_logged_in() OR is_404() );
373
- }
374
-
375
-
376
- /**
377
- * JavaScript-Header oder return
378
- *
379
- * @since 1.1.0
380
- * @change 1.3.0
381
- *
382
- * @param boolean $is_snippet JavaScript-Snippte als Aufruf?
383
- * @return mixed Exit oder return je nach Snippet
384
- */
385
-
386
- private static function _jump_out($is_snippet) {
387
- if ( $is_snippet ) {
388
- nocache_headers();
389
- header('Content-type: text/javascript', true, 204);
390
- exit;
391
- }
392
-
393
- return false;
394
- }
395
-
396
-
397
- /**
398
- * Deklariert GET-Variablen für die Weiternutzung
399
- *
400
- * @since 1.1.0
401
- * @change 1.1.0
402
- *
403
- * @param array $vars Array mit existierenden Variablen
404
- * @return array $vars Array mit Plugin-Variablen
405
- */
406
-
407
- public static function query_vars($vars) {
408
- $vars[] = 'statify_referrer';
409
- $vars[] = 'statify_target';
410
-
411
- return $vars;
412
- }
413
-
414
-
415
- /**
416
- * Ausgabe des JS-Snippets
417
- *
418
- * @since 1.1.0
419
- * @change 1.2.8
420
- */
421
-
422
- public static function wp_footer()
423
- {
424
- if ( self::get_option('snippet') ) { ?>
425
-
426
- <!-- Tracking von http://statify.de -->
427
- <script type="text/javascript">
428
- (function() {
429
- var e = document.createElement('script'),
430
- s = document.getElementsByTagName('script')[0],
431
- r = encodeURIComponent(document.referrer),
432
- t = encodeURIComponent(location.pathname),
433
- p = '?statify_referrer=' + r + '&statify_target=' + t;
434
-
435
- e.async = true;
436
- e.type = 'text/javascript';
437
- e.src = "<?php echo home_url('/', 'relative') ?>" + p;
438
-
439
- s.parentNode.insertBefore(e, s);
440
- })();
441
- </script>
442
-
443
- <?php }
444
- }
445
  }
15
  {
16
 
17
 
18
+ /**
19
+ * Plugin options
20
+ *
21
+ * @since 1.4.0
22
+ */
23
+
24
+ public static $_options;
25
 
26
 
27
  /**
28
+ * Class self initialize
29
  *
30
  * @since 0.1.0
31
  * @change 0.1.0
38
 
39
 
40
  /**
41
+ * Class constructor
42
  *
43
  * @since 0.1.0
44
+ * @change 1.4.0
45
  */
46
 
47
  public function __construct()
48
  {
49
+ /* Skip me! */
50
+ if ( (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) OR (defined('DOING_AJAX') && DOING_AJAX) ) {
51
  return;
52
  }
53
 
54
+ /* Table init */
55
  Statify_Table::init();
56
 
57
+ /* Plugin options */
58
+ self::$_options = wp_parse_args(
59
+ get_option('statify'),
60
+ array(
61
+ 'days' => 14,
62
+ 'limit' => 3,
63
+ 'today' => 0,
64
+ 'snippet' => 0
65
+ )
66
+ );
67
+
68
  /* XMLRPC */
69
  if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
70
  add_filter(
75
  )
76
  );
77
 
78
+ /* Cron */
79
+ } else if ( defined('DOING_CRON') && DOING_CRON ) {
80
+ add_action(
81
+ 'statify_cleanup',
82
+ array(
83
+ 'Statify_Cron',
84
+ 'cleanup_data'
85
+ )
86
+ );
87
+
88
+ /* Backend */
89
  } else if ( is_admin() ) {
90
  add_action(
91
  'wpmu_new_blog',
111
  add_filter(
112
  'plugin_row_meta',
113
  array(
114
+ 'Statify_Backend',
115
  'add_meta_link'
116
  ),
117
  10,
120
  add_filter(
121
  'plugin_action_links_' .STATIFY_BASE,
122
  array(
123
+ 'Statify_Backend',
124
  'add_action_link'
125
  )
126
  );
127
 
128
+ /* Frontend */
129
  } else {
130
  add_action(
131
  'template_redirect',
132
  array(
133
+ 'Statify_Frontend',
134
  'track_visit'
135
  )
136
  );
137
  add_filter(
138
  'query_vars',
139
  array(
140
+ 'Statify_Frontend',
141
  'query_vars'
142
  )
143
  );
144
  add_action(
145
  'wp_footer',
146
  array(
147
+ 'Statify_Frontend',
148
  'wp_footer'
149
  )
150
  );
151
  }
152
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
inc/statify_backend.class.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ defined('ABSPATH') OR exit;
6
+
7
+
8
+ /**
9
+ * Statify_Backend
10
+ *
11
+ * @since 1.4.0
12
+ */
13
+
14
+ class Statify_Backend
15
+ {
16
+
17
+
18
+ /**
19
+ * Add plugin meta links
20
+ *
21
+ * @since 0.1.0
22
+ * @change 1.4.0
23
+ *
24
+ * @param array $input Registered links
25
+ * @param string $file Current plugin file
26
+ * @return array Merged links
27
+ */
28
+
29
+ public static function add_meta_link($input, $file)
30
+ {
31
+ /* Restliche Plugins? */
32
+ if ( $file !== STATIFY_BASE ) {
33
+ return $input;
34
+ }
35
+
36
+ return array_merge(
37
+ $input,
38
+ array(
39
+ '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=ZAQUT9RLPW8QN" target="_blank">PayPal</a>',
40
+ '<a href="https://flattr.com/t/1733733" target="_blank">Flattr</a>',
41
+ '<a href="https://github.com/sergejmueller/statify/wiki" target="_blank">Wiki</a>'
42
+ )
43
+ );
44
+ }
45
+
46
+
47
+ /**
48
+ * Add plugin action links
49
+ *
50
+ * @since 0.1.0
51
+ * @change 1.4.0
52
+ *
53
+ * @param array $input Registered links
54
+ * @return array Merged links
55
+ */
56
+
57
+ public static function add_action_link($input)
58
+ {
59
+ /* Rechte? */
60
+ if ( ! current_user_can('edit_dashboard') ) {
61
+ return $input;
62
+ }
63
+
64
+ /* Zusammenführen */
65
+ return array_merge(
66
+ $input,
67
+ array(
68
+ sprintf(
69
+ '<a href="%s">%s</a>',
70
+ add_query_arg(
71
+ array(
72
+ 'edit' => 'statify_dashboard#statify_dashboard'
73
+ ),
74
+ admin_url('/')
75
+ ),
76
+ __('Settings')
77
+ )
78
+ )
79
+ );
80
+ }
81
+ }
inc/statify_cron.class.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ defined('ABSPATH') OR exit;
6
+
7
+
8
+ /**
9
+ * Statify_Cron
10
+ *
11
+ * @since 1.4.0
12
+ */
13
+
14
+ class Statify_Cron extends Statify
15
+ {
16
+
17
+
18
+ /**
19
+ * Cleanup obsolete DB values
20
+ *
21
+ * @since 0.3.0
22
+ * @change 1.4.0
23
+ */
24
+
25
+ public static function cleanup_data()
26
+ {
27
+ /* Global */
28
+ global $wpdb;
29
+
30
+ /* Remove items */
31
+ $wpdb->query(
32
+ $wpdb->prepare(
33
+ "DELETE FROM `$wpdb->statify` WHERE created <= SUBDATE(CURDATE(), %d)",
34
+ (int)self::$_options['days']
35
+ )
36
+ );
37
+
38
+ /* Optimize DB */
39
+ $wpdb->query(
40
+ "OPTIMIZE TABLE `$wpdb->statify`"
41
+ );
42
+ }
43
+ }
inc/statify_dashboard.class.php CHANGED
@@ -11,28 +11,52 @@ defined('ABSPATH') OR exit;
11
  * @since 1.1
12
  */
13
 
14
- class Statify_Dashboard
15
  {
16
 
17
 
18
  /**
19
- * Anzeige des Dashboard-Widgets
 
 
 
 
 
 
 
 
 
20
  *
21
  * @since 0.1.0
22
- * @change 1.2.3
 
 
23
  */
24
 
25
  public static function init()
26
  {
27
- /* Filter */
28
- if ( ! current_user_can('edit_dashboard') ) {
29
  return;
30
  }
31
 
32
- /* Version definieren */
33
- self::_define_version();
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- /* Widget */
 
36
  wp_add_dashboard_widget(
37
  'statify_dashboard',
38
  'Statify',
@@ -46,7 +70,7 @@ class Statify_Dashboard
46
  )
47
  );
48
 
49
- /* CSS laden */
50
  add_action(
51
  'admin_print_styles',
52
  array(
@@ -55,7 +79,7 @@ class Statify_Dashboard
55
  )
56
  );
57
 
58
- /* JS laden */
59
  add_action(
60
  'admin_print_scripts',
61
  array(
@@ -67,316 +91,214 @@ class Statify_Dashboard
67
 
68
 
69
  /**
70
- * Ausgabe der Stylesheets
71
  *
72
  * @since 0.1.0
73
- * @change 1.1.0
74
  */
75
 
76
  public static function add_style()
77
  {
78
- /* CSS registrieren */
79
  wp_register_style(
80
  'statify',
81
- plugins_url('/css/dashboard.min.css', STATIFY_FILE),
82
- array(),
83
- STATIFY_VERSION
 
 
 
84
  );
85
 
86
- /* CSS ausgeben */
87
- wp_enqueue_style('statify');
88
  }
89
 
90
 
91
  /**
92
- * Ausgabe von JavaScript
93
  *
94
  * @since 0.1.0
95
- * @change 1.2.5
96
  */
97
 
98
  public static function add_js() {
99
- /* Keine Statistiken? */
100
- if ( ! self::get_stats() ) {
101
- return;
102
- }
103
-
104
- /* Edit modus? */
105
- if ( isset($_GET['edit']) && $_GET['edit'] === 'statify_dashboard' ) {
106
- return;
107
- }
108
-
109
- /* Register scripts */
110
  wp_register_script(
111
  'sm_raphael_js',
112
- plugins_url('js/raphael.min.js', STATIFY_FILE),
 
 
 
113
  array(),
114
- STATIFY_VERSION,
115
  true
116
  );
117
  wp_register_script(
118
  'sm_raphael_helper',
119
- plugins_url('js/raphael.helper.min.js', STATIFY_FILE),
 
 
 
120
  array(),
121
- STATIFY_VERSION,
122
  true
123
  );
124
  wp_register_script(
125
  'statify_chart_js',
126
- plugins_url('js/dashboard.min.js', STATIFY_FILE),
 
 
 
127
  array('jquery'),
128
- STATIFY_VERSION,
129
  true
130
  );
131
 
132
- /* Embed scripts */
133
- wp_enqueue_script('sm_raphael_js');
134
- wp_enqueue_script('sm_raphael_helper');
135
- wp_enqueue_script('statify_chart_js');
 
 
 
 
 
136
  }
137
 
138
 
139
  /**
140
- * Ausgabe der Frontseite
141
  *
142
  * @since 0.1.0
143
- * @change 1.3.0
144
  */
145
 
146
  public static function print_frontview()
147
  {
148
- /* Get stats */
149
- $stats = self::get_stats();
150
-
151
- /* No results? */
152
- if ( ! $stats ) {
153
- echo sprintf(
154
- '<div id="statify_chart"><p>%s</p></div>',
155
- 'Keine Daten verfügbar.'
156
- );
157
-
158
- return;
159
- }
160
-
161
- /* Get visits */
162
- $visits = array_reverse($stats['visits']);
163
-
164
- /* HTML start */
165
- $html = "<table id=statify_chart_data>\n";
166
-
167
-
168
- /* Timestamp table */
169
- $html .= "<tfoot><tr>\n";
170
- foreach ($visits as $item) {
171
- $html .= "<th>" .esc_html($item['date']). "</th>\n";
172
- }
173
- $html .= "</tr></tfoot>\n";
174
 
175
- /* Counter table */
176
- $html .= "<tbody><tr>\n";
177
- foreach($visits as $item) {
178
- $html .= "<td>" .intval($item['count']). "</td>\n";
179
- }
180
- $html .= "</tr></tbody>\n";
181
-
182
-
183
- /* HTML end */
184
- $html .= "</table>\n";
185
-
186
- /* Print html */
187
- echo '<div id="statify_chart">' .$html. '</div>'; ?>
188
-
189
- <?php if ( $stats['target'] ) { ?>
190
- <div class="table target">
191
- <p class="sub">Top Inhalte</p>
192
-
193
- <div>
194
- <table>
195
- <?php foreach ($stats['target'] as $target) { ?>
196
- <tr>
197
- <td class="b">
198
- <?php echo intval($target['count']) ?>
199
- </td>
200
- <td class="t">
201
- <a href="<?php echo esc_url($target['url']) ?>" target="_blank"><?php echo esc_url($target['url']) ?></a>
202
- </td>
203
- </tr>
204
- <?php } ?>
205
- </table>
206
- </div>
207
- </div>
208
- <?php } ?>
209
-
210
- <?php if ( $stats['referrer'] ) { ?>
211
- <div class="table referrer">
212
- <p class="sub">Top Referrer</p>
213
-
214
- <div>
215
- <table>
216
- <?php foreach ($stats['referrer'] as $referrer) { ?>
217
- <tr>
218
- <td class="b">
219
- <?php echo intval($referrer['count']) ?>
220
- </td>
221
- <td class="t">
222
- <a href="<?php echo esc_url($referrer['url']) ?>" target="_blank"><?php echo esc_url($referrer['host']) ?></a>
223
- </td>
224
- </tr>
225
- <?php } ?>
226
- </table>
227
- </div>
228
- </div>
229
- <?php } ?>
230
- <?php }
231
 
232
 
233
  /**
234
- * Ausgabe der Backseite
235
  *
236
  * @since 0.4.0
237
- * @change 1.2.3
238
  */
239
 
240
  public static function print_backview()
241
  {
242
- /* Rechte */
243
  if ( ! current_user_can('edit_dashboard') ) {
244
  return;
245
  }
246
 
247
- /* Speichern */
248
  if ( ! empty($_POST['statify']) ) {
249
- /* Formular-Referer */
250
- check_admin_referer('_statify');
251
-
252
- /* Optionen speichern */
253
- Statify::set_options(
254
- array(
255
- 'days' => (int)@$_POST['statify']['days'],
256
- 'limit' => (int)@$_POST['statify']['limit'],
257
- 'today' => (int)@$_POST['statify']['today'],
258
- 'snippet' => (int)@$_POST['statify']['snippet']
259
- )
260
- );
261
-
262
- /* Internen Cache Leeren */
263
- delete_transient('statify_chart');
264
-
265
- /* Cachify Cache leeren */
266
- if ( has_action('cachify_flush_cache') ) {
267
- do_action('cachify_flush_cache');
268
- }
269
  }
270
 
271
- /* Zeiträume */
272
- $dmatrix = array(
273
- 7 => '1 Woche',
274
- 14 => '2 Wochen',
275
- 21 => '3 Wochen',
276
- 30 => '1 Monat',
277
- 90 => '3 Monate',
278
- 180 => '6 Monate',
279
- 365 => '1 Jahr'
280
  );
 
 
281
 
282
- /* Optionen */
283
- $options = Statify::get_options();
284
-
285
- /* Security */
286
- wp_nonce_field('_statify'); ?>
287
-
288
- <table class="form-table">
289
- <tr valign="top">
290
- <th scope="row">
291
- Statistik
292
- </th>
293
- <td>
294
- <fieldset>
295
- <label for="statify_days">
296
- <select name="statify[days]" id="statify_days">
297
- <?php foreach( $dmatrix as $days => $string ) { ?>
298
- <option value="<?php echo $days ?>" <?php selected($options['days'], $days); ?>>
299
- <?php echo $string ?>
300
- </option>
301
- <?php } ?>
302
- </select>
303
- Zeitraum der Aufbewahrung
304
- </label>
305
-
306
- <br />
307
-
308
- <label for="statify_limit">
309
- <select name="statify[limit]" id="statify_limit">
310
- <?php foreach( range(0, 12) as $num ) { ?>
311
- <option <?php selected($options['limit'], $num) ?>>
312
- <?php echo $num ?>
313
- </option>
314
- <?php } ?>
315
- </select>
316
- Anzahl der Einträge in Listen
317
- </label>
318
-
319
- <br />
320
-
321
- <label for="statify_today">
322
- <input type="checkbox" name="statify[today]" id="statify_today" value="1" <?php checked($options['today'], 1) ?> />
323
- Einträge in Listen nur von heute
324
- </label>
325
- </fieldset>
326
- </td>
327
- </tr>
328
-
329
- <tr valign="top">
330
- <th scope="row">
331
- Tracking
332
- </th>
333
- <td>
334
- <fieldset>
335
- <label for="statify_snippet">
336
- <input type="checkbox" name="statify[snippet]" id="statify_snippet" value="1" <?php checked($options['snippet'], 1) ?> />
337
- Seitenzählung via JavaScript-Snippet
338
- </label>
339
- </fieldset>
340
- </td>
341
- </tr>
342
- </table>
343
-
344
- <p class="meta-links">
345
- <a href="http://playground.ebiene.de/statify-wordpress-statistik/" target="_blank">Handbuch</a> &bull; <a href="https://flattr.com/t/1733733" target="_blank">Flattr</a> &bull; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=5RDDW9FEHGLG6" target="_blank">PayPal</a>
346
- </p>
347
- <?php }
348
 
349
 
350
  /**
351
- * Rückgabe der Statistiken
352
  *
353
  * @since 0.1.0
354
- * @change 1.3.0
355
  *
356
- * @return array $data Array mit Statistiken
357
  */
358
 
359
  public static function get_stats()
360
  {
361
- /* Auf Cache zugreifen */
362
- if ( $data = get_transient('statify_chart') ) {
363
  return $data;
364
  }
365
 
366
- /* DB reinigen */
367
- self::_clean_data();
368
-
369
- /* Stats abrufen */
370
  $data = self::_select_data();
371
 
372
- /* Empty stats */
373
- if ( empty($data['visits']) ) {
374
- $data = NULL;
375
- }
 
 
376
 
377
- /* Merken */
378
  set_transient(
379
- 'statify_chart',
380
  $data,
381
  MINUTE_IN_SECONDS * 4
382
  );
@@ -386,103 +308,46 @@ class Statify_Dashboard
386
 
387
 
388
  /**
389
- * Statistiken aus der DB
390
  *
391
  * @since 0.1.0
392
- * @change 1.2.5
393
  *
394
- * @return array Array mit ausgelesenen Daten
395
  */
396
 
397
  private static function _select_data()
398
  {
399
- /* GLobal */
400
  global $wpdb;
401
 
402
- /* Optionen */
403
- $options = Statify::get_options();
 
 
404
 
405
  return array(
406
  'visits' => $wpdb->get_results(
407
  $wpdb->prepare(
408
- "SELECT DATE_FORMAT(`created`, '%%d.%%m.%%Y') as `date`, COUNT(`created`) as `count` FROM `$wpdb->statify` GROUP BY `created` ORDER BY `created` DESC LIMIT %d",
409
- (int)$options['days']
410
  ),
411
  ARRAY_A
412
  ),
413
  'target' => $wpdb->get_results(
414
  $wpdb->prepare(
415
- "SELECT COUNT(`target`) as `count`, `target` as `url` FROM `$wpdb->statify` " .( $options['today'] ? 'WHERE created = DATE(NOW())' : '' ). " GROUP BY `target` ORDER BY `count` DESC LIMIT %d",
416
- (int)$options['limit']
417
  ),
418
  ARRAY_A
419
  ),
420
  'referrer' => $wpdb->get_results(
421
  $wpdb->prepare(
422
- "SELECT COUNT(`referrer`) as `count`, `referrer` as `url`, SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'www.' FROM(TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(`referrer`))))), '/', 1), ':', 1) as `host` FROM `$wpdb->statify` WHERE `referrer` != '' " .( $options['today'] ? 'AND created = DATE(NOW())' : '' ). " GROUP BY `host` ORDER BY `count` DESC LIMIT %d",
423
- (int)$options['limit']
424
  ),
425
  ARRAY_A
426
  )
427
  );
428
  }
429
-
430
-
431
- /**
432
- * Bereinigung der veralteten Werte in der DB
433
- *
434
- * @since 0.3.0
435
- * @change 1.3.0
436
- */
437
-
438
- private static function _clean_data()
439
- {
440
- /* Überspringen? */
441
- if ( get_transient('statify_cron') ) {
442
- return;
443
- }
444
-
445
- /* Global */
446
- global $wpdb;
447
-
448
- /* Optionen */
449
- $options = Statify::get_options();
450
-
451
- /* Löschen */
452
- $wpdb->query(
453
- $wpdb->prepare(
454
- "DELETE FROM `$wpdb->statify` WHERE created <= SUBDATE(CURDATE(), %d)",
455
- (int)$options['days']
456
- )
457
- );
458
-
459
- /* DB optimieren */
460
- $wpdb->query(
461
- "OPTIMIZE TABLE `$wpdb->statify`"
462
- );
463
-
464
- /* Merken */
465
- set_transient(
466
- 'statify_cron',
467
- 'ilovesweta',
468
- HOUR_IN_SECONDS * 12
469
- );
470
- }
471
-
472
-
473
- /**
474
- * Plugin-Version als Konstante
475
- *
476
- * @since 1.1.0
477
- * @change 1.1.0
478
- */
479
-
480
- private static function _define_version()
481
- {
482
- /* Auslesen */
483
- $meta = get_plugin_data(STATIFY_FILE);
484
-
485
- /* Zuweisen */
486
- define('STATIFY_VERSION', $meta['Version']);
487
- }
488
  }
11
  * @since 1.1
12
  */
13
 
14
+ class Statify_Dashboard extends Statify
15
  {
16
 
17
 
18
  /**
19
+ * Plugin version
20
+ *
21
+ * @since 1.4.0
22
+ */
23
+
24
+ protected static $_plugin_version;
25
+
26
+
27
+ /**
28
+ * Dashboard widget initialize
29
  *
30
  * @since 0.1.0
31
+ * @change 1.4.0
32
+ *
33
+ * @hook boolean statify__user_can_see_stats (https://gist.github.com/sergejmueller/1ce0482c277508d8327e)
34
  */
35
 
36
  public static function init()
37
  {
38
+ /* Filter user_can_see_stats */
39
+ if ( ! apply_filters('statify__user_can_see_stats', current_user_can('edit_dashboard')) ) {
40
  return;
41
  }
42
 
43
+ /* Load textdomain */
44
+ load_plugin_textdomain(
45
+ 'statify',
46
+ false,
47
+ wp_normalize_path(
48
+ sprintf(
49
+ '%s/lang',
50
+ STATIFY_DIR
51
+ )
52
+ )
53
+ );
54
+
55
+ /* Plugin version */
56
+ self::_get_version();
57
 
58
+
59
+ /* Add dashboard widget */
60
  wp_add_dashboard_widget(
61
  'statify_dashboard',
62
  'Statify',
70
  )
71
  );
72
 
73
+ /* Init CSS */
74
  add_action(
75
  'admin_print_styles',
76
  array(
79
  )
80
  );
81
 
82
+ /* Init JS */
83
  add_action(
84
  'admin_print_scripts',
85
  array(
91
 
92
 
93
  /**
94
+ * Print CSS
95
  *
96
  * @since 0.1.0
97
+ * @change 1.4.0
98
  */
99
 
100
  public static function add_style()
101
  {
102
+ /* Register CSS */
103
  wp_register_style(
104
  'statify',
105
+ plugins_url(
106
+ '/css/dashboard.min.css',
107
+ STATIFY_FILE
108
+ ),
109
+ array(),
110
+ self::$_plugin_version
111
  );
112
 
113
+ /* Load CSS */
114
+ wp_enqueue_style('statify');
115
  }
116
 
117
 
118
  /**
119
+ * Print JavaScript
120
  *
121
  * @since 0.1.0
122
+ * @change 1.4.0
123
  */
124
 
125
  public static function add_js() {
126
+ /* Register JS */
 
 
 
 
 
 
 
 
 
 
127
  wp_register_script(
128
  'sm_raphael_js',
129
+ plugins_url(
130
+ 'js/raphael.min.js',
131
+ STATIFY_FILE
132
+ ),
133
  array(),
134
+ self::$_plugin_version,
135
  true
136
  );
137
  wp_register_script(
138
  'sm_raphael_helper',
139
+ plugins_url(
140
+ 'js/raphael.helper.min.js',
141
+ STATIFY_FILE
142
+ ),
143
  array(),
144
+ self::$_plugin_version,
145
  true
146
  );
147
  wp_register_script(
148
  'statify_chart_js',
149
+ plugins_url(
150
+ 'js/dashboard.min.js',
151
+ STATIFY_FILE
152
+ ),
153
  array('jquery'),
154
+ self::$_plugin_version,
155
  true
156
  );
157
 
158
+ /* Localize strings */
159
+ wp_localize_script(
160
+ 'statify_chart_js',
161
+ 'statify_translations',
162
+ array(
163
+ 'pageview' => strip_tags( __('Pageview', 'statify') ),
164
+ 'pageviews' => strip_tags( __('Pageviews', 'statify') )
165
+ )
166
+ );
167
  }
168
 
169
 
170
  /**
171
+ * Print widget frontview
172
  *
173
  * @since 0.1.0
174
+ * @change 1.4.0
175
  */
176
 
177
  public static function print_frontview()
178
  {
179
+ /* Load JS */
180
+ wp_enqueue_script('sm_raphael_js');
181
+ wp_enqueue_script('sm_raphael_helper');
182
+ wp_enqueue_script('statify_chart_js');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
+ /* Load template */
185
+ load_template(
186
+ wp_normalize_path(
187
+ sprintf(
188
+ '%s/views/widget_front.view.php',
189
+ STATIFY_DIR
190
+ )
191
+ )
192
+ );
193
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
 
196
  /**
197
+ * Print widget backview
198
  *
199
  * @since 0.4.0
200
+ * @change 1.4.0
201
  */
202
 
203
  public static function print_backview()
204
  {
205
+ /* Capability check */
206
  if ( ! current_user_can('edit_dashboard') ) {
207
  return;
208
  }
209
 
210
+ /* Update plugin options */
211
  if ( ! empty($_POST['statify']) ) {
212
+ self::_save_options();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
214
 
215
+ /* Load view */
216
+ load_template(
217
+ wp_normalize_path(
218
+ sprintf(
219
+ '%s/views/widget_back.view.php',
220
+ STATIFY_DIR
221
+ )
222
+ )
 
223
  );
224
+ }
225
+
226
 
227
+ /**
228
+ * Save plugin options
229
+ *
230
+ * @since 1.4.0
231
+ * @change 1.4.0
232
+ */
233
+
234
+ private static function _save_options()
235
+ {
236
+ /* Update values */
237
+ update_option(
238
+ 'statify',
239
+ array(
240
+ 'days' => (int)@$_POST['statify']['days'],
241
+ 'limit' => (int)@$_POST['statify']['limit'],
242
+ 'today' => (int)@$_POST['statify']['today'],
243
+ 'snippet' => (int)@$_POST['statify']['snippet']
244
+ )
245
+ );
246
+
247
+ /* Delete transient */
248
+ delete_transient('statify_data');
249
+
250
+ /* Clear Cachify cache */
251
+ if ( has_action('cachify_flush_cache') ) {
252
+ do_action('cachify_flush_cache');
253
+ }
254
+ }
255
+
256
+
257
+ /**
258
+ * Set plugin version from plugin meta data
259
+ *
260
+ * @since 1.4.0
261
+ * @change 1.4.0
262
+ */
263
+
264
+ private static function _get_version()
265
+ {
266
+ /* Get plugin meta */
267
+ $meta = get_plugin_data(STATIFY_FILE);
268
+
269
+ self::$_plugin_version = $meta['Version'];
270
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
 
273
  /**
274
+ * Get stats from cache
275
  *
276
  * @since 0.1.0
277
+ * @change 1.4.0
278
  *
279
+ * @return array $data Data from cache or DB
280
  */
281
 
282
  public static function get_stats()
283
  {
284
+ /* Get from cache */
285
+ if ( $data = get_transient('statify_data') ) {
286
  return $data;
287
  }
288
 
289
+ /* Get from DB */
 
 
 
290
  $data = self::_select_data();
291
 
292
+ /* Prepare data */
293
+ if ( ! empty($data['visits']) ) {
294
+ $data['visits'] = array_reverse($data['visits']);
295
+ } else {
296
+ $data = NULL;
297
+ }
298
 
299
+ /* Make cache */
300
  set_transient(
301
+ 'statify_data',
302
  $data,
303
  MINUTE_IN_SECONDS * 4
304
  );
308
 
309
 
310
  /**
311
+ * Get stats from DB
312
  *
313
  * @since 0.1.0
314
+ * @change 1.4.0
315
  *
316
+ * @return array DB results
317
  */
318
 
319
  private static function _select_data()
320
  {
321
+ /* Global */
322
  global $wpdb;
323
 
324
+ /* Init values */
325
+ $days = (int)self::$_options['days'];
326
+ $limit = (int)self::$_options['limit'];
327
+ $today = (int)self::$_options['today'];
328
 
329
  return array(
330
  'visits' => $wpdb->get_results(
331
  $wpdb->prepare(
332
+ "SELECT `created` as `date`, COUNT(`created`) as `count` FROM `$wpdb->statify` GROUP BY `created` ORDER BY `created` DESC LIMIT %d",
333
+ $days
334
  ),
335
  ARRAY_A
336
  ),
337
  'target' => $wpdb->get_results(
338
  $wpdb->prepare(
339
+ "SELECT COUNT(`target`) as `count`, `target` as `url` FROM `$wpdb->statify` " .( $today ? 'WHERE created = DATE(NOW())' : '' ). " GROUP BY `target` ORDER BY `count` DESC LIMIT %d",
340
+ $limit
341
  ),
342
  ARRAY_A
343
  ),
344
  'referrer' => $wpdb->get_results(
345
  $wpdb->prepare(
346
+ "SELECT COUNT(`referrer`) as `count`, `referrer` as `url`, SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'www.' FROM(TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(`referrer`))))), '/', 1), ':', 1) as `host` FROM `$wpdb->statify` WHERE `referrer` != '' " .( $today ? 'AND created = DATE(NOW())' : '' ). " GROUP BY `host` ORDER BY `count` DESC LIMIT %d",
347
+ $limit
348
  ),
349
  ARRAY_A
350
  )
351
  );
352
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  }
inc/statify_deactivate.class.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ defined('ABSPATH') OR exit;
6
+
7
+
8
+ /**
9
+ * Statify_Deactivate
10
+ *
11
+ * @since 1.4.0
12
+ */
13
+
14
+ class Statify_Deactivate
15
+ {
16
+
17
+
18
+ /**
19
+ * Plugin deactivation actions
20
+ *
21
+ * @since 1.4.0
22
+ * @change 1.4.0
23
+ */
24
+
25
+ public static function init()
26
+ {
27
+ /* Delete transients */
28
+ delete_transient('statify_data');
29
+
30
+ /* Delete cron event */
31
+ wp_clear_scheduled_hook('statify_cleanup');
32
+ }
33
+ }
inc/statify_frontend.class.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ defined('ABSPATH') OR exit;
6
+
7
+
8
+ /**
9
+ * Statify_Frontend
10
+ *
11
+ * @since 1.4.0
12
+ */
13
+
14
+ class Statify_Frontend extends Statify
15
+ {
16
+
17
+
18
+ /**
19
+ * Speicherung des Aufrufes in der DB
20
+ *
21
+ * @since 0.1.0
22
+ * @change 1.4.0
23
+ */
24
+
25
+ public static function track_visit()
26
+ {
27
+ /* JS-Snippet? */
28
+ $use_snippet = self::$_options['snippet'];
29
+ $is_snippet = $use_snippet && get_query_var('statify_target');
30
+
31
+ /* Snippet? */
32
+ if ( $is_snippet ) {
33
+ $target = urldecode( get_query_var('statify_target') );
34
+ $referrer = urldecode( get_query_var('statify_referrer') );
35
+ } else if ( ! $use_snippet) {
36
+ $target = ( empty($_SERVER['REQUEST_URI']) ? '/' : $_SERVER['REQUEST_URI'] );
37
+ $referrer = ( empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'] );
38
+ } else {
39
+ return;
40
+ }
41
+
42
+ /* Kein Ziel? */
43
+ if ( empty($target) OR ! filter_var( home_url($target), FILTER_VALIDATE_URL ) ) {
44
+ return self::_jump_out($is_snippet);
45
+ }
46
+
47
+ /* Bot? */
48
+ if ( empty($_SERVER['HTTP_USER_AGENT']) OR ! preg_match('/(?:Windows|Macintosh|Linux|iPhone|iPad)/', $_SERVER['HTTP_USER_AGENT']) ) {
49
+ return self::_jump_out($is_snippet);
50
+ }
51
+
52
+ /* Filter */
53
+ if ( self::_skip_tracking() ) {
54
+ return self::_jump_out($is_snippet);
55
+ }
56
+
57
+ /* Global */
58
+ global $wpdb, $wp_rewrite;
59
+
60
+ /* Init */
61
+ $data = array(
62
+ 'created' => '',
63
+ 'referrer' => '',
64
+ 'target' => ''
65
+ );
66
+
67
+ /* Timestamp */
68
+ $data['created'] = strftime(
69
+ '%Y-%m-%d',
70
+ current_time('timestamp')
71
+ );
72
+
73
+ /* Referrer */
74
+ if ( ! empty($referrer) && strpos( $referrer, home_url() ) === false ) {
75
+ $data['referrer'] = esc_url_raw( $referrer, array('http', 'https') );
76
+ }
77
+
78
+ /* Set request target */
79
+ $data['target'] = home_url($target, 'relative');
80
+
81
+ /* Get url path only */
82
+ if ( $wp_rewrite->permalink_structure && ! is_search() ) {
83
+ $data['target'] = parse_url($data['target'], PHP_URL_PATH);
84
+ }
85
+
86
+ /* Sanitize url */
87
+ $data['target'] = filter_var($data['target'], FILTER_SANITIZE_URL);
88
+
89
+ /* Insert */
90
+ $wpdb->insert(
91
+ $wpdb->statify,
92
+ $data
93
+ );
94
+
95
+ /* Beenden */
96
+ return self::_jump_out($is_snippet);
97
+ }
98
+
99
+
100
+ /**
101
+ * Steuerung des Tracking-Mechanismus
102
+ *
103
+ * @since 1.2.6
104
+ * @change 1.4.0
105
+ *
106
+ * @hook boolean statify_skip_tracking
107
+ *
108
+ * @return boolean $skip_hook TRUE, wenn KEIN Tracking des Seitenaufrufes erfolgen soll
109
+ */
110
+
111
+ private static function _skip_tracking() {
112
+ if ( ( $skip_hook = apply_filters('statify_skip_tracking', NULL) ) !== NULL ) {
113
+ return $skip_hook;
114
+ }
115
+
116
+ return ( is_feed() OR is_trackback() OR is_robots() OR is_preview() OR is_user_logged_in() OR is_404() );
117
+ }
118
+
119
+
120
+ /**
121
+ * JavaScript-Header oder return
122
+ *
123
+ * @since 1.1.0
124
+ * @change 1.4.0
125
+ *
126
+ * @param boolean $is_snippet JavaScript-Snippte als Aufruf?
127
+ * @return mixed Exit oder return je nach Snippet
128
+ */
129
+
130
+ private static function _jump_out($is_snippet) {
131
+ if ( $is_snippet ) {
132
+ nocache_headers();
133
+ header('Content-type: text/javascript', true, 204);
134
+ exit;
135
+ }
136
+
137
+ return false;
138
+ }
139
+
140
+
141
+ /**
142
+ * Deklariert GET-Variablen für die Weiternutzung
143
+ *
144
+ * @since 1.1.0
145
+ * @change 1.4.0
146
+ *
147
+ * @param array $vars Array mit existierenden Variablen
148
+ * @return array $vars Array mit Plugin-Variablen
149
+ */
150
+
151
+ public static function query_vars($vars) {
152
+ $vars[] = 'statify_referrer';
153
+ $vars[] = 'statify_target';
154
+
155
+ return $vars;
156
+ }
157
+
158
+
159
+ /**
160
+ * Ausgabe des JS-Snippets
161
+ *
162
+ * @since 1.1.0
163
+ * @change 1.4.0
164
+ */
165
+
166
+ public static function wp_footer()
167
+ {
168
+ /* Skip by option */
169
+ if ( ! self::$_options['snippet'] ) {
170
+ return;
171
+ }
172
+
173
+ /* Load template */
174
+ load_template(
175
+ wp_normalize_path(
176
+ sprintf(
177
+ '%s/views/js_snippet.view.php',
178
+ STATIFY_DIR
179
+ )
180
+ )
181
+ );
182
+ }
183
+ }
inc/statify_install.class.php CHANGED
@@ -76,22 +76,28 @@ class Statify_Install
76
  * Anlegen der Daten
77
  *
78
  * @since 0.1.0
79
- * @change 1.3.0
80
  */
81
 
82
  private static function _apply()
83
  {
84
- /* Option */
85
  add_option(
86
  'statify',
87
- array(),
88
- '',
89
- 'no'
90
  );
91
 
92
  /* Transients */
93
- delete_transient('statify_chart');
94
- delete_transient('statify_cron');
 
 
 
 
 
 
 
 
95
 
96
  /* Tabelle setzen */
97
  Statify_Table::init();
76
  * Anlegen der Daten
77
  *
78
  * @since 0.1.0
79
+ * @change 1.4.0
80
  */
81
 
82
  private static function _apply()
83
  {
84
+ /* Options */
85
  add_option(
86
  'statify',
87
+ array()
 
 
88
  );
89
 
90
  /* Transients */
91
+ delete_transient('statify_data');
92
+
93
+ /* Cron */
94
+ if ( ! wp_next_scheduled('statify_cleanup') ) {
95
+ wp_schedule_event(
96
+ time(),
97
+ 'daily',
98
+ 'statify_cleanup'
99
+ );
100
+ }
101
 
102
  /* Tabelle setzen */
103
  Statify_Table::init();
inc/statify_table.class.php CHANGED
@@ -61,7 +61,7 @@ class Statify_Table
61
  /* Anlegen */
62
  dbDelta(
63
  "CREATE TABLE `$wpdb->statify` (
64
- `id` bigint(20) unsigned NOT NULL auto_increment,
65
  `created` date NOT NULL default '0000-00-00',
66
  `referrer` varchar(255) NOT NULL default '',
67
  `target` varchar(255) NOT NULL default '',
61
  /* Anlegen */
62
  dbDelta(
63
  "CREATE TABLE `$wpdb->statify` (
64
+ `id` bigint(20) unsigned NOT NULL auto_increment,
65
  `created` date NOT NULL default '0000-00-00',
66
  `referrer` varchar(255) NOT NULL default '',
67
  `target` varchar(255) NOT NULL default '',
inc/statify_uninstall.class.php CHANGED
@@ -79,22 +79,18 @@ class Statify_Uninstall
79
  * Löschung der Daten
80
  *
81
  * @since 0.1.0
82
- * @change 1.3.0
83
  */
84
 
85
  private static function _apply()
86
  {
87
- /* Option */
88
  delete_option('statify');
89
 
90
- /* Transients */
91
- delete_transient('statify_chart');
92
- delete_transient('statify_cron');
93
-
94
- /* Tabelle setzen */
95
  Statify_Table::init();
96
 
97
- /* Tabelle anlegen */
98
  Statify_Table::drop();
99
  }
100
  }
79
  * Löschung der Daten
80
  *
81
  * @since 0.1.0
82
+ * @change 1.4.0
83
  */
84
 
85
  private static function _apply()
86
  {
87
+ /* Delete options */
88
  delete_option('statify');
89
 
90
+ /* Init table */
 
 
 
 
91
  Statify_Table::init();
92
 
93
+ /* Delete table */
94
  Statify_Table::drop();
95
  }
96
  }
inc/statify_xmlrpc.class.php CHANGED
@@ -48,7 +48,7 @@ class Statify_XMLRPC
48
  public static function xmlrpc_callback($args) {
49
  /* Keine Zugangsdaten? */
50
  if ( empty($args[0]) OR empty($args[1]) ) {
51
- return '{"error": "Keine Zugangsdaten"}';
52
  }
53
 
54
  /* Nutzer einloggen */
@@ -56,17 +56,17 @@ class Statify_XMLRPC
56
 
57
  /* Falsche Zugangsdaten */
58
  if ( ! $user OR is_wp_error($user) ) {
59
- return '{"error": "Falsche Zugangsdaten"}';
60
  }
61
 
62
  /* Berechtigung prüfen */
63
  if ( ! user_can($user, 'edit_dashboard') ) {
64
- return '{"error": "Keine Berechtigung"}';
65
  }
66
 
67
  /* Leer? */
68
  if ( ! $data = Statify_Dashboard::get_stats() ) {
69
- return '{"error": "Keine Daten"}';
70
  }
71
 
72
  return json_encode($data['visits']);
48
  public static function xmlrpc_callback($args) {
49
  /* Keine Zugangsdaten? */
50
  if ( empty($args[0]) OR empty($args[1]) ) {
51
+ return '{"error": "Empty login data"}';
52
  }
53
 
54
  /* Nutzer einloggen */
56
 
57
  /* Falsche Zugangsdaten */
58
  if ( ! $user OR is_wp_error($user) ) {
59
+ return '{"error": "Incorrect login"}';
60
  }
61
 
62
  /* Berechtigung prüfen */
63
  if ( ! user_can($user, 'edit_dashboard') ) {
64
+ return '{"error": "User can check failed"}';
65
  }
66
 
67
  /* Leer? */
68
  if ( ! $data = Statify_Dashboard::get_stats() ) {
69
+ return '{"error": "No data"}';
70
  }
71
 
72
  return json_encode($data['visits']);
js/dashboard.js CHANGED
@@ -2,22 +2,29 @@
2
 
3
  // Grab the data
4
  var labels = [],
5
- data = [];
6
- jQuery("#statify_chart_data tfoot th").each(function () {
7
- labels.push(jQuery(this).html());
 
 
 
 
 
 
 
8
  });
9
- jQuery("#statify_chart_data tbody td").each(function () {
10
- data.push(jQuery(this).html());
11
  });
12
 
13
  // Draw
14
- var width = jQuery('#statify_chart').parent().width() + 8,
15
  height = 140,
16
  leftgutter = 0,
17
  bottomgutter = 22,
18
  topgutter = 22,
19
  color = '#0074a2',
20
- r = Raphael("statify_chart", width, height),
21
  txt = {font: 'bold 12px "Open Sans", sans-serif', fill: "#333"},
22
  X = (width - leftgutter * 2) / labels.length,
23
  max = Math.max.apply(Math, data),
@@ -40,7 +47,7 @@
40
  is_label_visible = false,
41
  leave_timer,
42
  blanket = r.set();
43
- label.push(r.text(60, 12, "7777 Aufrufe").attr(txt));
44
  label.push(r.text(60, 27, "23.12.2013").attr(txt).attr({fill: color}));
45
  label.hide();
46
  var frame = r.popup(100, 100, label, "right").attr({fill: "#fff", stroke: "#444", "stroke-width": 1}).hide();
@@ -82,7 +89,7 @@
82
  ly = label[0].transform()[0][2] + ppp.dy;
83
  frame.show().stop().animate(anim);
84
 
85
- label[0].attr({text: data + " Aufrufe"}).show().stop().animateWith(frame, anim, {transform: ["t", lx, ly]}, 200 * is_label_visible);
86
  label[1].attr({text: lbl }).show().stop().animateWith(frame, anim, {transform: ["t", lx, ly]}, 200 * is_label_visible);
87
  dot.attr("r", 6);
88
  is_label_visible = true;
2
 
3
  // Grab the data
4
  var labels = [],
5
+ data = [],
6
+ statify_chart_id = 'statify_chart',
7
+ $statify_data_table = jQuery('#statify_chart_data');
8
+
9
+ if ( ! $statify_data_table.length ) {
10
+ return;
11
+ }
12
+
13
+ jQuery('th', $statify_data_table).each(function () {
14
+ labels.push(jQuery(this).text());
15
  });
16
+ jQuery('td', $statify_data_table).each(function () {
17
+ data.push(jQuery(this).text());
18
  });
19
 
20
  // Draw
21
+ var width = jQuery('#' + statify_chart_id).parent().width() + 8,
22
  height = 140,
23
  leftgutter = 0,
24
  bottomgutter = 22,
25
  topgutter = 22,
26
  color = '#0074a2',
27
+ r = Raphael(statify_chart_id, width, height),
28
  txt = {font: 'bold 12px "Open Sans", sans-serif', fill: "#333"},
29
  X = (width - leftgutter * 2) / labels.length,
30
  max = Math.max.apply(Math, data),
47
  is_label_visible = false,
48
  leave_timer,
49
  blanket = r.set();
50
+ label.push(r.text(60, 12, "7777 Pageviews").attr(txt));
51
  label.push(r.text(60, 27, "23.12.2013").attr(txt).attr({fill: color}));
52
  label.hide();
53
  var frame = r.popup(100, 100, label, "right").attr({fill: "#fff", stroke: "#444", "stroke-width": 1}).hide();
89
  ly = label[0].transform()[0][2] + ppp.dy;
90
  frame.show().stop().animate(anim);
91
 
92
+ label[0].attr({text: data + " " + ( data > 1 ? statify_translations.pageviews : statify_translations.pageview )}).show().stop().animateWith(frame, anim, {transform: ["t", lx, ly]}, 200 * is_label_visible);
93
  label[1].attr({text: lbl }).show().stop().animateWith(frame, anim, {transform: ["t", lx, ly]}, 200 * is_label_visible);
94
  dot.attr("r", 6);
95
  is_label_visible = true;
js/dashboard.min.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(){var q=[],h=[];jQuery("#statify_chart_data tfoot th").each(function(){q.push(jQuery(this).html())});jQuery("#statify_chart_data tbody td").each(function(){h.push(jQuery(this).html())});var t=jQuery("#statify_chart").parent().width()+8,f=Raphael("statify_chart",t,140),a={font:'bold 12px "Open Sans", sans-serif',fill:"#333"},g=(t-0)/q.length,r=Math.max.apply(Math,h),u=96/r;f.text(16,16,r).attr({font:'normal 10px "Open Sans", sans-serif',fill:"#bbb"});var r=f.path().attr({stroke:"#0074a2",
2
- "stroke-width":2,"stroke-linejoin":"round"}),z=f.path().attr({stroke:"none",opacity:0.3,fill:"#0074a2"}),e=f.set(),v=0,w=0,p=!1,x,s=f.set();e.push(f.text(60,12,"7777 Aufrufe").attr(a));e.push(f.text(60,27,"23.12.2013").attr(a).attr({fill:"#0074a2"}));e.hide();for(var l=f.popup(100,100,e,"right").attr({fill:"#fff",stroke:"#444","stroke-width":1}).hide(),m,n,a=0,y=q.length;a<y;a++){var c=Math.round(118-u*h[a]),b=Math.round(0+g*(a+0.5));a||(m=["M",b,c,"C",b,c],n=["M",0+0.5*g,118,"L",b,c,"C",b,c]);if(a&&
3
- a<y-1){var d=Math.round(118-u*h[a-1]),A=Math.round(0+g*(a-0.5)),B=Math.round(118-u*h[a+1]),C=Math.round(0+g*(a+1.5)),d=getAnchors(A,d,b,c,C,B);m=m.concat([d.x1,d.y1,b,c,d.x2,d.y2]);n=n.concat([d.x1,d.y1,b,c,d.x2,d.y2])}d=f.circle(b,c,4).attr({fill:"#fff",stroke:"#0074a2","stroke-width":1});s.push(f.rect(0+g*a,0,g,118).attr({stroke:"none",fill:"#fff",opacity:0.2}));var D=s[s.length-1];(function(a,b,c,d,h){D.hover(function(){clearTimeout(x);var k="right";a+l.getBBox().width>t&&(k="left");var k=f.popup(a,
4
- b,e,k,1),g=Raphael.animation({path:k.path,transform:["t",k.dx,k.dy]},200*p);v=e[0].transform()[0][1]+k.dx;w=e[0].transform()[0][2]+k.dy;l.show().stop().animate(g);e[0].attr({text:c+" Aufrufe"}).show().stop().animateWith(l,g,{transform:["t",v,w]},200*p);e[1].attr({text:d}).show().stop().animateWith(l,g,{transform:["t",v,w]},200*p);h.attr("r",6);p=!0},function(){h.attr("r",4);x=setTimeout(function(){l.hide();e[0].hide();e[1].hide();p=!1},1)})})(b,c,h[a],q[a],d)}m=m.concat([b,c,b,c]);n=n.concat([b,c,
5
- b,c,"L",b,118,"z"]);r.attr({path:m});z.attr({path:n});l.toFront();e[0].toFront();e[1].toFront();s.toFront()})();
1
+ (function(){var q=[],h=[],e=jQuery("#statify_chart_data");if(e.length){jQuery("th",e).each(function(){q.push(jQuery(this).text())});jQuery("td",e).each(function(){h.push(jQuery(this).text())});var u=jQuery("#statify_chart").parent().width()+8,g=Raphael("statify_chart",u,140),a={font:'bold 12px "Open Sans", sans-serif',fill:"#333"},e=(u-0)/q.length,r=Math.max.apply(Math,h),v=96/r;g.text(16,16,r).attr({font:'normal 10px "Open Sans", sans-serif',fill:"#bbb"});var r=g.path().attr({stroke:"#0074a2","stroke-width":2,
2
+ "stroke-linejoin":"round"}),A=g.path().attr({stroke:"none",opacity:.3,fill:"#0074a2"}),f=g.set(),w=0,x=0,p=!1,y,t=g.set();f.push(g.text(60,12,"7777 Pageviews").attr(a));f.push(g.text(60,27,"23.12.2013").attr(a).attr({fill:"#0074a2"}));f.hide();for(var l=g.popup(100,100,f,"right").attr({fill:"#fff",stroke:"#444","stroke-width":1}).hide(),m,n,a=0,z=q.length;a<z;a++){var b=Math.round(118-v*h[a]),c=Math.round(0+e*(a+.5));a||(m=["M",c,b,"C",c,b],n=["M",0+.5*e,118,"L",c,b,"C",c,b]);if(a&&a<z-1){var d=Math.round(118-
3
+ v*h[a-1]),B=Math.round(0+e*(a-.5)),C=Math.round(118-v*h[a+1]),D=Math.round(0+e*(a+1.5)),d=getAnchors(B,d,c,b,D,C);m=m.concat([d.x1,d.y1,c,b,d.x2,d.y2]);n=n.concat([d.x1,d.y1,c,b,d.x2,d.y2])}d=g.circle(c,b,4).attr({fill:"#fff",stroke:"#0074a2","stroke-width":1});t.push(g.rect(0+e*a,0,e,118).attr({stroke:"none",fill:"#fff",opacity:.2}));var E=t[t.length-1];(function(a,c,b,d,e){E.hover(function(){clearTimeout(y);var k="right";a+l.getBBox().width>u&&(k="left");var k=g.popup(a,c,f,k,1),h=Raphael.animation({path:k.path,
4
+ transform:["t",k.dx,k.dy]},200*p);w=f[0].transform()[0][1]+k.dx;x=f[0].transform()[0][2]+k.dy;l.show().stop().animate(h);f[0].attr({text:b+" "+(1<b?statify_translations.pageviews:statify_translations.pageview)}).show().stop().animateWith(l,h,{transform:["t",w,x]},200*p);f[1].attr({text:d}).show().stop().animateWith(l,h,{transform:["t",w,x]},200*p);e.attr("r",6);p=!0},function(){e.attr("r",4);y=setTimeout(function(){l.hide();f[0].hide();f[1].hide();p=!1},1)})})(c,b,h[a],q[a],d)}m=m.concat([c,b,c,b]);
5
+ n=n.concat([c,b,c,b,"L",c,118,"z"]);r.attr({path:m});A.attr({path:n});l.toFront();f[0].toFront();f[1].toFront();t.toFront()}})();
js/raphael.helper.js CHANGED
@@ -1,142 +1,142 @@
1
  var tokenRegex = /\{([^\}]+)\}/g,
2
- objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,
3
- replacer = function (all, key, obj) {
4
- var res = obj;
5
- key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) {
6
- name = name || quotedName;
7
- if (res) {
8
- if (name in res) {
9
- res = res[name];
10
- }
11
- typeof res == "function" && isFunc && (res = res());
12
- }
13
- });
14
- res = (res == null || res == obj ? all : res) + "";
15
- return res;
16
- },
17
- fill = function (str, obj) {
18
- return String(str).replace(tokenRegex, function (all, key) {
19
- return replacer(all, key, obj);
20
- });
21
- };
22
 
23
 
24
  Raphael.fn.popup = function (X, Y, set, pos, ret) {
25
- pos = String(pos || "top-middle").split("-");
26
- pos[1] = pos[1] || "middle";
27
- var r = 5,
28
- bb = set.getBBox(),
29
- w = Math.round(bb.width),
30
- h = Math.round(bb.height),
31
- x = Math.round(bb.x) - r,
32
- y = Math.round(bb.y) - r,
33
- gap = Math.min(h / 2, w / 2, 10),
34
- shapes = {
35
- top: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}l-{right},0-{gap},{gap}-{gap}-{gap}-{left},0a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z",
36
- bottom: "M{x},{y}l{left},0,{gap}-{gap},{gap},{gap},{right},0a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z",
37
- right: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}l0-{bottom}-{gap}-{gap},{gap}-{gap},0-{top}a{r},{r},0,0,1,{r}-{r}z",
38
- left: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}l0,{top},{gap},{gap}-{gap},{gap},0,{bottom}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z"
39
- },
40
- offset = {
41
- hx0: X - (x + r + w - gap * 2),
42
- hx1: X - (x + r + w / 2 - gap),
43
- hx2: X - (x + r + gap),
44
- vhy: Y - (y + r + h + r + gap),
45
- "^hy": Y - (y - gap)
46
 
47
- },
48
- mask = [{
49
- x: x + r,
50
- y: y,
51
- w: w,
52
- w4: w / 4,
53
- h4: h / 4,
54
- right: 0,
55
- left: w - gap * 2,
56
- bottom: 0,
57
- top: h - gap * 2,
58
- r: r,
59
- h: h,
60
- gap: gap
61
- }, {
62
- x: x + r,
63
- y: y,
64
- w: w,
65
- w4: w / 4,
66
- h4: h / 4,
67
- left: w / 2 - gap,
68
- right: w / 2 - gap,
69
- top: h / 2 - gap,
70
- bottom: h / 2 - gap,
71
- r: r,
72
- h: h,
73
- gap: gap
74
- }, {
75
- x: x + r,
76
- y: y,
77
- w: w,
78
- w4: w / 4,
79
- h4: h / 4,
80
- left: 0,
81
- right: w - gap * 2,
82
- top: 0,
83
- bottom: h - gap * 2,
84
- r: r,
85
- h: h,
86
- gap: gap
87
- }][pos[1] == "middle" ? 1 : (pos[1] == "top" || pos[1] == "left") * 2];
88
- var dx = 0,
89
- dy = 0,
90
- out = this.path(fill(shapes[pos[0]], mask)).insertBefore(set);
91
- switch (pos[0]) {
92
- case "top":
93
- dx = X - (x + r + mask.left + gap);
94
- dy = Y - (y + r + h + r + gap);
95
- break;
96
- case "bottom":
97
- dx = X - (x + r + mask.left + gap);
98
- dy = Y - (y - gap);
99
- break;
100
- case "left":
101
- dx = X - (x + r + w + r + gap);
102
- dy = Y - (y + r + mask.top + gap);
103
- break;
104
- case "right":
105
- dx = X - (x - gap);
106
- dy = Y - (y + r + mask.top + gap);
107
- break;
108
- }
109
- out.translate(dx, dy);
110
- if (ret) {
111
- ret = out.attr("path");
112
- out.remove();
113
- return {
114
- path: ret,
115
- dx: dx,
116
- dy: dy
117
- };
118
- }
119
- set.translate(dx, dy);
120
- return out;
121
  };
122
 
123
 
124
  function getAnchors(p1x, p1y, p2x, p2y, p3x, p3y) {
125
- var l1 = (p2x - p1x) / 2,
126
- l2 = (p3x - p2x) / 2,
127
- a = Math.atan((p2x - p1x) / Math.abs(p2y - p1y)),
128
- b = Math.atan((p3x - p2x) / Math.abs(p2y - p3y));
129
- a = p1y < p2y ? Math.PI - a : a;
130
- b = p3y < p2y ? Math.PI - b : b;
131
- var alpha = Math.PI / 2 - ((a + b) % (Math.PI * 2)) / 2,
132
- dx1 = l1 * Math.sin(alpha + a),
133
- dy1 = l1 * Math.cos(alpha + a),
134
- dx2 = l2 * Math.sin(alpha + b),
135
- dy2 = l2 * Math.cos(alpha + b);
136
- return {
137
- x1: p2x - dx1,
138
- y1: p2y + dy1,
139
- x2: p2x + dx2,
140
- y2: p2y + dy2
141
- };
142
  }
1
  var tokenRegex = /\{([^\}]+)\}/g,
2
+ objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,
3
+ replacer = function (all, key, obj) {
4
+ var res = obj;
5
+ key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) {
6
+ name = name || quotedName;
7
+ if (res) {
8
+ if (name in res) {
9
+ res = res[name];
10
+ }
11
+ typeof res == "function" && isFunc && (res = res());
12
+ }
13
+ });
14
+ res = (res == null || res == obj ? all : res) + "";
15
+ return res;
16
+ },
17
+ fill = function (str, obj) {
18
+ return String(str).replace(tokenRegex, function (all, key) {
19
+ return replacer(all, key, obj);
20
+ });
21
+ };
22
 
23
 
24
  Raphael.fn.popup = function (X, Y, set, pos, ret) {
25
+ pos = String(pos || "top-middle").split("-");
26
+ pos[1] = pos[1] || "middle";
27
+ var r = 5,
28
+ bb = set.getBBox(),
29
+ w = Math.round(bb.width),
30
+ h = Math.round(bb.height),
31
+ x = Math.round(bb.x) - r,
32
+ y = Math.round(bb.y) - r,
33
+ gap = Math.min(h / 2, w / 2, 10),
34
+ shapes = {
35
+ top: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}l-{right},0-{gap},{gap}-{gap}-{gap}-{left},0a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z",
36
+ bottom: "M{x},{y}l{left},0,{gap}-{gap},{gap},{gap},{right},0a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z",
37
+ right: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}l0-{bottom}-{gap}-{gap},{gap}-{gap},0-{top}a{r},{r},0,0,1,{r}-{r}z",
38
+ left: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}l0,{top},{gap},{gap}-{gap},{gap},0,{bottom}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z"
39
+ },
40
+ offset = {
41
+ hx0: X - (x + r + w - gap * 2),
42
+ hx1: X - (x + r + w / 2 - gap),
43
+ hx2: X - (x + r + gap),
44
+ vhy: Y - (y + r + h + r + gap),
45
+ "^hy": Y - (y - gap)
46
 
47
+ },
48
+ mask = [{
49
+ x: x + r,
50
+ y: y,
51
+ w: w,
52
+ w4: w / 4,
53
+ h4: h / 4,
54
+ right: 0,
55
+ left: w - gap * 2,
56
+ bottom: 0,
57
+ top: h - gap * 2,
58
+ r: r,
59
+ h: h,
60
+ gap: gap
61
+ }, {
62
+ x: x + r,
63
+ y: y,
64
+ w: w,
65
+ w4: w / 4,
66
+ h4: h / 4,
67
+ left: w / 2 - gap,
68
+ right: w / 2 - gap,
69
+ top: h / 2 - gap,
70
+ bottom: h / 2 - gap,
71
+ r: r,
72
+ h: h,
73
+ gap: gap
74
+ }, {
75
+ x: x + r,
76
+ y: y,
77
+ w: w,
78
+ w4: w / 4,
79
+ h4: h / 4,
80
+ left: 0,
81
+ right: w - gap * 2,
82
+ top: 0,
83
+ bottom: h - gap * 2,
84
+ r: r,
85
+ h: h,
86
+ gap: gap
87
+ }][pos[1] == "middle" ? 1 : (pos[1] == "top" || pos[1] == "left") * 2];
88
+ var dx = 0,
89
+ dy = 0,
90
+ out = this.path(fill(shapes[pos[0]], mask)).insertBefore(set);
91
+ switch (pos[0]) {
92
+ case "top":
93
+ dx = X - (x + r + mask.left + gap);
94
+ dy = Y - (y + r + h + r + gap);
95
+ break;
96
+ case "bottom":
97
+ dx = X - (x + r + mask.left + gap);
98
+ dy = Y - (y - gap);
99
+ break;
100
+ case "left":
101
+ dx = X - (x + r + w + r + gap);
102
+ dy = Y - (y + r + mask.top + gap);
103
+ break;
104
+ case "right":
105
+ dx = X - (x - gap);
106
+ dy = Y - (y + r + mask.top + gap);
107
+ break;
108
+ }
109
+ out.translate(dx, dy);
110
+ if (ret) {
111
+ ret = out.attr("path");
112
+ out.remove();
113
+ return {
114
+ path: ret,
115
+ dx: dx,
116
+ dy: dy
117
+ };
118
+ }
119
+ set.translate(dx, dy);
120
+ return out;
121
  };
122
 
123
 
124
  function getAnchors(p1x, p1y, p2x, p2y, p3x, p3y) {
125
+ var l1 = (p2x - p1x) / 2,
126
+ l2 = (p3x - p2x) / 2,
127
+ a = Math.atan((p2x - p1x) / Math.abs(p2y - p1y)),
128
+ b = Math.atan((p3x - p2x) / Math.abs(p2y - p3y));
129
+ a = p1y < p2y ? Math.PI - a : a;
130
+ b = p3y < p2y ? Math.PI - b : b;
131
+ var alpha = Math.PI / 2 - ((a + b) % (Math.PI * 2)) / 2,
132
+ dx1 = l1 * Math.sin(alpha + a),
133
+ dy1 = l1 * Math.cos(alpha + a),
134
+ dx2 = l2 * Math.sin(alpha + b),
135
+ dy2 = l2 * Math.cos(alpha + b);
136
+ return {
137
+ x1: p2x - dx1,
138
+ y1: p2y + dy1,
139
+ x2: p2x + dx2,
140
+ y2: p2y + dy2
141
+ };
142
  }
lang/statify-de_DE.mo ADDED
Binary file
lang/statify-de_DE.po ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Statify\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: \n"
6
+ "Last-Translator: Sergej Müller\n"
7
+ "Language-Team: Sergej Müller\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-SourceCharset: utf-8\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "Language: de_DE\n"
16
+ "X-Generator: Poedit 1.7.5\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ msgid "Compact, easy-to-use and privacy-compliant stats plugin for WordPress."
20
+ msgstr "Kompakte, anwendungsfreundliche und datenschutzkonforme Statistik für WordPress."
21
+
22
+ msgid "No data available."
23
+ msgstr "Keine Daten verfügbar."
24
+
25
+ msgid "Top targets"
26
+ msgstr "Beste Inhalte"
27
+
28
+ msgid "Top referers"
29
+ msgstr "Beste Quellen"
30
+
31
+ msgid "Period of data saving"
32
+ msgstr "Zeitraum der Aufbewahrung"
33
+
34
+ msgid "Number of entries in top lists"
35
+ msgstr "Anzahl der Einträge in der Bestenliste"
36
+
37
+ msgid "Entries in top lists only for today"
38
+ msgstr "Einträge in der Bestenliste nur von heute"
39
+
40
+ msgid "Page tracking via JavaScript"
41
+ msgstr "Seitenzählung via JavaScript"
42
+
43
+ msgid "recommended if caching is in use"
44
+ msgstr "empfohlen bei aktivem Caching"
45
+
46
+ msgid "Pageview"
47
+ msgstr "Aufruf"
48
+
49
+ msgid "days"
50
+ msgstr "Tage"
51
+
52
+ msgid "Pageviews"
53
+ msgstr "Aufrufe"
lang/statify-ru_RU.mo ADDED
Binary file
lang/statify-ru_RU.po ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Statify\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: \n"
6
+ "Last-Translator: Sergej Müller\n"
7
+ "Language-Team: Sergej Müller\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-SourceCharset: utf-8\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "Language: de_DE\n"
16
+ "X-Generator: Poedit 1.7.5\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ msgid "Compact, easy-to-use and privacy-compliant stats plugin for WordPress."
20
+ msgstr "Компактный и простой в использовании плагин для статистики в WordPress."
21
+
22
+ msgid "No data available."
23
+ msgstr "Данные отсутствуют."
24
+
25
+ msgid "Top targets"
26
+ msgstr "Топ цели"
27
+
28
+ msgid "Top referers"
29
+ msgstr "Топ рефереров"
30
+
31
+ msgid "Period of data saving"
32
+ msgstr "Период сохранения данных"
33
+
34
+ msgid "Number of entries in top lists"
35
+ msgstr "Количество записей в ТОП-листах"
36
+
37
+ msgid "Entries in top lists only for today"
38
+ msgstr "Записи в ТОП-листах только за сегодня"
39
+
40
+ msgid "Page tracking via JavaScript"
41
+ msgstr "Отслеживание через JavaScript"
42
+
43
+ msgid "recommended if caching is in use"
44
+ msgstr "при кэширование страниц"
45
+
46
+ msgid "Pageview"
47
+ msgstr "Просмотр"
48
+
49
+ msgid "Pageviews"
50
+ msgstr "Просмотров"
51
+
52
+ msgid "days"
53
+ msgstr "дней"
readme.txt CHANGED
@@ -1,150 +1,151 @@
1
  === Statify ===
2
  Contributors: sergej.mueller
3
  Tags: stats, analytics, privacy, dashboard
4
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RDDW9FEHGLG6
5
- Requires at least: 3.8
6
- Tested up to: 3.9
7
  Stable tag: trunk
 
 
8
 
9
 
10
 
11
- Besucherstatistik in WordPress mit Schwerpunkten Datenschutz, Transparenz und Übersichtlichkeit. Ideal für Dashboard.
12
 
13
 
14
 
15
  == Description ==
 
16
 
17
- Das kostenlose Plugin *Statify* verfolgt ein simples Ziel: Zugriffszahlen der WordPress-Website blitzschnell und kompakt zugänglich machen. Ohne Schnickschnack. Ohne meterlange Datenschutzerklärungen.
18
 
 
19
 
20
- = Dashboard-Widget =
21
- Weniger ist mehr: Den aktuellen Verlauf der Seitenaufrufe präsentiert das Statistik-Plugin in Form eines interaktiven Diagramms, siehe [Screenshots](https://wordpress.org/plugins/statify/screenshots/). Der Zeitskala folgen eine Liste mit den häufigsten Verweisquellen (Referrer) und den meist aufgerufenen Zielseiten (Target) im Blog. Praktisch: Der Statistikzeitraum sowie die Listenlänge lassen sich direkt im Dashboard-Widget konfigurieren.
22
 
23
 
24
- = Datenschutz =
25
- In unmittelbarem Vergleich zu Statistik-Diensten wie *Google Analytics*, *WordPress.com Stats* und *Piwik* verarbeitet und speichert *Statify* keinerlei personenbezogene Daten wie z.B. IP-Adressen – *Statify* zählt Seitenaufrufe, keine Besucher. Absolute Datenschutzkonformität gepaart mit transparenter Arbeitsweise: Eine lokal in WordPress angelegte Datenbanktabelle besteht aus nur 4 Feldern (ID, Datum, Quelle, Ziel) und kann vom Administrator jederzeit eingesehen, bereinigt und geleert werden.
26
 
 
27
 
28
- = Filter =
29
- *Statify* protokolliert jeden Seitenaufruf im WordPress-Frontend. Ausgeschlossen sind Preview-, Feed-, Ressourcen-Ansichten und Zugriffe durch angemeldete Nutzer. Mehr Einzelheiten zu Optionen und Funktionen im [Online-Handbuch](http://playground.ebiene.de/statify-wordpress-statistik/).
30
 
 
 
31
 
32
- = Caching-Plugins =
33
- Für die Kompatibilität mit Caching-Plugins wie [Cachify](http://wordpress.org/extend/plugins/cachify/) verfügt *Statify* über ein optional zuschaltbares Tracking via JavaScript-Snippet. Diese Methode erlaubt eine zuverlässige Zählung der gecachten Blogseiten.
34
 
35
-
36
- > #### Statify Chrome App
37
- > Speziell für Inhaber und Administratoren mehrerer WordPress-Projekte wurde eine App für Google Chrome entwickelt: [Statify Chrome App](http://playground.ebiene.de/statify-wordpress-statistik/#chrome_app) - *Statify*-Statistiken an einer Stelle im Browser gesammelt dargestellt. Ab sofort kein lästiges Aufrufen der einzelnen Dashboards mehr. Statistikberichte verknüpfter Blogs in einem Fenster.
38
-
39
-
40
- = Support =
41
- Freundlich formulierte (An)Fragen rund um das Plugin werden per E-Mail beantwortet.
42
-
43
-
44
- = Systemanforderungen =
45
  * PHP 5.2.4
46
- * WordPress ab 3.8
47
 
48
 
49
- = Unterstützung =
50
- * Per [Flattr](https://flattr.com/donation/give/to/sergej.mueller)
51
- * Per [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5RDDW9FEHGLG6)
52
 
53
 
54
- = Handbuch =
55
- * [Statify: Statistik für WordPress](http://playground.ebiene.de/statify-wordpress-statistik/)
 
 
56
 
57
 
58
- = Website =
59
- * [statify.de](http://statify.de)
 
60
 
61
 
62
- = Autor =
63
- * [Twitter](https://twitter.com/wpSEO "Sergej Müller auf Twitter")
64
- * [Google+](https://plus.google.com/110569673423509816572 "Sergej Müller auf Google+")
65
  * [Plugins](http://wpcoder.de "WordPress Plugins")
66
 
67
 
68
 
69
  == Changelog ==
70
 
71
- = 1.3.0 =
72
- * Sourcecode-Optimierung für die Plugin-Finalisierung
 
 
 
 
 
 
73
 
74
- = 1.2.8 =
75
- * JavaScript-Snippet: Relativer Pfad für HTTP(S)-Aufrufe
76
 
77
- = 1.2.7 =
78
- * Unterstützung zu WordPress 3.9
79
- * Korrektur der Dashboard-Links (wenn WordPress im Unterordner)
80
 
81
- = 1.2.6 =
82
- * Optimierung für WordPress 3.8
83
- * Steuerung des Trackings via `statify_skip_tracking`
84
 
85
- = 1.2.5 =
86
- * Umstellung der Diagramm-Software
87
 
88
- = 1.2.4 =
89
- * Kompatibilität zu WordPress 3.6
90
 
91
- = 1.2.3 =
92
- * Zusätzliche Absicherung der PHP-Klassen vor direkten Aufrufen
93
- * Ersatz für Deprecated [User Levels](http://codex.wordpress.org/Roles_and_Capabilities#User_Levels)
94
 
95
- = 1.2.2 =
96
- * No-Cache und No-Content Header für das optionale Zähl-JavaScript
97
 
98
- = 1.2.1 =
99
- * Zusätzliche Zeiträume (bis zu einem Jahr) für Statistik
100
- * WordPress 3.4 als Systemanforderung
101
 
102
- = 1.2 =
103
- * Speziell für Chrome-Browser entwickelte [Statify App](http://playground.ebiene.de/statify-wordpress-statistik/#chrome_app)
104
- * Fix für eingeführte XML-RPC-Schnittstelle
105
 
106
- = 1.1 =
107
  * WordPress 3.5 Support
108
- * Schnittstelle via XML-RPC
109
- * Refactoring der Code-Basis
110
- * Überarbeitung der Online-Dokumentation
111
- * Optionales Tracking via JavaScript für Caching-Plugins
112
 
113
- = 1.0 =
114
  * WordPress 3.4 Support
115
- * [Offizielle Plugin-Website](http://statify.de "Statify WordPress Stats")
116
- * Unkomprimierte Version des Source Codes
117
 
118
- = 0.9 =
119
  * Xmas Edition
120
 
121
- = 0.8 =
122
- * Unterstützung für WordPress 3.3
123
- * Anzeige des Dashboard-Widgets auch für Autoren
124
- * Direkter Link zu den Einstellungen auf dem Dashboard
125
- * Filterung der Ziele/Referrer auf den aktuellen Tag
126
 
127
- = 0.7 =
128
- * Umsortierung der Statistiktage
129
- * Umfärbung der Statistikmarkierung
130
- * Ignorierung der XMLRPC-Requests
131
 
132
- = 0.6 =
133
- * WordPress 3.2 Unterstützung
134
- * Support für WordPress Multisite
135
- * Bereinigung überflüssiger URL-Parameter bei Zielseiten
136
- * Interaktive Statistik mit weiterführenden Informationen
137
 
138
- = 0.5 =
139
- * Fix: Abfrage für fehlende Referrer im Dashboard Widget
140
 
141
- = 0.4 =
142
- * Statify geht online
143
 
144
 
145
 
146
  == Screenshots ==
147
 
148
- 1. Statify Dashboard Widget
149
- 2. Statify Dashboard Widget Optionen
150
- 2. Statify Chrome App
1
  === Statify ===
2
  Contributors: sergej.mueller
3
  Tags: stats, analytics, privacy, dashboard
4
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZAQUT9RLPW8QN
5
+ Requires at least: 3.9
6
+ Tested up to: 4.2
7
  Stable tag: trunk
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
 
12
 
13
+ Visitor statistics for WordPress with focus on data protection, transparancy and clarity. Perfect as a widget in your Dashboard.
14
 
15
 
16
 
17
  == Description ==
18
+ The free and add-free plugin [Statify](http://statify.de) pursues a simple objective: to provide a straightforward and compact access to the number of site views.
19
 
20
+ No frills. No Cookies. No third party. No storage of personal data. No endless data privacy statements.
21
 
22
+ An interactive chart is followed by lists of the most common reference sources and target pages. The period of statistics and length of lists can be set directly in the dashboard widget.
23
 
24
+ > For German users: [Plugin-Beschreibung in Deutsch](https://github.com/sergejmueller/statify)
 
25
 
26
 
27
+ = Data Privacy =
28
+ In direct comparison to statistics services such as *Google Analytics*, *WordPress.com Stats* and *Piwik* *Statify* doesn't process and store personal data as e.g. IP addresses – *Statify* counts site views, not visitors.
29
 
30
+ Absolute privacy compliance coupled with transparent procedures: A locally in WordPress created database table consists of only 4 fields (ID, date, source, target) and can be viewed at any time, cleaned up and cleared by the administrator.
31
 
 
 
32
 
33
+ = Compatibility =
34
+ For compatibility with caching plugins like [Cachify](http://cachify.de) *Statify* offers an optional switchable tracking via JavaScript. This function allows reliable count of cached blog pages.
35
 
 
 
36
 
37
+ = Requirements =
 
 
 
 
 
 
 
 
 
38
  * PHP 5.2.4
39
+ * WordPress 3.9
40
 
41
 
42
+ = Memory Usage =
43
+ * Backend: ~ 0,2 MB
44
+ * Frontend: ~ 0,1 MB
45
 
46
 
47
+ = Languages =
48
+ * German
49
+ * English
50
+ * Русский
51
 
52
 
53
+ = Contributors =
54
+ * [Caspar Hübinger](http://glueckpress.com)
55
+ * [Bego Mario Garde](https://garde-medienberatung.de)
56
 
57
 
58
+ = Author =
59
+ * [Twitter](https://twitter.com/wpSEO)
60
+ * [Google+](https://plus.google.com/110569673423509816572)
61
  * [Plugins](http://wpcoder.de "WordPress Plugins")
62
 
63
 
64
 
65
  == Changelog ==
66
 
67
+ = 1.4.0 / 16.04.2014 =
68
+ * WordPress 4.2 support
69
+ * Plugin-wide code refactoring
70
+ * Translations for English and Russian
71
+ * [GitHub Repository](https://github.com/sergejmueller/statify)
72
+
73
+ = 1.3.0 / 28.04.2014 =
74
+ * Sourcecode optimization for plugin-finalization
75
 
76
+ = 1.2.8 / 19.04.2014 =
77
+ * JavaScript-Snippet: Relative Path for HTTP(S)-calls
78
 
79
+ = 1.2.7 / 09.04.2014 =
80
+ * Support for WordPress 3.9
81
+ * Correction of dashboard links (if WordPress is in subfolder)
82
 
83
+ = 1.2.6 / 12.12.2013 =
84
+ * Optimization for WordPress 3.8
85
+ * Control of tracking via `statify_skip_tracking`
86
 
87
+ = 1.2.5 / 22.08.2013 =
88
+ * Migration of chart-software
89
 
90
+ = 1.2.4 / 06.08.2013 =
91
+ * Compatibility to WordPress 3.6
92
 
93
+ = 1.2.3 / 06.06.2013 =
94
+ * Additional protection of PHP classes against direct access
95
+ * Replacement for Deprecated [User Levels](http://codex.wordpress.org/Roles_and_Capabilities#User_Levels)
96
 
97
+ = 1.2.2 / 14.03.2013 =
98
+ * No-Cache and No-Content Header for optional Count JavaScript
99
 
100
+ = 1.2.1 / 18.12.2012 =
101
+ * Additional periods (up to one year) for statistics
102
+ * WordPress 3.4 as requirement
103
 
104
+ = 1.2 / 29.11.2012 =
105
+ * Spezially for Chrome Browser developped [Statify App](http://playground.ebiene.de/statify-wordpress-statistik/#chrome_app)
106
+ * Fix for introduced XML-RPC-interface
107
 
108
+ = 1.1 / 23.11.2012 =
109
  * WordPress 3.5 Support
110
+ * Interface via XML-RPC
111
+ * Refactoring of Code Base
112
+ * Revision of Online Documentation
113
+ * Optional Tracking via JavaScript for Caching-Plugins
114
 
115
+ = 1.0 / 12.06.2012 =
116
  * WordPress 3.4 Support
117
+ * [Official Plugin Website](http://statify.de "Statify WordPress Stats")
118
+ * Uncompressed Version of Source Codes
119
 
120
+ = 0.9 / 23.12.2011 =
121
  * Xmas Edition
122
 
123
+ = 0.8 / 14.12.2011 =
124
+ * Support für WordPress 3.3
125
+ * Display of Dashboard Widgets also for authors
126
+ * Direct Link to settings on dashboard
127
+ * Filtering der Targets/Referrer on the current date
128
 
129
+ = 0.7 / 05.07.2011 =
130
+ * Replacement of Statistic Days
131
+ * Recolouring of Statistics Mark
132
+ * Ignoring XML-RPC-Requests
133
 
134
+ = 0.6 / 22.06.2011 =
135
+ * Support for WordPress 3.2
136
+ * Support for WordPress Multisite
137
+ * Adjustment of redundant URL parameters of target pages
138
+ * Interaktive Statistics with further informations
139
 
140
+ = 0.5 / 15.05.2011 =
141
+ * Fix: query for missing referrer in dashboard widget
142
 
143
+ = 0.4 / 16.03.2011 =
144
+ * Statify goes online
145
 
146
 
147
 
148
  == Screenshots ==
149
 
150
+ 1. Statify dashboard widget
151
+ 2. Statify dashboard widget options
 
statify.php CHANGED
@@ -1,11 +1,32 @@
1
  <?php
2
  /*
3
  Plugin Name: Statify
4
- Description: Kompakte, begreifliche und datenschutzkonforme Statistik für WordPress.
 
 
5
  Author: Sergej M&uuml;ller
6
  Author URI: http://wpcoder.de
7
  Plugin URI: http://statify.de
8
- Version: 1.3.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  */
10
 
11
 
@@ -13,8 +34,9 @@ Version: 1.3.0
13
  defined('ABSPATH') OR exit;
14
 
15
 
16
- /* Konstanten */
17
  define('STATIFY_FILE', __FILE__);
 
18
  define('STATIFY_BASE', plugin_basename(__FILE__));
19
 
20
 
@@ -27,14 +49,21 @@ add_action(
27
  )
28
  );
29
  register_activation_hook(
30
- __FILE__,
31
  array(
32
  'Statify_Install',
33
  'init'
34
  )
35
  );
 
 
 
 
 
 
 
36
  register_uninstall_hook(
37
- __FILE__,
38
  array(
39
  'Statify_Uninstall',
40
  'init'
@@ -42,18 +71,30 @@ register_uninstall_hook(
42
  );
43
 
44
 
45
- /* Autoload Init */
46
  spl_autoload_register('statify_autoload');
47
 
48
- /* Autoload Funktion */
49
  function statify_autoload($class) {
50
- if ( in_array($class, array('Statify', 'Statify_Dashboard', 'Statify_Install', 'Statify_Uninstall', 'Statify_Table', 'Statify_XMLRPC')) ) {
51
- require_once(
52
- sprintf(
53
- '%s/inc/%s.class.php',
54
- dirname(__FILE__),
55
- strtolower($class)
56
- )
57
- );
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
1
  <?php
2
  /*
3
  Plugin Name: Statify
4
+ Description: Compact, easy-to-use and privacy-compliant stats plugin for WordPress.
5
+ Text Domain: statify
6
+ Domain Path: /lang
7
  Author: Sergej M&uuml;ller
8
  Author URI: http://wpcoder.de
9
  Plugin URI: http://statify.de
10
+ License: GPLv2 or later
11
+ Version: 1.4.0
12
+ */
13
+
14
+ /*
15
+ Copyright (C) 2011-2015 Sergej Müller
16
+
17
+ This program is free software; you can redistribute it and/or modify
18
+ it under the terms of the GNU General Public License as published by
19
+ the Free Software Foundation; either version 2 of the License, or
20
+ (at your option) any later version.
21
+
22
+ This program is distributed in the hope that it will be useful,
23
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ GNU General Public License for more details.
26
+
27
+ You should have received a copy of the GNU General Public License along
28
+ with this program; if not, write to the Free Software Foundation, Inc.,
29
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30
  */
31
 
32
 
34
  defined('ABSPATH') OR exit;
35
 
36
 
37
+ /* Constants */
38
  define('STATIFY_FILE', __FILE__);
39
+ define('STATIFY_DIR', dirname(__FILE__));
40
  define('STATIFY_BASE', plugin_basename(__FILE__));
41
 
42
 
49
  )
50
  );
51
  register_activation_hook(
52
+ STATIFY_FILE,
53
  array(
54
  'Statify_Install',
55
  'init'
56
  )
57
  );
58
+ register_deactivation_hook(
59
+ STATIFY_FILE,
60
+ array(
61
+ 'Statify_Deactivate',
62
+ 'init'
63
+ )
64
+ );
65
  register_uninstall_hook(
66
+ STATIFY_FILE,
67
  array(
68
  'Statify_Uninstall',
69
  'init'
71
  );
72
 
73
 
74
+ /* Autoload */
75
  spl_autoload_register('statify_autoload');
76
 
 
77
  function statify_autoload($class) {
78
+ $plugin_classes = array(
79
+ 'Statify',
80
+ 'Statify_Backend',
81
+ 'Statify_Frontend',
82
+ 'Statify_Dashboard',
83
+ 'Statify_Install',
84
+ 'Statify_Uninstall',
85
+ 'Statify_Deactivate',
86
+ 'Statify_Table',
87
+ 'Statify_XMLRPC',
88
+ 'Statify_Cron'
89
+ );
90
+
91
+ if ( in_array($class, $plugin_classes) ) {
92
+ require_once(
93
+ sprintf(
94
+ '%s/inc/%s.class.php',
95
+ STATIFY_DIR,
96
+ strtolower($class)
97
+ )
98
+ );
99
+ }
100
  }
views/js_snippet.view.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ class_exists('Statify') OR exit; ?>
6
+
7
+
8
+ <!-- Stats by http://statify.de -->
9
+ <script type="text/javascript">
10
+ (function() {
11
+ var e = document.createElement('script'),
12
+ s = document.getElementsByTagName('script')[0],
13
+ r = encodeURIComponent(document.referrer),
14
+ t = encodeURIComponent(location.pathname),
15
+ p = '?statify_referrer=' + r + '&statify_target=' + t;
16
+
17
+ e.async = true;
18
+ e.type = 'text/javascript';
19
+ e.src = "<?php echo home_url('/', 'relative'); ?>" + p;
20
+
21
+ s.parentNode.insertBefore(e, s);
22
+ })();
23
+ </script>
24
+
25
+
26
+ <?php /* Markup space */ ?>
views/widget_back.view.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ class_exists('Statify') OR exit; ?>
6
+
7
+
8
+ <table class="form-table">
9
+ <tr valign="top">
10
+ <td>
11
+ <fieldset>
12
+ <label for="statify_days">
13
+ <select name="statify[days]" id="statify_days">
14
+ <?php foreach( array(7, 14, 21, 30, 84, 183, 365) as $days ) { ?>
15
+ <option value="<?php echo $days ?>" <?php selected( Statify::$_options['days'], $days ); ?>>
16
+ <?php echo sprintf( '%d %s', $days, esc_html__('days', 'statify') ); ?>
17
+ </option>
18
+ <?php } ?>
19
+ </select>
20
+ <?php esc_html_e('Period of data saving', 'statify'); ?>
21
+ </label>
22
+
23
+ <label for="statify_limit">
24
+ <select name="statify[limit]" id="statify_limit">
25
+ <?php foreach( range(0, 12) as $amount ) { ?>
26
+ <option <?php selected( Statify::$_options['limit'], $amount ); ?>>
27
+ <?php echo $amount; ?>
28
+ </option>
29
+ <?php } ?>
30
+ </select>
31
+ <?php esc_html_e('Number of entries in top lists', 'statify'); ?>
32
+ </label>
33
+
34
+ <label for="statify_today">
35
+ <input type="checkbox" name="statify[today]" id="statify_today" value="1" <?php checked( Statify::$_options['today'], 1 ); ?> />
36
+ <?php esc_html_e('Entries in top lists only for today', 'statify'); ?>
37
+ </label>
38
+
39
+ <label for="statify_snippet">
40
+ <input type="checkbox" name="statify[snippet]" id="statify_snippet" value="1" <?php checked( Statify::$_options['snippet'], 1 ); ?> />
41
+ <?php esc_html_e('Page tracking via JavaScript', 'statify'); ?>
42
+ <small>(<?php esc_html_e('recommended if caching is in use', 'statify'); ?>)</small>
43
+ </label>
44
+ </fieldset>
45
+ </td>
46
+ </tr>
47
+ </table>
48
+
49
+
50
+ <p class="meta-links">
51
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=ZAQUT9RLPW8QN" target="_blank">PayPal</a> &bull;
52
+ <a href="https://flattr.com/t/1733733" target="_blank">Flattr</a> &bull;
53
+ <a href="https://github.com/sergejmueller/statify/wiki" target="_blank">Wiki</a>
54
+ </p>
views/widget_front.view.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Quit */
5
+ class_exists('Statify') OR exit;
6
+
7
+
8
+ /* Get stats */
9
+ $stats = Statify_Dashboard::get_stats(); ?>
10
+
11
+
12
+ <div id="statify_chart">
13
+ <?php if ( empty($stats['visits']) ) { ?>
14
+ <p>
15
+ <?php esc_html_e('No data available.', 'statify'); ?>
16
+ </p>
17
+ <?php } else { ?>
18
+ <table id="statify_chart_data">
19
+ <?php foreach( $stats['visits'] as $visit ) { ?>
20
+ <tr>
21
+ <th><?php echo date_i18n( get_option('date_format'), strtotime($visit['date']) ); ?></th>
22
+ <td><?php echo intval($visit['count']); ?></td>
23
+ </tr>
24
+ <?php } ?>
25
+ </table>
26
+ <?php } ?>
27
+ </div>
28
+
29
+
30
+ <?php if ( ! empty($stats['target']) ) { ?>
31
+ <div class="table target">
32
+ <p class="sub">
33
+ <?php esc_html_e('Top targets', 'statify'); ?>
34
+ </p>
35
+
36
+ <div>
37
+ <table>
38
+ <?php foreach( $stats['target'] as $target ) { ?>
39
+ <tr>
40
+ <td class="b">
41
+ <?php echo intval($target['count']); ?>
42
+ </td>
43
+ <td class="t">
44
+ <a href="<?php echo esc_url($target['url']); ?>" target="_blank">
45
+ <?php echo esc_html($target['url']); ?>
46
+ </a>
47
+ </td>
48
+ </tr>
49
+ <?php } ?>
50
+ </table>
51
+ </div>
52
+ </div>
53
+ <?php } ?>
54
+
55
+
56
+ <?php if ( ! empty ($stats['referrer']) ) { ?>
57
+ <div class="table referrer">
58
+ <p class="sub">
59
+ <?php esc_html_e('Top referers', 'statify'); ?>
60
+ </p>
61
+
62
+ <div>
63
+ <table>
64
+ <?php foreach( $stats['referrer'] as $referrer ) { ?>
65
+ <tr>
66
+ <td class="b">
67
+ <?php echo intval($referrer['count']); ?>
68
+ </td>
69
+ <td class="t">
70
+ <a href="<?php echo esc_url($referrer['url']); ?>" target="_blank">
71
+ <?php echo esc_html($referrer['host']); ?>
72
+ </a>
73
+ </td>
74
+ </tr>
75
+ <?php } ?>
76
+ </table>
77
+ </div>
78
+ </div>
79
+ <?php } ?>