Gwolle Guestbook - Version 2.4.1

Version Description

  • 2018-03-28
  • Improve features for anti-spam.
  • Add readmore link to admin reply excerpt.
  • More improvements to mobile CSS for the form.
  • Fix warning when sending mail to moderator.
Download this release

Release Info

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

Code changes from version 2.4.0 to 2.4.1

docs/import_example/gwolle_gb_export_2.3.10_2018-02-16_12-02-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,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
 
 
 
docs/import_example/gwolle_gb_export_2.4.0_2018-03-25_17-57-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,meta_fields
2
+ 19,You,test@example.com,Zwolle,http://example.com,127.0.0.1,example.com,"Testbericht, verwijder het als je dat wilt. 😄👍👌",1522007830,0,0,1,"Alleen maar een test",1,a:0:{}
3
+ 18,You,test@example.com,Zwolle,http://example.com,127.0.0.1,example.com,"Testbericht, verwijder het als je dat wilt.",1522007830,0,0,1,"Alleen maar een test",1,a:0:{}
frontend/css/gwolle-gb-frontend.css CHANGED
@@ -90,14 +90,16 @@ body .gwolle-gb-content a {
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"],
@@ -382,9 +384,9 @@ li.gwolle-gb-widget.ssslide {
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
  }
@@ -396,9 +398,9 @@ li.gwolle-gb-widget.ssslide {
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
  }
90
  #gwolle_gb div.label,
91
  #gwolle_gb div.input {
92
  vertical-align: top;
93
+ width: 80%;
94
  }
95
+ #gwolle_gb .gwolle-gb-float div.label {
96
+ width: 35%;
97
  }
98
+ #gwolle_gb .gwolle-gb-float div.input {
99
+ width: 50%;
100
  border: 0px;
101
  }
102
+
103
  #gwolle_gb div.input input[type="text"],
104
  #gwolle_gb div.input input[type="email"],
105
  #gwolle_gb div.input input[type="url"],
384
  .gwolle-gb-float div.input {
385
  float: none;
386
  }
387
+ #gwolle_gb .gwolle-gb-float div.label,
388
+ #gwolle_gb .gwolle-gb-float div.input,
389
+ #gwolle_gb div.label,
390
  #gwolle_gb div.input {
391
  width: 80%;
392
  }
398
  .gwolle-gb-float div.input {
399
  float: none;
400
  }
401
+ #gwolle_gb .gwolle-gb-float div.label,
402
+ #gwolle_gb .gwolle-gb-float div.input,
403
+ #gwolle_gb div.label,
404
  #gwolle_gb div.input {
405
  width: 100%;
406
  }
frontend/gb-form-posthandling.php CHANGED
@@ -50,56 +50,59 @@ function gwolle_gb_frontend_posthandling() {
50
 
51
  /* Name */
52
  if ( isset($form_setting['form_name_enabled']) && $form_setting['form_name_enabled'] === 'true' ) {
53
- if (isset($_POST['gwolle_gb_author_name'])) {
54
- $author_name = trim($_POST['gwolle_gb_author_name']);
 
55
  $author_name = gwolle_gb_maybe_encode_emoji( $author_name, 'author_name' );
56
  $gwolle_gb_formdata['author_name'] = $author_name;
57
  gwolle_gb_add_formdata( 'author_name', $author_name );
58
  if ( $author_name == "" ) {
59
  if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) {
60
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your name is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_name'); // mandatory
61
  }
62
  }
63
  } else {
64
  if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) {
65
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your name is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_name'); // mandatory
66
  }
67
  }
68
  }
69
 
70
  /* City / Origin */
71
  if ( isset($form_setting['form_city_enabled']) && $form_setting['form_city_enabled'] === 'true' ) {
72
- if (isset($_POST['gwolle_gb_author_origin'])) {
73
- $author_origin = trim($_POST['gwolle_gb_author_origin']);
 
74
  $author_origin = gwolle_gb_maybe_encode_emoji( $author_origin, 'author_origin' );
75
  $gwolle_gb_formdata['author_origin'] = $author_origin;
76
  gwolle_gb_add_formdata( 'author_origin', $author_origin );
77
  if ( $author_origin == "" ) {
78
  if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) {
79
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your origin is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_origin'); // mandatory
80
  }
81
  }
82
  } else {
83
  if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) {
84
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your origin is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_origin'); // mandatory
85
  }
86
  }
87
  }
88
 
89
  /* Email */
90
  if ( isset($form_setting['form_email_enabled']) && $form_setting['form_email_enabled'] === 'true' ) {
91
- if (isset($_POST['gwolle_gb_author_email'])) {
92
- $author_email = trim($_POST['gwolle_gb_author_email']);
 
93
  $gwolle_gb_formdata['author_email'] = $author_email;
94
  gwolle_gb_add_formdata( 'author_email', $author_email );
95
  if ( filter_var( $author_email, FILTER_VALIDATE_EMAIL ) ) {
96
  // Valid Email address.
97
  } else if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) {
98
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your e-mail address is not filled in correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_email'); // mandatory
99
  }
100
  } else {
101
  if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) {
102
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your e-mail address is not filled in correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_email'); // mandatory
103
  }
