Antispam Bee - Version 2.4.2

Version Description

  • New geo ip location service (without the api key)
  • Code cleanup: Replacement of @ characters by a function
Download this release

Release Info

Developer sergej.mueller
Plugin Icon 128x128 Antispam Bee
Version 2.4.2
Comparing to
See all releases

Version 2.4.2

antispam_bee.php ADDED
@@ -0,0 +1,1959 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Antispam Bee
4
+ Text Domain: antispam_bee
5
+ Domain Path: /lang
6
+ Description: Easy and extremely productive spam-fighting plugin with many sophisticated solutions. Includes protection again trackback spam.
7
+ Author: Sergej M&uuml;ller
8
+ Author URI: http://wpseo.de
9
+ Plugin URI: http://antispambee.com
10
+ Version: 2.4.2
11
+ */
12
+
13
+
14
+ /* Sicherheitsabfrage */
15
+ if ( !class_exists('WP') ) {
16
+ die();
17
+ }
18
+
19
+
20
+ /**
21
+ * Antispam_Bee
22
+ *
23
+ * @since 0.1
24
+ * @change 2.4
25
+ */
26
+
27
+ class Antispam_Bee {
28
+
29
+
30
+ /* Init */
31
+ public static $short;
32
+ public static $default;
33
+ private static $base;
34
+ private static $secret;
35
+ private static $reason;
36
+
37
+
38
+ /**
39
+ * "Konstruktor" der Klasse
40
+ *
41
+ * @since 0.1
42
+ * @change 2.4.2
43
+ */
44
+
45
+ public static function init()
46
+ {
47
+ /* AJAX & Co. */
48
+ if ( (defined('DOING_AJAX') && DOING_AJAX) or (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) ) {
49
+ return;
50
+ }
51
+
52
+ /* Initialisierung */
53
+ self::_init_internal_vars();
54
+
55
+ /* Cronjob */
56
+ if ( defined('DOING_CRON') ) {
57
+ add_action(
58
+ 'antispam_bee_daily_cronjob',
59
+ array(
60
+ __CLASS__,
61
+ 'start_daily_cronjob'
62
+ )
63
+ );
64
+
65
+ /* Admin */
66
+ } elseif ( is_admin() ) {
67
+ /* Menü */
68
+ add_action(
69
+ 'admin_menu',
70
+ array(
71
+ __CLASS__,
72
+ 'add_sidebar_menu'
73
+ )
74
+ );
75
+
76
+ /* Dashboard */
77
+ if ( self::_current_page('dashboard') ) {
78
+ add_action(
79
+ 'init',
80
+ array(
81
+ __CLASS__,
82
+ 'load_plugin_lang'
83
+ )
84
+ );
85
+ add_action(
86
+ 'right_now_discussion_table_end',
87
+ array(
88
+ __CLASS__,
89
+ 'add_dashboard_count'
90
+ )
91
+ );
92
+ add_action(
93
+ 'wp_dashboard_setup',
94
+ array(
95
+ __CLASS__,
96
+ 'add_dashboard_chart'
97
+ )
98
+ );
99
+
100
+ /* Plugins */
101
+ } else if ( self::_current_page('plugins') ) {
102
+ add_action(
103
+ 'init',
104
+ array(
105
+ __CLASS__,
106
+ 'load_plugin_lang'
107
+ )
108
+ );
109
+ add_filter(
110
+ 'plugin_row_meta',
111
+ array(
112
+ __CLASS__,
113
+ 'init_row_meta'
114
+ ),
115
+ 10,
116
+ 2
117
+ );
118
+ add_filter(
119
+ 'plugin_action_links_' .self::$base,
120
+ array(
121
+ __CLASS__,
122
+ 'init_action_links'
123
+ )
124
+ );
125
+
126
+ /* Optionen */
127
+ } else if ( self::_current_page('options') ) {
128
+ add_action(
129
+ 'admin_init',
130
+ array(
131
+ __CLASS__,
132
+ 'load_plugin_lang'
133
+ )
134
+ );
135
+ add_action(
136
+ 'admin_init',
137
+ array(
138
+ __CLASS__,
139
+ 'init_plugin_sources'
140
+ )
141
+ );
142
+
143
+ } else if ( self::_current_page('admin-post') ) {
144
+ require_once( dirname(__FILE__). '/inc/gui.class.php' );
145
+
146
+ add_action(
147
+ 'admin_post_ab_save_changes',
148
+ array(
149
+ 'Antispam_Bee_GUI',
150
+ 'save_changes'
151
+ )
152
+ );
153
+ }
154
+
155
+ /* Frontend */
156
+ } else {
157
+ add_action(
158
+ 'template_redirect',
159
+ array(
160
+ __CLASS__,
161
+ 'prepare_comment_field'
162
+ )
163
+ );
164
+ add_action(
165
+ 'init',
166
+ array(
167
+ __CLASS__,
168
+ 'precheck_incoming_request'
169
+ )
170
+ );
171
+ add_action(
172
+ 'preprocess_comment',
173
+ array(
174
+ __CLASS__,
175
+ 'handle_incoming_request'
176
+ ),
177
+ 1
178
+ );
179
+ add_action(
180
+ 'antispam_bee_count',
181
+ array(
182
+ __CLASS__,
183
+ 'the_spam_count'
184
+ )
185
+ );
186
+ }
187
+ }
188
+
189
+
190
+
191
+
192
+ ############################
193
+ ######## INSTALL #########
194
+ ############################
195
+
196
+
197
+ /**
198
+ * Aktion bei der Aktivierung des Plugins
199
+ *
200
+ * @since 0.1
201
+ * @change 2.4
202
+ */
203
+
204
+ public static function activate()
205
+ {
206
+ /* Option anlegen */
207
+ add_option(
208
+ self::$short,
209
+ array(),
210
+ '',
211
+ 'no'
212
+ );
213
+
214
+ /* Cron aktivieren */
215
+ if ( self::get_option('cronjob_enable') ) {
216
+ self::init_scheduled_hook();
217
+ }
218
+ }
219
+
220
+
221
+ /**
222
+ * Aktion bei der Deaktivierung des Plugins
223
+ *
224
+ * @since 0.1
225
+ * @change 2.4
226
+ */
227
+
228
+ public static function deactivate()
229
+ {
230
+ self::clear_scheduled_hook();
231
+ }
232
+
233
+
234
+ /**
235
+ * Aktion beim Löschen des Plugins
236
+ *
237
+ * @since 2.4
238
+ * @change 2.4
239
+ */
240
+
241
+ public static function uninstall()
242
+ {
243
+ /* Global */
244
+ global $wpdb;
245
+
246
+ /* Remove settings */
247
+ delete_option('antispam_bee');
248
+
249
+ /* Clean DB */
250
+ $wpdb->query("OPTIMIZE TABLE `" .$wpdb->options. "`");
251
+ }
252
+
253
+
254
+
255
+
256
+ ############################
257
+ ######### INTERN #########
258
+ ############################
259
+
260
+
261
+ /**
262
+ * Initialisierung der internen Variablen
263
+ *
264
+ * @since 2.4
265
+ * @change 2.4
266
+ */
267
+
268
+ private static function _init_internal_vars()
269
+ {
270
+ self::$base = plugin_basename(__FILE__);
271
+ self::$short = 'antispam_bee';
272
+ self::$secret = substr(md5(get_bloginfo('url')), 0, 5). '-comment';
273
+
274
+ self::$default = array(
275
+ 'options' => array(
276
+ /* Allgemein */
277
+ 'advanced_check' => 1,
278
+ 'spam_ip' => 1,
279
+ 'already_commented' => 1,
280
+ 'ignore_pings' => 0,
281
+ 'always_allowed' => 0,
282
+
283
+ 'dashboard_chart' => 1,
284
+ 'dashboard_count' => 0,
285
+
286
+ /* Filter */
287
+ 'country_code' => 0,
288
+ 'country_black' => '',
289
+ 'country_white' => '',
290
+
291
+ 'translate_api' => 0,
292
+ 'translate_lang' => '',
293
+
294
+ 'honey_pot' => 0,
295
+ 'honey_key' => '',
296
+
297
+ /* Erweitert */
298
+ 'flag_spam' => 1,
299
+ 'email_notify' => 1,
300
+ 'no_notice' => 1,
301
+ 'cronjob_enable' => 0,
302
+ 'cronjob_interval' => 0,
303
+
304
+ 'ignore_filter' => 0,
305
+ 'ignore_type' => 0,
306
+ 'ignore_reasons' => array(),
307
+
308
+ /* Tab */
309
+ 'tab_index' => 0
310
+ ),
311
+ 'reasons' => array(
312
+ 'css' => 'CSS Hack',
313
+ 'empty' => 'Empty Data',
314
+ 'server' => 'Server IP',
315
+ 'spamip' => 'Spam IP',
316
+ 'country' => 'Country Check',
317
+ 'honey' => 'Honey Pot',
318
+ 'lang' => 'Comment Language'
319
+ )
320
+ );
321
+ }
322
+
323
+
324
+ /**
325
+ * Prüfung und Rückgabe eines Array-Keys
326
+ *
327
+ * @since 2.4.2
328
+ * @change 2.4.2
329
+ *
330
+ * @param array $array Array mit Werten
331
+ * @param string $key Name des Keys
332
+ * @return mixed Wert des angeforderten Keys
333
+ */
334
+
335
+ public static function get_key($array, $key)
336
+ {
337
+ if ( empty($array) or empty($key) or empty($array[$key]) ) {
338
+ return null;
339
+ }
340
+
341
+ return $array[$key];
342
+ }
343
+
344
+
345
+ /**
346
+ * Lokalisierung der Admin-Seiten
347
+ *
348
+ * @since 0.1
349
+ * @change 2.4
350
+ *
351
+ * @param string $page Kennzeichnung der Seite
352
+ * @return boolean TRUE Bei Erfolg
353
+ */
354
+
355
+ private static function _current_page($page)
356
+ {
357
+ switch ($page) {
358
+ case 'dashboard':
359
+ return ( empty($GLOBALS['pagenow']) or ( !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] == 'index.php' ) );
360
+
361
+ case 'options':
362
+ return ( !empty($_REQUEST['page']) && $_REQUEST['page'] == self::$short );
363
+
364
+ case 'plugins':
365
+ return ( !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] == 'plugins.php' );
366
+
367
+ case 'admin-post':
368
+ return ( !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] == 'admin-post.php' );
369
+
370
+ default:
371
+ return false;
372
+ }
373
+ }
374
+
375
+
376
+ /**
377
+ * Einbindung der Sprachdatei
378
+ *
379
+ * @since 0.1
380
+ * @change 2.4
381
+ */
382
+
383
+ public static function load_plugin_lang()
384
+ {
385
+ load_plugin_textdomain(
386
+ self::$short,
387
+ false,
388
+ 'antispam-bee/lang'
389
+ );
390
+ }
391
+
392
+
393
+ /**
394
+ * Hinzufügen des Links zu den Einstellungen
395
+ *
396
+ * @since 1.1
397
+ * @change 1.1
398
+ */
399
+
400
+ public static function init_action_links($data)
401
+ {
402
+ /* Rechte? */
403
+ if ( !current_user_can('manage_options') ) {
404
+ return $data;
405
+ }
406
+
407
+ return array_merge(
408
+ $data,
409
+ array(
410
+ sprintf(
411
+ '<a href="%s">%s</a>',
412
+ add_query_arg(
413
+ array(
414
+ 'page' => self::$short
415
+ ),
416
+ admin_url('options-general.php')
417
+ ),
418
+ __('Settings')
419
+ )
420
+ )
421
+ );
422
+ }
423
+
424
+
425
+ /**
426
+ * Meta-Links des Plugins
427
+ *
428
+ * @since 0.1
429
+ * @change 2.4
430
+ *
431
+ * @param array $data Bereits vorhandene Links
432
+ * @param string $page Aktuelle Seite
433
+ * @return array $data Modifizierte Links
434
+ */
435
+
436
+ public static function init_row_meta($data, $page)
437
+ {
438
+ /* Rechte */
439
+ if ( $page != self::$base ) {
440
+ return $data;
441
+ }
442
+
443
+ return array_merge(
444
+ $data,
445
+ array(
446
+ '<a href="http://flattr.com/profile/sergej.mueller" target="_blank">Plugin flattern</a>',
447
+ '<a href="https://plus.google.com/110569673423509816572" target="_blank">Auf Google+ folgen</a>'
448
+ )
449
+ );
450
+ }
451
+
452
+
453
+
454
+
455
+ ############################
456
+ ####### RESSOURCEN #######
457
+ ############################
458
+
459
+
460
+ /**
461
+ * Registrierung von Ressourcen (CSS & JS)
462
+ *
463
+ * @since 1.6
464
+ * @change 2.4
465
+ */
466
+
467
+ public static function init_plugin_sources()
468
+ {
469
+ /* Infos auslesen */
470
+ $plugin = get_plugin_data(__FILE__);
471
+
472
+ /* JS einbinden */
473
+ wp_register_script(
474
+ 'ab_script',
475
+ plugins_url('js/script.js', __FILE__),
476
+ array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'),
477
+ $plugin['Version']
478
+ );
479
+
480
+ /* CSS einbinden */
481
+ wp_register_style(
482
+ 'ab_style',
483
+ plugins_url('css/style.css', __FILE__),
484
+ array(),
485
+ $plugin['Version']
486
+ );
487
+ }
488
+
489
+
490
+ /**
491
+ * Initialisierung der Optionsseite
492
+ *
493
+ * @since 0.1
494
+ * @change 2.4
495
+ */
496
+
497
+ public static function add_sidebar_menu()
498
+ {
499
+ /* Menü anlegen */
500
+ $page = add_options_page(
501
+ 'Antispam Bee',
502
+ '<img src="' .plugins_url('img/icon.png', __FILE__). '" id="ab_icon" alt="Antispam Bee" />Antispam Bee',
503
+ 'manage_options',
504
+ self::$short,
505
+ array(
506
+ 'Antispam_Bee_GUI',
507
+ 'options_page'
508
+ )
509
+ );
510
+
511
+ /* JS einbinden */
512
+ add_action(
513
+ 'admin_print_scripts-' . $page,
514
+ array(
515
+ __CLASS__,
516
+ 'add_options_script'
517
+ )
518
+ );
519
+
520
+ /* CSS einbinden */
521
+ add_action(
522
+ 'admin_print_styles-' . $page,
523
+ array(
524
+ __CLASS__,
525
+ 'add_options_style'
526
+ )
527
+ );
528
+
529
+ /* PHP laden */
530
+ add_action(
531
+ 'load-' .$page,
532
+ array(
533
+ __CLASS__,
534
+ 'init_options_page'
535
+ )
536
+ );
537
+ }
538
+
539
+
540
+ /**
541
+ * Initialisierung von JavaScript
542
+ *
543
+ * @since 1.6
544
+ * @change 2.4
545
+ */
546
+
547
+ public static function add_options_script()
548
+ {
549
+ wp_enqueue_script('ab_script');
550
+ }
551
+
552
+
553
+ /**
554
+ * Initialisierung von Stylesheets
555
+ *
556
+ * @since 1.6
557
+ * @change 2.4
558
+ */
559
+
560
+ public static function add_options_style()
561
+ {
562
+ wp_enqueue_style('ab_style');
563
+ }
564
+
565
+
566
+ /**
567
+ * Einbindung der GUI
568
+ *
569
+ * @since 2.4
570
+ * @change 2.4
571
+ */
572
+
573
+ public static function init_options_page()
574
+ {
575
+ require_once( dirname(__FILE__). '/inc/gui.class.php' );
576
+ }
577
+
578
+
579
+
580
+
581
+ ############################
582
+ ####### DASHBOARD ########
583
+ ############################
584
+
585
+
586
+ /**
587
+ * Anzeige des Spam-Counters auf dem Dashboard
588
+ *
589
+ * @since 0.1
590
+ * @change 2.4
591
+ */
592
+
593
+ public static function add_dashboard_count()
594
+ {
595
+ /* Aktiv? */
596
+ if ( !self::get_option('dashboard_count') ) {
597
+ return;
598
+ }
599
+
600
+ /* Ausgabe */
601
+ echo sprintf(
602
+ '<tr>
603
+ <td class="b b-spam" style="font-size:18px">%s</td>
604
+ <td class="last t">%s</td>
605
+ </tr>',
606
+ esc_html( self::_get_spam_count() ),
607
+ esc_html__('Blocked', self::$short)
608
+ );
609
+ }
610
+
611
+
612
+ /**
613
+ * Initialisierung des Dashboard-Chart
614
+ *
615
+ * @since 1.9
616
+ * @change 2.4
617
+ */
618
+
619
+ public static function add_dashboard_chart()
620
+ {
621
+ /* Filter */
622
+ if ( !current_user_can('level_2') or !self::get_option('dashboard_chart') ) {
623
+ return;
624
+ }
625
+
626
+ /* Widget hinzufügen */
627
+ wp_add_dashboard_widget(
628
+ 'ab_widget',
629
+ 'Antispam Bee',
630
+ array(
631
+ __CLASS__,
632
+ 'show_spam_chart'
633
+ )
634
+ );
635
+
636
+ /* JS laden */
637
+ add_action(
638
+ 'wp_print_scripts',
639
+ array(
640
+ __CLASS__,
641
+ 'add_dashboard_script'
642
+ )
643
+ );
644
+
645
+ /* CSS laden */
646
+ add_action(
647
+ 'admin_head',
648
+ array(
649
+ __CLASS__,
650
+ 'add_dashboard_style'
651
+ )
652
+ );
653
+ }
654
+
655
+
656
+ /**
657
+ * Ausgabe der Dashboard-CSS
658
+ *
659
+ * @since 1.9
660
+ * @change 2.4
661
+ */
662
+
663
+ public static function add_dashboard_style()
664
+ {
665
+ /* Plugin-Info */
666
+ $plugin = get_plugin_data(__FILE__);
667
+
668
+ /* CSS registrieren */
669
+ wp_register_style(
670
+ 'ab_chart',
671
+ plugins_url('css/dashboard.css', __FILE__),
672
+ array(),
673
+ $plugin['Version']
674
+ );
675
+
676
+ /* CSS ausgeben */
677
+ wp_print_styles('ab_chart');
678
+ }
679
+
680
+
681
+ /**
682
+ * Ausgabe der Dashboard-JS
683
+ *
684
+ * @since 1.9
685
+ * @change 2.4
686
+ */
687
+
688
+ public static function add_dashboard_script()
689
+ {
690
+ /* Init */
691
+ $items = (array)self::get_option('daily_stats');
692
+
693
+ /* Leer? */
694
+ if ( empty($items) ) {
695
+ return;
696
+ }
697
+
698
+ /* Sortieren */
699
+ krsort($items, SORT_NUMERIC);
700
+
701
+ /* Init */
702
+ $output = array(
703
+ 'created' => array(),
704
+ 'count' => array()
705
+ );
706
+
707
+ /* Init */
708
+ $i = 0;
709
+
710
+ /* Zeilen loopen */
711
+ foreach($items as $timestamp => $count) {
712
+ array_push(
713
+ $output['created'],
714
+ ( $timestamp == strtotime('today', current_time('timestamp')) ? __('Today', self::$short) : date('d.m', $timestamp) )
715
+ );
716
+ array_push(
717
+ $output['count'],
718
+ (int)$count
719
+ );
720
+ }
721
+
722
+ /* Zusammenfassen */
723
+ $stats = array(
724
+ 'created' => implode(',', $output['created']),
725
+ 'count' => implode(',', $output['count'])
726
+ );
727
+
728
+ /* Plugin-Info */
729
+ $plugin = get_plugin_data(__FILE__);
730
+
731
+ /* JS einbinden */
732
+ wp_register_script(
733
+ 'ab_chart',
734
+ plugins_url('js/dashboard.js', __FILE__),
735
+ array('jquery'),
736
+ $plugin['Version']
737
+ );
738
+ wp_register_script(
739
+ 'google_jsapi',
740
+ 'http://www.google.com/jsapi',
741
+ false
742
+ );
743
+
744
+ /* Einbinden */
745
+ wp_enqueue_script('google_jsapi');
746
+ wp_enqueue_script('ab_chart');
747
+
748
+ /* Übergeben */
749
+ wp_localize_script(
750
+ 'ab_chart',
751
+ 'antispambee',
752
+ $stats
753
+ );
754
+ }
755
+
756
+
757
+ /**
758
+ * Ausgabe des Dashboard-Chart
759
+ *
760
+ * @since 1.9
761
+ * @change 2.4
762
+ */
763
+
764
+ public static function show_spam_chart()
765
+ {
766
+ /* Init */
767
+ $items = (array)self::get_option('daily_stats');
768
+
769
+ /* Ausgabe */
770
+ echo sprintf(
771
+ '<div id="ab_chart">%s</div>',
772
+ ( empty($items) ? esc_html__('No data available.', self::$short) : '' )
773
+ );
774
+ }
775
+
776
+
777
+
778
+
779
+ ############################
780
+ ######## OPTIONS #########
781
+ ############################
782
+
783
+
784
+ /**
785
+ * Rückgabe der Optionen
786
+ *
787
+ * @since 2.4
788
+ * @change 2.4
789
+ *
790
+ * @return array $options Array mit Optionen
791
+ */
792
+
793
+ public static function get_options()
794
+ {
795
+ if ( !$options = wp_cache_get(self::$short) ) {
796
+ $options = wp_parse_args(
797
+ get_option(self::$short),
798
+ self::$default['options']
799
+ );
800
+
801
+ wp_cache_set(
802
+ self::$short,
803
+ $options
804
+ );
805
+ }
806
+
807
+ return $options;
808
+ }
809
+
810
+
811
+ /**
812
+ * Rückgabe eines Optionsfeldes
813
+ *
814
+ * @since 0.1
815
+ * @change 2.4.2
816
+ *
817
+ * @param string $field Name des Feldes
818
+ * @return mixed Wert des Feldes
819
+ */
820
+
821
+ public static function get_option($field)
822
+ {
823
+ $options = self::get_options();
824
+
825
+ return self::get_key($options, $field);
826
+ }
827
+
828
+
829
+ /**
830
+ * Aktualisiert ein Optionsfeld
831
+ *
832
+ * @since 0.1
833
+ * @change 2.4
834
+ *
835
+ * @param string $field Name des Feldes
836
+ * @param mixed Wert des Feldes
837
+ */
838
+
839
+ private static function _update_option($field, $value)
840
+ {
841
+ self::update_options(
842
+ array(
843
+ $field => $value
844
+ )
845
+ );
846
+ }
847
+
848
+
849
+ /**
850
+ * Aktualisiert mehrere Optionsfelder
851
+ *
852
+ * @since 0.1
853
+ * @change 2.4
854
+ *
855
+ * @param array $data Array mit Feldern
856
+ */
857
+
858
+ public static function update_options($data)
859
+ {
860
+ /* Option zuweisen */
861
+ $options = array_merge(
862
+ (array)get_option(self::$short),
863
+ $data
864
+ );
865
+
866
+ /* DB updaten */
867
+ update_option(
868
+ self::$short,
869
+ $options
870
+ );
871
+
872
+ /* Cache updaten */
873
+ wp_cache_set(
874
+ self::$short,
875
+ $options
876
+ );
877
+ }
878
+
879
+
880
+
881
+
882
+ ############################
883
+ ######## CRONJOBS ########
884
+ ############################
885
+
886
+
887
+ /**
888
+ * Ausführung des täglichen Cronjobs
889
+ *
890
+ * @since 0.1
891
+ * @change 2.4
892
+ */
893
+
894
+ public static function start_daily_cronjob()
895
+ {
896
+ /* Kein Cronjob? */
897
+ if ( !self::get_option('cronjob_enable') ) {
898
+ return;
899
+ }
900
+
901
+ /* Timestamp updaten */
902
+ self::_update_option(
903
+ 'cronjob_timestamp',
904
+ time()
905
+ );
906
+
907
+ /* Spam löschen */
908
+ self::_delete_old_spam();
909
+ }
910
+
911
+
912
+ /**
913
+ * Löschung alter Spamkommentare
914
+ *
915
+ * @since 0.1
916
+ * @change 2.4
917
+ */
918
+
919
+ private static function _delete_old_spam()
920
+ {
921
+ /* Anzahl der Tage */
922
+ $days = (int)self::get_option('cronjob_interval');
923
+
924
+ /* Kein Wert? */
925
+ if ( empty($days) ) {
926
+ return false;
927
+ }
928
+
929
+ /* Global */
930
+ global $wpdb;
931
+
932
+ /* Kommentare löschen */
933
+ $wpdb->query(
934
+ $wpdb->prepare(
935
+ "DELETE FROM `$wpdb->comments` WHERE `comment_approved` = 'spam' AND SUBDATE(NOW(), %d) > comment_date_gmt",
936
+ $days
937
+ )
938
+ );
939
+
940
+ /* DB optimieren */
941
+ $wpdb->query("OPTIMIZE TABLE `$wpdb->comments`");
942
+ }
943
+
944
+
945
+ /**
946
+ * Initialisierung des Cronjobs
947
+ *
948
+ * @since 0.1
949
+ * @change 2.4
950
+ */
951
+
952
+ public static function init_scheduled_hook()
953
+ {
954
+ if ( !wp_next_scheduled('antispam_bee_daily_cronjob') ) {
955
+ wp_schedule_event(
956
+ time(),
957
+ 'daily',
958
+ 'antispam_bee_daily_cronjob'
959
+ );
960
+ }
961
+ }
962
+
963
+
964
+ /**
965
+ * Löschung des Cronjobs
966
+ *
967
+ * @since 0.1
968
+ * @change 2.4
969
+ */
970
+
971
+ public static function clear_scheduled_hook()
972
+ {
973
+ if ( wp_next_scheduled('antispam_bee_daily_cronjob') ) {
974
+ wp_clear_scheduled_hook('antispam_bee_daily_cronjob');
975
+ }
976
+ }
977
+
978
+
979
+
980
+
981
+ ############################
982
+ ###### SPAMPRÜFUNG #######
983
+ ############################
984
+
985
+
986
+ /**
987
+ * Überprüfung der POST-Werte
988
+ *
989
+ * @since 0.1
990
+ * @change 2.4.2
991
+ */
992
+
993
+ public static function precheck_incoming_request()
994
+ {
995
+ /* Nur Frontend */
996
+ if ( is_feed() or is_trackback() or self::_is_mobile() ) {
997
+ return;
998
+ }
999
+
1000
+ /* Allgemeine Werte */
1001
+ $request_url = self::get_key($_SERVER, 'REQUEST_URI');
1002
+ $hidden_field = self::get_key($_POST, 'comment');
1003
+ $plugin_field = self::get_key($_POST, self::$secret);
1004
+
1005
+ /* Falsch verbunden */
1006
+ if ( empty($_POST) or empty($request_url) or strpos($request_url, 'wp-comments-post.php') === false ) {
1007
+ return;
1008
+ }
1009
+
1010
+ /* Felder prüfen */
1011
+ if ( empty($hidden_field) && !empty($plugin_field) ) {
1012
+ $_POST['comment'] = $plugin_field;
1013
+ unset($_POST[self::$secret]);
1014
+ } else {
1015
+ $_POST['bee_spam'] = 1;
1016
+ }
1017
+ }
1018
+
1019
+
1020
+ /**
1021
+ * Prüfung der eingehenden Anfragen auf Spam
1022
+ *
1023
+ * @since 0.1
1024
+ * @change 2.4.2
1025
+ *
1026
+ * @param array $comment Unbehandelter Kommentar
1027
+ * @return array $comment Behandelter Kommentar
1028
+ */
1029
+
1030
+ public static function handle_incoming_request($comment)
1031
+ {
1032
+ /* Server-Werte */
1033
+ $url = self::get_key($_SERVER, 'REQUEST_URI');
1034
+
1035
+ /* Leere Werte? */
1036
+ if ( empty($url) ) {
1037
+ return self::_handle_spam_request(
1038
+ $comment,
1039
+ 'empty'
1040
+ );
1041
+ }
1042
+
1043
+ /* Ping-Optionen */
1044
+ $ping = array(
1045
+ 'types' => array('pingback', 'trackback', 'pings'),
1046
+ 'allowed' => !self::get_option('ignore_pings')
1047
+ );
1048
+
1049
+ /* Kommentar */
1050
+ if ( strpos($url, 'wp-comments-post.php') !== false && !empty($_POST) ) {
1051
+ /* Filter ausführen */
1052
+ $status = self::_verify_comment_request($comment);
1053
+
1054
+ /* Spam lokalisiert */
1055
+ if ( !empty($status['reason']) ) {
1056
+ return self::_handle_spam_request(
1057
+ $comment,
1058
+ $status['reason']
1059
+ );
1060
+ }
1061
+
1062
+ /* Trackback */
1063
+ } else if ( in_array(self::get_key($comment, 'comment_type'), $ping['types']) && $ping['allowed'] ) {
1064
+ /* Filter ausführen */
1065
+ $status = self::_verify_trackback_request($comment);
1066
+
1067
+ /* Spam lokalisiert */
1068
+ if ( !empty($status['reason']) ) {
1069
+ return self::_handle_spam_request(
1070
+ $comment,
1071
+ $status['reason'],
1072
+ true
1073
+ );
1074
+ }
1075
+ }
1076
+
1077
+ return $comment;
1078
+ }
1079
+
1080
+
1081
+ /**
1082
+ * Bereitet die Ersetzung des KOmmentarfeldes vor
1083
+ *
1084
+ * @since 0.1
1085
+ * @change 2.4
1086
+ */
1087
+
1088
+ public static function prepare_comment_field()
1089
+ {
1090
+ /* Nur Frontend */
1091
+ if ( is_feed() or is_trackback() or is_robots() or self::_is_mobile() ) {
1092
+ return;
1093
+ }
1094
+
1095
+ /* Nur Beiträge */
1096
+ if ( !is_singular() && !self::get_option('always_allowed') ) {
1097
+ return;
1098
+ }
1099
+
1100
+ /* Fire! */
1101
+ ob_start(
1102
+ array(
1103
+ 'Antispam_Bee',
1104
+ 'replace_comment_field'
1105
+ )
1106
+ );
1107
+ }
1108
+
1109
+
1110
+ /**
1111
+ * ersetzt das Kommentarfeld
1112
+ *
1113
+ * @since 2.4
1114
+ * @change 2.4.1
1115
+ *
1116
+ * @param string $data HTML-Code der Webseite
1117
+ * @return string Behandelter HTML-Code
1118
+ */
1119
+
1120
+ public static function replace_comment_field($data)
1121
+ {
1122
+ /* Leer? */
1123
+ if ( empty($data) ) {
1124
+ return;
1125
+ }
1126
+
1127
+ /* Convert */
1128
+ return preg_replace(
1129
+ '#<textarea(.+?)name=["\']comment["\'](.+?)</textarea>#s',
1130
+ '<textarea$1name="' .self::$secret. '"$2</textarea><textarea name="comment" style="display:none" rows="1" cols="1"></textarea>',
1131
+ (string) $data,
1132
+ 1
1133
+ );
1134
+ }
1135
+
1136
+
1137
+ /**
1138
+ * Kürzung der IP-Adressen
1139
+ *
1140
+ * @since 0.1
1141
+ * @change 2.4
1142
+ *
1143
+ * @param string $ip Ungekürzte IP
1144
+ * @return string $ip Gekürzte IP
1145
+ */
1146
+
1147
+ private static function _cut_ip($ip)
1148
+ {
1149
+ return str_replace(
1150
+ strrchr(
1151
+ $ip,
1152
+ ( self::_is_ipv4($ip) ? '.' : ':' )
1153
+ ),
1154
+ '',
1155
+ $ip
1156
+ );
1157
+ }
1158
+
1159
+
1160
+ /**
1161
+ * Prüfung auf Mobile
1162
+ *
1163
+ * @since 0.1
1164
+ * @change 2.4
1165
+ *
1166
+ * @return boolean TRUE, wenn "wptouch" aktiv ist
1167
+ */
1168
+
1169
+ private static function _is_mobile()
1170
+ {
1171
+ return strpos(TEMPLATEPATH, 'wptouch');
1172
+ }
1173
+
1174
+
1175
+ /**
1176
+ * Prüfung auf eine IPv4-Adresse
1177
+ *
1178
+ * @since 2.4
1179
+ * @change 2.4
1180
+ *
1181
+ * @param string $ip Zu prüfende IP
1182
+ * @return integer Anzahl der Treffer
1183
+ */
1184
+
1185
+ private static function _is_ipv4($ip)
1186
+ {
1187
+ return preg_match('/^\d{1,3}(\.\d{1,3}){3,3}$/', $ip);
1188
+ }
1189
+
1190
+
1191
+ /**
1192
+ * Prüfung einer IP auf ihre Existenz im Spam
1193
+ *
1194
+ * @since 2.0
1195
+ * @change 2.4
1196
+ *
1197
+ * @param string $ip IP-Adresse
1198
+ * @return boolean TRUE bei verdächtiger IP
1199
+ */
1200
+
1201
+ private static function _is_spam_ip($ip)
1202
+ {
1203
+ /* Keine IP? */
1204
+ if ( empty($ip) ) {
1205
+ return true;
1206
+ }
1207
+
1208
+ /* Global */
1209
+ global $wpdb;
1210
+
1211
+ /* Suchen */
1212
+ $found = $wpdb->get_var(
1213
+ $wpdb->prepare(
1214
+ "SELECT `comment_ID` FROM `$wpdb->comments` WHERE `comment_approved` = 'spam' AND `comment_author_IP` = %s LIMIT 1",
1215
+ (string)$ip
1216
+ )
1217
+ );
1218
+
1219
+ /* Gefunden? */
1220
+ if ( $found ) {
1221
+ return true;
1222
+ }
1223
+
1224
+ return false;
1225
+ }
1226
+
1227
+
1228
+ /**
1229
+ * Prüfung auf erlaubten Ländercodes
1230
+ *
1231
+ * @since 0.1
1232
+ * @change 2.4.2
1233
+ *
1234
+ * @param string $ip IP-Adresse
1235
+ * @return boolean TRUE bei unerwünschten Ländercodes
1236
+ */
1237
+
1238
+ private static function _is_spam_country($ip)
1239
+ {
1240
+ /* Keine IP? */
1241
+ if ( empty($ip) ) {
1242
+ return true;
1243
+ }
1244
+
1245
+ /* Optionen */
1246
+ $options = self::get_options();
1247
+
1248
+ /* White & Black */
1249
+ $white = preg_split(
1250
+ '/ /',
1251
+ $options['country_white'],
1252
+ -1,
1253
+ PREG_SPLIT_NO_EMPTY
1254
+ );
1255
+ $black = preg_split(
1256
+ '/ /',
1257
+ $options['country_black'],
1258
+ -1,
1259
+ PREG_SPLIT_NO_EMPTY
1260
+ );
1261
+
1262
+ /* Leere Listen? */
1263
+ if ( empty($white) && empty($black) ) {
1264
+ return false;
1265
+ }
1266
+
1267
+ /* IP abfragen */
1268
+ $response = wp_remote_get(
1269
+ sprintf(
1270
+ 'http://api.hostip.info/country.php?ip=%s',
1271
+ $ip
1272
+ )
1273
+ );
1274
+
1275
+ /* Fehler? */
1276
+ if ( is_wp_error($response) ) {
1277
+ return false;
1278
+ }
1279
+
1280
+ /* Land auslesen */
1281
+ $country = wp_remote_retrieve_body($response);
1282
+
1283
+ /* Kein Land? */
1284
+ if ( empty($country) ) {
1285
+ return false;
1286
+ }
1287
+
1288
+ /* Blacklist */
1289
+ if ( !empty($black) ) {
1290
+ return ( in_array($country, $black) ? true : false );
1291
+ }
1292
+
1293
+ /* Whitelist */
1294
+ return ( in_array($country, $white) ? false : true );
1295
+ }
1296
+
1297
+
1298
+ /**
1299
+ * Prüfung auf Honey Pot Spam
1300
+ *
1301
+ * @since 1.7
1302
+ * @change 2.4
1303
+ *
1304
+ * @param string $ip IP-Adresse
1305
+ * @return boolean TRUE bei gemeldeter IP
1306
+ */
1307
+
1308
+ private static function _is_honey_spam($ip)
1309
+ {
1310
+ /* Keine IP? */
1311
+ if ( empty($ip) ) {
1312
+ return true;
1313
+ }
1314
+
1315
+ /* Optionen */
1316
+ $options = self::get_options();
1317
+
1318
+ /* Kein Key? */
1319
+ if ( empty($options['honey_key']) ) {
1320
+ return false;
1321
+ }
1322
+
1323
+ /* Host */
1324
+ $host = sprintf(
1325
+ '%s.%s.dnsbl.httpbl.org',
1326
+ $options['honey_key'],
1327
+ implode(
1328
+ '.',
1329
+ array_reverse(
1330
+ explode(
1331
+ '.',
1332
+ $ip
1333
+ )
1334
+ )
1335
+ )
1336
+ );
1337
+
1338
+ /* Response */
1339
+ $bits = explode(
1340
+ '.',
1341
+ gethostbyname($host)
1342
+ );
1343
+
1344
+ return ( $bits[0] == 127 && $bits[3] & 4 );
1345
+ }
1346
+
1347
+
1348
+ /**
1349
+ * Prüfung der Trackbacks
1350
+ *
1351
+ * @since 2.4
1352
+ * @change 2.4.2
1353
+ *
1354
+ * @param array $comment Daten des Trackbacks
1355
+ * @return array Array mit dem Verdachtsgrund [optional]
1356
+ */
1357
+
1358
+ private static function _verify_trackback_request($comment)
1359
+ {
1360
+ /* IP */
1361
+ $ip = self::get_key($_SERVER, 'REMOTE_ADDR');
1362
+
1363
+ /* Kommentarwerte */
1364
+ $url = self::get_key($comment, 'comment_author_url');
1365
+ $body = self::get_key($comment, 'comment_content');
1366
+
1367
+ /* Leere Werte ? */
1368
+ if ( empty($ip) or empty($url) or empty($body) ) {
1369
+ return array(
1370
+ 'reason' => 'empty'
1371
+ );
1372
+ }
1373
+
1374
+ /* Optionen */
1375
+ $options = self::get_options();
1376
+
1377
+ /* IP != Server */
1378
+ if ( $options['advanced_check'] && self::_is_fake_ip($ip, parse_url($url, PHP_URL_HOST)) ) {
1379
+ return array(
1380
+ 'reason' => 'server'
1381
+ );
1382
+ }
1383
+
1384
+ /* IP im Spam */
1385
+ if ( $options['spam_ip'] && self::_is_spam_ip($ip) ) {
1386
+ return array(
1387
+ 'reason' => 'spamip'
1388
+ );
1389
+ }
1390
+
1391
+ /* Honey Pot */
1392
+ if ( $options['honey_pot'] && self::_is_honey_spam($ip) ) {
1393
+ return array(
1394
+ 'reason' => 'honey'
1395
+ );
1396
+ }
1397
+
1398
+ /* Country Code prüfen */
1399
+ if ( $options['country_code'] && self::_is_spam_country($ip) ) {
1400
+ return array(
1401
+ 'reason' => 'country'
1402
+ );
1403
+ }
1404
+ }
1405
+
1406
+
1407
+ /**
1408
+ * Prüfung auf eine bereits freigegebene E-Mail-Adresse
1409
+ *
1410
+ * @since 2.0
1411
+ * @change 2.4
1412
+ *
1413
+ * @param string $email E-Mail-Adresse
1414
+ * @return boolean TRUE bei einem gefundenen Eintrag
1415
+ */
1416
+
1417
+ private static function _is_approved_email($email)
1418
+ {
1419
+ /* Leer? */
1420
+ if ( empty($email) ) {
1421
+ return false;
1422
+ }
1423
+
1424
+ /* Global */
1425
+ global $wpdb;
1426
+
1427
+ /* Suchen */
1428
+ $found = $wpdb->get_var(
1429
+ $wpdb->prepare(
1430
+ "SELECT `comment_ID` FROM `$wpdb->comments` WHERE `comment_approved` = '1' AND `comment_author_email` = %s LIMIT 1",
1431
+ (string)$email
1432
+ )
1433
+ );
1434
+
1435
+ /* Gefunden? */
1436
+ if ( $found ) {
1437
+ return true;
1438
+ }
1439
+
1440
+ return false;
1441
+ }
1442
+
1443
+
1444
+ /**
1445
+ * Prüfung auf eine gefälschte IP
1446
+ *
1447
+ * @since 2.0
1448
+ * @change 2.4
1449
+ *
1450
+ * @param string $ip IP-Adresse
1451
+ * @param string $host Host [optional]
1452
+ * @return boolean TRUE bei gefälschter IP
1453
+ */
1454
+
1455
+ private static function _is_fake_ip($ip, $host = false)
1456
+ {
1457
+ /* Leer? */
1458
+ if ( empty($ip) ) {
1459
+ return true;
1460
+ }
1461
+
1462
+ /* Remote Host */
1463
+ $hostbyip = gethostbyaddr($ip);
1464
+
1465
+ /* IPv6 */
1466
+ if ( !self::_is_ipv4($ip) ) {
1467
+ return $ip != $hostbyip;
1468
+ }
1469
+
1470
+ /* IPv4 / Kommentar */
1471
+ if ( empty($host) ) {
1472
+ $found = strpos(
1473
+ $ip,
1474
+ self::_cut_ip(
1475
+ gethostbyname($hostbyip)
1476
+ )
1477
+ );
1478
+
1479
+ /* IPv4 / Trackback */
1480
+ } else {
1481
+ /* IP-Vergleich */
1482
+ if ( $hostbyip == $ip ) {
1483
+ return true;
1484
+ }
1485
+
1486
+ /* Treffer suchen */
1487
+ $found = strpos(
1488
+ $ip,
1489
+ self::_cut_ip(
1490
+ gethostbyname($host)
1491
+ )
1492
+ );
1493
+ }
1494
+
1495
+ return $found === false;
1496
+ }
1497
+
1498
+
1499
+ /**
1500
+ * Prüfung auf unerwünschte Sprachen
1501
+ *
1502
+ * @since 2.0
1503
+ * @change 2.4.2
1504
+ *
1505
+ * @param string $content Inhalt des Kommentars
1506
+ * @return boolean TRUE bei Spam
1507
+ */
1508
+
1509
+ private static function _is_lang_spam($content)
1510
+ {
1511
+ /* Init */
1512
+ $lang = self::get_option('translate_lang');
1513
+
1514
+ /* Formatieren */
1515
+ $content = wp_strip_all_tags($content);
1516
+
1517
+ /* Keine Daten? */
1518
+ if ( empty($lang) or empty($content) ) {
1519
+ return false;
1520
+ }
1521
+
1522
+ /* Formatieren */
1523
+ $content = rawurlencode(
1524
+ ( function_exists('mb_substr') ? mb_substr($content, 0, 200) : substr($content, 0, 200) )
1525
+ );
1526
+
1527
+ /* IP abfragen */
1528
+ $response = wp_remote_get(
1529
+ sprintf(
1530
+ 'http://translate.google.com/translate_a/t?client=x&text=%s',
1531
+ $content
1532
+ )
1533
+ );
1534
+
1535
+ /* Fehler? */
1536
+ if ( is_wp_error($response) ) {
1537
+ return false;
1538
+ }
1539
+
1540
+ /* Parsen */
1541
+ preg_match(
1542
+ '/"src":"(\\D{2})"/',
1543
+ wp_remote_retrieve_body($response),
1544
+ $matches
1545
+ );
1546
+
1547
+ /* Fehler? */
1548
+ if ( empty($matches[1]) ) {
1549
+ return false;
1550
+ }
1551
+
1552
+ return ( strtolower($matches[1]) != $lang );
1553
+ }
1554
+
1555
+
1556
+ /**
1557
+ * Prüfung den Kommentar
1558
+ *
1559
+ * @since 2.4
1560
+ * @change 2.4.2
1561
+ *
1562
+ * @param array $comment Daten des Kommentars
1563
+ * @return array Array mit dem Verdachtsgrund [optional]
1564
+ */
1565
+
1566
+ private static function _verify_comment_request($comment)
1567
+ {
1568
+ /* IP */
1569
+ $ip = self::get_key($_SERVER, 'REMOTE_ADDR');
1570
+
1571
+ /* Kommentarwerte */
1572
+ $body = self::get_key($comment, 'comment_content');
1573
+ $email = self::get_key($comment, 'comment_author_email');
1574
+
1575
+ /* Leere Werte ? */
1576
+ if ( empty($ip) or empty($body) or empty($email) ) {
1577
+ return array(
1578
+ 'reason' => 'empty'
1579
+ );
1580
+ }
1581
+
1582
+ /* Optionen */
1583
+ $options = self::get_options();
1584
+
1585
+ /* Bereits kommentiert? */
1586
+ if ( $options['already_commented'] && self::_is_approved_email($email) ) {
1587
+ return;
1588
+ }
1589
+
1590
+ /* Bot erkannt */
1591
+ if ( !empty($_POST['bee_spam']) ) {
1592
+ return array(
1593
+ 'reason' => 'css'
1594
+ );
1595
+ }
1596
+
1597
+ /* Erweiterter Schutz */
1598
+ if ( $options['advanced_check'] && self::_is_fake_ip($ip) ) {
1599
+ return array(
1600
+ 'reason' => 'server'
1601
+ );
1602
+ }
1603
+
1604
+ /* IP im Spam */
1605
+ if ( $options['spam_ip'] && self::_is_spam_ip($ip) ) {
1606
+ return array(
1607
+ 'reason' => 'spamip'
1608
+ );
1609
+ }
1610
+
1611
+ /* Honey Pot */
1612
+ if ( $options['honey_pot'] && self::_is_honey_spam($ip) ) {
1613
+ return array(
1614
+ 'reason' => 'honey'
1615
+ );
1616
+ }
1617
+
1618
+ /* Country Code prüfen */
1619
+ if ( $options['country_code'] && self::_is_spam_country($ip) ) {
1620
+ return array(
1621
+ 'reason' => 'country'
1622
+ );
1623
+ }
1624
+
1625
+ /* Translate API */
1626
+ if ( $options['translate_api'] && self::_is_lang_spam($body) ) {
1627
+ return array(
1628
+ 'reason' => 'lang'
1629
+ );
1630
+ }
1631
+ }
1632
+
1633
+
1634
+ /**
1635
+ * Ausführung des Lösch-/Markier-Vorgangs
1636
+ *
1637
+ * @since 0.1
1638
+ * @change 2.4
1639
+ *
1640
+ * @param array $comment Unbehandelte Kommentardaten
1641
+ * @param string $reason Verdachtsgrund
1642
+ * @param boolean $is_ping Ping (ja oder nein) [optional]
1643
+ * @return array $comment Behandelte Kommentardaten
1644
+ */
1645
+
1646
+ private static function _handle_spam_request($comment, $reason, $is_ping = false)
1647
+ {
1648
+ /* Optionen */
1649
+ $options = self::get_options();
1650
+
1651
+ /* Einstellungen */
1652
+ $spam_remove = !$options['flag_spam'];
1653
+ $spam_notice = !$options['no_notice'];
1654
+
1655
+ /* Filter-Einstellungen */
1656
+ $ignore_filter = $options['ignore_filter'];
1657
+ $ignore_type = $options['ignore_type'];
1658
+ $ignore_reason = in_array($reason, $options['ignore_reasons']);
1659
+
1660
+ /* Spam hochzählen */
1661
+ self::_update_spam_count();
1662
+ self::_update_daily_stats();
1663
+
1664
+ /* Spam löschen */
1665
+ if ( $spam_remove ) {
1666
+ die('Spam deleted.');
1667
+ }
1668
+
1669
+ /* Typen behandeln */
1670
+ if ( $ignore_filter && (( $ignore_type == 1 && $is_ping ) or ( $ignore_type == 2 && !$is_ping )) ) {
1671
+ die('Spam deleted.');
1672
+ }
1673
+
1674
+ /* Spamgrund */
1675
+ if ( $ignore_reason ) {
1676
+ die('Spam deleted.');
1677
+ }
1678
+
1679
+ /* Spam-Grund */
1680
+ self::$reason = $reason;
1681
+
1682
+ /* Spam markieren */
1683
+ add_filter(
1684
+ 'pre_comment_approved',
1685
+ create_function(
1686
+ '',
1687
+ 'return "spam";'
1688
+ )
1689
+ );
1690
+
1691
+ /* E-Mail senden */
1692
+ add_filter(
1693
+ 'trackback_post',
1694
+ array(
1695
+ __CLASS__,
1696
+ 'send_mail_notification'
1697
+ )
1698
+ );
1699
+ add_filter(
1700
+ 'comment_post',
1701
+ array(
1702
+ __CLASS__,
1703
+ 'send_mail_notification'
1704
+ )
1705
+ );
1706
+
1707
+
1708
+ /* Notiz setzen */
1709
+ if ( $spam_notice ) {
1710
+ $comment['comment_content'] = sprintf(
1711
+ '[MARKED AS SPAM BY ANTISPAM BEE | %s]%s%s',
1712
+ self::$default['reasons'][self::$reason],
1713
+ "\n",
1714
+ $comment['comment_content']
1715
+ );
1716
+ }
1717
+
1718
+ return $comment;
1719
+ }
1720
+
1721
+
1722
+ /**
1723
+ * Versand einer Benachrichtigung via E-Mail
1724
+ *
1725
+ * @since 0.1
1726
+ * @change 2.4.2
1727
+ *
1728
+ * @param intval $id ID des Kommentars
1729
+ * @return intval $id ID des Kommentars
1730
+ */
1731
+
1732
+ public static function send_mail_notification($id)
1733
+ {
1734
+ /* Optionen */
1735
+ $options = self::get_options();
1736
+
1737
+ /* Keine Benachrichtigung? */
1738
+ if ( !$options['email_notify'] ) {
1739
+ return $id;
1740
+ }
1741
+
1742
+ /* Kommentar */
1743
+ $comment = get_comment($id, ARRAY_A);
1744
+
1745
+ /* Keine Werte? */
1746
+ if ( empty($comment) ) {
1747
+ return $id;
1748
+ }
1749
+
1750
+ /* Parent-Post */
1751
+ if ( !$post = get_post($comment['comment_post_ID']) ) {
1752
+ return $id;
1753
+ }
1754
+
1755
+ /* Sprache laden */
1756
+ self::load_plugin_lang();
1757
+
1758
+ /* Betreff */
1759
+ $subject = sprintf(
1760
+ '[%s] %s',
1761
+ get_bloginfo('name'),
1762
+ __('Comment marked as spam', self::$short)
1763
+ );
1764
+
1765
+ /* Content */
1766
+ if ( !$content = strip_tags(stripslashes($comment['comment_content'])) ) {
1767
+ $content = sprintf(
1768
+ '-- %s --',
1769
+ __('Content removed by Antispam Bee', self::$short)
1770
+ );
1771
+ }
1772
+
1773
+ /* Body */
1774
+ $body = sprintf(
1775
+ "%s \"%s\"\r\n\r\n",
1776
+ __('New spam comment on your post', self::$short),
1777
+ strip_tags($post->post_title)
1778
+ ).sprintf(
1779
+ "%s: %s\r\n",
1780
+ __('Author'),
1781
+ $comment['comment_author']
1782
+ ).sprintf(
1783
+ "URL: %s\r\n",
1784
+ esc_url($comment['comment_author_url'])
1785
+ ).sprintf(
1786
+ "%s: %s\r\n",
1787
+ __('Type', self::$short),
1788
+ __( ( empty($comment['comment_type']) ? 'Comment' : 'Trackback' ), self::$short )
1789
+ ).sprintf(
1790
+ "Whois: http://whois.arin.net/rest/ip/%s\r\n",
1791
+ $comment['comment_author_IP']
1792
+ ).sprintf(
1793
+ "%s: %s\r\n\r\n",
1794
+ __('Spam Reason', self::$short),
1795
+ __(self::$default['reasons'][self::$reason], self::$short)
1796
+ ).sprintf(
1797
+ "%s\r\n\r\n\r\n",
1798
+ $content
1799
+ ).(
1800
+ EMPTY_TRASH_DAYS ? (
1801
+ sprintf(
1802
+ "%s: %s\r\n",
1803
+ __('Trash it', self::$short),
1804
+ admin_url('comment.php?action=trash&c=' .$id)
1805
+ )
1806
+ ) : (
1807
+ sprintf(
1808
+ "%s: %s\r\n",
1809
+ __('Delete it', self::$short),
1810
+ admin_url('comment.php?action=delete&c=' .$id)
1811
+ )
1812
+ )
1813
+ ).sprintf(
1814
+ "%s: %s\r\n",
1815
+ __('Approve it', self::$short),
1816
+ admin_url('comment.php?action=approve&c=' .$id)
1817
+ ).sprintf(
1818
+ "%s: %s\r\n\r\n",
1819
+ __('Spam list', self::$short),
1820
+ admin_url('edit-comments.php?comment_status=spam')
1821
+ ).sprintf(
1822
+ "%s\r\n%s\r\n",
1823
+ __('Notify message by Antispam Bee', self::$short),
1824
+ __('http://antispambee.com', self::$short)
1825
+ );
1826
+
1827
+ /* Send */
1828
+ wp_mail(
1829
+ get_bloginfo('admin_email'),
1830
+ $subject,
1831
+ $body
1832
+ );
1833
+
1834
+ return $id;
1835
+ }
1836
+
1837
+
1838
+
1839
+
1840
+ ############################
1841
+ ####### STATISTIK ########
1842
+ ############################
1843
+
1844
+
1845
+ /**
1846
+ * Rückgabe der Anzahl von Spam-Kommentaren
1847
+ *
1848
+ * @since 0.1
1849
+ * @change 2.4
1850
+ *
1851
+ * @param intval $count Anzahl der Spam-Kommentare
1852
+ */
1853
+
1854
+ private static function _get_spam_count()
1855
+ {
1856
+ /* Init */
1857
+ $count = self::get_option('spam_count');
1858
+
1859
+ /* Fire */
1860
+ return ( get_locale() == 'de_DE' ? number_format($count, 0, '', '.') : number_format_i18n($count) );
1861
+ }
1862
+
1863
+
1864
+ /**
1865
+ * Ausgabe der Anzahl von Spam-Kommentaren
1866
+ *
1867
+ * @since 0.1
1868
+ * @change 2.4
1869
+ */
1870
+
1871
+ public static function the_spam_count()
1872
+ {
1873
+ echo esc_html( self::_get_spam_count() );
1874
+ }
1875
+
1876
+
1877
+ /**
1878
+ * Aktualisierung der Anzahl von Spam-Kommentaren
1879
+ *
1880
+ * @since 0.1
1881
+ * @change 2.4
1882
+ */
1883
+
1884
+ private static function _update_spam_count()
1885
+ {
1886
+ self::_update_option(
1887
+ 'spam_count',
1888
+ intval( self::get_option('spam_count') + 1 )
1889
+ );
1890
+ }
1891
+
1892
+
1893
+ /**
1894
+ * Aktualisierung der Statistik
1895
+ *
1896
+ * @since 1.9
1897
+ * @change 2.4
1898
+ */
1899
+
1900
+ private static function _update_daily_stats()
1901
+ {
1902
+ /* Init */
1903
+ $stats = (array)self::get_option('daily_stats');
1904
+ $today = (int)strtotime('today');
1905
+
1906
+ /* Hochzählen */
1907
+ if ( array_key_exists($today, $stats) ) {
1908
+ $stats[$today] ++;
1909
+ } else {
1910
+ $stats[$today] = 1;
1911
+ }
1912
+
1913
+ /* Sortieren */
1914
+ krsort($stats, SORT_NUMERIC);
1915
+
1916
+ /* Speichern */
1917
+ self::_update_option(
1918
+ 'daily_stats',
1919
+ array_slice($stats, 0, 31, true)
1920
+ );
1921
+ }
1922
+ }
1923
+
1924
+
1925
+ /* Fire */
1926
+ add_action(
1927
+ 'plugins_loaded',
1928
+ array(
1929
+ 'Antispam_Bee',
1930
+ 'init'
1931
+ )
1932
+ );
1933
+
1934
+ /* Activation */
1935
+ register_activation_hook(
1936
+ __FILE__,
1937
+ array(
1938
+ 'Antispam_Bee',
1939
+ 'activate'
1940
+ )
1941
+ );
1942
+
1943
+ /* Deactivation */
1944
+ register_deactivation_hook(
1945
+ __FILE__,
1946
+ array(
1947
+ 'Antispam_Bee',
1948
+ 'deactivate'
1949
+ )
1950
+ );
1951
+
1952
+ /* Uninstall */
1953
+ register_uninstall_hook(
1954
+ __FILE__,
1955
+ array(
1956
+ 'Antispam_Bee',
1957
+ 'uninstall'
1958
+ )
1959
+ );
css/dashboard.css ADDED
@@ -0,0 +1 @@
 
