Gwolle Guestbook - Version 2.4.0

Version Description

  • 2018-03-25
  • Add checkbox for privacy policy for GDPR compliance.
  • Add option to store or not store IP Address and hostname.
  • Add export for user based on ID or email.
  • Add search on entries page for user based on ID or email.
  • Support meta fields from the add-on in export/import (needs add-on > 1.1.0 ).
  • Fix CSS for mobile form and form in widget.
  • Remove book_id meta key when only one entry is shown.
  • Fix warning on entries page when no entries.
  • Add function 'gwolle_gb_get_postid_biggest_book'.
  • Add function 'gwolle_gb_get_books'.
  • Add hook 'gwolle_gb_delete_entry' when permanently deleting an entry.
  • Delete log entries in that hook.
  • Use correct URL in RSS feed.
  • Add filters for email body.
  • Fix docs for filters for email subject.
  • Drop support for Shortcake feature plugin.
  • Rephrase Cheating messages like WP Core.
Download this release

Release Info

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

Code changes from version 2.3.10 to 2.4.0

Files changed (38) hide show
  1. admin/gb-page-add-on.php +2 -1
  2. admin/gb-page-editor.php +3 -2
  3. admin/gb-page-entries.php +70 -9
  4. admin/gb-page-export.php +204 -31
  5. admin/gb-page-gwolle-gb.php +5 -4
  6. admin/gb-page-import.php +32 -3
  7. admin/gb-page-settings.php +11 -2
  8. admin/js/gwolle-gb-admin.js +45 -1
  9. admin/tabs/gb-admintab.php +1 -1
  10. admin/tabs/gb-antispamtab.php +2 -2
  11. admin/tabs/gb-debugtab.php +1 -1
  12. admin/tabs/gb-emailtab.php +1 -1
  13. admin/tabs/gb-formtab.php +32 -1
  14. admin/tabs/gb-readingtab.php +1 -1
  15. admin/tabs/gb-uninstalltab.php +1 -1
  16. docs/filters/gwolle_gb_entry_delete.txt +24 -0
  17. docs/filters/gwolle_gb_mail_author_body.txt +41 -0
  18. docs/filters/gwolle_gb_mail_author_on_admin_reply_body.txt +43 -0
  19. docs/filters/gwolle_gb_mail_author_on_admin_reply_subject.txt +4 -4
  20. docs/filters/gwolle_gb_mail_author_subject.txt +4 -4
  21. docs/filters/gwolle_gb_mail_moderator_body.txt +43 -0
  22. docs/filters/gwolle_gb_privacy_label.txt +25 -0
  23. docs/import_example/gwolle_gb_export_2.2.1_2017-09-04_08-33-part_1_of_1.csv +0 -3
  24. docs/import_example/gwolle_gb_export_2.3.10_2018-02-16_12-02-part_1_of_1.csv +3 -0
  25. frontend/css/gwolle-gb-frontend.css +40 -27
  26. frontend/gb-form-posthandling.php +11 -1
  27. frontend/gb-form.php +13 -2
  28. frontend/gb-rss.php +24 -14
  29. frontend/js/gwolle-gb-frontend.js +8 -1
  30. functions/gb-class-entry.php +2 -2
  31. functions/gb-log.php +1 -1
  32. functions/gb-mail.php +14 -11
  33. functions/gb-misc.php +101 -3
  34. functions/gb-post-meta.php +5 -0
  35. functions/gb-settings.php +3 -1
  36. functions/gb-shortcake.php +0 -37
  37. gwolle-gb.php +4 -5
  38. readme.txt +31 -3
admin/gb-page-add-on.php CHANGED
@@ -20,7 +20,7 @@ add_action( 'admin_menu', 'gwolle_gb_addon_menu_advertisement', 11 );
20
  function gwolle_gb_addon_page_advertisement() {
21
 
22
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
23
- die(esc_html__('Cheatin’ uh?', 'gwolle-gb'));
24
  }
25
 
26
  gwolle_gb_admin_enqueue();
@@ -77,6 +77,7 @@ function gwolle_gb_addon_features() {
77
  <li>' . esc_html__('Delete button in each entry for the moderator and author (optional).','gwolle-gb').'</li>
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
  </ul>';
81
  }
82
 
20
  function gwolle_gb_addon_page_advertisement() {
21
 
22
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
23
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
24
  }
25
 
26
  gwolle_gb_admin_enqueue();
77
  <li>' . esc_html__('Delete button in each entry for the moderator and author (optional).','gwolle-gb').'</li>
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
 
admin/gb-page-editor.php CHANGED
@@ -13,7 +13,7 @@ function gwolle_gb_page_editor() {
13
  global $entry;
14
 
15
  if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
16
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
17
  }
18
 
19
  gwolle_gb_admin_enqueue();
@@ -292,7 +292,8 @@ function gwolle_gb_page_editor() {
292
 
293
  /* Network Information */
294
  $set_author_ip = apply_filters( 'gwolle_gb_set_author_ip', true );
295
- if ( $set_author_ip ) {
 
296
  $entry->set_author_ip( $_SERVER['REMOTE_ADDR'] );
297
  $entry->set_author_host( gethostbyaddr( $_SERVER['REMOTE_ADDR'] ) );
298
  }
13
  global $entry;
14
 
15
  if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
16
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
17
  }
18
 
19
  gwolle_gb_admin_enqueue();
292
 
293
  /* Network Information */
294
  $set_author_ip = apply_filters( 'gwolle_gb_set_author_ip', true );
295
+ $set_author_ip2 = get_option('gwolle_gb-store_ip', 'true');
296
+ if ( $set_author_ip && ($set_author_ip2 == 'true') ) {
297
  $entry->set_author_ip( $_SERVER['REMOTE_ADDR'] );
298
  $entry->set_author_host( gethostbyaddr( $_SERVER['REMOTE_ADDR'] ) );
299
  }
admin/gb-page-entries.php CHANGED
@@ -13,13 +13,14 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
13
  function gwolle_gb_page_entries() {
14
 
15
  if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
16
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
17
  }
18
 
19
  gwolle_gb_admin_enqueue();
20
 
21
  $gwolle_gb_errors = '';
22
  $gwolle_gb_messages = '';
 
23
 
