Gwolle Guestbook - Version 2.5.0

Version Description

  • 2018-04-13
  • Improve custom quiz question.
  • Improve and extend Honeypot anti-spam.
  • Add Link Checker for anti-spam.
  • Add timeout for submitting the form for anti-spam.
  • Do not send IP Address to Akismet if disabled.
  • Add 'date_query' parameter to 'gwolle_gb_get_entries' function.
  • Set default settings upon install/upgrade, so we can cache them.
  • Add action 'gwolle_gb_uninstall'.
  • Switch multisite uninstall to 'admin_init' hook.
  • Flush transients from cache if no book_id is set.
  • Switch export to 3000 entries per part instead of 5000.
  • New file '/functions/gb-book_id.php'.
  • Improve comment blocks for functions.
Download this release

Release Info

Developer mpol
Plugin Icon 128x128 Gwolle Guestbook
Version 2.5.0
Comparing to
See all releases

Code changes from version 2.4.2 to 2.5.0

Files changed (53) hide show
  1. add-on/gb-add-on.php +20 -0
  2. admin/gb-dashboard-widget.php +3 -1
  3. admin/gb-page-add-on.php +22 -2
  4. admin/gb-page-editor.php +28 -0
  5. admin/gb-page-entries.php +3 -0
  6. admin/gb-page-export.php +9 -9
  7. admin/gb-page-gwolle-gb.php +28 -3
  8. admin/gb-page-import.php +16 -4
  9. admin/gb-page-settings.php +19 -0
  10. admin/gb-pagination.php +5 -5
  11. admin/gb-upgrade.php +145 -4
  12. admin/js/gwolle-gb-admin.js +2 -2
  13. admin/tabs/gb-admintab.php +3 -0
  14. admin/tabs/gb-antispamtab.php +43 -2
  15. admin/tabs/gb-debugtab.php +4 -1
  16. admin/tabs/gb-emailtab.php +3 -0
  17. admin/tabs/gb-formtab.php +5 -1
  18. admin/tabs/gb-readingtab.php +3 -0
  19. admin/tabs/gb-uninstalltab.php +4 -2
  20. docs/actions/gwolle_gb_uninstall.txt +23 -0
  21. frontend/gb-ajax-captcha.php +7 -8
  22. frontend/gb-form-ajax.php +5 -6
  23. frontend/gb-form-posthandling.php +85 -11
  24. frontend/gb-form.php +35 -8
  25. frontend/gb-pagination.php +3 -3
  26. frontend/gb-read.php +6 -3
  27. frontend/gb-rss.php +9 -3
  28. frontend/gb-shortcode-widget.php +12 -4
  29. frontend/gb-shortcodes.php +15 -8
  30. frontend/gb-total.php +2 -2
  31. frontend/gwolle_gb-entry.php +8 -8
  32. frontend/js/gwolle-gb-frontend.js +35 -0
  33. functions/gb-akismet.php +19 -17
  34. functions/gb-bbcode_emoji.php +12 -4
  35. functions/gb-book_id.php +139 -0
  36. functions/gb-cache.php +15 -1
  37. functions/gb-debug.php +3 -0
  38. functions/gb-formatting.php +13 -7
  39. functions/gb-get_entries.php +29 -16
  40. functions/gb-get_entry_count.php +2 -5
  41. functions/gb-log.php +13 -15
  42. functions/gb-mail.php +6 -3
  43. functions/gb-messages.php +25 -17
  44. functions/gb-metabox.php +8 -0
  45. functions/gb-misc.php +4 -136
  46. functions/gb-post-meta.php +7 -5
  47. functions/gb-settings.php +5 -2
  48. functions/gb-single-view.php +3 -4
  49. functions/gb-stop-forum-spam.php +2 -4
  50. functions/gb-user.php +15 -18
  51. gwolle-gb-hooks.php +11 -4
  52. gwolle-gb.php +8 -4
  53. readme.txt +19 -2
