Version Description
= 2.2 = Based on feedback: Removed the extra metabox and added preview link to the main Publish metabox. Requires now WordPress 3.5
= 2.1 = The update fixes a rare issue which had created 404 errors.
= 2.0 = New plugin maintainer, supports now all public post types, saves preview status via an AJAX request, ready for translation, requires at least WordPress 3.3.
Download this release
Release Info
Developer | ocean90 |
Plugin | Public Post Preview |
Version | 2.2-beta |
Comparing to | |
See all releases |
Code changes from version 2.1.1 to 2.2-beta
- js/public-post-preview.js +108 -6
- js/public-post-preview.min.js +6 -0
- lang/ds-public-post-preview-de_DE.mo +0 -0
- lang/ds-public-post-preview-de_DE.po +10 -20
- public-post-preview.php +44 -55
- readme.txt +12 -4
js/public-post-preview.js
CHANGED
@@ -1,6 +1,108 @@
|
|
1 |
-
(function(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function( $ ) {
|
2 |
+
DSPublicPostPreview = {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Initializes the plugin.
|
6 |
+
*
|
7 |
+
* @since 2.0.0
|
8 |
+
*/
|
9 |
+
initialize : function() {
|
10 |
+
var t = this;
|
11 |
+
|
12 |
+
t.checkbox = $( '#public-post-preview' );
|
13 |
+
t.link = $( '#public-post-preview-link' );
|
14 |
+
t.nonce = $( '#public_post_preview_wpnonce' );
|
15 |
+
t.status = $( '#public-post-preview-ajax' );
|
16 |
+
|
17 |
+
t.status.css( 'opacity', 0 );
|
18 |
+
|
19 |
+
if ( ! t.checkbox.prop( 'checked' ) )
|
20 |
+
t.link.hide();
|
21 |
+
|
22 |
+
t.checkbox.bind( 'change', function() {
|
23 |
+
t.change();
|
24 |
+
} );
|
25 |
+
},
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Handles a checkbox change.
|
29 |
+
*
|
30 |
+
* @since 2.0.0
|
31 |
+
*/
|
32 |
+
change : function() {
|
33 |
+
var t = this,
|
34 |
+
checked = t.checkbox.prop( 'checked' ) ? 1 : 0;
|
35 |
+
|
36 |
+
// Toggle visibility of the link
|
37 |
+
t.link.toggle();
|
38 |
+
|
39 |
+
// Disable the checkbox, to prevent double AJAX requests
|
40 |
+
t.checkbox.prop( 'disabled', 'disabled' );
|
41 |
+
|
42 |
+
t.request(
|
43 |
+
{
|
44 |
+
_ajax_nonce : t.nonce.val(),
|
45 |
+
checked : checked,
|
46 |
+
post_ID : $( '#post_ID' ).val()
|
47 |
+
},
|
48 |
+
function( data ) {
|
49 |
+
// data is '1' if it's a successful request
|
50 |
+
if ( data ) {
|
51 |
+
if ( checked ) {
|
52 |
+
t.status.text( DSPublicPostPreviewL10n.enabled );
|
53 |
+
t._pulsate( t.status, 'green' );
|
54 |
+
} else {
|
55 |
+
t.status.text( DSPublicPostPreviewL10n.disabled );
|
56 |
+
t._pulsate( t.status, 'red' );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
// Enable the checkbox again
|
61 |
+
t.checkbox.prop( 'disabled', '' );
|
62 |
+
}
|
63 |
+
);
|
64 |
+
},
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Does the AJAX request.
|
68 |
+
*
|
69 |
+
* @since 2.0.0
|
70 |
+
*
|
71 |
+
* @param {Object} data The data to send.
|
72 |
+
* @param {Object} callback Callback function for a successfull request.
|
73 |
+
*/
|
74 |
+
request : function( data, callback ) {
|
75 |
+
$.ajax( {
|
76 |
+
type: 'POST',
|
77 |
+
url: ajaxurl,
|
78 |
+
data: $.extend(
|
79 |
+
data,
|
80 |
+
{
|
81 |
+
action: 'public-post-preview'
|
82 |
+
}
|
83 |
+
),
|
84 |
+
success : callback
|
85 |
+
} );
|
86 |
+
},
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Helper for a pulse effect.
|
90 |
+
*
|
91 |
+
* @since 2.0.0
|
92 |
+
*
|
93 |
+
* @param {Object} e The element.
|
94 |
+
* @param {String} color The text color of the element.
|
95 |
+
*/
|
96 |
+
_pulsate : function( e, color ) {
|
97 |
+
e.css( 'color', color )
|
98 |
+
.animate( { opacity: 1 }, 600, 'linear' )
|
99 |
+
.animate( { opacity: 0 }, 600, 'linear', function() {
|
100 |
+
e.empty();
|
101 |
+
} );
|
102 |
+
}
|
103 |
+
};
|
104 |
+
|
105 |
+
// Document is ready.
|
106 |
+
$( DSPublicPostPreview.initialize() );
|
107 |
+
|
108 |
+
} )( jQuery );
|
js/public-post-preview.min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(a){DSPublicPostPreview={initialize:function(){var b=this;b.checkbox=a("#public-post-preview");b.link=a("#public-post-preview-link");b.nonce=a("#public_post_preview_wpnonce");
|
2 |
+
b.status=a("#public-post-preview-ajax");b.status.css("opacity",0);if(!b.checkbox.prop("checked")){b.link.hide();}b.checkbox.bind("change",function(){b.change();
|
3 |
+
});},change:function(){var b=this,c=b.checkbox.prop("checked")?1:0;b.link.toggle();b.checkbox.prop("disabled","disabled");b.request({_ajax_nonce:b.nonce.val(),checked:c,post_ID:a("#post_ID").val()},function(d){if(d){if(c){b.status.text(DSPublicPostPreviewL10n.enabled);
|
4 |
+
b._pulsate(b.status,"green");}else{b.status.text(DSPublicPostPreviewL10n.disabled);b._pulsate(b.status,"red");}}b.checkbox.prop("disabled","");});},request:function(b,c){a.ajax({type:"POST",url:ajaxurl,data:a.extend(b,{action:"public-post-preview"}),success:c});
|
5 |
+
},_pulsate:function(c,b){c.css("color",b).animate({opacity:1},600,"linear").animate({opacity:0},600,"linear",function(){c.empty();});}};a(DSPublicPostPreview.initialize());
|
6 |
+
})(jQuery);
|
lang/ds-public-post-preview-de_DE.mo
CHANGED
Binary file
|
lang/ds-public-post-preview-de_DE.po
CHANGED
@@ -1,15 +1,16 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: Public Post Preview v2.
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
-
"PO-Revision-Date:
|
7 |
"Last-Translator: Dominik Schilling <dominik.schilling@gmail.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
|
13 |
"X-Poedit-Language: German\n"
|
14 |
"X-Poedit-Country: GERMANY\n"
|
15 |
"X-Poedit-SourceCharset: utf-8\n"
|
@@ -21,7 +22,6 @@ msgstr ""
|
|
21 |
|
22 |
#. translators: plugin header field 'Name'
|
23 |
#: public-post-preview.php:0
|
24 |
-
#: public-post-preview.php:140
|
25 |
#@ ds-public-post-preview
|
26 |
msgid "Public Post Preview"
|
27 |
msgstr "Öffentliche Vorschau"
|
@@ -50,42 +50,32 @@ msgstr "Dominik Schilling"
|
|
50 |
msgid "http://wphelper.de/"
|
51 |
msgstr "http://wphelper.de/"
|
52 |
|
53 |
-
#: public-post-preview.php:
|
54 |
#@ ds-public-post-preview
|
55 |
msgid "Enabled!"
|
56 |
msgstr "Aktiviert!"
|
57 |
|
58 |
-
#: public-post-preview.php:
|
59 |
#@ ds-public-post-preview
|
60 |
msgid "Disabled!"
|
61 |
msgstr "Deaktiviert!"
|
62 |
|
63 |
-
#: public-post-preview.php:
|
64 |
#@ ds-public-post-preview
|
65 |
msgid "Enable public preview"
|
66 |
msgstr "Öffentliche Vorschau aktivieren"
|
67 |
|
68 |
-
#: public-post-preview.php:
|
69 |
#@ ds-public-post-preview
|
70 |
msgid "(Copy and share this link.)"
|
71 |
msgstr "(Kopiere und teile diesen Link.)"
|
72 |
|
73 |
-
#: public-post-preview.php:
|
74 |
-
#@ ds-public-post-preview
|
75 |
-
msgid "This post is already public."
|
76 |
-
msgstr "Dieser Artikel ist schon veröffentlicht."
|
77 |
-
|
78 |
-
#: public-post-preview.php:181
|
79 |
-
#@ ds-public-post-preview
|
80 |
-
msgid "The current post status is not supported. It needs to be draft, pending or future."
|
81 |
-
msgstr "Der aktuelle Status wird nicht unterstützt. Nur „Ausstehender Review“, „Entwurf“ oder „Planung“ werden unterstützt."
|
82 |
-
|
83 |
-
#: public-post-preview.php:322
|
84 |
#@ ds-public-post-preview
|
85 |
msgid "The link has been expired!"
|
86 |
msgstr "Der Link ist nicht mehr gültig!"
|
87 |
|
88 |
-
#: public-post-preview.php:
|
89 |
#@ ds-public-post-preview
|
90 |
msgid "No Public Preview available!"
|
91 |
msgstr "Keine öffentliche Vorschau verfügbar!"
|
@@ -93,6 +83,6 @@ msgstr "Keine öffentliche Vorschau verfügbar!"
|
|
93 |
#. translators: plugin header field 'Version'
|
94 |
#: public-post-preview.php:0
|
95 |
#@ ds-public-post-preview
|
96 |
-
msgid "2.
|
97 |
msgstr ""
|
98 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: Public Post Preview v2.2-beta\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-03-14 20:18:03+0000\n"
|
7 |
"Last-Translator: Dominik Schilling <dominik.schilling@gmail.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: CSL v1.x\n"
|
14 |
"X-Poedit-Language: German\n"
|
15 |
"X-Poedit-Country: GERMANY\n"
|
16 |
"X-Poedit-SourceCharset: utf-8\n"
|
22 |
|
23 |
#. translators: plugin header field 'Name'
|
24 |
#: public-post-preview.php:0
|
|
|
25 |
#@ ds-public-post-preview
|
26 |
msgid "Public Post Preview"
|
27 |
msgstr "Öffentliche Vorschau"
|
50 |
msgid "http://wphelper.de/"
|
51 |
msgstr "http://wphelper.de/"
|
52 |
|
53 |
+
#: public-post-preview.php:121
|
54 |
#@ ds-public-post-preview
|
55 |
msgid "Enabled!"
|
56 |
msgstr "Aktiviert!"
|
57 |
|
58 |
+
#: public-post-preview.php:122
|
59 |
#@ ds-public-post-preview
|
60 |
msgid "Disabled!"
|
61 |
msgstr "Deaktiviert!"
|
62 |
|
63 |
+
#: public-post-preview.php:168
|
64 |
#@ ds-public-post-preview
|
65 |
msgid "Enable public preview"
|
66 |
msgstr "Öffentliche Vorschau aktivieren"
|
67 |
|
68 |
+
#: public-post-preview.php:173
|
69 |
#@ ds-public-post-preview
|
70 |
msgid "(Copy and share this link.)"
|
71 |
msgstr "(Kopiere und teile diesen Link.)"
|
72 |
|
73 |
+
#: public-post-preview.php:329
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
#@ ds-public-post-preview
|
75 |
msgid "The link has been expired!"
|
76 |
msgstr "Der Link ist nicht mehr gültig!"
|
77 |
|
78 |
+
#: public-post-preview.php:332
|
79 |
#@ ds-public-post-preview
|
80 |
msgid "No Public Preview available!"
|
81 |
msgstr "Keine öffentliche Vorschau verfügbar!"
|
83 |
#. translators: plugin header field 'Version'
|
84 |
#: public-post-preview.php:0
|
85 |
#@ ds-public-post-preview
|
86 |
+
msgid "2.2-beta"
|
87 |
msgstr ""
|
88 |
|
public-post-preview.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Public Post Preview
|
4 |
-
* Version: 2.
|
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/
|
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* Previously (2009-2011) maintained by Jonathan Dingman and Matt Martz.
|
16 |
*
|
17 |
-
* Copyright (C) 2012 Dominik Schilling
|
18 |
*
|
19 |
* This program is free software; you can redistribute it and/or
|
20 |
* modify it under the terms of the GNU General Public License
|
@@ -45,7 +45,7 @@ if ( ! class_exists( 'WP' ) ) {
|
|
45 |
* - pre_get_posts
|
46 |
* - query_vars
|
47 |
* - init
|
48 |
-
* -
|
49 |
* - save_post
|
50 |
* - posts_results
|
51 |
* - wp_ajax_public-post-preview
|
@@ -72,7 +72,7 @@ class DS_Public_Post_Preview {
|
|
72 |
|
73 |
add_filter( 'query_vars', array( __CLASS__, 'add_query_var' ) );
|
74 |
} else {
|
75 |
-
add_action( '
|
76 |
|
77 |
add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
|
78 |
|
@@ -104,7 +104,7 @@ class DS_Public_Post_Preview {
|
|
104 |
if ( ! in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) )
|
105 |
return;
|
106 |
|
107 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '
|
108 |
|
109 |
wp_enqueue_script(
|
110 |
'ds-public-post-preview',
|
@@ -124,67 +124,56 @@ class DS_Public_Post_Preview {
|
|
124 |
);
|
125 |
}
|
126 |
|
127 |
-
|
128 |
/**
|
129 |
-
*
|
130 |
-
* Only public post types are used.
|
131 |
*
|
132 |
-
* @since 2.
|
133 |
*/
|
134 |
-
public static function
|
135 |
$post_types = get_post_types(
|
136 |
array(
|
137 |
'public' => true
|
138 |
)
|
139 |
);
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
/**
|
154 |
-
*
|
155 |
-
* Checks current post status and shows the checkbox + link field if the post status
|
156 |
-
* is draft, pending or future.
|
157 |
*
|
158 |
-
* @since 2.0.0
|
159 |
-
*
|
160 |
-
* @param object $post The current post object.
|
161 |
*/
|
162 |
-
|
163 |
-
if (
|
164 |
-
|
|
|
|
|
165 |
|
166 |
$preview_post_ids = self::get_preview_post_ids();
|
167 |
?>
|
168 |
-
<
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
<
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
</p>
|
178 |
-
<?php
|
179 |
-
elseif ( in_array( $post->post_status, array( 'publish' ) ) ) :
|
180 |
-
?>
|
181 |
-
<p><?php _e( 'This post is already public.', 'ds-public-post-preview' ); ?>
|
182 |
-
<?php
|
183 |
-
else :
|
184 |
-
?>
|
185 |
-
<p><?php _e( 'The current post status is not supported. It needs to be draft, pending or future.', 'ds-public-post-preview' ); ?>
|
186 |
<?php
|
187 |
-
endif;
|
188 |
}
|
189 |
|
190 |
/**
|
@@ -203,7 +192,7 @@ class DS_Public_Post_Preview {
|
|
203 |
return add_query_arg(
|
204 |
array(
|
205 |
'preview' => true,
|
206 |
-
'_ppp'
|
207 |
),
|
208 |
get_permalink( $post_id )
|
209 |
);
|
@@ -224,7 +213,7 @@ class DS_Public_Post_Preview {
|
|
224 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
225 |
return false;
|
226 |
|
227 |
-
if( wp_is_post_revision( $post_id ) )
|
228 |
return false;
|
229 |
|
230 |
if ( empty( $_POST['public_post_preview_wpnonce'] ) || ! wp_verify_nonce( $_POST['public_post_preview_wpnonce'], 'public_post_preview' ) )
|
@@ -265,10 +254,10 @@ class DS_Public_Post_Preview {
|
|
265 |
$post = get_post( $preview_post_id );
|
266 |
|
267 |
if ( ( 'page' == $post->post_type && ! current_user_can( 'edit_page', $preview_post_id ) ) || ! current_user_can( 'edit_post', $preview_post_id ) )
|
268 |
-
|
269 |
|
270 |
if ( ! in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) )
|
271 |
-
|
272 |
|
273 |
$preview_post_ids = self::get_preview_post_ids();
|
274 |
|
@@ -277,14 +266,14 @@ class DS_Public_Post_Preview {
|
|
277 |
elseif ( ! empty( $_POST['checked'] ) && ! in_array( $preview_post_id, $preview_post_ids ) )
|
278 |
$preview_post_ids = array_merge( $preview_post_ids, (array) $preview_post_id );
|
279 |
else
|
280 |
-
|
281 |
|
282 |
$ret = self::set_preview_post_ids( $preview_post_ids );
|
283 |
|
284 |
if ( ! $ret )
|
285 |
-
|
286 |
|
287 |
-
|
288 |
}
|
289 |
|
290 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Public Post Preview
|
4 |
+
* Version: 2.2-beta
|
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/
|
14 |
*
|
15 |
* Previously (2009-2011) maintained by Jonathan Dingman and Matt Martz.
|
16 |
*
|
17 |
+
* Copyright (C) 2012-2013 Dominik Schilling
|
18 |
*
|
19 |
* This program is free software; you can redistribute it and/or
|
20 |
* modify it under the terms of the GNU General Public License
|
45 |
* - pre_get_posts
|
46 |
* - query_vars
|
47 |
* - init
|
48 |
+
* - post_submitbox_misc_actions
|
49 |
* - save_post
|
50 |
* - posts_results
|
51 |
* - wp_ajax_public-post-preview
|
72 |
|
73 |
add_filter( 'query_vars', array( __CLASS__, 'add_query_var' ) );
|
74 |
} else {
|
75 |
+
add_action( 'post_submitbox_misc_actions', array( __CLASS__, 'post_submitbox_misc_actions' ) );
|
76 |
|
77 |
add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
|
78 |
|
104 |
if ( ! in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) )
|
105 |
return;
|
106 |
|
107 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
108 |
|
109 |
wp_enqueue_script(
|
110 |
'ds-public-post-preview',
|
124 |
);
|
125 |
}
|
126 |
|
|
|
127 |
/**
|
128 |
+
* Adds the checkbox to the submit metabox
|
|
|
129 |
*
|
130 |
+
* @since 2.2.0
|
131 |
*/
|
132 |
+
public static function post_submitbox_misc_actions() {
|
133 |
$post_types = get_post_types(
|
134 |
array(
|
135 |
'public' => true
|
136 |
)
|
137 |
);
|
138 |
|
139 |
+
$post = get_post();
|
140 |
+
|
141 |
+
if ( ! in_array( $post->post_type, $post_types ) )
|
142 |
+
return false;
|
143 |
+
|
144 |
+
if ( ! in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) )
|
145 |
+
return false;
|
146 |
+
|
147 |
+
?>
|
148 |
+
<div class="misc-pub-section public-post-preview">
|
149 |
+
<?php self::get_checkbox_html( $post ); ?>
|
150 |
+
</div>
|
151 |
+
<?php
|
152 |
+
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
+
* Prints the checkbox if the is draft, pending or future.
|
|
|
|
|
157 |
*
|
|
|
|
|
|
|
158 |
*/
|
159 |
+
private static function get_checkbox_html( $post ) {
|
160 |
+
if ( empty( $post ) )
|
161 |
+
$post = get_post();
|
162 |
+
|
163 |
+
wp_nonce_field( 'public_post_preview', 'public_post_preview_wpnonce' );
|
164 |
|
165 |
$preview_post_ids = self::get_preview_post_ids();
|
166 |
?>
|
167 |
+
<label><input type="checkbox"<?php checked( in_array( $post->ID, $preview_post_ids ) ); ?> name="public_post_preview" id="public-post-preview" value="1" />
|
168 |
+
<?php _e( 'Enable public preview', 'ds-public-post-preview' ); ?> <span id="public-post-preview-ajax"></span></label>
|
169 |
+
|
170 |
+
<div id="public-post-preview-link" style="margin-top:6px">
|
171 |
+
<label>
|
172 |
+
<input type="text" name="public_post_preview_link" class="regular-text" value="<?php echo esc_attr( self::get_preview_link( $post->ID ) ); ?>" style="width:99%" readonly />
|
173 |
+
<span class="description"><?php _e( '(Copy and share this link.)', 'ds-public-post-preview' ); ?></span>
|
174 |
+
</label>
|
175 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
<?php
|
|
|
177 |
}
|
178 |
|
179 |
/**
|
192 |
return add_query_arg(
|
193 |
array(
|
194 |
'preview' => true,
|
195 |
+
'_ppp' => self::create_nonce( 'public_post_preview_' . $post_id ),
|
196 |
),
|
197 |
get_permalink( $post_id )
|
198 |
);
|
213 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
214 |
return false;
|
215 |
|
216 |
+
if ( wp_is_post_revision( $post_id ) )
|
217 |
return false;
|
218 |
|
219 |
if ( empty( $_POST['public_post_preview_wpnonce'] ) || ! wp_verify_nonce( $_POST['public_post_preview_wpnonce'], 'public_post_preview' ) )
|
254 |
$post = get_post( $preview_post_id );
|
255 |
|
256 |
if ( ( 'page' == $post->post_type && ! current_user_can( 'edit_page', $preview_post_id ) ) || ! current_user_can( 'edit_post', $preview_post_id ) )
|
257 |
+
wp_die( 0 );
|
258 |
|
259 |
if ( ! in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) )
|
260 |
+
wp_die( 0 );
|
261 |
|
262 |
$preview_post_ids = self::get_preview_post_ids();
|
263 |
|
266 |
elseif ( ! empty( $_POST['checked'] ) && ! in_array( $preview_post_id, $preview_post_ids ) )
|
267 |
$preview_post_ids = array_merge( $preview_post_ids, (array) $preview_post_id );
|
268 |
else
|
269 |
+
wp_die( 0 );
|
270 |
|
271 |
$ret = self::set_preview_post_ids( $preview_post_ids );
|
272 |
|
273 |
if ( ! $ret )
|
274 |
+
wp_die( 0 );
|
275 |
|
276 |
+
wp_die( 1 );
|
277 |
}
|
278 |
|
279 |
/**
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: ocean90
|
3 |
Tags: public, post, preview, posts, custom post types
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VR8YU922B7K46
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -20,7 +20,7 @@ Have you ever been writing a post with the help of someone who does not have acc
|
|
20 |
|
21 |
*Previously this plugin was maintained by [Matt Martz](http://profiles.wordpress.org/sivel/) and was an idea of [Jonathan Dingman](http://profiles.wordpress.org/jdingman/).*
|
22 |
|
23 |
-
= Feedback =
|
24 |
If you want, you can drop me a line @[ocean90](http://twitter.com/ocean90) on Twitter or @[Dominik Schilling](https://plus.google.com/101675293278434581718/) on Google+.
|
25 |
|
26 |
= More =
|
@@ -55,6 +55,9 @@ To upload the plugin through WordPress, instead of FTP:
|
|
55 |
|
56 |
== Upgrade Notice ==
|
57 |
|
|
|
|
|
|
|
58 |
= 2.1 =
|
59 |
The update fixes a rare issue which had created 404 errors.
|
60 |
|
@@ -88,6 +91,11 @@ function my_nonce_life() {
|
|
88 |
}`
|
89 |
|
90 |
== Change Log ==
|
|
|
|
|
|
|
|
|
|
|
91 |
= 2.1.1 (20012-09-19): =
|
92 |
* Sorry for the new update. Through a change in 2.1 a filter was applied to each query. The misplaced "The link has been expired!" message is now gone. Props Aki Björklund and Jonathan Channon.
|
93 |
|
2 |
Contributors: ocean90
|
3 |
Tags: public, post, preview, posts, custom post types
|
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: 3.6
|
7 |
+
Stable tag: 2.2-beta
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
20 |
|
21 |
*Previously this plugin was maintained by [Matt Martz](http://profiles.wordpress.org/sivel/) and was an idea of [Jonathan Dingman](http://profiles.wordpress.org/jdingman/).*
|
22 |
|
23 |
+
= Feedback =
|
24 |
If you want, you can drop me a line @[ocean90](http://twitter.com/ocean90) on Twitter or @[Dominik Schilling](https://plus.google.com/101675293278434581718/) on Google+.
|
25 |
|
26 |
= More =
|
55 |
|
56 |
== Upgrade Notice ==
|
57 |
|
58 |
+
= 2.2 =
|
59 |
+
Based on feedback: Removed the extra metabox and added preview link to the main Publish metabox. Requires now WordPress 3.5
|
60 |
+
|
61 |
= 2.1 =
|
62 |
The update fixes a rare issue which had created 404 errors.
|
63 |
|
91 |
}`
|
92 |
|
93 |
== Change Log ==
|
94 |
+
= 2.2 (20013-03-15): =
|
95 |
+
* Based on feedback I have removed the extra metabox and added the preview link to the main Publish metabox
|
96 |
+
* Only shows the checkbox if the post status/post type is good
|
97 |
+
* Requires now WordPress 3.5
|
98 |
+
|
99 |
= 2.1.1 (20012-09-19): =
|
100 |
* Sorry for the new update. Through a change in 2.1 a filter was applied to each query. The misplaced "The link has been expired!" message is now gone. Props Aki Björklund and Jonathan Channon.
|
101 |
|