24
  if ( isset($_POST['gwolle_gb_page']) && $_POST['gwolle_gb_page'] == 'entries' ) {
25
  $action = '';
@@ -53,6 +54,9 @@ function gwolle_gb_page_entries() {
53
  }
54
  if ( $entries_checked < ( $num_entries + 1 ) ) {
55
  $continue_on_entries_checked = true;
 
 
 
56
  } else {
57
  $gwolle_gb_messages .= '<p>' . /* translators: Someone seems to be abusing the website in strange ways. */ esc_html__('It seems you checked more entries then were even listed on the page.', 'gwolle-gb') . '</p>';
58
  $gwolle_gb_errors = 'error';
@@ -312,9 +316,7 @@ function gwolle_gb_page_entries() {
312
  $count['spam'] = gwolle_gb_get_entry_count(array( 'spam' => 'spam' ));
313
  $count['trash'] = gwolle_gb_get_entry_count(array( 'trash'=> 'trash' ));
314
  $count['all'] = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
315
-
316
-
317
- $show = (isset($_REQUEST['show']) && in_array($_REQUEST['show'], array('checked', 'unchecked', 'spam', 'trash'))) ? $_REQUEST['show'] : 'all';
318
 
319
  $num_entries = get_option('gwolle_gb-entries_per_page', 20);
320
 
@@ -393,6 +395,28 @@ function gwolle_gb_page_entries() {
393
  'trash' => 'trash',
394
  'book_id' => $book_id
395
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  } else {
397
  $entries = gwolle_gb_get_entries(array(
398
  'num_entries' => $num_entries,
@@ -406,6 +430,13 @@ function gwolle_gb_page_entries() {
406
  ));
407
  }
408
  $count_entrypages = ceil( $count_entries / $num_entries );
 
 
 
 
 
 
 
409
  ?>
410
 
411
  <div class="wrap gwolle_gb">
@@ -425,7 +456,7 @@ function gwolle_gb_page_entries() {
425
  <input type="hidden" name="gwolle_gb_page" value="entries" />
426
  <!-- the following fields give us some information used for processing the mass edit -->
427
  <input type="hidden" name="pageNum" value="<?php echo $pageNum; ?>">
428
- <input type="hidden" name="entriesOnThisPage" value="<?php echo count($entries); ?>">
429
  <input type="hidden" name="show" value="<?php echo $show; ?>">
430
 
431
  <?php
@@ -455,11 +486,31 @@ function gwolle_gb_page_entries() {
455
  </li>
456
  <li><a href='admin.php?page=<?php echo GWOLLE_GB_FOLDER; ?>/entries.php&amp;show=trash' <?php
457
  if ($show == 'trash') { echo 'class="current"'; }
458
- ?>><?php /* translators: Is in Trashcan */ esc_html_e('In Trash', 'gwolle-gb'); ?> <span class="count gwolle_gb_trash_">(<?php echo $count['trash']; ?>)</span></a>
 
 
 
 
459
  </li>
460
  </ul>
461
 
462
  <div class="tablenav">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  <div class="alignleft actions">
464
  <?php
465
  $massEditControls_select = '<select name="massEditAction1">';
@@ -504,8 +555,15 @@ function gwolle_gb_page_entries() {
504
  </div>
505
 
506
  <?php
507
- $pagination = gwolle_gb_pagination_admin( $pageNum, $count_entrypages, $count_entries, $show );
508
- echo $pagination;
 
 
 
 
 
 
 
509
  ?>
510
  </div>
511
 
@@ -717,7 +775,10 @@ function gwolle_gb_page_entries() {
717
  echo $massEditControls_select . $massEditControls . $empty_button;
718
  } ?>
719
  </div>
720
- <?php echo $pagination; ?>
 
 
 
721
  </div>
722
 
723
  </form>
13
  function gwolle_gb_page_entries() {
14
 
15
  if ( function_exists('current_user_can') && !current_user_can('moderate_comments') ) {
16
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
17
  }
18
 
19
  gwolle_gb_admin_enqueue();
20
 
21
  $gwolle_gb_errors = '';
22
  $gwolle_gb_messages = '';
23
+ $show = (isset($_REQUEST['show']) && in_array($_REQUEST['show'], array( 'checked', 'unchecked', 'spam', 'trash', 'user' ))) ? $_REQUEST['show'] : 'all';
24
 
25
  if ( isset($_POST['gwolle_gb_page']) && $_POST['gwolle_gb_page'] == 'entries' ) {
26
  $action = '';
54
  }
55
  if ( $entries_checked < ( $num_entries + 1 ) ) {
56
  $continue_on_entries_checked = true;
57
+ } else if ( $show == 'user' ) {
58
+ // special case for mass edit all entries from user.
59
+ $continue_on_entries_checked = true;
60
  } else {
61
  $gwolle_gb_messages .= '<p>' . /* translators: Someone seems to be abusing the website in strange ways. */ esc_html__('It seems you checked more entries then were even listed on the page.', 'gwolle-gb') . '</p>';
62
  $gwolle_gb_errors = 'error';
316
  $count['spam'] = gwolle_gb_get_entry_count(array( 'spam' => 'spam' ));
317
  $count['trash'] = gwolle_gb_get_entry_count(array( 'trash'=> 'trash' ));
318
  $count['all'] = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
319
+ $count['user'] = 0; // dummy data, there is no pagination here.
 
 
320
 
321
  $num_entries = get_option('gwolle_gb-entries_per_page', 20);
322
 
395
  'trash' => 'trash',
396
  'book_id' => $book_id
397
  ));
398
+ } else if ( $show == 'user' ) {
399
+ $entries = array();
400
+ if ( isset( $_POST['gwolle_gb_user_id']) && ( (int) $_POST['gwolle_gb_user_id'] > 0 ) ) {
401
+ $user_id = (int) $_POST['gwolle_gb_user_id'];
402
+ $entries = gwolle_gb_get_entries(array(
403
+ 'author_id' => $user_id,
404
+ 'num_entries' => -1,
405
+ 'all' => 'all'
406
+ ));
407
+ } else if ( isset( $_POST['gwolle_gb_user_email']) && strlen($_POST['gwolle_gb_user_email']) > 0 ) {
408
+ $user_email = $_POST['gwolle_gb_user_email'];
409
+ $entries = gwolle_gb_get_entries(array(
410
+ 'email' => $user_email,
411
+ 'num_entries' => -1,
412
+ 'all' => 'all'
413
+ ));
414
+ }
415
+ if ( empty( $entries ) ) {
416
+ $count_entries = 0;
417
+ } else {
418
+ $count_entries = count($entries); // all on one page
419
+ }
420
  } else {
421
  $entries = gwolle_gb_get_entries(array(
422
  'num_entries' => $num_entries,
430
  ));
431
  }
432
  $count_entrypages = ceil( $count_entries / $num_entries );
433
+
434
+
435
+ if ( empty( $entries ) ) {
436
+ $entries_on_page = 0;
437
+ } else {
438
+ $entries_on_page = count($entries);
439
+ }
440
  ?>
441
 
442
  <div class="wrap gwolle_gb">
456
  <input type="hidden" name="gwolle_gb_page" value="entries" />
457
  <!-- the following fields give us some information used for processing the mass edit -->
458
  <input type="hidden" name="pageNum" value="<?php echo $pageNum; ?>">
459
+ <input type="hidden" name="entriesOnThisPage" value="<?php echo $entries_on_page; ?>">
460
  <input type="hidden" name="show" value="<?php echo $show; ?>">
461
 
462
  <?php
486
  </li>
487
  <li><a href='admin.php?page=<?php echo GWOLLE_GB_FOLDER; ?>/entries.php&amp;show=trash' <?php
488
  if ($show == 'trash') { echo 'class="current"'; }
489
+ ?>><?php /* translators: Is in Trashcan */ esc_html_e('In Trash', 'gwolle-gb'); ?> <span class="count gwolle_gb_trash_">(<?php echo $count['trash']; ?>)</span></a> |
490
+ </li>
491
+ <li><a href='admin.php?page=<?php echo GWOLLE_GB_FOLDER; ?>/entries.php&amp;show=user' <?php
492
+ if ($show == 'user') { echo 'class="current"'; }
493
+ ?>><?php esc_html_e('Author', 'gwolle-gb'); ?></a>
494
  </li>
495
  </ul>
496
 
497
  <div class="tablenav">
498
+ <?php if ( $show == 'user' ) {
499
+ if ( empty( $user_id ) ) { $user_id = ''; }
500
+ if ( empty( $user_email ) ) { $user_email = ''; }
501
+ ?>
502
+ <h3><?php esc_html_e('Select one option below, either User ID or Email address', 'gwolle-gb'); ?></h3>
503
+ <p>
504
+ <label for="gwolle_gb_user_id" class="text-info"><?php esc_html_e('User ID', 'gwolle-gb'); ?>:<br />
505
+ <input type="text" name="gwolle_gb_user_id" value="<?php echo $user_id; ?>" placeholder="<?php esc_html_e('User ID', 'gwolle-gb'); ?>" />
506
+ </label><br />
507
+ <label for="gwolle_gb_user_email" class="text-info"><?php esc_html_e('User Email', 'gwolle-gb'); ?>:<br />
508
+ <input type="text" name="gwolle_gb_user_email" value="<?php echo $user_email; ?>" placeholder="<?php esc_html_e('User Email', 'gwolle-gb'); ?>" />
509
+ </label><br />
510
+ <input type="submit" name="gb_search_user" id="gb_search_user" class="button button-primary" value="<?php esc_attr_e('Search entries', 'gwolle-gb'); ?>" />
511
+ </p><?php
512
+ } ?>
513
+
514
  <div class="alignleft actions">
515
  <?php
516
  $massEditControls_select = '<select name="massEditAction1">';
555
  </div>
556
 
557
  <?php
558
+ if ( $show == 'user' ) {
559
+ echo '<div class="tablenav-pages">
560
+ <span class="displaying-num">' . esc_html__('Showing:', 'gwolle-gb') . ' ' . $count_entries . '</span>
561
+ </div>';
562
+
563
+ } else {
564
+ $pagination = gwolle_gb_pagination_admin( $pageNum, $count_entrypages, $count_entries, $show );
565
+ echo $pagination;
566
+ }
567
  ?>
568
  </div>
569
 
775
  echo $massEditControls_select . $massEditControls . $empty_button;
776
  } ?>
777
  </div>
778
+ <?php
779
+ if ( $show != 'user' ) {
780
+ echo $pagination;
781
+ } ?>
782
  </div>
783
 
784
  </form>
admin/gb-page-export.php CHANGED
@@ -14,51 +14,51 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
14
  function gwolle_gb_page_export() {
15
 
16
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
17
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
18
  }
19
 
20
  gwolle_gb_admin_enqueue();
21
 
22
- $count = gwolle_gb_get_entry_count(array( 'all' => 'all' ));
23
- $num_entries = 5000;
24
- $parts = ceil( $count / $num_entries );
25
-
26
  /*
27
- * Build the Page and the Form
28
  */
29
  ?>
30
  <div class="wrap gwolle_gb">
31
  <div id="icon-gwolle-gb"><br /></div>
32
  <h1><?php esc_html_e('Export guestbook entries.', 'gwolle-gb'); ?></h1>
33
 
34
- <form name="gwolle_gb_export" id="gwolle_gb_export" method="POST" action="#" accept-charset="UTF-8">
35
- <input type="hidden" name="gwolle_gb_page" value="gwolle_gb_export" />
36
- <input type="hidden" name="gwolle_gb_export_part" id="gwolle_gb_export_part" value="1" />
37
- <input type="hidden" name="gwolle_gb_export_parts" id="gwolle_gb_export_parts" value="<?php echo $parts; ?>" />
38
-
39
- <?php
40
- /* Nonce */
41
- $nonce = wp_create_nonce( 'gwolle_gb_page_export' );
42
- echo '<input type="hidden" id="gwolle_gb_wpnonce" name="gwolle_gb_wpnonce" value="' . $nonce . '" />';
43
- ?>
44
-
45
- <div id="poststuff" class="gwolle_gb_export metabox-holder">
46
- <div class="postbox-container">
47
- <?php
48
- add_meta_box('gwolle_gb_export_postbox', esc_html__('Export guestbook entries from Gwolle-GB','gwolle-gb'), 'gwolle_gb_export_postbox', 'gwolle_gb_export', 'normal');
49
-
50
- do_meta_boxes( 'gwolle_gb_export', 'normal', '' );
51
- ?>
52
- </div>
53
  </div>
 
54
 
55
- </form>
56
  </div><?php
57
 
58
  }
59
 
60
 
61
  function gwolle_gb_export_postbox() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  $count = gwolle_gb_get_entry_count( array( 'all' => 'all' ) );
63
  $num_entries = 5000;
64
  $parts = ceil( $count / $num_entries );
@@ -87,6 +87,8 @@ function gwolle_gb_export_postbox() {
87
  <li><?php esc_html_e('"is spam" flag', 'gwolle-gb'); ?></li>
88
  <li><?php esc_html_e('"is trash" flag', 'gwolle-gb'); ?></li>
89
  <li><?php esc_html_e('Admin Reply', 'gwolle-gb'); ?></li>
 
 
90
  </ul>
91
  <?php esc_html_e('The exporter does not delete any data, so your data will still be here.', 'gwolle-gb'); ?>
92
 
@@ -102,10 +104,10 @@ function gwolle_gb_export_postbox() {
102
  </p>
103
  <?php
104
  }
 
105
  }
106
 
107
 
108
- add_action('admin_init', 'gwolle_gb_export_action');
109
  function gwolle_gb_export_action() {
110
  if ( is_admin() ) {
111
  if ( isset( $_POST['gwolle_gb_page']) && $_POST['gwolle_gb_page'] == 'gwolle_gb_export' ) {
@@ -113,6 +115,7 @@ function gwolle_gb_export_action() {
113
  }
114
  }
115
  }
 
116
 
117
 
118
  /*
@@ -153,7 +156,7 @@ function gwolle_gb_export_callback() {
153
  'all' => 'all'
154
  ));
155
 
156
- if ( is_array($entries) && !empty($entries) ) {
157
 
158
  // Clean everything before here
159
  ob_end_clean();
@@ -181,10 +184,10 @@ function gwolle_gb_export_callback() {
181
  'ischecked',
182
  'istrash',
183
  'admin_reply',
184
- 'book_id'
 
185
  ));
186
 
187
- $saved = 0;
188
  foreach ( $entries as $entry ) {
189
 
190
  $row = Array();
@@ -204,10 +207,180 @@ function gwolle_gb_export_callback() {
204
  $row[] = $entry->get_admin_reply();
205
  $row[] = $entry->get_book_id();
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  fputcsv($output, $row);
208
 
209
  gwolle_gb_add_log_entry( $entry->get_id(), 'exported-to-csv' );
210
- $saved++;
211
 
212
  }
213
 
14
  function gwolle_gb_page_export() {
15
 
16
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
17
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
18
  }
19
 
20
  gwolle_gb_admin_enqueue();
21
 
 
 
 
 
22
  /*
23
+ * Build the Page.
24
  */
25
  ?>
26
  <div class="wrap gwolle_gb">
27
  <div id="icon-gwolle-gb"><br /></div>
28
  <h1><?php esc_html_e('Export guestbook entries.', 'gwolle-gb'); ?></h1>
29
 
30
+ <div id="poststuff" class="gwolle_gb_export metabox-holder">
31
+ <div class="postbox-container">
32
+ <?php
33
+ add_meta_box('gwolle_gb_export_postbox', esc_html__('Export guestbook entries from Gwolle-GB','gwolle-gb'), 'gwolle_gb_export_postbox', 'gwolle_gb_export', 'normal');
34
+ add_meta_box('gwolle_gb_export_postbox_user', esc_html__('Export guestbook entries for a user','gwolle-gb'), 'gwolle_gb_export_postbox_user', 'gwolle_gb_export', 'normal');
35
+ do_meta_boxes( 'gwolle_gb_export', 'normal', '' );
36
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
37
  </div>
38
+ </div>
39
 
 
40
  </div><?php
41
 
42
  }
43
 
44
 
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
+
52
+ <form name="gwolle_gb_export" id="gwolle_gb_export" method="POST" action="#" accept-charset="UTF-8">
53
+ <input type="hidden" name="gwolle_gb_page" value="gwolle_gb_export" />
54
+ <input type="hidden" name="gwolle_gb_export_part" id="gwolle_gb_export_part" value="1" />
55
+ <input type="hidden" name="gwolle_gb_export_parts" id="gwolle_gb_export_parts" value="<?php echo $parts; ?>" />
56
+
57
+ <?php
58
+ /* Nonce */
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 );
87
  <li><?php esc_html_e('"is spam" flag', 'gwolle-gb'); ?></li>
88
  <li><?php esc_html_e('"is trash" flag', 'gwolle-gb'); ?></li>
89
  <li><?php esc_html_e('Admin Reply', 'gwolle-gb'); ?></li>
90
+ <li><?php esc_html_e('Book ID', 'gwolle-gb'); ?></li>
91
+ <li><?php esc_html_e('Meta Fields (if the add-on is active)', 'gwolle-gb'); ?></li>
92
  </ul>
93
  <?php esc_html_e('The exporter does not delete any data, so your data will still be here.', 'gwolle-gb'); ?>
94
 
104
  </p>
105
  <?php
106
  }
107
+ ?></form><?php
108
  }
109
 
110
 
 
111
  function gwolle_gb_export_action() {
112
  if ( is_admin() ) {
113
  if ( isset( $_POST['gwolle_gb_page']) && $_POST['gwolle_gb_page'] == 'gwolle_gb_export' ) {
115
  }
116
  }
117
  }
118
+ add_action('admin_init', 'gwolle_gb_export_action');
119
 
120
 
121
  /*
156
  'all' => 'all'
157
  ));
158
 
159
+ if ( is_array($entries) && ! empty($entries) ) {
160
 
161
  // Clean everything before here
162
  ob_end_clean();
184
  'ischecked',
185
  'istrash',
186
  'admin_reply',
187
+ 'book_id',
188
+ 'meta_fields'
189
  ));
190
 
 
191
  foreach ( $entries as $entry ) {
192
 
193
  $row = Array();
207
  $row[] = $entry->get_admin_reply();
208
  $row[] = $entry->get_book_id();
209
 
210
+ $meta = '';
211
+ if ( function_exists( 'gwolle_gb_addon_get_meta' ) ) {
212
+ $meta = gwolle_gb_addon_get_meta( $entry->get_id(), '' );
213
+ $meta = serialize( $meta );
214
+ }
215
+ $row[] = $meta;
216
+
217
+ fputcsv($output, $row);
218
+
219
+ gwolle_gb_add_log_entry( $entry->get_id(), 'exported-to-csv' );
220
+
221
+ }
222
+
223
+ fclose($output);
224
+ die();
225
+ }
226
+
227
+ echo '(Gwolle-GB) Error, no entries.';
228
+ die();
229
+ }
230
+
231
+
232
+ /*
233
+ * Export entries for user
234
+ *
235
+ * @since 2.3.11
236
+ */
237
+ function gwolle_gb_export_postbox_user() {
238
+ ?>
239
+
240
+ <form name="gwolle_gb_export_user" id="gwolle_gb_export_user" method="POST" action="#" accept-charset="UTF-8">
241
+ <input type="hidden" name="gwolle_gb_page" value="gwolle_gb_export_user" />
242
+
243
+ <?php
244
+ /* Nonce */
245
+ $nonce = wp_create_nonce( 'gwolle_gb_page_export_user' );
246
+ echo '<input type="hidden" id="gwolle_gb_wpnonce" name="gwolle_gb_wpnonce" value="' . $nonce . '" />';
247
+
248
+ $count = gwolle_gb_get_entry_count( array( 'all' => 'all' ) );
249
+ if ( $count == 0 ) { ?>
250
+ <p><?php esc_html_e('No entries were found.', 'gwolle-gb'); ?></p><?php
251
+ } else {
252
+ ?>
253
+ <p><?php esc_html_e('Select one option below, either User ID or Email address', 'gwolle-gb'); ?></p>
254
+ <p>
255
+ <label for="gwolle_gb_user_id" class="text-info"><?php esc_html_e('User ID', 'gwolle-gb'); ?>:<br />
256
+ <input type="text" name="gwolle_gb_user_id" value="" placeholder="<?php esc_html_e('User ID', 'gwolle-gb'); ?>" />
257
+ </label><br />
258
+ <label for="gwolle_gb_user_email" class="text-info"><?php esc_html_e('User Email', 'gwolle-gb'); ?>:<br />
259
+ <input type="text" name="gwolle_gb_user_email" value="" placeholder="<?php esc_html_e('User Email', 'gwolle-gb'); ?>" />
260
+ </label>
261
+ </p>
262
+
263
+ <p>
264
+ <label for="start_export_user_enable" class="selectit">
265
+ <input id="start_export_user_enable" name="start_export_user_enable" type="checkbox" />
266
+ <?php esc_html_e('Export user entries from this website.', 'gwolle-gb'); ?>
267
+ </label>
268
+ </p>
269
+ <input name="gwolle_gb_start_export_user" id="gwolle_gb_start_export_user" type="submit" class="button" disabled value="<?php esc_attr_e('Start export', 'gwolle-gb'); ?>">
270
+ <?php
271
+ }
272
+ ?></form><?php
273
+ }
274
+
275
+
276
+ function gwolle_gb_export_user_action() {
277
+ if ( is_admin() ) {
278
+ if ( isset( $_POST['gwolle_gb_page']) && $_POST['gwolle_gb_page'] == 'gwolle_gb_export_user' ) {
279
+ gwolle_gb_export_user_callback();
280
+ }
281
+ }
282
+ }
283
+ 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
+
291
+ if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
292
+ echo 'error, no permission.';
293
+ die();
294
+ }
295
+
296
+ /* Check Nonce */
297
+ $verified = false;
298
+ if ( isset($_POST['gwolle_gb_wpnonce']) ) {
299
+ $verified = wp_verify_nonce( $_POST['gwolle_gb_wpnonce'], 'gwolle_gb_page_export_user' );
300
+ }
301
+ if ( $verified == false ) {
302
+ // Nonce is invalid.
303
+ esc_html_e('Nonce check failed. Please go back and try again.', 'gwolle-gb');
304
+ die();
305
+ }
306
+
307
+ if ( isset( $_POST['gwolle_gb_user_id']) && ( (int) $_POST['gwolle_gb_user_id'] > 0 ) ) {
308
+ $user_id = (int) $_POST['gwolle_gb_user_id'];
309
+ $entries = gwolle_gb_get_entries(array(
310
+ 'author_id' => $user_id,
311
+ 'num_entries' => -1,
312
+ 'all' => 'all'
313
+ ));
314
+ } else if ( isset( $_POST['gwolle_gb_user_email']) && strlen($_POST['gwolle_gb_user_email']) > 0 ) {
315
+ $user_id = $_POST['gwolle_gb_user_email'];
316
+ $entries = gwolle_gb_get_entries(array(
317
+ 'email' => $user_id,
318
+ 'num_entries' => -1,
319
+ 'all' => 'all'
320
+ ));
321
+ }
322
+
323
+ if ( is_array($entries) && ! empty($entries) ) {
324
+
325
+ // Clean everything before here
326
+ ob_end_clean();
327
+
328
+ // Output headers so that the file is downloaded rather than displayed
329
+ $filename = 'gwolle_gb_export_' . GWOLLE_GB_VER . '_' . date('Y-m-d_H-i') . '-user_' . $user_id . '.csv';
330
+ header( 'Content-Type: text/csv; charset=utf-8' );
331
+ header( 'Content-Disposition: attachment; filename=' . $filename );
332
+
333
+ // Create a file pointer connected to the output stream
334
+ $output = fopen('php://output', 'w');
335
+
336
+ // Output the column headings
337
+ fputcsv($output, array(
338
+ 'id',
339
+ 'author_name',
340
+ 'author_email',
341
+ 'author_origin',
342
+ 'author_website',
343
+ 'author_ip',
344
+ 'author_host',
345
+ 'content',
346
+ 'datetime',
347
+ 'isspam',
348
+ 'ischecked',
349
+ 'istrash',
350
+ 'admin_reply',
351
+ 'book_id',
352
+ 'meta_fields'
353
+ ));
354
+
355
+ foreach ( $entries as $entry ) {
356
+
357
+ $row = Array();
358
+
359
+ $row[] = $entry->get_id();
360
+ $row[] = addslashes($entry->get_author_name());
361
+ $row[] = addslashes($entry->get_author_email());
362
+ $row[] = addslashes($entry->get_author_origin());
363
+ $row[] = addslashes($entry->get_author_website());
364
+ $row[] = $entry->get_author_ip();
365
+ $row[] = $entry->get_author_host();
366
+ $row[] = addslashes($entry->get_content());
367
+ $row[] = $entry->get_datetime();
368
+ $row[] = $entry->get_isspam();
369
+ $row[] = $entry->get_ischecked();
370
+ $row[] = $entry->get_istrash();
371
+ $row[] = $entry->get_admin_reply();
372
+ $row[] = $entry->get_book_id();
373
+
374
+ $meta = '';
375
+ if ( function_exists( 'gwolle_gb_addon_get_meta' ) ) {
376
+ $meta = gwolle_gb_addon_get_meta( $entry->get_id(), '' );
377
+ $meta = serialize( $meta );
378
+ }
379
+ $row[] = $meta;
380
+
381
  fputcsv($output, $row);
382
 
383
  gwolle_gb_add_log_entry( $entry->get_id(), 'exported-to-csv' );
 
384
 
385
  }
386
 
admin/gb-page-gwolle-gb.php CHANGED
@@ -13,7 +13,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
13
  function gwolle_gb_welcome() {
14
 
15
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
16
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
17
  }
18
 
19
  /* Post Handling: Save notification setting */
@@ -160,7 +160,7 @@ function gwolle_gb_overview(){
160
  <div class="versions">
161
  <p>
162
  <?php
163
- $postid = gwolle_gb_get_postid();
164
  if ( $postid ) {
165
  $permalink = get_permalink( $postid );
166
  ?>
@@ -259,8 +259,9 @@ function gwolle_gb_overview_thanks() {
259
  echo '<h3>
260
  ' . esc_html__('This plugin uses the following scripts and services:', 'gwolle-gb') . '</h3>
261
  <ul class="ul-disc">
262
- <li><a href="http://akismet.com/tos/" target="_blank">' . esc_html__( 'Akismet', 'gwolle-gb' ) . '</a></li>
263
- <li><a href="http://markitup.jaysalvat.com/" target="_blank">' . esc_html__( 'MarkItUp', 'gwolle-gb' ) . '</a></li>
 
264
  <li><a href="https://wordpress.org/plugins/really-simple-captcha/" target="_blank">' . esc_html__( 'Really Simple CAPTCHA plugin', 'gwolle-gb' ) . '</a></li>
265
  <li><a href="http://supersimpleslider.com/" target="_blank">' . esc_html__( 'Super Simple Slider', 'gwolle-gb' ) . '</a></li>
266
  </ul>';
13
  function gwolle_gb_welcome() {
14
 
15
  if ( function_exists('current_user_can') && ! current_user_can('moderate_comments') ) {
16
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
17
  }
18
 
19
  /* Post Handling: Save notification setting */
160
  <div class="versions">
161
  <p>
162
  <?php
163
+ $postid = gwolle_gb_get_postid_biggest_book();
164
  if ( $postid ) {
165
  $permalink = get_permalink( $postid );
166
  ?>
259
  echo '<h3>
260
  ' . esc_html__('This plugin uses the following scripts and services:', 'gwolle-gb') . '</h3>
261
  <ul class="ul-disc">
262
+ <li><a href="https://akismet.com/tos/" target="_blank">' . esc_html__( 'Akismet', 'gwolle-gb' ) . '</a></li>
263
+ <li><a href="https://www.stopforumspam.com" target="_blank">' . esc_html__( 'Stop Forum Spam', 'gwolle-gb' ) . '</a></li>
264
+ <li><a href="https://markitup.jaysalvat.com/" target="_blank">' . esc_html__( 'MarkItUp', 'gwolle-gb' ) . '</a></li>
265
  <li><a href="https://wordpress.org/plugins/really-simple-captcha/" target="_blank">' . esc_html__( 'Really Simple CAPTCHA plugin', 'gwolle-gb' ) . '</a></li>
266
  <li><a href="http://supersimpleslider.com/" target="_blank">' . esc_html__( 'Super Simple Slider', 'gwolle-gb' ) . '</a></li>
267
  </ul>';
admin/gb-page-import.php CHANGED
@@ -19,7 +19,7 @@ function gwolle_gb_page_import() {
19
  gwolle_gb_admin_enqueue();
20
 
21
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
22
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
23
  }
24
 
25
  /* $_POST handling. */
@@ -566,7 +566,24 @@ function gwolle_gb_page_import_post() {
566
  'admin_reply',
567
  'book_id'
568
  );
569
- if ( $data != $testrow_1_0 && $data != $testrow_1_4_1 && $data != $testrow_1_4_8 && $data != $testrow_2_3_9 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  gwolle_gb_add_message( '<p>' . esc_html__('It seems your CSV file is from an export that is not compatible with this version of Gwolle-GB.', 'gwolle-gb') . '</p>', true, false);
571
  break;
572
  }
@@ -574,7 +591,7 @@ function gwolle_gb_page_import_post() {
574
  continue;
575
  }
576
 
577
- if ( $num != 12 && $num != 13 && $num != 14 ) {
578
  gwolle_gb_add_message( '<p>' . esc_html__('Your data seems to be corrupt. Import failed.', 'gwolle-gb') . '</p>', true, false);
579
  break;
580
  }
@@ -606,11 +623,23 @@ function gwolle_gb_page_import_post() {
606
  if ( isset( $data[13] ) ) {
607
  $entry->set_book_id( $data[13] ); // book_id is only since 2.3.9
608
  }
 
 
 
 
609
 
610
  /* Save the instance */
611
  $save = $entry->save();
612
  if ( $save ) {
613
  // We have been saved to the Database
 
 
 
 
 
 
 
 
614
  gwolle_gb_add_log_entry( $entry->get_id(), 'imported-from-gwolle' );
615
  $row++;
616
  } else {
19
  gwolle_gb_admin_enqueue();
20
 
21
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
22
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
23
  }
24
 
25
  /* $_POST handling. */
566
  'admin_reply',
567
  'book_id'
568
  );
569
+ $testrow_2_4_0 = array(
570
+ 'id',
571
+ 'author_name',
572
+ 'author_email',
573
+ 'author_origin',
574
+ 'author_website',
575
+ 'author_ip',
576
+ 'author_host',
577
+ 'content',
578
+ 'datetime',
579
+ 'isspam',
580
+ 'ischecked',
581
+ 'istrash',
582
+ 'admin_reply',
583
+ 'book_id',
584
+ 'meta_fields'
585
+ );
586
+ if ( $data != $testrow_1_0 && $data != $testrow_1_4_1 && $data != $testrow_1_4_8 && $data != $testrow_2_3_9 && $data != $testrow_2_4_0 ) {
587
  gwolle_gb_add_message( '<p>' . esc_html__('It seems your CSV file is from an export that is not compatible with this version of Gwolle-GB.', 'gwolle-gb') . '</p>', true, false);
588
  break;
589
  }
591
  continue;
592
  }
593
 
594
+ if ( $num != 12 && $num != 13 && $num != 14 && $num != 15 ) {
595
  gwolle_gb_add_message( '<p>' . esc_html__('Your data seems to be corrupt. Import failed.', 'gwolle-gb') . '</p>', true, false);
596
  break;
597
  }
623
  if ( isset( $data[13] ) ) {
624
  $entry->set_book_id( $data[13] ); // book_id is only since 2.3.9
625
  }
626
+ $metas = ''; // reset
627
+ if ( isset( $data[14] ) ) {
628
+ $metas = $data[14]; // meta fields is only since is only since 2.4.0
629
+ }
630
 
631
  /* Save the instance */
632
  $save = $entry->save();
633
  if ( $save ) {
634
  // We have been saved to the Database
635
+ if ( isset( $metas ) && function_exists( 'gwolle_gb_addon_save_meta' ) ) {
636
+ $metas = maybe_unserialize( $metas );
637
+ if ( ! empty( $metas ) ) {
638
+ foreach ( $metas as $meta ) {
639
+ gwolle_gb_addon_save_meta( $entry->get_id(), $meta['meta_key'], $meta['meta_value'] );
640
+ }
641
+ }
642
+ }
643
  gwolle_gb_add_log_entry( $entry->get_id(), 'imported-from-gwolle' );
644
  $row++;
645
  } else {
admin/gb-page-settings.php CHANGED
@@ -12,7 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  function gwolle_gb_page_settings() {
13
 
14
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
15
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
16
  }
17
 
18
  gwolle_gb_admin_enqueue();
@@ -77,6 +77,14 @@ function gwolle_gb_page_settings() {
77
  $saved = true;
78
  }
79
 
 
 
 
 
 
 
 
 
80
  $list = Array(
81
  'form_name_enabled',
82
  'form_name_mandatory',
@@ -90,7 +98,8 @@ function gwolle_gb_page_settings() {
90
  'form_message_mandatory',
91
  'form_bbcode_enabled',
92
  'form_antispam_enabled',
93
- 'form_recaptcha_enabled'
 
94
  );
95
  $form_setting = Array();
96
  foreach ( $list as $item ) {
12
  function gwolle_gb_page_settings() {
13
 
14
  if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
15
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
16
  }
17
 
18
  gwolle_gb_admin_enqueue();
77
  $saved = true;
78
  }
79
 
80
+ if (isset($_POST['store_ip']) && $_POST['store_ip'] == 'on') {
81
+ update_option('gwolle_gb-store_ip', 'true');
82
+ $saved = true;
83
+ } else {
84
+ update_option('gwolle_gb-store_ip', 'false');
85
+ $saved = true;
86
+ }
87
+
88
  $list = Array(
89
  'form_name_enabled',
90
  'form_name_mandatory',
98
  'form_message_mandatory',
99
  'form_bbcode_enabled',
100
  'form_antispam_enabled',
101
+ 'form_recaptcha_enabled',
102
+ 'form_privacy_enabled'
103
  );
104
  $form_setting = Array();
105
  foreach ( $list as $item ) {
admin/js/gwolle-gb-admin.js CHANGED
@@ -177,7 +177,7 @@ jQuery(document).ready(function($) {
177
 
178
 
179
  /*
180
- * Export Page
181
  */
182
  jQuery(document).ready(function($) {
183
 
@@ -242,3 +242,47 @@ jQuery(document).ready(function($) {
242
  }
243
 
244
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
 
179
  /*
180
+ * Export Page for all entries.
181
  */
182
  jQuery(document).ready(function($) {
183
 
242
  }
243
 
244
  });
245
+
246
+
247
+ /*
248
+ * Export Page for user ID / Email.
249
+ */
250
+ jQuery(document).ready(function($) {
251
+
252
+ /* Checking checkbox will enable the submit button */
253
+ jQuery("input#start_export_user_enable").prop("checked", false); // init
254
+
255
+ jQuery("input#start_export_user_enable").change(function() {
256
+ var checked = jQuery( "input#start_export_user_enable" ).prop('checked');
257
+ if ( checked == true ) {
258
+ jQuery("#gwolle_gb_start_export_user").addClass( 'button-primary' );
259
+ jQuery("#gwolle_gb_start_export_user").removeAttr('disabled');
260
+ } else {
261
+ jQuery("#gwolle_gb_start_export_user").removeClass( 'button-primary' );
262
+ jQuery("#gwolle_gb_start_export_user").attr('disabled', true);
263
+ }
264
+ });
265
+
266
+
267
+ /* Click Event, submit the form through AJAX and receive a CSV-file.
268
+ * Will request multi part files, every 5 seconds to be easy on the webserver.
269
+ */
270
+ jQuery( 'input#gwolle_gb_start_export_user' ).click(function(event) {
271
+
272
+ if ( jQuery("#gwolle_gb_start_export_user").attr('disabled') ) {
273
+ // Not sure if this block is needed... Just in case.
274
+ return;
275
+ }
276
+
277
+ var form = jQuery('form#gwolle_gb_export_user');
278
+ form.submit();
279
+
280
+ // Reset for to initial state.
281
+ jQuery( "#gwolle_gb_start_export_user" ).removeClass( 'button-primary' );
282
+ jQuery( "#gwolle_gb_start_export_user" ).attr( 'disabled', true );
283
+ jQuery( "input#start_export_user_enable" ).prop( 'checked', false );
284
+
285
+ event.preventDefault();
286
+ });
287
+
288
+ });
admin/tabs/gb-admintab.php CHANGED
@@ -12,7 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  function gwolle_gb_page_settingstab_admin() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_admin" />
12
  function gwolle_gb_page_settingstab_admin() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_admin" />
admin/tabs/gb-antispamtab.php CHANGED
@@ -12,7 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  function gwolle_gb_page_settingstab_antispam() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_antispam" />
@@ -135,7 +135,7 @@ function gwolle_gb_page_settingstab_antispam() {
135
  </th>
136
  <td>
137
  <span class="setting-description">
138
- <a href="http://akismet.com/" title="<?php esc_html_e('Learn more about Akismet...', 'gwolle-gb'); ?>" target="_blank">
139
  <?php esc_html_e("What's Akismet?", 'gwolle-gb'); ?>
140
  </a><br />
141
  <?php
12
  function gwolle_gb_page_settingstab_antispam() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_antispam" />
135
  </th>
136
  <td>
137
  <span class="setting-description">
138
+ <a href="https://akismet.com/" title="<?php esc_html_e('Learn more about Akismet...', 'gwolle-gb'); ?>" target="_blank">
139
  <?php esc_html_e("What's Akismet?", 'gwolle-gb'); ?>
140
  </a><br />
141
  <?php
admin/tabs/gb-debugtab.php CHANGED
@@ -14,7 +14,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
14
  function gwolle_gb_page_settingstab_debug( $debug_test ) {
15
 
16
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
17
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
18
  } ?>
19
 
20
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_debug" />
14
  function gwolle_gb_page_settingstab_debug( $debug_test ) {
15
 
16
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
17
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
18
  } ?>
19
 
20
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_debug" />
admin/tabs/gb-emailtab.php CHANGED
@@ -12,7 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  function gwolle_gb_page_settingstab_email() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_mail" />
12
  function gwolle_gb_page_settingstab_email() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_mail" />
admin/tabs/gb-formtab.php CHANGED
@@ -12,7 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  function gwolle_gb_page_settingstab_form() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_forms" />
@@ -111,6 +111,22 @@ We reserve the right to edit, delete, or not publish entries.
111
  </td>
112
  </tr>
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  </tbody>
115
  </table>
116
 
@@ -268,6 +284,21 @@ We reserve the right to edit, delete, or not publish entries.
268
  </td>
269
  </tr>
270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  <tr>
272
  <th colspan="3">
273
  <p class="submit">
12
  function gwolle_gb_page_settingstab_form() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_forms" />
111
  </td>
112
  </tr>
113
 
114
+ <tr valign="top">
115
+ <th scope="row"><label for="store_ip"><?php esc_html_e('Store IP Address', 'gwolle-gb'); ?></label></th>
116
+ <td>
117
+ <input type="checkbox" id="store_ip" name="store_ip" <?php
118
+ if ( get_option( 'gwolle_gb-store_ip', 'true' ) === 'true' ) {
119
+ echo 'checked="checked"';
120
+ }
121
+ ?> />
122
+ <label for="store_ip"><?php esc_html_e('Store IP Address and hostname for each entry.', 'gwolle-gb'); ?></label>
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
+
130
  </tbody>
131
  </table>
132
 
284
  </td>
285
  </tr>
286
 
287
+ <tr valign="top">
288
+ <th scope="row"><label for="form_privacy_enabled"><?php esc_html_e('Privacy checkbox', 'gwolle-gb'); ?>:</label></th>
289
+ <td>
290
+ <input type="checkbox" id="form_privacy_enabled" name="form_privacy_enabled"<?php
291
+ if ( isset($form_setting['form_privacy_enabled']) && $form_setting['form_privacy_enabled'] === 'true' ) {
292
+ echo ' checked="checked"';
293
+ }
294
+ ?> />
295
+ <label for="form_privacy_enabled"><?php esc_html_e('Enabled', 'gwolle-gb'); ?></label>
296
+ </td>
297
+ <td>
298
+ <?php esc_html_e('When enabled it is mandatory.', 'gwolle-gb'); ?>
299
+ </td>
300
+ </tr>
301
+
302
  <tr>
303
  <th colspan="3">
304
  <p class="submit">
admin/tabs/gb-readingtab.php CHANGED
@@ -12,7 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
12
  function gwolle_gb_page_settingstab_reading() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_reading" />
12
  function gwolle_gb_page_settingstab_reading() {
13
 
14
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
15
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
16
  } ?>
17
 
18
  <input type="hidden" id="gwolle_gb_tab" name="gwolle_gb_tab" value="gwolle_gb_reading" />
admin/tabs/gb-uninstalltab.php CHANGED
@@ -15,7 +15,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
15
  function gwolle_gb_page_settingstab_uninstall( $uninstalled ) {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
18
- die(esc_html__('Cheatin&#8217; uh?', 'gwolle-gb'));
19
  }
20
  if ( function_exists('is_multisite') && is_multisite() ) {
21
  return;
15
  function gwolle_gb_page_settingstab_uninstall( $uninstalled ) {
16
 
17
  if ( function_exists('current_user_can') && ! current_user_can('manage_options') ) {
18
+ die(esc_html__('You need a higher level of permission.', 'gwolle-gb'));
19
  }
20
  if ( function_exists('is_multisite') && is_multisite() ) {
21
  return;
docs/filters/gwolle_gb_entry_delete.txt ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_delete_entry"</b> filter is used to hook a function after an entry is deleted from the database.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_delete_entry', 'filter_function_name' ) ?></code>
10
+
11
+ Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
+
13
+ '''filter_function_name''' should be a unique function name. It cannot match any other function name already declared.
14
+
15
+
16
+ ==Examples==
17
+
18
+
19
+ function my_gwolle_gb_delete_entry( $entry_id ) {
20
+ // Do something
21
+ do_it();
22
+ }
23
+ add_action( 'gwolle_gb_delete_entry', 'my_gwolle_gb_delete_entry');
24
+
docs/filters/gwolle_gb_mail_author_body.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_mail_author_body"</b> filter is used to set the body for the notification email to the entry author.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_mail_author_body', 'filter_function_name' ) ?></code>
10
+
11
+ Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
+
13
+ '''filter_function_name''' should be a unique function name. It cannot match any other function name already declared.
14
+
15
+
16
+ ==Examples==
17
+
18
+
19
+ function my_gwolle_gb_mail_author_body( $body ) {
20
+ // this is the default;
21
+ $body = esc_html__("
22
+ Hello,
23
+
24
+ You have just posted a new guestbook entry at '%blog_name%'.
25
+
26
+ Have a nice day.
27
+ The editors at %blog_name%.
28
+
29
+
30
+ Website address: %blog_url%
31
+ User name: %user_name%
32
+ User email: %user_email%
33
+ Entry content:
34
+ %entry_content%
35
+ "
36
+ , 'gwolle-gb');
37
+
38
+ return $body;
39
+ }
40
+ add_filter( 'gwolle_gb_mail_author_body', 'my_gwolle_gb_mail_author_body', 10,1 );
41
+
docs/filters/gwolle_gb_mail_author_on_admin_reply_body.txt ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_mail_author_on_admin_reply_body"</b> filter is used to set the body for the notification email the author gets when an admin_reply has been added.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_mail_author_on_admin_reply_body', 'filter_function_name' ) ?></code>
10
+
11
+ Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
+
13
+ '''filter_function_name''' should be a unique function name. It cannot match any other function name already declared.
14
+
15
+
16
+ ==Examples==
17
+
18
+
19
+ function my_gwolle_gb_mail_author_on_admin_reply_body( $body ) {
20
+ // this is the default;
21
+ $body = esc_html__("
22
+ Hello,
23
+
24
+ An admin has just added or changed a reply message to your guestbook entry at '%blog_name%'.
25
+
26
+ Have a nice day.
27
+ The editors at %blog_name%.
28
+
29
+
30
+ Website address: %blog_url%
31
+ Admin Reply:
32
+ %admin_reply%
33
+
34
+
35
+ Original entry posted on %date%:
36
+ %entry_content%
37
+ "
38
+ , 'gwolle-gb');
39
+
40
+ return $body;
41
+ }
42
+ add_filter( 'gwolle_gb_mail_author_on_admin_reply_body', 'my_gwolle_gb_mail_author_on_admin_reply_body', 10,1 );
43
+
docs/filters/gwolle_gb_mail_author_on_admin_reply_subject.txt CHANGED
@@ -2,11 +2,11 @@
2
 
3
  ==Description==
4
 
5
- The <b>"gwolle_gb_mail_author_on_admin_reply"</b> filter is used to set the subject for the notification email the author gets when an admin_reply has been added.
6
 
7
  You can use this filter as:
8
 
9
- <code><?php add_filter( 'gwolle_gb_mail_author_on_admin_reply', 'filter_function_name' ) ?></code>
10
 
11
  Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
 
@@ -16,10 +16,10 @@ Where 'filter_function_name' is the function WordPress should call when the filt
16
  ==Examples==
17
 
18
 
19
- function my_gwolle_gb_mail_author_on_admin_reply( $subject ) {
20
  // this is the default;
21
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('Admin Reply', 'gwolle-gb');
22
  return $subject;
23
  }
24
- add_filter( 'gwolle_gb_mail_author_on_admin_reply', 'my_gwolle_gb_mail_author_on_admin_reply', 10,1 );
25
 
2
 
3
  ==Description==
4
 
5
+ The <b>"gwolle_gb_mail_author_on_admin_reply_subject"</b> filter is used to set the subject for the notification email the author gets when an admin_reply has been added.
6
 
7
  You can use this filter as:
8
 
9
+ <code><?php add_filter( 'gwolle_gb_mail_author_on_admin_reply_subject', 'filter_function_name' ) ?></code>
10
 
11
  Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
 
16
  ==Examples==
17
 
18
 
19
+ function my_gwolle_gb_mail_author_on_admin_reply_subject( $subject ) {
20
  // this is the default;
21
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('Admin Reply', 'gwolle-gb');
22
  return $subject;
23
  }
24
+ add_filter( 'gwolle_gb_mail_author_on_admin_reply_subject', 'my_gwolle_gb_mail_author_on_admin_reply_subject', 10,1 );
25
 
docs/filters/gwolle_gb_mail_author_subject.txt CHANGED
@@ -2,11 +2,11 @@
2
 
3
  ==Description==
4
 
5
- The <b>"gwolle_gb_mail_author"</b> filter is used to set the subject for the notification email to the entry author.
6
 
7
  You can use this filter as:
8
 
9
- <code><?php add_filter( 'gwolle_gb_mail_author', 'filter_function_name' ) ?></code>
10
 
11
  Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
 
@@ -16,10 +16,10 @@ Where 'filter_function_name' is the function WordPress should call when the filt
16
  ==Examples==
17
 
18
 
19
- function my_gwolle_gb_mail_author( $subject ) {
20
  // this is the default;
21
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
22
  return $subject;
23
  }
24
- add_filter( 'gwolle_gb_mail_author', 'my_gwolle_gb_mail_author', 10,1 );
25
 
2
 
3
  ==Description==
4
 
5
+ The <b>"gwolle_gb_mail_author_subject"</b> filter is used to set the subject for the notification email to the entry author.
6
 
7
  You can use this filter as:
8
 
9
+ <code><?php add_filter( 'gwolle_gb_mail_author_subject', 'filter_function_name' ) ?></code>
10
 
11
  Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
 
16
  ==Examples==
17
 
18
 
19
+ function my_gwolle_gb_mail_author_subject( $subject ) {
20
  // this is the default;
21
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
22
  return $subject;
23
  }
24
+ add_filter( 'gwolle_gb_mail_author_subject', 'my_gwolle_gb_mail_author_subject', 10,1 );
25
 
docs/filters/gwolle_gb_mail_moderator_body.txt ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_mail_moderators_body"</b> filter is used to set the body for the moderator notification email.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_mail_moderators_body', 'filter_function_name' ) ?></code>
10
+
11
+ Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
+
13
+ '''filter_function_name''' should be a unique function name. It cannot match any other function name already declared.
14
+
15
+
16
+ ==Examples==
17
+
18
+
19
+ function my_gwolle_gb_mail_moderators_body( $body ) {
20
+ // this is the default;
21
+ $body = esc_html__("
22
+ Hello,
23
+
24
+ There is a new guestbook entry at '%blog_name%'.
25
+ You can check it at %entry_management_url%.
26
+
27
+ Have a nice day.
28
+ Your Gwolle-GB-Mailer
29
+
30
+
31
+ Website address: %blog_url%
32
+ User name: %user_name%
33
+ User email: %user_email%
34
+ Entry status: %status%
35
+ Entry content:
36
+ %entry_content%
37
+ "
38
+ , 'gwolle-gb');
39
+
40
+ return $body;
41
+ }
42
+ add_filter( 'gwolle_gb_mail_moderators_body', 'my_gwolle_gb_mail_moderators_body', 10,1 );
43
+
docs/filters/gwolle_gb_privacy_label.txt ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_privacy_label"</b> filter is used to change the text of the label for the checkbox of the privacy policy at the frontend.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_privacy_label', 'filter_function_name' ) ?></code>
10
+
11
+ Where 'filter_function_name' is the function WordPress should call when the filter is being used.
12
+
13
+ '''filter_function_name''' should be a unique function name. It cannot match any other function name already declared.
14
+
15
+
16
+ ==Examples==
17
+
18
+
19
+ function my_gwolle_gb_privacy_label( $label ) {
20
+ // $label is a string
21
+ $label = 'test';
22
+ return $label;
23
+ }
24
+ add_filter( 'gwolle_gb_privacy_label', 'my_gwolle_gb_privacy_label', 10, 1 );
25
+
docs/import_example/gwolle_gb_export_2.2.1_2017-09-04_08-33-part_1_of_1.csv DELETED
@@ -1,3 +0,0 @@
1
- id,author_name,author_email,author_origin,author_website,author_ip,author_host,content,datetime,isspam,ischecked,istrash,admin_reply
2
- 13,You,test@example.com,Zwolle,http://example.com,127.0.0.1,example.com,"Testbericht, verwijder het als je dat wilt. 😄👍👌",1504521217,0,0,1,"Alleen maar een test"
3
- 12,You,test@example.com,Zwolle,http://example.com,127.0.0.1,example.com,"Testbericht, verwijder het als je dat wilt.",1504521217,0,0,1,"Alleen maar een test"
 
 
 
docs/import_example/gwolle_gb_export_2.3.10_2018-02-16_12-02-part_1_of_1.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ id,author_name,author_email,author_origin,author_website,author_ip,author_host,content,datetime,isspam,ischecked,istrash,admin_reply,book_id
2
+ 17,You,test@example.com,Zwolle,http://example.com,127.0.0.1,example.com,"Testbericht, verwijder het als je dat wilt. 😄👍👌",1518786116,0,0,1,"Alleen maar een test",1
3
+ 16,You,test@example.com,Zwolle,http://example.com,127.0.0.1,example.com,"Testbericht, verwijder het als je dat wilt.",1518786116,0,0,1,"Alleen maar een test",1
frontend/css/gwolle-gb-frontend.css CHANGED
@@ -87,24 +87,24 @@ body .gwolle-gb-content a {
87
  border: 1px solid #dd3d36;
88
  }
89
 
90
- #gwolle_gb .label,
91
- #gwolle_gb .input {
92
  vertical-align: top;
93
  }
94
- #gwolle_gb .label {
95
  width: 30%;
96
  }
97
  #gwolle_gb div.input {
98
  width: 40%;
99
  border: 0px;
100
  }
101
- #gwolle_gb .input input[type="text"],
102
- #gwolle_gb .input input[type="email"],
103
- #gwolle_gb .input input[type="url"],
104
- #gwolle_gb .input textarea {
105
  width: 100%;
106
  }
107
- #gwolle_gb .input textarea {
108
  height: 150px;
109
  }
110
  #gwolle_gb .clearBoth {
@@ -355,41 +355,54 @@ li.gwolle-gb-widget.ssslide {
355
 
356
 
357
  /* Form inside a widget */
358
- .widget .gwolle_gb_float .label,
359
- .widget .gwolle-gb-float .label,
360
- .widget .gwolle_gb_float .input,
361
- .widget .gwolle-gb-float .input,
362
- .widget-area .gwolle_gb_float .label,
363
- .widget-area .gwolle_gb_float .input {
364
  float: none;
365
  }
366
- .widget #gwolle_gb .label,
367
- .widget-area #gwolle_gb .label {
368
- width: 80%;
369
  }
370
- .widget #gwolle_gb .input,
371
- .widget-area #gwolle_gb .input {
372
- width: 80%;
373
  }
374
 
375
 
376
  /* Responsive Design */
377
 
378
  @media only screen and (max-width: 820px) {
379
- .gwolle_gb_float .label,
380
- .gwolle-gb-float .label,
381
- .gwolle_gb_float .input,
382
- .gwolle-gb-float .input {
383
  float: none;
384
  }
385
- #gwolle_gb .label {
386
  width: 80%;
387
  }
388
- #gwolle_gb .input {
389
  width: 80%;
390
  }
391
  }
392
-
 
 
 
 
 
 
 
 
 
 
 
 
 
393
 
394
  /* Add-On */
395
  div.gwolle-gb-starrating-result {
87
  border: 1px solid #dd3d36;
88
  }
89
 
90
+ #gwolle_gb div.label,
91
+ #gwolle_gb div.input {
92
  vertical-align: top;
93
  }
94
+ #gwolle_gb div.label {
95
  width: 30%;
96
  }
97
  #gwolle_gb div.input {
98
  width: 40%;
99
  border: 0px;
100
  }
101
+ #gwolle_gb div.input input[type="text"],
102
+ #gwolle_gb div.input input[type="email"],
103
+ #gwolle_gb div.input input[type="url"],
104
+ #gwolle_gb div.input textarea {
105
  width: 100%;
106
  }
107
+ #gwolle_gb div.input textarea {
108
  height: 150px;
109
  }
110
  #gwolle_gb .clearBoth {
355
 
356
 
357
  /* Form inside a widget */
358
+ .widget .gwolle_gb_float div.label,
359
+ .widget .gwolle-gb-float div.label,
360
+ .widget .gwolle_gb_float div.input,
361
+ .widget .gwolle-gb-float div.input,
362
+ .widget-area .gwolle_gb_float div.label,
363
+ .widget-area .gwolle_gb_float div.input {
364
  float: none;
365
  }
366
+ .widget #gwolle_gb div.label,
367
+ .widget-area #gwolle_gb div.label {
368
+ width: 100%;
369
  }
370
+ .widget #gwolle_gb div.input,
371
+ .widget-area #gwolle_gb div.input {
372
+ width: 100%;
373
  }
374
 
375
 
376
  /* Responsive Design */
377
 
378
  @media only screen and (max-width: 820px) {
379
+ .gwolle_gb_float div.label,
380
+ .gwolle-gb-float div.label,
381
+ .gwolle_gb_float div.input,
382
+ .gwolle-gb-float div.input {
383
  float: none;
384
  }
385
+ #gwolle_gb div.label {
386
  width: 80%;
387
  }
388
+ #gwolle_gb div.input {
389
  width: 80%;
390
  }
