Gwolle Guestbook - Version 3.1.2

Version Description

  • 2019-04-04
  • Improve accessibility for the frontend metabox.
  • Add filter gwolle_gb_new_entry_frontend.
  • Add filter gwolle_gb_get_permalink.
  • Change arrows in next/prev pagination.
  • Auto-detect line endings in import from CSV.
Download this release

Release Info

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

Code changes from version 3.1.1 to 3.1.2

admin/gb-page-editor.php CHANGED
@@ -233,7 +233,7 @@ function gwolle_gb_editor_postbox_icons( $entry ) {
233
 
234
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
235
  if ( $postid ) {
236
- $permalink = get_permalink( $postid );
237
  ?>
238
  <div id="gwolle_gb_frontend">
239
  <a class="button rbutton button" href="<?php echo $permalink; ?>"><?php esc_attr_e('View Guestbook','gwolle-gb'); ?></a>
233
 
234
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
235
  if ( $postid ) {
236
+ $permalink = gwolle_gb_get_permalink( $postid );
237
  ?>
238
  <div id="gwolle_gb_frontend">
239
  <a class="button rbutton button" href="<?php echo $permalink; ?>"><?php esc_attr_e('View Guestbook','gwolle-gb'); ?></a>
admin/gb-page-gwolle-gb.php CHANGED
@@ -155,7 +155,7 @@ function gwolle_gb_overview(){
155
  <?php
156
  $postid = gwolle_gb_get_postid_biggest_book();
157
  if ( $postid ) {
158
- $permalink = get_permalink( $postid );
159
  ?>
160
  <a class="button rbutton button button-primary" href="<?php echo $permalink; ?>"><?php esc_html_e('View Guestbook','gwolle-gb'); ?></a>
161
  <?php
155
  <?php
156
  $postid = gwolle_gb_get_postid_biggest_book();
157
  if ( $postid ) {
158
+ $permalink = gwolle_gb_get_permalink( $postid );
159
  ?>
160
  <a class="button rbutton button button-primary" href="<?php echo $permalink; ?>"><?php esc_html_e('View Guestbook','gwolle-gb'); ?></a>
161
  <?php
admin/gb-page-import.php CHANGED
@@ -289,6 +289,10 @@ function gwolle_gb_import_postbox_gwolle() {
289
  <p>
290
  <input name="start_import_gwolle" id="start_import_gwolle" type="submit" class="button" disabled value="<?php esc_attr_e('Start import', 'gwolle-gb'); ?>">
291
  </p>
 
 
 
 
292
  </form>
293
  <?php
294
  }
@@ -491,6 +495,7 @@ function gwolle_gb_page_import_post() {
491
  gwolle_gb_add_message( '<p>' . esc_html__('You have a very old version of PHP. Please contact your hosting provider and request an upgrade.', 'gwolle-gb') . '</p>', false, false);
492
  }
493
 
 
494
  $handle = fopen($_FILES['start_import_gwolle_file']['tmp_name'], "r");
495
  $row = 0;
496
 
@@ -625,7 +630,7 @@ function gwolle_gb_page_import_post() {
625
  // We have been saved to the Database
626
  if ( isset( $metas ) && function_exists( 'gwolle_gb_addon_save_meta' ) ) {
627
  $metas = maybe_unserialize( $metas );
628
- if ( ! empty( $metas ) ) {
629
  foreach ( $metas as $meta ) {
630
  gwolle_gb_addon_save_meta( $entry->get_id(), $meta['meta_key'], $meta['meta_value'] );
631
  }
289
  <p>
290
  <input name="start_import_gwolle" id="start_import_gwolle" type="submit" class="button" disabled value="<?php esc_attr_e('Start import', 'gwolle-gb'); ?>">
291
  </p>
292
+ <p>
293
+ <?php esc_html_e('If you want to manually prepare a CSV file, please use decent software like LibreOffice Calc. Microsoft Excel will not be able to prepare a valid CSV file.', 'gwolle-gb'); ?><br />
294
+ </p>
295
+
296
  </form>
297
  <?php
298
  }
495
  gwolle_gb_add_message( '<p>' . esc_html__('You have a very old version of PHP. Please contact your hosting provider and request an upgrade.', 'gwolle-gb') . '</p>', false, false);
496
  }
497
 
498
+ ini_set('auto_detect_line_endings', true);
499
  $handle = fopen($_FILES['start_import_gwolle_file']['tmp_name'], "r");
500
  $row = 0;
501
 
630
  // We have been saved to the Database
631
  if ( isset( $metas ) && function_exists( 'gwolle_gb_addon_save_meta' ) ) {
632
  $metas = maybe_unserialize( $metas );
633
+ if ( ! empty( $metas ) && is_array( $metas ) ) {
634
  foreach ( $metas as $meta ) {
635
  gwolle_gb_addon_save_meta( $entry->get_id(), $meta['meta_key'], $meta['meta_value'] );
636
  }
admin/gb-page-settings.php CHANGED
@@ -51,7 +51,7 @@ function gwolle_gb_page_settings() {
51
  }
52
 
53
  /* The rel attribute will be the form that becomes active */ ?>
54
- <h2 class="nav-tab-wrapper gwolle-nav-tab-wrapper" role="tablist">
55
  <a href="#" role="tab" class="nav-tab <?php if ($active_tab == 'gwolle_gb_forms') { echo "nav-tab-active";} ?>" rel="gwolle_gb_forms"><?php /* translators: Settings page tab */ esc_html_e('Form', 'gwolle-gb'); ?></a>
56
  <a href="#" role="tab" class="nav-tab <?php if ($active_tab == 'gwolle_gb_reading') { echo "nav-tab-active";} ?>" rel="gwolle_gb_reading"><?php /* translators: Settings page tab */ esc_html_e('Reading', 'gwolle-gb'); ?></a>
57
  <a href="#" role="tab" class="nav-tab <?php if ($active_tab == 'gwolle_gb_admin') { echo "nav-tab-active";} ?>" rel="gwolle_gb_admin"><?php /* translators: Settings page tab */ esc_html_e('Admin', 'gwolle-gb'); ?></a>
51
  }
52
 
53
  /* The rel attribute will be the form that becomes active */ ?>
54
+ <h2 class="nav-tab-wrapper gwolle-nav-tab-wrapper" role="tablist"> // Do not use nav but h2, since it is using (in)visible content, not real navigation.
55
  <a href="#" role="tab" class="nav-tab <?php if ($active_tab == 'gwolle_gb_forms') { echo "nav-tab-active";} ?>" rel="gwolle_gb_forms"><?php /* translators: Settings page tab */ esc_html_e('Form', 'gwolle-gb'); ?></a>
56
  <a href="#" role="tab" class="nav-tab <?php if ($active_tab == 'gwolle_gb_reading') { echo "nav-tab-active";} ?>" rel="gwolle_gb_reading"><?php /* translators: Settings page tab */ esc_html_e('Reading', 'gwolle-gb'); ?></a>
57
  <a href="#" role="tab" class="nav-tab <?php if ($active_tab == 'gwolle_gb_admin') { echo "nav-tab-active";} ?>" rel="gwolle_gb_admin"><?php /* translators: Settings page tab */ esc_html_e('Admin', 'gwolle-gb'); ?></a>
admin/gb-pagination.php CHANGED
@@ -52,7 +52,7 @@ function gwolle_gb_pagination_admin( $pageNum, $pages_total, $count, $show ) {
52
 
53
  if ($pageNum > 1) {
54
  $link = admin_url( 'admin.php?page=' . GWOLLE_GB_FOLDER . '/entries.php&show=' . $show . '&pageNum=' . round($pageNum - 1) . '&book_id=' . $book_id );
55
- $pagination .= '<a class="first page-numbers button" href="' . $link . '" rel="prev">&laquo;</a>';
56
  }
57
 
58
  if ($pageNum < 5) {
@@ -115,7 +115,7 @@ function gwolle_gb_pagination_admin( $pageNum, $pages_total, $count, $show ) {
115
  $pagination .= '<a class="page-numbers button" href="' . $link . '">' . $pages_total . '</a>';
116
  }
117
  $link = admin_url( 'admin.php?page=' . GWOLLE_GB_FOLDER . '/entries.php&show=' . $show . '&pageNum=' . round($pageNum + 1) . '&book_id=' . $book_id );
118
- $pagination .= '<a class="last page-numbers button" href="' . $link . '" rel="next">&raquo;</a>';
119
  }
120
 
121
  $pagination .= '</div>';
52
 
53
  if ($pageNum > 1) {
54
  $link = admin_url( 'admin.php?page=' . GWOLLE_GB_FOLDER . '/entries.php&show=' . $show . '&pageNum=' . round($pageNum - 1) . '&book_id=' . $book_id );
55
+ $pagination .= '<a class="first page-numbers button" href="' . $link . '" rel="prev">&larr;</a>';
56
  }
57
 
58
  if ($pageNum < 5) {
115
  $pagination .= '<a class="page-numbers button" href="' . $link . '">' . $pages_total . '</a>';
116
  }
117
  $link = admin_url( 'admin.php?page=' . GWOLLE_GB_FOLDER . '/entries.php&show=' . $show . '&pageNum=' . round($pageNum + 1) . '&book_id=' . $book_id );
118
+ $pagination .= '<a class="last page-numbers button" href="' . $link . '" rel="next">&rarr;</a>';
119
  }
120
 
121
  $pagination .= '</div>';
docs/actions/gwolle_gb_save_entry_admin.txt CHANGED
@@ -25,7 +25,7 @@ function my_gwolle_gb_save_entry_admin( $entry ) {
25
  $post_id = gwolle_gb_get_postid( $book_id );
26
  if ( $post_id ) {
27
  // this redirect doesn't work, since the headers were already sent.
28
- wp_redirect( get_permalink( $post_id ) );
29
  exit;
30
  }
31
 
25
  $post_id = gwolle_gb_get_postid( $book_id );
26
  if ( $post_id ) {
27
  // this redirect doesn't work, since the headers were already sent.
28
+ wp_redirect( gwolle_gb_get_permalink( $post_id ) );
29
  exit;
30
  }
31
 
docs/filters/gwolle_gb_get_permalink.txt ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_get_permalink"</b> filter is used to change the permalink that is used throughout the guestbook. It can be handy with one-page design and a anchor, as it is used in the example below.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_get_permalink', '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_get_permalink( $permalink ) {
20
+ // $permalink is a string
21
+ $permalink .= '#guestbook';
22
+ return $permalink;
23
+ }
24
+ add_filter( 'gwolle_gb_get_permalink', 'my_gwolle_gb_get_permalink', 10, 1 );
25
+
docs/filters/gwolle_gb_new_entry_frontend.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ==Description==
4
+
5
+ The <b>"gwolle_gb_new_entry_frontend"</b> filter is used to check the entry before saving it to the database from the frontend form.
6
+
7
+ You can use this filter as:
8
+
9
+ <code><?php add_filter( 'gwolle_gb_new_entry_frontend', '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_new_entry_frontend( $entry ) {
20
+ // $entry is an instance of the gwolle_gb_entry class.
21
+
22
+ // Non-fatal error message.
23
+ gwolle_gb_add_message( '<p class="gb-my-special-error"><strong>' . esc_html__('This is an extra error message that is non-fatal. The entry will still get saved.', 'gwolle-gb') . '</strong></p>', false, false);
24
+
25
+ // Fatal error message.
26
+ gwolle_gb_add_message( '<p class="gb-my-special-error"><strong>' . esc_html__('This is an extra error message that is fatal. The entry was not saved.', 'gwolle-gb') . '</strong></p>', true, false);
27
+
28
+ return $entry;
29
+ }
30
+ add_filter( 'gwolle_gb_new_entry_frontend', 'my_gwolle_gb_new_entry_frontend');
31
+
frontend/css/gwolle-gb-frontend.css CHANGED
@@ -182,7 +182,7 @@ body .gwolle-gb-content a {
182
  color: #555;
183
  }
184
 
185
- /* Border-radius for whole thing. */
186
  #gwolle_gb .page-navigation a:nth-child(2),
187
  #gwolle_gb .page-navigation span:nth-child(2) {
188
  border-radius: 3px 0 0 3px;
@@ -257,6 +257,12 @@ div.gb-metabox-handle {
257
  cursor: pointer;
258
  font-weight: bold;
259
  }
 
 
 
 
 
 
260
  div.gb-metabox {
261
  position: absolute;
262
  top: 0;
182
  color: #555;
183
  }
184
 
185
+ /* Border-radius for whole pagination thing. */
186
  #gwolle_gb .page-navigation a:nth-child(2),
187
  #gwolle_gb .page-navigation span:nth-child(2) {
188
  border-radius: 3px 0 0 3px;
257
  cursor: pointer;
258
  font-weight: bold;
259
  }
260
+ div.gb-metabox-handle:focus {
261
+ outline-color: currentColor;
262
+ outline-style: solid;
263
+ outline-width: thin;
264
+ }
265
+
266
  div.gb-metabox {
267
  position: absolute;
268
  top: 0;
frontend/gb-form-posthandling.php CHANGED
@@ -190,15 +190,6 @@ function gwolle_gb_frontend_posthandling() {
190
  /* New Instance of gwolle_gb_entry. */
191
  $entry = new gwolle_gb_entry();
192
 
193
-
194
- /* If there are errors, stop here and return false */
195
- $gwolle_gb_error_fields = gwolle_gb_get_error_fields();
196
- if ( is_array( $gwolle_gb_error_fields ) && ! empty( $gwolle_gb_error_fields ) ) {
197
- do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
198
- return false; // no need to check and save
199
- }
200
-
201
-
202
  /* Set the data in the instance */
203
  $set_data = $entry->set_data( $gwolle_gb_formdata );
204
  if ( ! $set_data ) {
@@ -209,6 +200,24 @@ function gwolle_gb_frontend_posthandling() {
209
  }
210
 
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  /* Akismet: check for spam and set accordingly */
213
  $marked_by_akismet = false;
214
  if ( get_option( 'gwolle_gb-akismet-active', 'false' ) === 'true' ) {
190
  /* New Instance of gwolle_gb_entry. */
191
  $entry = new gwolle_gb_entry();
192
 
 
 
 
 
 
 
 
 
 
193
  /* Set the data in the instance */
194
  $set_data = $entry->set_data( $gwolle_gb_formdata );
195
  if ( ! $set_data ) {
200
  }
201
 
202
 
203
+ /*
204
+ * Use this hook to do your own magic on the frontend submission.
205
+ *
206
+ * @since 3.1.2
207
+ *
208
+ * @param object $entry instance of gwolle_gb_entry.
209
+ */
210
+ $entry = apply_filters( 'gwolle_gb_new_entry_frontend', $entry );
211
+
212
+
213
+ /* If there are errors, stop here and return false */
214
+ $gwolle_gb_errors = gwolle_gb_get_errors();
215
+ if ( $gwolle_gb_errors ) {
216
+ do_action( 'gwolle_gb_notsaved_entry_frontend', $entry );
217
+ return false; // no need to check and save
218
+ }
219
+
220
+
221
  /* Akismet: check for spam and set accordingly */
222
  $marked_by_akismet = false;
223
  if ( get_option( 'gwolle_gb-akismet-active', 'false' ) === 'true' ) {
frontend/gb-pagination.php CHANGED
@@ -19,7 +19,7 @@ function gwolle_gb_pagination_frontend( $pageNum, $pages_total ) {
19
  $highDotsMade = false;
20
  $pages_done = array();
21
 
22
- $permalink = get_permalink(get_the_ID());
23
  $is_search = gwolle_gb_is_search();
24
  if ( $is_search ) {
25
  $search_query = trim($_GET['gwolle-gb-search-input']);
@@ -31,7 +31,7 @@ function gwolle_gb_pagination_frontend( $pageNum, $pages_total ) {
31
  <span class="screen-reader-text">' . esc_html__('Guestbook list navigation', 'gwolle-gb') . '</span>';
32
 
33
  if ($pageNum > 1) {
34
- $pagination .= '<a href="' . add_query_arg( 'pageNum', round($pageNum - 1), $permalink ) . '" title="' . esc_attr__('Previous page', 'gwolle-gb') . '" rel="prev">&laquo;</a>';
35
  }
36
 
37
  if ($pageNum < 5) {
@@ -89,7 +89,7 @@ function gwolle_gb_pagination_frontend( $pageNum, $pages_total ) {
89
  if ( ! in_array( $pages_total, $pages_done ) ) {
90
  $pagination .= '<a href="' . add_query_arg( 'pageNum', $pages_total, $permalink ) . '" title="' . esc_attr__('Page', 'gwolle-gb') . ' ' . $pages_total . '">' . $pages_total . '</a>';
91
  }
92
- $pagination .= '<a href="' . add_query_arg( 'pageNum', round($pageNum + 1), $permalink ) . '" title="' . esc_attr__('Next page', 'gwolle-gb') . '" rel="next">&raquo;</a>';
93
  }
94
 
95
  // 'All' link
19
  $highDotsMade = false;
20
  $pages_done = array();
21
 
22
+ $permalink = gwolle_gb_get_permalink(get_the_ID());
23
  $is_search = gwolle_gb_is_search();
24
  if ( $is_search ) {
25
  $search_query = trim($_GET['gwolle-gb-search-input']);
31
  <span class="screen-reader-text">' . esc_html__('Guestbook list navigation', 'gwolle-gb') . '</span>';
32
 
33
  if ($pageNum > 1) {
34
+ $pagination .= '<a href="' . add_query_arg( 'pageNum', round($pageNum - 1), $permalink ) . '" title="' . esc_attr__('Previous page', 'gwolle-gb') . '" rel="prev">&larr;</a>';
35
  }
36
 
37
  if ($pageNum < 5) {
89
  if ( ! in_array( $pages_total, $pages_done ) ) {
90
  $pagination .= '<a href="' . add_query_arg( 'pageNum', $pages_total, $permalink ) . '" title="' . esc_attr__('Page', 'gwolle-gb') . ' ' . $pages_total . '">' . $pages_total . '</a>';
91
  }
92
+ $pagination .= '<a href="' . add_query_arg( 'pageNum', round($pageNum + 1), $permalink ) . '" title="' . esc_attr__('Next page', 'gwolle-gb') . '" rel="next">&rarr;</a>';
93
  }
94
 
95
  // 'All' link
frontend/gb-rss.php CHANGED
@@ -88,7 +88,7 @@ function gwolle_gb_rss() {
88
  $blog_url = get_bloginfo('wpurl');
89
  $biggest_book = gwolle_gb_get_postid_biggest_book();
90
  if ( $biggest_book ) {
91
- $permalink_biggest_book = get_permalink( $biggest_book );
92
  }
93
  if ( is_wp_error( $permalink_biggest_book ) ) {
94
  $permalink_biggest_book = $blog_url . '?p=' . $biggest_book;
@@ -136,7 +136,7 @@ function gwolle_gb_rss() {
136
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
137
  $permalink = $blog_url; // init for new entry.
138
  if ( $postid ) {
139
- $permalink = get_permalink( $postid );
140
  }
141
  if ( is_wp_error( $permalink ) ) {
142
  $permalink = $blog_url . '?p=' . $postid;
88
  $blog_url = get_bloginfo('wpurl');
89
  $biggest_book = gwolle_gb_get_postid_biggest_book();
90
  if ( $biggest_book ) {
91
+ $permalink_biggest_book = gwolle_gb_get_permalink( $biggest_book );
92
  }
93
  if ( is_wp_error( $permalink_biggest_book ) ) {
94
  $permalink_biggest_book = $blog_url . '?p=' . $biggest_book;
136
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
137
  $permalink = $blog_url; // init for new entry.
138
  if ( $postid ) {
139
+ $permalink = gwolle_gb_get_permalink( $postid );
140
  }
141
  if ( is_wp_error( $permalink ) ) {
142
  $permalink = $blog_url . '?p=' . $postid;
frontend/gb-widget.php CHANGED
@@ -80,7 +80,7 @@ if (function_exists('register_sidebar') && class_exists('WP_Widget')) {
80
 
81
  $raquo = '';
82
  if ( (int) $postid > 0 ) {
83
- $permalink = get_permalink( $postid );
84
  $raquo = '
85
  <a href="' . $permalink . '" title="' . esc_attr__('Click here to get to the guestbook.', 'gwolle-gb') . '">&raquo;</a>
86
  ';
80
 
81
  $raquo = '';
82
  if ( (int) $postid > 0 ) {
83
+ $permalink = gwolle_gb_get_permalink( $postid );
84
  $raquo = '
85
  <a href="' . $permalink . '" title="' . esc_attr__('Click here to get to the guestbook.', 'gwolle-gb') . '">&raquo;</a>
86
  ';
frontend/gwolle_gb-entry.php CHANGED
@@ -225,7 +225,7 @@ if ( ! function_exists('gwolle_gb_entry_template') ) {
225
  $gb_metabox = apply_filters( 'gwolle_gb_entry_metabox_lines', '', $entry );
226
  if ( $gb_metabox ) {
227
  $entry_output .= '
228
- <div class="gb-metabox-handle">' . esc_html__('...', 'gwolle-gb' ) . '<span class="screen-reader-text"> ' . esc_html__('Toggle this metabox.', 'gwolle-gb') . '</span></div>
229
  <div class="gb-metabox gwolle_gb_invisible gwolle-gb-invisible">' .
230
  $gb_metabox . '
231
  </div>';
225
  $gb_metabox = apply_filters( 'gwolle_gb_entry_metabox_lines', '', $entry );
226
  if ( $gb_metabox ) {
227
  $entry_output .= '
228
+ <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>
229
  <div class="gb-metabox gwolle_gb_invisible gwolle-gb-invisible">' .
230
  $gb_metabox . '
231
  </div>';
frontend/js/gwolle-gb-frontend.js CHANGED
@@ -65,6 +65,13 @@ function gwolle_gb_metabox_handle() {
65
  jQuery( metabox_parent ).find('div.gb-metabox').toggleClass( 'gwolle_gb_invisible' );
66
  return false;
67
  });
 
 
 
 
 
 
 
68
  return false;
69
  }
70
  jQuery(document).ready(function($) {
65
  jQuery( metabox_parent ).find('div.gb-metabox').toggleClass( 'gwolle_gb_invisible' );
66
  return false;
67
  });
68
+ jQuery("div.gb-metabox-handle").keypress(function(e) {
69
+ if (e.keyCode == 13) {
70
+ var metabox_parent = jQuery(this).parent();
71
+ jQuery( metabox_parent ).find('div.gb-metabox').toggleClass( 'gwolle_gb_invisible' );
72
+ return false;
73
+ }
74
+ });
75
  return false;
76
  }
77
  jQuery(document).ready(function($) {
functions/gb-akismet.php CHANGED
@@ -87,7 +87,7 @@ function gwolle_gb_akismet( $entry, $action ) {
87
  // http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
88
  $comment['comment_type'] = 'comment';
89
 
90
- $permalink = get_permalink( get_the_ID() );
91
  if ( $permalink ) {
92
  $comment['permalink'] = $permalink;
93
  }
87
  // http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
88
  $comment['comment_type'] = 'comment';
89
 
90
+ $permalink = gwolle_gb_get_permalink( get_the_ID() );
91
  if ( $permalink ) {
92
  $comment['permalink'] = $permalink;
93
  }
functions/gb-book_id.php CHANGED
@@ -149,7 +149,7 @@ function gwolle_gb_get_permalinks() {
149
 
150
  /* Build up all the permalinks for the books. */
151
  foreach ( $postids as $postid ) {
152
- $permalink = get_permalink( $postid );
153
 
154
  if ( empty( $permalink ) ) {
155
  continue;
@@ -168,3 +168,20 @@ function gwolle_gb_get_permalinks() {
168
  }
169
  return $books;
170
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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;
168
  }
169
  return $books;
170
  }
171
+
172
+
173
+ /*
174
+ * Wrapper for get_permalink.
175
+ *
176
+ * @param int $postid ID of the post that is requested a permalink for.
177
+ * @return string permalink of post.
178
+ *
179
+ * @since 3.1.2
180
+ */
181
+ function gwolle_gb_get_permalink( $postid ) {
182
+
183
+ $permalink = get_permalink( $postid );
184
+ $permalink = apply_filters( 'gwolle_gb_get_permalink', $permalink );
185
+ return $permalink;
186
+
187
+ }
functions/gb-mail.php CHANGED
@@ -86,7 +86,7 @@ Entry content:
86
  $info['blog_name'] = get_bloginfo('name');
87
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
88
  if ( $postid ) {
89
- $permalink = get_permalink( $postid );
90
  if ( is_wp_error( $permalink ) ) {
91
  $info['blog_url'] = get_bloginfo('wpurl') . '?p=' . $postid;
92
  } else {
@@ -193,7 +193,7 @@ Entry content:
193
  $info['blog_name'] = get_bloginfo('name');
194
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
195
  if ( $postid ) {
196
- $permalink = get_permalink( $postid );
197
  if ( is_wp_error( $permalink ) ) {
198
  $info['blog_url'] = get_bloginfo('wpurl') . '?p=' . $postid;
199
  } else {
@@ -271,7 +271,7 @@ Original entry posted on %date%:
271
  $info['blog_name'] = get_bloginfo('name');
272
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
273
  if ( $postid ) {
274
- $permalink = get_permalink( $postid );
275
  if ( is_wp_error( $permalink ) ) {
276
  $info['blog_url'] = get_bloginfo('wpurl') . '?p=' . $postid;
277
  } else {
86
  $info['blog_name'] = get_bloginfo('name');
87
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
88
  if ( $postid ) {
89
+ $permalink = gwolle_gb_get_permalink( $postid );
90
  if ( is_wp_error( $permalink ) ) {
91
  $info['blog_url'] = get_bloginfo('wpurl') . '?p=' . $postid;
92
  } else {
193
  $info['blog_name'] = get_bloginfo('name');
194
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
195
  if ( $postid ) {
196
+ $permalink = gwolle_gb_get_permalink( $postid );
197
  if ( is_wp_error( $permalink ) ) {
198
  $info['blog_url'] = get_bloginfo('wpurl') . '?p=' . $postid;
199
  } else {
271
  $info['blog_name'] = get_bloginfo('name');
272
  $postid = gwolle_gb_get_postid( (int) $entry->get_book_id() );
273
  if ( $postid ) {
274
+ $permalink = gwolle_gb_get_permalink( $postid );
275
  if ( is_wp_error( $permalink ) ) {
276
  $info['blog_url'] = get_bloginfo('wpurl') . '?p=' . $postid;
277
  } else {
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.1
7
  Author: Marcel Pol
8
  Author URI: http://zenoweb.nl
9
  License: GPLv2 or later
@@ -32,7 +32,7 @@ Domain Path: /lang/
32
 
33
 
34
  // Plugin Version
35
- define('GWOLLE_GB_VER', '3.1.1');
36
 
37
 
38
  /*
@@ -48,11 +48,12 @@ define('GWOLLE_GB_VER', '3.1.1');
48
  * - Consider SQL IN when emptying spam/trash.
49
  * - Someday, do something with the REST API. Someday.
50
  * - Unify statuses in one status column like WP_Posts.
 
51
  * - Add status 'revision' to support that too. Add metabox to editor to restore old revision.
52
  * - More smooth import from third parties.
53
  * - Test and possibly add support for Gutenberg editor (shortcode block).
54
  * - Support sticky entries.
55
- * - Support mark-as-ham for Stop Forum Spam.
56
  * - Do something to have less database queries for meta fields in add-on, especially export:
57
  * - Use foreign keys for add-on, set meta var (add function). Test with frontend and export and isam db-engine.
58
  * - Use foreign keys through a hook with SQL, and add a setter for meta.
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.2
7
  Author: Marcel Pol
8
  Author URI: http://zenoweb.nl
9
  License: GPLv2 or later
32
 
33
 
34
  // Plugin Version
35
+ define('GWOLLE_GB_VER', '3.1.2');
36
 
37
 
38
  /*
48
  * - Consider SQL IN when emptying spam/trash.
49
  * - Someday, do something with the REST API. Someday.
50
  * - Unify statuses in one status column like WP_Posts.
51
+ * - Add status 'private', only visible for author and moderators.
52
  * - Add status 'revision' to support that too. Add metabox to editor to restore old revision.
53
  * - More smooth import from third parties.
54
  * - Test and possibly add support for Gutenberg editor (shortcode block).
55
  * - Support sticky entries.
56
+ * - Support mark-as-ham for Stop Forum Spam. Needs API key.
57
  * - Do something to have less database queries for meta fields in add-on, especially export:
58
  * - Use foreign keys for add-on, set meta var (add function). Test with frontend and export and isam db-engine.
59
  * - Use foreign keys through a hook with SQL, and add a setter for meta.
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.1
6
- Stable tag: 3.1.1
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
 
@@ -424,6 +424,14 @@ But if you don't use standard comments, you can just as easily use the comment s
424
 
425
  == Changelog ==
426
 
 
 
 
 
 
 
 
 
427
  = 3.1.1 =
428
  * 2019-03-08
429
  * Drop check for mime-type on import, too many problems.
3
  Tags: guestbook, guest book, livre d'or, Gästebuch, review
4
  Requires at least: 3.7
5
  Tested up to: 5.1
6
+ Stable tag: 3.1.2
7
  License: GPLv2 or later
8
  Requires PHP: 5.3
9
 
424
 
425
  == Changelog ==
426
 
427
+ = 3.1.2 =
428
+ * 2019-04-04
429
+ * Improve accessibility for the frontend metabox.
430
+ * Add filter gwolle_gb_new_entry_frontend.
431
+ * Add filter gwolle_gb_get_permalink.
432
+ * Change arrows in next/prev pagination.
433
+ * Auto-detect line endings in import from CSV.
434
+
435
  = 3.1.1 =
436
  * 2019-03-08
437
  * Drop check for mime-type on import, too many problems.