Version Description
- 2020-07-21
- Add blocklist (taken from add-on).
- Also use blocklist from WordPress Core.
- Fix datetime in RSS to be RFC 822 compliant.
- Add support for user ID in import (based on email address).
- Support editing of author ID in Editor.
- Add class 'gwolle-gb-widget' to widget 'ul' element.
- Fix saving certain settings on some hosts.
- Update strings for add-on.
Download this release
Release Info
Developer | mpol |
Plugin | Gwolle Guestbook |
Version | 4.0.5 |
Comparing to | |
See all releases |
Code changes from version 4.0.3 to 4.0.5
- add-on/gb-add-on.php +4 -12
- admin/gb-page-add-on.php +0 -1
- admin/gb-page-editor.php +22 -4
- admin/gb-page-import.php +8 -1
- admin/gb-page-settings.php +15 -6
- admin/gwolle-gb-hooks.php +7 -2
- admin/tabs/gb-antispamtab.php +13 -0
- frontend/gb-blocklist.php +105 -0
- frontend/gb-rss.php +7 -3
- frontend/gb-widget.php +1 -1
- functions/gb-settings.php +1 -0
- gwolle-gb.php +20 -22
- readme.txt +17 -3
add-on/gb-add-on.php
CHANGED
@@ -29,8 +29,6 @@ function gwolle_gb_addon_translation_strings() {
|
|
29 |
esc_html_e('Social Media', 'gwolle-gb');
|
30 |
/* translators: Commercial Add-On: Settings page tab */
|
31 |
esc_html_e('Star Rating', 'gwolle-gb');
|
32 |
-
/* translators: Commercial Add-On: Settings page tab (typo in 1.0.4) */
|
33 |
-
esc_html_e('Miscellanious', 'gwolle-gb');
|
34 |
/* translators: Commercial Add-On: Settings page tab */
|
35 |
esc_html_e('Miscellaneous', 'gwolle-gb');
|
36 |
/* translators: Commercial Add-On: Settings page tab */
|
@@ -186,8 +184,6 @@ Entry content:
|
|
186 |
/* translators: Settings page, option for delete link */
|
187 |
esc_html_e('Delete link', 'gwolle-gb');
|
188 |
/* translators: Commercial Add-On */
|
189 |
-
esc_html_e('Show delete link in Metabox.', 'gwolle-gb'); // deprecated since 1.0.3
|
190 |
-
/* translators: Commercial Add-On */
|
191 |
esc_html_e('Show delete link in Metabox for moderators.', 'gwolle-gb');
|
192 |
/* translators: Commercial Add-On */
|
193 |
esc_html_e('Show delete link in Metabox for author.', 'gwolle-gb');
|
@@ -261,6 +257,10 @@ Entry content:
|
|
261 |
esc_html_e('Show Average Star Rating', 'gwolle-gb');
|
262 |
/* translators: Commercial Add-On */
|
263 |
esc_html_e('The average will be shown above the list of entries.', 'gwolle-gb');
|
|
|
|
|
|
|
|
|
264 |
|
265 |
// function gwolle_gb_addon_page_settingstab_strings() {
|
266 |
/* translators: Commercial Add-On */
|
@@ -281,16 +281,8 @@ Entry content:
|
|
281 |
// function gwolle_gb_addon_page_settingstab_abuse() {
|
282 |
/* translators: Commercial Add-On */
|
283 |
esc_html_e('Enable report abuse link in Metabox.', 'gwolle-gb');
|
284 |
-
/* translators: Commercial Add-On, obsoleted because of typo */
|
285 |
-
esc_html_e('Vistors can report abusive entries through a link in the metabox.', 'gwolle-gb'); // in version 1.2.1 and older.
|
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 |
|
295 |
// gwolle_gb_addon_editor_metabox_meta()
|
296 |
/* translators: Commercial Add-On, metabox on editor */
|
29 |
esc_html_e('Social Media', 'gwolle-gb');
|
30 |
/* translators: Commercial Add-On: Settings page tab */
|
31 |
esc_html_e('Star Rating', 'gwolle-gb');
|
|
|
|
|
32 |
/* translators: Commercial Add-On: Settings page tab */
|
33 |
esc_html_e('Miscellaneous', 'gwolle-gb');
|
34 |
/* translators: Commercial Add-On: Settings page tab */
|
184 |
/* translators: Settings page, option for delete link */
|
185 |
esc_html_e('Delete link', 'gwolle-gb');
|
186 |
/* translators: Commercial Add-On */
|
|
|
|
|
187 |
esc_html_e('Show delete link in Metabox for moderators.', 'gwolle-gb');
|
188 |
/* translators: Commercial Add-On */
|
189 |
esc_html_e('Show delete link in Metabox for author.', 'gwolle-gb');
|
257 |
esc_html_e('Show Average Star Rating', 'gwolle-gb');
|
258 |
/* translators: Commercial Add-On */
|
259 |
esc_html_e('The average will be shown above the list of entries.', 'gwolle-gb');
|
260 |
+
/* translators: Commercial Add-On */
|
261 |
+
esc_html_e('Subject for Star Rating', 'gwolle-gb');
|
262 |
+
/* translators: Commercial Add-On */
|
263 |
+
esc_html_e('Subject for Average Star Rating, used by Search Engines.', 'gwolle-gb');
|
264 |
|
265 |
// function gwolle_gb_addon_page_settingstab_strings() {
|
266 |
/* translators: Commercial Add-On */
|
281 |
// function gwolle_gb_addon_page_settingstab_abuse() {
|
282 |
/* translators: Commercial Add-On */
|
283 |
esc_html_e('Enable report abuse link in Metabox.', 'gwolle-gb');
|
|
|
|
|
284 |
/* translators: Commercial Add-On */
|
285 |
esc_html_e('Visitors can report abusive entries through a link in the metabox.', 'gwolle-gb');
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
|
287 |
// gwolle_gb_addon_editor_metabox_meta()
|
288 |
/* translators: Commercial Add-On, metabox on editor */
|
admin/gb-page-add-on.php
CHANGED
@@ -87,7 +87,6 @@ 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__('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>
|
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__('Easy String Replacement in the default text so you can make this guestbook into a review section or anything you want.','gwolle-gb').'</li>
|
91 |
<li>' . esc_html__('Delete button in each entry for the moderator and author (optional).','gwolle-gb').'</li>
|
92 |
<li>' . esc_html__('Permalink button in each entry for easy access (optional).','gwolle-gb').'</li>
|
admin/gb-page-editor.php
CHANGED
@@ -461,12 +461,22 @@ function gwolle_gb_editor_postbox_logs( $entry ) {
|
|
461 |
*/
|
462 |
function gwolle_gb_editor_meta_inputs( $entry ) {
|
463 |
global $wp_locale;
|
464 |
-
|
465 |
?>
|
466 |
-
<label for="gwolle_gb_author_name"><?php esc_html_e('Author', 'gwolle-gb');
|
467 |
<input type="text" name="gwolle_gb_author_name" size="24" value="<?php echo gwolle_gb_sanitize_output( $entry->get_author_name() ); ?>" id="gwolle_gb_author_name" class="wp-exclude-emoji" /><br />
|
468 |
|
469 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
<div class="gwolle_gb_date"><?php
|
471 |
|
472 |
$date = $entry->get_datetime();
|
@@ -511,7 +521,7 @@ function gwolle_gb_editor_meta_inputs( $entry ) {
|
|
511 |
</div>
|
512 |
</div>
|
513 |
|
514 |
-
<label for="gwolle_gb_book_id"><?php esc_html_e('Book ID', 'gwolle-gb');
|
515 |
<input type="text" name="gwolle_gb_book_id" size="4" value="<?php echo (int) $entry->get_book_id(); ?>" id="gwolle_gb_book_id" />
|
516 |
|
517 |
<p>
|
@@ -673,6 +683,14 @@ function gwolle_gb_page_editor_update( $entry ) {
|
|
673 |
}
|
674 |
}
|
675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
/* Check if the datetime changed, and update from all input. */
|
677 |
if ( isset($_POST['gwolle_gb_timestamp']) && is_numeric($_POST['gwolle_gb_timestamp']) ) {
|
678 |
$timestamp = (int) $_POST['gwolle_gb_timestamp'];
|
461 |
*/
|
462 |
function gwolle_gb_editor_meta_inputs( $entry ) {
|
463 |
global $wp_locale;
|
|
|
464 |
?>
|
465 |
+
<label for="gwolle_gb_author_name"><?php esc_html_e('Author', 'gwolle-gb'); ?></label><br />
|
466 |
<input type="text" name="gwolle_gb_author_name" size="24" value="<?php echo gwolle_gb_sanitize_output( $entry->get_author_name() ); ?>" id="gwolle_gb_author_name" class="wp-exclude-emoji" /><br />
|
467 |
|
468 |
+
<label for="gwolle_gb_author_id"><?php esc_html_e('Author ID', 'gwolle-gb');
|
469 |
+
// Get user ID from email address.
|
470 |
+
$user = new WP_User;
|
471 |
+
$user_object = $user->get_data_by( 'email', gwolle_gb_sanitize_output( $entry->get_author_email() ) );
|
472 |
+
if ( is_object( $user_object ) && isset( $user_object->ID ) ) {
|
473 |
+
/* translators: %s is the user ID that is suggested. */
|
474 |
+
echo ' ' . sprintf( esc_html__('(suggested %s)', 'gwolle-gb'), $user_object->ID );
|
475 |
+
}
|
476 |
+
?></label><br />
|
477 |
+
<input type="text" name="gwolle_gb_author_id" size="6" value="<?php echo (int) ( $entry->get_author_id() ); ?>" id="gwolle_gb_author_id" class="wp-exclude-emoji" /><br />
|
478 |
+
|
479 |
+
<span><?php esc_html_e('Date and time', 'gwolle-gb'); ?> </span><br />
|
480 |
<div class="gwolle_gb_date"><?php
|
481 |
|
482 |
$date = $entry->get_datetime();
|
521 |
</div>
|
522 |
</div>
|
523 |
|
524 |
+
<label for="gwolle_gb_book_id"><?php esc_html_e('Book ID', 'gwolle-gb'); ?></label><br />
|
525 |
<input type="text" name="gwolle_gb_book_id" size="4" value="<?php echo (int) $entry->get_book_id(); ?>" id="gwolle_gb_book_id" />
|
526 |
|
527 |
<p>
|
683 |
}
|
684 |
}
|
685 |
|
686 |
+
/* Check if the author_id changed, and update accordingly */
|
687 |
+
if ( isset($_POST['gwolle_gb_author_id']) ) {
|
688 |
+
if ( $_POST['gwolle_gb_author_id'] != $entry->get_author_id() ) {
|
689 |
+
$entry_author_id = (int) $_POST['gwolle_gb_author_id'];
|
690 |
+
$entry->set_author_id( $entry_author_id );
|
691 |
+
}
|
692 |
+
}
|
693 |
+
|
694 |
/* Check if the datetime changed, and update from all input. */
|
695 |
if ( isset($_POST['gwolle_gb_timestamp']) && is_numeric($_POST['gwolle_gb_timestamp']) ) {
|
696 |
$timestamp = (int) $_POST['gwolle_gb_timestamp'];
|
admin/gb-page-import.php
CHANGED
@@ -621,7 +621,14 @@ function gwolle_gb_page_import_post() {
|
|
621 |
}
|
622 |
$metas = ''; // reset
|
623 |
if ( isset( $data[14] ) ) {
|
624 |
-
$metas = $data[14]; // meta fields is only since
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
}
|
626 |
|
627 |
/* Save the instance */
|
621 |
}
|
622 |
$metas = ''; // reset
|
623 |
if ( isset( $data[14] ) ) {
|
624 |
+
$metas = $data[14]; // meta fields is only since 2.4.0
|
625 |
+
}
|
626 |
+
|
627 |
+
// Support author ID, based on email address.
|
628 |
+
$user = new WP_User;
|
629 |
+
$user_object = $user->get_data_by( 'email', $data[2] );
|
630 |
+
if ( is_object( $user_object ) && isset( $user_object->ID ) ) {
|
631 |
+
$entry->set_author_id( $user_object->ID );
|
632 |
}
|
633 |
|
634 |
/* Save the instance */
|
admin/gb-page-settings.php
CHANGED
@@ -189,10 +189,10 @@ function gwolle_gb_page_settings_update() {
|
|
189 |
);
|
190 |
$form_setting = Array();
|
191 |
foreach ( $list as $item ) {
|
192 |
-
if ( isset($_POST[$item]) && $_POST[$item] == 'on' ) {
|
193 |
-
$form_setting[$item] = 'true';
|
194 |
} else {
|
195 |
-
$form_setting[$item] = 'false';
|
196 |
}
|
197 |
}
|
198 |
update_option( 'gwolle_gb-form', $form_setting );
|
@@ -266,10 +266,10 @@ function gwolle_gb_page_settings_update() {
|
|
266 |
);
|
267 |
$read_setting = Array();
|
268 |
foreach ( $list as $item ) {
|
269 |
-
if ( isset($_POST[$item]) && $_POST[$item] == 'on' ) {
|
270 |
-
$read_setting[$item] = 'true';
|
271 |
} else {
|
272 |
-
$read_setting[$item] = 'false';
|
273 |
}
|
274 |
}
|
275 |
update_option( 'gwolle_gb-read', $read_setting );
|
@@ -372,6 +372,15 @@ function gwolle_gb_page_settings_update() {
|
|
372 |
update_option('gwolle_gb-antispam-answer', gwolle_gb_sanitize_input($_POST['antispam-answer']));
|
373 |
}
|
374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
break;
|
376 |
case 'gwolle_gb_mail':
|
377 |
|
189 |
);
|
190 |
$form_setting = Array();
|
191 |
foreach ( $list as $item ) {
|
192 |
+
if ( isset($_POST["$item"]) && $_POST["$item"] == 'on' ) {
|
193 |
+
$form_setting["$item"] = 'true';
|
194 |
} else {
|
195 |
+
$form_setting["$item"] = 'false';
|
196 |
}
|
197 |
}
|
198 |
update_option( 'gwolle_gb-form', $form_setting );
|
266 |
);
|
267 |
$read_setting = Array();
|
268 |
foreach ( $list as $item ) {
|
269 |
+
if ( isset($_POST["$item"]) && $_POST["$item"] == 'on' ) {
|
270 |
+
$read_setting["$item"] = 'true';
|
271 |
} else {
|
272 |
+
$read_setting["$item"] = 'false';
|
273 |
}
|
274 |
}
|
275 |
update_option( 'gwolle_gb-read', $read_setting );
|
372 |
update_option('gwolle_gb-antispam-answer', gwolle_gb_sanitize_input($_POST['antispam-answer']));
|
373 |
}
|
374 |
|
375 |
+
if ( isset($_POST['gb_moderation_keys']) ) {
|
376 |
+
$blocklist = gwolle_gb_sanitize_input( $_POST['gb_moderation_keys'], 'setting_textarea' );
|
377 |
+
$blocklist = explode( "\n", $blocklist );
|
378 |
+
$blocklist = array_filter( array_map( 'trim', $blocklist ) );
|
379 |
+
$blocklist = array_unique( $blocklist );
|
380 |
+
$blocklist = implode( "\n", $blocklist );
|
381 |
+
update_option('gwolle_gb_addon-moderation_keys', $blocklist);
|
382 |
+
}
|
383 |
+
|
384 |
break;
|
385 |
case 'gwolle_gb_mail':
|
386 |
|
admin/gwolle-gb-hooks.php
CHANGED
@@ -23,6 +23,11 @@ function gwolle_gb_adminmenu() {
|
|
23 |
* add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' )
|
24 |
*/
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
// Counter
|
27 |
$count_unchecked = get_transient( 'gwolle_gb_menu_counter' );
|
28 |
if ( false === $count_unchecked ) {
|
@@ -97,8 +102,8 @@ function gwolle_gb_admin_enqueue() {
|
|
97 |
* Add Settings link to the main plugin page
|
98 |
*/
|
99 |
function gwolle_gb_links( $links, $file ) {
|
100 |
-
if ( $file ==
|
101 |
-
$links[] = '<a href="' . admin_url( 'admin.php?page=gwolle-gb/settings.php' ) . '">'.
|
102 |
}
|
103 |
return $links;
|
104 |
}
|
23 |
* add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' )
|
24 |
*/
|
25 |
|
26 |
+
/*
|
27 |
+
* How to add new sub-menu-entries:
|
28 |
+
* add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null )
|
29 |
+
*/
|
30 |
+
|
31 |
// Counter
|
32 |
$count_unchecked = get_transient( 'gwolle_gb_menu_counter' );
|
33 |
if ( false === $count_unchecked ) {
|
102 |
* Add Settings link to the main plugin page
|
103 |
*/
|
104 |
function gwolle_gb_links( $links, $file ) {
|
105 |
+
if ( $file == GWOLLE_GB_FOLDER . '/gwolle-gb.php' ) {
|
106 |
+
$links[] = '<a href="' . admin_url( 'admin.php?page=gwolle-gb/settings.php' ) . '">' . esc_html__( 'Settings', 'gwolle-gb' ).'</a>';
|
107 |
}
|
108 |
return $links;
|
109 |
}
|
admin/tabs/gb-antispamtab.php
CHANGED
@@ -249,6 +249,19 @@ function gwolle_gb_page_settingstab_antispam() {
|
|
249 |
</td>
|
250 |
</tr>
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
<tr>
|
253 |
<th colspan="2">
|
254 |
<p class="submit">
|
249 |
</td>
|
250 |
</tr>
|
251 |
|
252 |
+
<tr>
|
253 |
+
<th scope="row"><label for="gb_moderation_keys"><?php esc_html_e( 'Blocklist Moderation', 'gwolle-gb' ); ?></label></th>
|
254 |
+
<td>
|
255 |
+
<label for="gb_moderation_keys">
|
256 |
+
<?php esc_html_e('Enter words for the blocklist.', 'gwolle-gb'); ?>
|
257 |
+
</label><br />
|
258 |
+
<textarea name="gb_moderation_keys" rows="10" cols="50" id="gb_moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'gwolle_gb_addon-moderation_keys' ) ); ?></textarea>
|
259 |
+
<span class="setting-description">
|
260 |
+
<?php 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' ); ?>
|
261 |
+
</span>
|
262 |
+
</td>
|
263 |
+
</tr>
|
264 |
+
|
265 |
<tr>
|
266 |
<th colspan="2">
|
267 |
<p class="submit">
|
frontend/gb-blocklist.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/*
|
5 |
+
* Check frontend form for blocklisted words.
|
6 |
+
* Borrowed from wp-includes/comment.php check_comment().
|
7 |
+
* Uses blocklisted words from WordPress Core and Guestbook settings.
|
8 |
+
*
|
9 |
+
* @since 4.0.5
|
10 |
+
*
|
11 |
+
* @param string $entry the guestbook entry the metadata belongs to.
|
12 |
+
*
|
13 |
+
* @return none.
|
14 |
+
*/
|
15 |
+
function gwolle_gb_blocklist( $entry ) {
|
16 |
+
|
17 |
+
$wp_mod_keys = trim( get_option( 'moderation_keys' ) );
|
18 |
+
$gb_mod_keys = trim( get_option( 'gwolle_gb_addon-moderation_keys' ) );
|
19 |
+
$send_to_moderation = false;
|
20 |
+
|
21 |
+
// If moderation 'keys' (keywords) are set, process them.
|
22 |
+
$wp_words = array();
|
23 |
+
$gb_words = array();
|
24 |
+
if ( ! empty( $wp_mod_keys ) ) {
|
25 |
+
$wp_words = explode( "\n", $wp_mod_keys );
|
26 |
+
}
|
27 |
+
if ( ! empty( $gb_mod_keys ) ) {
|
28 |
+
$gb_words = explode( "\n", $gb_mod_keys );
|
29 |
+
}
|
30 |
+
$words = array_merge( $wp_words, $gb_words );
|
31 |
+
|
32 |
+
if ( ! empty( $words ) ) {
|
33 |
+
foreach ( (array) $words as $word ) {
|
34 |
+
$word = trim( $word );
|
35 |
+
|
36 |
+
// Skip empty lines.
|
37 |
+
if ( empty( $word ) ) {
|
38 |
+
continue;
|
39 |
+
}
|
40 |
+
|
41 |
+
/*
|
42 |
+
* Do some escaping magic so that '#' (number of) characters in the spam
|
43 |
+
* words don't break things:
|
44 |
+
*/
|
45 |
+
$word = preg_quote( $word, '#' );
|
46 |
+
|
47 |
+
/*
|
48 |
+
* Check the comment fields for moderation keywords. If any are found,
|
49 |
+
* fail the check for the given field by returning false.
|
50 |
+
*/
|
51 |
+
$pattern = "#$word#i";
|
52 |
+
$author = $entry->get_author_name();
|
53 |
+
if ( preg_match( $pattern, $author ) ) {
|
54 |
+
$send_to_moderation = true;
|
55 |
+
}
|
56 |
+
$email = $entry->get_author_email();
|
57 |
+
if ( preg_match( $pattern, $email ) ) {
|
58 |
+
$send_to_moderation = true;
|
59 |
+
}
|
60 |
+
$origin = $entry->get_author_origin();
|
61 |
+
if ( preg_match( $pattern, $origin ) ) {
|
62 |
+
$send_to_moderation = true;
|
63 |
+
}
|
64 |
+
$website = $entry->get_author_website();
|
65 |
+
if ( preg_match( $pattern, $website ) ) {
|
66 |
+
$send_to_moderation = true;
|
67 |
+
}
|
68 |
+
$content = $entry->get_content();
|
69 |
+
if ( preg_match( $pattern, $content ) ) {
|
70 |
+
$send_to_moderation = true;
|
71 |
+
}
|
72 |
+
$user_ip = gwolle_gb_addon_get_user_ip();
|
73 |
+
if ( preg_match( $pattern, $user_ip ) ) {
|
74 |
+
$send_to_moderation = true;
|
75 |
+
}
|
76 |
+
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
77 |
+
if ( preg_match( $pattern, $user_agent ) ) {
|
78 |
+
$send_to_moderation = true;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( $send_to_moderation == true ) {
|
84 |
+
$entry->set_ischecked( false );
|
85 |
+
}
|
86 |
+
|
87 |
+
return $entry;
|
88 |
+
|
89 |
+
}
|
90 |
+
add_filter( 'gwolle_gb_new_entry_frontend', 'gwolle_gb_blocklist' );
|
91 |
+
|
92 |
+
|
93 |
+
/*
|
94 |
+
* Disable frontend form for blocklisted words in Add-On.
|
95 |
+
*
|
96 |
+
* @since 4.0.5
|
97 |
+
*
|
98 |
+
* @return none.
|
99 |
+
*/
|
100 |
+
function gwolle_gb_disable_addon_blocklist() {
|
101 |
+
|
102 |
+
remove_filter( 'gwolle_gb_new_entry_frontend', 'gwolle_gb_addon_blacklist' );
|
103 |
+
|
104 |
+
}
|
105 |
+
add_action('init', 'gwolle_gb_disable_addon_blocklist');
|
frontend/gb-rss.php
CHANGED
@@ -78,11 +78,15 @@ function gwolle_gb_rss() {
|
|
78 |
)
|
79 |
);
|
80 |
|
|
|
|
|
|
|
|
|
81 |
/* Get the time of the last entry, else of the last edited post */
|
82 |
if ( is_array($entries) && !empty($entries) ) {
|
83 |
-
$lastbuild = gmdate(
|
84 |
} else {
|
85 |
-
$lastbuild = mysql2date(
|
86 |
}
|
87 |
|
88 |
$blog_url = get_bloginfo('wpurl');
|
@@ -144,7 +148,7 @@ function gwolle_gb_rss() {
|
|
144 |
$permalink = add_query_arg( 'entry_id', $entry->get_id(), $permalink );
|
145 |
$permalink = htmlspecialchars($permalink, ENT_COMPAT, 'UTF-8');
|
146 |
echo $permalink; ?></link>
|
147 |
-
<pubDate><?php echo gmdate(
|
148 |
<dc:creator><?php echo trim( $entry->get_author_name() ); ?></dc:creator>
|
149 |
<guid isPermaLink="false"><?php echo $permalink; ?></guid>
|
150 |
<description><![CDATA[<?php echo wp_trim_words( $entry->get_content(), 12, '...' ) ?>]]></description>
|
78 |
)
|
79 |
);
|
80 |
|
81 |
+
// Date in RFC 822.
|
82 |
+
$timezone = date_i18n('O'); // +0200 for example
|
83 |
+
$datetimeformat = 'd M Y H:i:s';
|
84 |
+
|
85 |
/* Get the time of the last entry, else of the last edited post */
|
86 |
if ( is_array($entries) && !empty($entries) ) {
|
87 |
+
$lastbuild = gmdate( $datetimeformat, $entries[0]->get_datetime() ) . ' ' . $timezone;
|
88 |
} else {
|
89 |
+
$lastbuild = mysql2date($datetimeformat, get_lastpostmodified('GMT'), false) . ' GMT';
|
90 |
}
|
91 |
|
92 |
$blog_url = get_bloginfo('wpurl');
|
148 |
$permalink = add_query_arg( 'entry_id', $entry->get_id(), $permalink );
|
149 |
$permalink = htmlspecialchars($permalink, ENT_COMPAT, 'UTF-8');
|
150 |
echo $permalink; ?></link>
|
151 |
+
<pubDate><?php echo gmdate( $datetimeformat, $entry->get_datetime() ) . ' ' . $timezone; ?></pubDate>
|
152 |
<dc:creator><?php echo trim( $entry->get_author_name() ); ?></dc:creator>
|
153 |
<guid isPermaLink="false"><?php echo $permalink; ?></guid>
|
154 |
<description><![CDATA[<?php echo wp_trim_words( $entry->get_content(), 12, '...' ) ?>]]></description>
|
frontend/gb-widget.php
CHANGED
@@ -57,7 +57,7 @@ if (function_exists('register_sidebar') && class_exists('WP_Widget')) {
|
|
57 |
$html5 = current_theme_supports( 'html5' );
|
58 |
|
59 |
// Prepare for SSS Slider. Registers Script with WordPress to wp_footer().
|
60 |
-
$widget_class = 'gwolle_gb_widget';
|
61 |
if ( $slider ) {
|
62 |
wp_register_script( 'gwolle_gb_widget_sss', GWOLLE_GB_URL . '/frontend/js/sss/sss.js', 'jquery', GWOLLE_GB_VER, true );
|
63 |
wp_enqueue_script( 'gwolle_gb_widget_sss' );
|
57 |
$html5 = current_theme_supports( 'html5' );
|
58 |
|
59 |
// Prepare for SSS Slider. Registers Script with WordPress to wp_footer().
|
60 |
+
$widget_class = 'gwolle_gb_widget gwolle-gb-widget';
|
61 |
if ( $slider ) {
|
62 |
wp_register_script( 'gwolle_gb_widget_sss', GWOLLE_GB_URL . '/frontend/js/sss/sss.js', 'jquery', GWOLLE_GB_VER, true );
|
63 |
wp_enqueue_script( 'gwolle_gb_widget_sss' );
|
functions/gb-settings.php
CHANGED
@@ -12,6 +12,7 @@ if ( strpos($_SERVER['PHP_SELF'], basename(__FILE__) )) {
|
|
12 |
*/
|
13 |
function gwolle_gb_register_settings() {
|
14 |
// option_name sanitize default value
|
|
|
15 |
register_setting( 'gwolle_gb_options', 'gwolle_gb-admin_style', 'strval' ); // 'false'
|
16 |
register_setting( 'gwolle_gb_options', 'gwolle_gb-adminMailContent', 'strval' ); // empty by default
|
17 |
register_setting( 'gwolle_gb_options', 'gwolle_gb-akismet-active', 'strval' ); // 'false'
|
12 |
*/
|
13 |
function gwolle_gb_register_settings() {
|
14 |
// option_name sanitize default value
|
15 |
+
register_setting( 'gwolle_gb_options', 'gwolle_gb_addon-moderation_keys', 'strval' ); // 'true', taken from the Add-On since 4.0.4
|
16 |
register_setting( 'gwolle_gb_options', 'gwolle_gb-admin_style', 'strval' ); // 'false'
|
17 |
register_setting( 'gwolle_gb_options', 'gwolle_gb-adminMailContent', 'strval' ); // empty by default
|
18 |
register_setting( 'gwolle_gb_options', 'gwolle_gb-akismet-active', 'strval' ); // 'false'
|
gwolle-gb.php
CHANGED
@@ -3,36 +3,35 @@
|
|
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
|
10 |
Text Domain: gwolle-gb
|
11 |
Domain Path: /lang/
|
12 |
-
*/
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
*/
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
-
define('GWOLLE_GB_VER', '4.0.
|
36 |
|
37 |
|
38 |
/*
|
@@ -63,8 +62,6 @@ define('GWOLLE_GB_VER', '4.0.3');
|
|
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 |
|
@@ -89,6 +86,7 @@ include_once( GWOLLE_GB_DIR . '/functions/gb-class-entry.php' );
|
|
89 |
|
90 |
// Functions for the frontend
|
91 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-ajax-infinite-scroll.php' );
|
|
|
92 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-form.php' );
|
93 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-form-ajax.php' );
|
94 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-form-posthandling.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.5
|
7 |
Author: Marcel Pol
|
8 |
Author URI: https://zenoweb.nl
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: gwolle-gb
|
11 |
Domain Path: /lang/
|
|
|
12 |
|
13 |
+
|
14 |
+
Copyright 2009 - 2010 Wolfgang Timme (email: gwolle@wolfgangtimme.de)
|
15 |
+
Copyright 2014 - 2020 Marcel Pol (email: marcel@timelord.nl)
|
16 |
+
|
17 |
+
This program is free software; you can redistribute it and/or modify
|
18 |
+
it under the terms of the GNU General Public License as published by
|
19 |
+
the Free Software Foundation; either version 2 of the License, or
|
20 |
+
(at your option) any later version.
|
21 |
+
|
22 |
+
This program is distributed in the hope that it will be useful,
|
23 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
GNU General Public License for more details.
|
26 |
+
|
27 |
+
You should have received a copy of the GNU General Public License
|
28 |
+
along with this program; if not, write to the Free Software
|
29 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
30 |
*/
|
31 |
|
32 |
|
33 |
// Plugin Version
|
34 |
+
define('GWOLLE_GB_VER', '4.0.5');
|
35 |
|
36 |
|
37 |
/*
|
62 |
* - Use select2 or similar for subscribe/unsubcribe dropdowns.
|
63 |
* - On one-page-design, paging doesn't work correctly in Chrome:
|
64 |
* https://wordpress.org/support/topic/problem-of-text-selection-in-gwolle-guestbook/
|
|
|
|
|
65 |
*
|
66 |
*/
|
67 |
|
86 |
|
87 |
// Functions for the frontend
|
88 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-ajax-infinite-scroll.php' );
|
89 |
+
include_once( GWOLLE_GB_DIR . '/frontend/gb-blocklist.php' );
|
90 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-form.php' );
|
91 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-form-ajax.php' );
|
92 |
include_once( GWOLLE_GB_DIR . '/frontend/gb-form-posthandling.php' );
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
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.
|
6 |
-
Stable tag: 4.0.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
@@ -85,7 +85,6 @@ 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 |
-
* 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,6 +421,21 @@ But if you don't use standard comments, you can just as easily use the comment s
|
|
422 |
|
423 |
== Changelog ==
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
= 4.0.3 =
|
426 |
* 2020-06-21
|
427 |
* Remove ':' from form labels.
|
2 |
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.5
|
6 |
+
Stable tag: 4.0.5
|
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 |
* Easy String Replacement in the default text so you can make this guestbook into a review section or anything you want.
|
89 |
* Delete button in each entry for the moderator and author (optional).
|
90 |
* Permalink button in each entry for easy access (optional).
|
421 |
|
422 |
== Changelog ==
|
423 |
|
424 |
+
= 4.0.5 =
|
425 |
+
* 2020-07-21
|
426 |
+
* Add blocklist (taken from add-on).
|
427 |
+
* Also use blocklist from WordPress Core.
|
428 |
+
* Fix datetime in RSS to be RFC 822 compliant.
|
429 |
+
* Add support for user ID in import (based on email address).
|
430 |
+
* Support editing of author ID in Editor.
|
431 |
+
* Add class 'gwolle-gb-widget' to widget 'ul' element.
|
432 |
+
* Fix saving certain settings on some hosts.
|
433 |
+
* Update strings for add-on.
|
434 |
+
|
435 |
+
= 4.0.4 =
|
436 |
+
* 2020-06-21
|
437 |
+
* Fix svn issue.
|
438 |
+
|
439 |
= 4.0.3 =
|
440 |
* 2020-06-21
|
441 |
* Remove ':' from form labels.
|