391
  }
392
+ @media only screen and (max-width: 620px) {
393
+ .gwolle_gb_float div.label,
394
+ .gwolle-gb-float div.label,
395
+ .gwolle_gb_float div.input,
396
+ .gwolle-gb-float div.input {
397
+ float: none;
398
+ }
399
+ #gwolle_gb div.label {
400
+ width: 100%;
401
+ }
402
+ #gwolle_gb div.input {
403
+ width: 100%;
404
+ }
405
+ }
406
 
407
  /* Add-On */
408
  div.gwolle-gb-starrating-result {
frontend/gb-form-posthandling.php CHANGED
@@ -194,6 +194,15 @@ function gwolle_gb_frontend_posthandling() {
194
  }
195
  }
196
 
 
 
 
 
 
 
 
 
 
197
 
198
  /* New Instance of gwolle_gb_entry. */
199
  $entry = new gwolle_gb_entry();
@@ -340,7 +349,8 @@ function gwolle_gb_frontend_posthandling() {
340
  * Network Information
341
  */
342
  $set_author_ip = apply_filters( 'gwolle_gb_set_author_ip', true );
343
- if ( $set_author_ip ) {
 
344
  $entry->set_author_ip( $_SERVER['REMOTE_ADDR'] );
345
  $entry->set_author_host( gethostbyaddr( $_SERVER['REMOTE_ADDR'] ) );
346
  }
194
  }