104
  }
105
  } else {
@@ -112,8 +115,9 @@ function gwolle_gb_frontend_posthandling() {
112
 
113
  /* Website / Homepage */
114
  if ( isset($form_setting['form_homepage_enabled']) && $form_setting['form_homepage_enabled'] === 'true' ) {
115
- if (isset($_POST['gwolle_gb_author_website'])) {
116
- $author_website = trim($_POST['gwolle_gb_author_website']);
 
117
  $gwolle_gb_formdata['author_website'] = $author_website;
118
  gwolle_gb_add_formdata( 'author_website', $author_website );
119
  $pattern = '/^http/';
@@ -123,22 +127,23 @@ function gwolle_gb_frontend_posthandling() {
123
  if ( filter_var( $author_website, FILTER_VALIDATE_URL ) ) {
124
  // Valid Website URL.
125
  } else if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) {
126
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your website is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_website'); // mandatory
127
  }
128
  } else {
129
  if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) {
130
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your website is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'author_website'); // mandatory
131
  }
132
  }
133
  }
134
 
135
  /* Message */
136
  if ( isset($form_setting['form_message_enabled']) && $form_setting['form_message_enabled'] === 'true' ) {
137
- if (isset($_POST['gwolle_gb_content'])) {
138
- $content = trim($_POST['gwolle_gb_content']);
 
139
  if ( $content == "" ) {
140
  if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) {
141
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('There is no message, even though it is mandatory.', 'gwolle-gb') . '</strong></p>',true, 'content'); // mandatory
142
  }
143
  } else {
144
  $content = gwolle_gb_maybe_encode_emoji( $content, 'content' );
@@ -147,7 +152,7 @@ function gwolle_gb_frontend_posthandling() {
147
  }
148
  } else {
149
  if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) {
150
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('There is no message, even though it is mandatory.', 'gwolle-gb') . '</strong></p>',true, 'content'); // mandatory
151
  }
152
  }
153
  }
@@ -161,7 +166,7 @@ function gwolle_gb_frontend_posthandling() {
161
  if ( isset($_POST['gwolle_gb_antispam_answer']) && trim($_POST['gwolle_gb_antispam_answer']) == trim($antispam_answer) ) {
162
  //echo "You got it!";
163
  } else {
164
- 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, 'antispam_answer'); // mandatory
165
  }
166
  }
