Version Description
- 2020-01-21
- Add highlight to search results (thanks @robinnatter).
- Add searchwords to search widget after searching.
- Do not set meta_key when shortcode is used in widget or one-page design.
- Show InnoDB engine on debug tab.
- Show existence of database tables on debug tab.
Download this release
Release Info
Developer | mpol |
Plugin | Gwolle Guestbook |
Version | 3.1.8 |
Comparing to | |
See all releases |
Code changes from version 3.1.7 to 3.1.8
- add-on/gb-add-on.php +8 -1
- admin/tabs/gb-formtab.php +1 -1
- docs/filters/{gwolle_gb_bbode_image_referrer.txt → gwolle_gb_bbode_img_referrer.txt} +0 -0
- docs/filters/gwolle_gb_button.txt +1 -1
- docs/filters/gwolle_gb_entry_the_admin_reply.txt +27 -0
- docs/filters/gwolle_gb_entry_the_author_name.txt +27 -0
- docs/filters/gwolle_gb_entry_the_content.txt +27 -0
- frontend/css/gwolle-gb-frontend.css +3 -0
- frontend/gb-shortcodes.php +0 -10
- frontend/gb-widget-search.php +7 -1
- frontend/gwolle_gb-entry.php +8 -2
- functions/gb-debug.php +63 -0
- functions/gb-formatting.php +29 -0
- functions/gb-get_entries_from_search.php +28 -0
- functions/gb-post-meta.php +44 -22
- functions/gb-user.php +2 -1
- gwolle-gb.php +5 -6
- readme.txt +9 -1
add-on/gb-add-on.php
CHANGED
@@ -121,7 +121,9 @@ Entry content:
|
|
121 |
esc_html_e('The slug of the field is where your data is attached to. Only change the slug if you know what you are doing.', 'gwolle-gb');
|
122 |
/* translators: Commercial Add-On */
|
123 |
esc_html_e('The name of the field is what you will see in the label and placeholder in the form.', 'gwolle-gb');
|
124 |
-
/* translators: Commercial Add-On.
|
|
|
|
|
125 |
esc_html_e('Top', 'gwolle-gb');
|
126 |
/* translators: Commercial Add-On */
|
127 |
esc_html_e('Slug:', 'gwolle-gb');
|
@@ -262,6 +264,8 @@ Entry content:
|
|
262 |
|
263 |
// gwolle_gb_addon_editor_metabox_meta()
|
264 |
/* translators: Commercial Add-On, metabox on editor */
|
|
|
|
|
265 |
esc_html__('Abuse Reports', 'gwolle-gb');
|
266 |
/* translators: Commercial Add-On, remove abuse reports and moderate entry */
|
267 |
esc_html__('Remove and moderate', 'gwolle-gb');
|
@@ -277,4 +281,7 @@ Entry content:
|
|
277 |
__( 'When visitors report an entry as abusive, the entry ID will be stored in a cookie in the browser. For fallback, the IP address will be saved temporarily as a transient in the database together with the number of reports.', 'gwolle-gb' ); // 1.2.1 and older
|
278 |
/* translators: Commercial Add-On. Text for privacy policy. */
|
279 |
__( 'When visitors report an entry as abusive, the entry ID will be stored in a cookie in the browser. Also, the IP address will be saved temporarily in the database together with the number of reports.', 'gwolle-gb' );
|
|
|
|
|
|
|
280 |
}
|
121 |
esc_html_e('The slug of the field is where your data is attached to. Only change the slug if you know what you are doing.', 'gwolle-gb');
|
122 |
/* translators: Commercial Add-On */
|
123 |
esc_html_e('The name of the field is what you will see in the label and placeholder in the form.', 'gwolle-gb');
|
124 |
+
/* translators: Commercial Add-On. */
|
125 |
+
esc_html_e('Required:', 'gwolle-gb');
|
126 |
+
/* translators: Commercial Add-On. */
|
127 |
esc_html_e('Top', 'gwolle-gb');
|
128 |
/* translators: Commercial Add-On */
|
129 |
esc_html_e('Slug:', 'gwolle-gb');
|
264 |
|
265 |
// gwolle_gb_addon_editor_metabox_meta()
|
266 |
/* translators: Commercial Add-On, metabox on editor */
|
267 |
+
esc_html__('There are no Meta Fields saved in settings yet.','gwolle-gb');
|
268 |
+
/* translators: Commercial Add-On, metabox on editor */
|
269 |
esc_html__('Abuse Reports', 'gwolle-gb');
|
270 |
/* translators: Commercial Add-On, remove abuse reports and moderate entry */
|
271 |
esc_html__('Remove and moderate', 'gwolle-gb');
|
281 |
__( 'When visitors report an entry as abusive, the entry ID will be stored in a cookie in the browser. For fallback, the IP address will be saved temporarily as a transient in the database together with the number of reports.', 'gwolle-gb' ); // 1.2.1 and older
|
282 |
/* translators: Commercial Add-On. Text for privacy policy. */
|
283 |
__( 'When visitors report an entry as abusive, the entry ID will be stored in a cookie in the browser. Also, the IP address will be saved temporarily in the database together with the number of reports.', 'gwolle-gb' );
|
284 |
+
|
285 |
+
/* translators: %s is the name of the meta field */
|
286 |
+
$error_message = sprintf( esc_html__('The %s field was not filled in, even though it is mandatory.', 'gwolle-gb'), $name );
|
287 |
}
|
admin/tabs/gb-formtab.php
CHANGED
@@ -251,7 +251,7 @@ We reserve the right to edit, delete, or not publish entries.
|
|
251 |
</tr>
|
252 |
|
253 |
<tr valign="top">
|
254 |
-
<th scope="row"><label for="form_bbcode_enabled"><?php esc_html_e('
|
255 |
<td>
|
256 |
<input type="checkbox" id="form_bbcode_enabled" name="form_bbcode_enabled"<?php
|
257 |
if ( isset($form_setting['form_bbcode_enabled']) && $form_setting['form_bbcode_enabled'] === 'true' ) {
|
251 |
</tr>
|
252 |
|
253 |
<tr valign="top">
|
254 |
+
<th scope="row"><label for="form_bbcode_enabled"><?php esc_html_e('Visual formatting and Emoji', 'gwolle-gb'); ?>:</label></th>
|
255 |
<td>
|
256 |
<input type="checkbox" id="form_bbcode_enabled" name="form_bbcode_enabled"<?php
|
257 |
if ( isset($form_setting['form_bbcode_enabled']) && $form_setting['form_bbcode_enabled'] === 'true' ) {
|
docs/filters/{gwolle_gb_bbode_image_referrer.txt → gwolle_gb_bbode_img_referrer.txt}
RENAMED
File without changes
|
docs/filters/gwolle_gb_button.txt
CHANGED
@@ -20,7 +20,7 @@ function my_gwolle_gb_button( $button ) {
|
|
20 |
// $button is a string
|
21 |
$button = '
|
22 |
<div id="gwolle_gb_write_button">
|
23 |
-
<input type="button" value="» Write a new entry." />
|
24 |
</div>';
|
25 |
|
26 |
return $button;
|
20 |
// $button is a string
|
21 |
$button = '
|
22 |
<div id="gwolle_gb_write_button">
|
23 |
+
<input type="button" class="button btn btn-default" value="» ' . esc_attr__('Write a new entry.', 'gwolle-gb') . '" />
|
24 |
</div>';
|
25 |
|
26 |
return $button;
|
docs/filters/gwolle_gb_entry_the_admin_reply.txt
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
==Description==
|
4 |
+
|
5 |
+
The <b>"gwolle_gb_entry_the_admin_reply"</b> filter is used to filter the admin reply of each entry at the frontend.
|
6 |
+
|
7 |
+
You can use this filter as:
|
8 |
+
|
9 |
+
<code><?php add_filter( 'gwolle_gb_entry_the_admin_reply', 'filter_function_name' ) ?></code>
|
10 |
+
|
11 |
+
Where 'filter_function_name' is the function WordPress should call when the filter is being used.
|
12 |
+
|
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_entry_the_admin_reply($string, $entry) {
|
20 |
+
// $string is a string
|
21 |
+
$old = 'Old String';
|
22 |
+
$new = 'New String';
|
23 |
+
$string = str_replace( $old, $new, $string );
|
24 |
+
return $string;
|
25 |
+
}
|
26 |
+
add_filter( 'gwolle_gb_entry_the_admin_reply', my_gwolle_gb_entry_the_admin_reply', 10, 2 );
|
27 |
+
|
docs/filters/gwolle_gb_entry_the_author_name.txt
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
==Description==
|
4 |
+
|
5 |
+
The <b>"gwolle_gb_entry_the_author_name"</b> filter is used to filter the author name of each entry at the frontend.
|
6 |
+
|
7 |
+
You can use this filter as:
|
8 |
+
|
9 |
+
<code><?php add_filter( 'gwolle_gb_entry_the_author_name', '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_entry_the_author_name($string, $entry) {
|
20 |
+
// $string is a string
|
21 |
+
$old = 'Old String';
|
22 |
+
$new = 'New String';
|
23 |
+
$string = str_replace( $old, $new, $string );
|
24 |
+
return $string;
|
25 |
+
}
|
26 |
+
add_filter( 'gwolle_gb_entry_the_author_name', 'my_gwolle_gb_entry_the_author_name', 10, 2 );
|
27 |
+
|
docs/filters/gwolle_gb_entry_the_content.txt
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
==Description==
|
4 |
+
|
5 |
+
The <b>"gwolle_gb_entry_the_content"</b> filter is used to filter the content of each entry at the frontend.
|
6 |
+
|
7 |
+
You can use this filter as:
|
8 |
+
|
9 |
+
<code><?php add_filter( 'gwolle_gb_entry_the_content', '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_entry_the_content($string, $entry) {
|
20 |
+
// $string is a string
|
21 |
+
$old = 'Old String';
|
22 |
+
$new = 'New String';
|
23 |
+
$string = str_replace( $old, $new, $string );
|
24 |
+
return $string;
|
25 |
+
}
|
26 |
+
add_filter( 'gwolle_gb_entry_the_content', 'my_gwolle_gb_entry_the_content', 10, 2 );
|
27 |
+
|
frontend/css/gwolle-gb-frontend.css
CHANGED
@@ -245,6 +245,9 @@ body .gwolle-gb-content a {
|
|
245 |
#gwolle_gb .gb-entry .gb-entry-content img {
|
246 |
max-width: 100%;
|
247 |
}
|
|
|
|
|
|
|
248 |
|
249 |
|
250 |
/* Metabox */
|
245 |
#gwolle_gb .gb-entry .gb-entry-content img {
|
246 |
max-width: 100%;
|
247 |
}
|
248 |
+
#gwolle_gb .gb-entry .gb-highlight {
|
249 |
+
background-color: #ddff00;
|
250 |
+
}
|
251 |
|
252 |
|
253 |
/* Metabox */
|
frontend/gb-shortcodes.php
CHANGED
@@ -47,10 +47,6 @@ function get_gwolle_gb( $atts ) {
|
|
47 |
$shortcode_atts['book_id'] = get_the_ID();
|
48 |
}
|
49 |
|
50 |
-
// Set Meta_keys
|
51 |
-
//gwolle_gb_set_meta_keys( 'write', $shortcode_atts );
|
52 |
-
gwolle_gb_set_meta_keys( 'read', $shortcode_atts );
|
53 |
-
|
54 |
// Load Frontend CSS in Footer, only when it's active
|
55 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
56 |
//wp_enqueue_script('jquery');
|
@@ -93,9 +89,6 @@ function get_gwolle_gb_write( $atts ) {
|
|
93 |
$shortcode_atts['book_id'] = get_the_ID();
|
94 |
}
|
95 |
|
96 |
-
// Set Meta_keys
|
97 |
-
//gwolle_gb_set_meta_keys( 'write', $shortcode_atts );
|
98 |
-
|
99 |
// Load Frontend CSS in Footer, only when it's active
|
100 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
101 |
//wp_enqueue_script('jquery');
|
@@ -133,9 +126,6 @@ function get_gwolle_gb_read( $atts ) {
|
|
133 |
$shortcode_atts['book_id'] = get_the_ID();
|
134 |
}
|
135 |
|
136 |
-
// Set Meta_keys
|
137 |
-
gwolle_gb_set_meta_keys( 'read', $shortcode_atts );
|
138 |
-
|
139 |
// Load Frontend CSS in Footer, only when it's active
|
140 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
141 |
//wp_enqueue_script('jquery');
|
47 |
$shortcode_atts['book_id'] = get_the_ID();
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
50 |
// Load Frontend CSS in Footer, only when it's active
|
51 |
wp_enqueue_style('gwolle_gb_frontend_css');
|
52 |
//wp_enqueue_script('jquery');
|
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');
|
94 |
//wp_enqueue_script('jquery');
|
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');
|
131 |
//wp_enqueue_script('jquery');
|
frontend/gb-widget-search.php
CHANGED
@@ -49,13 +49,19 @@ if (function_exists('register_sidebar') && class_exists('WP_Widget')) {
|
|
49 |
$widget_html .= $args['before_title'] . apply_filters('widget_title', $widget_title) . $args['after_title'];
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
$widget_html .= '
|
53 |
<form id="gwolle-gb-widget-search" action="#" method="GET" class="' . $widget_class . '" role="search" aria-label="' . esc_html__( 'Guestbook', 'gwolle-gb' ) . '">
|
54 |
<div class="label">
|
55 |
<label for="gwolle-gb-search-input" class="text-info">' . esc_html__('Search:', 'gwolle-gb') . '</label>
|
56 |
</div>
|
57 |
<div class="input">
|
58 |
-
<input class="wp-exclude-emoji" value="" type="text" name="gwolle-gb-search-input" id="gwolle-gb-search-input" placeholder="' . esc_attr__('Search...', 'gwolle-gb') . '" />
|
59 |
</div>
|
60 |
<div class="gwolle-gb-search-submit">
|
61 |
<div class="input">
|
49 |
$widget_html .= $args['before_title'] . apply_filters('widget_title', $widget_title) . $args['after_title'];
|
50 |
}
|
51 |
|
52 |
+
$searchwords = '';
|
53 |
+
$is_search = gwolle_gb_is_search();
|
54 |
+
if ( is_array($is_search) && ! empty($is_search) ) {
|
55 |
+
$searchwords = implode( ' ', $is_search);
|
56 |
+
}
|
57 |
+
|
58 |
$widget_html .= '
|
59 |
<form id="gwolle-gb-widget-search" action="#" method="GET" class="' . $widget_class . '" role="search" aria-label="' . esc_html__( 'Guestbook', 'gwolle-gb' ) . '">
|
60 |
<div class="label">
|
61 |
<label for="gwolle-gb-search-input" class="text-info">' . esc_html__('Search:', 'gwolle-gb') . '</label>
|
62 |
</div>
|
63 |
<div class="input">
|
64 |
+
<input class="wp-exclude-emoji" value="' . $searchwords . '" type="text" name="gwolle-gb-search-input" id="gwolle-gb-search-input" placeholder="' . esc_attr__('Search...', 'gwolle-gb') . '" />
|
65 |
</div>
|
66 |
<div class="gwolle-gb-search-submit">
|
67 |
<div class="input">
|
frontend/gwolle_gb-entry.php
CHANGED
@@ -118,10 +118,13 @@ if ( ! function_exists('gwolle_gb_entry_template') ) {
|
|
118 |
$entry_output .= '
|
119 |
<div class="gb-entry-content">';
|
120 |
|
121 |
-
// Use this filter to just add something
|
122 |
$entry_output .= apply_filters( 'gwolle_gb_entry_read_add_content_before', '', $entry );
|
123 |
|
124 |
-
$
|
|
|
|
|
|
|
125 |
if ( get_option( 'gwolle_gb-showLineBreaks', 'false' ) === 'true' ) {
|
126 |
$entry_content = nl2br($entry_content);
|
127 |
}
|
@@ -152,6 +155,9 @@ if ( ! function_exists('gwolle_gb_entry_template') ) {
|
|
152 |
|
153 |
/* Admin Reply */
|
154 |
$admin_reply_content = gwolle_gb_sanitize_output( $entry->get_admin_reply(), 'admin_reply' );
|
|
|
|
|
|
|
155 |
if ( $admin_reply_content != '' ) {
|
156 |
|
157 |
$class = '';
|
118 |
$entry_output .= '
|
119 |
<div class="gb-entry-content">';
|
120 |
|
121 |
+
// Use this filter to just add something.
|
122 |
$entry_output .= apply_filters( 'gwolle_gb_entry_read_add_content_before', '', $entry );
|
123 |
|
124 |
+
$real_content = gwolle_gb_sanitize_output( $entry->get_content(), 'content' );
|
125 |
+
// This filters the real content of the entry.
|
126 |
+
$entry_content .= apply_filters( 'gwolle_gb_entry_the_content', $real_content, $entry );
|
127 |
+
|
128 |
if ( get_option( 'gwolle_gb-showLineBreaks', 'false' ) === 'true' ) {
|
129 |
$entry_content = nl2br($entry_content);
|
130 |
}
|
155 |
|
156 |
/* Admin Reply */
|
157 |
$admin_reply_content = gwolle_gb_sanitize_output( $entry->get_admin_reply(), 'admin_reply' );
|
158 |
+
// This filters the real content of the admin reply.
|
159 |
+
$admin_reply_content = apply_filters( 'gwolle_gb_entry_the_admin_reply', $admin_reply_content, $entry );
|
160 |
+
|
161 |
if ( $admin_reply_content != '' ) {
|
162 |
|
163 |
$class = '';
|
functions/gb-debug.php
CHANGED
@@ -77,6 +77,50 @@ function gwolle_gb_debug_info() {
|
|
77 |
</td>
|
78 |
</tr>
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
<tr>
|
81 |
<th><?php esc_html_e('MySQL / MySQLi:', 'gwolle-gb'); ?></th>
|
82 |
<td><?php
|
@@ -104,6 +148,25 @@ function gwolle_gb_debug_info() {
|
|
104 |
</td>
|
105 |
</tr>
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
<?php
|
108 |
}
|
109 |
|
77 |
</td>
|
78 |
</tr>
|
79 |
|
80 |
+
<tr>
|
81 |
+
<th><?php esc_html_e('MySQL Tables:', 'gwolle-gb'); ?></th>
|
82 |
+
<td><?php
|
83 |
+
$exist = '';
|
84 |
+
$nonexist = '';
|
85 |
+
|
86 |
+
$table = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_entries'");
|
87 |
+
if ( $table != 0 ) {
|
88 |
+
$exist .= '<li>gwolle_gb_entries</li>';
|
89 |
+
} else {
|
90 |
+
$nonexist .= '<li>gwolle_gb_entries</li>';
|
91 |
+
}
|
92 |
+
$table = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_log'");
|
93 |
+
if ( $table != 0 ) {
|
94 |
+
$exist .= '<li>gwolle_gb_log</li>';
|
95 |
+
} else {
|
96 |
+
$nonexist .= '<li>gwolle_gb_log</li>';
|
97 |
+
}
|
98 |
+
|
99 |
+
$active = is_plugin_active( 'gwolle-gb-addon/gwolle-gb-addon.php' ); // true or false
|
100 |
+
if ( $active ) {
|
101 |
+
$table = $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "gwolle_gb_meta'");
|
102 |
+
if ( $table != 0 ) {
|
103 |
+
$exist .= '<li>gwolle_gb_meta</li>';
|
104 |
+
} else {
|
105 |
+
$nonexist .= '<li>gwolle_gb_meta</li>';
|
106 |
+
}
|
107 |
+
}
|
108 |
+
echo esc_html__('MySQL Tables that exist:', 'gwolle-gb');
|
109 |
+
echo '<ul class="ul-disc">';
|
110 |
+
echo $exist;
|
111 |
+
echo '</ul>';
|
112 |
+
|
113 |
+
if ( strlen( $nonexist ) > 0 ) {
|
114 |
+
echo esc_html__('MySQL Tables that do not exist:', 'gwolle-gb');
|
115 |
+
echo '<ul class="ul-disc">';
|
116 |
+
echo $nonexist;
|
117 |
+
echo '</ul>';
|
118 |
+
}
|
119 |
+
|
120 |
+
?>
|
121 |
+
</td>
|
122 |
+
</tr>
|
123 |
+
|
124 |
<tr>
|
125 |
<th><?php esc_html_e('MySQL / MySQLi:', 'gwolle-gb'); ?></th>
|
126 |
<td><?php
|
148 |
</td>
|
149 |
</tr>
|
150 |
|
151 |
+
<tr>
|
152 |
+
<th><?php esc_html_e('MySQL engine:', 'gwolle-gb'); ?></th>
|
153 |
+
<td><?php
|
154 |
+
$sql = "
|
155 |
+
SELECT TABLE_NAME, ENGINE
|
156 |
+
FROM information_schema.TABLES
|
157 |
+
WHERE TABLE_SCHEMA = '" . $wpdb->dbname . "'
|
158 |
+
;";
|
159 |
+
$engines = $wpdb->get_results( $sql, ARRAY_N );
|
160 |
+
foreach ( $engines as $engine ) {
|
161 |
+
if ( $engine[0] == $wpdb->prefix . 'gwolle_gb_entries' ) {
|
162 |
+
echo $engine[1];
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
?>
|
167 |
+
</td>
|
168 |
+
</tr>
|
169 |
+
|
170 |
<?php
|
171 |
}
|
172 |
|
functions/gb-formatting.php
CHANGED
@@ -93,3 +93,32 @@ function gwolle_gb_get_excerpt( $content, $excerpt_length = 20 ) {
|
|
93 |
}
|
94 |
return $excerpt;
|
95 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
return $excerpt;
|
95 |
}
|
96 |
+
|
97 |
+
|
98 |
+
/*
|
99 |
+
* Function to highlight text.
|
100 |
+
* Taken from SO:
|
101 |
+
* https://stackoverflow.com/questions/2757556/highlight-multiple-keywords-in-search/2757619#2757619
|
102 |
+
*
|
103 |
+
* @param string $text the text with possible words to highlight.
|
104 |
+
* @param array $words the words to highlight in that text.
|
105 |
+
* @return $text with highlighted words.
|
106 |
+
*
|
107 |
+
* @since 3.1.8
|
108 |
+
*/
|
109 |
+
function gwolle_gb_highlight( $text, $words ) {
|
110 |
+
|
111 |
+
if ( is_array($words) && ! empty($words) ) {
|
112 |
+
$pattern = array();
|
113 |
+
foreach ( $words as $word ) {
|
114 |
+
$pattern[] = '/' . preg_quote($word, '/') . '/i';
|
115 |
+
}
|
116 |
+
|
117 |
+
$highlighted = preg_filter($pattern, '<b><span class="gb-highlight">$0</span></b>', $text);
|
118 |
+
if ( ! empty($highlighted) ) {
|
119 |
+
$text = $highlighted;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
return $text;
|
123 |
+
|
124 |
+
}
|
functions/gb-get_entries_from_search.php
CHANGED
@@ -315,3 +315,31 @@ function gwolle_gb_get_entry_count_from_search( $args ) {
|
|
315 |
return $count_static;
|
316 |
|
317 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
return $count_static;
|
316 |
|
317 |
}
|
318 |
+
|
319 |
+
|
320 |
+
/*
|
321 |
+
* Function to highlight the text in search results.
|
322 |
+
*
|
323 |
+
* @param string $text of whatever needs to be highlighted.
|
324 |
+
*
|
325 |
+
* @return string $text with highlighted search words.
|
326 |
+
*
|
327 |
+
* @since 3.1.8
|
328 |
+
*/
|
329 |
+
function gwolle_gb_highlight_searchresults( $text ) {
|
330 |
+
|
331 |
+
$is_search = gwolle_gb_is_search();
|
332 |
+
if ( ! $is_search ) {
|
333 |
+
return $text;
|
334 |
+
}
|
335 |
+
|
336 |
+
$text = gwolle_gb_highlight( $text, $is_search );
|
337 |
+
|
338 |
+
return $text;
|
339 |
+
|
340 |
+
}
|
341 |
+
add_filter( 'gwolle_gb_entry_the_author_name', 'gwolle_gb_highlight_searchresults', 10, 1 );
|
342 |
+
add_filter( 'gwolle_gb_entry_the_content', 'gwolle_gb_highlight_searchresults', 10, 1 );
|
343 |
+
add_filter( 'gwolle_gb_entry_the_admin_reply', 'gwolle_gb_highlight_searchresults', 10, 1 );
|
344 |
+
|
345 |
+
|
functions/gb-post-meta.php
CHANGED
@@ -45,6 +45,46 @@ function gwolle_gb_save_post($id) {
|
|
45 |
add_action('save_post', 'gwolle_gb_save_post');
|
46 |
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
/*
|
49 |
* Make our meta fields protected, so they are not in the custom fields metabox.
|
50 |
*
|
@@ -71,31 +111,13 @@ add_filter( 'is_protected_meta', 'gwolle_gb_is_protected_meta', 10, 3 );
|
|
71 |
* @param string $shortcode value 'write' or 'read'.
|
72 |
* @param array $shortcode_atts array with the shortcode attributes.
|
73 |
*
|
74 |
-
* @since
|
|
|
75 |
*/
|
76 |
function gwolle_gb_set_meta_keys( $shortcode, $shortcode_atts ) {
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
$meta_value_read = get_post_meta( get_the_ID(), 'gwolle_gb_read', true );
|
81 |
-
if ( $meta_value_read != 'true' ) {
|
82 |
-
update_post_meta( get_the_ID(), 'gwolle_gb_read', 'true' );
|
83 |
-
}
|
84 |
-
if ( isset($shortcode_atts['entry_id']) && $shortcode_atts['entry_id'] > 0 ) {
|
85 |
-
// There is only one entry visible (no form), remove the book_id.
|
86 |
-
delete_post_meta( get_the_ID(), 'gwolle_gb_book_id' );
|
87 |
-
return;
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
$book_id = 1; // default
|
92 |
-
if ( isset($shortcode_atts['book_id']) ) {
|
93 |
-
$book_id = $shortcode_atts['book_id'];
|
94 |
-
}
|
95 |
-
$meta_value_book_id = get_post_meta( get_the_ID(), 'gwolle_gb_book_id', true );
|
96 |
-
if ( $meta_value_book_id != $book_id ) {
|
97 |
-
update_post_meta( get_the_ID(), 'gwolle_gb_book_id', $book_id );
|
98 |
-
}
|
99 |
|
100 |
}
|
101 |
|
45 |
add_action('save_post', 'gwolle_gb_save_post');
|
46 |
|
47 |
|
48 |
+
/*
|
49 |
+
* Set meta_keys so we can find the post with the shortcode back.
|
50 |
+
*
|
51 |
+
* @param string $content Content of the post
|
52 |
+
* @return string $content Content of the post
|
53 |
+
*
|
54 |
+
* @since 3.1.8
|
55 |
+
*/
|
56 |
+
function gwolle_gb_content_filter_for_meta_keys( $content ) {
|
57 |
+
|
58 |
+
if ( ! is_singular() || ! is_main_query() || is_admin() ) {
|
59 |
+
return $content;
|
60 |
+
}
|
61 |
+
|
62 |
+
if ( function_exists('has_shortcode') ) {
|
63 |
+
$id = get_the_ID();
|
64 |
+
|
65 |
+
if ( has_shortcode( $content, 'gwolle_gb' ) || has_shortcode( $content, 'gwolle_gb_read' ) ) {
|
66 |
+
// Set a meta_key so we can find the post with the shortcode back.
|
67 |
+
$meta_value = get_post_meta( $id, 'gwolle_gb_read', true );
|
68 |
+
if ( $meta_value != 'true' ) {
|
69 |
+
update_post_meta( $id, 'gwolle_gb_read', 'true' );
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
// Remove the meta_key in case it is set.
|
73 |
+
delete_post_meta( $id, 'gwolle_gb_read' );
|
74 |
+
}
|
75 |
+
|
76 |
+
if ( has_shortcode( $content, 'gwolle_gb' ) || has_shortcode( $content, 'gwolle_gb_read' ) || has_shortcode( $content, 'gwolle_gb_write' ) ) {
|
77 |
+
// Nothing to do
|
78 |
+
} else {
|
79 |
+
delete_post_meta( $id, 'gwolle_gb_book_id' );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
return $content;
|
84 |
+
}
|
85 |
+
add_filter( 'the_content', 'gwolle_gb_content_filter_for_meta_keys', 1 ); // before shortcodes are done.
|
86 |
+
|
87 |
+
|
88 |
/*
|
89 |
* Make our meta fields protected, so they are not in the custom fields metabox.
|
90 |
*
|
111 |
* @param string $shortcode value 'write' or 'read'.
|
112 |
* @param array $shortcode_atts array with the shortcode attributes.
|
113 |
*
|
114 |
+
* @since 1.5.6
|
115 |
+
* @deprecated 3.1.8 Meta keys are now set in gwolle_gb_content_filter_for_meta_keys()
|
116 |
*/
|
117 |
function gwolle_gb_set_meta_keys( $shortcode, $shortcode_atts ) {
|
118 |
|
119 |
+
_deprecated_function( __FUNCTION__, ' 3.1.8', 'gwolle_gb_content_filter_for_meta_keys()' );
|
120 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
}
|
123 |
|
functions/gb-user.php
CHANGED
@@ -127,8 +127,9 @@ add_action( 'deleted_user', 'gwolle_gb_deleted_user' );
|
|
127 |
function gwolle_gb_get_author_name_html($entry) {
|
128 |
|
129 |
$author_name = gwolle_gb_sanitize_output( trim( $entry->get_author_name() ) );
|
|
|
130 |
|
131 |
-
// Registered
|
132 |
$author_id = $entry->get_author_id();
|
133 |
$is_moderator = gwolle_gb_is_moderator( $author_id );
|
134 |
if ( $is_moderator ) {
|
127 |
function gwolle_gb_get_author_name_html($entry) {
|
128 |
|
129 |
$author_name = gwolle_gb_sanitize_output( trim( $entry->get_author_name() ) );
|
130 |
+
$author_name = apply_filters( 'gwolle_gb_entry_the_author_name', $author_name, $entry );
|
131 |
|
132 |
+
// Registered user gets italic font-style.
|
133 |
$author_id = $entry->get_author_id();
|
134 |
$is_moderator = gwolle_gb_is_moderator( $author_id );
|
135 |
if ( $is_moderator ) {
|
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: 3.1.
|
7 |
Author: Marcel Pol
|
8 |
Author URI: http://zenoweb.nl
|
9 |
License: GPLv2 or later
|
@@ -13,7 +13,7 @@ Domain Path: /lang/
|
|
13 |
|
14 |
/*
|
15 |
Copyright 2009 - 2010 Wolfgang Timme (email: gwolle@wolfgangtimme.de)
|
16 |
-
Copyright 2014 -
|
17 |
|
18 |
This program is free software; you can redistribute it and/or modify
|
19 |
it under the terms of the GNU General Public License as published by
|
@@ -32,7 +32,7 @@ Domain Path: /lang/
|
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
-
define('GWOLLE_GB_VER', '3.1.
|
36 |
|
37 |
|
38 |
/*
|
@@ -61,11 +61,10 @@ define('GWOLLE_GB_VER', '3.1.7');
|
|
61 |
* - Add emoji for Zwarte Piet and Sinterklaas when locale=nl_nl.
|
62 |
* - Look into saving a timestamp including offset. Look again at saving from editor.
|
63 |
* - Use button for metabox control.
|
64 |
-
* -
|
65 |
-
* - Do not set meta_key when shortcode is used in widget.
|
66 |
-
* - fase out current_time:
|
67 |
* https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/
|
68 |
* - Support rewrite API for single entry.
|
|
|
69 |
*/
|
70 |
|
71 |
|
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: 3.1.8
|
7 |
Author: Marcel Pol
|
8 |
Author URI: http://zenoweb.nl
|
9 |
License: GPLv2 or later
|
13 |
|
14 |
/*
|
15 |
Copyright 2009 - 2010 Wolfgang Timme (email: gwolle@wolfgangtimme.de)
|
16 |
+
Copyright 2014 - 2020 Marcel Pol (email: marcel@timelord.nl)
|
17 |
|
18 |
This program is free software; you can redistribute it and/or modify
|
19 |
it under the terms of the GNU General Public License as published by
|
32 |
|
33 |
|
34 |
// Plugin Version
|
35 |
+
define('GWOLLE_GB_VER', '3.1.8');
|
36 |
|
37 |
|
38 |
/*
|
61 |
* - Add emoji for Zwarte Piet and Sinterklaas when locale=nl_nl.
|
62 |
* - Look into saving a timestamp including offset. Look again at saving from editor.
|
63 |
* - Use button for metabox control.
|
64 |
+
* - phase out current_time:
|
|
|
|
|
65 |
* https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/
|
66 |
* - Support rewrite API for single entry.
|
67 |
+
* - Use select2 or similar for subscribe/unsubcribe dropdowns.
|
68 |
*/
|
69 |
|
70 |
|
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.3
|
6 |
-
Stable tag: 3.1.
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
@@ -428,6 +428,14 @@ But if you don't use standard comments, you can just as easily use the comment s
|
|
428 |
|
429 |
== Changelog ==
|
430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
= 3.1.7 =
|
432 |
* 2019-10-25
|
433 |
* Show subscription status for email notifications on settings page.
|
3 |
Tags: guestbook, guest book, livre d'or, Gästebuch, review
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 3.1.8
|
7 |
License: GPLv2 or later
|
8 |
Requires PHP: 5.3
|
9 |
|
428 |
|
429 |
== Changelog ==
|
430 |
|
431 |
+
= 3.1.8 =
|
432 |
+
* 2020-01-21
|
433 |
+
* Add highlight to search results (thanks @robinnatter).
|
434 |
+
* Add searchwords to search widget after searching.
|
435 |
+
* Do not set meta_key when shortcode is used in widget or one-page design.
|
436 |
+
* Show InnoDB engine on debug tab.
|
437 |
+
* Show existence of database tables on debug tab.
|
438 |
+
|
439 |
= 3.1.7 =
|
440 |
* 2019-10-25
|
441 |
* Show subscription status for email notifications on settings page.
|