add-on/gb-add-on.php CHANGED
@@ -117,6 +117,26 @@ function gwolle_gb_addon_translation_strings() {
117
  esc_html_e('Show delete link in Metabox for author.', 'gwolle-gb');
118
  /* translators: Commercial Add-On */
119
  esc_html_e('A link to delete the entry will be added to the metabox. Only visible for moderators and the author.', 'gwolle-gb');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  // function gwolle_gb_addon_page_settingstab_reading() {
122
  /* translators: Commercial Add-On */
117
  esc_html_e('Show delete link in Metabox for author.', 'gwolle-gb');
118
  /* translators: Commercial Add-On */
119
  esc_html_e('A link to delete the entry will be added to the metabox. Only visible for moderators and the author.', 'gwolle-gb');
120
+ /* translators: Commercial Add-On */
121
+ esc_html_e('Auto Delete', 'gwolle-gb');
122
+ /* translators: Commercial Add-On */
123
+ esc_html_e('Auto Delete entries after a certain time.', 'gwolle-gb');
124
+ /* translators: Commercial Add-On */
125
+ esc_html_e('This setting will enable automatic deletion of entries older than a certain date.', 'gwolle-gb');
126
+ /* translators: Commercial Add-On */
127
+ esc_html_e('Be very carefull with this option.', 'gwolle-gb');
128
+ /* translators: Commercial Add-On */
129
+ esc_html_e('Auto Delete entries older than:', 'gwolle-gb');
130
+ /* translators: Commercial Add-On */
131
+ esc_html_e('1 Day','gwolle-gb');
132
+ /* translators: Commercial Add-On */
133
+ esc_html_e('2 Days','gwolle-gb');
134
+ /* translators: Commercial Add-On */
135
+ esc_html_e('1 Week','gwolle-gb');
136
+ /* translators: Commercial Add-On */
137
+ esc_html_e('2 Weeks','gwolle-gb');
138
+ /* translators: Commercial Add-On */
139
+ esc_html_e('1 Month','gwolle-gb');
140
 
141
  // function gwolle_gb_addon_page_settingstab_reading() {
142
  /* translators: Commercial Add-On */
admin/gb-dashboard-widget.php CHANGED
@@ -157,7 +157,9 @@ function gwolle_gb_dashboard() {
157
  }
158
 
159
 
160
- // Add the widget
 
 
161
  function gwolle_gb_dashboard_setup() {
162
 
163
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
157
  }
158
 
159
 
160
+ /*
161
+ * The hook to add a dashboard widget to show the latest entries.
162
+ */
163
  function gwolle_gb_dashboard_setup() {
164
 
165
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
admin/gb-page-add-on.php CHANGED
@@ -6,6 +6,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
6
  }
7
 
8
 
 
 
 
9
  function gwolle_gb_addon_menu_advertisement() {
10
 
11
  $active = is_plugin_active( 'gwolle-gb-addon/gwolle-gb-addon.php' ); // true or false
@@ -16,7 +19,9 @@ function gwolle_gb_addon_menu_advertisement() {
16
  add_action( 'admin_menu', 'gwolle_gb_addon_menu_advertisement', 11 );
17
 
18
 
19
- /* Metaboxes on the left. */
 
 
20
  function gwolle_gb_addon_page_advertisement() {
21
 
22
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
@@ -52,6 +57,9 @@ function gwolle_gb_addon_page_advertisement() {
52
  }
53
 
54
 
 
 
 
55
  function gwolle_gb_addon_description(){
56
  ?>
57
  <div class="table table_content gwolle_gb">
@@ -62,6 +70,9 @@ function gwolle_gb_addon_description(){
62
  }
63
 
64
 
 
 
 
65
  function gwolle_gb_addon_features() {
66
  echo '<h3>
67
  ' . esc_html__('Current features include:', 'gwolle-gb').'</h3>
@@ -78,11 +89,14 @@ function gwolle_gb_addon_features() {
78
  <li>' . esc_html__('Permalink button in each entry for easy access (optional).','gwolle-gb').'</li>
79
  <li>' . esc_html__('Email button to contact each author (optional).','gwolle-gb').'</li>
80
  <li>' . esc_html__('Sitemap support for popular SEO/Sitemap plugins.','gwolle-gb').'</li>
 
81
  </ul>';
82
  }
83
 
84
 
85
- /* Metaboxes on the right. */
 
 
86
  function gwolle_gb_addon_buy() {
87
  ?>
88
  <h3><?php esc_html_e('Buy the Add-On.', 'gwolle-gb'); ?></h3>
@@ -96,6 +110,9 @@ function gwolle_gb_addon_buy() {
96
  }
97
 
98
 
 
 
 
99
  function gwolle_gb_addon_demo() {
100
  ?>
101
  <h3><?php esc_html_e('Demo with the Add-On.', 'gwolle-gb'); ?></h3>
@@ -115,6 +132,9 @@ function gwolle_gb_addon_demo() {
115
  }
116
 
117
 
 
 
 
118
  function gwolle_gb_addon_development() {
119
  ?>
120
  <p><?php
6
  }
7
 
8
 
9
+ /*
10
+ * Admin page for advertising the Add-On.
11
+ */
12
  function gwolle_gb_addon_menu_advertisement() {
13
 
14
  $active = is_plugin_active( 'gwolle-gb-addon/gwolle-gb-addon.php' ); // true or false
19
  add_action( 'admin_menu', 'gwolle_gb_addon_menu_advertisement', 11 );
20
 
21
 
22
+ /*
23
+ * Admin page for advertising the Add-On. Contains metaboxes.
24
+ */
25
  function gwolle_gb_addon_page_advertisement() {
26
 
27
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
57
  }
58
 
59
 
60
+ /*
61
+ * Metabox with the main description of the add-on.
62
+ */
63
  function gwolle_gb_addon_description(){
64
  ?>
65
  <div class="table table_content gwolle_gb">
70
  }
71
 
72
 
73
+ /*
74
+ * Metabox with the feature list of the add-on.
75
+ */
76
  function gwolle_gb_addon_features() {
77
  echo '<h3>
78
  ' . esc_html__('Current features include:', 'gwolle-gb').'</h3>
89
  <li>' . esc_html__('Permalink button in each entry for easy access (optional).','gwolle-gb').'</li>
90
  <li>' . esc_html__('Email button to contact each author (optional).','gwolle-gb').'</li>
91
  <li>' . esc_html__('Sitemap support for popular SEO/Sitemap plugins.','gwolle-gb').'</li>
92
+ <li>' . esc_html__('Auto Delete timer (optional).','gwolle-gb').'</li>
93
  </ul>';
94
  }
95
 
96
 
97
+ /*
98
+ * Metabox with the link to the marketplace for the add-on.
99
+ */
100
  function gwolle_gb_addon_buy() {
101
  ?>
102
  <h3><?php esc_html_e('Buy the Add-On.', 'gwolle-gb'); ?></h3>
110
  }
111
 
112
 
113
+ /*
114
+ * Metabox with links to the demo site.
115
+ */
116
  function gwolle_gb_addon_demo() {
117
  ?>
118
  <h3><?php esc_html_e('Demo with the Add-On.', 'gwolle-gb'); ?></h3>
132
  }
133
 
134
 
135
+ /*
136
+ * Metabox with the motivational text of the add-on.
137
+ */
138
  function gwolle_gb_addon_development() {
139
  ?>
140
  <p><?php
admin/gb-page-editor.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_editor() {
13
  global $entry;
14
 
@@ -383,6 +386,9 @@ function gwolle_gb_page_editor() {
383
  }
384
 
385
 
 
 
 
386
  function gwolle_gb_editor_postbox_content( $entry ) {
387
  ?>
388
  <textarea rows="10" name="gwolle_gb_content" id="gwolle_gb_content" class="wp-exclude-emoji" tabindex="1" placeholder="<?php esc_html_e('Message', 'gwolle-gb'); ?>"><?php echo gwolle_gb_sanitize_output( $entry->get_content(), 'content' ); ?></textarea>
@@ -425,6 +431,9 @@ function gwolle_gb_editor_postbox_content( $entry ) {
425
  }
426
 
427
 
 
 
 
428
  function gwolle_gb_editor_postbox_website( $entry ) {
429
  ?>
430
  <input type="url" name="gwolle_gb_author_website" tabindex="2" value="<?php echo gwolle_gb_sanitize_output( $entry->get_author_website() ); ?>" id="author_website" placeholder="<?php esc_attr_e('Website', 'gwolle-gb'); ?>" />
@@ -436,6 +445,9 @@ function gwolle_gb_editor_postbox_website( $entry ) {
436
  }
437
 
438
 
 
 
 
439
  function gwolle_gb_editor_postbox_author_origin( $entry ) {
440
  ?>
441
  <input type="text" name="gwolle_gb_author_origin" tabindex="3" class="wp-exclude-emoji" placeholder="<?php esc_attr_e('City', 'gwolle-gb'); ?>" value="<?php echo gwolle_gb_sanitize_output( $entry->get_author_origin() ); ?>" id="author_origin" />
@@ -443,6 +455,9 @@ function gwolle_gb_editor_postbox_author_origin( $entry ) {
443
  }
444
 
445
 
 
 
 
446
  function gwolle_gb_editor_postbox_admin_reply( $entry ) {
447
  $form_setting = gwolle_gb_get_setting( 'form' );
448
  ?>
@@ -487,6 +502,9 @@ function gwolle_gb_editor_postbox_admin_reply( $entry ) {
487
  }
488
 
489
 
 
 
 
490
  function gwolle_gb_editor_postbox_icons( $entry ) {
491
  global $class;
492
 
@@ -616,6 +634,9 @@ function gwolle_gb_editor_postbox_icons( $entry ) {
616
  }
617
 
618
 
 
 
 
619
  function gwolle_gb_editor_postbox_actions( $entry ) {
620
  global $class;
621
  if ( $entry->get_id() > 0 ) {
@@ -648,6 +669,9 @@ function gwolle_gb_editor_postbox_actions( $entry ) {
648
  }
649
 
650
 
 
 
 
651
  function gwolle_gb_editor_postbox_details( $entry ) {
652
  ?>
653
  <p>
@@ -713,6 +737,10 @@ function gwolle_gb_editor_postbox_details( $entry ) {
713
  <?php
714
  }
715
 
 
 
 
 
716
  function gwolle_gb_editor_postbox_logs( $entry ) {
717
  ?>
718
  <ul>
9
  }
10
 
11
 
12
+ /*
13
+ * Admin page with the entry editor. Used for new and existing entries.
14
+ */
15
  function gwolle_gb_page_editor() {
16
  global $entry;
17
 
386
  }
387
 
388
 
389
+ /*
390
+ * Metabox with the content of the entry.
391
+ */
392
  function gwolle_gb_editor_postbox_content( $entry ) {
393
  ?>
394
  <textarea rows="10" name="gwolle_gb_content" id="gwolle_gb_content" class="wp-exclude-emoji" tabindex="1" placeholder="<?php esc_html_e('Message', 'gwolle-gb'); ?>"><?php echo gwolle_gb_sanitize_output( $entry->get_content(), 'content' ); ?></textarea>
431
  }
432
 
433
 
434
+ /*
435
+ * Metabox with the website of the entry.
436
+ */
437
  function gwolle_gb_editor_postbox_website( $entry ) {
438
  ?>
439
  <input type="url" name="gwolle_gb_author_website" tabindex="2" value="<?php echo gwolle_gb_sanitize_output( $entry->get_author_website() ); ?>" id="author_website" placeholder="<?php esc_attr_e('Website', 'gwolle-gb'); ?>" />
445
  }
446
 
447
 
448
+ /*
449
+ * Metabox with the city/origin of the entry.
450
+ */
451
  function gwolle_gb_editor_postbox_author_origin( $entry ) {
452
  ?>
453
  <input type="text" name="gwolle_gb_author_origin" tabindex="3" class="wp-exclude-emoji" placeholder="<?php esc_attr_e('City', 'gwolle-gb'); ?>" value="<?php echo gwolle_gb_sanitize_output( $entry->get_author_origin() ); ?>" id="author_origin" />
455
  }
456
 
457
 
458
+ /*
459
+ * Metabox with the admin reply of the entry.
460
+ */
461
  function gwolle_gb_editor_postbox_admin_reply( $entry ) {
462
  $form_setting = gwolle_gb_get_setting( 'form' );
463
  ?>
502
  }
503
 
504
 
505
+ /*
506
+ * Metabox with the icons and checkboxes for quick glancing at the visibility of the entry.
507
+ */
508
  function gwolle_gb_editor_postbox_icons( $entry ) {
509
  global $class;
510
 
634
  }
635
 
636
 
637
+ /*
638
+ * Metabox with quick actions for the entry (AJAX).
639
+ */
640
  function gwolle_gb_editor_postbox_actions( $entry ) {
641
  global $class;
642
  if ( $entry->get_id() > 0 ) {
669
  }
670
 
671
 
672
+ /*
673
+ * Metabox with the small details of the entry.
674
+ */
675
  function gwolle_gb_editor_postbox_details( $entry ) {
676
  ?>
677
  <p>
737
  <?php
738
  }
739
 
740
+
741
+ /*
742
+ * Metabox with the log of the entry.
743
+ */
744
  function gwolle_gb_editor_postbox_logs( $entry ) {
745
  ?>
746
  <ul>
admin/gb-page-entries.php CHANGED
@@ -10,6 +10,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
10
  }
11
 
12
 
 
 
 
13
  function gwolle_gb_page_entries() {
14
 
15
  if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
10
  }
11
 
12
 
13
+ /*
14
+ * Admin page with lists of entries.
15
+ */
16
  function gwolle_gb_page_entries() {
17
 
18
  if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
admin/gb-page-export.php CHANGED
@@ -11,6 +11,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
11
  }
12
 
13
 
 
 
 
14
  function gwolle_gb_page_export() {
15
 
16
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
@@ -45,7 +48,7 @@ function gwolle_gb_page_export() {
45
  function gwolle_gb_export_postbox() {
46
 
47
  $count = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
48
- $num_entries = 5000;
49
  $parts = ceil( $count / $num_entries );
50
  ?>
51
 
@@ -59,9 +62,6 @@ function gwolle_gb_export_postbox() {
59
  $nonce = wp_create_nonce( 'gwolle_gb_page_export' );
60
  echo '<input type="hidden" id="gwolle_gb_wpnonce" name="gwolle_gb_wpnonce" value="' . $nonce . '" />';
61
 
62
- $count = gwolle_gb_get_entry_count( array( 'all' => 'all' ) );
63
- $num_entries = 5000;
64
- $parts = ceil( $count / $num_entries );
65
  if ( $count == 0 ) { ?>
66
  <p><?php esc_html_e('No entries were found.', 'gwolle-gb'); ?></p><?php
67
  } else {
@@ -119,7 +119,7 @@ add_action('admin_init', 'gwolle_gb_export_action');
119
 
120
 
121
  /*
122
- * Callback function for request generated from the Export page
123
  */
124
  function gwolle_gb_export_callback() {
125
 
@@ -140,7 +140,7 @@ function gwolle_gb_export_callback() {
140
  }
141
 
142
  $count = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
143
- $num_entries = 5000;
144
  $parts = ceil( $count / $num_entries );
145
  if ( isset( $_POST['gwolle_gb_export_part']) && ( (int) $_POST['gwolle_gb_export_part'] < ($parts + 1) ) ) {
146
  $part = (int) $_POST['gwolle_gb_export_part'];
@@ -148,7 +148,7 @@ function gwolle_gb_export_callback() {
148
  echo '(Gwolle-GB) Wrong part requested.';
149
  die();
150
  }
151
- $offset = ($part * 5000) - 5000;
152
 
153
  $entries = gwolle_gb_get_entries(array(
154
  'num_entries' => $num_entries,
@@ -230,7 +230,7 @@ function gwolle_gb_export_callback() {
230
 
231
 
232
  /*
233
- * Export entries for user
234
  *
235
  * @since 2.3.11
236
  */
@@ -284,7 +284,7 @@ add_action('admin_init', 'gwolle_gb_export_user_action');
284
 
285
 
286
  /*
287
- * Callback function for request generated from the Export page
288
  */
289
  function gwolle_gb_export_user_callback() {
290
 
11
  }
12
 
13
 
14
+ /*
15
+ * Admin page for export.
16
+ */
17
  function gwolle_gb_page_export() {
18
 
19
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
48
  function gwolle_gb_export_postbox() {
49
 
50
  $count = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
51
+ $num_entries = 3000;
52
  $parts = ceil( $count / $num_entries );
53
  ?>
54
 
62
  $nonce = wp_create_nonce( 'gwolle_gb_page_export' );
63
  echo '<input type="hidden" id="gwolle_gb_wpnonce" name="gwolle_gb_wpnonce" value="' . $nonce . '" />';
64
 
 
 
 
65
  if ( $count == 0 ) { ?>
66
  <p><?php esc_html_e('No entries were found.', 'gwolle-gb'); ?></p><?php
67
  } else {
119
 
120
 
121
  /*
122
+ * Callback function for request generated from the Export page.
123
  */
124
  function gwolle_gb_export_callback() {
125
 
140
  }
141
 
142
  $count = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
143
+ $num_entries = 3000;
144
  $parts = ceil( $count / $num_entries );
145
  if ( isset( $_POST['gwolle_gb_export_part']) && ( (int) $_POST['gwolle_gb_export_part'] < ($parts + 1) ) ) {
146
  $part = (int) $_POST['gwolle_gb_export_part'];
148
  echo '(Gwolle-GB) Wrong part requested.';
149
  die();
150
  }
151
+ $offset = ($part * 3000) - 3000;
152
 
153
  $entries = gwolle_gb_get_entries(array(
154
  'num_entries' => $num_entries,
230
 
231
 
232
  /*
233
+ * Export entries for user.
234
  *
235
  * @since 2.3.11
236
  */
284
 
285
 
286
  /*
287
+ * Callback function for request generated from the Export page.
288
  */
289
  function gwolle_gb_export_user_callback() {
290
 
admin/gb-page-gwolle-gb.php CHANGED
@@ -9,7 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
12
- /* Show the page */
 
 
13
  function gwolle_gb_welcome() {
14
 
15
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
@@ -67,7 +69,9 @@ function gwolle_gb_welcome() {
67
  }
68
 
69
 
70
-
 
 
71
  function gwolle_gb_overview(){
72
 
73
  // Calculate the number of entries
@@ -187,6 +191,9 @@ function gwolle_gb_overview(){
187
  <?php }
188
 
189
 
 
 
 
190
  function gwolle_gb_overview_notification() {
191
 
192
  // Check if function mail() exists. If not, display a hint to the user.
@@ -255,6 +262,9 @@ function gwolle_gb_overview_notification() {
255
  }
256
 
257
 
 
 
 
258
  function gwolle_gb_overview_thanks() {
259
  echo '<h3>
260
  ' . esc_html__('This plugin uses the following scripts and services:', 'gwolle-gb') . '</h3>
@@ -268,7 +278,9 @@ function gwolle_gb_overview_thanks() {
268
  }
269
 
270
 
271
- /* Metaboxes on the right */
 
 
272
  function gwolle_gb_overview_help() {
273
  echo '<h3>
274
  ' . esc_html__('This is how you can get your guestbook displayed on your website:', 'gwolle-gb') . '</h3>
@@ -280,6 +292,9 @@ function gwolle_gb_overview_help() {
280
  }
281
 
282
 
 
 
 
283
  function gwolle_gb_overview_visibility() {
284
  echo '<h3>
285
  ' . esc_html__('These entries will be visible for your visitors:', 'gwolle-gb').'</h3>
@@ -291,6 +306,9 @@ function gwolle_gb_overview_visibility() {
291
  }
292
 
293
 
 
 
 
294
  function gwolle_gb_overview_support() {
295
  ?>
296
  <h3><?php esc_html_e('Support.', 'gwolle-gb'); ?></h3>
@@ -316,6 +334,10 @@ function gwolle_gb_overview_support() {
316
  }
317
 
318
 
 
 
 
 
319
  function gwolle_gb_overview_donate() {
320
  ?>
321
  <h3><?php esc_html_e('Review this plugin.', 'gwolle-gb'); ?></h3>
@@ -328,6 +350,9 @@ function gwolle_gb_overview_donate() {
328
  }
329
 
330
 
 
 
 
331
  function gwolle_gb_welcome_post() {
332
 
333
  /* Check Nonce */
9
  }
10
 
11
 
12
+ /*
13
+ * Main Admin page.
14
+ */
15
  function gwolle_gb_welcome() {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
69
  }
70
 
71
 
72
+ /*
73
+ * Metabox with overview.
74
+ */
75
  function gwolle_gb_overview(){
76
 
77
  // Calculate the number of entries
191
  <?php }
192
 
193
 
194
+ /*
195
+ * Metabox with checbox for subscribing this user to email notifications.
196
+ */
197
  function gwolle_gb_overview_notification() {
198
 
199
  // Check if function mail() exists. If not, display a hint to the user.
262
  }
263
 
264
 
265
+ /*
266
+ * Metabox with overview of third parties.
267
+ */
268
  function gwolle_gb_overview_thanks() {
269
  echo '<h3>
270
  ' . esc_html__('This plugin uses the following scripts and services:', 'gwolle-gb') . '</h3>
278
  }
279
 
280
 
281
+ /*
282
+ * Metabox with quick help text.
283
+ */
284
  function gwolle_gb_overview_help() {
285
  echo '<h3>
286
  ' . esc_html__('This is how you can get your guestbook displayed on your website:', 'gwolle-gb') . '</h3>
292
  }
293
 
294
 
295
+ /*
296
+ * Metabox with quick help text.
297
+ */
298
  function gwolle_gb_overview_visibility() {
299
  echo '<h3>
300
  ' . esc_html__('These entries will be visible for your visitors:', 'gwolle-gb').'</h3>
306
  }
307
 
308
 
309
+ /*
310
+ * Metabox with text about support and translations.
311
+ */
312
  function gwolle_gb_overview_support() {
313
  ?>
314
  <h3><?php esc_html_e('Support.', 'gwolle-gb'); ?></h3>
334
  }
335
 
336
 
337
+ /*
338
+ * Metabox with text about wp.org reviews.
339
+ * Call for donations is gone.
340
+ */
341
  function gwolle_gb_overview_donate() {
342
  ?>
343
  <h3><?php esc_html_e('Review this plugin.', 'gwolle-gb'); ?></h3>
350
  }
351
 
352
 
353
+ /*
354
+ * Subscribe this user to email notifications.
355
+ */
356
  function gwolle_gb_welcome_post() {
357
 
358
  /* Check Nonce */
admin/gb-page-import.php CHANGED
@@ -14,6 +14,10 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
14
  }
15
 
16
 
 
 
 
 
17
  function gwolle_gb_page_import() {
18
 
19
  gwolle_gb_admin_enqueue();
@@ -27,10 +31,6 @@ function gwolle_gb_page_import() {
27
  gwolle_gb_page_import_post();
28
  }
29
 
30
-
31
- /*
32
- * Build the Page and the Form
33
- */
34
  ?>
35
  <div class="wrap gwolle_gb">
36
  <div id="icon-gwolle-gb"><br /></div>
@@ -67,6 +67,9 @@ function gwolle_gb_page_import() {
67
  }
68
 
69
 
 
 
 
70
  function gwolle_gb_import_postbox_dms() {
71
  global $wpdb;
72
  ?>
@@ -137,6 +140,9 @@ function gwolle_gb_import_postbox_dms() {
137
  }
138
 
139
 
 
 
 
140
  function gwolle_gb_import_postbox_wp() {
141
  ?>
142
  <form name="gwolle_gb_import_wp" id="gwolle_gb_import_wp" method="POST" action="#" accept-charset="UTF-8">
@@ -263,6 +269,9 @@ function gwolle_gb_import_postbox_wp() {
263
  }
264
 
265
 
 
 
 
266
  function gwolle_gb_import_postbox_gwolle() {
267
  ?>
268
  <form name="gwolle_gb_import_gwolle" id="gwolle_gb_import_gwolle" method="POST" action="#" accept-charset="UTF-8" enctype="multipart/form-data">
@@ -287,6 +296,9 @@ function gwolle_gb_import_postbox_gwolle() {
287
  }
288
 
289
 
 
 
 
290
  function gwolle_gb_page_import_post() {
291
  global $wpdb;
292
 
14
  }
15
 
16
 
17
+ /*
18
+ * Admin page for import.
19
+ * Contains metaboxes with forms.
20
+ */
21
  function gwolle_gb_page_import() {
22
 
23
  gwolle_gb_admin_enqueue();
31
  gwolle_gb_page_import_post();
32
  }
33
 
 
 
 
 
34
  ?>
35
  <div class="wrap gwolle_gb">
36
  <div id="icon-gwolle-gb"><br /></div>
67
  }
68
 
69
 
70
+ /*
71
+ * Metabox with form for import from DMS Guestbook.
72
+ */
73
  function gwolle_gb_import_postbox_dms() {
74
  global $wpdb;
75
  ?>
140
  }
141
 
142
 
143
+ /*
144
+ * Metabox with form for import from WordPress comments.
145
+ */
146
  function gwolle_gb_import_postbox_wp() {
147
  ?>
148
  <form name="gwolle_gb_import_wp" id="gwolle_gb_import_wp" method="POST" action="#" accept-charset="UTF-8">
269
  }
270
 
271
 
272
+ /*
273
+ * Metabox with form for import from Gwolle through a CSV file.
274
+ */
275
  function gwolle_gb_import_postbox_gwolle() {
276
  ?>
277
  <form name="gwolle_gb_import_gwolle" id="gwolle_gb_import_gwolle" method="POST" action="#" accept-charset="UTF-8" enctype="multipart/form-data">
296
  }
297
 
298
 
299
+ /*
300
+ * Handle the submitted forms.
301
+ */
302
  function gwolle_gb_page_import_post() {
303
  global $wpdb;
304
 
admin/gb-page-settings.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_settings() {
13
 
14
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
@@ -292,6 +295,22 @@ function gwolle_gb_page_settings() {
292
  $saved = true;
293
  }
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  if (isset($_POST['akismet-active']) && $_POST['akismet-active'] == 'on') {
296
  update_option('gwolle_gb-akismet-active', 'true');
297
  $saved = true;
9
  }
10
 
11
 
12
+ /*
13
+ * Admin Settings page. Uses the files under /tabs for filling the tabs. This file mostly does saving of the settings.
14
+ */
15
  function gwolle_gb_page_settings() {
16
 
17
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
295
  $saved = true;
296
  }
297
 
298
+ if (isset($_POST['gwolle_gb_linkchecker']) && $_POST['gwolle_gb_linkchecker'] == 'on') {
299
+ update_option('gwolle_gb-linkchecker', 'true');
300
+ $saved = true;
301
+ } else {
302
+ update_option('gwolle_gb-linkchecker', 'false');
303
+ $saved = true;
304
+ }
305
+
306
+ if (isset($_POST['gwolle_gb_timeout']) && $_POST['gwolle_gb_timeout'] == 'on') {
307
+ update_option('gwolle_gb-timeout', 'true');
308
+ $saved = true;
309
+ } else {
310
+ update_option('gwolle_gb-timeout', 'false');
311
+ $saved = true;
312
+ }
313
+
314
  if (isset($_POST['akismet-active']) && $_POST['akismet-active'] == 'on') {
315
  update_option('gwolle_gb-akismet-active', 'true');
316
  $saved = true;
admin/gb-pagination.php CHANGED
@@ -10,11 +10,11 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
10
  * gwolle_gb_pagination_admin
11
  * Pagination of the entries for the page-entries.php
12
  *
13
- * @args: $pageNum, int with the number of the requested page.
14
- * $pages_total, int with the total number of pages.
15
- * $count, int with total number of entries. Relative to the $show variable.
16
- * $show, string with the tab of the page that is shown.
17
- * @return: $pagination, string with the html of the pagination.
18
  */
19
  function gwolle_gb_pagination_admin( $pageNum, $pages_total, $count, $show ) {
20
 
10
  * gwolle_gb_pagination_admin
11
  * Pagination of the entries for the page-entries.php
12
  *
13
+ * @param int $pageNum the number of the requested page.
14
+ * @param int $pages_total the total number of pages.
15
+ * @param int $count total number of entries. Relative to the $show variable.
16
+ * @param string $show the tab of the page that is shown.
17
+ * @return string $pagination the html of the pagination.
18
  */
19
  function gwolle_gb_pagination_admin( $pageNum, $pages_total, $count, $show ) {
20
 
admin/gb-upgrade.php CHANGED
@@ -14,6 +14,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
14
  }
15
 
16
 
 
 
 
17
  function gwolle_gb_install() {
18
  global $wpdb;
19
 
@@ -76,19 +79,26 @@ function gwolle_gb_install() {
76
  }
77
  }
78
 
79
- // Save plugin version to database only when we did install.
 
 
 
80
  $result_after = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_entries'");
81
  $result_after2 = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_log'");
82
  if ( $result_after != 0 && $result_after2 != 0 ) {
83
  add_option('gwolle_gb_version', GWOLLE_GB_VER);
84
  }
85
 
86
- // Call flush_rules() as a method of the $wp_rewrite object for the RSS Feed.
87
  global $wp_rewrite;
88
  $wp_rewrite->flush_rules( false );
89
  }
90
 
91
 
 
 
 
 
92
  function gwolle_gb_uninstall() {
93
  // Delete the plugin's tables
94
  global $wpdb;
@@ -103,11 +113,16 @@ function gwolle_gb_uninstall() {
103
  option_name LIKE 'gwolle_gb%'
104
  ");
105
 
 
 
106
  // Deactivate ourselves
107
  deactivate_plugins( GWOLLE_GB_FOLDER . '/gwolle-gb.php' );
108
  }
109
 
110
 
 
 
 
111
  function gwolle_gb_upgrade() {
112
  global $wpdb;
113
  $installed_ver = get_option('gwolle_gb_version');
@@ -480,7 +495,6 @@ function gwolle_gb_upgrade() {
480
  ");
481
  }
482
 
483
-
484
  /* Upgrade to new shiny db collation. Since WP 4.2 */
485
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
486
  if ( function_exists('maybe_convert_table_to_utf8mb4') ) {
@@ -490,7 +504,134 @@ function gwolle_gb_upgrade() {
490
  }
491
  }
492
 
 
 
493
 
494
- /* Update the plugin version option */
495
  update_option('gwolle_gb_version', GWOLLE_GB_VER);
496
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
 
17
+ /*
18
+ * Install plugin structure.
19
+ */
20
  function gwolle_gb_install() {
21
  global $wpdb;
22
 
79
  }
80
  }
81
 
82
+ /* Set default options if not set yet. */
83
+ gwolle_gb_set_defaults();
84
+
85
+ /* Save plugin version to database only when we did install. */
86
  $result_after = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_entries'");
87
  $result_after2 = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_log'");
88
  if ( $result_after != 0 && $result_after2 != 0 ) {
89
  add_option('gwolle_gb_version', GWOLLE_GB_VER);
90
  }
91
 
92
+ /* Call flush_rules() as a method of the $wp_rewrite object for the RSS Feed. */
93
  global $wp_rewrite;
94
  $wp_rewrite->flush_rules( false );
95
  }
96
 
97
 
98
+ /*
99
+ * Uninstall plugin structure.
100
+ * Called from the settingspage or from multisite uninstall function.
101
+ */
102
  function gwolle_gb_uninstall() {
103
  // Delete the plugin's tables
104
  global $wpdb;
113
  option_name LIKE 'gwolle_gb%'
114
  ");
115
 
116
+ do_action( 'gwolle_gb_uninstall' );
117
+
118
  // Deactivate ourselves
119
  deactivate_plugins( GWOLLE_GB_FOLDER . '/gwolle-gb.php' );
120
  }
121
 
122
 
123
+ /*
124
+ * Upgrade plugin structure.
125
+ */
126
  function gwolle_gb_upgrade() {
127
  global $wpdb;
128
  $installed_ver = get_option('gwolle_gb_version');
495
  ");
496
  }
497
 
 
498
  /* Upgrade to new shiny db collation. Since WP 4.2 */
499
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
500
  if ( function_exists('maybe_convert_table_to_utf8mb4') ) {
504
  }
505
  }
506
 
507
+ /* Set default options if not set yet. */
508
+ gwolle_gb_set_defaults();
509
 
510
+ /* Update the plugin version option. */
511
  update_option('gwolle_gb_version', GWOLLE_GB_VER);
512
  }
513
+
514
+
515
+ /*
516
+ * Set default options.
517
+ * Idea is to have all options in the database and thus cached, so we hit an empty cache less often.
518
+ *
519
+ * @since 2.5.0
520
+ */
521
+ function gwolle_gb_set_defaults() {
522
+ if ( get_option('gwolle_gb-admin_style', false) == false ) {
523
+ update_option( 'gwolle_gb-admin_style', 'false' );
524
+ }
525
+ if ( get_option('gwolle_gb-akismet-active', false) == false ) {
526
+ update_option( 'gwolle_gb-akismet-active', 'false' );
527
+ }
528
+ if ( get_option('gwolle_gb-entries_per_page', false) == false ) {
529
+ update_option( 'gwolle_gb-entries_per_page', 20 );
530
+ }
531
+ if ( get_option('gwolle_gb-entriesPerPage', false) == false ) {
532
+ update_option( 'gwolle_gb-entriesPerPage', 20 );
533
+ }
534
+ if ( get_option('gwolle_gb-excerpt_length', false) == false ) {
535
+ update_option( 'gwolle_gb-excerpt_length', 0 );
536
+ }
537
+ if ( get_option('gwolle_gb-form', false) == false ) {
538
+ $defaults = Array(
539
+ 'form_name_enabled' => 'true',
540
+ 'form_name_mandatory' => 'true',
541
+ 'form_city_enabled' => 'true',
542
+ 'form_city_mandatory' => 'false',
543
+ 'form_email_enabled' => 'true',
544
+ 'form_email_mandatory' => 'true',
545
+ 'form_homepage_enabled' => 'true',
546
+ 'form_homepage_mandatory' => 'false',
547
+ 'form_message_enabled' => 'true',
548
+ 'form_message_mandatory' => 'true',
549
+ 'form_bbcode_enabled' => 'false',
550
+ 'form_antispam_enabled' => 'false',
551
+ 'form_recaptcha_enabled' => 'false',
552
+ 'form_privacy_enabled' => 'false'
553
+ );
554
+ $defaults = serialize( $defaults );
555
+ update_option( 'gwolle_gb-form', $defaults );
556
+ }
557
+ if ( get_option('gwolle_gb-form_ajax', false) == false ) {
558
+ update_option( 'gwolle_gb-form_ajax', 'true' );
559
+ }
560
+ if ( get_option('gwolle_gb-honeypot', false) == false ) {
561
+ update_option( 'gwolle_gb-honeypot', 'true' );
562
+ }
563
+ if ( get_option('gwolle_gb-honeypot_value', false) == false ) {
564
+ $random = rand( 1, 99 );
565
+ update_option( 'gwolle_gb-honeypot_value', $random );
566
+ }
567
+ if ( get_option('gwolle_gb-labels_float', false) == false ) {
568
+ update_option( 'gwolle_gb-labels_float', 'true' );
569
+ }
570
+ if ( get_option('gwolle_gb-linkAuthorWebsite', false) == false ) {
571
+ update_option( 'gwolle_gb-linkAuthorWebsite', 'true' );
572
+ }
573
+ if ( get_option('gwolle_gb-linkchecker', false) == false ) {
574
+ update_option( 'gwolle_gb-linkchecker', 'true' );
575
+ }
576
+ if ( get_option('gwolle_gb-longtext', false) == false ) {
577
+ update_option( 'gwolle_gb-longtext', 'true' );
578
+ }
579
+ if ( get_option('gwolle_gb-mail_author', false) == false ) {
580
+ update_option( 'gwolle_gb-mail_author', 'false' );
581
+ }
582
+ if ( get_option('gwolle_gb-moderate-entries', false) == false ) {
583
+ update_option( 'gwolle_gb-moderate-entries', 'true' );
584
+ }
585
+ if ( get_option('gwolle_gb-navigation', false) == false ) {
586
+ update_option( 'gwolle_gb-navigation', 0 );
587
+ }
588
+ if ( get_option('gwolle_gb-nonce', false) == false ) {
589
+ update_option( 'gwolle_gb-nonce', 'true' );
590
+ }
591
+ if ( get_option('gwolle_gb-paginate_all', false) == false ) {
592
+ update_option( 'gwolle_gb-paginate_all', 'false' );
593
+ }
594
+ if ( get_option('gwolle_gb-read', false) == false ) {
595
+ if ( get_option('show_avatars') ) {
596
+ $avatar = 'true';
597
+ } else {
598
+ $avatar = 'false';
599
+ }
600
+ $defaults = Array(
601
+ 'read_avatar' => $avatar,
602
+ 'read_name' => 'true',
603
+ 'read_city' => 'true',
604
+ 'read_datetime' => 'true',
605
+ 'read_date' => 'false',
606
+ 'read_content' => 'true',
607
+ 'read_aavatar' => 'false',
608
+ 'read_editlink' => 'true'
609
+ );
610
+ $defaults = serialize( $defaults );
611
+ update_option( 'gwolle_gb-read', $defaults );
612
+ }
613
+ if ( get_option('gwolle_gb-refuse-spam', false) == false ) {
614
+ update_option( 'gwolle_gb-refuse-spam', 'false' );
615
+ }
616
+ if ( get_option('gwolle_gb-require_login', false) == false ) {
617
+ update_option( 'gwolle_gb-require_login', 'false' );
618
+ }
619
+ if ( get_option('gwolle_gb-sfs', false) == false ) {
620
+ update_option( 'gwolle_gb-sfs', 'false' );
621
+ }
622
+ if ( get_option('gwolle_gb-store_ip', false) == false ) {
623
+ update_option( 'gwolle_gb-store_ip', 'true' );
624
+ }
625
+ if ( get_option('gwolle_gb-showEntryIcons', false) == false ) {
626
+ update_option( 'gwolle_gb-showEntryIcons', 'true' );
627
+ }
628
+ if ( get_option('gwolle_gb-showLineBreaks', false) == false ) {
629
+ update_option( 'gwolle_gb-showLineBreaks', 'false' );
630
+ }
631
+ if ( get_option('gwolle_gb-showSmilies', false) == false ) {
632
+ update_option( 'gwolle_gb-showSmilies', 'true' );
633
+ }
634
+ if ( get_option('gwolle_gb-timeout', false) == false ) {
635
+ update_option( 'gwolle_gb-timeout', 'true' );
636
+ }
637
+ }
admin/js/gwolle-gb-admin.js CHANGED
@@ -217,14 +217,14 @@ jQuery(document).ready(function($) {
217
  var parts = parseFloat( jQuery("#gwolle_gb_export_parts").val() );
218
 
219
  for ( var part = 1; part < (parts + 1); part++ ) {
220
- var timeout = (part - 1) * 5000;
221
  gwolle_gb_export_part( part, timeout );
222
  }
223
 
224
  setTimeout(
225
  function() {
226
  jQuery( ".gwolle_gb_export_gif" ).css( 'visibility', 'hidden' );
227
- }, ( (part - 1) * 5000 )
228
  );
229
 
230
  event.preventDefault();
217
  var parts = parseFloat( jQuery("#gwolle_gb_export_parts").val() );
218
 
219
  for ( var part = 1; part < (parts + 1); part++ ) {
220
+ var timeout = (part - 1) * 3000;
221
  gwolle_gb_export_part( part, timeout );
222
  }
223
 
224
  setTimeout(
225
  function() {
226
  jQuery( ".gwolle_gb_export_gif" ).css( 'visibility', 'hidden' );
227
+ }, ( (part - 1) * 3000 )
228
  );
229
 
230
  event.preventDefault();
admin/tabs/gb-admintab.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_settingstab_admin() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
9
  }
10
 
11
 
12
+ /*
13
+ * Admin tab of the Settings page.
14
+ */
15
  function gwolle_gb_page_settingstab_admin() {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
admin/tabs/gb-antispamtab.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_settingstab_antispam() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
@@ -60,7 +63,7 @@ function gwolle_gb_page_settingstab_antispam() {
60
  <span class="setting-description">
61
  <?php esc_html_e('Entries that are marked as spam will be placed in your spam folder by default.', 'gwolle-gb'); ?>
62
  <br />
63
- <?php esc_html_e('This option will refuse to accept entries marked by Honeypot, Nonce, Akismet and Stop Forum Spam. Users will see the form again after submit, with an error stating that it is recognized as spam.', 'gwolle-gb'); ?>
64
  </span>
65
  </td>
66
  </tr>
@@ -129,6 +132,44 @@ function gwolle_gb_page_settingstab_antispam() {
129
  </td>
130
  </tr>
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  <tr valign="top">
133
  <th scope="row">
134
  <label for="akismet-active"><?php esc_html_e('Akismet', 'gwolle-gb'); ?></label>
@@ -161,7 +202,7 @@ function gwolle_gb_page_settingstab_antispam() {
161
  <label for="akismet-active">
162
  ' . esc_html__('Use Akismet', 'gwolle-gb') . '
163
  </label><br />';
164
- esc_html_e('Akismet is an external service by Automattic that acts as a spamfilter for guestbook entries.', 'gwolle-gb') . '<br />';
165
  esc_html_e('The WordPress API key has been found, so you can start using Akismet right now.', 'gwolle-gb');
166
  }
167
  ?>
9
  }
10
 
11
 
12
+ /*
13
+ * Anti-spam tab of the Settings page.
14
+ */
15
  function gwolle_gb_page_settingstab_antispam() {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
63
  <span class="setting-description">
64
  <?php esc_html_e('Entries that are marked as spam will be placed in your spam folder by default.', 'gwolle-gb'); ?>
65
  <br />
66
+ <?php esc_html_e('This option will refuse to accept entries marked by Honeypot, Nonce, Link Checker, Form Timeout, Akismet and Stop Forum Spam. Users will see the form again after submit, with an error stating that it is recognized as spam.', 'gwolle-gb'); ?>
67
  </span>
68
  </td>
69
  </tr>
132
  </td>
133
  </tr>
134
 
135
+ <tr valign="top">
136
+ <th scope="row"><label for="gwolle_gb_linkchecker"><?php esc_html_e('Link Checker', 'gwolle-gb'); ?></label></th>
137
+ <td>
138
+ <input <?php
139
+ if (get_option( 'gwolle_gb-linkchecker', 'true') == 'true') {
140
+ echo 'checked="checked"';
141
+ } ?>
142
+ type="checkbox" name="gwolle_gb_linkchecker" id="gwolle_gb_linkchecker">
143
+ <label for="gwolle_gb_linkchecker">
144
+ <?php esc_html_e('Scan for multiple links.', 'gwolle-gb'); ?>
145
+ </label><br />
146
+ <span class="setting-description">
147
+ <?php
148
+ esc_html_e('This will scan entries for links, which are often part of spam. If there are 2 links found in the content, it will be automatically marked as spam.', 'gwolle-gb');
149
+ ?>
150
+ </span>
151
+ </td>
152
+ </tr>
153
+
154
+ <tr valign="top">
155
+ <th scope="row"><label for="gwolle_gb_timeout"><?php esc_html_e('Form Timeout', 'gwolle-gb'); ?></label></th>
156
+ <td>
157
+ <input <?php
158
+ if (get_option( 'gwolle_gb-timeout', 'true') == 'true') {
159
+ echo 'checked="checked"';
160
+ } ?>
161
+ type="checkbox" name="gwolle_gb_timeout" id="gwolle_gb_timeout">
162
+ <label for="gwolle_gb_timeout">
163
+ <?php esc_html_e('Set timeout for form submit.', 'gwolle-gb'); ?>
164
+ </label><br />
165
+ <span class="setting-description">
166
+ <?php
167
+ esc_html_e('This will enable a timer function for the form. If the form is submitted faster than the timeout the entry will be marked as spam.', 'gwolle-gb');
168
+ ?>
169
+ </span>
170
+ </td>
171
+ </tr>
172
+
173
  <tr valign="top">
174
  <th scope="row">
175
  <label for="akismet-active"><?php esc_html_e('Akismet', 'gwolle-gb'); ?></label>
202
  <label for="akismet-active">
203
  ' . esc_html__('Use Akismet', 'gwolle-gb') . '
204
  </label><br />';
205
+ esc_html_e('Akismet is an external service by Automattic that acts as a spamfilter for guestbook entries.', 'gwolle-gb'); echo '<br />';
206
  esc_html_e('The WordPress API key has been found, so you can start using Akismet right now.', 'gwolle-gb');
207
  }
208
  ?>
admin/tabs/gb-debugtab.php CHANGED
@@ -8,8 +8,11 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
8
  die('No direct calls allowed!');
9
  }
10
 
 
11
  /*
12
- * $debug_test is a bool, if we want a debug test to be done.
 
 
13
  */
14
  function gwolle_gb_page_settingstab_debug( $debug_test ) {
15
 
8
  die('No direct calls allowed!');
9
  }
10
 
11
+
12
  /*
13
+ * Debug tab of the Settings page.
14
+ *
15
+ * @param bool $debug_test if we want a debug test to be done.
16
  */
17
  function gwolle_gb_page_settingstab_debug( $debug_test ) {
18
 
admin/tabs/gb-emailtab.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_settingstab_email() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
9
  }
10
 
11
 
12
+ /*
13
+ * Notifications tab of the Settings page.
14
+ */
15
  function gwolle_gb_page_settingstab_email() {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
admin/tabs/gb-formtab.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_settingstab_form() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
@@ -123,7 +126,8 @@ We reserve the right to edit, delete, or not publish entries.
123
  <br />
124
  <span class="setting-description"><?php /* translators: The GDPR law often has a country specific name */
125
  esc_html_e('Since May 2018 there is a GDPR law in the EU about privacy and personal information that is being stored.', 'gwolle-gb'); echo '<br />';
126
- esc_html_e('Disabling this option will still add the IP Address to notification emails and it will be used for spamfiltering in Akismet and Stop Forum Spam.', 'gwolle-gb'); ?></span>
 
127
  </td>
128
  </tr>
129
 
9
  }
10
 
11
 
12
+ /*
13
+ * Form tab of the Settings page.
14
+ */
15
  function gwolle_gb_page_settingstab_form() {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
126
  <br />
127
  <span class="setting-description"><?php /* translators: The GDPR law often has a country specific name */
128
  esc_html_e('Since May 2018 there is a GDPR law in the EU about privacy and personal information that is being stored.', 'gwolle-gb'); echo '<br />';
129
+ esc_html_e('Disabling this option will still have the IP Address used for spamfiltering in Stop Forum Spam.', 'gwolle-gb'); echo '<br />';
130
+ esc_html_e('Disabling this option will probably make the Akismet spamfilter less effective.', 'gwolle-gb'); ?></span>
131
  </td>
132
  </tr>
133
 
admin/tabs/gb-readingtab.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
  }
10
 
11
 
 
 
 
12
  function gwolle_gb_page_settingstab_reading() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
9
  }
10
 
11
 
12
+ /*
13
+ * Reading tab of the Settings page.
14
+ */
15
  function gwolle_gb_page_settingstab_reading() {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
admin/tabs/gb-uninstalltab.php CHANGED
@@ -8,10 +8,12 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
8
  die('No direct calls allowed!');
9
  }
10
 
 
11
  /*
12
- * $uninstalled is a bool, if the install has been done already. In that case, show messages.
 
 
13
  */
14
-
15
  function gwolle_gb_page_settingstab_uninstall( $uninstalled ) {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
8
  die('No direct calls allowed!');
9
  }
10
 
11
+
12
  /*
13
+ * Uninstall tab of the Settings page.
14
+ *
15
+ * @param bool $uninstalled if the install has been done already. In that case, show messages.
16
  */
 
17
  function gwolle_gb_page_settingstab_uninstall( $uninstalled ) {
18
 
19
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
docs/actions/gwolle_gb_uninstall.txt ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_uninstall"</b> action is used to execute a function when the plugin is uninstalled and deactivated.
6
+
7
+ You can use this action as:
8
+
9
+ <code><?php add_action( 'gwolle_gb_uninstall', 'action_function_name' ) ?></code>
10
+
11
+ Where 'action_function_name' is the function WordPress should call when the action is being used.
12
+
13
+ '''action_function_name''' should be a unique function name. It cannot match any other function name already declared.
14
+
15
+
16
+ ==Examples==
17
+
18
+ function my_gwolle_gb_uninstall( $args = '' ) {
19
+
20
+ // Do something
21
+
22
+ }
23
+ add_action( 'gwolle_gb_uninstall', 'my_gwolle_gb_uninstall' );
frontend/gb-ajax-captcha.php CHANGED
@@ -1,13 +1,5 @@
1
  <?php
2
 
3
- /*
4
- * Handles AJAX request from Gwolle-GB Captcha AJAX check.
5
- * Expects that the plugin Really Simple Captcha is enabled.
6
- *
7
- * Returns 'true' or 'false', if the CAPTCHA is filled in correctly.
8
- * This response is not required for validation and being able to submit the form.
9
- */
10
-
11
 
12
  // No direct calls to this script
13
  if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
@@ -15,6 +7,13 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
15
  }
16
 
17
 
 
 
 
 
 
 
 
18
  function gwolle_gb_captcha_ajax_callback() {
19
 
20
  if ( class_exists('ReallySimpleCaptcha') ) {
1
  <?php
2
 
 
 
 
 
 
 
 
 
3
 
4
  // No direct calls to this script
5
  if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
7
  }
8
 
9
 
10
+ /*
11
+ * Handles AJAX request from Gwolle-GB Captcha AJAX check.
12
+ * Expects that the plugin Really Simple Captcha is enabled.
13
+ *
14
+ * @return bool 'true' or 'false', if the CAPTCHA is filled in correctly.
15
+ * This response is not required for validation and being able to submit the form.
16
+ */
17
  function gwolle_gb_captcha_ajax_callback() {
18
 
19
  if ( class_exists('ReallySimpleCaptcha') ) {
frontend/gb-form-ajax.php CHANGED
@@ -1,11 +1,5 @@
1
  <?php
2
 
3
- /*
4
- * Handles AJAX request from Gwolle-GB AJAX Submit.
5
- *
6
- * Returns json encoded data, which is handled with by frontend/js/script.js.
7
- */
8
-
9
 
10
  // No direct calls to this script
11
  if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
@@ -13,6 +7,11 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
13
  }
14
 
15
 
 
 
 
 
 
16
  function gwolle_gb_form_ajax_callback() {
17
 
18
  $saved = gwolle_gb_frontend_posthandling();
1
  <?php
2
 
 
 
 
 
 
 
3
 
4
  // No direct calls to this script
5
  if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
7
  }
8
 
9
 
10
+ /*
11
+ * Handles AJAX request from Gwolle-GB AJAX Submit.
12
+ *
13
+ * @return string json encoded data, which is handled with by frontend/js/script.js.
14
+ */
15
  function gwolle_gb_form_ajax_callback() {
16
 
17
  $saved = gwolle_gb_frontend_posthandling();
frontend/gb-form-posthandling.php CHANGED
@@ -11,7 +11,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
11
  * Use this action, since $post is populated and we can use get_the_ID().
12
  */
13
  function gwolle_gb_handle_post() {
14
- if ( !is_admin() ) {
15
  // Frontend Handling of $_POST, only one form
16
  if ( isset($_POST['gwolle_gb_function']) && $_POST['gwolle_gb_function'] == 'add_entry' ) {
17
  gwolle_gb_frontend_posthandling();
@@ -28,8 +28,8 @@ add_action('wp', 'gwolle_gb_handle_post');
28
  * global vars used:
29
  * $gwolle_gb_formdata: the data that was submitted, and will be used to fill the form for resubmit.
30
  *
31
- * returns entry->ID when saved.
32
- * returns false when not saved, and should return the form with an error.
33
  */
34
  function gwolle_gb_frontend_posthandling() {
35
 
@@ -159,18 +159,19 @@ function gwolle_gb_frontend_posthandling() {
159
 
160
  /* Custom Anti-Spam */
161
  if ( isset($form_setting['form_antispam_enabled']) && $form_setting['form_antispam_enabled'] === 'true' ) {
 
162
  $antispam_question = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-question') );
163
  $antispam_answer = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-answer') );
164
 
165
  if ( isset($antispam_question) && strlen($antispam_question) > 0 && isset($antispam_answer) && strlen($antispam_answer) > 0 ) {
166
- if ( isset($_POST['gwolle_gb_antispam_answer']) && trim($_POST['gwolle_gb_antispam_answer']) == trim($antispam_answer) ) {
167
  //echo "You got it!";
168
  } else {
169
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('The anti-spam question was not answered correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'gwolle_gb_antispam_answer'); // mandatory
170
  }
171
  }
172
- if ( isset($_POST['gwolle_gb_antispam_answer']) ) {
173
- $antispam = trim($_POST['gwolle_gb_antispam_answer']);
174
  $gwolle_gb_formdata['antispam_answer'] = $antispam;
175
  gwolle_gb_add_formdata( 'antispam_answer', $antispam );
176
  }
@@ -263,9 +264,11 @@ function gwolle_gb_frontend_posthandling() {
263
  }
264
 
265
 
266
- /* Honeypot: check for spam and set accordingly */
267
  $marked_by_honeypot = false;
268
  $field_name = gwolle_gb_get_field_name( 'honeypot' );
 
 
269
  if ( isset($_POST[$field_name]) && strlen($_POST[$field_name]) > 0 ) {
270
  // Input field was filled in, so considered spam
271
  $entry->set_isspam(true);
@@ -276,9 +279,19 @@ function gwolle_gb_frontend_posthandling() {
276
  return false;
277
  }
278
  }
 
 
 
 
 
 
 
 
 
 
279
 
280
 
281
- /* Nonce: check for spam and set accordingly */
282
  $marked_by_nonce = false;
283
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
284
  $field_name = gwolle_gb_get_field_name( 'nonce' );
@@ -348,7 +361,62 @@ function gwolle_gb_frontend_posthandling() {
348
  }
349
 
350
 
351
- /* Check for logged in user, and set the userid as author_id, just in case someone is also admin, or gets promoted some day */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  $entry->set_author_id( $user_id );
353
 
354
 
@@ -418,7 +486,7 @@ function gwolle_gb_frontend_posthandling() {
418
 
419
 
420
  /*
421
- * No Log for the Entry needed, it has a default post date in the Entry itself.
422
  * Only log when something specific happened:
423
  */
424
  if ( $marked_by_akismet ) {
@@ -436,6 +504,12 @@ function gwolle_gb_frontend_posthandling() {
436
  if ( $marked_by_longtext ) {
437
  gwolle_gb_add_log_entry( $entry->get_id(), 'marked-by-longtext' );
438
  }
 
 
 
 
 
 
439
 
440
 
441
  /*
11
  * Use this action, since $post is populated and we can use get_the_ID().
12
  */
13
  function gwolle_gb_handle_post() {
14
+ if ( ! is_admin() ) {
15
  // Frontend Handling of $_POST, only one form
16
  if ( isset($_POST['gwolle_gb_function']) && $_POST['gwolle_gb_function'] == 'add_entry' ) {
17
  gwolle_gb_frontend_posthandling();
28
  * global vars used:
29
  * $gwolle_gb_formdata: the data that was submitted, and will be used to fill the form for resubmit.
30
  *
31
+ * @return int entry->ID when saved.
32
+ * @return bool false when not saved, and should return the form with an error.
33
  */
34
  function gwolle_gb_frontend_posthandling() {
35
 
159
 
160
  /* Custom Anti-Spam */
161
  if ( isset($form_setting['form_antispam_enabled']) && $form_setting['form_antispam_enabled'] === 'true' ) {
162
+ $field_name = gwolle_gb_get_field_name( 'custom' );
163
  $antispam_question = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-question') );
164
  $antispam_answer = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-answer') );
165
 
166
  if ( isset($antispam_question) && strlen($antispam_question) > 0 && isset($antispam_answer) && strlen($antispam_answer) > 0 ) {
167
+ if ( isset($_POST[$field_name]) && trim($_POST[$field_name]) == trim($antispam_answer) ) {
168
  //echo "You got it!";
169
  } else {
170
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('The anti-spam question was not answered correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
171
  }
172
  }
173
+ if ( isset($_POST[$field_name]) ) {
174
+ $antispam = trim($_POST[$field_name]);
175
  $gwolle_gb_formdata['antispam_answer'] = $antispam;
176
  gwolle_gb_add_formdata( 'antispam_answer', $antispam );
177
  }
264
  }
265
 
266
 
267
+ /* Honeypot: check for spam and set accordingly. */
268
  $marked_by_honeypot = false;
269
  $field_name = gwolle_gb_get_field_name( 'honeypot' );
270
+ $field_name2 = gwolle_gb_get_field_name( 'honeypot2' );
271
+ $honeypot_value = get_option( 'gwolle_gb-honeypot_value', 15 );
272
  if ( isset($_POST[$field_name]) && strlen($_POST[$field_name]) > 0 ) {
273
  // Input field was filled in, so considered spam
274
  $entry->set_isspam(true);
279
  return false;
280
  }
281
  }
282
+ if ( ! isset($_POST[$field_name2]) || $_POST[$field_name2] != $honeypot_value ) {
283
+ // Input field was not filled in correctly, so considered spam
284
+ $entry->set_isspam(true);
285
+ $marked_by_honeypot = true;
286
+ if (get_option( 'gwolle_gb-refuse-spam', 'false') == 'true') {
287
+ gwolle_gb_add_message( '<p class="refuse-spam-honeypot2"><strong>' . esc_html__('Your entry was marked as spam. Please try again.', 'gwolle-gb') . '</strong></p>', true, false );
288
+ do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
289
+ return false;
290
+ }
291
+ }
292
 
293
 
294
+ /* Nonce: check for spam and set accordingly. */
295
  $marked_by_nonce = false;
296
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
297
  $field_name = gwolle_gb_get_field_name( 'nonce' );
361
  }
362
 
363
 
364
+ /* Scan with Link Checker. */
365
+ $marked_by_linkchecker = false;
366
+ $marker_for_linkchecker = 0;
367
+ if ( get_option( 'gwolle_gb-linkchecker', 'true') == 'true' ) {
368
+ $words = explode( " ", $entry->get_content() );
369
+ foreach ( $words as $word ) {
370
+ if ( preg_match( '/(http|https)\:\/\/?/', $content, $matches) ) {
371
+ // Match
372
+ $marker_for_linkchecker++;
373
+ }
374
+ }
375
+ if ( $marker_for_linkchecker > 1 ) {
376
+ $entry->set_isspam( true );
377
+ $marked_by_linkchecker = true;
378
+ if (get_option( 'gwolle_gb-refuse-spam', 'false') == 'true') {
379
+ gwolle_gb_add_message( '<p class="refuse-spam-linkchecker"><strong>' . esc_html__('Your entry was marked as spam. Please try again.', 'gwolle-gb') . '</strong></p>', true, false );
380
+ do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
381
+ return false;
382
+ }
383
+ }
384
+ }
385
+
386
+
387
+ /* Form Timeout: check for spam and set accordingly. */
388
+ $marked_by_timeout = false;
389
+ if (get_option( 'gwolle_gb-timeout', 'true') == 'true') {
390
+ $field_name = gwolle_gb_get_field_name( 'timeout' );
391
+ $field_name2 = gwolle_gb_get_field_name( 'timeout2' );
392
+ if ( isset($_POST[$field_name]) && strlen($_POST[$field_name]) > 0 && isset($_POST[$field_name2]) && strlen($_POST[$field_name2]) > 0 ) {
393
+ // Input fields were filled in, so continue.
394
+ $timeout = (int) $_POST[$field_name];
395
+ $timeout2 = (int) $_POST[$field_name2];
396
+ if ( ($timeout2 - $timeout) < 14 ) {
397
+ // Submitted less then 7 seconds after loading. Considered spam.
398
+ $entry->set_isspam(true);
399
+ $marked_by_timeout = true;
400
+ if (get_option( 'gwolle_gb-refuse-spam', 'false') == 'true') {
401
+ gwolle_gb_add_message( '<p class="refuse-spam-timeout"><strong>' . esc_html__('Your entry was submitted too fast, please slow down and try again.', 'gwolle-gb') . '</strong></p>', true, false );
402
+ do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
403
+ return false;
404
+ }
405
+ }
406
+ } else {
407
+ // Input fields were not filled in correctly. Considered spam.
408
+ $entry->set_isspam(true);
409
+ $marked_by_timeout = true;
410
+ if (get_option( 'gwolle_gb-refuse-spam', 'false') == 'true') {
411
+ gwolle_gb_add_message( '<p class="refuse-spam-timeout"><strong>' . esc_html__('Your entry was marked as spam. Please try again.', 'gwolle-gb') . '</strong></p>', true, false );
412
+ do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
413
+ return false;
414
+ }
415
+ }
416
+ }
417
+
418
+
419
+ /* Check for logged in user, and set the userid as author_id, just in case someone is also admin, or gets promoted some day. */
420
  $entry->set_author_id( $user_id );
421
 
422
 
486
 
487
 
488
  /*
489
+ * No initial Log for the Entry needed, it has a default post date in the Entry itself.
490
  * Only log when something specific happened:
491
  */
492
  if ( $marked_by_akismet ) {
504
  if ( $marked_by_longtext ) {
505
  gwolle_gb_add_log_entry( $entry->get_id(), 'marked-by-longtext' );
506
  }
507
+ if ( $marked_by_linkchecker ) {
508
+ gwolle_gb_add_log_entry( $entry->get_id(), 'marked-by-linkchecker' );
509
+ }
510
+ if ( $marked_by_timeout ) {
511
+ gwolle_gb_add_log_entry( $entry->get_id(), 'marked-by-timeout' );
512
+ }
513
 
514
 
515
  /*
frontend/gb-form.php CHANGED
@@ -8,8 +8,12 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
8
 
9
  /*
10
  * Build up a form for the user, including possible error_fields
 
 
 
 
 
11
  */
12
-
13
  function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
14
 
15
  /* Get the messages and formdata from the form handling in posthandling.php. */
@@ -271,14 +275,36 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
271
  $output .= apply_filters( 'gwolle_gb_write_add_after_website', '' );
272
 
273
  /* Honeypot */
274
- if (get_option( 'gwolle_gb-honeypot', 'true') == 'true') {
275
  $field_name = gwolle_gb_get_field_name( 'honeypot' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  $output .= '
277
  <div class="' . $field_name . '" style="display:none;">
278
- <div class="label"><label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not fill this in', 'gwolle-gb') . ':
 
279
  </label></div>
280
  <div class="input">
281
- <input value="" type="text" name="' . $field_name . '" id="' . $field_name . '" placeholder="" />
 
282
  </div>
283
  </div>
284
  <div class="clearBoth"></div>';
@@ -342,6 +368,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
342
 
343
  /* Custom Anti-Spam */
344
  if ( isset($form_setting['form_antispam_enabled']) && $form_setting['form_antispam_enabled'] === 'true' ) {
 
345
  $label = apply_filters( 'gwolle_gb_antispam_label', esc_html__('Anti-spam', 'gwolle-gb') );
346
  $antispam_question = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-question') );
347
  $antispam_answer = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-answer') );
@@ -350,15 +377,15 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
350
  $output .= '
351
  <div class="gwolle_gb_antispam">
352
  <div class="label">
353
- <label for="gwolle_gb_antispam_answer" class="text-info">' . $label . ': *<br />
354
  ' . esc_html__('Question:', 'gwolle-gb') . ' ' . $antispam_question . '</label>
355
  </div>
356
  <div class="input"><input class="';
357
- if (in_array('gwolle_gb_antispam_answer', $gwolle_gb_error_fields)) {
358
  $output .= ' error';
359
  }
360
- $output .= '" value="' . $antispam . '" type="text" name="gwolle_gb_antispam_answer" id="gwolle_gb_antispam_answer" placeholder="' . esc_attr__('Answer', 'gwolle-gb') . '" ';
361
- if ( in_array('gwolle_gb_antispam_answer', $gwolle_gb_error_fields) && isset($autofocus) ) {
362
  $output .= $autofocus;
363
  $autofocus = false; // disable it for the next error.
364
  }
8
 
9
  /*
10
  * Build up a form for the user, including possible error_fields
11
+ * Called by shortcode or template function
12
+ *
13
+ * @param array $shortcode_atts shortcode attributes
14
+ * @param string $shortcode the shortcode that was used
15
+ * @return string html with the form and messages
16
  */
 
17
  function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
18
 
19
  /* Get the messages and formdata from the form handling in posthandling.php. */
275
  $output .= apply_filters( 'gwolle_gb_write_add_after_website', '' );
276
 
277
  /* Honeypot */
278
+ if ( get_option( 'gwolle_gb-honeypot', 'true') == 'true' ) {
279
  $field_name = gwolle_gb_get_field_name( 'honeypot' );
280
+ $field_name2 = gwolle_gb_get_field_name( 'honeypot2' );
281
+ $honeypot_value = get_option( 'gwolle_gb-honeypot_value', 15 );
282
+ $output .= '
283
+ <div class="' . $field_name . '" style="display:none;">
284
+ <div class="label"><label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not fill this in', 'gwolle-gb') . ':</label>
285
+ <label for="' . $field_name2 . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . ':
286
+ </label></div>
287
+ <div class="input">
288
+ <input value="' . $honeypot_value . '" type="text" name="' . $field_name . '" id="' . $field_name . '" placeholder="" />
289
+ <input value="" type="text" name="' . $field_name2 . '" id="' . $field_name2 . '" placeholder="" />
290
+ </div>
291
+ </div>
292
+ <div class="clearBoth"></div>';
293
+ }
294
+
295
+ /* Form Timeout */
296
+ if ( get_option( 'gwolle_gb-timeout', 'true') == 'true' ) {
297
+ $field_name = gwolle_gb_get_field_name( 'timeout' );
298
+ $field_name2 = gwolle_gb_get_field_name( 'timeout2' );
299
+ $random = rand( 100, 100000 );
300
  $output .= '
301
  <div class="' . $field_name . '" style="display:none;">
302
+ <div class="label"><label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . ':</label>
303
+ <label for="' . $field_name2 . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . ':
304
  </label></div>
305
  <div class="input">
306
+ <input value="' . $random . '" type="text" name="' . $field_name . '" id="' . $field_name . '" placeholder="" />
307
+ <input value="' . $random . '" type="text" name="' . $field_name2 . '" id="' . $field_name2 . '" placeholder="" />
308
  </div>
309
  </div>
310
  <div class="clearBoth"></div>';
368
 
369
  /* Custom Anti-Spam */
370
  if ( isset($form_setting['form_antispam_enabled']) && $form_setting['form_antispam_enabled'] === 'true' ) {
371
+ $field_name = gwolle_gb_get_field_name( 'custom' );
372
  $label = apply_filters( 'gwolle_gb_antispam_label', esc_html__('Anti-spam', 'gwolle-gb') );
373
  $antispam_question = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-question') );
374
  $antispam_answer = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-answer') );
377
  $output .= '
378
  <div class="gwolle_gb_antispam">
379
  <div class="label">
380
+ <label for="' . $field_name . '" class="text-info">' . $label . ': *<br />
381
  ' . esc_html__('Question:', 'gwolle-gb') . ' ' . $antispam_question . '</label>
382
  </div>
383
  <div class="input"><input class="';
384
+ if (in_array( $field_name, $gwolle_gb_error_fields)) {
385
  $output .= ' error';
386
  }
387
+ $output .= '" value="' . $antispam . '" type="text" name="' . $field_name . '" id="' . $field_name . '" placeholder="' . esc_attr__('Answer', 'gwolle-gb') . '" ';
388
+ if ( in_array( $field_name, $gwolle_gb_error_fields) && isset($autofocus) ) {
389
  $output .= $autofocus;
390
  $autofocus = false; // disable it for the next error.
391
  }
frontend/gb-pagination.php CHANGED
@@ -10,9 +10,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
10
  * gwolle_gb_pagination_frontend
11
  * Pagination of the entries for the guestbook frontend
12
  *
13
- * @args: $pageNum, int with the number of the requested page.
14
- * $pages_total, int with the total number of pages.
15
- * @return: $pagination, string with the html of the pagination.
16
  */
17
  function gwolle_gb_pagination_frontend( $pageNum, $pages_total ) {
18
 
10
  * gwolle_gb_pagination_frontend
11
  * Pagination of the entries for the guestbook frontend
12
  *
13
+ * @param int $pageNum the number of the requested page.
14
+ * @param int $pages_total the total number of pages.
15
+ * @return string $pagination the html of the pagination.
16
  */
17
  function gwolle_gb_pagination_frontend( $pageNum, $pages_total ) {
18
 
frontend/gb-read.php CHANGED
@@ -7,10 +7,13 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
7
 
8
 
9
  /*
10
- * gwolle_gb_frontend_read
11
- * Reading mode of the guestbook frontend
 
 
 
 
12
  */
13
-
14
  function gwolle_gb_frontend_read( $shortcode_atts, $shortcode ) {
15
 
16
  $output = '';
7
 
8
 
9
  /*
10
+ * Called by the shortcode or template function.
11
+ * Reading mode of the guestbook frontend.
12
+ *
13
+ * @param array $shortcode_atts shortcode attributes
14
+ * @param string $shortcode the shortcode that was used
15
+ * @return string html with the list of entries
16
  */
 
17
  function gwolle_gb_frontend_read( $shortcode_atts, $shortcode ) {
18
 
19
  $output = '';
frontend/gb-rss.php CHANGED
@@ -7,7 +7,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
7
  }
8
 
9
 
10
- /* Add the feed. */
 
 
11
  function gwolle_gb_rss_init(){
12
  add_feed('gwolle_gb', 'gwolle_gb_rss');
13
  }
@@ -45,7 +47,9 @@ function gwolle_gb_rss_head() {
45
  add_action('wp_head', 'gwolle_gb_rss_head', 1);
46
 
47
 
48
- /* Set the correct HTTP header for Content-type. */
 
 
49
  function gwolle_gb_rss_content_type( $content_type, $type ) {
50
  if ( 'gwolle_gb' === $type ) {
51
  return feed_content_type( 'rss2' );
@@ -55,7 +59,9 @@ function gwolle_gb_rss_content_type( $content_type, $type ) {
55
  add_filter( 'feed_content_type', 'gwolle_gb_rss_content_type', 10, 2 );
56
 
57
 
58
- /* Show the XML Feed */
 
 
59
  function gwolle_gb_rss() {
60
 
61
  // Only show the first page of entries.
7
  }
8
 
9
 
10
+ /*
11
+ * Add the feed.
12
+ */
13
  function gwolle_gb_rss_init(){
14
  add_feed('gwolle_gb', 'gwolle_gb_rss');
15
  }
47
  add_action('wp_head', 'gwolle_gb_rss_head', 1);
48
 
49
 
50
+ /*
51
+ * Set the correct HTTP header for Content-type.
52
+ */
53
  function gwolle_gb_rss_content_type( $content_type, $type ) {
54
  if ( 'gwolle_gb' === $type ) {
55
  return feed_content_type( 'rss2' );
59
  add_filter( 'feed_content_type', 'gwolle_gb_rss_content_type', 10, 2 );
60
 
61
 
62
+ /*
63
+ * Show the XML Feed
64
+ */
65
  function gwolle_gb_rss() {
66
 
67
  // Only show the first page of entries.
frontend/gb-shortcode-widget.php CHANGED
@@ -6,21 +6,29 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
6
  }
7
 
8
 
9
- /* Widget Function for simple layout.
 
10
  *
11
  * For multiple guestbooks, use it like this:
12
  * gwolle_gb_shortcode_widget( array('book_id'=>2) );
13
  * which will show Book ID 2 in widget layout.
 
 
 
 
 
 
 
14
  */
15
-
16
  function gwolle_gb_shortcode_widget( $atts ) {
17
  echo get_gwolle_gb_shortcode_widget( $atts );
18
  }
19
 
20
 
21
- /* Frontend function to show the list of entries in widget layout.
 
22
  *
23
- * Parameters:
24
  * - book_id, int with an ID.
25
  * - num_entries, int with the shown number of messages.
26
  * - num_words, int with the shown number of words per entry.
6
  }
7
 
8
 
9
+ /*
10
+ * Widget Function for simple layout.
11
  *
12
  * For multiple guestbooks, use it like this:
13
  * gwolle_gb_shortcode_widget( array('book_id'=>2) );
14
  * which will show Book ID 2 in widget layout.
15
+ *
16
+ * @since 2.1.4
17
+ *
18
+ * @param array $atts array with the shortcode attributes.
19
+ * - book_id, int with an ID.
20
+ * - num_entries, int with the shown number of messages.
21
+ * - num_words, int with the shown number of words per entry.
22
  */
 
23
  function gwolle_gb_shortcode_widget( $atts ) {
24
  echo get_gwolle_gb_shortcode_widget( $atts );
25
  }
26
 
27
 
28
+ /*
29
+ * Frontend function to show the list of entries in widget layout.
30
  *
31
+ * @param array $atts array with the shortcode attributes.
32
  * - book_id, int with an ID.
33
  * - num_entries, int with the shown number of messages.
34
  * - num_words, int with the shown number of words per entry.
frontend/gb-shortcodes.php CHANGED
@@ -12,28 +12,27 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  }
13
 
14
 
15
- /* Frontend Function
 
16
  * Use this to display the guestbook on a page without using a shortcode.
17
  *
18
  * For multiple guestbooks, use it like this:
19
  * show_gwolle_gb( array('book_id'=>2) );
20
  * which will show Book ID 2.
21
  */
22
-
23
  function show_gwolle_gb( $atts ) {
24
  echo get_gwolle_gb( $atts );
25
  }
26
 
27
 
28
- /* Frontend Function
 
29
  * Used for the main shortcode.
30
  *
31
- * Parameters:
32
- * shortcode_atts:
33
  * - book_id = 1 (default)
34
  * Can be any integer. Can also be post_id, which will set it to the ID of that post.
35
  */
36
-
37
  function get_gwolle_gb( $atts ) {
38
 
39
  $shortcode = 'gwolle_gb';
@@ -75,7 +74,11 @@ add_shortcode( 'gwolle-gb', 'get_gwolle_gb' ); // deprecated, do not use dashes
75
  add_shortcode( 'gwolle_gb', 'get_gwolle_gb' );
76
 
77
 
78
- /* Frontend function to show just the form */
 
 
 
 
79
  function get_gwolle_gb_write( $atts ) {
80
 
81
  $shortcode = 'gwolle_gb_write';
@@ -112,7 +115,11 @@ function get_gwolle_gb_write( $atts ) {
112
  add_shortcode( 'gwolle_gb_write', 'get_gwolle_gb_write' );
113
 
114
 
115
- /* Frontend function to show just the list of entries */
 
 
 
 
116
  function get_gwolle_gb_read( $atts ) {
117
 
118
  $shortcode = 'gwolle_gb_read';
12
  }
13
 
14
 
15
+ /*
16
+ * Frontend Function
17
  * Use this to display the guestbook on a page without using a shortcode.
18
  *
19
  * For multiple guestbooks, use it like this:
20
  * show_gwolle_gb( array('book_id'=>2) );
21
  * which will show Book ID 2.
22
  */
 
23
  function show_gwolle_gb( $atts ) {
24
  echo get_gwolle_gb( $atts );
25
  }
26
 
27
 
28
+ /*
29
+ * Frontend Function
30
  * Used for the main shortcode.
31
  *
32
+ * @param array $atts array with the shortcode attributes.
 
33
  * - book_id = 1 (default)
34
  * Can be any integer. Can also be post_id, which will set it to the ID of that post.
35
  */
 
36
  function get_gwolle_gb( $atts ) {
37
 
38
  $shortcode = 'gwolle_gb';
74
  add_shortcode( 'gwolle_gb', 'get_gwolle_gb' );
75
 
76
 
77
+ /*
78
+ * Frontend function to show just the form.
79
+ *
80
+ * @param array $atts array with the shortcode attributes.
81
+ */
82
  function get_gwolle_gb_write( $atts ) {
83
 
84
  $shortcode = 'gwolle_gb_write';
115
  add_shortcode( 'gwolle_gb_write', 'get_gwolle_gb_write' );
116
 
117
 
118
+ /*
119
+ * Frontend function to show just the list of entries
120
+ *
121
+ * @param array $atts array with the shortcode attributes.
122
+ */
123
  function get_gwolle_gb_read( $atts ) {
124
 
125
  $shortcode = 'gwolle_gb_read';
frontend/gb-total.php CHANGED
@@ -14,8 +14,8 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
14
  * Display the total number of entries.
15
  *
16
  * @param string $html html content of the filter.
17
- * array $args the parameters of the query for visible entries
18
- * @return array
19
  *
20
  * @since 2.3.2
21
  */
14
  * Display the total number of entries.
15
  *
16
  * @param string $html html content of the filter.
17
+ * @param array $args the parameters of the query for visible entries
18
+ * @return string $html new html content of the filter.
19
  *
20
  * @since 2.3.2
21
  */
frontend/gwolle_gb-entry.php CHANGED
@@ -6,13 +6,6 @@
6
  * By default this file will be loaded from /wp-content/plugins/gwolle-gb-frontend/gwolle_gb-entry.php.
7
  * If you place it in your childtheme or parenttheme, it will be overridden.
8
  * Make sure you only return values, and not to use echo statements.
9
- *
10
- *
11
- * $args: $entry, instance of gwolle_gb_entry.
12
- * $first, boolean with true if it is the first entry.
13
- * $counter,int with the number of the entry. (since 1.4.7)
14
- *
15
- * return: string, html with a single guestbook entry.
16
  */
17
 
18
 
@@ -21,7 +14,14 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
21
  die('No direct calls allowed!');
22
  }
23
 
24
-
 
 
 
 
 
 
 
25
  if ( ! function_exists('gwolle_gb_entry_template') ) {
26
  function gwolle_gb_entry_template( $entry, $first, $counter ) {
27
 
6
  * By default this file will be loaded from /wp-content/plugins/gwolle-gb-frontend/gwolle_gb-entry.php.
7
  * If you place it in your childtheme or parenttheme, it will be overridden.
8
  * Make sure you only return values, and not to use echo statements.
 
 
 
 
 
 
 
9
  */
10
 
11
 
14
  die('No direct calls allowed!');
15
  }
16
 
17
+ /*
18
+ * Template file for s single guestbook entry.
19
+ *
20
+ * @param object $entry instance of gwolle_gb_entry.
21
+ * @param bool $first true if it is the first entry.
22
+ * @param int $counter the number of the entry. (since 1.4.7)
23
+ * @return: string, html with a single guestbook entry.
24
+ */
25
  if ( ! function_exists('gwolle_gb_entry_template') ) {
26
  function gwolle_gb_entry_template( $entry, $first, $counter ) {
27
 
frontend/js/gwolle-gb-frontend.js CHANGED
@@ -136,6 +136,41 @@ jQuery(document).ready(function($) {
136
  });
137
 
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  /*
140
  * AJAX Submit for Gwolle Guestbook Frontend.
141
  */
136
  });
137
 
138
 
139
+ /*
140
+ * Mangle data for the honeypot.
141
+ */
142
+ jQuery(document).ready(function($) {
143
+ var honeypot = gwolle_gb_frontend_script.honeypot;
144
+ var honeypot2 = gwolle_gb_frontend_script.honeypot2;
145
+ var val = jQuery( '#' + honeypot ).val();
146
+ if ( val > 0 ) {
147
+ jQuery( '#' + honeypot2 ).val( val );
148
+ jQuery( '#' + honeypot ).val( '' );
149
+ }
150
+ });
151
+
152
+
153
+ /*
154
+ * Mangle data for the form timeout.
155
+ */
156
+ jQuery(document).ready(function($) {
157
+ setInterval('gwolle_gb_timout_clock()', 1000 );
158
+ });
159
+ function gwolle_gb_timout_clock() {
160
+ var timeout = gwolle_gb_frontend_script.timeout;
161
+ var timeout2 = gwolle_gb_frontend_script.timeout2;
162
+
163
+ var timer = new Number( jQuery( '#' + timeout ).val() );
164
+ var timer2 = new Number( jQuery( '#' + timeout2 ).val() );
165
+
166
+ var timer = timer - 1
167
+ var timer2 = timer2 + 1
168
+
169
+ jQuery( '#' + timeout ).val( timer );
170
+ jQuery( '#' + timeout2 ).val( timer2 );
171
+ }
172
+
173
+
174
  /*
175
  * AJAX Submit for Gwolle Guestbook Frontend.
176
  */
functions/gb-akismet.php CHANGED
@@ -13,18 +13,15 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
13
 
14
 
15
  /*
16
- * $params:
17
- * $entry: object $gwolle_gb_entry with a guestbook entry to be checked
18
- * should be an instance of the gwolle_gb_entry class
19
- * $action: string with the requested action
20
  * - comment-check: check with Akismet service if entry is considered spam or not
21
  * - submit-ham: submit as ham to Akismet service
22
  * - submit-spam: submit as spam to Akismet service
23
- *
24
- * Return: - true if the entry is considered spam by akismet
25
- * - false if no spam, or no akismet functionality is found
26
  */
27
-
28
  function gwolle_gb_akismet( $entry, $action ) {
29
 
30
  $actions = array(
@@ -74,8 +71,11 @@ function gwolle_gb_akismet( $entry, $action ) {
74
  $comment['blog'] = get_option( 'home' );
75
  $comment['blog_lang'] = get_locale();
76
  $comment['blog_charset'] = get_option( 'blog_charset' );
77
- $comment['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
78
- $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
 
 
 
79
  if ( isset($_SERVER['HTTP_REFERER']) ) {
80
  $comment['referrer'] = $_SERVER['HTTP_REFERER'];
81
  }
@@ -88,7 +88,7 @@ function gwolle_gb_akismet( $entry, $action ) {
88
  $comment['permalink'] = $permalink;
89
  }
90
 
91
- $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
92
  foreach ( $_SERVER as $key => $value ) {
93
  if ( ! in_array( $key, (array) $ignore ) )
94
  $comment["$key"] = $value;
@@ -103,13 +103,15 @@ function gwolle_gb_akismet( $entry, $action ) {
103
  /*
104
  * Check the $comment against Akismet service
105
  *
106
- * Parameters:
107
- * $comment: Array with the comment
108
- * $action: string with 'comment-check', 'submit-ham', 'submit-spam'
109
- *
110
- * Return: true or false
 
 
 
111
  */
112
-
113
  function gwolle_gb_akismet_entry_check( $comment, $action ) {
114
  global $akismet_api_host, $akismet_api_port;
115
 
13
 
14
 
15
  /*
16
+ * @param object $entry instance of gwolle_gb_entry with a guestbook entry to be checked
17
+ * @param string $action the requested action
 
 
18
  * - comment-check: check with Akismet service if entry is considered spam or not
19
  * - submit-ham: submit as ham to Akismet service
20
  * - submit-spam: submit as spam to Akismet service
21
+ * @return bool
22
+ * - true if the entry is considered spam by akismet
23
+ * - false if no spam, or no akismet functionality is found
24
  */
 
25
  function gwolle_gb_akismet( $entry, $action ) {
26
 
27
  $actions = array(
71
  $comment['blog'] = get_option( 'home' );
72
  $comment['blog_lang'] = get_locale();
73
  $comment['blog_charset'] = get_option( 'blog_charset' );
74
+ $store_author_ip = get_option('gwolle_gb-store_ip', 'true');
75
+ if ( $store_author_ip == 'true' ) {
76
+ $comment['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
77
+ $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
78
+ }
79
  if ( isset($_SERVER['HTTP_REFERER']) ) {
80
  $comment['referrer'] = $_SERVER['HTTP_REFERER'];
81
  }
88
  $comment['permalink'] = $permalink;
89
  }
90
 
91
+ $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW', 'REMOTE_ADDR', 'HTTP_USER_AGENT', 'PATH' );
92
  foreach ( $_SERVER as $key => $value ) {
93
  if ( ! in_array( $key, (array) $ignore ) )
94
  $comment["$key"] = $value;
103
  /*
104
  * Check the $comment against Akismet service
105
  *
106
+ * @param array $comment array with data fields to be checked on
107
+ * @param string $action the requested action
108
+ * - comment-check: check with Akismet service if entry is considered spam or not
109
+ * - submit-ham: submit as ham to Akismet service
110
+ * - submit-spam: submit as spam to Akismet service
111
+ * @return bool
112
+ * - true if the entry is considered spam by akismet
113
+ * - false if no spam, or no akismet functionality is found
114
  */
 
115
  function gwolle_gb_akismet_entry_check( $comment, $action ) {
116
  global $akismet_api_host, $akismet_api_port;
117
 
functions/gb-bbcode_emoji.php CHANGED
@@ -9,6 +9,9 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
9
 
10
  /*
11
  * Parse the BBcode into HTML for output.
 
 
 
12
  */
13
  function gwolle_gb_bbcode_parse( $str ){
14
  $bb[] = "#\[b\](.*?)\[/b\]#si";
@@ -51,6 +54,9 @@ function gwolle_gb_bbcode_parse( $str ){
51
 
52
  /*
53
  * Strip the BBcode from the output.
 
 
 
54
  */
55
  function gwolle_gb_bbcode_strip( $str ){
56
  $bb[] = "#\[b\](.*?)\[/b\]#si";
@@ -81,6 +87,8 @@ function gwolle_gb_bbcode_strip( $str ){
81
 
82
  /*
83
  * Get the list of Emoji for the form.
 
 
84
  */
85
  function gwolle_gb_get_emoji() {
86
  $emoji = '
@@ -149,6 +157,7 @@ function gwolle_gb_get_emoji() {
149
  <a title="🌜" class="gwolle_gb_emoji_63 noslimstat">🌜</a>
150
  <a title="🌈" class="gwolle_gb_emoji_64 noslimstat">🌈</a>
151
  <a title="🏝" class="gwolle_gb_emoji_65 noslimstat">🏝</a>
 
152
  ';
153
  /*
154
  * Filters the list of emoji shown on textarea/bbcode/emoji at the frontend form.
@@ -168,10 +177,9 @@ function gwolle_gb_get_emoji() {
168
  /*
169
  * Convert to 3byte Emoji for storing in db, if db-charset is not utf8mb4.
170
  *
171
- * $Args: - string, text string to encode
172
- * - field, the database field that is used for that string, will be checked on charset.
173
- *
174
- * Return: string, encoded or not.
175
  */
176
  function gwolle_gb_maybe_encode_emoji( $string, $field ) {
177
  global $wpdb;
9
 
10
  /*
11
  * Parse the BBcode into HTML for output.
12
+ *
13
+ * @param string $str content that needs to be parsed
14
+ * @return string parsed content
15
  */
16
  function gwolle_gb_bbcode_parse( $str ){
17
  $bb[] = "#\[b\](.*?)\[/b\]#si";
54
 
55
  /*
56
  * Strip the BBcode from the output.
57
+ *
58
+ * @param string $str content that needs to be stripped
59
+ * @return string stripped content
60
  */
61
  function gwolle_gb_bbcode_strip( $str ){
62
  $bb[] = "#\[b\](.*?)\[/b\]#si";
87
 
88
  /*
89
  * Get the list of Emoji for the form.