167
  if ( isset($_POST['gwolle_gb_antispam_answer']) ) {
@@ -183,7 +188,7 @@ function gwolle_gb_frontend_posthandling() {
183
  $gwolle_gb_captcha_correct = $gwolle_gb_captcha->check( $gwolle_gb_captcha_prefix, $gwolle_gb_captcha_code );
184
  // If CAPTCHA validation fails (incorrect value entered in CAPTCHA field) mark comment as spam.
185
  if ( true != $gwolle_gb_captcha_correct ) {
186
- gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('The CAPTCHA was not filled in correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'captcha_code' );
187
  //gwolle_gb_add_message( '<p style="display_:none"><strong>' . $gwolle_gb_captcha_correct . '</strong></p>' );
188
  } else {
189
  // verified!
@@ -199,7 +204,7 @@ function gwolle_gb_frontend_posthandling() {
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
 
@@ -260,7 +265,8 @@ function gwolle_gb_frontend_posthandling() {
260
 
261
  /* Honeypot: check for spam and set accordingly */
262
  $marked_by_honeypot = false;
263
- if ( isset($_POST["gwolle_gb_subject"]) && strlen($_POST["gwolle_gb_subject"]) > 0 ) {
 
264
  // Input field was filled in, so considered spam
265
  $entry->set_isspam(true);
266
  $marked_by_honeypot = true;
@@ -275,7 +281,8 @@ function gwolle_gb_frontend_posthandling() {
275
  /* Nonce: check for spam and set accordingly */
276
  $marked_by_nonce = false;
277
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
278
- $verified = wp_verify_nonce( $_REQUEST['gwolle_gb_wpnonce'], 'gwolle_gb_add_entry' );
 
279
  if ( $verified == false ) {
280
  // Nonce is invalid, so considered spam
281
  $entry->set_isspam(true);
@@ -380,10 +387,11 @@ function gwolle_gb_frontend_posthandling() {
380
  'book_id' => $entry->get_book_id()
381
  ));
382
  if ( is_array( $entries ) && !empty( $entries ) ) {
 
383
  foreach ( $entries as $entry_email ) {
384
  if ( $entry_email->get_content() == $entry->get_content() ) {
385
  // Match is double entry
386
- gwolle_gb_add_message( '<p class="double_post gb-double-post"><strong>' . esc_html__('Double post: An entry with the data you entered has already been saved.', 'gwolle-gb') . '</strong></p>', true, 'content' );
387
  do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
388
  return false;
389
  }
50
 
51
  /* Name */
52
  if ( isset($form_setting['form_name_enabled']) && $form_setting['form_name_enabled'] === 'true' ) {
53
+ $field_name = gwolle_gb_get_field_name( 'name' );
54
+ if (isset($_POST[$field_name])) {
55
+ $author_name = trim($_POST[$field_name]);
56
  $author_name = gwolle_gb_maybe_encode_emoji( $author_name, 'author_name' );
57
  $gwolle_gb_formdata['author_name'] = $author_name;
58
  gwolle_gb_add_formdata( 'author_name', $author_name );
59
  if ( $author_name == "" ) {
60
  if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) {
61
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your name is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
62
  }
63
  }
64
  } else {
65
  if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) {
66
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your name is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
67
  }
68
  }
69
  }
70
 
71
  /* City / Origin */
72
  if ( isset($form_setting['form_city_enabled']) && $form_setting['form_city_enabled'] === 'true' ) {
73
+ $field_name = gwolle_gb_get_field_name( 'city' );
74
+ if (isset($_POST[$field_name])) {
75
+ $author_origin = trim($_POST[$field_name]);
76
  $author_origin = gwolle_gb_maybe_encode_emoji( $author_origin, 'author_origin' );
77
  $gwolle_gb_formdata['author_origin'] = $author_origin;
78
  gwolle_gb_add_formdata( 'author_origin', $author_origin );
79
  if ( $author_origin == "" ) {
80
  if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) {
81
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your origin is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
82
  }
83
  }
84
  } else {
85
  if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) {
86
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your origin is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
87
  }
88
  }
89
  }
90
 
91
  /* Email */
92
  if ( isset($form_setting['form_email_enabled']) && $form_setting['form_email_enabled'] === 'true' ) {
93
+ $field_name = gwolle_gb_get_field_name( 'email' );
94
+ if (isset($_POST[$field_name])) {
95
+ $author_email = trim($_POST[$field_name]);
96
  $gwolle_gb_formdata['author_email'] = $author_email;
97
  gwolle_gb_add_formdata( 'author_email', $author_email );
98
  if ( filter_var( $author_email, FILTER_VALIDATE_EMAIL ) ) {
99
  // Valid Email address.
100
  } else if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) {
101
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your e-mail address is not filled in correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
102
  }
103
  } else {
104
  if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) {
105
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your e-mail address is not filled in correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
106
  }
107
  }
108
  } else {
115
 
116
  /* Website / Homepage */
117
  if ( isset($form_setting['form_homepage_enabled']) && $form_setting['form_homepage_enabled'] === 'true' ) {
118
+ $field_name = gwolle_gb_get_field_name( 'website' );
119
+ if (isset($_POST[$field_name])) {
120
+ $author_website = trim($_POST[$field_name]);
121
  $gwolle_gb_formdata['author_website'] = $author_website;
122
  gwolle_gb_add_formdata( 'author_website', $author_website );
123
  $pattern = '/^http/';
127
  if ( filter_var( $author_website, FILTER_VALIDATE_URL ) ) {
128
  // Valid Website URL.
129
  } else if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) {
130
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your website is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
131
  }
132
  } else {
133
  if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) {
134
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('Your website is not filled in, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, $field_name); // mandatory
135
  }
136
  }
137
  }
138
 
139
  /* Message */
140
  if ( isset($form_setting['form_message_enabled']) && $form_setting['form_message_enabled'] === 'true' ) {
141
+ $field_name = gwolle_gb_get_field_name( 'content' );
142
+ if (isset($_POST[$field_name])) {
143
+ $content = trim($_POST[$field_name]);
144
  if ( $content == "" ) {
145
  if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) {
146
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('There is no message, even though it is mandatory.', 'gwolle-gb') . '</strong></p>',true, $field_name); // mandatory
147
  }
148
  } else {
149
  $content = gwolle_gb_maybe_encode_emoji( $content, 'content' );
152
  }
153
  } else {
154
  if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) {
155
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('There is no message, even though it is mandatory.', 'gwolle-gb') . '</strong></p>',true, $field_name); // mandatory
156
  }
157
  }
158
  }
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']) ) {
188
  $gwolle_gb_captcha_correct = $gwolle_gb_captcha->check( $gwolle_gb_captcha_prefix, $gwolle_gb_captcha_code );
189
  // If CAPTCHA validation fails (incorrect value entered in CAPTCHA field) mark comment as spam.
190
  if ( true != $gwolle_gb_captcha_correct ) {
191
+ gwolle_gb_add_message( '<p class="error_fields gb-error-fields"><strong>' . esc_html__('The CAPTCHA was not filled in correctly, even though it is mandatory.', 'gwolle-gb') . '</strong></p>', true, 'gwolle_gb_captcha_code' );
192
  //gwolle_gb_add_message( '<p style="display_:none"><strong>' . $gwolle_gb_captcha_correct . '</strong></p>' );
193
  } else {
194
  // verified!
204
  if (isset($_POST['gwolle_gb_privacy']) && $_POST['gwolle_gb_privacy'] == 'on') {
205
  // Should be fine.
206
  } else {
207
+ 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, 'gwolle_gb_privacy'); // mandatory
208
  }
209
  }
