Version Description
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.0 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 2.0
- js/public-post-preview.dev.js +111 -0
- js/public-post-preview.js +6 -0
- lang/ds-public-post-preview-de_DE.mo +0 -0
- lang/ds-public-post-preview-de_DE.po +98 -0
- lang/ds-public-post-preview-xx_XX.pot +21 -0
- public-post-preview.php +409 -92
- readme.txt +47 -17
- screenshot-1.png +0 -0
- uninstall.php +0 -8
js/public-post-preview.dev.js
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
if ( ! t.checkbox.prop( 'checked' ) )
|
18 |
+
t.link.hide();
|
19 |
+
|
20 |
+
t.checkbox.bind( 'change', function() {
|
21 |
+
t.change();
|
22 |
+
} );
|
23 |
+
},
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Handles a checkbox change.
|
27 |
+
*
|
28 |
+
* @since 2.0.0
|
29 |
+
*/
|
30 |
+
change : function() {
|
31 |
+
var t = this,
|
32 |
+
checked = t.checkbox.prop( 'checked' ) ? 1 : 0;
|
33 |
+
|
34 |
+
// Toggle visibility of the link
|
35 |
+
t.link.toggle();
|
36 |
+
|
37 |
+
// Disable the checkbox, to prevent double AJAX requests
|
38 |
+
t.checkbox.prop( 'disabled', 'disabled' );
|
39 |
+
|
40 |
+
t.request(
|
41 |
+
{
|
42 |
+
_ajax_nonce : t.nonce.val(),
|
43 |
+
checked : checked,
|
44 |
+
post_ID : $( '#post_ID' ).val()
|
45 |
+
},
|
46 |
+
function( data ) {
|
47 |
+
// data is '1' if it's a successful request
|
48 |
+
if ( data ) {
|
49 |
+
if ( checked ) {
|
50 |
+
t.status.text( DSPublicPostPreviewL10n.enabled );
|
51 |
+
t._pulsate( t.status, 'green' );
|
52 |
+
} else {
|
53 |
+
t.status.text( DSPublicPostPreviewL10n.disabled );
|
54 |
+
t._pulsate( t.status, 'red' );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
// Enable the checkbox again
|
59 |
+
t.checkbox.prop('disabled', '');
|
60 |
+
}
|
61 |
+
);
|
62 |
+
},
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Does the AJAX request.
|
66 |
+
*
|
67 |
+
* @since 2.0.0
|
68 |
+
*
|
69 |
+
* @param {Object} data The data to send.
|
70 |
+
* @param {Object} callback Callback function for a successfull request.
|
71 |
+
*/
|
72 |
+
request : function( data, callback ) {
|
73 |
+
$.ajax( {
|
74 |
+
type: 'POST',
|
75 |
+
url: ajaxurl,
|
76 |
+
data: $.extend(
|
77 |
+
data,
|
78 |
+
{
|
79 |
+
action: 'public-post-preview'
|
80 |
+
}
|
81 |
+
),
|
82 |
+
success : callback
|
83 |
+
} );
|
84 |
+
},
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Helper for a pulse effect.
|
88 |
+
*
|
89 |
+
* @since 2.0.0
|
90 |
+
*
|
91 |
+
* @param {Object} e The element.
|
92 |
+
* @param {String} color The text color of the element.
|
93 |
+
*/
|
94 |
+
_pulsate : function( e, color ) {
|
95 |
+
e.css( 'color', color )
|
96 |
+
.animate( { opacity: 0 }, 600, 'linear' )
|
97 |
+
.animate( { opacity: 1 }, 600, 'linear' )
|
98 |
+
.animate( { opacity: 0 }, 600, 'linear' )
|
99 |
+
.animate( { opacity: 1 }, 600, 'linear' )
|
100 |
+
.animate( { opacity: 0 }, 600, 'linear', function() {
|
101 |
+
e.text( '' );
|
102 |
+
} );
|
103 |
+
}
|
104 |
+
};
|
105 |
+
|
106 |
+
// Document is ready.
|
107 |
+
$( function() {
|
108 |
+
DSPublicPostPreview.initialize();
|
109 |
+
} );
|
110 |
+
|
111 |
+
} )( jQuery );
|
js/public-post-preview.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");if(!b.checkbox.prop("checked")){b.link.hide();}b.checkbox.bind("change",function(){b.change();});},change:function(){var b=this,c=b.checkbox.prop("checked")?1:0;
|
3 |
+
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:0},600,"linear").animate({opacity:1},600,"linear").animate({opacity:0},600,"linear").animate({opacity:1},600,"linear").animate({opacity:0},600,"linear",function(){c.text("");
|
6 |
+
});}};a(function(){DSPublicPostPreview.initialize();});})(jQuery);
|
lang/ds-public-post-preview-de_DE.mo
ADDED
Binary file
|
lang/ds-public-post-preview-de_DE.po
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Public Post Preview v2.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2012-07-21 23:09:45+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-Poedit-Language: German\n"
|
14 |
+
"X-Poedit-Country: GERMANY\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
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"
|
28 |
+
|
29 |
+
#. translators: plugin header field 'PluginURI'
|
30 |
+
#: public-post-preview.php:0
|
31 |
+
#@ ds-public-post-preview
|
32 |
+
msgid "http://wpgrafie.de/wp-plugins/public-post-preview/en/"
|
33 |
+
msgstr "http://wpgrafie.de/wp-plugins/public-post-preview/"
|
34 |
+
|
35 |
+
#. translators: plugin header field 'Description'
|
36 |
+
#: public-post-preview.php:0
|
37 |
+
#@ ds-public-post-preview
|
38 |
+
msgid "Enables you to give a link to anonymous users for public preview of any post type before it is published."
|
39 |
+
msgstr "Bietet die Möglichkeit einen Link mit Dritten zu Teilen, um eine Vorschau eines bisher unveröffentlichten Inhaltstyp zu geben."
|
40 |
+
|
41 |
+
#. translators: plugin header field 'Author'
|
42 |
+
#: public-post-preview.php:0
|
43 |
+
#@ ds-public-post-preview
|
44 |
+
msgid "Dominik Schilling"
|
45 |
+
msgstr "Dominik Schilling"
|
46 |
+
|
47 |
+
#. translators: plugin header field 'AuthorURI'
|
48 |
+
#: public-post-preview.php:0
|
49 |
+
#@ ds-public-post-preview
|
50 |
+
msgid "http://wphelper.de/"
|
51 |
+
msgstr "http://wphelper.de/"
|
52 |
+
|
53 |
+
#. translators: plugin header field 'Version'
|
54 |
+
#: public-post-preview.php:0
|
55 |
+
#@ ds-public-post-preview
|
56 |
+
msgid "2.0"
|
57 |
+
msgstr "2.0-DE"
|
58 |
+
|
59 |
+
#: public-post-preview.php:117
|
60 |
+
#@ ds-public-post-preview
|
61 |
+
msgid "Enabled!"
|
62 |
+
msgstr "Aktiviert!"
|
63 |
+
|
64 |
+
#: public-post-preview.php:118
|
65 |
+
#@ ds-public-post-preview
|
66 |
+
msgid "Disabled!"
|
67 |
+
msgstr "Deaktiviert!"
|
68 |
+
|
69 |
+
#: public-post-preview.php:166
|
70 |
+
#@ ds-public-post-preview
|
71 |
+
msgid "Enable public preview"
|
72 |
+
msgstr "Öffentliche Vorschau aktivieren"
|
73 |
+
|
74 |
+
#: public-post-preview.php:171
|
75 |
+
#@ ds-public-post-preview
|
76 |
+
msgid "(Copy and share this link.)"
|
77 |
+
msgstr "(Kopiere und teile diesen Link.)"
|
78 |
+
|
79 |
+
#: public-post-preview.php:177
|
80 |
+
#@ ds-public-post-preview
|
81 |
+
msgid "This post is already public."
|
82 |
+
msgstr "Dieser Artikel ist schon veröffentlicht."
|
83 |
+
|
84 |
+
#: public-post-preview.php:181
|
85 |
+
#@ ds-public-post-preview
|
86 |
+
msgid "The current post status is not supported. It needs to be draft, pending or future."
|
87 |
+
msgstr "Der aktuelle Status wird nicht unterstützt. Nur „Ausstehender Review“, „Entwurf“ oder „Planung“ werden unterstützt."
|
88 |
+
|
89 |
+
#: public-post-preview.php:322
|
90 |
+
#@ ds-public-post-preview
|
91 |
+
msgid "The link has been expired!"
|
92 |
+
msgstr "Der Link ist nicht mehr gültig!"
|
93 |
+
|
94 |
+
#: public-post-preview.php:325
|
95 |
+
#@ ds-public-post-preview
|
96 |
+
msgid "No Public Preview available!"
|
97 |
+
msgstr "Keine öffentliche Vorschau verfügbar!"
|
98 |
+
|
lang/ds-public-post-preview-xx_XX.pot
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: PlaceHolder\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2012-07-21 23:01:26+0000\n"
|
7 |
+
"Last-Translator: none\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: English\n"
|
14 |
+
"X-Poedit-Country: UNITED STATES\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
public-post-preview.php
CHANGED
@@ -1,119 +1,436 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
Plugin Name: Public Post Preview
|
4 |
-
|
5 |
-
Description: Enables you to give a link to anonymous users for public preview of
|
6 |
-
Author:
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
-
// create a nonce
|
48 |
-
function create_nonce($action = -1) {
|
49 |
-
$i = wp_nonce_tick();
|
50 |
-
return substr(wp_hash($i . $action, 'nonce'), -12, 10);
|
51 |
-
}
|
52 |
-
|
53 |
-
// Content for meta box
|
54 |
-
function preview_link($post) {
|
55 |
-
$preview_posts = get_option('public_post_preview');
|
56 |
-
if ( ! in_array($post->post_status, array('publish')) ) {
|
57 |
-
?>
|
58 |
-
<p>
|
59 |
-
<label for="public_preview_status" class="selectit">
|
60 |
-
<input type="checkbox" name="public_preview_status" id="public_preview_status"<?php if ( !isset($preview_posts[$post->ID]) ) echo ' checked="checked"'; ?>/>
|
61 |
-
Public Preview
|
62 |
-
</label>
|
63 |
-
</p>
|
64 |
-
<?php
|
65 |
-
if ( ! isset($preview_posts[$post->ID]) ) {
|
66 |
-
$this->id = (int) $post->ID;
|
67 |
-
$nonce = $this->create_nonce('public_post_preview_' . $this->id);
|
68 |
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
-
|
104 |
-
wp_die('You do not have permission to publicly preview this post.');
|
105 |
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
$posts[0]->post_status = 'publish';
|
|
|
113 |
return $posts;
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
|
117 |
-
|
118 |
|
119 |
-
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Public Post Preview
|
4 |
+
* Version: 2.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/
|
8 |
+
* Plugin URI: http://wpgrafie.de/wp-plugins/public-post-preview/en/
|
9 |
+
*
|
10 |
+
* Text Domain: ds-public-post-preview
|
11 |
+
* Domain Path: /lang
|
12 |
+
*
|
13 |
+
* License: GPLv2 or later
|
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
|
21 |
+
* as published by the Free Software Foundation; either version 2
|
22 |
+
* of the License, or (at your option) any later version.
|
23 |
+
*
|
24 |
+
* This program is distributed in the hope that it will be useful,
|
25 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
+
* GNU General Public License for more details.
|
28 |
+
*
|
29 |
+
* You should have received a copy of the GNU General Public License
|
30 |
+
* along with this program; if not, write to the Free Software
|
31 |
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
32 |
+
*/
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Don't call this file directly.
|
36 |
+
*/
|
37 |
+
if ( ! class_exists( 'WP' ) ) {
|
38 |
+
die();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* The class which controls the plugin.
|
43 |
+
*
|
44 |
+
* Used hooks:
|
45 |
+
* - pre_get_posts
|
46 |
+
* - add_meta_boxes
|
47 |
+
* - save_post
|
48 |
+
* - posts_results
|
49 |
+
* - wp_ajax_public-post-preview
|
50 |
+
* - admin_enqueue_scripts
|
51 |
+
* - init
|
52 |
+
*
|
53 |
+
* Inits at 'plugins_loaded' hook.
|
54 |
+
*
|
55 |
+
*/
|
56 |
+
class DS_Public_Post_Preview {
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Hooks into 'pre_get_posts' to handle public preview, only nn-admin
|
60 |
+
* Hooks into 'add_meta_boxes' to register the meta box.
|
61 |
+
* Hooks into 'save_post' to handle the values of the meta box.
|
62 |
+
* Hooks into 'admin_enqueue_scripts' to register JavaScript.
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
*/
|
66 |
+
public static function init() {
|
67 |
+
if ( ! is_admin() )
|
68 |
+
add_filter( 'pre_get_posts', array( __CLASS__, 'show_public_preview' ) );
|
69 |
+
|
70 |
+
add_action( 'init', array( __CLASS__, 'load_textdomain' ) );
|
71 |
+
|
72 |
+
add_action( 'add_meta_boxes', array( __CLASS__, 'register_meta_boxes' ) );
|
73 |
+
|
74 |
+
add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
|
75 |
+
|
76 |
+
add_action( 'wp_ajax_public-post-preview', array( __CLASS__, 'ajax_register_public_preview' ) );
|
77 |
+
|
78 |
+
add_action( 'admin_enqueue_scripts' , array( __CLASS__, 'enqueue_script' ) );
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* Registers the textdomain.
|
83 |
+
*
|
84 |
+
* @since 2.0.0
|
85 |
+
*/
|
86 |
+
public static function load_textdomain() {
|
87 |
+
return load_plugin_textdomain(
|
88 |
+
'ds-public-post-preview',
|
89 |
+
false,
|
90 |
+
dirname( plugin_basename( __FILE__ ) ) . '/lang'
|
91 |
+
);
|
92 |
}
|
93 |
|
94 |
+
/**
|
95 |
+
* Registers the JavaScript file for post(-new).php.
|
96 |
+
*
|
97 |
+
* @since 2.0.0
|
98 |
+
*/
|
99 |
+
public static function enqueue_script( $hook_suffix ) {
|
100 |
+
if ( ! in_array( $hook_suffix, array( 'post.php', 'post-new.php' ) ) )
|
101 |
+
return;
|
102 |
+
|
103 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
|
104 |
+
|
105 |
+
wp_enqueue_script(
|
106 |
+
'ds-public-post-preview',
|
107 |
+
plugins_url( "js/public-post-preview$suffix.js", __FILE__ ),
|
108 |
+
array( 'jquery' ),
|
109 |
+
self::get_plugin_info( 'Version' ),
|
110 |
+
true
|
111 |
+
);
|
112 |
+
|
113 |
+
wp_localize_script(
|
114 |
+
'ds-public-post-preview',
|
115 |
+
'DSPublicPostPreviewL10n',
|
116 |
+
array(
|
117 |
+
'enabled' => __( 'Enabled!', 'ds-public-post-preview' ),
|
118 |
+
'disabled' => __( 'Disabled!', 'ds-public-post-preview' )
|
119 |
+
)
|
120 |
+
);
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
/**
|
125 |
+
* Registers for each post type a meta box.
|
126 |
+
* Only public post types are used.
|
127 |
+
*
|
128 |
+
* @since 2.0.0
|
129 |
+
*/
|
130 |
+
public static function register_meta_boxes() {
|
131 |
+
$post_types = get_post_types(
|
132 |
+
array(
|
133 |
+
'public' => true
|
134 |
+
)
|
135 |
+
);
|
136 |
|
137 |
+
foreach ( $post_types as $post_type ) {
|
138 |
+
add_meta_box(
|
139 |
+
'ds-public-post-preview',
|
140 |
+
__( 'Public Post Preview', 'ds-public-post-preview' ),
|
141 |
+
array( __CLASS__, 'public_post_preview_metabox_cb' ),
|
142 |
+
$post_type,
|
143 |
+
'normal',
|
144 |
+
'high'
|
145 |
+
);
|
146 |
}
|
147 |
}
|
148 |
|
149 |
+
/**
|
150 |
+
* Callback method for the meta boxes.
|
151 |
+
* Checks current post status and shows the checkbox + link field if the post status
|
152 |
+
* is draft, pending or future.
|
153 |
+
*
|
154 |
+
* @since 2.0.0
|
155 |
+
*
|
156 |
+
* @param object $post The current post object.
|
157 |
+
*/
|
158 |
+
public static function public_post_preview_metabox_cb( $post ) {
|
159 |
+
if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) :
|
160 |
+
wp_nonce_field( 'public_post_preview', 'public_post_preview_wpnonce' );
|
161 |
+
|
162 |
+
$preview_post_ids = self::get_preview_post_ids();
|
163 |
+
?>
|
164 |
+
<p>
|
165 |
+
<label><input type="checkbox"<?php checked( in_array( $post->ID, $preview_post_ids ) ); ?> name="public_post_preview" id="public-post-preview" value="1" />
|
166 |
+
<?php _e( 'Enable public preview', 'ds-public-post-preview' ); ?> <span id="public-post-preview-ajax"></span></label>
|
167 |
+
</p>
|
168 |
+
<p id="public-post-preview-link">
|
169 |
+
<label>
|
170 |
+
<input type="text" name="public_post_preview_link" class="regular-text disabled" value="<?php echo esc_attr( self::get_preview_link( $post->ID ) ); ?>" style="width:99%;" disabled="disabled" />
|
171 |
+
<?php _e( '(Copy and share this link.)', 'ds-public-post-preview' ); ?>
|
172 |
+
</label>
|
173 |
+
</p>
|
174 |
+
<?php
|
175 |
+
elseif ( in_array( $post->post_status, array( 'publish' ) ) ) :
|
176 |
+
?>
|
177 |
+
<p><?php _e( 'This post is already public.', 'ds-public-post-preview' ); ?>
|
178 |
+
<?php
|
179 |
+
else :
|
180 |
+
?>
|
181 |
+
<p><?php _e( 'The current post status is not supported. It needs to be draft, pending or future.', 'ds-public-post-preview' ); ?>
|
182 |
+
<?php
|
183 |
+
endif;
|
184 |
}
|
185 |
|
186 |
+
/**
|
187 |
+
* Returns the public preview link.
|
188 |
+
*
|
189 |
+
* The link is the permalink with these parameters:
|
190 |
+
* - preview, always true (query var for core)
|
191 |
+
* - _ppp, a custom nonce, see DS_Public_Post_Preview::create_nonce()
|
192 |
+
*
|
193 |
+
* @since 2.0.0
|
194 |
+
*
|
195 |
+
* @param int $post_id The post id.
|
196 |
+
* @return string The generated public preview link.
|
197 |
+
*/
|
198 |
+
private static function get_preview_link( $post_id ) {
|
199 |
+
return add_query_arg(
|
200 |
+
array(
|
201 |
+
'preview' => true,
|
202 |
+
'_ppp' => self::create_nonce( 'public_post_preview_' . $post_id ),
|
203 |
+
),
|
204 |
+
get_permalink( $post_id )
|
205 |
+
);
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* (Un)Registers a post for a public preview.
|
210 |
+
*
|
211 |
+
* Don't runs on an autosave and ignores post revisions.
|
212 |
+
*
|
213 |
+
* @since 2.0.0
|
214 |
+
*
|
215 |
+
* @param int $post_id The post id.
|
216 |
+
* @param object $post The post object.
|
217 |
+
* @return bool Returns false on a failure, true on a success.
|
218 |
+
*/
|
219 |
+
public static function register_public_preview( $post_id, $post ) {
|
220 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
221 |
+
return false;
|
222 |
+
|
223 |
+
if( wp_is_post_revision( $post_id ) )
|
224 |
+
return false;
|
225 |
+
|
226 |
+
if ( empty( $_POST['public_post_preview_wpnonce'] ) || ! wp_verify_nonce( $_POST['public_post_preview_wpnonce'], 'public_post_preview' ) )
|
227 |
+
return false;
|
228 |
+
|
229 |
+
$preview_post_ids = self::get_preview_post_ids();
|
230 |
+
$preview_post_id = $post->ID;
|
231 |
+
|
232 |
+
if ( empty( $_POST['public_post_preview'] ) && in_array( $preview_post_id, $preview_post_ids ) )
|
233 |
+
$preview_post_ids = array_diff( $preview_post_ids, (array) $preview_post_id );
|
234 |
+
elseif (
|
235 |
+
! empty( $_POST['public_post_preview'] ) &&
|
236 |
+
! empty( $_POST['original_post_status'] ) &&
|
237 |
+
'publish' != $_POST['original_post_status'] &&
|
238 |
+
'publish' == $post->post_status &&
|
239 |
+
in_array( $preview_post_id, $preview_post_ids )
|
240 |
+
)
|
241 |
+
$preview_post_ids = array_diff( $preview_post_ids, (array) $preview_post_id );
|
242 |
+
elseif ( ! empty( $_POST['public_post_preview'] ) && ! in_array( $preview_post_id, $preview_post_ids ) )
|
243 |
+
$preview_post_ids = array_merge( $preview_post_ids, (array) $preview_post_id );
|
244 |
+
else
|
245 |
+
return false; // Nothing changed.
|
246 |
+
|
247 |
+
return self::set_preview_post_ids( $preview_post_ids );
|
248 |
}
|
249 |
|
250 |
+
/**
|
251 |
+
* (Un)Registers a post for a public preview for an AJAX request.
|
252 |
+
*
|
253 |
+
* @since 2.0.0
|
254 |
+
*
|
255 |
+
* @return string Returns '0' on a failure, '1' on success.
|
256 |
+
*/
|
257 |
+
public static function ajax_register_public_preview() {
|
258 |
+
check_ajax_referer( 'public_post_preview' );
|
259 |
+
|
260 |
+
$preview_post_id = (int) $_POST['post_ID'];
|
261 |
+
$post = get_post( $preview_post_id );
|
262 |
+
|
263 |
+
if ( ( 'page' == $post->post_type && ! current_user_can( 'edit_page', $preview_post_id ) ) || ! current_user_can( 'edit_post', $preview_post_id ) )
|
264 |
+
die( '0' );
|
265 |
+
|
266 |
+
if ( ! in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) )
|
267 |
+
die( '0' );
|
268 |
+
|
269 |
+
$preview_post_ids = self::get_preview_post_ids();
|
270 |
+
|
271 |
+
if ( empty( $_POST['checked'] ) && in_array( $preview_post_id, $preview_post_ids ) )
|
272 |
+
$preview_post_ids = array_diff( $preview_post_ids, (array) $preview_post_id );
|
273 |
+
elseif ( ! empty( $_POST['checked'] ) && ! in_array( $preview_post_id, $preview_post_ids ) )
|
274 |
+
$preview_post_ids = array_merge( $preview_post_ids, (array) $preview_post_id );
|
275 |
+
else
|
276 |
+
die( '0' );
|
277 |
|
278 |
+
$ret = self::set_preview_post_ids( $preview_post_ids );
|
|
|
279 |
|
280 |
+
if ( ! $ret )
|
281 |
+
die( '0' );
|
282 |
+
|
283 |
+
die( '1' );
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Show the post if it's a public preview.
|
288 |
+
*
|
289 |
+
* Only if it's the main query, a preview, a singular page and
|
290 |
+
* DS_Public_Post_Preview::public_preview_available() return true.
|
291 |
+
*
|
292 |
+
* @since 2.0.0
|
293 |
+
*
|
294 |
+
* @param object $query The WP_Query object.
|
295 |
+
* @return object The WP_Query object, unchanged.
|
296 |
+
*/
|
297 |
+
public static function show_public_preview( $query ) {
|
298 |
+
if ( $query->is_main_query() && $query->is_preview() && $query->is_singular() ) {
|
299 |
+
$post_id = get_query_var( 'page_id' ) ? get_query_var( 'page_id' ) : get_query_var( 'p' );
|
300 |
+
|
301 |
+
if ( self::public_preview_available( $post_id ) )
|
302 |
+
add_filter( 'posts_results', array( __CLASS__, 'set_post_to_publish' ) );
|
303 |
}
|
304 |
+
|
305 |
+
return $query;
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Checks if a public preview is available and allowed.
|
310 |
+
* Verifies the nonce and if the post id is registered for a public preview.
|
311 |
+
*
|
312 |
+
* @since 2.0.0
|
313 |
+
*
|
314 |
+
* @param int $post_id The post id.
|
315 |
+
* @return bool True if a public preview is allowed, false on a failure.
|
316 |
+
*/
|
317 |
+
private static function public_preview_available( $post_id ) {
|
318 |
+
if ( empty( $post_id ) || empty( $_GET['_ppp'] ) )
|
319 |
+
return false;
|
320 |
+
|
321 |
+
if( ! self::verify_nonce( $_GET['_ppp'], 'public_post_preview_' . $post_id ) )
|
322 |
+
wp_die( __( 'The link has been expired!', 'ds-public-post-preview' ) );
|
323 |
+
|
324 |
+
if ( ! in_array( $post_id, get_option( 'public_post_preview', array() ) ) )
|
325 |
+
wp_die( __( 'No Public Preview available!', 'ds-public-post-preview' ) );
|
326 |
+
|
327 |
+
return true;
|
328 |
}
|
329 |
|
330 |
+
/**
|
331 |
+
* Sets the post status of the first post to publish, so we don't have to do anything
|
332 |
+
* *too* hacky to get it to load the preview.
|
333 |
+
*
|
334 |
+
* @since 2.0.0
|
335 |
+
*
|
336 |
+
* @param array $posts The post to preview.
|
337 |
+
*/
|
338 |
+
public static function set_post_to_publish( $posts ) {
|
339 |
$posts[0]->post_status = 'publish';
|
340 |
+
|
341 |
return $posts;
|
342 |
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Creates a random, one time use token. Without an UID.
|
346 |
+
*
|
347 |
+
* @see wp_create_nonce()
|
348 |
+
*
|
349 |
+
* @since 1.0.0
|
350 |
+
*
|
351 |
+
* @param string|int $action Scalar value to add context to the nonce.
|
352 |
+
* @return string The one use form token
|
353 |
+
*/
|
354 |
+
private static function create_nonce( $action = -1 ) {
|
355 |
+
$i = wp_nonce_tick();
|
356 |
+
|
357 |
+
return substr( wp_hash( $i . $action, 'nonce' ), -12, 10 );
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Verifies that correct nonce was used with time limit. Without an UID.
|
362 |
+
*
|
363 |
+
* @see wp_verify_nonce()
|
364 |
+
*
|
365 |
+
* @since 1.0.0
|
366 |
+
*
|
367 |
+
* @param string $nonce Nonce that was used in the form to verify
|
368 |
+
* @param string|int $action Should give context to what is taking place and be the same when nonce was created.
|
369 |
+
* @return bool Whether the nonce check passed or failed.
|
370 |
+
*/
|
371 |
+
private static function verify_nonce( $nonce, $action = -1 ) {
|
372 |
+
$i = wp_nonce_tick();
|
373 |
+
|
374 |
+
// Nonce generated 0-12 hours ago
|
375 |
+
if ( substr( wp_hash( $i . $action, 'nonce' ), -12, 10 ) == $nonce )
|
376 |
+
return 1;
|
377 |
+
|
378 |
+
// Nonce generated 12-24 hours ago
|
379 |
+
if ( substr( wp_hash( ( $i - 1 ) . $action, 'nonce' ), -12, 10 ) == $nonce )
|
380 |
+
return 2;
|
381 |
+
|
382 |
+
// Invalid nonce
|
383 |
+
return false;
|
384 |
+
}
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Returns the post ids which are registered for a public preview.
|
388 |
+
*
|
389 |
+
* @since 2.0.0
|
390 |
+
*
|
391 |
+
* @return array The post ids. (Empty array if no ids are registered.)
|
392 |
+
*/
|
393 |
+
private static function get_preview_post_ids() {
|
394 |
+
return get_option( 'public_post_preview', array() );
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Saves the post ids which are registered for a public preview.
|
399 |
+
*
|
400 |
+
* @since 2.0.0
|
401 |
+
*
|
402 |
+
* @return array The post ids. (Empty array if no ids are registered.)
|
403 |
+
*/
|
404 |
+
private static function set_preview_post_ids( $post_ids = array( )) {
|
405 |
+
return update_option( 'public_post_preview', $post_ids );
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Small helper to get some plugin info.
|
410 |
+
*
|
411 |
+
* @since 2.0.0
|
412 |
+
*
|
413 |
+
* @param string $key The key to get the info from, see get_plugin_data().
|
414 |
+
* @return string|bool Either the value, or if the key doesn't exists false.
|
415 |
+
*/
|
416 |
+
private static function get_plugin_info( $key = null ) {
|
417 |
+
$plugin_data = get_plugin_data( __FILE__);
|
418 |
+
if ( array_key_exists( $key, $plugin_data ) )
|
419 |
+
return $plugin_data[ $key ];
|
420 |
+
|
421 |
+
return false;
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Delets the option 'public_post_preview' if the plugin will be uninstalled.
|
426 |
+
*
|
427 |
+
* @since 2.0.0
|
428 |
+
*/
|
429 |
+
public static function uninstall() {
|
430 |
+
delete_option( 'public_post_preview' );
|
431 |
+
}
|
432 |
}
|
433 |
|
434 |
+
add_action( 'plugins_loaded', array( 'DS_Public_Post_Preview', 'init' ) );
|
435 |
|
436 |
+
register_uninstall_hook( __FILE__, array( 'DS_Public_Post_Preview', 'uninstall' ) );
|
readme.txt
CHANGED
@@ -1,45 +1,75 @@
|
|
1 |
=== Public Post Preview ===
|
2 |
-
Contributors: ocean90
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
Stable tag:
|
8 |
|
9 |
Enables you to give a link to anonymous users for public preview of a post before it is published.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
Enables you to give a link to anonymous users for public preview of a post before it is published.
|
14 |
|
15 |
Have you ever been writing a post with the help of someone who does not have access to your blog and needed to give them the ability to preview it before publishing? This plugin takes care of that by generating a URL with an expiring nonce that can be given out for public preview.
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
== Installation ==
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
== Screenshots ==
|
27 |
|
28 |
1. Edit Posts Page
|
29 |
|
30 |
-
== Upgrade ==
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
1. Upload the new `public-post-preview` folder to the `/wp-content/plugins/` directory
|
35 |
|
36 |
== Usage ==
|
|
|
|
|
|
|
37 |
|
38 |
-
1. By default all posts in draft or pending review status will have public preview links that can be found diretly below the edit post box.
|
39 |
-
1. To disable public post preview for a specific post uncheck the public preview post box and save the post.
|
40 |
|
41 |
== Change Log ==
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
= 1.3 (2009-06-30): =
|
44 |
* Hook in earlier in the post selection process to fix PHP notices
|
45 |
* Add uninstall functionality to remove options from the options table
|
1 |
=== Public Post Preview ===
|
2 |
+
Contributors: ocean90
|
3 |
+
Tags: public, post, preview, posts, custom post types
|
4 |
+
Requires at least: 3.3
|
5 |
+
Tested up to: 3.5-alpha
|
6 |
+
License: GPLv2 or later
|
7 |
+
Stable tag: 2.0
|
8 |
|
9 |
Enables you to give a link to anonymous users for public preview of a post before it is published.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
Enables you to give a link to anonymous users for public preview of a post (or any other public post type) before it is published.
|
14 |
|
15 |
Have you ever been writing a post with the help of someone who does not have access to your blog and needed to give them the ability to preview it before publishing? This plugin takes care of that by generating a URL with an expiring nonce that can be given out for public preview.
|
16 |
|
17 |
+
**Sounds pretty good? Install now!**
|
18 |
+
|
19 |
+
*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/).*
|
20 |
+
|
21 |
+
= Feedback =
|
22 |
+
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+.
|
23 |
+
|
24 |
+
= More =
|
25 |
+
Try also some of my [other plugins](http://profiles.wordpress.org/users/ocean90) or visit my site [wpGrafie.de](http://wpgrafie.de/).
|
26 |
+
|
27 |
+
*Thanks to Hans Dinkelberg for his [photo](http://www.flickr.com/photos/uitdragerij/7516234430/).*
|
28 |
|
29 |
== Installation ==
|
30 |
|
31 |
+
Note: There will be NO settings page.
|
32 |
+
|
33 |
+
For an automatic installation through WordPress:
|
34 |
+
|
35 |
+
1. Go to the 'Add New' plugins screen in your WordPress admin area
|
36 |
+
1. Search for 'Public Post Preview'
|
37 |
+
1. Click 'Install Now' and activate the plugin
|
38 |
|
39 |
+
|
40 |
+
For a manual installation via FTP:
|
41 |
+
|
42 |
+
1. Upload the `public-post-preview` directory to the `/wp-content/plugins/` directory
|
43 |
+
1. Activate the plugin through the 'Plugins' screen in your WordPress admin area
|
44 |
+
|
45 |
+
|
46 |
+
To upload the plugin through WordPress, instead of FTP:
|
47 |
+
|
48 |
+
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
|
49 |
|
50 |
== Screenshots ==
|
51 |
|
52 |
1. Edit Posts Page
|
53 |
|
54 |
+
== Upgrade Notice ==
|
55 |
|
56 |
+
= 2.0 =
|
57 |
+
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.
|
|
|
58 |
|
59 |
== Usage ==
|
60 |
+
* To enable a public post preview check the box below the edit post box.
|
61 |
+
* The link will be displayed if the checkbox is checked, just copy and share the link with your frieds.
|
62 |
+
* To disable a preview just uncheck the box.
|
63 |
|
|
|
|
|
64 |
|
65 |
== Change Log ==
|
66 |
|
67 |
+
= 2.0 (20012-07-23): =
|
68 |
+
* Support for all public post types
|
69 |
+
* Saves public preview status via an AJAX request
|
70 |
+
* I18n
|
71 |
+
* Requires at least WordPress 3.3
|
72 |
+
|
73 |
= 1.3 (2009-06-30): =
|
74 |
* Hook in earlier in the post selection process to fix PHP notices
|
75 |
* Add uninstall functionality to remove options from the options table
|
screenshot-1.png
DELETED
Binary file
|
uninstall.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// If uninstall/delete not called from WordPress then exit
|
3 |
-
if ( ! defined('ABSPATH') && ! defined('WP_UNINSTALL_PLUGIN') )
|
4 |
-
exit();
|
5 |
-
|
6 |
-
// Delete option from options table
|
7 |
-
delete_option('public_post_preview');
|
8 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|