Public Post Preview - Version 2.6.0

Version Description

(2017-04-27): = * Make DS_Public_Post_Preview::get_preview_link() public. Props @rcstr. * Send no-cache headers for public post previews.

Download this release

Release Info

Developer ocean90
Plugin Icon 128x128 Public Post Preview
Version 2.6.0
Comparing to
See all releases

Code changes from version 2.5.0 to 2.6.0

Files changed (2) hide show
  1. public-post-preview.php +7 -3
  2. readme.txt +6 -3
public-post-preview.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Public Post Preview
4
- * Version: 2.5.0
5
  * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published.
6
  * Author: Dominik Schilling
7
  * Author URI: http://wphelper.de/
@@ -13,7 +13,7 @@
13
  *
14
  * Previously (2009-2011) maintained by Jonathan Dingman and Matt Martz.
15
  *
16
- * Copyright (C) 2012-2016 Dominik Schilling
17
  *
18
  * This program is free software; you can redistribute it and/or
19
  * modify it under the terms of the GNU General Public License
@@ -217,7 +217,7 @@ class DS_Public_Post_Preview {
217
  * @param WP_Post $post The post object.
218
  * @return string The generated public preview link.
219
  */
220
- private static function get_preview_link( $post ) {
221
  if ( 'page' == $post->post_type ) {
222
  $args = array(
223
  'page_id' => $post->ID,
@@ -420,6 +420,10 @@ class DS_Public_Post_Preview {
420
  $query->is_singular() &&
421
  $query->get( '_ppp' )
422
  ) {
 
 
 
 
423
  add_filter( 'posts_results', array( __CLASS__, 'set_post_to_publish' ), 10, 2 );
424
  }
425
 
1
  <?php
2
  /**
3
  * Plugin Name: Public Post Preview
4
+ * Version: 2.6.0
5
  * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published.
6
  * Author: Dominik Schilling
7
  * Author URI: http://wphelper.de/
13
  *
14
  * Previously (2009-2011) maintained by Jonathan Dingman and Matt Martz.
15
  *
16
+ * Copyright (C) 2012-2017 Dominik Schilling
17
  *
18
  * This program is free software; you can redistribute it and/or
19
  * modify it under the terms of the GNU General Public License
217
  * @param WP_Post $post The post object.
218
  * @return string The generated public preview link.
219
  */
220
+ public static function get_preview_link( $post ) {
221
  if ( 'page' == $post->post_type ) {
222
  $args = array(
223
  'page_id' => $post->ID,
420
  $query->is_singular() &&
421
  $query->get( '_ppp' )
422
  ) {
423
+ if ( ! headers_sent() ) {
424
+ nocache_headers();
425
+ }
426
+
427
  add_filter( 'posts_results', array( __CLASS__, 'set_post_to_publish' ), 10, 2 );
428
  }
429
 
readme.txt CHANGED
@@ -1,10 +1,9 @@
1
  === Public Post Preview ===
2
  Contributors: ocean90
3
  Tags: public, post, preview, posts, custom post types, draft
4
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VR8YU922B7K46
5
  Requires at least: 3.5
6
- Tested up to: 4.7
7
- Stable tag: 2.5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -72,6 +71,10 @@ function my_nonce_life() {
72
  Or use the [Public Post Preview Configurator](https://wordpress.org/plugins/public-post-preview-configurator/).
73
 
74
  == Change Log ==
 
 
 
 
75
  = 2.5.0 (2016-04-05): =
76
  * Auto select preview link on focus. Props [@JeroenSormani](https://github.com/JeroenSormani).
77
  * Remove preview status from posts which are trashed or after scheduled posts are published.
1
  === Public Post Preview ===
2
  Contributors: ocean90
3
  Tags: public, post, preview, posts, custom post types, draft
 
4
  Requires at least: 3.5
5
+ Tested up to: 4.9
6
+ Stable tag: 2.6.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
71
  Or use the [Public Post Preview Configurator](https://wordpress.org/plugins/public-post-preview-configurator/).
72
 
73
  == Change Log ==
74
+ = 2.6.0 (2017-04-27): =
75
+ * Make `DS_Public_Post_Preview::get_preview_link()` public. Props [@rcstr](https://github.com/rcstr).
76
+ * Send no-cache headers for public post previews.
77
+
78
  = 2.5.0 (2016-04-05): =
79
  * Auto select preview link on focus. Props [@JeroenSormani](https://github.com/JeroenSormani).
80
  * Remove preview status from posts which are trashed or after scheduled posts are published.