210
 
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);
272
  $marked_by_honeypot = true;
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' );
285
+ $verified = wp_verify_nonce( $_REQUEST[$field_name], 'gwolle_gb_add_entry' );
286
  if ( $verified == false ) {
287
  // Nonce is invalid, so considered spam
288
  $entry->set_isspam(true);
387
  'book_id' => $entry->get_book_id()
388
  ));
389
  if ( is_array( $entries ) && !empty( $entries ) ) {
390
+ $field_name = gwolle_gb_get_field_name( 'content' );
391
  foreach ( $entries as $entry_email ) {
392
  if ( $entry_email->get_content() == $entry->get_content() ) {
393
  // Match is double entry
394
+ gwolle_gb_add_message( '<p class="double_post gb-double-post"><strong>' . esc_html__('Double post: An entry with the data you entered has already been saved.', 'gwolle-gb') . '</strong></p>', true, $field_name );
395
  do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
396
  return false;
397
  }
frontend/gb-form.php CHANGED
@@ -161,17 +161,18 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
161
 
162
  /* Name */
163
  if ( isset($form_setting['form_name_enabled']) && $form_setting['form_name_enabled'] === 'true' ) {
 
164
  $label = apply_filters( 'gwolle_gb_author_name_label', esc_html__('Name', 'gwolle-gb') );
165
- $output .= '<div class="gwolle_gb_author_name">
166
- <div class="label"><label for="gwolle_gb_author_name" class="text-info">' . $label . ':';
167
  if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) { $output .= ' *';}
168
  $output .= '</label></div>
169
  <div class="input"><input class="wp-exclude-emoji ';
170
- if (in_array('author_name', $gwolle_gb_error_fields)) {
171
  $output .= ' error';
172
  }
173
- $output .= '" value="' . $name . '" type="text" name="gwolle_gb_author_name" id="gwolle_gb_author_name" placeholder="' . $label . '"';
174
- if ( in_array('author_name', $gwolle_gb_error_fields) && isset($autofocus) ) {
175
  $output .= $autofocus;
176
  $autofocus = false; // disable it for the next error.
177
  }
@@ -187,17 +188,18 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
187
 
188
  /* City / Origin */
189
  if ( isset($form_setting['form_city_enabled']) && $form_setting['form_city_enabled'] === 'true' ) {
 
190
  $label = apply_filters( 'gwolle_gb_author_origin_label', esc_html__('City', 'gwolle-gb') );
191
- $output .= '<div class="gwolle_gb_author_origin">
192
- <div class="label"><label for="gwolle_gb_author_origin" class="text-info">' . $label . ':';
193
  if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) { $output .= ' *';}
194
  $output .= '</label></div>
195
  <div class="input"><input class="wp-exclude-emoji ';
196
- if (in_array('author_origin', $gwolle_gb_error_fields)) {
197
  $output .= ' error';
198
  }
199
- $output .= '" value="' . $origin . '" type="text" name="gwolle_gb_author_origin" id="gwolle_gb_author_origin" placeholder="' . $label . '"';
200
- if ( in_array('author_origin', $gwolle_gb_error_fields) && isset($autofocus) ) {
201
  $output .= $autofocus;
202
  $autofocus = false; // disable it for the next error.
203
  }
@@ -212,17 +214,18 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
212
 
213
  /* Email */
214
  if ( isset($form_setting['form_email_enabled']) && $form_setting['form_email_enabled'] === 'true' ) {
 
215
  $label = apply_filters( 'gwolle_gb_author_email_label', esc_html__('Email', 'gwolle-gb') );
216
- $output .= '<div class="gwolle_gb_author_email">
217
- <div class="label"><label for="gwolle_gb_author_email" class="text-info">' . $label . ':';
218
  if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) { $output .= ' *';}
219
  $output .= '</label></div>
220
  <div class="input"><input class="';
221
- if (in_array('author_email', $gwolle_gb_error_fields)) {
222
  $output .= ' error';
223
  }
224
- $output .= '" value="' . $email . '" ' . ($html5 ? 'type="email"' : 'type="text"') . ' name="gwolle_gb_author_email" id="gwolle_gb_author_email" placeholder="' . $label . '" ';
225
- if ( in_array('author_email', $gwolle_gb_error_fields) && isset($autofocus) ) {
226
  $output .= $autofocus;
227
  $autofocus = false; // disable it for the next error.
228
  }
@@ -242,17 +245,18 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
242
 
243
  /* Website / Homepage */
244
  if ( isset($form_setting['form_homepage_enabled']) && $form_setting['form_homepage_enabled'] === 'true' ) {
 
245
  $label = apply_filters( 'gwolle_gb_author_website_label', esc_html__('Website', 'gwolle-gb') );
246
- $output .= '<div class="gwolle_gb_author_website">
247
- <div class="label"><label for="gwolle_gb_author_website" class="text-info">' . $label . ':';
248
  if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) { $output .= ' *';}
249
  $output .= '</label></div>
250
  <div class="input"><input class="';
251
- if (in_array('author_website', $gwolle_gb_error_fields)) {
252
  $output .= ' error';
253
  }
254
- $output .= '" value="' . $website . '" ' . ($html5 ? 'type="url"' : 'type="text"') . ' name="gwolle_gb_author_website" id="gwolle_gb_author_website" placeholder="' . $label . '" ';
255
- if ( in_array('author_website', $gwolle_gb_error_fields) && isset($autofocus) ) {
256
  $output .= $autofocus;
257
  $autofocus = false; // disable it for the next error.
258
  }
@@ -268,12 +272,13 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
268
 
269
  /* Honeypot */
270
  if (get_option( 'gwolle_gb-honeypot', 'true') == 'true') {
 
271
  $output .= '
272
- <div class="gwolle_gb_subject" style="display:none;">
273
- <div class="label"><label for="gwolle_gb_subject" class="text-primary">' . esc_html__('Do not fill this in', 'gwolle-gb') . ':
274
  </label></div>
275
  <div class="input">
276
- <input value="" type="text" name="gwolle_gb_subject" id="gwolle_gb_subject" placeholder="" />
277
  </div>
278
  </div>
279
  <div class="clearBoth"></div>';
@@ -281,13 +286,14 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
281
 
282
  /* Content */
283
  if ( isset($form_setting['form_message_enabled']) && $form_setting['form_message_enabled'] === 'true' ) {
 
284
  $label = apply_filters( 'gwolle_gb_content_label', esc_html__('Guestbook entry', 'gwolle-gb') );
285
  $output .= '<div class="gwolle_gb_content">
286
  <div class="label"><label for="gwolle_gb_content" class="text-info">' . $label . ':';
287
  if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) { $output .= ' *';}
288
  $output .= '</label></div>
289
  <div class="input"><textarea name="gwolle_gb_content" id="gwolle_gb_content" class="wp-exclude-emoji ';
290
- if (in_array('content', $gwolle_gb_error_fields)) {
291
  $output .= ' error';
292
  }
293
  $output .= '" placeholder="' . $label . '" ';
@@ -348,11 +354,11 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
348
  ' . esc_html__('Question:', 'gwolle-gb') . ' ' . $antispam_question . '</label>
349
  </div>
350
  <div class="input"><input class="';
351
- if (in_array('antispam_answer', $gwolle_gb_error_fields)) {
352
  $output .= ' error';
353
  }
354
  $output .= '" value="' . $antispam . '" type="text" name="gwolle_gb_antispam_answer" id="gwolle_gb_antispam_answer" placeholder="' . esc_attr__('Answer', 'gwolle-gb') . '" ';
355
- if ( in_array('antispam_answer', $gwolle_gb_error_fields) && isset($autofocus) ) {
356
  $output .= $autofocus;
357
  $autofocus = false; // disable it for the next error.
358
  }
@@ -423,11 +429,11 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
423
  </div>
424
  <div class="input">
425
  <input class="';
426
- if (in_array('captcha_code', $gwolle_gb_error_fields)) {
427
  $output .= 'error';
428
  }
429
  $output .= '" value="" type="text" name="gwolle_gb_captcha_code" id="gwolle_gb_captcha_code" placeholder="' . esc_attr__('CAPTCHA', 'gwolle-gb') . '" ';
430
- if ( in_array('captcha_code', $gwolle_gb_error_fields) && isset($autofocus) ) {
431
  $output .= $autofocus;
432
  $autofocus = false; // disable it for the next error.
433
  }
@@ -455,8 +461,9 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
455
 
456
  /* Nonce */
457
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
 
458
  $nonce = wp_create_nonce( 'gwolle_gb_add_entry' );
459
- $output .= '<input type="hidden" id="gwolle_gb_wpnonce" name="gwolle_gb_wpnonce" value="' . $nonce . '" />';
460
  }
461
 
462
  /* Use this filter to just add something */
161
 
162
  /* Name */
163
  if ( isset($form_setting['form_name_enabled']) && $form_setting['form_name_enabled'] === 'true' ) {
164
+ $field_name = gwolle_gb_get_field_name( 'name' );
165
  $label = apply_filters( 'gwolle_gb_author_name_label', esc_html__('Name', 'gwolle-gb') );
166
+ $output .= '<div class="' . $field_name . '">
167
+ <div class="label"><label for="' . $field_name . '" class="text-info">' . $label . ':';
168
  if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) { $output .= ' *';}
169
  $output .= '</label></div>
170
  <div class="input"><input class="wp-exclude-emoji ';
171
+ if (in_array($field_name, $gwolle_gb_error_fields)) {
172
  $output .= ' error';
173
  }
174
+ $output .= '" value="' . $name . '" type="text" name="' . $field_name . '" id="' . $field_name . '" placeholder="' . $label . '"';
175
+ if ( in_array($field_name, $gwolle_gb_error_fields) && isset($autofocus) ) {
176
  $output .= $autofocus;
177
  $autofocus = false; // disable it for the next error.
178
  }
188
 
189
  /* City / Origin */
190
  if ( isset($form_setting['form_city_enabled']) && $form_setting['form_city_enabled'] === 'true' ) {
191
+ $field_name = gwolle_gb_get_field_name( 'city' );
192
  $label = apply_filters( 'gwolle_gb_author_origin_label', esc_html__('City', 'gwolle-gb') );
193
+ $output .= '<div class="' . $field_name . '">
194
+ <div class="label"><label for="' . $field_name . '" class="text-info">' . $label . ':';
195
  if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) { $output .= ' *';}
196
  $output .= '</label></div>
197
  <div class="input"><input class="wp-exclude-emoji ';
198
+ if (in_array($field_name, $gwolle_gb_error_fields)) {
199
  $output .= ' error';
200
  }
201
+ $output .= '" value="' . $origin . '" type="text" name="' . $field_name . '" id="' . $field_name . '" placeholder="' . $label . '"';
202
+ if ( in_array($field_name, $gwolle_gb_error_fields) && isset($autofocus) ) {
203
  $output .= $autofocus;
204
  $autofocus = false; // disable it for the next error.
205
  }
214
 
215
  /* Email */
216
  if ( isset($form_setting['form_email_enabled']) && $form_setting['form_email_enabled'] === 'true' ) {
217
+ $field_name = gwolle_gb_get_field_name( 'email' );
218
  $label = apply_filters( 'gwolle_gb_author_email_label', esc_html__('Email', 'gwolle-gb') );
219
+ $output .= '<div class="' . $field_name . '">
220
+ <div class="label"><label for="' . $field_name . '" class="text-info">' . $label . ':';
221
  if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) { $output .= ' *';}
222
  $output .= '</label></div>
223
  <div class="input"><input class="';
224
+ if (in_array($field_name, $gwolle_gb_error_fields)) {
225
  $output .= ' error';
226
  }
227
+ $output .= '" value="' . $email . '" ' . ($html5 ? 'type="email"' : 'type="text"') . ' name="' . $field_name . '" id="' . $field_name . '" placeholder="' . $label . '" ';
228
+ if ( in_array($field_name, $gwolle_gb_error_fields) && isset($autofocus) ) {
229
  $output .= $autofocus;
230
  $autofocus = false; // disable it for the next error.
231
  }
245
 
246
  /* Website / Homepage */
247
  if ( isset($form_setting['form_homepage_enabled']) && $form_setting['form_homepage_enabled'] === 'true' ) {
248
+ $field_name = gwolle_gb_get_field_name( 'website' );
249
  $label = apply_filters( 'gwolle_gb_author_website_label', esc_html__('Website', 'gwolle-gb') );
250
+ $output .= '<div class="' . $field_name . '">
251
+ <div class="label"><label for="' . $field_name . '" class="text-info">' . $label . ':';
252
  if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) { $output .= ' *';}
253
  $output .= '</label></div>
254
  <div class="input"><input class="';
255
+ if (in_array($field_name, $gwolle_gb_error_fields)) {
256
  $output .= ' error';
257
  }
258
+ $output .= '" value="' . $website . '" ' . ($html5 ? 'type="url"' : 'type="text"') . ' name="' . $field_name . '" id="' . $field_name . '" placeholder="' . $label . '" ';
259
+ if ( in_array($field_name, $gwolle_gb_error_fields) && isset($autofocus) ) {
260
  $output .= $autofocus;
261
  $autofocus = false; // disable it for the next error.
262
  }
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>';
286
 
287
  /* Content */
288
  if ( isset($form_setting['form_message_enabled']) && $form_setting['form_message_enabled'] === 'true' ) {
289
+ $field_name = gwolle_gb_get_field_name( 'content' );
290
  $label = apply_filters( 'gwolle_gb_content_label', esc_html__('Guestbook entry', 'gwolle-gb') );
291
  $output .= '<div class="gwolle_gb_content">
292
  <div class="label"><label for="gwolle_gb_content" class="text-info">' . $label . ':';
293
  if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) { $output .= ' *';}
294
  $output .= '</label></div>
295
  <div class="input"><textarea name="gwolle_gb_content" id="gwolle_gb_content" class="wp-exclude-emoji ';
296
+ if (in_array($field_name, $gwolle_gb_error_fields)) {
297
  $output .= ' error';
298
  }
299
  $output .= '" placeholder="' . $label . '" ';
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
  }
429
  </div>
430
  <div class="input">
431
  <input class="';
432
+ if (in_array('gwolle_gb_captcha_code', $gwolle_gb_error_fields)) {
433
  $output .= 'error';
434
  }
435
  $output .= '" value="" type="text" name="gwolle_gb_captcha_code" id="gwolle_gb_captcha_code" placeholder="' . esc_attr__('CAPTCHA', 'gwolle-gb') . '" ';
436
+ if ( in_array('gwolle_gb_captcha_code', $gwolle_gb_error_fields) && isset($autofocus) ) {
437
  $output .= $autofocus;
438
  $autofocus = false; // disable it for the next error.
439
  }
461
 
462
  /* Nonce */
463
  if (get_option( 'gwolle_gb-nonce', 'true') == 'true') {
464
+ $field_name = gwolle_gb_get_field_name( 'nonce' );
465
  $nonce = wp_create_nonce( 'gwolle_gb_add_entry' );
466
+ $output .= '<input type="hidden" id="' . $field_name . '" name="' . $field_name . '" value="' . $nonce . '" />';
467
  }
468
 
469
  /* Use this filter to just add something */
frontend/gwolle_gb-entry.php CHANGED
@@ -194,19 +194,26 @@ if ( ! function_exists('gwolle_gb_entry_template') ) {
194
  if ( get_option( 'gwolle_gb-showLineBreaks', 'false' ) === 'true' ) {
195
  $admin_reply_content = nl2br($admin_reply_content);
196
  }
197
- if ( $excerpt_length > 0 ) {
198
- $admin_reply_content = wp_trim_words( $admin_reply_content, $excerpt_length, '...' );
199
- }
200
  if ( isset($form_setting['form_bbcode_enabled']) && $form_setting['form_bbcode_enabled'] === 'true' ) {
201
  $admin_reply_content = gwolle_gb_bbcode_parse($admin_reply_content);
202
  } else {
203
  $admin_reply_content = gwolle_gb_bbcode_strip($admin_reply_content);
204
  }
205
- $admin_reply .= '
 
 
 
 
 
 
 
 
 
 
206
  <div class="gb-admin_reply_content gb-admin-reply-content">
207
  ' . $admin_reply_content . '
208
- </div>
209
- </div>';
210
 
211
  $entry_output .= $admin_reply;
212
  }
194
  if ( get_option( 'gwolle_gb-showLineBreaks', 'false' ) === 'true' ) {
195
  $admin_reply_content = nl2br($admin_reply_content);
196
  }
 
 
 
197
  if ( isset($form_setting['form_bbcode_enabled']) && $form_setting['form_bbcode_enabled'] === 'true' ) {
198
  $admin_reply_content = gwolle_gb_bbcode_parse($admin_reply_content);
199
  } else {
200
  $admin_reply_content = gwolle_gb_bbcode_strip($admin_reply_content);
201
  }
202
+ if ( $excerpt_length > 0 ) {
203
+ $admin_reply_excerpt = wp_trim_words( $admin_reply_content, $excerpt_length, $readmore );
204
+ }
205
+ if ( $excerpt_length > 0 ) {
206
+ $admin_reply .= '
207
+ <div class="gb-admin_reply-excerpt">' . $admin_reply_excerpt . '</div>
208
+ <div class="gb-admin_reply-full-content gwolle_gb_hide">
209
+ ' . $admin_reply_content . '
210
+ </div>';
211
+ } else {
212
+ $admin_reply .= '
213
  <div class="gb-admin_reply_content gb-admin-reply-content">
214
  ' . $admin_reply_content . '
215
+ </div>';
216
+ }
217
 
218
  $entry_output .= $admin_reply;
219
  }