195
  }
196
 
197
+ /* Privacy checkbox for GDPR compliance. */
198
+ if ( isset($form_setting['form_privacy_enabled']) && $form_setting['form_privacy_enabled'] === 'true' ) {
199
+ if (isset($_POST['gwolle_gb_privacy']) && $_POST['gwolle_gb_privacy'] == 'on') {
200
+ // Should be fine.
201
+ } else {
202
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('You did not accept the privacy policy, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'privacy'); // mandatory
203
+ }
204
+ }
205
+
206
 
207
  /* New Instance of gwolle_gb_entry. */
208
  $entry = new gwolle_gb_entry();
349
  * Network Information
350
  */
351
  $set_author_ip = apply_filters( 'gwolle_gb_set_author_ip', true );
352
+ $set_author_ip2 = get_option('gwolle_gb-store_ip', 'true');
353
+ if ( $set_author_ip && ($set_author_ip2 == 'true') ) {
354
  $entry->set_author_ip( $_SERVER['REMOTE_ADDR'] );
355
  $entry->set_author_host( gethostbyaddr( $_SERVER['REMOTE_ADDR'] ) );
356
  }
frontend/gb-form.php CHANGED
@@ -435,13 +435,24 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
435
  $output .= ' />
436
  <input type="hidden" name="gwolle_gb_captcha_prefix" id="gwolle_gb_captcha_prefix" value="' . $gwolle_gb_captcha_prefix . '" />
437
  <span id="gwolle_gb_captcha_verify"></span>
438
- </div>
439
  </div>
440
- <div class="clearBoth">&nbsp;</div>';
 
441
  }