1
+ #ab_chart{color:#aaa;height:120px;}
css/dashboard.dev.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #ab_chart {
2
+ color: #aaa;
3
+ height: 120px;
4
+ }
css/style.css ADDED
@@ -0,0 +1 @@
 
1
+ #icon-ab{top:5px;left:0;width:36px;height:34px;position:absolute;background:url('../img/icon32.png') no-repeat;}#ab_main .table{width:460px;height:1%;margin:20px 0 0 -10px;}#ab_main .hr{width:283px;margin:10px 0 10px 10px;border-top:1px dotted #dfdfdf;}#ab_main .related tr{display:none;}#ab_main .related tr:first-child{display:table-row;}#ab_main .form-table{margin:0;}#ab_main .form-table th{width:250px;padding-top:8px;vertical-align:middle;}#ab_main .form-table label{text-shadow:none;}#ab_main .form-table small{color:#aaa;}#ab_main .form-table .maxi-text,#ab_main .form-table .maxi-select{width:160px;}#ab_main .form-table .mini-select option{padding-right:6px;}#ab_main select[multiple]{height:60px;}#ab_main .submit{width:431px;height:1%;margin:20px 0 0;padding:15px 0 0;overflow:hidden;border-top:1px solid #bebebe;}#ab_main .submit .help{float:left;color:#bebebe;font-size:11px;line-height:23px;}#ab_main .submit .button-primary{float:right;}#ab_main .nav-tab-wrapper{height:35px;margin:13px 0 0;padding:0 0 0 44px;border-bottom:1px solid #ccc;}#ab_main .nav-tab-wrapper li{float:left;margin:0;padding:0;}#ab_main .nav-tab-wrapper h2{padding:0;}#ab_main .nav-tab-wrapper a{color:#AAA;height:24px;}#ab_main .ui-tabs-selected a{color:#464646;border-color:#ccc;border-bottom:1px solid #fff;}.ui-tabs .ui-tabs-hide{display:none;}#message{display:none;}#setting-error-settings_updated{top:13px;right:15px;margin:0;padding:1px 10px 0;position:absolute;animation:blink 1s cubic-bezier(1,0,0,1) 2;-moz-animation:blink 1s cubic-bezier(1,0,0,1) 2;-webkit-animation:blink 1s cubic-bezier(1,0,0,1) 2;}#setting-error-settings_updated p{padding:0;}@keyframes blink{from{opacity:1;}to{opacity:0;}}@-moz-keyframes blink{from{opacity:1;}to{opacity:0;}}@-webkit-keyframes blink{from{opacity:1;}to{opacity:0;}}
css/style.dev.css ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* @group Icon */
2
+
3
+ #icon-ab {
4
+ top: 5px;
5
+ left: 0;
6
+ width: 36px;
7
+ height: 34px;
8
+ position: absolute;
9
+ background: url('../img/icon32.png') no-repeat;
10
+ }
11
+
12
+ /* @end group */
13
+
14
+
15
+ /* @group GUI */
16
+
17
+ #ab_main .table {
18
+ width: 460px;
19
+ height: 1%;
20
+ margin: 20px 0 0 -10px;
21
+ }
22
+
23
+ #ab_main .hr {
24
+ width: 283px;
25
+ margin: 10px 0 10px 10px;
26
+ border-top: 1px dotted #DFDFDF;
27
+ }
28
+
29
+ #ab_main .related tr {
30
+ display: none;
31
+ }
32
+ #ab_main .related tr:first-child {
33
+ display: table-row;
34
+ }
35
+
36
+ #ab_main .form-table {
37
+ margin: 0;
38
+ }
39
+ #ab_main .form-table th {
40
+ width: 250px;
41
+ padding-top: 8px;
42
+ vertical-align: middle;
43
+ }
44
+ #ab_main .form-table label {
45
+ text-shadow: none;
46
+ }
47
+ #ab_main .form-table small {
48
+ color: #aaa;
49
+ }
50
+ #ab_main .form-table .maxi-text,
51
+ #ab_main .form-table .maxi-select {
52
+ width: 160px;
53
+ }
54
+ #ab_main .form-table .mini-select option {
55
+ padding-right: 6px;
56
+ }
57
+
58
+ #ab_main select[multiple] {
59
+ height: 60px;
60
+ }
61
+
62
+ #ab_main .submit {
63
+ width: 431px;
64
+ height: 1%;
65
+ margin: 20px 0 0;
66
+ padding: 15px 0 0;
67
+ overflow: hidden;
68
+ border-top: 1px solid #bebebe;
69
+ }
70
+ #ab_main .submit .help {
71
+ float: left;
72
+ color: #bebebe;
73
+ font-size: 11px;
74
+ line-height: 23px;
75
+ }
76
+ #ab_main .submit .button-primary {
77
+ float: right;
78
+ }
79
+
80
+ /* @end group */
81
+
82
+
83
+ /* @group Tabs */
84
+
85
+ #ab_main .nav-tab-wrapper {
86
+ height: 35px;
87
+ margin: 13px 0 0;
88
+ padding: 0 0 0 44px;
89
+ border-bottom: 1px solid #ccc;
90
+ }
91
+ #ab_main .nav-tab-wrapper li {
92
+ float: left;
93
+ margin: 0;
94
+ padding: 0;
95
+ }
96
+ #ab_main .nav-tab-wrapper h2 {
97
+ padding: 0;
98
+ }
99
+ #ab_main .nav-tab-wrapper a {
100
+ color: #AAA;
101
+ height: 24px;
102
+ }
103
+ #ab_main .ui-tabs-selected a {
104
+ color: #464646;
105
+ border-color: #ccc;
106
+ border-bottom: 1px solid #fff;
107
+ }
108
+ .ui-tabs .ui-tabs-hide {
109
+ display: none;
110
+ }
111
+
112
+ /* @end group */
113
+
114
+
115
+ /* @group Alert */
116
+
117
+ #message {
118
+ display: none;
119
+ }
120
+ #setting-error-settings_updated {
121
+ top: 13px;
122
+ right: 15px;
123
+ margin: 0;
124
+ padding: 1px 10px 0;
125
+ position: absolute;
126
+
127
+ animation: blink 1s cubic-bezier(1, 0, 0, 1) 2;
128
+ -moz-animation: blink 1s cubic-bezier(1, 0, 0, 1) 2;
129
+ -webkit-animation: blink 1s cubic-bezier(1, 0, 0, 1) 2;
130
+ }
131
+ #setting-error-settings_updated p {
132
+ padding: 0;
133
+ }
134
+
135
+ @keyframes blink {
136
+ from {
137
+ opacity: 1;
138
+ }
139
+ to {
140
+ opacity: 0;
141
+ }
142
+ }
143
+ @-moz-keyframes blink {
144
+ from {
145
+ opacity: 1;
146
+ }
147
+ to {
148
+ opacity: 0;
149
+ }
150
+ }
151
+ @-webkit-keyframes blink {
152
+ from {
153
+ opacity: 1;
154
+ }
155
+ to {
156
+ opacity: 0;
157
+ }
158
+ }
159
+
160
+ /* @end group */
img/icon.png ADDED
Binary file
img/icon32.png ADDED
Binary file
inc/gui.class.php ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /* Sicherheitsabfrage */
5
+ if ( !class_exists('Antispam_Bee') ) {
6
+ die();
7
+ }
8
+
9
+
10
+ /**
11
+ * Antispam_Bee_GUI
12
+ *
13
+ * @since 2.4
14
+ */
15
+
16
+ class Antispam_Bee_GUI extends Antispam_Bee {
17
+
18
+
19
+ /**
20
+ * Speicherung der GUI
21
+ *
22
+ * @since 0.1
23
+ * @change 2.4.2
24
+ */
25
+
26
+ public static function save_changes()
27
+ {
28
+ /* Kein POST? */
29
+ if ( empty($_POST) ) {
30
+ wp_die(__('Cheatin&#8217; uh?'));
31
+ }
32
+
33
+ /* Referer prüfen */
34
+ check_admin_referer(self::$short);
35
+
36
+ /* Optionen ermitteln */
37
+ $options = array(
38
+ 'flag_spam' => (int)(!empty($_POST['ab_flag_spam'])),
39
+ 'email_notify' => (int)(!empty($_POST['ab_email_notify'])),
40
+ 'cronjob_enable' => (int)(!empty($_POST['ab_cronjob_enable'])),
41
+ 'cronjob_interval' => (int)self::get_key($_POST, 'ab_cronjob_interval'),
42
+
43
+ 'no_notice' => (int)(!empty($_POST['ab_no_notice'])),
44
+
45
+ 'dashboard_count' => (int)(!empty($_POST['ab_dashboard_count'])),
46
+ 'dashboard_chart' => (int)(!empty($_POST['ab_dashboard_chart'])),
47
+ 'advanced_check' => (int)(!empty($_POST['ab_advanced_check'])),
48
+ 'spam_ip' => (int)(!empty($_POST['ab_spam_ip'])),
49
+ 'already_commented' => (int)(!empty($_POST['ab_already_commented'])),
50
+ 'always_allowed' => (int)(!empty($_POST['ab_always_allowed'])),
51
+
52
+ 'ignore_pings' => (int)(!empty($_POST['ab_ignore_pings'])),
53
+ 'ignore_filter' => (int)(!empty($_POST['ab_ignore_filter'])),
54
+ 'ignore_type' => (int)self::get_key($_POST, 'ab_ignore_type'),
55
+ 'ignore_reasons' => (array)self::get_key($_POST, 'ab_ignore_reasons'),
56
+
57
+ 'honey_pot' => (int)(!empty($_POST['ab_honey_pot'])),
58
+ 'honey_key' => sanitize_text_field(self::get_key($_POST, 'ab_honey_key')),
59
+
60
+ 'country_code' => (int)(!empty($_POST['ab_country_code'])),
61
+ 'country_black' => sanitize_text_field(self::get_key($_POST, 'ab_country_black')),
62
+ 'country_white' => sanitize_text_field(self::get_key($_POST, 'ab_country_white')),
63
+
64
+ 'translate_api' => (int)(!empty($_POST['ab_translate_api'])),
65
+ 'translate_lang' => sanitize_text_field(self::get_key($_POST, 'ab_translate_lang')),
66
+
67
+ 'tab_index' => (int)self::get_key($_POST, 'ab_tab_index')
68
+ );
69
+
70
+ /* Kein Tag eingetragen? */
71
+ if ( empty($options['cronjob_interval']) ) {
72
+ $options['cronjob_enable'] = 0;
73
+ }
74
+
75
+ /* Honey Key reinigen */
76
+ if ( !empty($options['honey_key']) ) {
77
+ $options['honey_key'] = preg_replace(
78
+ '/[^a-z]/',
79
+ '',
80
+ strtolower($options['honey_key'])
81
+ );
82
+ }
83
+ if ( empty($options['honey_key']) ) {
84
+ $options['honey_pot'] = 0;
85
+ }
86
+
87
+ /* Translate API */
88
+ if ( !empty($options['translate_lang']) ) {
89
+ if ( !preg_match('/^(de|en|fr|it|es)$/', $options['translate_lang']) ) {
90
+ $options['translate_lang'] = '';
91
+ }
92
+ }
93
+ if ( empty($options['translate_lang']) ) {
94
+ $options['translate_api'] = 0;
95
+ }
96
+
97
+
98
+ /* Blacklist reinigen */
99
+ if ( !empty($options['country_black']) ) {
100
+ $options['country_black'] = preg_replace(
101
+ '/[^A-Z ]/',
102
+ '',
103
+ strtoupper($options['country_black'])
104
+ );
105
+ }
106
+
107
+ /* Whitelist reinigen */
108
+ if ( !empty($options['country_white']) ) {
109
+ $options['country_white'] = preg_replace(
110
+ '/[^A-Z ]/',
111
+ '',
112
+ strtoupper($options['country_white'])
113
+ );
114
+ }
115
+
116
+ /* Leere Listen? */
117
+ if ( empty($options['country_black']) && empty($options['country_white']) ) {
118
+ $options['country_code'] = 0;
119
+ }
120
+
121
+
122
+ /* Cron stoppen? */
123
+ if ( $options['cronjob_enable'] && !self::get_option('cronjob_enable') ) {
124
+ self::init_scheduled_hook();
125
+ } else if ( !$options['cronjob_enable'] && self::get_option('cronjob_enable') ) {
126
+ self::clear_scheduled_hook();
127
+ }
128
+
129
+ /* Optionen speichern */
130
+ self::update_options($options);
131
+
132
+ /* Redirect */
133
+ wp_safe_redirect(
134
+ add_query_arg(
135
+ array(
136
+ 'updated' => 'true'
137
+ ),
138
+ wp_get_referer()
139
+ )
140
+ );
141
+
142
+ die();
143
+ }
144
+
145
+
146
+ /**
147
+ * Der aktive Tab
148
+ *
149
+ * @since 2.4
150
+ * @change 2.4
151
+ */
152
+
153
+ private static function _tab_index()
154
+ {
155
+ echo ( empty($_GET['updated']) ? 0 : (int)self::get_option('tab_index') );
156
+ }
157
+
158
+
159
+ /**
160
+ * Anzeige der GUI
161
+ *
162
+ * @since 0.1
163
+ * @change 2.4.2
164
+ */
165
+
166
+ function options_page() { ?>
167
+ <div class="wrap" id="ab_main">
168
+ <form action="<?php echo admin_url('admin-post.php') ?>" method="post">
169
+ <?php $options = self::get_options() ?>
170
+
171
+ <?php wp_nonce_field(self::$short) ?>
172
+
173
+ <input type="hidden" name="action" value="ab_save_changes" />
174
+ <input type="hidden" name="ab_tab_index" id="ab_tab_index" value="<?php self::_tab_index() ?>" />
175
+
176
+ <?php screen_icon('ab') ?>
177
+
178
+ <ul class="nav-tab-wrapper">
179
+ <li class="ui-tabs-selected">
180
+ <h2><a href="#ab-tab-general" class="nav-tab"><?php esc_html_e('General', self::$short) ?></a></h2>
181
+ </li>
182
+ <li>
183
+ <h2><a href="#ab-tab-filter" class="nav-tab"><?php esc_html_e('Filter', self::$short) ?></a></h2>
184
+ </li>
185
+ <li>
186
+ <h2><a href="#ab-tab-advanced" class="nav-tab"><?php esc_html_e('Advanced', self::$short) ?></a></h2>
187
+ </li>
188
+ </ul>
189
+
190
+ <!-- Allgemein -->
191
+ <div class="table ui-tabs-hide" id="ab-tab-general">
192
+ <table class="form-table">
193
+ <tr>
194
+ <th>
195
+ <label for="ab_advanced_check">
196
+ <?php esc_html_e('Stricter inspection for comments and pings', self::$short) ?>
197
+ </label>
198
+ </th>
199
+ <td>
200
+ <input type="checkbox" name="ab_advanced_check" id="ab_advanced_check" value="1" <?php checked($options['advanced_check'], 1) ?> />
201
+ </td>
202
+ </tr>
203
+
204
+ <tr>
205
+ <th>
206
+ <label for="ab_spam_ip">
207
+ <?php esc_html_e('Consider comments which are already marked as spam', self::$short) ?>
208
+ </label>
209
+ </th>
210
+ <td>
211
+ <input type="checkbox" name="ab_spam_ip" id="ab_spam_ip" value="1" <?php checked($options['spam_ip'], 1) ?> />
212
+ </td>
213
+ </tr>
214
+
215
+ <tr>
216
+ <th>
217
+ <label for="ab_already_commented">
218
+ <?php esc_html_e('Do not check if the comment author has already approved', self::$short) ?>
219
+ </label>
220
+ </th>
221
+ <td>
222
+ <input type="checkbox" name="ab_already_commented" id="ab_already_commented" value="1" <?php checked($options['already_commented'], 1) ?> />
223
+ </td>
224
+ </tr>
225
+
226
+ <tr>
227
+ <th>
228
+ <label for="ab_ignore_pings">
229
+ <?php esc_html_e('Do not check trackbacks / pingbacks', self::$short) ?>
230
+ </label>
231
+ </th>
232
+ <td>
233
+ <input type="checkbox" name="ab_ignore_pings" id="ab_ignore_pings" value="1" <?php checked($options['ignore_pings'], 1) ?> />
234
+ </td>
235
+ </tr>
236
+
237
+ <tr>
238
+ <th>
239
+ <label for="ab_always_allowed">
240
+ <?php esc_html_e('Comment form used outside of posts', self::$short) ?>
241
+ </label>
242
+ </th>
243
+ <td>
244
+ <input type="checkbox" name="ab_always_allowed" id="ab_always_allowed" value="1" <?php checked($options['always_allowed'], 1) ?> />
245
+ </td>
246
+ </tr>
247
+ </table>
248
+
249
+ <p class="hr"></p>
250
+
251
+ <table class="form-table">
252
+ <tr>
253
+ <th>
254
+ <label for="ab_dashboard_chart">
255
+ <?php esc_html_e('Statistics on the dashboard', self::$short) ?>
256
+ </label>
257
+ </th>
258
+ <td>
259
+ <input type="checkbox" name="ab_dashboard_chart" id="ab_dashboard_chart" value="1" <?php checked($options['dashboard_chart'], 1) ?> />
260
+ </td>
261
+ </tr>
262
+
263
+ <tr>
264
+ <th>
265
+ <label for="ab_dashboard_count">
266
+ <?php esc_html_e('Spam counter on the dashboard', self::$short) ?>
267
+ </label>
268
+ </th>
269
+ <td>
270
+ <input type="checkbox" name="ab_dashboard_count" id="ab_dashboard_count" value="1" <?php checked($options['dashboard_count'], 1) ?> />
271
+ </td>
272
+ </tr>
273
+ </table>
274
+ </div>
275
+
276
+
277
+ <!-- Filter -->
278
+ <div class="table ui-tabs-hide" id="ab-tab-filter">
279
+ <!-- IP info DB -->
280
+ <table class="form-table related">
281
+ <tr>
282
+ <th>
283
+ <label for="ab_country_code">
284
+ <?php esc_html_e('Block comments and pings from specific countries', self::$short) ?>
285
+ </label>
286
+ </th>
287
+ <td>
288
+ <input type="checkbox" name="ab_country_code" id="ab_country_code" value="1" <?php checked($options['country_code'], 1) ?> />
289
+ </td>
290
+ </tr>
291
+
292
+ <tr>
293
+ <th>
294
+ <label for="ab_country_black">
295
+ <?php esc_html_e('Blacklist', self::$short) ?> <?php esc_html_e('as', self::$short) ?> <a href="http://www.iso.org/iso/country_names_and_code_elements" target="_blank"><?php esc_html_e('iso codes', self::$short) ?></a>
296
+ </label>
297
+ </th>
298
+ <td>
299
+ <input type="text" name="ab_country_black" id="ab_country_black" value="<?php echo esc_attr($options['country_black']); ?>" class="maxi-text code" />
300
+ </td>
301
+ </tr>
302
+
303
+ <tr>
304
+ <th>
305
+ <label for="ab_country_white">
306
+ <?php esc_html_e('Whitelist', self::$short) ?> <?php esc_html_e('as', self::$short) ?> <a href="http://www.iso.org/iso/country_names_and_code_elements" target="_blank"><?php esc_html_e('iso codes', self::$short) ?></a>
307
+ </label>
308
+ </th>
309
+ <td>
310
+ <input type="text" name="ab_country_white" id="ab_country_white" value="<?php echo esc_attr($options['country_white']); ?>" class="maxi-text code" />
311
+ </td>
312
+ </tr>
313
+ </table>
314
+
315
+ <p class="hr"></p>
316
+
317
+ <!-- Translate API -->
318
+ <table class="form-table related">
319
+ <tr>
320
+ <th>
321
+ <label for="ab_translate_api">
322
+ <?php esc_html_e('Allow comments only in certain language', self::$short) ?>
323
+ </label>
324
+ </th>
325
+ <td>
326
+ <input type="checkbox" name="ab_translate_api" id="ab_translate_api" value="1" <?php checked($options['translate_api'], 1) ?> />
327
+ </td>
328
+ </tr>
329
+
330
+ <tr>
331
+ <th>
332
+ <label for="ab_translate_lang">
333
+ <?php esc_html_e('Language', self::$short) ?>
334
+ </label>
335
+ </th>
336
+ <td>
337
+ <select name="ab_translate_lang" class="maxi-select">
338
+ <?php foreach(array('de' => 'German', 'en' => 'English', 'fr' => 'French', 'it' => 'Italian', 'es' => 'Spanish') as $k => $v) { ?>
339
+ <option <?php selected($options['translate_lang'], $k); ?> value="<?php echo esc_attr($k) ?>"><?php esc_html_e($v, self::$short) ?></option>
340
+ <?php } ?>
341
+ </select>
342
+ </td>
343
+ </tr>
344
+ </table>
345
+
346
+ <p class="hr"></p>
347
+
348
+ <!-- Honey Pot -->
349
+ <table class="form-table related">
350
+ <tr>
351
+ <th>
352
+ <label for="ab_honey_pot">
353
+ <?php esc_html_e('Search comment spammers in the Project Honey Pot', self::$short) ?>
354
+ </label>
355
+ </th>
356
+ <td>
357
+ <input type="checkbox" name="ab_honey_pot" id="ab_honey_pot" value="1" <?php checked($options['honey_pot'], 1) ?> />
358
+ </td>
359
+ </tr>
360
+
361
+ <tr>
362
+ <th>
363
+ <label for="ab_honey_key">
364
+ Project Honey Pot <a href="http://www.projecthoneypot.org/httpbl_configure.php" target="_blank">API Key</a>
365
+ </label>
366
+ </th>
367
+ <td>
368
+ <input type="text" name="ab_honey_key" id="ab_honey_key" value="<?php echo esc_attr($options['honey_key']); ?>" class="maxi-text code" />
369
+ </td>
370
+ </tr>
371
+ </table>
372
+ </div>
373
+
374
+
375
+ <!-- Erweitert -->
376
+ <div class="table ui-tabs-hide" id="ab-tab-advanced">
377
+ <table class="form-table related">
378
+ <tr>
379
+ <th>
380
+ <label for="ab_flag_spam">
381
+ <?php esc_html_e('Mark as Spam, do not delete', self::$short) ?>
382
+ </label>
383
+ </th>
384
+ <td>
385
+ <input type="checkbox" name="ab_flag_spam" id="ab_flag_spam" value="1" <?php checked($options['flag_spam'], 1) ?> />
386
+ </td>
387
+ </tr>
388
+
389
+ <tr>
390
+ <th>
391
+ <label for="ab_email_notify">
392
+ <?php esc_html_e('Notification by email', self::$short) ?>
393
+ </label>
394
+ </th>
395
+ <td>
396
+ <input type="checkbox" name="ab_email_notify" id="ab_email_notify" value="1" <?php checked($options['email_notify'], 1) ?> />
397
+ </td>
398
+ </tr>
399
+
400
+ <tr>
401
+ <th>
402
+ <?php echo sprintf(esc_html__('Spam will be automatically deleted after %s days', self::$short), '<input type="text" name="ab_cronjob_interval" value="' .esc_attr($options['cronjob_interval']). '" class="small-text" />') ?>
403
+ <?php if ( $options['cronjob_enable'] && $options['cronjob_timestamp'] ) {
404
+ echo sprintf(
405
+ '<br /><small>%s @ %s</small>',
406
+ esc_html__('Last check', self::$short),
407
+ date_i18n('d.m.Y H:i:s', ($options['cronjob_timestamp'] + get_option('gmt_offset') * 3600))
408
+ );
409
+ } ?>
410
+ </th>
411
+ <td>
412
+ <input type="checkbox" name="ab_cronjob_enable" id="ab_cronjob_enable" value="1" <?php checked($options['cronjob_enable'], 1) ?> />
413
+ </td>
414
+ </tr>
415
+
416
+ <tr>
417
+ <th>
418
+ <label for="ab_no_notice">
419
+ <?php esc_html_e('Hide the &quot;MARKED AS SPAM&quot; note', self::$short) ?>
420
+ </label>
421
+ </th>
422
+ <td>
423
+ <input type="checkbox" name="ab_no_notice" id="ab_no_notice" value="1" <?php checked($options['no_notice'], 1) ?> />
424
+ </td>
425
+ </tr>
426
+
427
+ <tr>
428
+ <th>
429
+ <?php esc_html_e('Limit on', self::$short) ?> <select name="ab_ignore_type" class="mini-select"><?php foreach(array(1 => 'Comments', 2 => 'Pings') as $key => $value) {
430
+ echo '<option value="' .esc_attr($key). '" ';
431
+ selected($options['ignore_type'], $key);
432
+ echo '>' .esc_html__($value). '</option>';
433
+ } ?>
434
+ </select>
435
+ </th>
436
+ <td>
437
+ <input type="checkbox" name="ab_ignore_filter" id="ab_ignore_filter" value="1" <?php checked($options['ignore_filter'], 1) ?> />
438
+ </td>
439
+ </tr>
440
+
441
+ <tr>
442
+ <th style="vertical-align: top">
443
+ <label for="ab_ignore_reasons">
444
+ <?php esc_html_e('Delete comments by spam reasons', self::$short) ?>
445
+ <small><?php esc_html_e('Multiple choice or deselection by pressing Ctrl/CMD', self::$short) ?></small>
446
+ </label>
447
+ </th>
448
+ <td>
449
+ <select name="ab_ignore_reasons[]" id="ab_ignore_reasons" size="2" multiple="multiple" class="maxi-select">
450
+ <?php foreach ( self::$default['reasons'] as $k => $v) { ?>
451
+ <option <?php selected(in_array($k, $options['ignore_reasons']), true); ?> value="<?php echo $k ?>"><?php esc_html_e($v, self::$short) ?></option>
452
+ <?php } ?>
453
+ </select>
454
+ </td>
455
+ </tr>
456
+ </table>
457
+ </div>
458
+
459
+
460
+ <p class="submit">
461
+ <?php if ( get_locale() == 'de_DE' ) { ?>
462
+ <a href="http://playground.ebiene.de/antispam-bee-wordpress-plugin/" class="help" target="_blank">
463
+ Dokumentation
464
+ </a>
465
+ <?php } ?>
466
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
467
+ </p>
468
+ </form>
469
+ </div>
470
+ <?php }
471
+ }
js/dashboard.dev.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ google.load("visualization", "1", {packages:["corechart"]});
2
+ google.setOnLoadCallback(drawChart);
3
+
4
+ function drawChart() {
5
+ /* Init */
6
+ var id,
7
+ rows = [],
8
+ output = document.getElementById('ab_chart'),
9
+ data = new google.visualization.DataTable();
10
+
11
+ /* Leer? */
12
+ if ( !output || !antispambee.created.length ) {
13
+ return;
14
+ }
15
+
16
+ /* Extrahieren */
17
+ var created = antispambee.created.split(','),
18
+ count = antispambee.count.split(',');
19
+
20
+ /* Loopen */
21
+ for (id in created) {
22
+ rows[id] = [created[id], parseInt(count[id], 10)];
23
+ }
24
+
25
+ data.addColumn('string', 'Date');
26
+ data.addColumn('number', 'Spam');
27
+ data.addRows(rows);
28
+
29
+ var chart = new google.visualization.AreaChart(output);
30
+ chart.draw(
31
+ data,
32
+ {
33
+ width: parseInt(jQuery('#ab_chart').parent().width(), 10),
34
+ height: 120,
35
+ legend: 'none',
36
+ pointSize: 6,
37
+ lineWidth: 3,
38
+ gridlineColor: '#ececec',
39
+ colors:['#3399CC'],
40
+ reverseCategories: true,
41
+ backgroundColor: 'transparent',
42
+ vAxis: {
43
+ baselineColor: 'transparent',
44
+ textPosition: 'in',
45
+ textStyle: {
46
+ color: '#8F8F8F',
47
+ fontSize: 10
48
+ }
49
+ },
50
+ hAxis: {
51
+ textStyle: {
52
+ color: '#3399CC',
53
+ fontSize: 10
54
+ }
55
+ },
56
+ chartArea: {
57
+ width: "100%",
58
+ height: "100%"
59
+ }
60
+ }
61
+ );
62
+ }
js/dashboard.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ google.load("visualization","1",{packages:["corechart"]});google.setOnLoadCallback(drawChart);
2
+ function drawChart(){var a,c=[],d=document.getElementById("ab_chart"),b=new google.visualization.DataTable;if(d&&antispambee.created.length){var e=antispambee.created.split(","),f=antispambee.count.split(",");for(a in e)c[a]=[e[a],parseInt(f[a],10)];b.addColumn("string","Date");b.addColumn("number","Spam");b.addRows(c);(new google.visualization.AreaChart(d)).draw(b,{width:parseInt(jQuery("#ab_chart").parent().width(),10),height:120,legend:"none",pointSize:6,lineWidth:3,gridlineColor:"#ececec",colors:["#3399CC"],
3
+ reverseCategories:!0,backgroundColor:"transparent",vAxis:{baselineColor:"transparent",textPosition:"in",textStyle:{color:"#8F8F8F",fontSize:10}},hAxis:{textStyle:{color:"#3399CC",fontSize:10}},chartArea:{width:"100%",height:"100%"}})}};
js/script.dev.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(
2
+ function($) {
3
+ /* Mini Plugin */
4
+ $.fn.abManageOptions = function() {
5
+ var $$ = this,
6
+ obj = $$.parents('tr').nextAll('tr');
7
+
8
+ obj.toggle(
9
+ 0,
10
+ function() {
11
+ obj.children().find(':input').attr('disabled', !$$.attr('checked'));
12
+ }
13
+ );
14
+ }
15
+
16
+ /* Event abwickeln */
17
+ $('#ab_main .related tr:first-child :checkbox').click(
18
+ function() {
19
+ $(this).abManageOptions();
20
+ }
21
+ ).filter(':checked').abManageOptions();
22
+
23
+
24
+ /* Tabs steuern */
25
+ $('#ab_main').tabs(
26
+ {
27
+ 'select': function(event, ui) {
28
+ $('#ab_tab_index').val(ui.index);
29
+ },
30
+ 'selected': parseInt($('#ab_tab_index').val())
31
+ }
32
+ );
33
+
34
+ /* Alert ausblenden */
35
+ if ( typeof $.fn.delay === 'function' ) {
36
+ $('#setting-error-settings_updated').delay(5000).fadeOut();
37
+ }
38
+ }
39
+ );
js/script.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(a){a.fn.abManageOptions=function(){var a=this,b=a.parents("tr").nextAll("tr");b.toggle(0,function(){b.children().find(":input").attr("disabled",!a.attr("checked"))})};a("#ab_main .related tr:first-child :checkbox").click(function(){a(this).abManageOptions()}).filter(":checked").abManageOptions();a("#ab_main").tabs({select:function(c,b){a("#ab_tab_index").val(b.index)},selected:parseInt(a("#ab_tab_index").val())});"function"===typeof a.fn.delay&&a("#setting-error-settings_updated").delay(5E3).fadeOut()});
lang/antispam_bee-de_DE.mo ADDED
Binary file
lang/antispam_bee-de_DE.po ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Antispam Bee\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-Language: German\n"
12
+ "X-Poedit-Country: GERMANY\n"
13
+ "X-Poedit-SourceCharset: utf-8\n"
14
+ "X-Poedit-KeywordsList: __;_e\n"
15
+ "X-Poedit-Basepath: .\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ msgid "No data available."
19
+ msgstr "Noch keine Daten vorhanden."
20
+
21
+ msgid "New spam comment on your post"
22
+ msgstr "Neuer Spam zum Artikel"
23
+
24
+ msgid "Advanced"
25
+ msgstr "Erweitert"
26
+
27
+ msgid "Filter"
28
+ msgstr "Filter"
29
+
30
+ msgid "General"
31
+ msgstr "Allgemein"
32
+
33
+ msgid "Comment"
34
+ msgstr "Kommentar"
35
+
36
+ msgid "Type"
37
+ msgstr "Typ"
38
+
39
+ msgid "Spam Reason"
40
+ msgstr "Spamgrund"
41
+
42
+ msgid "Empty Data"
43
+ msgstr "Leere Daten"
44
+
45
+ msgid "CSS Hack"
46
+ msgstr "CSS Hack"
47
+
48
+ msgid "Server IP"
49
+ msgstr "Server IP"
50
+
51
+ msgid "Spam IP"
52
+ msgstr "Spam IP"
53
+
54
+ msgid "Comment Language"
55
+ msgstr "Kommentarsprache"
56
+
57
+ msgid "Country Check"
58
+ msgstr "Ländercode"
59
+
60
+ msgid "Honey Pot"
61
+ msgstr "Honey Pot"
62
+
63
+ msgid "as"
64
+ msgstr "als"
65
+
66
+ msgid "iso codes"
67
+ msgstr "ISO Codes"
68
+
69
+ msgid "Approve it"
70
+ msgstr "Freigeben"
71
+
72
+ msgid "Delete it"
73
+ msgstr "Löschen"
74
+
75
+ msgid "Trash it"
76
+ msgstr "In Papierkorb"
77
+
78
+ msgid "Spam list"
79
+ msgstr "Spamliste"
80
+
81
+ msgid "Notify message by Antispam Bee"
82
+ msgstr "Benachrichtigung von Antispam Bee"
83
+
84
+ msgid "Content removed by Antispam Bee"
85
+ msgstr "Inhalt entfernt von Antispam Bee"
86
+
87
+ msgid "Last check"
88
+ msgstr "Zuletzt"
89
+
90
+ msgid "Blocked"
91
+ msgstr "Blockiert"
92
+
93
+ msgid "Today"
94
+ msgstr "Heute"
95
+
96
+ msgid "Easy and extremely productive spam-fighting plugin with many sophisticated solutions. Includes protection again trackback spam."
97
+ msgstr "Simples, äußerst effektives Plugin zur Bekämpfung von Spam-Kommentaren. Datenschutzkonform, funktionsreich und unkompliziert."
98
+
99
+ msgid "http://antispambee.com"
100
+ msgstr "http://antispambee.de"
101
+
102
+ # Spam detection
103
+ msgid "Mark as Spam, do not delete"
104
+ msgstr "Spam markieren, nicht löschen"
105
+
106
+ msgid "Limit on"
107
+ msgstr "Beschränken auf"
108
+
109
+ msgid "Spam will be automatically deleted after %s days"
110
+ msgstr "Löschung nach %s Tagen"
111
+
112
+ msgid "Notification by email"
113
+ msgstr "Benachrichtigung via E-Mail"
114
+
115
+ msgid "Delete comments by spam reasons"
116
+ msgstr "Bei gewählten Spamgründen sofort löschen"
117
+
118
+ msgid "Multiple choice or deselection by pressing Ctrl/CMD"
119
+ msgstr "Mehrfachauswahl bzw. Abwahl mit Strg/CMD"
120
+
121
+ msgid "Hide the &quot;MARKED AS SPAM&quot; note"
122
+ msgstr "&quot;MARKED AS SPAM&quot; unterdrücken"
123
+
124
+ msgid "Comment marked as spam"
125
+ msgstr "Spam-Benachrichtigung"
126
+
127
+ # Block countries
128
+ msgid "Block comments and pings from specific countries"
129
+ msgstr "Länder blockieren bzw. erlauben"
130
+
131
+ msgid "Blacklist"
132
+ msgstr "Blacklist"
133
+
134
+ msgid "Whitelist"
135
+ msgstr "Whitelist"
136
+
137
+ # Project Honey Pot
138
+ msgid "Search comment spammers in the Project Honey Pot"
139
+ msgstr "Project Honey Pot als Quelle für Spam"
140
+
141
+ msgid "English"
142
+ msgstr "Englisch"
143
+
144
+ msgid "German"
145
+ msgstr "Deutsch"
146
+
147
+ msgid "French"
148
+ msgstr "Französisch"
149
+
150
+ msgid "Italian"
151
+ msgstr "Italienisch"
152
+
153
+ msgid "Spanish"
154
+ msgstr "Spanisch"
155
+
156
+ # Translate API
157
+ msgid "Allow comments only in certain language"
158
+ msgstr "Inhalte nur in einer Sprache zulassen"
159
+
160
+ msgid "Language"
161
+ msgstr "Sprache"
162
+
163
+ # Extended
164
+ msgid "Stricter inspection for comments and pings"
165
+ msgstr "Zusatzchecks für Kommentare und Pings"
166
+
167
+ msgid "Consider comments which are already marked as spam"
168
+ msgstr "Lernfähigkeit für aktuellen Datenbestand"
169
+
170
+ msgid "Do not check if the comment author has already approved"
171
+ msgstr "Genehmigten Kommentatoren vertrauen"
172
+
173
+ # Misc
174
+ msgid "Spam counter on the dashboard"
175
+ msgstr "Spam-Anzahl auf dem Dashboard"
176
+
177
+ msgid "Statistics on the dashboard"
178
+ msgstr "Verlauf-Statistik auf dem Dashboard"
179
+
180
+ msgid "Do not check trackbacks / pingbacks"
181
+ msgstr "Keine Prüfung der Ping- und Trackbacks"
182
+
183
+ msgid "Comment form used outside of posts"
184
+ msgstr "Kommentarformular auf Archivseiten"
185
+
lang/antispam_bee-ru_RU.mo ADDED
Binary file
lang/antispam_bee-ru_RU.po ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Antispam Bee\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-Language: German\n"
12
+ "X-Poedit-Country: GERMANY\n"
13
+ "X-Poedit-SourceCharset: utf-8\n"
14
+ "X-Poedit-KeywordsList: __;_e\n"
15
+ "X-Poedit-Basepath: .\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ msgid "No data available."
19
+ msgstr "Нет данных."
20
+
21
+ msgid "New spam comment on your post"
22
+ msgstr "Новый спам комментарий"
23
+
24
+ msgid "Advanced"
25
+ msgstr "Расширенные"
26
+
27
+ msgid "Filter"
28
+ msgstr "Фильтры"
29
+
30
+ msgid "General"
31
+ msgstr "Общие"
32
+
33
+ msgid "Comment"
34
+ msgstr "Kомментарий"
35
+
36
+ msgid "Type"
37
+ msgstr "Tип"
38
+
39
+ msgid "Spam Reason"
40
+ msgstr "Причина спама"
41
+
42
+ msgid "Empty Data"
43
+ msgstr "Нет данных"
44
+
45
+ msgid "CSS Hack"
46
+ msgstr "CSS Hack"
47
+
48
+ msgid "Server IP"
49
+ msgstr "Server IP"
50
+
51
+ msgid "Spam IP"
52
+ msgstr "Spam IP"
53
+
54
+ msgid "Comment Language"
55
+ msgstr "Язык комментария"
56
+
57
+ msgid "Country Check"
58
+ msgstr "Проверка страны"
59
+
60
+ msgid "Honey Pot"
61
+ msgstr "Honey Pot"
62
+
63
+ msgid "as"
64
+ msgstr "как"
65
+
66
+ msgid "iso codes"
67
+ msgstr "ISO Codes"
68
+
69
+ msgid "Approve it"
70
+ msgstr "Разрешить его"
71
+
72
+ msgid "Delete it"
73
+ msgstr "Удалить его"
74
+
75
+ msgid "Trash it"
76
+ msgstr "В помойку его"
77
+
78
+ msgid "Spam list"
79
+ msgstr "Список спама"
80
+
81
+ msgid "Notify message by Antispam Bee"
82
+ msgstr "Сообщение от Antispam Bee"
83
+
84
+ msgid "Content removed by Antispam Bee"
85
+ msgstr "Содержимое удалено"
86
+
87
+ msgid "Last check"
88
+ msgstr "Последний раз"
89
+
90
+ msgid "Blocked"
91
+ msgstr "Заблокировано"
92
+
93
+ msgid "Today"
94
+ msgstr "Сегодня"
95
+
96
+ msgid "Easy and extremely productive spam-fighting plugin with many sophisticated solutions. Includes protection again trackback spam."
97
+ msgstr "Простой и очень продуктивный антиспам плагин. Включает в себя защиту от trackback спама."
98
+
99
+ msgid "http://antispambee.com"
100
+ msgstr "http://antispambee.de"
101
+
102
+ # Spam detection
103
+ msgid "Mark as Spam, do not delete"
104
+ msgstr "Отметить как спам, не удалять"
105
+
106
+ msgid "Limit on"
107
+ msgstr "Ограничить на"
108
+
109
+ msgid "Spam will be automatically deleted after %s days"
110
+ msgstr "Спам машинально удалять через %s дней"
111
+
112
+ msgid "Notification by email"
113
+ msgstr "Отправить емайл при новом спаме"
114
+
115
+ msgid "Delete comments by spam reasons"
116
+ msgstr "Удаление спама в комментариях по причинам"
117
+
118
+ msgid "Multiple choice or deselection by pressing Ctrl/CMD"
119
+ msgstr "Выбор или отменa нажав клавиши Strg/CMD"
120
+
121
+ msgid "Hide the &quot;MARKED AS SPAM&quot; note"
122
+ msgstr "Скрыть замечание &quot;MARKED AS SPAM&quot;"
123
+
124
+ msgid "Comment marked as spam"
125
+ msgstr "Kомментарий помечен как спам"
126
+
127
+ # Block countries
128
+ msgid "Block comments and pings from specific countries"
129
+ msgstr "Банить или разрешать страны"
130
+
131
+ msgid "Blacklist"
132
+ msgstr "Черный список"
133
+
134
+ msgid "Whitelist"
135
+ msgstr "Белый список"
136
+
137
+ # Project Honey Pot
138
+ msgid "Search comment spammers in the Project Honey Pot"
139
+ msgstr "Поиск спамеров в Project Honey Pot"
140
+
141
+ msgid "English"
142
+ msgstr "Английский"
143
+
144
+ msgid "German"
145
+ msgstr "Немецкий"
146
+
147
+ msgid "French"
148
+ msgstr "Французский"
149
+
150
+ msgid "Italian"
151
+ msgstr "Итальянский"
152
+
153
+ msgid "Spanish"
154
+ msgstr "Испанский"
155
+
156
+ # Translate API
157
+ msgid "Allow comments only in certain language"
158
+ msgstr "Разрешить комментарии только в одном языке"
159
+
160
+ msgid "Language"
161
+ msgstr "Язык"
162
+
163
+ # Extended
164
+ msgid "Stricter inspection for comments and pings"
165
+ msgstr "Строгий контроль на входящие комментарии"
166
+
167
+ msgid "Consider comments which are already marked as spam"
168
+ msgstr "Учитывать сpам из базы данных"
169
+
170
+ msgid "Do not check if the comment author has already approved"
171
+ msgstr "Не проверять, если автор уже комментировал и был утвержден"
172
+
173
+ # Misc
174
+ msgid "Spam counter on the dashboard"
175
+ msgstr "Заблокированный спам показать на панели инструментов"
176
+
177
+ msgid "Statistics on the dashboard"
178
+ msgstr "Статистикa на панели инструментов"
179
+
180
+ msgid "Do not check trackbacks / pingbacks"
181
+ msgstr "Не проверять trackbacks и pingbacks"
182
+
183
+ msgid "Comment form used outside of posts"
184
+ msgstr "Комментарии также используются вне постов и страниц"
185
+
readme.txt ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Antispam Bee ===
2
+ Contributors: sergej.mueller
3
+ Tags: antispam, spam, comments, trackback
4
+ Donate link: http://flattr.com/profile/sergej.mueller
5
+ Requires at least: 3.3
6
+ Tested up to: 3.4
7
+ Stable tag: trunk
8
+
9
+
10
+
11
+ Anonymous and independent antispam solution. Detect comment and trackback spam. Includes statistics and notifications.
12
+
13
+
14
+
15
+ == Description ==
16
+
17
+ = Kill spam =
18
+ Antispam Bee is simple to use, has many options and filters. Does not store data on remote servers. Really.
19
+
20
+ = Features =
21
+ * Very fast execution
22
+ * Spam counter on dashboard
23
+ * Anonymous and confidential
24
+ * Trackback and pingback check
25
+ * Saves no data on remote servers
26
+ * No need to adjust any templates
27
+ * Cleaning up after plugin removal
28
+ * Support for the Project Honey Pot
29
+ * Accordingly no outgoing connection
30
+ * Interactive statistics on dashboard
31
+ * Automatically cleanup the spam folder
32
+ * Allow comments only in certain language
33
+ * Spam may be marked or deleted immediately
34
+ * Email notifications about new spam comments
35
+ * Quick & Dirty: activate, set settings, done!
36
+ * Optional strict check for incomming comments
37
+ * Block comments and pings from specific countries
38
+ * WordPress 3.x ready: Design as well as technical
39
+ * Consider comments which are already marked as spam
40
+
41
+ = Counter =
42
+ `<?php do_action('antispam_bee_count') ?> spam comments blocked by
43
+ <a href="http://antispambee.com">Antispam Bee</a>`
44
+
45
+ = Documentation =
46
+ * [Antispam Bee: Antispam für WordPress](http://playground.ebiene.de/antispam-bee-wordpress-plugin/ "Antispam für WordPress") (DE)
47
+
48
+ = Author =
49
+ * [Google+](https://plus.google.com/110569673423509816572 "Google+")
50
+ * [Portfolio](http://ebiene.de "Portfolio")
51
+
52
+
53
+
54
+ == Changelog ==
55
+
56
+ = 2.4.2 =
57
+ * New geo ip location service (without the api key)
58
+ * Code cleanup: Replacement of `@` characters by a function
59
+
60
+ = 2.4.1 =
61
+ * Add russian translation
62
+ * Fix for the textarea replace
63
+ * Detect and hide admin notices
64
+
65
+ = 2.4 =
66
+ * Support for IPv6
67
+ * Source code revision
68
+ * Delete spam by reason
69
+ * Changing the user interface
70
+ * Requirements: PHP 5.1.2 and WordPress 3.3
71
+
72
+ = 2.3 =
73
+ * Xmas Edition
74
+
75
+ = 2.2 =
76
+ * Interactive Dashboard Stats
77
+
78
+ = 2.1 =
79
+ * Remove Google Translate API support
80
+
81
+ = 2.0 =
82
+ * Allow comments only in certain language (English/German)
83
+ * Consider comments which are already marked as spam
84
+ * Dashboard Stats: Change from canvas to image format
85
+ * System requirements: WordPress 2.8
86
+ * Removal of the migration script
87
+ * Increase plugin security
88
+
89
+ = 1.9 =
90
+ * Dashboard History Stats (HTML5 Canvas)
91
+
92
+ = 1.8 =
93
+ * Support for the new IPInfoDB API (including API Key)
94
+
95
+ = 1.7 =
96
+ * Black and whitelisting for specific countries
97
+ * "Project Honey Pot" as a optional spammer source
98
+ * Spam reason in the notification email
99
+ * Visual refresh of the notification email
100
+ * Advanced GUI changes + Fold-out options
101
+
102
+ = 1.6 =
103
+ * Support for WordPress 3.0
104
+ * System requirements: WordPress 2.7
105
+ * Code optimization
106
+
107
+ = 1.5 =
108
+ * Compatibility with WPtouch
109
+ * Add support for do_action
110
+ * Translation to Portuguese of Brazil
111
+
112
+ = 1.4 =
113
+ * Enable stricter inspection for incomming comments
114
+ * Do not check if the author has already commented and approved
115
+
116
+ = 1.3 =
117
+ * New code structure
118
+ * Email notifications about new spam comments
119
+ * Novel Algorithm: Advanced spam checking
120
+
121
+ = 1.2 =
122
+ * Antispam Bee spam counter on dashboard
123
+
124
+ = 1.1 =
125
+ * Adds support for WordPress new changelog readme.txt standard
126
+ * Various changes for more speed, usability and security
127
+
128
+ = 1.0 =
129
+ * Adds WordPress 2.8 support
130
+
131
+ = 0.9 =
132
+ * Mark as spam only comments or only pings
133
+
134
+ = 0.8 =
135
+ * Optical adjustments of the settings page
136
+ * Translation for Simplified Chinese, Spanish and Catalan
137
+
138
+ = 0.7 =
139
+ * Spam folder cleanup after X days
140
+ * Optional hide the &quot;MARKED AS SPAM&quot; note
141
+ * Language support for Italian and Turkish
142
+
143
+ = 0.6 =
144
+ * Language support for English, German, Russian
145
+
146
+ = 0.5 =
147
+ * Workaround for empty comments
148
+
149
+ = 0.4 =
150
+ * Option for trackback and pingback protection
151
+
152
+ = 0.3 =
153
+ * Trackback and Pingback spam protection
154
+
155
+
156
+
157
+ == Screenshots ==
158
+
159
+ 1. Antispam Bee settings
screenshot-1.png ADDED
Binary file