frontend/js/gwolle-gb-frontend.js CHANGED
@@ -24,13 +24,21 @@ jQuery(document).ready(function($) {
24
  gwolle_gb_ajax_callback.add( gwolle_gb_readmore );
25
  });
26
  function gwolle_gb_readmore() {
27
- jQuery(".gwolle-gb-readmore").off('click');
28
- jQuery(".gwolle-gb-readmore").on('click', function() {
29
  var content_div = jQuery(this).parent().parent();
30
  jQuery( content_div ).find('.gb-entry-excerpt').css( 'display', 'none' );
31
  jQuery( content_div ).find('.gb-entry-full_content').slideDown(500);
32
  return false;
33
  });
 
 
 
 
 
 
 
 
34
  }
35
 
36
 
@@ -239,7 +247,7 @@ jQuery(document).ready(function($) {
239
  jQuery( '#gwolle_gb_new_entry input' ).removeClass( 'error' );
240
  jQuery( '#gwolle_gb_new_entry textarea' ).removeClass( 'error' );
241
  jQuery.each( gwolle_gb_error_fields, function( index, value ) {
242
- jQuery( '#gwolle_gb_' + value ).addClass( 'error' );
243
  });
244
 
245
  jQuery( '#gwolle_gb .gwolle_gb_submit_ajax_icon' ).css( 'display', 'none' );
24
  gwolle_gb_ajax_callback.add( gwolle_gb_readmore );
25
  });
