Version Description
- 2020-06-21
- Remove ':' from form labels.
- Remove part of the label for anti-spam question.
- Fix class of messages on error (red/green).
- Fixed a few actions for 'gwolle_gb_save_entry_admin'.
- Remove 'gwolle_gb_antispam_label' filter.
- Metabox opens now with a softer fade effect.
- Use standard From addres 'wordpress@domain.com' as default.
- Add function 'gwolle_gb_get_user_ip()' for CDN or proxy.
- Add filter 'gwolle_gb_include_proxy_ips' for using this with a CDN or proxy.
- Fix bugs in book_id functions.
Download this release
Release Info
Developer | mpol |
Plugin | Gwolle Guestbook |
Version | 4.0.3 |
Comparing to | |
See all releases |
Code changes from version 4.0.2 to 4.0.3
- add-on/gb-add-on.php +2 -2
- admin/gb-page-add-on.php +1 -1
- admin/gb-page-editor.php +2 -2
- admin/gb-page-import.php +3 -3
- docs/filters/gwolle_gb_antispam_label.txt +0 -25
- docs/filters/gwolle_gb_include_proxy_ips.txt +26 -0
- frontend/css/gwolle-gb-frontend.css +1 -0
- frontend/gb-form-posthandling.php +2 -2
- frontend/gb-form.php +13 -14
- frontend/gb-shortcodes.php +8 -0
- frontend/gwolle_gb-entry.php +1 -1
- frontend/js/gwolle-gb-frontend.js +4 -4
- functions/gb-akismet.php +1 -1
- functions/gb-book_id.php +6 -6
- functions/gb-mail.php +4 -15
- functions/gb-stop-forum-spam.php +1 -1
- functions/gb-user-ip.php +55 -0
- gwolle-gb.php +5 -2
- readme.txt +15 -2
add-on/gb-add-on.php
CHANGED
@@ -286,9 +286,9 @@ Entry content:
|
|
286 |
/* translators: Commercial Add-On */
|
287 |
esc_html_e('Visitors can report abusive entries through a link in the metabox.', 'gwolle-gb');
|
288 |
/* translators: Commercial Add-On */
|
289 |
-
esc_html_e( '
|
290 |
/* translators: Commercial Add-On */
|
291 |
-
esc_html_e('Enter words for the
|
292 |
/* translators: Commercial Add-On */
|
293 |
esc_html_e( 'When an entry contains any of these words in its content, name, URL, email, or IP address, it will be held in the moderation queue. One word or IP address per line. It will match inside words, so “press” will match “WordPress”.', 'gwolle-gb' );
|
294 |
|
286 |
/* translators: Commercial Add-On */
|
287 |
esc_html_e('Visitors can report abusive entries through a link in the metabox.', 'gwolle-gb');
|
288 |
/* translators: Commercial Add-On */
|
289 |
+
esc_html_e( 'Blocklist Moderation', 'gwolle-gb' );
|
290 |
/* translators: Commercial Add-On */
|
291 |
+
esc_html_e('Enter words for the blocklist.', 'gwolle-gb');
|
292 |
/* translators: Commercial Add-On */
|
293 |
esc_html_e( 'When an entry contains any of these words in its content, name, URL, email, or IP address, it will be held in the moderation queue. One word or IP address per line. It will match inside words, so “press” will match “WordPress”.', 'gwolle-gb' );
|
294 |
|
admin/gb-page-add-on.php
CHANGED
@@ -87,7 +87,7 @@ function gwolle_gb_addon_features() {
|
|
87 |
<li>' . esc_html__('Admin reply on the frontend with AJAX.','gwolle-gb').'</li>
|
88 |
<li>' . esc_html__('Edit content of entry on the frontend with AJAX.','gwolle-gb').'</li>
|
89 |
<li>' . esc_html__('Report Abuse.','gwolle-gb').'</li>
|
90 |
-
<li>' . esc_html__('
|
91 |
<li>' . esc_html__('Easy String Replacement in the default text so you can make this guestbook into a review section or anything you want.','gwolle-gb').'</li>
|
92 |
<li>' . esc_html__('Delete button in each entry for the moderator and author (optional).','gwolle-gb').'</li>
|
93 |
<li>' . esc_html__('Permalink button in each entry for easy access (optional).','gwolle-gb').'</li>
|
87 |
<li>' . esc_html__('Admin reply on the frontend with AJAX.','gwolle-gb').'</li>
|
88 |
<li>' . esc_html__('Edit content of entry on the frontend with AJAX.','gwolle-gb').'</li>
|
89 |
<li>' . esc_html__('Report Abuse.','gwolle-gb').'</li>
|
90 |
+
<li>' . esc_html__('Blocklist for words and IP address.','gwolle-gb').'</li>
|
91 |
<li>' . esc_html__('Easy String Replacement in the default text so you can make this guestbook into a review section or anything you want.','gwolle-gb').'</li>
|
92 |
<li>' . esc_html__('Delete button in each entry for the moderator and author (optional).','gwolle-gb').'</li>
|
93 |
<li>' . esc_html__('Permalink button in each entry for easy access (optional).','gwolle-gb').'</li>
|
admin/gb-page-editor.php
CHANGED
@@ -779,8 +779,8 @@ function gwolle_gb_page_editor_update( $entry ) {
|
|
779 |
$set_author_ip = apply_filters( 'gwolle_gb_set_author_ip', true );
|
780 |
$set_author_ip2 = get_option('gwolle_gb-store_ip', 'true');
|
781 |
if ( $set_author_ip && ($set_author_ip2 == 'true') ) {
|
782 |
-
$entry->set_author_ip(
|
783 |
-
$entry->set_author_host( gethostbyaddr(
|
784 |
}
|
785 |
|
786 |
$result1 = $entry->set_data( $data );
|
779 |
$set_author_ip = apply_filters( 'gwolle_gb_set_author_ip', true );
|
780 |
$set_author_ip2 = get_option('gwolle_gb-store_ip', 'true');
|
781 |
if ( $set_author_ip && ($set_author_ip2 == 'true') ) {
|
782 |
+
$entry->set_author_ip( gwolle_gb_get_user_ip() );
|
783 |
+
$entry->set_author_host( gethostbyaddr( gwolle_gb_get_user_ip() ) );
|
784 |
}
|
785 |
|
786 |
$result1 = $entry->set_data( $data );
|
admin/gb-page-import.php
CHANGED
@@ -377,7 +377,7 @@ function gwolle_gb_page_import_post() {
|
|
377 |
if ( $saved == 0 ) {
|
378 |
gwolle_gb_add_message( '<p>' . esc_html__("I'm sorry, but I wasn't able to import entries from DMSGuestbook successfully.", 'gwolle-gb') . '</p>', true, false);
|
379 |
} else if ( $saved == 1 || $saved > 1 ) {
|
380 |
-
do_action( 'gwolle_gb_save_entry_admin' );
|
381 |
/* translators: %s is the number of entries */
|
382 |
gwolle_gb_add_message( '<p>' . sprintf( _n('%s entry imported successfully from DMSGuestbook.','%s entries imported successfully from DMSGuestbook.', $saved, 'gwolle-gb'), $saved ) . '</p>', false, false);
|
383 |
}
|
@@ -457,7 +457,7 @@ function gwolle_gb_page_import_post() {
|
|
457 |
if ( $saved == 0 ) {
|
458 |
gwolle_gb_add_message( '<p>' . esc_html__("I'm sorry, but I wasn't able to import comments from that page successfully.", 'gwolle-gb') . '</p>', true, false);
|
459 |
} else if ( $saved == 1 || $saved > 1 ) {
|
460 |
-
do_action( 'gwolle_gb_save_entry_admin' );
|
461 |
/* translators: %s is the number of entries */
|
462 |
gwolle_gb_add_message( '<p>' . sprintf( _n('%s entry imported successfully from WordPress comments.','%s entries imported successfully from WordPress comments.', $saved, 'gwolle-gb'), $saved ) . '</p>', false, false);
|
463 |
}
|
@@ -650,7 +650,7 @@ function gwolle_gb_page_import_post() {
|
|
650 |
if ( $row == 0 ) {
|
651 |
gwolle_gb_add_message( '<p>' . esc_html__("I'm sorry, but I wasn't able to import entries from the CSV file.", 'gwolle-gb') . '</p>', true, false);
|
652 |
} else if ( $row == 1 || $row > 1 ) {
|
653 |
-
do_action( 'gwolle_gb_save_entry_admin' );
|
654 |
/* translators: %s is the number of entries */
|
655 |
gwolle_gb_add_message( '<p>' . sprintf( _n('%s entry imported successfully from the CSV file.','%s entries imported successfully from the CSV file.', $row, 'gwolle-gb'), $row ) . '</p>', false, false);
|
656 |
}
|
377 |
if ( $saved == 0 ) {
|
378 |
gwolle_gb_add_message( '<p>' . esc_html__("I'm sorry, but I wasn't able to import entries from DMSGuestbook successfully.", 'gwolle-gb') . '</p>', true, false);
|
379 |
} else if ( $saved == 1 || $saved > 1 ) {
|
380 |
+
do_action( 'gwolle_gb_save_entry_admin', $entry );
|
381 |
/* translators: %s is the number of entries */
|
382 |
gwolle_gb_add_message( '<p>' . sprintf( _n('%s entry imported successfully from DMSGuestbook.','%s entries imported successfully from DMSGuestbook.', $saved, 'gwolle-gb'), $saved ) . '</p>', false, false);
|
383 |
}
|
457 |
if ( $saved == 0 ) {
|
458 |
gwolle_gb_add_message( '<p>' . esc_html__("I'm sorry, but I wasn't able to import comments from that page successfully.", 'gwolle-gb') . '</p>', true, false);
|
459 |
} else if ( $saved == 1 || $saved > 1 ) {
|
460 |
+
do_action( 'gwolle_gb_save_entry_admin', $entry );
|
461 |
/* translators: %s is the number of entries */
|
462 |
gwolle_gb_add_message( '<p>' . sprintf( _n('%s entry imported successfully from WordPress comments.','%s entries imported successfully from WordPress comments.', $saved, 'gwolle-gb'), $saved ) . '</p>', false, false);
|
463 |
}
|
650 |
if ( $row == 0 ) {
|
651 |
gwolle_gb_add_message( '<p>' . esc_html__("I'm sorry, but I wasn't able to import entries from the CSV file.", 'gwolle-gb') . '</p>', true, false);
|
652 |
} else if ( $row == 1 || $row > 1 ) {
|
653 |
+
do_action( 'gwolle_gb_save_entry_admin', $entry );
|
654 |
/* translators: %s is the number of entries */
|
655 |
gwolle_gb_add_message( '<p>' . sprintf( _n('%s entry imported successfully from the CSV file.','%s entries imported successfully from the CSV file.', $row, 'gwolle-gb'), $row ) . '</p>', false, false);
|
656 |
}
|
docs/filters/gwolle_gb_antispam_label.txt
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
==Description==
|
4 |
-
|
5 |
-
The <b>"gwolle_gb_antispam_label"</b> filter is used to change the text of the label for the input for antispam at the frontend. It is used for the Custom antispam question.
|
6 |
-
|
7 |
-
You can use this filter as:
|
8 |
-
|
9 |
-
<code><?php add_filter( 'gwolle_gb_antispam_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_antispam_label( $label ) {
|
20 |
-
// $label is a string
|
21 |
-
$label = 'test';
|
22 |
-
return $label;
|
23 |
-
}
|
24 |
-
add_filter( 'gwolle_gb_antispam_label', 'my_gwolle_gb_antispam_label', 10, 1 );
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/filters/gwolle_gb_include_proxy_ips.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
==Description==
|
4 |
+
|
5 |
+
The <b>"gwolle_gb_include_proxy_ips"</b> filter is used to use the real client IP instead of the ip from the CDN or proxy.
|
6 |
+
|
7 |
+
You can use this filter as:
|
8 |
+
|
9 |
+
<code><?php add_filter( 'gwolle_gb_include_proxy_ips', '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_include_proxy_ips( $include_proxy_ip ) {
|
20 |
+
// $include_proxy_ip is a boolean
|
21 |
+
$include_proxy_ip = true;
|
22 |
+
|
23 |
+
return $include_proxy_ip;
|
24 |
+
}
|
25 |
+
add_filter( 'gwolle_gb_include_proxy_ips', 'my_gwolle_gb_include_proxy_ips', 10, 2 );
|
26 |
+
|
frontend/css/gwolle-gb-frontend.css
CHANGED
@@ -265,6 +265,7 @@ div.gb-metabox-handle:focus {
|
|
265 |
}
|
266 |
|
267 |
div.gb-metabox {
|
|
|
268 |
position: absolute;
|
269 |
top: 0;
|
270 |
right: 30px;
|
265 |
}
|
266 |
|
267 |
div.gb-metabox {
|
268 |
+
display: none;
|
269 |
position: absolute;
|
270 |
top: 0;
|
271 |
right: 30px;
|
frontend/gb-form-posthandling.php
CHANGED
@@ -418,8 +418,8 @@ function gwolle_gb_frontend_posthandling() {
|
|
418 |
$set_author_ip = (bool) apply_filters( 'gwolle_gb_set_author_ip', true );
|
419 |
$set_author_ip2 = get_option('gwolle_gb-store_ip', 'true');
|
420 |
if ( $set_author_ip && ($set_author_ip2 == 'true') ) {
|
421 |
-
$entry->set_author_ip(
|
422 |
-
$entry->set_author_host( gethostbyaddr(
|
423 |
}
|
424 |
|
425 |
|
418 |
$set_author_ip = (bool) apply_filters( 'gwolle_gb_set_author_ip', true );
|
419 |
$set_author_ip2 = get_option('gwolle_gb-store_ip', 'true');
|
420 |
if ( $set_author_ip && ($set_author_ip2 == 'true') ) {
|
421 |
+
$entry->set_author_ip( gwolle_gb_get_user_ip() );
|
422 |
+
$entry->set_author_host( gethostbyaddr( gwolle_gb_get_user_ip() ) );
|
423 |
}
|
424 |
|
425 |
|
frontend/gb-form.php
CHANGED
@@ -173,7 +173,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
173 |
$field_name = gwolle_gb_get_field_name( 'name' );
|
174 |
$label = apply_filters( 'gwolle_gb_author_name_label', esc_html__('Name', 'gwolle-gb') );
|
175 |
$output .= '<div class="' . $field_name . '">
|
176 |
-
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label
|
177 |
if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) { $output .= ' *';}
|
178 |
$output .= '</label></div>
|
179 |
<div class="input"><input class="wp-exclude-emoji ' . $field_name;
|
@@ -200,7 +200,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
200 |
$field_name = gwolle_gb_get_field_name( 'city' );
|
201 |
$label = apply_filters( 'gwolle_gb_author_origin_label', esc_html__('City', 'gwolle-gb') );
|
202 |
$output .= '<div class="' . $field_name . '">
|
203 |
-
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label
|
204 |
if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) { $output .= ' *';}
|
205 |
$output .= '</label></div>
|
206 |
<div class="input"><input class="wp-exclude-emoji ' . $field_name;
|
@@ -226,7 +226,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
226 |
$field_name = gwolle_gb_get_field_name( 'email' );
|
227 |
$label = apply_filters( 'gwolle_gb_author_email_label', esc_html__('Email', 'gwolle-gb') );
|
228 |
$output .= '<div class="' . $field_name . '">
|
229 |
-
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label
|
230 |
if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) { $output .= ' *';}
|
231 |
$output .= '</label></div>
|
232 |
<div class="input"><input class="' . $field_name;
|
@@ -257,7 +257,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
257 |
$field_name = gwolle_gb_get_field_name( 'website' );
|
258 |
$label = apply_filters( 'gwolle_gb_author_website_label', esc_html__('Website', 'gwolle-gb') );
|
259 |
$output .= '<div class="' . $field_name . '">
|
260 |
-
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label
|
261 |
if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) { $output .= ' *';}
|
262 |
$output .= '</label></div>
|
263 |
<div class="input"><input class="' . $field_name;
|
@@ -287,8 +287,8 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
287 |
$output .= '
|
288 |
<div class="' . $field_name . '" style="display:none;">
|
289 |
<div class="label">
|
290 |
-
<label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '
|
291 |
-
<label for="' . $field_name2 . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '
|
292 |
</div>
|
293 |
<div class="input">
|
294 |
<input value="' . $honeypot_value . '" type="text" name="' . $field_name . '" class="' . $field_name . '" placeholder="" />
|
@@ -306,8 +306,8 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
306 |
$output .= '
|
307 |
<div class="' . $field_name . '" style="display:none;">
|
308 |
<div class="label">
|
309 |
-
<label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '
|
310 |
-
<label for="' . $field_name2 . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '
|
311 |
</div>
|
312 |
<div class="input">
|
313 |
<input value="' . $random . '" type="text" name="' . $field_name . '" class="' . $field_name . '" placeholder="" />
|
@@ -323,7 +323,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
323 |
$label = apply_filters( 'gwolle_gb_content_label', esc_html__('Guestbook entry', 'gwolle-gb') ); // backwards compatible.
|
324 |
$label = apply_filters( 'gwolle_gb_author_content_label', $label ); // new consistent name.
|
325 |
$output .= '<div class="' . $field_name . '">
|
326 |
-
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label
|
327 |
if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) { $output .= ' *';}
|
328 |
$output .= '</label></div>
|
329 |
<div class="input"><textarea name="' . $field_name . '" class="' . $field_name . ' wp-exclude-emoji';
|
@@ -361,7 +361,6 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
361 |
/* Custom Anti-Spam */
|
362 |
if ( isset($form_setting['form_antispam_enabled']) && $form_setting['form_antispam_enabled'] === 'true' ) {
|
363 |
$field_name = gwolle_gb_get_field_name( 'custom' );
|
364 |
-
$label = apply_filters( 'gwolle_gb_antispam_label', esc_html__('Anti-spam', 'gwolle-gb') );
|
365 |
$antispam_question = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-question') );
|
366 |
$antispam_answer = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-answer') );
|
367 |
|
@@ -369,8 +368,8 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
369 |
$output .= '
|
370 |
<div class="gwolle_gb_antispam">
|
371 |
<div class="label">
|
372 |
-
<label for="' . $field_name . '" class="text-info">'
|
373 |
-
|
374 |
</div>
|
375 |
<div class="input"><input class="' . $field_name;
|
376 |
if (in_array( $field_name, $gwolle_gb_error_fields)) {
|
@@ -409,7 +408,7 @@ function gwolle_gb_frontend_write( $shortcode_atts, $shortcode ) {
|
|
409 |
$label = apply_filters( 'gwolle_gb_privacy_label', sprintf( esc_html__( 'Accept %sPrivacy Policy%s', 'gwolle-gb' ), $a_open, $a_close ) );
|
410 |
$output .= '
|
411 |
<div class="gwolle_gb_privacy">
|
412 |
-
<div class="label"><label for="gwolle_gb_privacy" class="text-info">' . $label . '
|
413 |
<div class="input"><input type="checkbox" name="gwolle_gb_privacy" class="gwolle_gb_privacy" required' . $checked . ' /></div>
|
414 |
</div>
|
415 |
<div class="clearBoth"> </div>';
|
@@ -459,7 +458,7 @@ We reserve the right to edit, delete, or not publish entries.
|
|
459 |
}
|
460 |
|
461 |
$notice = nl2br($notice);
|
462 |
-
$output .= str_replace('%ip%',
|
463 |
|
464 |
$output .= '
|
465 |
</div>';
|
173 |
$field_name = gwolle_gb_get_field_name( 'name' );
|
174 |
$label = apply_filters( 'gwolle_gb_author_name_label', esc_html__('Name', 'gwolle-gb') );
|
175 |
$output .= '<div class="' . $field_name . '">
|
176 |
+
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label;
|
177 |
if ( isset($form_setting['form_name_mandatory']) && $form_setting['form_name_mandatory'] === 'true' ) { $output .= ' *';}
|
178 |
$output .= '</label></div>
|
179 |
<div class="input"><input class="wp-exclude-emoji ' . $field_name;
|
200 |
$field_name = gwolle_gb_get_field_name( 'city' );
|
201 |
$label = apply_filters( 'gwolle_gb_author_origin_label', esc_html__('City', 'gwolle-gb') );
|
202 |
$output .= '<div class="' . $field_name . '">
|
203 |
+
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label;
|
204 |
if ( isset($form_setting['form_city_mandatory']) && $form_setting['form_city_mandatory'] === 'true' ) { $output .= ' *';}
|
205 |
$output .= '</label></div>
|
206 |
<div class="input"><input class="wp-exclude-emoji ' . $field_name;
|
226 |
$field_name = gwolle_gb_get_field_name( 'email' );
|
227 |
$label = apply_filters( 'gwolle_gb_author_email_label', esc_html__('Email', 'gwolle-gb') );
|
228 |
$output .= '<div class="' . $field_name . '">
|
229 |
+
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label;
|
230 |
if ( isset($form_setting['form_email_mandatory']) && $form_setting['form_email_mandatory'] === 'true' ) { $output .= ' *';}
|
231 |
$output .= '</label></div>
|
232 |
<div class="input"><input class="' . $field_name;
|
257 |
$field_name = gwolle_gb_get_field_name( 'website' );
|
258 |
$label = apply_filters( 'gwolle_gb_author_website_label', esc_html__('Website', 'gwolle-gb') );
|
259 |
$output .= '<div class="' . $field_name . '">
|
260 |
+
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label;
|
261 |
if ( isset($form_setting['form_homepage_mandatory']) && $form_setting['form_homepage_mandatory'] === 'true' ) { $output .= ' *';}
|
262 |
$output .= '</label></div>
|
263 |
<div class="input"><input class="' . $field_name;
|
287 |
$output .= '
|
288 |
<div class="' . $field_name . '" style="display:none;">
|
289 |
<div class="label">
|
290 |
+
<label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '</label>
|
291 |
+
<label for="' . $field_name2 . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '</label>
|
292 |
</div>
|
293 |
<div class="input">
|
294 |
<input value="' . $honeypot_value . '" type="text" name="' . $field_name . '" class="' . $field_name . '" placeholder="" />
|
306 |
$output .= '
|
307 |
<div class="' . $field_name . '" style="display:none;">
|
308 |
<div class="label">
|
309 |
+
<label for="' . $field_name . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '</label>
|
310 |
+
<label for="' . $field_name2 . '" class="text-primary">' . esc_html__('Do not touch this', 'gwolle-gb') . '</label>
|
311 |
</div>
|
312 |
<div class="input">
|
313 |
<input value="' . $random . '" type="text" name="' . $field_name . '" class="' . $field_name . '" placeholder="" />
|
323 |
$label = apply_filters( 'gwolle_gb_content_label', esc_html__('Guestbook entry', 'gwolle-gb') ); // backwards compatible.
|
324 |
$label = apply_filters( 'gwolle_gb_author_content_label', $label ); // new consistent name.
|
325 |
$output .= '<div class="' . $field_name . '">
|
326 |
+
<div class="label"><label for="' . $field_name . '" class="text-info">' . $label;
|
327 |
if ( isset($form_setting['form_message_mandatory']) && $form_setting['form_message_mandatory'] === 'true' ) { $output .= ' *';}
|
328 |
$output .= '</label></div>
|
329 |
<div class="input"><textarea name="' . $field_name . '" class="' . $field_name . ' wp-exclude-emoji';
|
361 |
/* Custom Anti-Spam */
|
362 |
if ( isset($form_setting['form_antispam_enabled']) && $form_setting['form_antispam_enabled'] === 'true' ) {
|
363 |
$field_name = gwolle_gb_get_field_name( 'custom' );
|
|
|
364 |
$antispam_question = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-question') );
|
365 |
$antispam_answer = gwolle_gb_sanitize_output( get_option('gwolle_gb-antispam-answer') );
|
366 |
|
368 |
$output .= '
|
369 |
<div class="gwolle_gb_antispam">
|
370 |
<div class="label">
|
371 |
+
<label for="' . $field_name . '" class="text-info">'
|
372 |
+
. esc_html__('Question:', 'gwolle-gb') . ' ' . $antispam_question . ' *</label>
|
373 |
</div>
|
374 |
<div class="input"><input class="' . $field_name;
|
375 |
if (in_array( $field_name, $gwolle_gb_error_fields)) {
|
408 |
$label = apply_filters( 'gwolle_gb_privacy_label', sprintf( esc_html__( 'Accept %sPrivacy Policy%s', 'gwolle-gb' ), $a_open, $a_close ) );
|
409 |
$output .= '
|
410 |
<div class="gwolle_gb_privacy">
|
411 |
+
<div class="label"><label for="gwolle_gb_privacy" class="text-info">' . $label . ' *</label></div>
|
412 |
<div class="input"><input type="checkbox" name="gwolle_gb_privacy" class="gwolle_gb_privacy" required' . $checked . ' /></div>
|
413 |
</div>
|
414 |
<div class="clearBoth"> </div>';
|
458 |
}
|
459 |
|
460 |
$notice = nl2br($notice);
|
461 |
+
$output .= str_replace('%ip%', gwolle_gb_get_user_ip(), $notice);
|
462 |
|
463 |
$output .= '
|
464 |
</div>';
|
frontend/gb-shortcodes.php
CHANGED
@@ -88,6 +88,10 @@ function get_gwolle_gb_write( $atts ) {
|
|
88 |
if ( $shortcode_atts['book_id'] === 'post_id' ) {
|
89 |
$shortcode_atts['book_id'] = get_the_ID();
|
90 |
}
|
|
|
|
|
|
|
|
|
91 |
|
92 |
// Load Frontend CSS in Footer, only when it's active
|
93 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
@@ -125,6 +129,10 @@ function get_gwolle_gb_read( $atts ) {
|
|
125 |
if ( $shortcode_atts['book_id'] === 'post_id' ) {
|
126 |
$shortcode_atts['book_id'] = get_the_ID();
|
127 |
}
|
|
|
|
|
|
|
|
|
128 |
|
129 |
// Load Frontend CSS in Footer, only when it's active
|
130 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
88 |
if ( $shortcode_atts['book_id'] === 'post_id' ) {
|
89 |
$shortcode_atts['book_id'] = get_the_ID();
|
90 |
}
|
91 |
+
if ( is_singular() && is_main_query() && ! is_admin() ) {
|
92 |
+
$id = get_the_ID();
|
93 |
+
update_post_meta( $id, 'gwolle_gb_book_id', $shortcode_atts['book_id'] );
|
94 |
+
}
|
95 |
|
96 |
// Load Frontend CSS in Footer, only when it's active
|
97 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
129 |
if ( $shortcode_atts['book_id'] === 'post_id' ) {
|
130 |
$shortcode_atts['book_id'] = get_the_ID();
|
131 |
}
|
132 |
+
if ( is_singular() && is_main_query() && ! is_admin() ) {
|
133 |
+
$id = get_the_ID();
|
134 |
+
update_post_meta( $id, 'gwolle_gb_book_id', $shortcode_atts['book_id'] );
|
135 |
+
}
|
136 |
|
137 |
// Load Frontend CSS in Footer, only when it's active
|
138 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
frontend/gwolle_gb-entry.php
CHANGED
@@ -237,7 +237,7 @@ if ( ! function_exists('gwolle_gb_entry_template') ) {
|
|
237 |
if ( $gb_metabox ) {
|
238 |
$entry_output .= '
|
239 |
<div class="gb-metabox-handle" tabindex="0">' . esc_html__('...', 'gwolle-gb' ) . '<span class="screen-reader-text"> ' . esc_html__('Toggle this metabox.', 'gwolle-gb') . '</span></div>
|
240 |
-
<div class="gb-metabox
|
241 |
$gb_metabox . '
|
242 |
</div>';
|
243 |
}
|
237 |
if ( $gb_metabox ) {
|
238 |
$entry_output .= '
|
239 |
<div class="gb-metabox-handle" tabindex="0">' . esc_html__('...', 'gwolle-gb' ) . '<span class="screen-reader-text"> ' . esc_html__('Toggle this metabox.', 'gwolle-gb') . '</span></div>
|
240 |
+
<div class="gb-metabox">' .
|
241 |
$gb_metabox . '
|
242 |
</div>';
|
243 |
}
|
frontend/js/gwolle-gb-frontend.js
CHANGED
@@ -64,13 +64,13 @@ function gwolle_gb_metabox_handle() {
|
|
64 |
jQuery('div.gb-metabox-handle').off('click');
|
65 |
jQuery('div.gb-metabox-handle').on('click', function() {
|
66 |
var entry_div = jQuery(this).closest('div.gb-entry');
|
67 |
-
jQuery('div.gb-metabox', entry_div).
|
68 |
return false;
|
69 |
});
|
70 |
jQuery("div.gb-metabox-handle").keypress(function(e) {
|
71 |
if (e.keyCode == 13) { // Enter key.
|
72 |
var entry_div = jQuery(this).closest('div.gb-entry');
|
73 |
-
jQuery('div.gb-metabox', entry_div).
|
74 |
return false;
|
75 |
}
|
76 |
});
|
@@ -78,7 +78,7 @@ function gwolle_gb_metabox_handle() {
|
|
78 |
}
|
79 |
jQuery(document).ready(function($) {
|
80 |
jQuery('body').on('click', function( el ) {
|
81 |
-
jQuery('div.gb-metabox').
|
82 |
});
|
83 |
});
|
84 |
|
@@ -319,7 +319,7 @@ jQuery(document).ready(function($) {
|
|
319 |
|
320 |
// Show returned messages.
|
321 |
jQuery( '.gwolle_gb_messages_top_container', main_div ).html('');
|
322 |
-
jQuery( '.gwolle_gb_messages_bottom_container', main_div ).html('<div class="gwolle_gb_messages
|
323 |
|
324 |
// Add error class to failed input fields.
|
325 |
jQuery.each( gwolle_gb_error_fields, function( index, value ) {
|
64 |
jQuery('div.gb-metabox-handle').off('click');
|
65 |
jQuery('div.gb-metabox-handle').on('click', function() {
|
66 |
var entry_div = jQuery(this).closest('div.gb-entry');
|
67 |
+
jQuery('div.gb-metabox', entry_div).fadeToggle( 'fast', 'linear' );
|
68 |
return false;
|
69 |
});
|
70 |
jQuery("div.gb-metabox-handle").keypress(function(e) {
|
71 |
if (e.keyCode == 13) { // Enter key.
|
72 |
var entry_div = jQuery(this).closest('div.gb-entry');
|
73 |
+
jQuery('div.gb-metabox', entry_div).fadeToggle( 'fast', 'linear' );
|
74 |
return false;
|
75 |
}
|
76 |
});
|
78 |
}
|
79 |
jQuery(document).ready(function($) {
|
80 |
jQuery('body').on('click', function( el ) {
|
81 |
+
jQuery('div.gb-metabox').fadeOut( 'fast', 'linear' );
|
82 |
});
|
83 |
});
|
84 |
|
319 |
|
320 |
// Show returned messages.
|
321 |
jQuery( '.gwolle_gb_messages_top_container', main_div ).html('');
|
322 |
+
jQuery( '.gwolle_gb_messages_bottom_container', main_div ).html('<div class="gwolle_gb_messages error">' + data['gwolle_gb_messages'] + '</div>');
|
323 |
|
324 |
// Add error class to failed input fields.
|
325 |
jQuery.each( gwolle_gb_error_fields, function( index, value ) {
|
functions/gb-akismet.php
CHANGED
@@ -77,7 +77,7 @@ function gwolle_gb_akismet( $entry, $action ) {
|
|
77 |
$comment['blog_charset'] = get_option( 'blog_charset' );
|
78 |
$store_author_ip = get_option('gwolle_gb-store_ip', 'true');
|
79 |
if ( $store_author_ip == 'true' ) {
|
80 |
-
$comment['user_ip'] = preg_replace( '/[^0-9., ]/', '',
|
81 |
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
82 |
}
|
83 |
if ( isset($_SERVER['HTTP_REFERER']) ) {
|
77 |
$comment['blog_charset'] = get_option( 'blog_charset' );
|
78 |
$store_author_ip = get_option('gwolle_gb-store_ip', 'true');
|
79 |
if ( $store_author_ip == 'true' ) {
|
80 |
+
$comment['user_ip'] = preg_replace( '/[^0-9., ]/', '', gwolle_gb_get_user_ip() );
|
81 |
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
82 |
}
|
83 |
if ( isset($_SERVER['HTTP_REFERER']) ) {
|
functions/gb-book_id.php
CHANGED
@@ -114,6 +114,8 @@ function gwolle_gb_get_books() {
|
|
114 |
$the_query = new WP_Query( array(
|
115 |
'post_type' => 'any',
|
116 |
'ignore_sticky_posts' => true, // do not use sticky posts.
|
|
|
|
|
117 |
'meta_query' => array(
|
118 |
array(
|
119 |
'key' => 'gwolle_gb_read',
|
@@ -123,7 +125,6 @@ function gwolle_gb_get_books() {
|
|
123 |
'update_post_term_cache' => false,
|
124 |
'update_post_meta_cache' => false
|
125 |
));
|
126 |
-
|
127 |
$postids = array();
|
128 |
if ( $the_query->have_posts() ) {
|
129 |
while ( $the_query->have_posts() ) : $the_query->the_post();
|
@@ -147,25 +148,24 @@ function gwolle_gb_get_permalinks() {
|
|
147 |
$postids = gwolle_gb_get_books();
|
148 |
$books = array();
|
149 |
|
150 |
-
/* Build up all the permalinks for the books. */
|
151 |
foreach ( $postids as $postid ) {
|
152 |
$permalink = gwolle_gb_get_permalink( $postid );
|
153 |
-
|
154 |
-
if ( empty( $permalink ) ) {
|
155 |
continue;
|
156 |
}
|
157 |
|
158 |
$book_id = get_post_meta( $postid, 'gwolle_gb_book_id', true );
|
159 |
-
if (
|
160 |
continue;
|
161 |
}
|
162 |
|
163 |
-
$books[
|
164 |
'post_id' => $postid,
|
165 |
'book_id' => $book_id,
|
166 |
'permalink' => $permalink
|
167 |
);
|
168 |
}
|
|
|
169 |
return $books;
|
170 |
}
|
171 |
|
114 |
$the_query = new WP_Query( array(
|
115 |
'post_type' => 'any',
|
116 |
'ignore_sticky_posts' => true, // do not use sticky posts.
|
117 |
+
'nopaging' => true,
|
118 |
+
'posts_per_page' => 500,
|
119 |
'meta_query' => array(
|
120 |
array(
|
121 |
'key' => 'gwolle_gb_read',
|
125 |
'update_post_term_cache' => false,
|
126 |
'update_post_meta_cache' => false
|
127 |
));
|
|
|
128 |
$postids = array();
|
129 |
if ( $the_query->have_posts() ) {
|
130 |
while ( $the_query->have_posts() ) : $the_query->the_post();
|
148 |
$postids = gwolle_gb_get_books();
|
149 |
$books = array();
|
150 |
|
|
|
151 |
foreach ( $postids as $postid ) {
|
152 |
$permalink = gwolle_gb_get_permalink( $postid );
|
153 |
+
if ( strlen( $permalink ) == 0 ) {
|
|
|
154 |
continue;
|
155 |
}
|
156 |
|
157 |
$book_id = get_post_meta( $postid, 'gwolle_gb_book_id', true );
|
158 |
+
if ( strlen( $book_id ) == 0 ) {
|
159 |
continue;
|
160 |
}
|
161 |
|
162 |
+
$books[] = array(
|
163 |
'post_id' => $postid,
|
164 |
'book_id' => $book_id,
|
165 |
'permalink' => $permalink
|
166 |
);
|
167 |
}
|
168 |
+
|
169 |
return $books;
|
170 |
}
|
171 |
|
functions/gb-mail.php
CHANGED
@@ -36,8 +36,6 @@ function gwolle_gb_mail_moderators( $entry ) {
|
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
-
@ini_set('sendmail_from', get_bloginfo('admin_mail'));
|
40 |
-
|
41 |
// Set the Mail Content
|
42 |
$mailTags = array( 'user_email', 'user_name', 'status', 'entry_management_url', 'blog_name', 'blog_url', 'wp_admin_url', 'entry_content', 'author_ip', 'author_origin' );
|
43 |
$mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-adminMailContent', false ), 'setting_textarea' );
|
@@ -67,13 +65,10 @@ Entry content:
|
|
67 |
$subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
|
68 |
$subject = apply_filters( 'gwolle_gb_mail_moderators_subject', $subject );
|
69 |
|
70 |
-
$header = "";
|
71 |
if ( get_option('gwolle_gb-mail-from', false) ) {
|
72 |
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . get_option('gwolle_gb-mail-from') . ">\r\n";
|
73 |
-
} else {
|
74 |
-
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . get_bloginfo('admin_email') . ">\r\n";
|
75 |
}
|
76 |
-
$header .= "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail.
|
77 |
$author_email = $entry->get_author_email();
|
78 |
if ( $author_email ) {
|
79 |
$header .= 'Reply-To: "' . gwolle_gb_format_values_for_mail($entry->get_author_name()) . '" <' . $author_email . ">\r\n"; // Set Reply-To for easy answering.
|
@@ -101,7 +96,7 @@ Entry content:
|
|
101 |
$info['entry_management_url'] = $wpadmin . '?page=' . GWOLLE_GB_FOLDER . '/editor.php&entry_id=' . $entry->get_id();
|
102 |
|
103 |
$info['entry_content'] = gwolle_gb_format_values_for_mail(gwolle_gb_sanitize_output( $entry->get_content(), 'content' ));
|
104 |
-
$info['author_ip'] =
|
105 |
$info['author_origin'] = $entry->get_author_origin();
|
106 |
if ( $entry->get_ischecked() ) {
|
107 |
$info['status'] = esc_html__('Checked', 'gwolle-gb');
|
@@ -178,13 +173,10 @@ Entry content:
|
|
178 |
$subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
|
179 |
$subject = apply_filters( 'gwolle_gb_mail_author_subject', $subject );
|
180 |
|
181 |
-
$header = "";
|
182 |
if ( get_option('gwolle_gb-mail-from', false) ) {
|
183 |
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . gwolle_gb_sanitize_output( get_option('gwolle_gb-mail-from') ) . ">\r\n";
|
184 |
-
} else {
|
185 |
-
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . get_bloginfo('admin_email') . ">\r\n";
|
186 |
}
|
187 |
-
$header .= "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail
|
188 |
|
189 |
// Replace the tags from the mailtemplate with real data from the website and entry
|
190 |
$info = array();
|
@@ -256,13 +248,10 @@ Original entry posted on %date%:
|
|
256 |
$subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('Admin Reply', 'gwolle-gb');
|
257 |
$subject = apply_filters( 'gwolle_gb_mail_author_on_admin_reply_subject', $subject );
|
258 |
|
259 |
-
$header = "";
|
260 |
if ( get_option('gwolle_gb-mail-from', false) ) {
|
261 |
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . gwolle_gb_sanitize_output( get_option('gwolle_gb-mail-from') ) . ">\r\n";
|
262 |
-
} else {
|
263 |
-
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . get_bloginfo('admin_email') . ">\r\n";
|
264 |
}
|
265 |
-
$header .= "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail
|
266 |
|
267 |
// Replace the tags from the mailtemplate with real data from the website and entry
|
268 |
$info = array();
|
36 |
return;
|
37 |
}
|
38 |
|
|
|
|
|
39 |
// Set the Mail Content
|
40 |
$mailTags = array( 'user_email', 'user_name', 'status', 'entry_management_url', 'blog_name', 'blog_url', 'wp_admin_url', 'entry_content', 'author_ip', 'author_origin' );
|
41 |
$mail_body = gwolle_gb_sanitize_output( get_option( 'gwolle_gb-adminMailContent', false ), 'setting_textarea' );
|
65 |
$subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
|
66 |
$subject = apply_filters( 'gwolle_gb_mail_moderators_subject', $subject );
|
67 |
|
68 |
+
$header = "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail.
|
69 |
if ( get_option('gwolle_gb-mail-from', false) ) {
|
70 |
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . get_option('gwolle_gb-mail-from') . ">\r\n";
|
|
|
|
|
71 |
}
|
|
|
72 |
$author_email = $entry->get_author_email();
|
73 |
if ( $author_email ) {
|
74 |
$header .= 'Reply-To: "' . gwolle_gb_format_values_for_mail($entry->get_author_name()) . '" <' . $author_email . ">\r\n"; // Set Reply-To for easy answering.
|
96 |
$info['entry_management_url'] = $wpadmin . '?page=' . GWOLLE_GB_FOLDER . '/editor.php&entry_id=' . $entry->get_id();
|
97 |
|
98 |
$info['entry_content'] = gwolle_gb_format_values_for_mail(gwolle_gb_sanitize_output( $entry->get_content(), 'content' ));
|
99 |
+
$info['author_ip'] = gwolle_gb_get_user_ip();
|
100 |
$info['author_origin'] = $entry->get_author_origin();
|
101 |
if ( $entry->get_ischecked() ) {
|
102 |
$info['status'] = esc_html__('Checked', 'gwolle-gb');
|
173 |
$subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('New Guestbook Entry', 'gwolle-gb');
|
174 |
$subject = apply_filters( 'gwolle_gb_mail_author_subject', $subject );
|
175 |
|
176 |
+
$header = "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail
|
177 |
if ( get_option('gwolle_gb-mail-from', false) ) {
|
178 |
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . gwolle_gb_sanitize_output( get_option('gwolle_gb-mail-from') ) . ">\r\n";
|
|
|
|
|
179 |
}
|
|
|
180 |
|
181 |
// Replace the tags from the mailtemplate with real data from the website and entry
|
182 |
$info = array();
|
248 |
$subject = '[' . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . '] ' . esc_html__('Admin Reply', 'gwolle-gb');
|
249 |
$subject = apply_filters( 'gwolle_gb_mail_author_on_admin_reply_subject', $subject );
|
250 |
|
251 |
+
$header = "Content-Type: text/plain; charset=UTF-8\r\n"; // Encoding of the mail
|
252 |
if ( get_option('gwolle_gb-mail-from', false) ) {
|
253 |
$header .= "From: " . gwolle_gb_format_values_for_mail(get_bloginfo('name')) . " <" . gwolle_gb_sanitize_output( get_option('gwolle_gb-mail-from') ) . ">\r\n";
|
|
|
|
|
254 |
}
|
|
|
255 |
|
256 |
// Replace the tags from the mailtemplate with real data from the website and entry
|
257 |
$info = array();
|
functions/gb-stop-forum-spam.php
CHANGED
@@ -22,7 +22,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
|
|
22 |
*/
|
23 |
function gwolle_gb_stop_forum_spam( $entry ) {
|
24 |
$args = array();
|
25 |
-
$args['ip'] =
|
26 |
$args['email'] = urlencode(iconv( 'GBK', 'UTF-8', $entry->get_author_email() ));
|
27 |
$args['username'] = urlencode(iconv( 'GBK', 'UTF-8', $entry->get_author_name() ));
|
28 |
$args['f'] = 'json';
|
22 |
*/
|
23 |
function gwolle_gb_stop_forum_spam( $entry ) {
|
24 |
$args = array();
|
25 |
+
$args['ip'] = gwolle_gb_get_user_ip();
|
26 |
$args['email'] = urlencode(iconv( 'GBK', 'UTF-8', $entry->get_author_email() ));
|
27 |
$args['username'] = urlencode(iconv( 'GBK', 'UTF-8', $entry->get_author_name() ));
|
28 |
$args['f'] = 'json';
|
functions/gb-user-ip.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
* Validate user IP, include known proxy headers if needed.
|
12 |
+
*
|
13 |
+
* @since 4.0.3
|
14 |
+
*/
|
15 |
+
function gwolle_gb_get_user_ip() {
|
16 |
+
|
17 |
+
static $user_ip;
|
18 |
+
|
19 |
+
if ( isset($user_ip) ) {
|
20 |
+
return $user_ip;
|
21 |
+
}
|
22 |
+
|
23 |
+
$include_proxy = apply_filters( 'gwolle_gb_include_proxy_ips', false );
|
24 |
+
if ( true === $include_proxy ) {
|
25 |
+
$proxy_headers = array(
|
26 |
+
'HTTP_VIA',
|
27 |
+
'HTTP_X_FORWARDED_FOR',
|
28 |
+
'HTTP_FORWARDED_FOR',
|
29 |
+
'HTTP_X_FORWARDED',
|
30 |
+
'HTTP_FORWARDED',
|
31 |
+
'HTTP_CLIENT_IP',
|
32 |
+
'HTTP_FORWARDED_FOR_IP',
|
33 |
+
'VIA',
|
34 |
+
'X_FORWARDED_FOR',
|
35 |
+
'FORWARDED_FOR',
|
36 |
+
'X_FORWARDED',
|
37 |
+
'FORWARDED',
|
38 |
+
'CLIENT_IP',
|
39 |
+
'FORWARDED_FOR_IP',
|
40 |
+
'HTTP_PROXY_CONNECTION',
|
41 |
+
'REMOTE_ADDR'
|
42 |
+
);
|
43 |
+
foreach ( $proxy_headers as $header ) {
|
44 |
+
if ( isset( $_SERVER[ "$header" ] ) ) {
|
45 |
+
$user_ip = $_SERVER[ "$header" ];
|
46 |
+
break;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
return $user_ip;
|
50 |
+
}
|
51 |
+
|
52 |
+
$user_ip = $_SERVER[ 'REMOTE_ADDR' ];
|
53 |
+
return $user_ip;
|
54 |
+
|
55 |
+
}
|
gwolle-gb.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Gwolle Guestbook
|
4 |
Plugin URI: https://wordpress.org/plugins/gwolle-gb/
|
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: 4.0.
|
7 |
Author: Marcel Pol
|
8 |
Author URI: https://zenoweb.nl
|
9 |
License: GPLv2 or later
|
@@ -32,7 +32,7 @@ Domain Path: /lang/
|
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
-
define('GWOLLE_GB_VER', '4.0.
|
36 |
|
37 |
|
38 |
/*
|
@@ -63,6 +63,8 @@ define('GWOLLE_GB_VER', '4.0.2');
|
|
63 |
* - Use select2 or similar for subscribe/unsubcribe dropdowns.
|
64 |
* - On one-page-design, paging doesn't work correctly in Chrome:
|
65 |
* https://wordpress.org/support/topic/problem-of-text-selection-in-gwolle-guestbook/
|
|
|
|
|
66 |
*
|
67 |
*/
|
68 |
|
@@ -146,6 +148,7 @@ include_once( GWOLLE_GB_DIR . '/functions/gb-settings.php' );
|
|
146 |
include_once( GWOLLE_GB_DIR . '/functions/gb-single-view.php' );
|
147 |
include_once( GWOLLE_GB_DIR . '/functions/gb-stop-forum-spam.php' );
|
148 |
include_once( GWOLLE_GB_DIR . '/functions/gb-user.php' );
|
|
|
149 |
|
150 |
// General Hooks
|
151 |
include_once( GWOLLE_GB_DIR . '/gwolle-gb-hooks.php' );
|
3 |
Plugin Name: Gwolle Guestbook
|
4 |
Plugin URI: https://wordpress.org/plugins/gwolle-gb/
|
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: 4.0.3
|
7 |
Author: Marcel Pol
|
8 |
Author URI: https://zenoweb.nl
|
9 |
License: GPLv2 or later
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
+
define('GWOLLE_GB_VER', '4.0.3');
|
36 |
|
37 |
|
38 |
/*
|
63 |
* - Use select2 or similar for subscribe/unsubcribe dropdowns.
|
64 |
* - On one-page-design, paging doesn't work correctly in Chrome:
|
65 |
* https://wordpress.org/support/topic/problem-of-text-selection-in-gwolle-guestbook/
|
66 |
+
* - On export/import, support user ID and connect it with author email.
|
67 |
+
* - Add author ID to user interface of editor.
|
68 |
*
|
69 |
*/
|
70 |
|
148 |
include_once( GWOLLE_GB_DIR . '/functions/gb-single-view.php' );
|
149 |
include_once( GWOLLE_GB_DIR . '/functions/gb-stop-forum-spam.php' );
|
150 |
include_once( GWOLLE_GB_DIR . '/functions/gb-user.php' );
|
151 |
+
include_once( GWOLLE_GB_DIR . '/functions/gb-user-ip.php' );
|
152 |
|
153 |
// General Hooks
|
154 |
include_once( GWOLLE_GB_DIR . '/gwolle-gb-hooks.php' );
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Gwolle, mpol
|
|
3 |
Tags: guestbook, guest book, livre d'or, Gästebuch, review
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.4
|
6 |
-
Stable tag: 4.0.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
@@ -85,7 +85,7 @@ Current features include:
|
|
85 |
* Admin reply on the frontend with AJAX.
|
86 |
* Edit content of entry on the frontend with AJAX.
|
87 |
* Report Abuse.
|
88 |
-
*
|
89 |
* Easy String Replacement in the default text so you can make this guestbook into a review section or anything you want.
|
90 |
* Delete button in each entry for the moderator and author (optional).
|
91 |
* Permalink button in each entry for easy access (optional).
|
@@ -422,6 +422,19 @@ But if you don't use standard comments, you can just as easily use the comment s
|
|
422 |
|
423 |
== Changelog ==
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
= 4.0.2 =
|
426 |
* 2020-05-15
|
427 |
* Redo dismiss button for form in CSS.
|
3 |
Tags: guestbook, guest book, livre d'or, Gästebuch, review
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.4
|
6 |
+
Stable tag: 4.0.3
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
85 |
* Admin reply on the frontend with AJAX.
|
86 |
* Edit content of entry on the frontend with AJAX.
|
87 |
* Report Abuse.
|
88 |
+
* Blocklist for words and IP address.
|
89 |
* Easy String Replacement in the default text so you can make this guestbook into a review section or anything you want.
|
90 |
* Delete button in each entry for the moderator and author (optional).
|
91 |
* Permalink button in each entry for easy access (optional).
|
422 |
|
423 |
== Changelog ==
|
424 |
|
425 |
+
= 4.0.3 =
|
426 |
+
* 2020-06-21
|
427 |
+
* Remove ':' from form labels.
|
428 |
+
* Remove part of the label for anti-spam question.
|
429 |
+
* Fix class of messages on error (red/green).
|
430 |
+
* Fixed a few actions for 'gwolle_gb_save_entry_admin'.
|
431 |
+
* Remove 'gwolle_gb_antispam_label' filter.
|
432 |
+
* Metabox opens now with a softer fade effect.
|
433 |
+
* Use standard From addres 'wordpress@domain.com' as default.
|
434 |
+
* Add function 'gwolle_gb_get_user_ip()' for CDN or proxy.
|
435 |
+
* Add filter 'gwolle_gb_include_proxy_ips' for using this with a CDN or proxy.
|
436 |
+
* Fix bugs in book_id functions.
|
437 |
+
|
438 |
= 4.0.2 =
|
439 |
* 2020-05-15
|
440 |
* Redo dismiss button for form in CSS.
|