442
  }
443
  $output .= apply_filters( 'gwolle_gb_write_add_after_captcha', '' );
444
 
 
 
 
 
 
 
 
 
 
 
 
445
  /* Nonce */
446
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
447
  $nonce = wp_create_nonce( 'gwolle_gb_add_entry' );
435
  $output .= ' />
436
  <input type="hidden" name="gwolle_gb_captcha_prefix" id="gwolle_gb_captcha_prefix" value="' . $gwolle_gb_captcha_prefix . '" />
437
  <span id="gwolle_gb_captcha_verify"></span>
 
438
  </div>
439
+ </div>
440
+ <div class="clearBoth">&nbsp;</div>';
441
  }
442
  }
443
  $output .= apply_filters( 'gwolle_gb_write_add_after_captcha', '' );
444
 
445
+ /* Privacy checkbox for GDPR compliance. */
446
+ if ( isset($form_setting['form_privacy_enabled']) && $form_setting['form_privacy_enabled'] === 'true' ) {
447
+ $label = apply_filters( 'gwolle_gb_privacy_label', esc_html__('Accept Privacy Policy', 'gwolle-gb') );
448
+ $output .= '
449
+ <div class="gwolle_gb_privacy">
450
+ <div class="label"><label for="gwolle_gb_privacy" class="text-info">' . $label . ': *</label></div>
451
+ <div class="input"><input type="checkbox" name="gwolle_gb_privacy" id="gwolle_gb_privacy" required /></div>
452
+ </div>
453
+ <div class="clearBoth">&nbsp;</div>';
454
+ }
455
+
456
  /* Nonce */