26
  function gwolle_gb_readmore() {
27
+ jQuery(".gb-entry-content .gwolle-gb-readmore").off('click');
28
+ jQuery(".gb-entry-content .gwolle-gb-readmore").on('click', function() {
29
  var content_div = jQuery(this).parent().parent();
30
  jQuery( content_div ).find('.gb-entry-excerpt').css( 'display', 'none' );
31
  jQuery( content_div ).find('.gb-entry-full_content').slideDown(500);
32
  return false;
33
  });
34
+
35
+ jQuery(".gb-entry-admin_reply .gwolle-gb-readmore").off('click');
36
+ jQuery(".gb-entry-admin_reply .gwolle-gb-readmore").on('click', function() {
37
+ var content_div = jQuery(this).parent().parent();
38
+ jQuery( content_div ).find('.gb-admin_reply-excerpt').css( 'display', 'none' );
39
+ jQuery( content_div ).find('.gb-admin_reply-full-content').slideDown(500);
40
+ return false;
41
+ });
42
  }
43
 
44
 
247
  jQuery( '#gwolle_gb_new_entry input' ).removeClass( 'error' );
248
  jQuery( '#gwolle_gb_new_entry textarea' ).removeClass( 'error' );
249
  jQuery.each( gwolle_gb_error_fields, function( index, value ) {
250
+ jQuery( '#' + value ).addClass( 'error' );
251
  });
252
 
253
  jQuery( '#gwolle_gb .gwolle_gb_submit_ajax_icon' ).css( 'display', 'none' );
functions/gb-mail.php CHANGED
@@ -18,17 +18,21 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
18
  */
19
  function gwolle_gb_mail_moderators( $entry ) {
20
  $isspam = $entry->get_isspam();
21
- if ( !$isspam ) {
22
  $subscribers = Array();
23
- $recipients = get_option('gwolle_gb-notifyByMail', Array() );
24
- if ( count($recipients ) > 0 ) {
25
  $recipients = explode( ",", $recipients );
 
 
26
  foreach ( $recipients as $recipient ) {
27
  if ( is_numeric($recipient) ) {
28
  $userdata = get_userdata( $recipient );
29
  $subscribers[] = $userdata->user_email;
30
  }
31
  }
 
 
32
  }
33
 
34
  @ini_set('sendmail_from', get_bloginfo('admin_mail'));
18
  */
19
  function gwolle_gb_mail_moderators( $entry ) {
20
  $isspam = $entry->get_isspam();
21
+ if ( ! $isspam ) {
22
  $subscribers = Array();
23
+ $recipients = get_option('gwolle_gb-notifyByMail');
24
+ if ( strlen($recipients) > 0 ) {
25
  $recipients = explode( ",", $recipients );
26
+ }
27
+ if ( is_array( $recipients ) && count( $recipients ) > 0 ) {
28
  foreach ( $recipients as $recipient ) {
29
  if ( is_numeric($recipient) ) {
30
  $userdata = get_userdata( $recipient );
31
  $subscribers[] = $userdata->user_email;
32
  }
33
  }
34
+ } else {
35
+ return;
36
  }
37
 
38
  @ini_set('sendmail_from', get_bloginfo('admin_mail'));
functions/gb-misc.php CHANGED
@@ -195,3 +195,31 @@ function gwolle_gb_touch_time( $entry ) {
195
  </p>
196
  <?php
197
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  </p>
196
  <?php
197
  }
198
+
199
+
200
+ /*
201
+ * Use a custom field name for the form fields that are different for each website.
202
+ *
203
+ * @param string field name of the requested field.
204
+ *
205
+ * @return hashed fieldname or fieldname, prepended with gwolle_gb.
206
+ *
207
+ * @since 2.4.1
208
+ */
209
+ function gwolle_gb_get_field_name( $field ) {
210
+
211
+ if ( ! in_array( $field, array('name', 'city', 'email', 'website', 'honeypot', 'nonce') ) ) {
212
+ return 'gwolle_gb_' . $field;
213
+ }
214
+
215
+ $blog_url = get_bloginfo('wpurl');
216
+ $key = 'gwolle_gb_' . $field . '_field_name_' . $blog_url;
217
+ $field_name = get_transient( $key );
218
+ if ( false === $field_name ) {
219
+ $field_name = wp_hash( $key, 'auth' );
220
+ set_transient( $key, $field_name, DAY_IN_SECONDS );
221
+ }
222
+ $field_name = 'gwolle_gb_' . $field_name;
223
+
224
+ return $field_name;
225
+ }
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.4.0
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.4.0');
36
 
37
 
38
  /*
@@ -61,6 +61,7 @@ define('GWOLLE_GB_VER', '2.4.0');
61
  * - Consider a functions/list-view.php refactoring.
62
  * - Really switch to InnoDB.
63
  * - Consider SQL IN when emptying spam/trash.
 
64
  *
65
  */
66
 
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.1
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.1');
36
 
37
 
38
  /*
61
  * - Consider a functions/list-view.php refactoring.
62
  * - Really switch to InnoDB.
63
  * - Consider SQL IN when emptying spam/trash.
64
+ * - Support mark-as-spam and mark-as-ham for Stop Forum Spam.
65
  *
66
  */
67
 
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.4.0
7
  License: GPLv2 or later
8
 
9
  Gwolle Guestbook is the WordPress guestbook you've just been looking for. Beautiful and easy.
@@ -404,6 +404,13 @@ But if you don't use standard comments, you can just as easily use the comment s
404
 
405
  == Changelog ==
406
 
 
 
 
 
 
 
 
407
  = 2.4.0 =
408
  * 2018-03-25
409
  * Add checkbox for privacy policy for GDPR compliance.
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.1
7
  License: GPLv2 or later
8
 
9
  Gwolle Guestbook is the WordPress guestbook you've just been looking for. Beautiful and easy.
404
 
405
  == Changelog ==
406
 
407
+ = 2.4.1 =
408
+ * 2018-03-28
409
+ * Improve features for anti-spam.
410
+ * Add readmore link to admin reply excerpt.
411
+ * More improvements to mobile CSS for the form.
412
+ * Fix warning when sending mail to moderator.
413
+
414
  = 2.4.0 =
415
  * 2018-03-25
416
  * Add checkbox for privacy policy for GDPR compliance.