457
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
458
  $nonce = wp_create_nonce( 'gwolle_gb_add_entry' );
frontend/gb-rss.php CHANGED
@@ -79,13 +79,14 @@ function gwolle_gb_rss() {
79
  $lastbuild = mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
80
  }
81
 
82
- $postid = gwolle_gb_get_postid();
83
- if ( $postid ) {
84
- $permalink = get_bloginfo('url') . '?p=' . $postid;
85
- } else {
86
- $permalink = get_bloginfo('url');
 
 
87
  }
88
-
89
  /* Get the Language setting */
90
  $WPLANG = get_option('WPLANG', false);
91
  if ( ! $WPLANG ) {
@@ -114,7 +115,7 @@ function gwolle_gb_rss() {
114
  <channel>
115
  <title><?php bloginfo_rss('name'); echo " - " . esc_html__('Guestbook Feed', 'gwolle-gb'); ?></title>
116
  <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
117
- <link><?php echo $permalink; ?></link>
118
  <description><?php bloginfo_rss('description'); echo " - " . esc_html__('Guestbook Feed', 'gwolle-gb'); ?></description>
119
  <lastBuildDate><?php echo $lastbuild; ?></lastBuildDate>
120
  <language><?php echo $WPLANG; ?></language>
@@ -125,15 +126,21 @@ function gwolle_gb_rss() {
125
  <?php
126
  if ( is_array($entries) && !empty($entries) ) {
127
  foreach ( $entries as $entry ) { ?>
 
128
  <item>
129
- <title>
130
- <?php esc_html_e('Guestbook Entry by', 'gwolle-gb'); echo " " . trim( $entry->get_author_name() ) . " (" . trim(date_i18n( get_option('date_format'), $entry->get_datetime() )) . " " . trim(date_i18n( get_option('time_format'), $entry->get_datetime() )) . ")"; ?>
131
- </title>
132
  <link><?php
133
- $permalink_entry = add_query_arg( 'entry_id', $entry->get_id(), $permalink );
134
- $permalink_entry = htmlspecialchars($permalink_entry, ENT_COMPAT, 'UTF-8');
135
- echo $permalink_entry; ?>
136
- </link>
 
 
 
 
 
 
 
137
  <pubDate><?php echo gmdate( 'D, d M Y H:i:s', $entry->get_datetime() ); ?></pubDate>
138
  <dc:creator><?php echo trim( $entry->get_author_name() ); ?></dc:creator>
139
  <guid isPermaLink="false"><?php echo $permalink; ?></guid>
@@ -141,10 +148,13 @@ function gwolle_gb_rss() {
141
  <content:encoded><![CDATA[<?php echo wp_trim_words( $entry->get_content(), 25, '...' ) ?>]]></content:encoded>
142
  <?php rss_enclosure(); ?>
143
  <?php do_action('rss2_item'); ?>
 
144
  </item>
 
145
  <?php
146
  }
147
  } ?>
 
148
  </channel>
149
  </rss>
150
  <?php
79
  $lastbuild = mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
80
  }
81
 
82
+ $blog_url = get_bloginfo('wpurl');
83
+ $biggest_book = gwolle_gb_get_postid_biggest_book();
84
+ if ( $biggest_book ) {
85
+ $permalink_biggest_book = get_permalink( $biggest_book );
86
+ }
87
+ if ( is_wp_error( $permalink_biggest_book ) ) {
88
+ $permalink_biggest_book = $blog_url . '?p=' . $biggest_book;
89
  }
 
90
  /* Get the Language setting */
91
  $WPLANG = get_option('WPLANG', false);
92
  if ( ! $WPLANG ) {
115
  <channel>
116
  <title><?php bloginfo_rss('name'); echo " - " . esc_html__('Guestbook Feed', 'gwolle-gb'); ?></title>
117
  <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
118
+ <link><?php echo $permalink_biggest_book; ?></link>
119
  <description><?php bloginfo_rss('description'); echo " - " . esc_html__('Guestbook Feed', 'gwolle-gb'); ?></description>
120
  <lastBuildDate><?php echo $lastbuild; ?></lastBuildDate>
121
  <language><?php echo $WPLANG; ?></language>
126
  <?php
127
  if ( is_array($entries) && !empty($entries) ) {
128
  foreach ( $entries as $entry ) { ?>
129
+
130
  <item>
131
+ <title><?php esc_html_e('Guestbook Entry by', 'gwolle-gb'); echo " " . trim( $entry->get_author_name() ) . " (" . trim(date_i18n( get_option('date_format'), $entry->get_datetime() )) . " " . trim(date_i18n( get_option('time_format'), $entry->get_datetime() )) . ")"; ?></title>
 
 
132
  <link><?php
133
+ $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
134
+ $permalink = $blog_url; // init for new entry.
135
+ if ( $postid ) {
136
+ $permalink = get_permalink( $postid );
137
+ }
138
+ if ( is_wp_error( $permalink ) ) {
139
+ $permalink = $blog_url . '?p=' . $postid;
140
+ }
141
+ $permalink = add_query_arg( 'entry_id', $entry->get_id(), $permalink );
142
+ $permalink = htmlspecialchars($permalink, ENT_COMPAT, 'UTF-8');
143
+ echo $permalink; ?></link>
144
  <pubDate><?php echo gmdate( 'D, d M Y H:i:s', $entry->get_datetime() ); ?></pubDate>
145
  <dc:creator><?php echo trim( $entry->get_author_name() ); ?></dc:creator>
146
  <guid isPermaLink="false"><?php echo $permalink; ?></guid>
148
  <content:encoded><![CDATA[<?php echo wp_trim_words( $entry->get_content(), 25, '...' ) ?>]]></content:encoded>
149
  <?php rss_enclosure(); ?>
150
  <?php do_action('rss2_item'); ?>
151
+
152
  </item>
153
+
154
  <?php
155
  }
156
  } ?>
157
+
158
  </channel>
159
  </rss>
160
  <?php
frontend/js/gwolle-gb-frontend.js CHANGED
@@ -144,7 +144,14 @@ jQuery(document).ready(function($) {
144
  jQuery('.gwolle_gb_form_ajax input').each(function( index, value ) {
145
  var val = jQuery( value ).val();
146
  var id = jQuery( value ).attr('id');
147
- gwolle_gb_ajax_data[id] = val;
 
 
 
 
 
 
 
148
  });
149
  jQuery('.gwolle_gb_form_ajax textarea').each(function( index, value ) {
150
  var val = jQuery( value ).val();
144
  jQuery('.gwolle_gb_form_ajax input').each(function( index, value ) {
145
  var val = jQuery( value ).val();
146
  var id = jQuery( value ).attr('id');
147
+ if ( id == 'gwolle_gb_privacy' ) {
148
+ var checked = jQuery('.gwolle_gb_form_ajax input#gwolle_gb_privacy').prop('checked');
149
+ if ( checked == true ) {
150
+ gwolle_gb_ajax_data[id] = 'on';
151
+ }
152
+ } else {
153
+ gwolle_gb_ajax_data[id] = val;
154
+ }
155
  });
156
  jQuery('.gwolle_gb_form_ajax textarea').each(function( index, value ) {
157
  var val = jQuery( value ).val();
functions/gb-class-entry.php CHANGED
@@ -627,8 +627,8 @@ class gwolle_gb_entry {
627
 
628
 
629
  if ($result == 1) {
630
- // Also remove the log entries
631
- gwolle_gb_del_log_entries( $id );
632
 
633
  return true;
634
  }
627
 
628
 
629
  if ($result == 1) {
630
+ // Also remove the log entries and possibly meta fields.
631
+ do_action( 'gwolle_gb_delete_entry', $id );
632
 
633
  return true;
634
  }
functions/gb-log.php CHANGED
@@ -246,5 +246,5 @@ function gwolle_gb_del_log_entries( $entry_id ) {
246
  return true;
247
  }
248
  return false;
249
-
250
  }
 
246
  return true;
247
  }
248
  return false;
 
249
  }
250
+ add_action( 'gwolle_gb_delete_entry', 'gwolle_gb_del_log_entries' );
functions/gb-mail.php CHANGED
@@ -13,8 +13,8 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
13
  /*
14
  * Send the Notification Mail to moderators that have subscribed (only when it is not Spam).
15
  *
16
- * $arg: $entry, instance of gwolle_gb_entry
17
- * since 1.4.9
18
  */
19
  function gwolle_gb_mail_moderators( $entry ) {
20
  $isspam = $entry->get_isspam();
@@ -36,8 +36,8 @@ function gwolle_gb_mail_moderators( $entry ) {
36
  // Set the Mail Content
37
  $mailTags = array( 'user_email', 'user_name', 'status', 'entry_management_url', 'blog_name', 'blog_url', 'wp_admin_url', 'entry_content', 'author_ip', 'author_origin' );
38
  $mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-adminMailContent', false ), 'setting_textarea' );
39
- if (!$mail_body) {
40
- $mail_body = esc_html__("
41
  Hello,
42
 
43
  There is a new guestbook entry at '%blog_name%'.
@@ -56,6 +56,7 @@ Entry content:
56
  "
57
  , 'gwolle-gb');
58
  }
 
59
 
60
  // Set the Mail Headers
61
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
@@ -130,8 +131,8 @@ add_action( 'gwolle_gb_save_entry_frontend', 'gwolle_gb_mail_moderators' );
130
  /*
131
  * Send Notification Mail to the author if set to true in an option (only when it is not Spam).
132
  *
133
- * $arg: $entry, instance of gwolle_gb_entry
134
- * since 1.4.9
135
  */
136
  function gwolle_gb_mail_author( $entry ) {
137
  $isspam = $entry->get_isspam();
@@ -141,8 +142,8 @@ function gwolle_gb_mail_author( $entry ) {
141
  // Set the Mail Content
142
  $mailTags = array('user_email', 'user_name', 'blog_name', 'blog_url', 'entry_content');
143
  $mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-authorMailContent', false ), 'setting_textarea' );
144
- if (!$mail_body) {
145
- $mail_body = esc_html__("
146
  Hello,
147
 
148
  You have just posted a new guestbook entry at '%blog_name%'.
@@ -159,6 +160,7 @@ Entry content:
159
  "
160
  , 'gwolle-gb');
161
  }
 
162
 
163
  // Set the Mail Headers
164
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
@@ -204,8 +206,8 @@ add_action( 'gwolle_gb_save_entry_frontend', 'gwolle_gb_mail_author' );
204
  /*
205
  * Send Notification Mail to the author that there is an admin_reply (only when it is not Spam).
206
  *
207
- * $arg: $entry, instance of gwolle_gb_entry
208
- * since 1.4.9
209
  */
210
  function gwolle_gb_mail_author_on_admin_reply( $entry ) {
211
  $isspam = $entry->get_isspam();
@@ -214,7 +216,7 @@ function gwolle_gb_mail_author_on_admin_reply( $entry ) {
214
  // Set the Mail Content
215
  $mailTags = array('user_email', 'user_name', 'blog_name', 'blog_url', 'admin_reply', 'entry_content', 'date');
216
  $mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-mail_admin_replyContent', false ), 'setting_textarea' );
217
- if (!$mail_body) {
218
  $mail_body = esc_html__("
219
  Hello,
220
 
@@ -234,6 +236,7 @@ Original entry posted on %date%:
234
  "
235
  , 'gwolle-gb');
236
  }
 
237
 
238
  // Set the Mail Headers
239
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('Admin Reply', 'gwolle-gb');
13
  /*
14
  * Send the Notification Mail to moderators that have subscribed (only when it is not Spam).
15
  *
16
+ * @arg: $entry, instance of gwolle_gb_entry
17
+ * @since 1.4.9
18
  */
19
  function gwolle_gb_mail_moderators( $entry ) {
20
  $isspam = $entry->get_isspam();
36
  // Set the Mail Content
37
  $mailTags = array( 'user_email', 'user_name', 'status', 'entry_management_url', 'blog_name', 'blog_url', 'wp_admin_url', 'entry_content', 'author_ip', 'author_origin' );
38
  $mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-adminMailContent', false ), 'setting_textarea' );
39
+ if ( ! $mail_body) {
40
+ $mail_body = esc_html__("
41
  Hello,
42
 
43
  There is a new guestbook entry at '%blog_name%'.
56
  "
57
  , 'gwolle-gb');
58
  }
59
+ $mail_body = apply_filters( 'gwolle_gb_mail_moderators_body', $mail_body );
60
 
61
  // Set the Mail Headers
62
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
131
  /*
132
  * Send Notification Mail to the author if set to true in an option (only when it is not Spam).
133
  *
134
+ * @arg: $entry, instance of gwolle_gb_entry
135
+ * @since 1.4.9
136
  */
137
  function gwolle_gb_mail_author( $entry ) {
138
  $isspam = $entry->get_isspam();
142
  // Set the Mail Content
143
  $mailTags = array('user_email', 'user_name', 'blog_name', 'blog_url', 'entry_content');
144
  $mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-authorMailContent', false ), 'setting_textarea' );
145
+ if ( ! $mail_body) {
146
+ $mail_body = esc_html__("
147
  Hello,
148
 
149
  You have just posted a new guestbook entry at '%blog_name%'.
160
  "
161
  , 'gwolle-gb');
162
  }
163
+ $mail_body = apply_filters( 'gwolle_gb_mail_author_body', $mail_body );
164
 
165
  // Set the Mail Headers
166
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
206
  /*
207
  * Send Notification Mail to the author that there is an admin_reply (only when it is not Spam).
208
  *
209
+ * @arg: $entry, instance of gwolle_gb_entry
210
+ * @since 1.4.9
211
  */
212
  function gwolle_gb_mail_author_on_admin_reply( $entry ) {
213
  $isspam = $entry->get_isspam();
216
  // Set the Mail Content
217
  $mailTags = array('user_email', 'user_name', 'blog_name', 'blog_url', 'admin_reply', 'entry_content', 'date');
218
  $mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-mail_admin_replyContent', false ), 'setting_textarea' );
219
+ if ( ! $mail_body) {
220
  $mail_body = esc_html__("
221
  Hello,
222
 
236
  "
237
  , 'gwolle-gb');
238
  }
239
+ $mail_body = apply_filters( 'gwolle_gb_mail_author_on_admin_reply_body', $mail_body );
240
 
241
  // Set the Mail Headers
242
  $subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('Admin Reply', 'gwolle-gb');
functions/gb-misc.php CHANGED
@@ -8,14 +8,17 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
8
 
9
 
10
  /*
11
- * Uses intermittent meta_key to determine the permalink. See functions/gb-post-meta.php and gwolle_gb_set_meta_keys().
12
- * return (int) postid if found, else 0.
 
 
 
13
  */
14
  function gwolle_gb_get_postid( $book_id = 1 ) {
15
 
16
  $the_query = new WP_Query( array(
17
  'post_type' => 'any',
18
- 'ignore_sticky_posts' => true,
19
  'meta_query' => array(
20
  array(
21
  'key' => 'gwolle_gb_read',
@@ -29,6 +32,7 @@ function gwolle_gb_get_postid( $book_id = 1 ) {
29
  'update_post_term_cache' => false,
30
  'update_post_meta_cache' => false
31
  ));
 
32
  if ( $the_query->have_posts() ) {
33
  while ( $the_query->have_posts() ) : $the_query->the_post();
34
  $postid = get_the_ID();
@@ -42,6 +46,100 @@ function gwolle_gb_get_postid( $book_id = 1 ) {
42
  }
43
 
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /*
46
  * Taken from wp-admin/includes/template.php touch_time()
47
  * Adapted for simplicity.
8
 
9
 
10
  /*
11
+ * Uses intermittent meta_key to determine the post ID. See functions/gb-post-meta.php and gwolle_gb_set_meta_keys().
12
+ *
13
+ * @param int book_id integer of the guestbook ID. Not required for backwards compatibility, but suggested to use the parameter.
14
+ *
15
+ * @return (int) postid if found, else 0.
16
  */
17
  function gwolle_gb_get_postid( $book_id = 1 ) {
18
 
19
  $the_query = new WP_Query( array(
20
  'post_type' => 'any',
21
+ 'ignore_sticky_posts' => true, // do not use sticky posts.
22
  'meta_query' => array(
23
  array(
24
  'key' => 'gwolle_gb_read',
32
  'update_post_term_cache' => false,
33
  'update_post_meta_cache' => false
34
  ));
35
+
36
  if ( $the_query->have_posts() ) {
37
  while ( $the_query->have_posts() ) : $the_query->the_post();
38
  $postid = get_the_ID();
46
  }
47
 
48
 
49
+ /*
50
+ * Uses intermittent meta_key to determine the post ID. See functions/gb-post-meta.php and gwolle_gb_set_meta_keys().
51
+ *
52
+ * @return int postid if found, else 0.
53
+ *
54
+ * @since 2.4.0
55
+ */
56
+ function gwolle_gb_get_postid_biggest_book() {
57
+
58
+ $postids = gwolle_gb_get_books();
59
+ if ( is_array($postids) && ! empty($postids) ) {
60
+
61
+ if ( count( $postids ) == 1 ) {
62
+ return $postids[0]; // just one guestbook, return it.
63
+ }
64
+
65
+ $books = array();
66
+ $totals = array();
67
+ foreach ( $postids as $postid ) {
68
+ $bookid = (int) get_post_meta( $postid, 'gwolle_gb_book_id', true );
69
+ if ( empty( $bookid ) ) {
70
+ continue;
71
+ }
72
+ $key = 'gwolle_gb_frontend_pagination_book_' . $bookid;
73
+ $entries_total = (int) get_transient( $key );
74
+ if ( false === $entries_total ) {
75
+ $entries_total = gwolle_gb_get_entry_count(
76
+ array(
77
+ 'checked' => 'checked',
78
+ 'trash' => 'notrash',
79
+ 'spam' => 'nospam',
80
+ 'book_id' => $bookid
81
+ )
82
+ );
83
+ set_transient( $key, $entries_total, DAY_IN_SECONDS );
84
+ }
85
+ $book = array();
86
+ $book['postid'] = $postid;
87
+ $book['bookid'] = $bookid;
88
+ $book['entries_total'] = $entries_total;
89
+ $books[] = $book;
90
+ $totals[] = $entries_total;
91
+ }
92
+
93
+ // First check what the biggest total is, then find the post_id that belongs to it.
94
+ rsort( $totals );
95
+
96
+ foreach ( $books as $book ) {
97
+ if ( $book['entries_total'] == $totals[0] ) {
98
+ return $book['postid'];
99
+ }
100
+ }
101
+ }
102
+
103
+ return 0;
104
+
105
+ }
106
+
107
+
108
+ /*
109
+ * Uses intermittent meta_key to determine the post IDs. See functions/gb-post-meta.php and gwolle_gb_set_meta_keys().
110
+ *
111
+ * @return array with post IDs that contain a guestbook.
112
+ *
113
+ * @since 2.4.0
114
+ */
115
+ function gwolle_gb_get_books() {
116
+
117
+ $the_query = new WP_Query( array(
118
+ 'post_type' => 'any',
119
+ 'ignore_sticky_posts' => true, // do not use sticky posts.
120
+ 'meta_query' => array(
121
+ array(
122
+ 'key' => 'gwolle_gb_read',
123
+ 'value' => 'true',
124
+ ),
125
+ ),
126
+ 'update_post_term_cache' => false,
127
+ 'update_post_meta_cache' => false
128
+ ));
129
+
130
+ $postids = array();
131
+ if ( $the_query->have_posts() ) {
132
+ while ( $the_query->have_posts() ) : $the_query->the_post();
133
+ $postids[] = get_the_ID();
134
+ endwhile;
135
+ wp_reset_postdata();
136
+ }
137
+
138
+ return $postids;
139
+
140
+ }
141
+
142
+
143
  /*
144
  * Taken from wp-admin/includes/template.php touch_time()
145
  * Adapted for simplicity.
functions/gb-post-meta.php CHANGED
@@ -81,6 +81,11 @@ function gwolle_gb_set_meta_keys( $shortcode, $shortcode_atts ) {
81
  if ( $meta_value_read != 'true' ) {
82
  update_post_meta( get_the_ID(), 'gwolle_gb_read', 'true' );
83
  }
 
 
 
 
 
84
  }
85
 
86
  $book_id = 1; // default
81
  if ( $meta_value_read != 'true' ) {
82
  update_post_meta( get_the_ID(), 'gwolle_gb_read', 'true' );
83
  }
84
+ if ( isset($shortcode_atts['entry_id']) && $shortcode_atts['entry_id'] > 0 ) {
85
+ // There is only one entry visible (no form), remove the book_id.
86
+ delete_post_meta( get_the_ID(), 'gwolle_gb_book_id' );
87
+ return;
88
+ }
89
  }
90
 
91
  $book_id = 1; // default
functions/gb-settings.php CHANGED
@@ -40,6 +40,7 @@ function gwolle_gb_register_settings() {
40
  register_setting( 'gwolle_gb_options', 'gwolle_gb-refuse-spam', 'strval' ); // 'false'
41
  register_setting( 'gwolle_gb_options', 'gwolle_gb-require_login', 'strval' ); // 'false'
42
  register_setting( 'gwolle_gb_options', 'gwolle_gb-sfs', 'strval' ); // 'false'
 
43
  register_setting( 'gwolle_gb_options', 'gwolle_gb-showEntryIcons', 'strval' ); // 'true'
44
  register_setting( 'gwolle_gb_options', 'gwolle_gb-showLineBreaks', 'strval' ); // 'false'
45
  register_setting( 'gwolle_gb_options', 'gwolle_gb-showSmilies', 'strval' ); // 'true'
@@ -76,7 +77,8 @@ function gwolle_gb_get_setting($request) {
76
  'form_message_mandatory' => 'true',
77
  'form_bbcode_enabled' => 'false',
78
  'form_antispam_enabled' => 'false',
79
- 'form_recaptcha_enabled' => 'false'
 
80
  );
81
  $setting = get_option( 'gwolle_gb-form', Array() );
82
  if ( is_string( $setting ) ) {
40
  register_setting( 'gwolle_gb_options', 'gwolle_gb-refuse-spam', 'strval' ); // 'false'
41
  register_setting( 'gwolle_gb_options', 'gwolle_gb-require_login', 'strval' ); // 'false'
42
  register_setting( 'gwolle_gb_options', 'gwolle_gb-sfs', 'strval' ); // 'false'
43
+ register_setting( 'gwolle_gb_options', 'gwolle_gb-store_ip', 'strval' ); // 'true'
44
  register_setting( 'gwolle_gb_options', 'gwolle_gb-showEntryIcons', 'strval' ); // 'true'
45
  register_setting( 'gwolle_gb_options', 'gwolle_gb-showLineBreaks', 'strval' ); // 'false'
46
  register_setting( 'gwolle_gb_options', 'gwolle_gb-showSmilies', 'strval' ); // 'true'
77
  'form_message_mandatory' => 'true',
78
  'form_bbcode_enabled' => 'false',
79
  'form_antispam_enabled' => 'false',
80
+ 'form_recaptcha_enabled' => 'false',
81
+ 'form_privacy_enabled' => 'false'
82
  );
83
  $setting = get_option( 'gwolle_gb-form', Array() );
84
  if ( is_string( $setting ) ) {
functions/gb-shortcake.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
-
3
-
4
- // No direct calls to this script
5
- if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
6
- die('No direct calls allowed!');
7
- }
8
-
9
-
10
- /*
11
- * Support Shortcode UI feature plugin.
12
- */
13
- function gwolle_gb_shortcode_ui() {
14
- if ( function_exists( 'shortcode_ui_register_for_shortcode' ) ) {
15
- if ( isset($_GET['post']) ) {
16
- $postid = (int) $_GET['post'];
17
- $description = sprintf( esc_html__( 'Book ID for when using multiple guestbooks. Default is 1. Your current post ID is %d.', 'gwolle-gb' ), $postid );
18
- } else {
19
- $description = esc_html__( 'Book ID for when using multiple guestbooks. Default is 1.', 'gwolle-gb' );
20
- }
21
-
22
- $ui_args = array(
23
- 'label' => esc_html__( 'Gwolle Guestbook', 'gwolle-gb' ),
24
- 'listItemImage' => 'dashicons-comments',
25
- 'attrs' => array(
26
- array(
27
- 'label' => esc_html__( 'Gwolle Guestbook', 'gwolle-gb' ),
28
- 'attr' => 'book_id',
29
- 'type' => 'number',
30
- 'description' => $description,
31
- ),
32
- ),
33
- );
34
- shortcode_ui_register_for_shortcode( 'gwolle_gb', $ui_args );
35
- }
36
- }
37
- add_action( 'init', 'gwolle_gb_shortcode_ui' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gwolle-gb.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Gwolle Guestbook
4
  Plugin URI: http://zenoweb.nl
5
  Description: Gwolle Guestbook is not just another guestbook for WordPress. The goal is to provide an easy and slim way to integrate a guestbook into your WordPress powered site. Don't use your 'comment' section the wrong way - install Gwolle Guestbook and have a real guestbook.
6
- Version: 2.3.10
7
  Author: Marcel Pol
8
  Author URI: http://zenoweb.nl
9
  License: GPLv2 or later
@@ -32,7 +32,7 @@ Domain Path: /lang/
32
 
33
 
34
  // Plugin Version
35
- define('GWOLLE_GB_VER', '2.3.10');
36
 
37
 
38
  /*
@@ -54,8 +54,8 @@ define('GWOLLE_GB_VER', '2.3.10');
54
  * - Add datetime WHERE clause in get_functions? Support filter for the function parameters inside the function?
55
  * - Think about a cancel button for the form:
56
  * https://wordpress.org/support/topic/missing-cancel-button-in-new-entry-from/
57
- *
58
- * 2.4.0:
59
  * - Add proper docblocks to filters in the code.
60
  * - Use GWOLLE_GB_URL where appropriate.
61
  * - Consider a functions/list-view.php refactoring.
@@ -134,7 +134,6 @@ include_once( GWOLLE_GB_DIR . '/functions/gb-metabox.php' );
134
  include_once( GWOLLE_GB_DIR . '/functions/gb-misc.php' );
135
  include_once( GWOLLE_GB_DIR . '/functions/gb-post-meta.php' );
136
  include_once( GWOLLE_GB_DIR . '/functions/gb-settings.php' );
137
- include_once( GWOLLE_GB_DIR . '/functions/gb-shortcake.php' );
138
  include_once( GWOLLE_GB_DIR . '/functions/gb-single-view.php' );
139
  include_once( GWOLLE_GB_DIR . '/functions/gb-stop-forum-spam.php' );
140
  include_once( GWOLLE_GB_DIR . '/functions/gb-user.php' );
3
  Plugin Name: Gwolle Guestbook
4
  Plugin URI: http://zenoweb.nl
5
  Description: Gwolle Guestbook is not just another guestbook for WordPress. The goal is to provide an easy and slim way to integrate a guestbook into your WordPress powered site. Don't use your 'comment' section the wrong way - install Gwolle Guestbook and have a real guestbook.
6
+ Version: 2.4.0
7
  Author: Marcel Pol
8
  Author URI: http://zenoweb.nl
9
  License: GPLv2 or later
32
 
33
 
34
  // Plugin Version
35
+ define('GWOLLE_GB_VER', '2.4.0');
36
 
37
 
38
  /*
54
  * - Add datetime WHERE clause in get_functions? Support filter for the function parameters inside the function?
55
  * - Think about a cancel button for the form:
56
  * https://wordpress.org/support/topic/missing-cancel-button-in-new-entry-from/
57
+ * Consider makeing the messages and the expanded form dismissible with an 'x' and a jQuery.slideUp().
58
+ * - Better support for aria attributes.
59
  * - Add proper docblocks to filters in the code.
60
  * - Use GWOLLE_GB_URL where appropriate.
61
  * - Consider a functions/list-view.php refactoring.
134
  include_once( GWOLLE_GB_DIR . '/functions/gb-misc.php' );
135
  include_once( GWOLLE_GB_DIR . '/functions/gb-post-meta.php' );
136
  include_once( GWOLLE_GB_DIR . '/functions/gb-settings.php' );
 
137
  include_once( GWOLLE_GB_DIR . '/functions/gb-single-view.php' );
138
  include_once( GWOLLE_GB_DIR . '/functions/gb-stop-forum-spam.php' );
139
  include_once( GWOLLE_GB_DIR . '/functions/gb-user.php' );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Gwolle, mpol
3
  Tags: guestbook, guest book, livre d'or, Gästebuch, libro de visitas
4
  Requires at least: 3.7
5
  Tested up to: 4.9
6
- Stable tag: 2.3.10
7
  License: GPLv2 or later
8
 
9
  Gwolle Guestbook is the WordPress guestbook you've just been looking for. Beautiful and easy.
@@ -85,6 +85,7 @@ Current features include:
85
  * Delete button in each entry for the moderator and author (optional).
86
  * Permalink button in each entry for easy access (optional).
87
  * Email button to contact each author (optional).
 
88
 
89
  You can buy the Add-On at [Mojo Marketplace](http://www.mojomarketplace.com/item/gwolle-gb-add-on) for only $ 9.
90
 
@@ -177,7 +178,8 @@ The header needs to look like this:
177
  'ischecked',
178
  'istrash',
179
  'admin_reply',
180
- 'book_id'
 
181
  )
182
  ?>
183
 
@@ -273,6 +275,12 @@ You can set the book_id automatically to the post_id with this shortcode:
273
 
274
  [gwolle_gb book_id="post_id"]
275
 
 
 
 
 
 
 
276
  = I don't see the labels in the form. =
277
 
278
  This plugin doesn't apply any CSS to the label elements. It is possible that your label elements have a white color on a white background.
@@ -374,7 +382,7 @@ First, this plugin is a guestbook. If you want to use it for a different usecase
374
  Take a look at the previous question about hooks.
375
  You are probably wanting to use the hooks for 'gwolle_gb_write' and 'gwolle_gb_button'.
376
 
377
- This question gets asked a lot. You can also take a look at the [support forum](https://wordpress.org/support/topic/change-button-text-20/).
378
 
379
  = Should I really not use WordPress comments for a guestbook? =
380
 
@@ -396,6 +404,26 @@ But if you don't use standard comments, you can just as easily use the comment s
396
 
397
  == Changelog ==
398
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  = 2.3.10 =
400
  * 2018-02-10
401
  * Small CSS update for login form.
3
  Tags: guestbook, guest book, livre d'or, Gästebuch, libro de visitas
4
  Requires at least: 3.7
5
  Tested up to: 4.9
6
+ Stable tag: 2.4.0
7
  License: GPLv2 or later
8
 
9
  Gwolle Guestbook is the WordPress guestbook you've just been looking for. Beautiful and easy.
85
  * Delete button in each entry for the moderator and author (optional).
86
  * Permalink button in each entry for easy access (optional).
87
  * Email button to contact each author (optional).
88
+ * Sitemap support for popular SEO/Sitemap plugins.
89
 
90
  You can buy the Add-On at [Mojo Marketplace](http://www.mojomarketplace.com/item/gwolle-gb-add-on) for only $ 9.
91
 
178
  'ischecked',
179
  'istrash',
180
  'admin_reply',
181
+ 'book_id',
182
+ 'meta_fields'
183
  )
184
  ?>
185
 
275
 
276
  [gwolle_gb book_id="post_id"]
277
 
278
+ = I only want to show one entry. =
279
+
280
+ You can use a shortcode parameter for showing just one entry:
281
+
282
+ [gwolle_gb_read entry_id="213"]
283
+
284
  = I don't see the labels in the form. =
285
 
286
  This plugin doesn't apply any CSS to the label elements. It is possible that your label elements have a white color on a white background.
382
  Take a look at the previous question about hooks.
383
  You are probably wanting to use the hooks for 'gwolle_gb_write' and 'gwolle_gb_button'.
384
 
385
+ This question gets asked a lot. You can also take a look at the [support forum](https://wordpress.org/support/topic/change-button-text-20/). Also, the add-on has options for text changes.
386
 
387
  = Should I really not use WordPress comments for a guestbook? =
388
 
404
 
405
  == Changelog ==
406
 
407
+ = 2.4.0 =
408
+ * 2018-03-25
409
+ * Add checkbox for privacy policy for GDPR compliance.
410
+ * Add option to store or not store IP Address and hostname.
411
+ * Add export for user based on ID or email.
412
+ * Add search on entries page for user based on ID or email.
413
+ * Support meta fields from the add-on in export/import (needs add-on > 1.1.0 ).
414
+ * Fix CSS for mobile form and form in widget.
415
+ * Remove book_id meta key when only one entry is shown.
416
+ * Fix warning on entries page when no entries.
417
+ * Add function 'gwolle_gb_get_postid_biggest_book'.
418
+ * Add function 'gwolle_gb_get_books'.
419
+ * Add hook 'gwolle_gb_delete_entry' when permanently deleting an entry.
420
+ * Delete log entries in that hook.
421
+ * Use correct URL in RSS feed.
422
+ * Add filters for email body.
423
+ * Fix docs for filters for email subject.
424
+ * Drop support for Shortcake feature plugin.
425
+ * Rephrase Cheating messages like WP Core.
426
+
427
  = 2.3.10 =
428
  * 2018-02-10
429
  * Small CSS update for login form.