Version Description
Download this release
Release Info
Developer | publishpress |
Plugin | Post Expirator |
Version | 2.4.3 |
Comparing to | |
See all releases |
Code changes from version 2.4.2 to 2.4.3
- admin-edit.js +102 -90
- assets/css/edit.css +11 -0
- style.css → assets/css/style.css +34 -31
- functions.php +7 -0
- languages/post-expirator.pot +581 -559
- legacy-functions.php +47 -0
- post-expirator-debug.php +87 -87
- post-expirator.php +2252 -2022
- readme.txt +58 -24
admin-edit.js
CHANGED
@@ -1,90 +1,102 @@
|
|
1 |
-
(function($, config) {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
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 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
var $
|
66 |
-
|
67 |
-
|
68 |
-
var $
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($, config) {
|
2 |
+
|
3 |
+
// show/hide the date fields when the user chooses the intent.
|
4 |
+
$('body').on('change', 'select[name="expirationdate_status"]', function(e){
|
5 |
+
var $show = $(this).find('option:selected').attr('data-show-fields');
|
6 |
+
if($show === 'true'){
|
7 |
+
$(this).parents('.timestamp-wrap').find('span.post-expirator-date-fields').show();
|
8 |
+
}else{
|
9 |
+
$(this).parents('.timestamp-wrap').find('span.post-expirator-date-fields').hide();
|
10 |
+
}
|
11 |
+
});
|
12 |
+
|
13 |
+
// we create a copy of the WP inline edit post function
|
14 |
+
var $wp_inline_edit = inlineEditPost.edit;
|
15 |
+
|
16 |
+
// and then we overwrite the function with our own code
|
17 |
+
inlineEditPost.edit = function( id ) {
|
18 |
+
|
19 |
+
// "call" the original WP edit function
|
20 |
+
// we don't want to leave WordPress hanging
|
21 |
+
$wp_inline_edit.apply( this, arguments );
|
22 |
+
|
23 |
+
// now we take care of our business
|
24 |
+
|
25 |
+
// get the post ID
|
26 |
+
var $post_id = 0;
|
27 |
+
if ( typeof( id ) == 'object' ) {
|
28 |
+
$post_id = parseInt( this.getId( id ) );
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( $post_id > 0 ) {
|
32 |
+
// define the edit row
|
33 |
+
var $edit_row = $( '#edit-' + $post_id );
|
34 |
+
|
35 |
+
// get / set year
|
36 |
+
var $year = $( '#expirationdate_year-' + $post_id ).text();
|
37 |
+
$edit_row.find( 'input[name="expirationdate_year"]' ).val( $year );
|
38 |
+
|
39 |
+
// get / set month
|
40 |
+
var $month = $( '#expirationdate_month-' + $post_id ).text();
|
41 |
+
$edit_row.find( 'select[name="expirationdate_month"]' ).val( $month );
|
42 |
+
|
43 |
+
// get / set day
|
44 |
+
var $day = $( '#expirationdate_day-' + $post_id ).text();
|
45 |
+
$edit_row.find( 'input[name="expirationdate_day"]' ).val( $day );
|
46 |
+
|
47 |
+
// get / set hour
|
48 |
+
var $hour = $( '#expirationdate_hour-' + $post_id ).text();
|
49 |
+
$edit_row.find( 'input[name="expirationdate_hour"]' ).val( $hour );
|
50 |
+
|
51 |
+
// get / set minute
|
52 |
+
var $minute = $( '#expirationdate_minute-' + $post_id ).text();
|
53 |
+
$edit_row.find( 'input[name="expirationdate_minute"]' ).val( $minute );
|
54 |
+
|
55 |
+
var $enabled = $( '#expirationdate_enabled-' + $post_id ).text();
|
56 |
+
if ($enabled == "true") {
|
57 |
+
$edit_row.find( 'input[name="enable-expirationdate"]' ).prop( 'checked', true );
|
58 |
+
}
|
59 |
+
}
|
60 |
+
};
|
61 |
+
|
62 |
+
$( '#bulk_edit' ).on( 'click', function() {
|
63 |
+
|
64 |
+
// define the bulk edit row
|
65 |
+
var $bulk_row = $( '#bulk-edit' );
|
66 |
+
|
67 |
+
// get the selected post ids that are being edited
|
68 |
+
var $post_ids = [];
|
69 |
+
$bulk_row.find( '#bulk-titles' ).children().each( function() {
|
70 |
+
$post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
|
71 |
+
});
|
72 |
+
|
73 |
+
// get the custom fields
|
74 |
+
var $expirationdate_month = $bulk_row.find( 'select[name="expirationdate_month"]' ).val();
|
75 |
+
var $expirationdate_day = $bulk_row.find( 'input[name="expirationdate_day"]' ).val();
|
76 |
+
var $expirationdate_year = $bulk_row.find( 'input[name="expirationdate_year"]' ).val();
|
77 |
+
var $expirationdate_hour = $bulk_row.find( 'input[name="expirationdate_hour"]' ).val();
|
78 |
+
var $expirationdate_minute = $bulk_row.find( 'input[name="expirationdate_minute"]' ).val();
|
79 |
+
var $expirationdate_status = $bulk_row.find( 'select[name="expirationdate_status"]' ).val();
|
80 |
+
|
81 |
+
// save the data
|
82 |
+
$.ajax({
|
83 |
+
url: ajaxurl, // this is a variable that WordPress has already defined for us
|
84 |
+
type: 'POST',
|
85 |
+
async: false,
|
86 |
+
cache: false,
|
87 |
+
data: {
|
88 |
+
action: config.ajax.bulk_edit,
|
89 |
+
post_ids: $post_ids, // and these are the 2 parameters we're passing to our function
|
90 |
+
expirationdate_month: $expirationdate_month,
|
91 |
+
expirationdate_day: $expirationdate_day,
|
92 |
+
expirationdate_year: $expirationdate_year,
|
93 |
+
expirationdate_hour: $expirationdate_hour,
|
94 |
+
expirationdate_minute: $expirationdate_minute,
|
95 |
+
expirationdate_status: $expirationdate_status,
|
96 |
+
nonce: config.ajax.nonce
|
97 |
+
}
|
98 |
+
});
|
99 |
+
|
100 |
+
});
|
101 |
+
|
102 |
+
})(jQuery, config);
|
assets/css/edit.css
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
div.timestamp-wrap label {
|
2 |
+
vertical-align: middle !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
div.timestamp-wrap > span.post-expirator-date-fields {
|
6 |
+
display: none;
|
7 |
+
}
|
8 |
+
|
9 |
+
.post-expirator-quickedit input {
|
10 |
+
font-size: 12px;
|
11 |
+
}
|
style.css → assets/css/style.css
RENAMED
@@ -1,31 +1,34 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
width:
|
23 |
-
}
|
24 |
-
|
25 |
-
margin:
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
1 |
+
/* settings */
|
2 |
+
.post-expirator-adminnotice {
|
3 |
+
background-color: red;
|
4 |
+
}
|
5 |
+
|
6 |
+
.post-expirator-addcolumn {
|
7 |
+
font-size: 0.8em;
|
8 |
+
font-weight: normal;
|
9 |
+
}
|
10 |
+
|
11 |
+
.post-expirator-debug th {
|
12 |
+
font-weight: bold;
|
13 |
+
border-bottom: 1px solid black;
|
14 |
+
}
|
15 |
+
|
16 |
+
.post-expirator-timestamp {
|
17 |
+
width: 150px;
|
18 |
+
}
|
19 |
+
|
20 |
+
/* metabox */
|
21 |
+
#post-expirator-cat-list {
|
22 |
+
max-width: 250px;
|
23 |
+
}
|
24 |
+
#post-expirator-cat-list ul {
|
25 |
+
margin: 0;
|
26 |
+
}
|
27 |
+
#post-expirator-cat-list ul ul {
|
28 |
+
margin-left: 18px;
|
29 |
+
}
|
30 |
+
.post-expirator-taxonomy-name {
|
31 |
+
margin: 0px;
|
32 |
+
font-style: italic;
|
33 |
+
font-size: x-small;
|
34 |
+
}
|
functions.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file provides access to all publicly exposed functions.
|
4 |
+
*/
|
5 |
+
|
6 |
+
require_once POSTEXPIRATOR_BASEDIR . '/legacy-functions.php';
|
7 |
+
|
languages/post-expirator.pot
CHANGED
@@ -1,560 +1,582 @@
|
|
1 |
-
# Copyright (C) 2021 Aaron Axelsen
|
2 |
-
# This file is distributed under the same license as the Post Expirator package.
|
3 |
-
msgid ""
|
4 |
-
msgstr ""
|
5 |
-
"Project-Id-Version: Post Expirator 2.4.
|
6 |
-
"Report-Msgid-Bugs-To: "
|
7 |
-
"https://wordpress.org/support/plugin/PublishPress-Future\n"
|
8 |
-
"POT-Creation-Date: 2021-
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"Last-Translator: PostExpirator Translate Team\n"
|
13 |
-
"Language-Team: PostExpirator Translate Team\n"
|
14 |
-
|
15 |
-
#: post-expirator-debug.php:66
|
16 |
-
msgid "Debugging table is currently empty."
|
17 |
-
msgstr ""
|
18 |
-
|
19 |
-
#: post-expirator-debug.php:70
|
20 |
-
msgid "Timestamp"
|
21 |
-
msgstr ""
|
22 |
-
|
23 |
-
#: post-expirator-debug.php:71
|
24 |
-
msgid "Message"
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
#: post-expirator.php:15
|
28 |
-
msgid "l F jS, Y"
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: post-expirator.php:16
|
32 |
-
msgid "g:ia"
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: post-expirator.php:17
|
36 |
-
msgid "Post expires at EXPIRATIONTIME on EXPIRATIONDATE"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: post-expirator.php:
|
40 |
-
msgid "Settings"
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
#: post-expirator.php:
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
"Post
|
54 |
-
"
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
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 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: post-expirator.php:
|
117 |
-
msgid ""
|
118 |
-
"
|
119 |
-
"
|
120 |
-
msgstr ""
|
121 |
-
|
122 |
-
#: post-expirator.php:
|
123 |
-
msgid ""
|
124 |
-
"
|
125 |
-
"
|
126 |
-
msgstr ""
|
127 |
-
|
128 |
-
#: post-expirator.php:
|
129 |
-
msgid ""
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
"
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
"
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
msgstr ""
|
184 |
-
|
185 |
-
#: post-expirator.php:
|
186 |
-
msgid "
|
187 |
-
msgstr ""
|
188 |
-
|
189 |
-
#: post-expirator.php:
|
190 |
-
msgid "
|
191 |
-
msgstr ""
|
192 |
-
|
193 |
-
#: post-expirator.php:
|
194 |
-
msgid ""
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
"
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
"
|
214 |
-
"
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
msgstr ""
|
221 |
-
|
222 |
-
#: post-expirator.php:
|
223 |
-
msgid ""
|
224 |
-
"
|
225 |
-
"
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
"
|
250 |
-
"
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
"
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
msgstr ""
|
261 |
-
|
262 |
-
#: post-expirator.php:
|
263 |
-
msgid "
|
264 |
-
msgstr ""
|
265 |
-
|
266 |
-
#: post-expirator.php:
|
267 |
-
msgid "
|
268 |
-
msgstr ""
|
269 |
-
|
270 |
-
#: post-expirator.php:
|
271 |
-
msgid "
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
"
|
281 |
-
"
|
282 |
-
msgstr ""
|
283 |
-
|
284 |
-
#: post-expirator.php:
|
285 |
-
msgid "
|
286 |
-
msgstr ""
|
287 |
-
|
288 |
-
#: post-expirator.php:
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
"
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
"
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
"
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
"
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
"expiration date
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
"
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
"
|
423 |
-
msgstr ""
|
424 |
-
|
425 |
-
#: post-expirator.php:
|
426 |
-
msgid "
|
427 |
-
msgstr ""
|
428 |
-
|
429 |
-
#: post-expirator.php:
|
430 |
-
msgid "
|
431 |
-
msgstr ""
|
432 |
-
|
433 |
-
#: post-expirator.php:
|
434 |
-
msgid "
|
435 |
-
msgstr ""
|
436 |
-
|
437 |
-
#: post-expirator.php:
|
438 |
-
msgid "
|
439 |
-
msgstr ""
|
440 |
-
|
441 |
-
#: post-expirator.php:
|
442 |
-
msgid "
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
"
|
489 |
-
msgstr ""
|
490 |
-
|
491 |
-
#: post-expirator.php:
|
492 |
-
msgid "
|
493 |
-
msgstr ""
|
494 |
-
|
495 |
-
#: post-expirator.php:
|
496 |
-
msgid "
|
497 |
-
msgstr ""
|
498 |
-
|
499 |
-
#: post-expirator.php:
|
500 |
-
msgid "
|
501 |
-
msgstr ""
|
502 |
-
|
503 |
-
#: post-expirator.php:
|
504 |
-
msgid "
|
505 |
-
msgstr ""
|
506 |
-
|
507 |
-
#: post-expirator.php:
|
508 |
-
msgid ""
|
509 |
-
"
|
510 |
-
"
|
511 |
-
msgstr ""
|
512 |
-
|
513 |
-
#: post-expirator.php:
|
514 |
-
msgid "
|
515 |
-
msgstr ""
|
516 |
-
|
517 |
-
#: post-expirator.php:
|
518 |
-
msgid "
|
519 |
-
msgstr ""
|
520 |
-
|
521 |
-
#: post-expirator.php:
|
522 |
-
msgid "
|
523 |
-
msgstr ""
|
524 |
-
|
525 |
-
#: post-expirator.php:
|
526 |
-
msgid "
|
527 |
-
msgstr ""
|
528 |
-
|
529 |
-
#: post-expirator.php:
|
530 |
-
msgid "
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
"
|
553 |
-
msgstr ""
|
554 |
-
|
555 |
-
|
556 |
-
msgid ""
|
557 |
-
|
558 |
-
|
559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
msgstr ""
|
1 |
+
# Copyright (C) 2021 Aaron Axelsen
|
2 |
+
# This file is distributed under the same license as the Post Expirator package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: Post Expirator 2.4.2\n"
|
6 |
+
"Report-Msgid-Bugs-To: "
|
7 |
+
"https://wordpress.org/support/plugin/PublishPress-Future\n"
|
8 |
+
"POT-Creation-Date: 2021-06-17 17:09:25+00:00\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Last-Translator: PostExpirator Translate Team\n"
|
13 |
+
"Language-Team: PostExpirator Translate Team\n"
|
14 |
+
|
15 |
+
#: post-expirator-debug.php:66
|
16 |
+
msgid "Debugging table is currently empty."
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: post-expirator-debug.php:70
|
20 |
+
msgid "Timestamp"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: post-expirator-debug.php:71
|
24 |
+
msgid "Message"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: post-expirator.php:15
|
28 |
+
msgid "l F jS, Y"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: post-expirator.php:16
|
32 |
+
msgid "g:ia"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: post-expirator.php:17
|
36 |
+
msgid "Post expires at EXPIRATIONTIME on EXPIRATIONDATE"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: post-expirator.php:41
|
40 |
+
msgid "Settings"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: post-expirator.php:70 post-expirator.php:147 post-expirator.php:218
|
44 |
+
#: post-expirator.php:269
|
45 |
+
msgid "Expires"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: post-expirator.php:164
|
49 |
+
msgid "Never"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: post-expirator.php:216 post-expirator.php:272 post-expirator.php:429
|
53 |
+
msgid "Enable Post Expiration"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: post-expirator.php:220 post-expirator.php:283 post-expirator.php:436
|
57 |
+
msgid "Month"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: post-expirator.php:233 post-expirator.php:297 post-expirator.php:437
|
61 |
+
msgid "Day"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: post-expirator.php:235 post-expirator.php:301 post-expirator.php:435
|
65 |
+
msgid "Year"
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: post-expirator.php:237 post-expirator.php:305 post-expirator.php:474
|
69 |
+
msgid "Hour"
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: post-expirator.php:239 post-expirator.php:309 post-expirator.php:475
|
73 |
+
msgid "Minute"
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: post-expirator.php:274
|
77 |
+
msgid "No Change"
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#: post-expirator.php:275
|
81 |
+
msgid "Change expiry date if enabled on posts"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: post-expirator.php:275
|
85 |
+
msgid "Change on posts"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: post-expirator.php:276
|
89 |
+
msgid "Add expiry date if not enabled on posts"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: post-expirator.php:276
|
93 |
+
msgid "Add to posts"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: post-expirator.php:277
|
97 |
+
msgid "Change & Add"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: post-expirator.php:278
|
101 |
+
msgid "Remove from posts"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: post-expirator.php:432
|
105 |
+
msgid "The published date/time will be used as the expiration value"
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#: post-expirator.php:496
|
109 |
+
msgid "How to expire"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: post-expirator.php:507
|
113 |
+
msgid "Expiration Categories"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: post-expirator.php:518
|
117 |
+
msgid ""
|
118 |
+
"You must assign a heirarchical taxonomy to this post type to use this "
|
119 |
+
"feature."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: post-expirator.php:520
|
123 |
+
msgid ""
|
124 |
+
"More than 1 heirachical taxonomy detected. You must assign a default "
|
125 |
+
"taxonomy on the settings screen."
|
126 |
+
msgstr ""
|
127 |
+
|
128 |
+
#: post-expirator.php:530
|
129 |
+
msgid "Taxonomy Name"
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: post-expirator.php:827 post-expirator.php:838 post-expirator.php:849
|
133 |
+
#: post-expirator.php:860
|
134 |
+
msgid ""
|
135 |
+
"%1$s (%2$s) has expired at %3$s. Post status has been successfully changed "
|
136 |
+
"to \"%4$s\"."
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: post-expirator.php:871
|
140 |
+
msgid ""
|
141 |
+
"%1$s (%2$s) has expired at %3$s. Post \"%4$s\" status has been successfully "
|
142 |
+
"set."
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: post-expirator.php:882
|
146 |
+
msgid ""
|
147 |
+
"%1$s (%2$s) has expired at %3$s. Post \"%4$s\" status has been successfully "
|
148 |
+
"removed."
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: post-expirator.php:895 post-expirator.php:909
|
152 |
+
msgid ""
|
153 |
+
"%1$s (%2$s) has expired at %3$s. Post \"%4$s\" have now been set to "
|
154 |
+
"\"%5$s\"."
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: post-expirator.php:932 post-expirator.php:946
|
158 |
+
msgid ""
|
159 |
+
"%1$s (%2$s) has expired at %3$s. The following post \"%4$s\" have now been "
|
160 |
+
"added: \"%5$s\". The full list of categories on the post are: \"%6$s\"."
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: post-expirator.php:974 post-expirator.php:995
|
164 |
+
msgid ""
|
165 |
+
"%1$s (%2$s) has expired at %3$s. The following post \"%4$s\" have now been "
|
166 |
+
"removed: \"%5$s\". The full list of categories on the post are: \"%6$s\"."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: post-expirator.php:1014
|
170 |
+
msgid "Post Expiration Complete \"%s\""
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: post-expirator.php:1050
|
174 |
+
msgid "[%1$s] %2$s"
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: post-expirator.php:1092
|
178 |
+
msgid "General Settings"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: post-expirator.php:1093 post-expirator.php:1228
|
182 |
+
msgid "Defaults"
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: post-expirator.php:1094
|
186 |
+
msgid "Diagnostics"
|
187 |
+
msgstr ""
|
188 |
+
|
189 |
+
#: post-expirator.php:1095
|
190 |
+
msgid "View Debug Logs"
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
#: post-expirator.php:1110 post-expirator.php:1133
|
194 |
+
msgid "Post Expirator Options"
|
195 |
+
msgstr ""
|
196 |
+
|
197 |
+
#: post-expirator.php:1169 post-expirator.php:1401
|
198 |
+
msgid "Saved Options!"
|
199 |
+
msgstr ""
|
200 |
+
|
201 |
+
#: post-expirator.php:1216
|
202 |
+
msgid ""
|
203 |
+
"The post expirator plugin sets a custom meta value, and then optionally "
|
204 |
+
"allows you to select if you want the post changed to a draft status or "
|
205 |
+
"deleted when it expires."
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: post-expirator.php:1219
|
209 |
+
msgid "Valid [postexpirator] attributes:"
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: post-expirator.php:1221
|
213 |
+
msgid "type - defaults to full - valid options are full,date,time"
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: post-expirator.php:1222
|
217 |
+
msgid ""
|
218 |
+
"dateformat - format set here will override the value set on the settings "
|
219 |
+
"page"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: post-expirator.php:1223
|
223 |
+
msgid ""
|
224 |
+
"timeformat - format set here will override the value set on the settings "
|
225 |
+
"page"
|
226 |
+
msgstr ""
|
227 |
+
|
228 |
+
#: post-expirator.php:1231
|
229 |
+
msgid "Date Format:"
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: post-expirator.php:1235
|
233 |
+
msgid ""
|
234 |
+
"The default format to use when displaying the expiration date within a post "
|
235 |
+
"using the [postexpirator] shortcode or within the footer. For information "
|
236 |
+
"on valid formatting options, see: <a "
|
237 |
+
"href=\"http://us2.php.net/manual/en/function.date.php\" "
|
238 |
+
"target=\"_blank\">PHP Date Function</a>."
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: post-expirator.php:1239
|
242 |
+
msgid "Time Format:"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: post-expirator.php:1243
|
246 |
+
msgid ""
|
247 |
+
"The default format to use when displaying the expiration time within a post "
|
248 |
+
"using the [postexpirator] shortcode or within the footer. For information "
|
249 |
+
"on valid formatting options, see: <a "
|
250 |
+
"href=\"http://us2.php.net/manual/en/function.date.php\" "
|
251 |
+
"target=\"_blank\">PHP Date Function</a>."
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: post-expirator.php:1247
|
255 |
+
msgid "Default Date/Time Duration:"
|
256 |
+
msgstr ""
|
257 |
+
|
258 |
+
#: post-expirator.php:1250
|
259 |
+
msgid "None"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: post-expirator.php:1251
|
263 |
+
msgid "Custom"
|
264 |
+
msgstr ""
|
265 |
+
|
266 |
+
#: post-expirator.php:1252
|
267 |
+
msgid "Post/Page Publish Time"
|
268 |
+
msgstr ""
|
269 |
+
|
270 |
+
#: post-expirator.php:1255
|
271 |
+
msgid ""
|
272 |
+
"Set the default expiration date to be used when creating new posts and "
|
273 |
+
"pages. Defaults to none."
|
274 |
+
msgstr ""
|
275 |
+
|
276 |
+
#: post-expirator.php:1260
|
277 |
+
msgid ""
|
278 |
+
"Set the custom value to use for the default expiration date. For "
|
279 |
+
"information on formatting, see %1$s. For example, you could enter %2$s+1 "
|
280 |
+
"month%3$s or %4$s+1 week 2 days 4 hours 2 seconds%5$s or %6$snext "
|
281 |
+
"Thursday%7$s."
|
282 |
+
msgstr ""
|
283 |
+
|
284 |
+
#: post-expirator.php:1265
|
285 |
+
msgid "Category Expiration"
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: post-expirator.php:1268
|
289 |
+
msgid "Default Expiration Category"
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: post-expirator.php:1279
|
293 |
+
msgid "Set's the default expiration category for the post."
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#: post-expirator.php:1284
|
297 |
+
msgid "Expiration Email Notification"
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#: post-expirator.php:1285
|
301 |
+
msgid ""
|
302 |
+
"Whenever a post expires, an email can be sent to alert users of the "
|
303 |
+
"expiration."
|
304 |
+
msgstr ""
|
305 |
+
|
306 |
+
#: post-expirator.php:1288
|
307 |
+
msgid "Enable Email Notification?"
|
308 |
+
msgstr ""
|
309 |
+
|
310 |
+
#: post-expirator.php:1290 post-expirator.php:1300 post-expirator.php:1323
|
311 |
+
#: post-expirator.php:1464
|
312 |
+
msgid "Enabled"
|
313 |
+
msgstr ""
|
314 |
+
|
315 |
+
#: post-expirator.php:1292 post-expirator.php:1302 post-expirator.php:1325
|
316 |
+
#: post-expirator.php:1466
|
317 |
+
msgid "Disabled"
|
318 |
+
msgstr ""
|
319 |
+
|
320 |
+
#: post-expirator.php:1294
|
321 |
+
msgid ""
|
322 |
+
"This will enable or disable the send of email notification on post "
|
323 |
+
"expiration."
|
324 |
+
msgstr ""
|
325 |
+
|
326 |
+
#: post-expirator.php:1298
|
327 |
+
msgid "Include Blog Administrators?"
|
328 |
+
msgstr ""
|
329 |
+
|
330 |
+
#: post-expirator.php:1304
|
331 |
+
msgid ""
|
332 |
+
"This will include all users with the role of \"Administrator\" in the post "
|
333 |
+
"expiration email."
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: post-expirator.php:1308 post-expirator.php:1478
|
337 |
+
msgid "Who to notify:"
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: post-expirator.php:1312
|
341 |
+
msgid ""
|
342 |
+
"Enter a comma seperate list of emails that you would like to be notified "
|
343 |
+
"when the post expires. This will be applied to ALL post types. You can "
|
344 |
+
"set post type specific emails on the Defaults tab."
|
345 |
+
msgstr ""
|
346 |
+
|
347 |
+
#: post-expirator.php:1317
|
348 |
+
msgid "Post Footer Display"
|
349 |
+
msgstr ""
|
350 |
+
|
351 |
+
#: post-expirator.php:1318
|
352 |
+
msgid ""
|
353 |
+
"Enabling this below will display the expiration date automatically at the "
|
354 |
+
"end of any post which is set to expire."
|
355 |
+
msgstr ""
|
356 |
+
|
357 |
+
#: post-expirator.php:1321
|
358 |
+
msgid "Show in post footer?"
|
359 |
+
msgstr ""
|
360 |
+
|
361 |
+
#: post-expirator.php:1327
|
362 |
+
msgid ""
|
363 |
+
"This will enable or disable displaying the post expiration date in the post "
|
364 |
+
"footer."
|
365 |
+
msgstr ""
|
366 |
+
|
367 |
+
#: post-expirator.php:1331
|
368 |
+
msgid "Footer Contents:"
|
369 |
+
msgstr ""
|
370 |
+
|
371 |
+
#: post-expirator.php:1335
|
372 |
+
msgid ""
|
373 |
+
"Enter the text you would like to appear at the bottom of every post that "
|
374 |
+
"will expire. The following placeholders will be replaced with the post "
|
375 |
+
"expiration date in the following format:"
|
376 |
+
msgstr ""
|
377 |
+
|
378 |
+
#: post-expirator.php:1344
|
379 |
+
msgid "Footer Style:"
|
380 |
+
msgstr ""
|
381 |
+
|
382 |
+
#: post-expirator.php:1347
|
383 |
+
msgid "This post will expire on"
|
384 |
+
msgstr ""
|
385 |
+
|
386 |
+
#: post-expirator.php:1349
|
387 |
+
msgid "The inline css which will be used to style the footer text."
|
388 |
+
msgstr ""
|
389 |
+
|
390 |
+
#: post-expirator.php:1354 post-expirator.php:1492
|
391 |
+
msgid "Save Changes"
|
392 |
+
msgstr ""
|
393 |
+
|
394 |
+
#: post-expirator.php:1409
|
395 |
+
msgid "Default Expiration Values"
|
396 |
+
msgstr ""
|
397 |
+
|
398 |
+
#: post-expirator.php:1411
|
399 |
+
msgid ""
|
400 |
+
"Use the values below to set the default actions/values to be used for each "
|
401 |
+
"for the corresponding post types. These values can all be overwritten when "
|
402 |
+
"creating/editing the post/page."
|
403 |
+
msgstr ""
|
404 |
+
|
405 |
+
#: post-expirator.php:1443
|
406 |
+
msgid "Active:"
|
407 |
+
msgstr ""
|
408 |
+
|
409 |
+
#: post-expirator.php:1445
|
410 |
+
msgid "Active"
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
#: post-expirator.php:1447
|
414 |
+
msgid "Inactive"
|
415 |
+
msgstr ""
|
416 |
+
|
417 |
+
#: post-expirator.php:1449
|
418 |
+
msgid "Select whether the post expirator meta box is active for this post type."
|
419 |
+
msgstr ""
|
420 |
+
|
421 |
+
#: post-expirator.php:1453
|
422 |
+
msgid "How to expire:"
|
423 |
+
msgstr ""
|
424 |
+
|
425 |
+
#: post-expirator.php:1458
|
426 |
+
msgid "Select the default expire action for the post type."
|
427 |
+
msgstr ""
|
428 |
+
|
429 |
+
#: post-expirator.php:1462
|
430 |
+
msgid "Auto-Enable?"
|
431 |
+
msgstr ""
|
432 |
+
|
433 |
+
#: post-expirator.php:1468
|
434 |
+
msgid "Select whether the post expirator is enabled for all new posts."
|
435 |
+
msgstr ""
|
436 |
+
|
437 |
+
#: post-expirator.php:1472
|
438 |
+
msgid "Taxonomy (hierarchical):"
|
439 |
+
msgstr ""
|
440 |
+
|
441 |
+
#: post-expirator.php:1482
|
442 |
+
msgid ""
|
443 |
+
"Enter a comma seperate list of emails that you would like to be notified "
|
444 |
+
"when the post expires."
|
445 |
+
msgstr ""
|
446 |
+
|
447 |
+
#: post-expirator.php:1514
|
448 |
+
msgid "Debugging Disabled"
|
449 |
+
msgstr ""
|
450 |
+
|
451 |
+
#: post-expirator.php:1519
|
452 |
+
msgid "Debugging Enabled"
|
453 |
+
msgstr ""
|
454 |
+
|
455 |
+
#: post-expirator.php:1526
|
456 |
+
msgid "Debugging Table Emptied"
|
457 |
+
msgstr ""
|
458 |
+
|
459 |
+
#: post-expirator.php:1535
|
460 |
+
msgid "Advanced Diagnostics"
|
461 |
+
msgstr ""
|
462 |
+
|
463 |
+
#: post-expirator.php:1538
|
464 |
+
msgid "Post Expirator Debug Logging:"
|
465 |
+
msgstr ""
|
466 |
+
|
467 |
+
#: post-expirator.php:1542
|
468 |
+
msgid "Status: Enabled"
|
469 |
+
msgstr ""
|
470 |
+
|
471 |
+
#: post-expirator.php:1543
|
472 |
+
msgid "Disable Debugging"
|
473 |
+
msgstr ""
|
474 |
+
|
475 |
+
#: post-expirator.php:1545
|
476 |
+
msgid "Status: Disabled"
|
477 |
+
msgstr ""
|
478 |
+
|
479 |
+
#: post-expirator.php:1546
|
480 |
+
msgid "Enable Debugging"
|
481 |
+
msgstr ""
|
482 |
+
|
483 |
+
#: post-expirator.php:1554
|
484 |
+
msgid "Purge Debug Log:"
|
485 |
+
msgstr ""
|
486 |
+
|
487 |
+
#: post-expirator.php:1556
|
488 |
+
msgid "Purge Debug Log"
|
489 |
+
msgstr ""
|
490 |
+
|
491 |
+
#: post-expirator.php:1560
|
492 |
+
msgid "WP-Cron Status:"
|
493 |
+
msgstr ""
|
494 |
+
|
495 |
+
#: post-expirator.php:1564
|
496 |
+
msgid "DISABLED"
|
497 |
+
msgstr ""
|
498 |
+
|
499 |
+
#: post-expirator.php:1566
|
500 |
+
msgid "ENABLED - OK"
|
501 |
+
msgstr ""
|
502 |
+
|
503 |
+
#: post-expirator.php:1572
|
504 |
+
msgid "Current Cron Schedule:"
|
505 |
+
msgstr ""
|
506 |
+
|
507 |
+
#: post-expirator.php:1574
|
508 |
+
msgid ""
|
509 |
+
"The below table will show all currently scheduled cron events with the next "
|
510 |
+
"run time."
|
511 |
+
msgstr ""
|
512 |
+
|
513 |
+
#: post-expirator.php:1577
|
514 |
+
msgid "Date"
|
515 |
+
msgstr ""
|
516 |
+
|
517 |
+
#: post-expirator.php:1578
|
518 |
+
msgid "Event"
|
519 |
+
msgstr ""
|
520 |
+
|
521 |
+
#: post-expirator.php:1579
|
522 |
+
msgid "Arguments / Schedule"
|
523 |
+
msgstr ""
|
524 |
+
|
525 |
+
#: post-expirator.php:1604
|
526 |
+
msgid "Single Event"
|
527 |
+
msgstr ""
|
528 |
+
|
529 |
+
#: post-expirator.php:1632
|
530 |
+
msgid ""
|
531 |
+
"Below is a dump of the debugging table, this should be useful for "
|
532 |
+
"troubleshooting."
|
533 |
+
msgstr ""
|
534 |
+
|
535 |
+
#: post-expirator.php:2075
|
536 |
+
msgid "Draft"
|
537 |
+
msgstr ""
|
538 |
+
|
539 |
+
#: post-expirator.php:2076
|
540 |
+
msgid "Delete"
|
541 |
+
msgstr ""
|
542 |
+
|
543 |
+
#: post-expirator.php:2077
|
544 |
+
msgid "Trash"
|
545 |
+
msgstr ""
|
546 |
+
|
547 |
+
#: post-expirator.php:2078
|
548 |
+
msgid "Private"
|
549 |
+
msgstr ""
|
550 |
+
|
551 |
+
#: post-expirator.php:2079
|
552 |
+
msgid "Stick"
|
553 |
+
msgstr ""
|
554 |
+
|
555 |
+
#: post-expirator.php:2080
|
556 |
+
msgid "Unstick"
|
557 |
+
msgstr ""
|
558 |
+
|
559 |
+
#: post-expirator.php:2082
|
560 |
+
msgid "Category: Replace"
|
561 |
+
msgstr ""
|
562 |
+
|
563 |
+
#: post-expirator.php:2083
|
564 |
+
msgid "Category: Add"
|
565 |
+
msgstr ""
|
566 |
+
|
567 |
+
#: post-expirator.php:2084
|
568 |
+
msgid "Category: Remove"
|
569 |
+
msgstr ""
|
570 |
+
|
571 |
+
#: post-expirator.php:2137
|
572 |
+
msgid ""
|
573 |
+
"Select the hierarchical taxonomy to be used for \"category\" based "
|
574 |
+
"expiration."
|
575 |
+
msgstr ""
|
576 |
+
|
577 |
+
#. Description of the plugin/theme
|
578 |
+
msgid ""
|
579 |
+
"Allows you to add an expiration date (minute) to posts which you can "
|
580 |
+
"configure to either delete the post, change it to a draft, or update the "
|
581 |
+
"post categories at expiration time."
|
582 |
msgstr ""
|
legacy-functions.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file provides access to all legacy functions that are now deprecated.
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! function_exists( '_scheduleExpiratorEvent' ) ) {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Schedules the single event.
|
10 |
+
*
|
11 |
+
* @since 2.4.3
|
12 |
+
* @deprecated 2.4.3
|
13 |
+
*/
|
14 |
+
function _scheduleExpiratorEvent( $id, $ts, $opts ) {
|
15 |
+
postexpirator_schedule_event( $id, $ts, $opts );
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
if ( ! function_exists( '_unscheduleExpiratorEvent' ) ) {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Unschedules the single event.
|
24 |
+
*
|
25 |
+
* @since 2.4.3
|
26 |
+
* @deprecated 2.4.3
|
27 |
+
*/
|
28 |
+
function _unscheduleExpiratorEvent( $id ) {
|
29 |
+
postexpirator_unschedule_event( $id );
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
if ( ! function_exists( 'postExpiratorExpire' ) ) {
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Expires the post.
|
38 |
+
*
|
39 |
+
* @since 2.4.3
|
40 |
+
* @deprecated 2.4.3
|
41 |
+
*/
|
42 |
+
function postExpiratorExpire( $id ) {
|
43 |
+
postexpirator_expire_post( $id );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
|
post-expirator-debug.php
CHANGED
@@ -1,88 +1,88 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
4 |
-
|
5 |
-
/**
|
6 |
-
* The class that adds debug entries to the database.
|
7 |
-
*/
|
8 |
-
class PostExpiratorDebug {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Constructor.
|
12 |
-
*/
|
13 |
-
function __construct() {
|
14 |
-
global $wpdb;
|
15 |
-
$this->debug_table = $wpdb->prefix . 'postexpirator_debug';
|
16 |
-
$this->createDBTable();
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Create Database Table to store debugging information if it does not already exist.
|
21 |
-
*/
|
22 |
-
private function createDBTable() {
|
23 |
-
global $wpdb;
|
24 |
-
|
25 |
-
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $this->debug_table . "'" ) !== $this->debug_table ) {
|
26 |
-
$sql = 'CREATE TABLE `' . $this->debug_table . '` (
|
27 |
-
`id` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
28 |
-
`timestamp` TIMESTAMP NOT NULL,
|
29 |
-
`blog` INT(9) NOT NULL,
|
30 |
-
`message` text NOT NULL
|
31 |
-
);';
|
32 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
33 |
-
dbDelta( $sql );
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Drop Database Table.
|
39 |
-
*/
|
40 |
-
public function removeDBTable() {
|
41 |
-
global $wpdb;
|
42 |
-
$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->debug_table );
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Insert into Database Table.
|
47 |
-
*/
|
48 |
-
public function save( $data ) {
|
49 |
-
global $wpdb;
|
50 |
-
if ( is_multisite() ) {
|
51 |
-
global $current_blog;
|
52 |
-
$blog = $current_blog->blog_id;
|
53 |
-
} else {
|
54 |
-
$blog = 0;
|
55 |
-
}
|
56 |
-
$wpdb->query( $wpdb->prepare( 'INSERT INTO ' . $this->debug_table . ' (`timestamp`,`message`,`blog`) VALUES (FROM_UNIXTIME(%d),%s,%s)', time(), $data['message'], $blog ) );
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Get the HTML of the table's data.
|
61 |
-
*/
|
62 |
-
public function getTable() {
|
63 |
-
global $wpdb;
|
64 |
-
$results = $wpdb->get_results( "SELECT * FROM {$this->debug_table} ORDER BY `id` DESC" );
|
65 |
-
if ( empty( $results ) ) {
|
66 |
-
print '<p>' . __( 'Debugging table is currently empty.', 'post-expirator' ) . '</p>';
|
67 |
-
return;
|
68 |
-
}
|
69 |
-
print '<table class="post-expirator-debug">';
|
70 |
-
print '<tr><th class="post-expirator-timestamp">' . __( 'Timestamp', 'post-expirator' ) . '</th>';
|
71 |
-
print '<th>' . __( 'Message', 'post-expirator' ) . '</th></tr>';
|
72 |
-
foreach ( $results as $result ) {
|
73 |
-
print '<tr><td>' . $result->timestamp . '</td>';
|
74 |
-
print '<td>' . $result->message . '</td></tr>';
|
75 |
-
}
|
76 |
-
print '</table>';
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Truncate Database Table.
|
81 |
-
*/
|
82 |
-
public function purge() {
|
83 |
-
global $wpdb;
|
84 |
-
$wpdb->query( "TRUNCATE TABLE {$this->debug_table}" );
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
// phpcs:enable
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
4 |
+
|
5 |
+
/**
|
6 |
+
* The class that adds debug entries to the database.
|
7 |
+
*/
|
8 |
+
class PostExpiratorDebug {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Constructor.
|
12 |
+
*/
|
13 |
+
function __construct() {
|
14 |
+
global $wpdb;
|
15 |
+
$this->debug_table = $wpdb->prefix . 'postexpirator_debug';
|
16 |
+
$this->createDBTable();
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Create Database Table to store debugging information if it does not already exist.
|
21 |
+
*/
|
22 |
+
private function createDBTable() {
|
23 |
+
global $wpdb;
|
24 |
+
|
25 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $this->debug_table . "'" ) !== $this->debug_table ) {
|
26 |
+
$sql = 'CREATE TABLE `' . $this->debug_table . '` (
|
27 |
+
`id` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
28 |
+
`timestamp` TIMESTAMP NOT NULL,
|
29 |
+
`blog` INT(9) NOT NULL,
|
30 |
+
`message` text NOT NULL
|
31 |
+
);';
|
32 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
33 |
+
dbDelta( $sql );
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Drop Database Table.
|
39 |
+
*/
|
40 |
+
public function removeDBTable() {
|
41 |
+
global $wpdb;
|
42 |
+
$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->debug_table );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Insert into Database Table.
|
47 |
+
*/
|
48 |
+
public function save( $data ) {
|
49 |
+
global $wpdb;
|
50 |
+
if ( is_multisite() ) {
|
51 |
+
global $current_blog;
|
52 |
+
$blog = $current_blog->blog_id;
|
53 |
+
} else {
|
54 |
+
$blog = 0;
|
55 |
+
}
|
56 |
+
$wpdb->query( $wpdb->prepare( 'INSERT INTO ' . $this->debug_table . ' (`timestamp`,`message`,`blog`) VALUES (FROM_UNIXTIME(%d),%s,%s)', time(), $data['message'], $blog ) );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Get the HTML of the table's data.
|
61 |
+
*/
|
62 |
+
public function getTable() {
|
63 |
+
global $wpdb;
|
64 |
+
$results = $wpdb->get_results( "SELECT * FROM {$this->debug_table} ORDER BY `id` DESC" );
|
65 |
+
if ( empty( $results ) ) {
|
66 |
+
print '<p>' . __( 'Debugging table is currently empty.', 'post-expirator' ) . '</p>';
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
print '<table class="post-expirator-debug">';
|
70 |
+
print '<tr><th class="post-expirator-timestamp">' . __( 'Timestamp', 'post-expirator' ) . '</th>';
|
71 |
+
print '<th>' . __( 'Message', 'post-expirator' ) . '</th></tr>';
|
72 |
+
foreach ( $results as $result ) {
|
73 |
+
print '<tr><td>' . $result->timestamp . '</td>';
|
74 |
+
print '<td>' . $result->message . '</td></tr>';
|
75 |
+
}
|
76 |
+
print '</table>';
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Truncate Database Table.
|
81 |
+
*/
|
82 |
+
public function purge() {
|
83 |
+
global $wpdb;
|
84 |
+
$wpdb->query( "TRUNCATE TABLE {$this->debug_table}" );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
// phpcs:enable
|
post-expirator.php
CHANGED
@@ -1,2022 +1,2252 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Post Expirator
|
4 |
-
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
|
5 |
-
Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
|
6 |
-
Author: Aaron Axelsen
|
7 |
-
Version: 2.4.
|
8 |
-
Author URI: http://postexpirator.tuxdocs.net/
|
9 |
-
Text Domain: post-expirator
|
10 |
-
Domain Path: /languages
|
11 |
-
*/
|
12 |
-
|
13 |
-
// Default Values
|
14 |
-
define( 'POSTEXPIRATOR_VERSION', '2.4.
|
15 |
-
define( 'POSTEXPIRATOR_DATEFORMAT', __( 'l F jS, Y', 'post-expirator' ) );
|
16 |
-
define( 'POSTEXPIRATOR_TIMEFORMAT', __( 'g:ia', 'post-expirator' ) );
|
17 |
-
define( 'POSTEXPIRATOR_FOOTERCONTENTS', __( 'Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator' ) );
|
18 |
-
define( 'POSTEXPIRATOR_FOOTERSTYLE', 'font-style: italic;' );
|
19 |
-
define( 'POSTEXPIRATOR_FOOTERDISPLAY', '0' );
|
20 |
-
define( 'POSTEXPIRATOR_EMAILNOTIFICATION', '0' );
|
21 |
-
define( 'POSTEXPIRATOR_EMAILNOTIFICATIONADMINS', '0' );
|
22 |
-
define( 'POSTEXPIRATOR_DEBUGDEFAULT', '0' );
|
23 |
-
define( 'POSTEXPIRATOR_EXPIREDEFAULT', 'null' );
|
24 |
-
define( 'POSTEXPIRATOR_SLUG', 'post-expirator' );
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
*
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
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 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
$
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
*
|
159 |
-
*/
|
160 |
-
function
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
<
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
<
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
}
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
$
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
$
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
$
|
412 |
-
|
413 |
-
$
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
}
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
}
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
}
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
}
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
*
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
//
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
}
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
}
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
if (
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
$
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
}
|
956 |
-
}
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
</
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
<?php
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
<
|
1317 |
-
<
|
1318 |
-
<
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
<
|
1354 |
-
<
|
1355 |
-
<
|
1356 |
-
<?php
|
1357 |
-
</
|
1358 |
-
</
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
</
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
)
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
}
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
*
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
}
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
$
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
}
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
}
|
1943 |
-
|
1944 |
-
$
|
1945 |
-
$
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Post Expirator
|
4 |
+
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
|
5 |
+
Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
|
6 |
+
Author: Aaron Axelsen
|
7 |
+
Version: 2.4.3
|
8 |
+
Author URI: http://postexpirator.tuxdocs.net/
|
9 |
+
Text Domain: post-expirator
|
10 |
+
Domain Path: /languages
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Default Values
|
14 |
+
define( 'POSTEXPIRATOR_VERSION', '2.4.3' );
|
15 |
+
define( 'POSTEXPIRATOR_DATEFORMAT', __( 'l F jS, Y', 'post-expirator' ) );
|
16 |
+
define( 'POSTEXPIRATOR_TIMEFORMAT', __( 'g:ia', 'post-expirator' ) );
|
17 |
+
define( 'POSTEXPIRATOR_FOOTERCONTENTS', __( 'Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator' ) );
|
18 |
+
define( 'POSTEXPIRATOR_FOOTERSTYLE', 'font-style: italic;' );
|
19 |
+
define( 'POSTEXPIRATOR_FOOTERDISPLAY', '0' );
|
20 |
+
define( 'POSTEXPIRATOR_EMAILNOTIFICATION', '0' );
|
21 |
+
define( 'POSTEXPIRATOR_EMAILNOTIFICATIONADMINS', '0' );
|
22 |
+
define( 'POSTEXPIRATOR_DEBUGDEFAULT', '0' );
|
23 |
+
define( 'POSTEXPIRATOR_EXPIREDEFAULT', 'null' );
|
24 |
+
define( 'POSTEXPIRATOR_SLUG', 'post-expirator' );
|
25 |
+
define( 'POSTEXPIRATOR_BASEDIR', dirname( __FILE__ ) );
|
26 |
+
define( 'POSTEXPIRATOR_BASEURL', plugins_url( '/', __FILE__ ) );
|
27 |
+
|
28 |
+
require_once POSTEXPIRATOR_BASEDIR . '/functions.php';
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Adds links to the plugin listing screen.
|
33 |
+
*
|
34 |
+
* @internal
|
35 |
+
*
|
36 |
+
* @access private
|
37 |
+
*/
|
38 |
+
function postexpirator_plugin_action_links( $links, $file ) {
|
39 |
+
$this_plugin = basename( plugin_dir_url( __FILE__ ) ) . '/post-expirator.php';
|
40 |
+
if ( $file === $this_plugin ) {
|
41 |
+
$links[] = '<a href="options-general.php?page=post-expirator">' . __( 'Settings', 'post-expirator' ) . '</a>';
|
42 |
+
}
|
43 |
+
return $links;
|
44 |
+
}
|
45 |
+
add_filter( 'plugin_action_links', 'postexpirator_plugin_action_links', 10, 2 );
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Load translation, if it exists.
|
49 |
+
*
|
50 |
+
* @internal
|
51 |
+
*
|
52 |
+
* @access private
|
53 |
+
*/
|
54 |
+
function postexpirator_init() {
|
55 |
+
$plugin_dir = basename( dirname( __FILE__ ) );
|
56 |
+
load_plugin_textdomain( 'post-expirator', null, $plugin_dir . '/languages/' );
|
57 |
+
}
|
58 |
+
add_action( 'plugins_loaded', 'postexpirator_init' );
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Adds an 'Expires' column to the post display table.
|
62 |
+
*
|
63 |
+
* @internal
|
64 |
+
*
|
65 |
+
* @access private
|
66 |
+
*/
|
67 |
+
function postexpirator_add_column( $columns, $type ) {
|
68 |
+
$defaults = get_option( 'expirationdateDefaults' . ucfirst( $type ) );
|
69 |
+
if ( ! isset( $defaults['activeMetaBox'] ) || $defaults['activeMetaBox'] === 'active' ) {
|
70 |
+
$columns['expirationdate'] = __( 'Expires', 'post-expirator' );
|
71 |
+
}
|
72 |
+
return $columns;
|
73 |
+
}
|
74 |
+
add_filter( 'manage_posts_columns', 'postexpirator_add_column', 10, 2 );
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Adds sortable columns.
|
78 |
+
*
|
79 |
+
* @internal
|
80 |
+
*
|
81 |
+
* @access private
|
82 |
+
*/
|
83 |
+
function postexpirator_manage_sortable_columns() {
|
84 |
+
$post_types = get_post_types( array('public' => true) );
|
85 |
+
foreach ( $post_types as $post_type ) {
|
86 |
+
add_filter( 'manage_edit-' . $post_type . '_sortable_columns', 'postexpirator_sortable_column' );
|
87 |
+
}
|
88 |
+
}
|
89 |
+
add_action( 'init', 'postexpirator_manage_sortable_columns', 100 );
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Adds an 'Expires' column to the post display table.
|
93 |
+
*
|
94 |
+
* @internal
|
95 |
+
*
|
96 |
+
* @access private
|
97 |
+
*/
|
98 |
+
function postexpirator_sortable_column( $columns ) {
|
99 |
+
$columns['expirationdate'] = 'expirationdate';
|
100 |
+
return $columns;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Modify the sorting of posts.
|
105 |
+
*
|
106 |
+
* @internal
|
107 |
+
*
|
108 |
+
* @access private
|
109 |
+
*/
|
110 |
+
function postexpirator_orderby( $query ) {
|
111 |
+
if ( ! is_admin() ) {
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
|
115 |
+
$orderby = $query->get( 'orderby' );
|
116 |
+
|
117 |
+
if ( 'expirationdate' === $orderby ) {
|
118 |
+
$query->set(
|
119 |
+
'meta_query', array(
|
120 |
+
'relation' => 'OR',
|
121 |
+
array(
|
122 |
+
'key' => '_expiration-date',
|
123 |
+
'compare' => 'EXISTS',
|
124 |
+
),
|
125 |
+
array(
|
126 |
+
'key' => '_expiration-date',
|
127 |
+
'compare' => 'NOT EXISTS',
|
128 |
+
'value' => '',
|
129 |
+
),
|
130 |
+
)
|
131 |
+
);
|
132 |
+
$query->set( 'orderby', 'meta_value_num' );
|
133 |
+
}
|
134 |
+
}
|
135 |
+
add_action( 'pre_get_posts', 'postexpirator_orderby' );
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Adds an 'Expires' column to the page display table.
|
139 |
+
*
|
140 |
+
* @internal
|
141 |
+
*
|
142 |
+
* @access private
|
143 |
+
*/
|
144 |
+
function postexpirator_add_column_page( $columns ) {
|
145 |
+
$defaults = get_option( 'expirationdateDefaultsPage' );
|
146 |
+
if ( ! isset( $defaults['activeMetaBox'] ) || $defaults['activeMetaBox'] === 'active' ) {
|
147 |
+
$columns['expirationdate'] = __( 'Expires', 'post-expirator' );
|
148 |
+
}
|
149 |
+
return $columns;
|
150 |
+
}
|
151 |
+
add_filter( 'manage_pages_columns', 'postexpirator_add_column_page' );
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Fills the 'Expires' column of the post display table.
|
155 |
+
*
|
156 |
+
* @internal
|
157 |
+
*
|
158 |
+
* @access private
|
159 |
+
*/
|
160 |
+
function postexpirator_show_value( $column_name ) {
|
161 |
+
global $post;
|
162 |
+
$id = $post->ID;
|
163 |
+
if ( $column_name === 'expirationdate' ) {
|
164 |
+
$display = __( 'Never', 'post-expirator' );
|
165 |
+
$ed = get_post_meta( $id, '_expiration-date', true );
|
166 |
+
if ( $ed ) {
|
167 |
+
$display = date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $ed + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
|
168 |
+
}
|
169 |
+
echo $display;
|
170 |
+
|
171 |
+
// Values for Quick Edit
|
172 |
+
if ( $ed ) {
|
173 |
+
$date = gmdate( 'Y-m-d H:i:s', $ed );
|
174 |
+
$year = get_date_from_gmt( $date, 'Y' );
|
175 |
+
$month = get_date_from_gmt( $date, 'm' );
|
176 |
+
$day = get_date_from_gmt( $date, 'd' );
|
177 |
+
$hour = get_date_from_gmt( $date, 'H' );
|
178 |
+
$minute = get_date_from_gmt( $date, 'i' );
|
179 |
+
echo '<span id="expirationdate_year-' . $id . '" style="display: none;">' . $year . '</span>';
|
180 |
+
echo '<span id="expirationdate_month-' . $id . '" style="display: none;">' . $month . '</span>';
|
181 |
+
echo '<span id="expirationdate_day-' . $id . '" style="display: none;">' . $day . '</span>';
|
182 |
+
echo '<span id="expirationdate_hour-' . $id . '" style="display: none;">' . $hour . '</span>';
|
183 |
+
echo '<span id="expirationdate_minute-' . $id . '" style="display: none;">' . $minute . '</span>';
|
184 |
+
echo '<span id="expirationdate_enabled-' . $id . '" style="display: none;">true</span>';
|
185 |
+
} else {
|
186 |
+
echo '<span id="expirationdate_year-' . $id . '" style="display: none;">' . date( 'Y' ) . '</span>';
|
187 |
+
echo '<span id="expirationdate_month-' . $id . '" style="display: none;">' . date( 'm' ) . '</span>';
|
188 |
+
echo '<span id="expirationdate_day-' . $id . '" style="display: none;">' . date( 'd' ) . '</span>';
|
189 |
+
echo '<span id="expirationdate_hour-' . $id . '" style="display: none;">' . date( 'H' ) . '</span>';
|
190 |
+
echo '<span id="expirationdate_minute-' . $id . '" style="display: none;">' . date( 'i' ) . '</span>';
|
191 |
+
echo '<span id="expirationdate_enabled-' . $id . '" style="display: none;">false</span>';
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
add_action( 'manage_posts_custom_column', 'postexpirator_show_value' );
|
196 |
+
add_action( 'manage_pages_custom_column', 'postexpirator_show_value' );
|
197 |
+
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Quick Edit functionality.
|
201 |
+
*
|
202 |
+
* @internal
|
203 |
+
*
|
204 |
+
* @access private
|
205 |
+
*/
|
206 |
+
function postexpirator_quickedit( $column_name, $post_type ) {
|
207 |
+
if ( $column_name !== 'expirationdate' ) {
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
?>
|
211 |
+
<div style="clear:both"></div>
|
212 |
+
<fieldset class="inline-edit-col-left post-expirator-quickedit">
|
213 |
+
<div class="inline-edit-col">
|
214 |
+
<div class="inline-edit-group">
|
215 |
+
<span class="title"><?php _e( 'Post Expirator', 'post-expirator' ); ?></span>
|
216 |
+
<p><input name="enable-expirationdate" type="checkbox" /><span class="title"><?php _e( 'Enable Post Expiration', 'post-expirator' ); ?></span></p>
|
217 |
+
<fieldset class="inline-edit-date">
|
218 |
+
<legend><span class="title"><?php _e( 'Expires', 'post-expirator' ); ?></span></legend>
|
219 |
+
<div class="timestamp-wrap">
|
220 |
+
<label>
|
221 |
+
<span class="screen-reader-text"><?php _e( 'Month', 'post-expirator' ); ?></span>
|
222 |
+
<select name="expirationdate_month">
|
223 |
+
<?php
|
224 |
+
for ( $x = 1; $x <= 12; $x++ ) {
|
225 |
+
$now = mktime( 0, 0, 0, $x, 1, date_i18n( 'Y' ) );
|
226 |
+
$monthNumeric = date_i18n( 'm', $now );
|
227 |
+
$monthStr = date_i18n( 'M', $now );
|
228 |
+
?>
|
229 |
+
<option value="<?php echo $monthNumeric; ?>" data-text="<?php echo $monthStr; ?>"><?php echo $monthNumeric; ?>-<?php echo $monthStr; ?></option>
|
230 |
+
<?php } ?>
|
231 |
+
|
232 |
+
</select>
|
233 |
+
</label>
|
234 |
+
<label>
|
235 |
+
<span class="screen-reader-text"><?php _e( 'Day', 'post-expirator' ); ?></span>
|
236 |
+
<input name="expirationdate_day" value="" size="2" maxlength="2" autocomplete="off" type="text" placeholder="<?php echo date( 'd' ); ?>">
|
237 |
+
</label>,
|
238 |
+
<label>
|
239 |
+
<span class="screen-reader-text"><?php _e( 'Year', 'post-expirator' ); ?></span>
|
240 |
+
<input name="expirationdate_year" value="" size="4" maxlength="4" autocomplete="off" type="text" placeholder="<?php echo date( 'Y' ); ?>">
|
241 |
+
</label> @
|
242 |
+
<label>
|
243 |
+
<span class="screen-reader-text"><?php _e( 'Hour', 'post-expirator' ); ?></span>
|
244 |
+
<input name="expirationdate_hour" value="" size="2" maxlength="2" autocomplete="off" type="text" placeholder="00">
|
245 |
+
</label> :
|
246 |
+
<label>
|
247 |
+
<span class="screen-reader-text"><?php _e( 'Minute', 'post-expirator' ); ?></span>
|
248 |
+
<input name="expirationdate_minute" value="" size="2" maxlength="2" autocomplete="off" type="text" placeholder="00">
|
249 |
+
</label>
|
250 |
+
</div>
|
251 |
+
<input name="expirationdate_quickedit" value="true" type="hidden"/>
|
252 |
+
</fieldset>
|
253 |
+
</div>
|
254 |
+
</div>
|
255 |
+
</fieldset>
|
256 |
+
<?php
|
257 |
+
|
258 |
+
}
|
259 |
+
add_action( 'quick_edit_custom_box', 'postexpirator_quickedit', 10, 2 );
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Bulk Edit functionality.
|
263 |
+
*
|
264 |
+
* @internal
|
265 |
+
*
|
266 |
+
* @access private
|
267 |
+
*/
|
268 |
+
function postexpirator_bulkedit( $column_name, $post_type ) {
|
269 |
+
if ( $column_name !== 'expirationdate' ) {
|
270 |
+
return;
|
271 |
+
}
|
272 |
+
?>
|
273 |
+
<div style="clear:both"></div>
|
274 |
+
<div class="inline-edit-col post-expirator-quickedit">
|
275 |
+
<div class="inline-edit-col">
|
276 |
+
<div class="inline-edit-group">
|
277 |
+
<legend class="inline-edit-legend"><?php _e( 'Post Expirator', 'post-expirator' ); ?></legend>
|
278 |
+
<fieldset class="inline-edit-date">
|
279 |
+
<legend><span class="title"><?php _e( 'Expires', 'post-expirator' ); ?></span></legend>
|
280 |
+
<div class="timestamp-wrap">
|
281 |
+
<label>
|
282 |
+
<span class="screen-reader-text"><?php _e( 'Enable Post Expiration', 'post-expirator' ); ?></span>
|
283 |
+
<select name="expirationdate_status">
|
284 |
+
<option value="no-change" data-show-fields="false" selected>--<?php _e( 'No Change', 'post-expirator' ); ?>--</option>
|
285 |
+
<option value="change-only" data-show-fields="true" title="<?php _e( 'Change expiry date if enabled on posts', 'post-expirator' ); ?>"><?php _e( 'Change on posts', 'post-expirator' ); ?></option>
|
286 |
+
<option value="add-only" data-show-fields="true" title="<?php _e( 'Add expiry date if not enabled on posts', 'post-expirator' ); ?>"><?php _e( 'Add to posts', 'post-expirator' ); ?></option>
|
287 |
+
<option value="change-add" data-show-fields="true"><?php _e( 'Change & Add', 'post-expirator' ); ?></option>
|
288 |
+
<option value="remove-only" data-show-fields="false"><?php _e( 'Remove from posts', 'post-expirator' ); ?></option>
|
289 |
+
</select>
|
290 |
+
</label>
|
291 |
+
<span class="post-expirator-date-fields">
|
292 |
+
<label>
|
293 |
+
<span class="screen-reader-text"><?php _e( 'Month', 'post-expirator' ); ?></span>
|
294 |
+
<select name="expirationdate_month">
|
295 |
+
<?php
|
296 |
+
for ( $x = 1; $x <= 12; $x++ ) {
|
297 |
+
$now = mktime( 0, 0, 0, $x, 1, date_i18n( 'Y' ) );
|
298 |
+
$monthNumeric = date_i18n( 'm', $now );
|
299 |
+
$monthStr = date_i18n( 'M', $now );
|
300 |
+
?>
|
301 |
+
<option value="<?php echo $monthNumeric; ?>" data-text="<?php echo $monthStr; ?>"><?php echo $monthNumeric; ?>-<?php echo $monthStr; ?></option>
|
302 |
+
<?php } ?>
|
303 |
+
|
304 |
+
</select>
|
305 |
+
</label>
|
306 |
+
<label>
|
307 |
+
<span class="screen-reader-text"><?php _e( 'Day', 'post-expirator' ); ?></span>
|
308 |
+
<input name="expirationdate_day" placeholder="<?php echo date( 'd' ); ?>" value="" size="2" maxlength="2" autocomplete="off" type="text">
|
309 |
+
</label>,
|
310 |
+
<label>
|
311 |
+
<span class="screen-reader-text"><?php _e( 'Year', 'post-expirator' ); ?></span>
|
312 |
+
<input name="expirationdate_year" placeholder="<?php echo date( 'Y' ); ?>" value="" size="4" maxlength="4" autocomplete="off" type="text">
|
313 |
+
</label> @
|
314 |
+
<label>
|
315 |
+
<span class="screen-reader-text"><?php _e( 'Hour', 'post-expirator' ); ?></span>
|
316 |
+
<input name="expirationdate_hour" placeholder="00" value="" size="2" maxlength="2" autocomplete="off" type="text">
|
317 |
+
</label> :
|
318 |
+
<label>
|
319 |
+
<span class="screen-reader-text"><?php _e( 'Minute', 'post-expirator' ); ?></span>
|
320 |
+
<input name="expirationdate_minute" placeholder="00" value="" size="2" maxlength="2" autocomplete="off" type="text">
|
321 |
+
</label>
|
322 |
+
</span>
|
323 |
+
</div>
|
324 |
+
<input name="expirationdate_quickedit" value="true" type="hidden"/>
|
325 |
+
</fieldset>
|
326 |
+
</div>
|
327 |
+
</div>
|
328 |
+
</div>
|
329 |
+
<?php
|
330 |
+
|
331 |
+
}
|
332 |
+
add_action( 'bulk_edit_custom_box', 'postexpirator_bulkedit', 10, 2 );
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Adds hooks to get the meta box added to pages and custom post types
|
336 |
+
*
|
337 |
+
* @internal
|
338 |
+
*
|
339 |
+
* @access private
|
340 |
+
*/
|
341 |
+
function postexpirator_meta_custom() {
|
342 |
+
$custom_post_types = get_post_types();
|
343 |
+
array_push( $custom_post_types, 'page' );
|
344 |
+
foreach ( $custom_post_types as $t ) {
|
345 |
+
$defaults = get_option( 'expirationdateDefaults' . ucfirst( $t ) );
|
346 |
+
if ( ! isset( $defaults['activeMetaBox'] ) || $defaults['activeMetaBox'] === 'active' ) {
|
347 |
+
add_meta_box( 'expirationdatediv', __( 'Post Expirator', 'post-expirator' ), 'postexpirator_meta_box', $t, 'side', 'core' );
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
add_action( 'add_meta_boxes', 'postexpirator_meta_custom' );
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Actually adds the meta box
|
355 |
+
*
|
356 |
+
* @internal
|
357 |
+
*
|
358 |
+
* @access private
|
359 |
+
*/
|
360 |
+
function postexpirator_meta_box( $post ) {
|
361 |
+
// Get default month
|
362 |
+
$expirationdatets = get_post_meta( $post->ID, '_expiration-date', true );
|
363 |
+
$firstsave = get_post_meta( $post->ID, '_expiration-date-status', true );
|
364 |
+
|
365 |
+
// nonce
|
366 |
+
wp_nonce_field( '__postexpirator', '_postexpiratornonce' );
|
367 |
+
|
368 |
+
$default = '';
|
369 |
+
$expireType = '';
|
370 |
+
$defaults = get_option( 'expirationdateDefaults' . ucfirst( $post->post_type ) );
|
371 |
+
if ( empty( $expirationdatets ) ) {
|
372 |
+
$default = get_option( 'expirationdateDefaultDate', POSTEXPIRATOR_EXPIREDEFAULT );
|
373 |
+
if ( $default === 'null' ) {
|
374 |
+
$defaultmonth = date_i18n( 'm' );
|
375 |
+
$defaultday = date_i18n( 'd' );
|
376 |
+
$defaulthour = date_i18n( 'H' );
|
377 |
+
$defaultyear = date_i18n( 'Y' );
|
378 |
+
$defaultminute = date_i18n( 'i' );
|
379 |
+
|
380 |
+
} elseif ( $default === 'custom' ) {
|
381 |
+
$custom = get_option( 'expirationdateDefaultDateCustom' );
|
382 |
+
if ( $custom === false ) {
|
383 |
+
$ts = time();
|
384 |
+
} else {
|
385 |
+
$tz = get_option( 'timezone_string' );
|
386 |
+
if ( $tz ) {
|
387 |
+
// @TODO Using date_default_timezone_set() and similar isn't allowed, instead use WP internal timezone support.
|
388 |
+
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
|
389 |
+
date_default_timezone_set( $tz );
|
390 |
+
}
|
391 |
+
|
392 |
+
// strip the quotes in case the user provides them.
|
393 |
+
$custom = str_replace( '"', '', html_entity_decode( $custom, ENT_QUOTES ) );
|
394 |
+
|
395 |
+
$ts = time() + ( strtotime( $custom ) - time() );
|
396 |
+
if ( $tz ) {
|
397 |
+
// @TODO Using date_default_timezone_set() and similar isn't allowed, instead use WP internal timezone support.
|
398 |
+
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
|
399 |
+
date_default_timezone_set( 'UTC' );
|
400 |
+
}
|
401 |
+
}
|
402 |
+
$defaultmonth = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $ts ), 'm' );
|
403 |
+
$defaultday = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $ts ), 'd' );
|
404 |
+
$defaultyear = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $ts ), 'Y' );
|
405 |
+
$defaulthour = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $ts ), 'H' );
|
406 |
+
$defaultminute = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $ts ), 'i' );
|
407 |
+
}
|
408 |
+
|
409 |
+
$enabled = '';
|
410 |
+
$disabled = ' disabled="disabled"';
|
411 |
+
$categories = get_option( 'expirationdateCategoryDefaults' );
|
412 |
+
|
413 |
+
if ( isset( $defaults['expireType'] ) ) {
|
414 |
+
$expireType = $defaults['expireType'];
|
415 |
+
}
|
416 |
+
|
417 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
418 |
+
if ( isset( $defaults['autoEnable'] ) && ( $firstsave !== 'saved' ) && ( $defaults['autoEnable'] === true || $defaults['autoEnable'] == 1 ) ) {
|
419 |
+
$enabled = ' checked="checked"';
|
420 |
+
$disabled = '';
|
421 |
+
}
|
422 |
+
} else {
|
423 |
+
$defaultmonth = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), 'm' );
|
424 |
+
$defaultday = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), 'd' );
|
425 |
+
$defaultyear = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), 'Y' );
|
426 |
+
$defaulthour = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), 'H' );
|
427 |
+
$defaultminute = get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), 'i' );
|
428 |
+
$enabled = ' checked="checked"';
|
429 |
+
$disabled = '';
|
430 |
+
$opts = get_post_meta( $post->ID, '_expiration-date-options', true );
|
431 |
+
if ( isset( $opts['expireType'] ) ) {
|
432 |
+
$expireType = $opts['expireType'];
|
433 |
+
}
|
434 |
+
$categories = isset( $opts['category'] ) ? $opts['category'] : false;
|
435 |
+
}
|
436 |
+
|
437 |
+
$rv = array();
|
438 |
+
$rv[] = '<p><input type="checkbox" name="enable-expirationdate" id="enable-expirationdate" value="checked"' . $enabled . ' onclick="expirationdate_ajax_add_meta(\'enable-expirationdate\')" />';
|
439 |
+
$rv[] = '<label for="enable-expirationdate">' . __( 'Enable Post Expiration', 'post-expirator' ) . '</label></p>';
|
440 |
+
|
441 |
+
if ( $default === 'publish' ) {
|
442 |
+
$rv[] = '<em>' . __( 'The published date/time will be used as the expiration value', 'post-expirator' ) . '</em><br/>';
|
443 |
+
} else {
|
444 |
+
$rv[] = '<table><tr>';
|
445 |
+
$rv[] = '<th style="text-align: left;">' . __( 'Year', 'post-expirator' ) . '</th>';
|
446 |
+
$rv[] = '<th style="text-align: left;">' . __( 'Month', 'post-expirator' ) . '</th>';
|
447 |
+
$rv[] = '<th style="text-align: left;">' . __( 'Day', 'post-expirator' ) . '</th>';
|
448 |
+
$rv[] = '</tr><tr>';
|
449 |
+
$rv[] = '<td>';
|
450 |
+
$rv[] = '<select name="expirationdate_year" id="expirationdate_year"' . $disabled . '>';
|
451 |
+
$currentyear = date( 'Y' );
|
452 |
+
|
453 |
+
if ( $defaultyear < $currentyear ) {
|
454 |
+
$currentyear = $defaultyear;
|
455 |
+
}
|
456 |
+
|
457 |
+
for ( $i = $currentyear; $i <= $currentyear + 10; $i++ ) {
|
458 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
459 |
+
if ( $i == $defaultyear ) {
|
460 |
+
$selected = ' selected="selected"';
|
461 |
+
} else {
|
462 |
+
$selected = '';
|
463 |
+
}
|
464 |
+
$rv[] = '<option' . $selected . '>' . ( $i ) . '</option>';
|
465 |
+
}
|
466 |
+
$rv[] = '</select>';
|
467 |
+
$rv[] = '</td><td>';
|
468 |
+
$rv[] = '<select name="expirationdate_month" id="expirationdate_month"' . $disabled . '>';
|
469 |
+
|
470 |
+
for ( $i = 1; $i <= 12; $i++ ) {
|
471 |
+
if ( $defaultmonth === date_i18n( 'm', mktime( 0, 0, 0, $i, 1, date_i18n( 'Y' ) ) ) ) {
|
472 |
+
$selected = ' selected="selected"';
|
473 |
+
} else {
|
474 |
+
$selected = '';
|
475 |
+
}
|
476 |
+
$rv[] = '<option value="' . date_i18n( 'm', mktime( 0, 0, 0, $i, 1, date_i18n( 'Y' ) ) ) . '"' . $selected . '>' . date_i18n( 'F', mktime( 0, 0, 0, $i, 1, date_i18n( 'Y' ) ) ) . '</option>';
|
477 |
+
}
|
478 |
+
|
479 |
+
$rv[] = '</select>';
|
480 |
+
$rv[] = '</td><td>';
|
481 |
+
$rv[] = '<input type="text" id="expirationdate_day" name="expirationdate_day" value="' . $defaultday . '" size="2"' . $disabled . ' />,';
|
482 |
+
$rv[] = '</td></tr><tr>';
|
483 |
+
$rv[] = '<th style="text-align: left;"></th>';
|
484 |
+
$rv[] = '<th style="text-align: left;">' . __( 'Hour', 'post-expirator' ) . '(' . date_i18n( 'T', mktime( 0, 0, 0, $i, 1, date_i18n( 'Y' ) ) ) . ')</th>';
|
485 |
+
$rv[] = '<th style="text-align: left;">' . __( 'Minute', 'post-expirator' ) . '</th>';
|
486 |
+
$rv[] = '</tr><tr>';
|
487 |
+
$rv[] = '<td>@</td><td>';
|
488 |
+
$rv[] = '<select name="expirationdate_hour" id="expirationdate_hour"' . $disabled . '>';
|
489 |
+
|
490 |
+
for ( $i = 1; $i <= 24; $i++ ) {
|
491 |
+
if ( $defaulthour === date_i18n( 'H', mktime( $i, 0, 0, date_i18n( 'n' ), date_i18n( 'j' ), date_i18n( 'Y' ) ) ) ) {
|
492 |
+
$selected = ' selected="selected"';
|
493 |
+
} else {
|
494 |
+
$selected = '';
|
495 |
+
}
|
496 |
+
$rv[] = '<option value="' . date_i18n( 'H', mktime( $i, 0, 0, date_i18n( 'n' ), date_i18n( 'j' ), date_i18n( 'Y' ) ) ) . '"' . $selected . '>' . date_i18n( 'H', mktime( $i, 0, 0, date_i18n( 'n' ), date_i18n( 'j' ), date_i18n( 'Y' ) ) ) . '</option>';
|
497 |
+
}
|
498 |
+
|
499 |
+
$rv[] = '</select></td><td>';
|
500 |
+
$rv[] = '<input type="text" id="expirationdate_minute" name="expirationdate_minute" value="' . $defaultminute . '" size="2"' . $disabled . ' />';
|
501 |
+
$rv[] = '</td></tr></table>';
|
502 |
+
}
|
503 |
+
$rv[] = '<input type="hidden" name="expirationdate_formcheck" value="true" />';
|
504 |
+
echo implode( "\n", $rv );
|
505 |
+
|
506 |
+
echo '<br/>' . __( 'How to expire', 'post-expirator' ) . ': ';
|
507 |
+
echo _postexpirator_expire_type( array('type' => $post->post_type, 'name' => 'expirationdate_expiretype', 'selected' => $expireType, 'disabled' => $disabled, 'onchange' => 'expirationdate_toggle_category(this)') );
|
508 |
+
echo '<br/>';
|
509 |
+
|
510 |
+
if ( $post->post_type !== 'page' ) {
|
511 |
+
if ( isset( $expireType ) && ( $expireType === 'category' || $expireType === 'category-add' || $expireType === 'category-remove' ) ) {
|
512 |
+
$catdisplay = 'block';
|
513 |
+
} else {
|
514 |
+
$catdisplay = 'none';
|
515 |
+
}
|
516 |
+
echo '<div id="expired-category-selection" style="display: ' . $catdisplay . '">';
|
517 |
+
echo '<br/>' . __( 'Expiration Categories', 'post-expirator' ) . ':<br/>';
|
518 |
+
|
519 |
+
echo '<div class="wp-tab-panel" id="post-expirator-cat-list">';
|
520 |
+
echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">';
|
521 |
+
$walker = new Walker_PostExpirator_Category_Checklist();
|
522 |
+
if ( ! empty( $disabled ) ) {
|
523 |
+
$walker->setDisabled();
|
524 |
+
}
|
525 |
+
$taxonomies = get_object_taxonomies( $post->post_type, 'object' );
|
526 |
+
$taxonomies = wp_filter_object_list( $taxonomies, array('hierarchical' => true) );
|
527 |
+
if ( sizeof( $taxonomies ) === 0 ) {
|
528 |
+
echo '<p>' . __( 'You must assign a heirarchical taxonomy to this post type to use this feature.', 'post-expirator' ) . '</p>';
|
529 |
+
} elseif ( sizeof( $taxonomies ) > 1 && ! isset( $defaults['taxonomy'] ) ) {
|
530 |
+
echo '<p>' . __( 'More than 1 heirachical taxonomy detected. You must assign a default taxonomy on the settings screen.', 'post-expirator' ) . '</p>';
|
531 |
+
} else {
|
532 |
+
$keys = array_keys( $taxonomies );
|
533 |
+
$taxonomy = isset( $defaults['taxonomy'] ) ? $defaults['taxonomy'] : $keys[0];
|
534 |
+
wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy, 'walker' => $walker, 'selected_cats' => $categories, 'checked_ontop' => false ) );
|
535 |
+
echo '<input type="hidden" name="taxonomy-heirarchical" value="' . $taxonomy . '" />';
|
536 |
+
}
|
537 |
+
echo '</ul>';
|
538 |
+
echo '</div>';
|
539 |
+
if ( isset( $taxonomy ) ) {
|
540 |
+
echo '<p class="post-expirator-taxonomy-name">' . __( 'Taxonomy Name', 'post-expirator' ) . ': ' . $taxonomy . '</p>';
|
541 |
+
}
|
542 |
+
echo '</div>';
|
543 |
+
}
|
544 |
+
echo '<div id="expirationdate_ajax_result"></div>';
|
545 |
+
}
|
546 |
+
|
547 |
+
/**
|
548 |
+
* Add's ajax javascript.
|
549 |
+
*
|
550 |
+
* @internal
|
551 |
+
*
|
552 |
+
* @access private
|
553 |
+
*/
|
554 |
+
function postexpirator_js_admin_header() {
|
555 |
+
// Define custom JavaScript function
|
556 |
+
?>
|
557 |
+
<script type="text/javascript">
|
558 |
+
//<![CDATA[
|
559 |
+
function expirationdate_ajax_add_meta(expireenable) {
|
560 |
+
var expire = document.getElementById(expireenable);
|
561 |
+
|
562 |
+
if (expire.checked == true) {
|
563 |
+
var enable = 'true';
|
564 |
+
if (document.getElementById('expirationdate_month')) {
|
565 |
+
document.getElementById('expirationdate_month').disabled = false;
|
566 |
+
document.getElementById('expirationdate_day').disabled = false;
|
567 |
+
document.getElementById('expirationdate_year').disabled = false;
|
568 |
+
document.getElementById('expirationdate_hour').disabled = false;
|
569 |
+
document.getElementById('expirationdate_minute').disabled = false;
|
570 |
+
}
|
571 |
+
document.getElementById('expirationdate_expiretype').disabled = false;
|
572 |
+
var cats = document.getElementsByName('expirationdate_category[]');
|
573 |
+
var max = cats.length;
|
574 |
+
for (var i=0; i<max; i++) {
|
575 |
+
cats[i].disabled = '';
|
576 |
+
}
|
577 |
+
} else {
|
578 |
+
if (document.getElementById('expirationdate_month')) {
|
579 |
+
document.getElementById('expirationdate_month').disabled = true;
|
580 |
+
document.getElementById('expirationdate_day').disabled = true;
|
581 |
+
document.getElementById('expirationdate_year').disabled = true;
|
582 |
+
document.getElementById('expirationdate_hour').disabled = true;
|
583 |
+
document.getElementById('expirationdate_minute').disabled = true;
|
584 |
+
}
|
585 |
+
document.getElementById('expirationdate_expiretype').disabled = true;
|
586 |
+
var cats = document.getElementsByName('expirationdate_category[]');
|
587 |
+
var max = cats.length;
|
588 |
+
for (var i=0; i<max; i++) {
|
589 |
+
cats[i].disabled = 'disable';
|
590 |
+
}
|
591 |
+
var enable = 'false';
|
592 |
+
}
|
593 |
+
return true;
|
594 |
+
}
|
595 |
+
function expirationdate_toggle_category(id) {
|
596 |
+
if (id.options[id.selectedIndex].value == 'category') {
|
597 |
+
jQuery('#expired-category-selection').show();
|
598 |
+
} else if (id.options[id.selectedIndex].value == 'category-add') {
|
599 |
+
jQuery('#expired-category-selection').show(); //TEMP
|
600 |
+
} else if (id.options[id.selectedIndex].value == 'category-remove') {
|
601 |
+
jQuery('#expired-category-selection').show(); //TEMP
|
602 |
+
} else {
|
603 |
+
jQuery('#expired-category-selection').hide();
|
604 |
+
}
|
605 |
+
}
|
606 |
+
function expirationdate_toggle_defaultdate(id) {
|
607 |
+
if (id.options[id.selectedIndex].value == 'custom') {
|
608 |
+
jQuery('#expired-custom-container').show();
|
609 |
+
} else {
|
610 |
+
jQuery('#expired-custom-container').hide();
|
611 |
+
}
|
612 |
+
|
613 |
+
}
|
614 |
+
//]]>
|
615 |
+
</script>
|
616 |
+
<?php
|
617 |
+
}
|
618 |
+
add_action( 'admin_head', 'postexpirator_js_admin_header' );
|
619 |
+
|
620 |
+
/**
|
621 |
+
* Get correct URL (HTTP or HTTPS)
|
622 |
+
*
|
623 |
+
* @internal
|
624 |
+
*
|
625 |
+
* @access private
|
626 |
+
*/
|
627 |
+
function expirationdate_get_blog_url() {
|
628 |
+
if ( is_multisite() ) {
|
629 |
+
echo network_home_url( '/' );
|
630 |
+
} else {
|
631 |
+
echo home_url( '/' );
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Called when post is saved - stores expiration-date meta value
|
637 |
+
*
|
638 |
+
* @internal
|
639 |
+
*
|
640 |
+
* @access private
|
641 |
+
*/
|
642 |
+
function postexpirator_update_post_meta( $id ) {
|
643 |
+
// don't run the echo if this is an auto save
|
644 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
645 |
+
return;
|
646 |
+
}
|
647 |
+
|
648 |
+
// don't run the echo if the function is called for saving revision.
|
649 |
+
$posttype = get_post_type( $id );
|
650 |
+
if ( $posttype === 'revision' ) {
|
651 |
+
return;
|
652 |
+
}
|
653 |
+
|
654 |
+
if ( ! isset( $_POST['expirationdate_quickedit'] ) ) {
|
655 |
+
if ( ! isset( $_POST['expirationdate_formcheck'] ) ) {
|
656 |
+
return;
|
657 |
+
}
|
658 |
+
}
|
659 |
+
|
660 |
+
if ( isset( $_POST['enable-expirationdate'] ) ) {
|
661 |
+
$default = get_option( 'expirationdateDefaultDate', POSTEXPIRATOR_EXPIREDEFAULT );
|
662 |
+
if ( $default === 'publish' ) {
|
663 |
+
$month = intval( $_POST['mm'] );
|
664 |
+
$day = intval( $_POST['jj'] );
|
665 |
+
$year = intval( $_POST['aa'] );
|
666 |
+
$hour = intval( $_POST['hh'] );
|
667 |
+
$minute = intval( $_POST['mn'] );
|
668 |
+
} else {
|
669 |
+
$month = intval( $_POST['expirationdate_month'] );
|
670 |
+
$day = intval( $_POST['expirationdate_day'] );
|
671 |
+
$year = intval( $_POST['expirationdate_year'] );
|
672 |
+
$hour = intval( $_POST['expirationdate_hour'] );
|
673 |
+
$minute = intval( $_POST['expirationdate_minute'] );
|
674 |
+
|
675 |
+
if ( empty( $day ) ) {
|
676 |
+
$day = date( 'd' );
|
677 |
+
}
|
678 |
+
if ( empty( $year ) ) {
|
679 |
+
$year = date( 'Y' );
|
680 |
+
}
|
681 |
+
}
|
682 |
+
$category = isset( $_POST['expirationdate_category'] ) ? $_POST['expirationdate_category'] : 0;
|
683 |
+
|
684 |
+
$ts = get_gmt_from_date( "$year-$month-$day $hour:$minute:0", 'U' );
|
685 |
+
|
686 |
+
if ( isset( $_POST['expirationdate_quickedit'] ) ) {
|
687 |
+
$ed = get_post_meta( $id, '_expiration-date', true );
|
688 |
+
if ( $ed ) {
|
689 |
+
$opts = get_post_meta( $id, '_expiration-date-options', true );
|
690 |
+
}
|
691 |
+
} else {
|
692 |
+
$opts = array();
|
693 |
+
|
694 |
+
// Schedule/Update Expiration
|
695 |
+
$opts['expireType'] = $_POST['expirationdate_expiretype'];
|
696 |
+
$opts['id'] = $id;
|
697 |
+
|
698 |
+
if ( $opts['expireType'] === 'category' || $opts['expireType'] === 'category-add' || $opts['expireType'] === 'category-remove' ) {
|
699 |
+
if ( isset( $category ) && ! empty( $category ) ) {
|
700 |
+
if ( ! empty( $category ) ) {
|
701 |
+
$opts['category'] = $category;
|
702 |
+
$opts['categoryTaxonomy'] = $_POST['taxonomy-heirarchical'];
|
703 |
+
}
|
704 |
+
}
|
705 |
+
}
|
706 |
+
}
|
707 |
+
postexpirator_schedule_event( $id, $ts, $opts );
|
708 |
+
} else {
|
709 |
+
postexpirator_unschedule_event( $id );
|
710 |
+
}
|
711 |
+
}
|
712 |
+
add_action( 'save_post', 'postexpirator_update_post_meta' );
|
713 |
+
|
714 |
+
/**
|
715 |
+
* Schedules the single event.
|
716 |
+
*
|
717 |
+
* @internal
|
718 |
+
*
|
719 |
+
* @access private
|
720 |
+
*/
|
721 |
+
function postexpirator_schedule_event( $id, $ts, $opts ) {
|
722 |
+
$debug = postexpirator_debug(); // check for/load debug
|
723 |
+
|
724 |
+
$id = intval( $id );
|
725 |
+
|
726 |
+
do_action( 'postexpiratior_schedule', $id, $ts, $opts ); // allow custom actions
|
727 |
+
|
728 |
+
if ( wp_next_scheduled( 'postExpiratorExpire', array($id) ) !== false ) {
|
729 |
+
$error = wp_clear_scheduled_hook( 'postExpiratorExpire', array($id), true ); // Remove any existing hooks
|
730 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
731 |
+
$debug->save( array('message' => $id . ' -> EXISTING FOUND - UNSCHEDULED - ' . ( is_wp_error( $error ) ? $error->get_error_message() : 'no error' )) );
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
$error = wp_schedule_single_event( $ts, 'postExpiratorExpire', array($id), true );
|
736 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
737 |
+
$debug->save( array('message' => $id . ' -> SCHEDULED at ' . date_i18n( 'r', $ts ) . ' ' . '(' . $ts . ') with options ' . print_r( $opts, true ) . ' ' . ( is_wp_error( $error ) ? $error->get_error_message() : 'no error' ) ) );
|
738 |
+
}
|
739 |
+
|
740 |
+
// Update Post Meta
|
741 |
+
update_post_meta( $id, '_expiration-date', $ts );
|
742 |
+
if ( ! is_null( $opts ) ) {
|
743 |
+
update_post_meta( $id, '_expiration-date-options', $opts );
|
744 |
+
}
|
745 |
+
update_post_meta( $id, '_expiration-date-status', 'saved' );
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* Unschedules the single event.
|
750 |
+
*
|
751 |
+
* @internal
|
752 |
+
*
|
753 |
+
* @access private
|
754 |
+
*/
|
755 |
+
function postexpirator_unschedule_event( $id ) {
|
756 |
+
$debug = postexpirator_debug(); // check for/load debug
|
757 |
+
|
758 |
+
do_action( 'postexpiratior_unschedule', $id ); // allow custom actions
|
759 |
+
|
760 |
+
delete_post_meta( $id, '_expiration-date' );
|
761 |
+
delete_post_meta( $id, '_expiration-date-options' );
|
762 |
+
|
763 |
+
// Delete Scheduled Expiration
|
764 |
+
if ( wp_next_scheduled( 'postExpiratorExpire', array($id) ) !== false ) {
|
765 |
+
wp_clear_scheduled_hook( 'postExpiratorExpire', array($id) ); // Remove any existing hooks
|
766 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
767 |
+
$debug->save( array('message' => $id . ' -> UNSCHEDULED') );
|
768 |
+
}
|
769 |
+
}
|
770 |
+
update_post_meta( $id, '_expiration-date-status', 'saved' );
|
771 |
+
}
|
772 |
+
|
773 |
+
/**
|
774 |
+
* The new expiration function, to work with single scheduled events.
|
775 |
+
*
|
776 |
+
* This was designed to hopefully be more flexible for future tweaks/modifications to the architecture.
|
777 |
+
*
|
778 |
+
* @internal
|
779 |
+
*
|
780 |
+
* @access private
|
781 |
+
*/
|
782 |
+
function postexpirator_expire_post( $id ) {
|
783 |
+
$debug = postexpirator_debug(); // check for/load debug
|
784 |
+
|
785 |
+
if ( empty( $id ) ) {
|
786 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
787 |
+
$debug->save( array('message' => 'No Post ID found - exiting') );
|
788 |
+
}
|
789 |
+
return false;
|
790 |
+
}
|
791 |
+
|
792 |
+
if ( is_null( get_post( $id ) ) ) {
|
793 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
794 |
+
$debug->save( array('message' => $id . ' -> Post does not exist - exiting') );
|
795 |
+
}
|
796 |
+
return false;
|
797 |
+
}
|
798 |
+
|
799 |
+
$posttype = get_post_type( $id );
|
800 |
+
$posttitle = get_the_title( $id );
|
801 |
+
$postlink = get_post_permalink( $id );
|
802 |
+
|
803 |
+
$postoptions = get_post_meta( $id, '_expiration-date-options', true );
|
804 |
+
$expireType = $category = $categoryTaxonomy = null;
|
805 |
+
|
806 |
+
if ( isset( $postoptions['expireType'] ) ) {
|
807 |
+
$expireType = $postoptions['expireType'];
|
808 |
+
}
|
809 |
+
|
810 |
+
if ( isset( $postoptions['category'] ) ) {
|
811 |
+
$category = $postoptions['category'];
|
812 |
+
}
|
813 |
+
|
814 |
+
if ( isset( $postoptions['categoryTaxonomy'] ) ) {
|
815 |
+
$categoryTaxonomy = $postoptions['categoryTaxonomy'];
|
816 |
+
}
|
817 |
+
|
818 |
+
$ed = get_post_meta( $id, '_expiration-date', true );
|
819 |
+
|
820 |
+
// Check for default expire only if not passed in
|
821 |
+
if ( empty( $expireType ) ) {
|
822 |
+
$posttype = get_post_type( $id );
|
823 |
+
if ( $posttype === 'page' ) {
|
824 |
+
$expireType = strtolower( get_option( 'expirationdateExpiredPageStatus', POSTEXPIRATOR_PAGESTATUS ) );
|
825 |
+
} elseif ( $posttype === 'post' ) {
|
826 |
+
$expireType = strtolower( get_option( 'expirationdateExpiredPostStatus', 'draft' ) );
|
827 |
+
} else {
|
828 |
+
$expireType = apply_filters( 'postexpirator_custom_posttype_expire', $expireType, $posttype ); // hook to set defaults for custom post types
|
829 |
+
}
|
830 |
+
}
|
831 |
+
|
832 |
+
// Remove KSES - wp_cron runs as an unauthenticated user, which will by default trigger kses filtering,
|
833 |
+
// even if the post was published by a admin user. It is fairly safe here to remove the filter call since
|
834 |
+
// we are only changing the post status/meta information and not touching the content.
|
835 |
+
kses_remove_filters();
|
836 |
+
|
837 |
+
// Do Work
|
838 |
+
if ( $expireType === 'draft' ) {
|
839 |
+
if ( wp_update_post( array('ID' => $id, 'post_status' => 'draft') ) === 0 ) {
|
840 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
841 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
842 |
+
}
|
843 |
+
} else {
|
844 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post status has been successfully changed to "%4$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', strtoupper( $expireType ) );
|
845 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
846 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
847 |
+
}
|
848 |
+
}
|
849 |
+
} elseif ( $expireType === 'private' ) {
|
850 |
+
if ( wp_update_post( array('ID' => $id, 'post_status' => 'private') ) === 0 ) {
|
851 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
852 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
853 |
+
}
|
854 |
+
} else {
|
855 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post status has been successfully changed to "%4$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', strtoupper( $expireType ) );
|
856 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
857 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
858 |
+
}
|
859 |
+
}
|
860 |
+
} elseif ( $expireType === 'delete' ) {
|
861 |
+
if ( wp_delete_post( $id ) === false ) {
|
862 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
863 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
864 |
+
}
|
865 |
+
} else {
|
866 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post status has been successfully changed to "%4$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', strtoupper( $expireType ) );
|
867 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
868 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
869 |
+
}
|
870 |
+
}
|
871 |
+
} elseif ( $expireType === 'trash' ) {
|
872 |
+
if ( wp_trash_post( $id ) === false ) {
|
873 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
874 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
875 |
+
}
|
876 |
+
} else {
|
877 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post status has been successfully changed to "%4$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', strtoupper( $expireType ) );
|
878 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
879 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
880 |
+
}
|
881 |
+
}
|
882 |
+
} elseif ( $expireType === 'stick' ) {
|
883 |
+
if ( stick_post( $id ) === false ) {
|
884 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
885 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
886 |
+
}
|
887 |
+
} else {
|
888 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post "%4$s" status has been successfully set.', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'STICKY' );
|
889 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
890 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
891 |
+
}
|
892 |
+
}
|
893 |
+
} elseif ( $expireType === 'unstick' ) {
|
894 |
+
if ( unstick_post( $id ) === false ) {
|
895 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
896 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
897 |
+
}
|
898 |
+
} else {
|
899 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post "%4$s" status has been successfully removed.', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'STICKY' );
|
900 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
901 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
902 |
+
}
|
903 |
+
}
|
904 |
+
} elseif ( $expireType === 'category' ) {
|
905 |
+
if ( ! empty( $category ) ) {
|
906 |
+
if ( ! isset( $categoryTaxonomy ) || $categoryTaxonomy === 'category' ) {
|
907 |
+
if ( wp_update_post( array('ID' => $id, 'post_category' => $category) ) === 0 ) {
|
908 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
909 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
910 |
+
}
|
911 |
+
} else {
|
912 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post "%4$s" have now been set to "%5$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'CATEGORIES', implode( ',', _postexpirator_get_cat_names( $category ) ) );
|
913 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
914 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
915 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES REPLACED ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
916 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES COMPLETE ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
917 |
+
}
|
918 |
+
}
|
919 |
+
} else {
|
920 |
+
$terms = array_map( 'intval', $category );
|
921 |
+
if ( is_wp_error( wp_set_object_terms( $id, $terms, $categoryTaxonomy, false ) ) ) {
|
922 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
923 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
924 |
+
}
|
925 |
+
} else {
|
926 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. Post "%4$s" have now been set to "%5$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'CATEGORIES', implode( ',', _postexpirator_get_cat_names( $category ) ) );
|
927 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
928 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
929 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES REPLACED ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
930 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES COMPLETE ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
931 |
+
}
|
932 |
+
}
|
933 |
+
}
|
934 |
+
} else {
|
935 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
936 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
937 |
+
}
|
938 |
+
}
|
939 |
+
} elseif ( $expireType === 'category-add' ) {
|
940 |
+
if ( ! empty( $category ) ) {
|
941 |
+
if ( ! isset( $categoryTaxonomy ) || $categoryTaxonomy === 'category' ) {
|
942 |
+
$cats = wp_get_post_categories( $id );
|
943 |
+
$merged = array_merge( $cats, $category );
|
944 |
+
if ( wp_update_post( array('ID' => $id, 'post_category' => $merged) ) === 0 ) {
|
945 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
946 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
947 |
+
}
|
948 |
+
} else {
|
949 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. The following post "%4$s" have now been added: "%5$s". The full list of categories on the post are: "%6$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'CATEGORIES', implode( ',', _postexpirator_get_cat_names( $category ) ), implode( ',', _postexpirator_get_cat_names( $merged ) ) );
|
950 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
951 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
952 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES ADDED ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
953 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES COMPLETE ' . print_r( _postexpirator_get_cat_names( $merged ), true )) );
|
954 |
+
}
|
955 |
+
}
|
956 |
+
} else {
|
957 |
+
$terms = array_map( 'intval', $category );
|
958 |
+
if ( is_wp_error( wp_set_object_terms( $id, $terms, $categoryTaxonomy, true ) ) ) {
|
959 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
960 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
961 |
+
}
|
962 |
+
} else {
|
963 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. The following post "%4$s" have now been added: "%5$s". The full list of categories on the post are: "%6$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'CATEGORIES', implode( ',', _postexpirator_get_cat_names( $category ) ), implode( ',', _postexpirator_get_cat_names( $merged ) ) );
|
964 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
965 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
966 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES ADDED ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
967 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES COMPLETE ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
968 |
+
}
|
969 |
+
}
|
970 |
+
}
|
971 |
+
} else {
|
972 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
973 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
974 |
+
}
|
975 |
+
}
|
976 |
+
} elseif ( $expireType === 'category-remove' ) {
|
977 |
+
if ( ! empty( $category ) ) {
|
978 |
+
if ( ! isset( $categoryTaxonomy ) || $categoryTaxonomy === 'category' ) {
|
979 |
+
$cats = wp_get_post_categories( $id );
|
980 |
+
$merged = array();
|
981 |
+
foreach ( $cats as $cat ) {
|
982 |
+
if ( ! in_array( $cat, $category, true ) ) {
|
983 |
+
$merged[] = $cat;
|
984 |
+
}
|
985 |
+
}
|
986 |
+
if ( wp_update_post( array('ID' => $id, 'post_category' => $merged) ) === 0 ) {
|
987 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
988 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
989 |
+
}
|
990 |
+
} else {
|
991 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. The following post "%4$s" have now been removed: "%5$s". The full list of categories on the post are: "%6$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'CATEGORIES', implode( ',', _postexpirator_get_cat_names( $category ) ), implode( ',', _postexpirator_get_cat_names( $merged ) ) );
|
992 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
993 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
994 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES REMOVED ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
995 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES COMPLETE ' . print_r( _postexpirator_get_cat_names( $merged ), true )) );
|
996 |
+
}
|
997 |
+
}
|
998 |
+
} else {
|
999 |
+
$terms = wp_get_object_terms( $id, $categoryTaxonomy, array('fields' => 'ids') );
|
1000 |
+
$merged = array();
|
1001 |
+
foreach ( $terms as $term ) {
|
1002 |
+
if ( ! in_array( $term, $category, true ) ) {
|
1003 |
+
$merged[] = $term;
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
+
$terms = array_map( 'intval', $merged );
|
1007 |
+
if ( is_wp_error( wp_set_object_terms( $id, $terms, $categoryTaxonomy, false ) ) ) {
|
1008 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
1009 |
+
$debug->save( array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
1010 |
+
}
|
1011 |
+
} else {
|
1012 |
+
$emailBody = sprintf( __( '%1$s (%2$s) has expired at %3$s. The following post "%4$s" have now been removed: "%5$s". The full list of categories on the post are: "%6$s".', 'post-expirator' ), '##POSTTITLE##', '##POSTLINK##', '##EXPIRATIONDATE##', 'CATEGORIES', implode( ',', _postexpirator_get_cat_names( $category ) ), implode( ',', _postexpirator_get_cat_names( $merged ) ) );
|
1013 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
1014 |
+
$debug->save( array('message' => $id . ' -> PROCESSED ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
1015 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES REMOVED ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
1016 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES COMPLETE ' . print_r( _postexpirator_get_cat_names( $category ), true )) );
|
1017 |
+
}
|
1018 |
+
}
|
1019 |
+
}
|
1020 |
+
} else {
|
1021 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
1022 |
+
$debug->save( array('message' => $id . ' -> CATEGORIES MISSING ' . $expireType . ' ' . print_r( $postoptions, true )) );
|
1023 |
+
}
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
// Process Email
|
1028 |
+
$emailenabled = get_option( 'expirationdateEmailNotification', POSTEXPIRATOR_EMAILNOTIFICATION );
|
1029 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
1030 |
+
if ( $emailenabled == 1 && isset( $emailBody ) ) {
|
1031 |
+
$subj = sprintf( __( 'Post Expiration Complete "%s"', 'post-expirator' ), $posttitle );
|
1032 |
+
$emailBody = str_replace( '##POSTTITLE##', $posttitle, $emailBody );
|
1033 |
+
$emailBody = str_replace( '##POSTLINK##', $postlink, $emailBody );
|
1034 |
+
$emailBody = str_replace( '##EXPIRATIONDATE##', get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $ed ), get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ), $emailBody );
|
1035 |
+
|
1036 |
+
$emails = array();
|
1037 |
+
// Get Blog Admins
|
1038 |
+
$emailadmins = get_option( 'expirationdateEmailNotificationAdmins', POSTEXPIRATOR_EMAILNOTIFICATIONADMINS );
|
1039 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
1040 |
+
if ( $emailadmins == 1 ) {
|
1041 |
+
$blogusers = get_users( 'role=Administrator' );
|
1042 |
+
foreach ( $blogusers as $user ) {
|
1043 |
+
$emails[] = $user->user_email;
|
1044 |
+
}
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
// Get Global Notification Emails
|
1048 |
+
$emaillist = get_option( 'expirationdateEmailNotificationList' );
|
1049 |
+
if ( ! empty( $emaillist ) ) {
|
1050 |
+
$vals = explode( ',', $emaillist );
|
1051 |
+
foreach ( $vals as $val ) {
|
1052 |
+
$emails[] = trim( $val );
|
1053 |
+
}
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
// Get Post Type Notification Emails
|
1057 |
+
$defaults = get_option( 'expirationdateDefaults' . ucfirst( $posttype ) );
|
1058 |
+
if ( isset( $defaults['emailnotification'] ) && ! empty( $defaults['emailnotification'] ) ) {
|
1059 |
+
$vals = explode( ',', $defaults['emailnotification'] );
|
1060 |
+
foreach ( $vals as $val ) {
|
1061 |
+
$emails[] = trim( $val );
|
1062 |
+
}
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
// Send Emails
|
1066 |
+
foreach ( $emails as $email ) {
|
1067 |
+
if ( wp_mail( $email, sprintf( __( '[%1$s] %2$s' ), get_option( 'blogname' ), $subj ), $emailBody ) ) {
|
1068 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
1069 |
+
$debug->save( array('message' => $id . ' -> EXPIRATION EMAIL SENT (' . $email . ')') );
|
1070 |
+
}
|
1071 |
+
} else {
|
1072 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
1073 |
+
$debug->save( array('message' => $id . ' -> EXPIRATION EMAIL FAILED (' . $email . ')') );
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
}
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
}
|
1080 |
+
add_action( 'postExpiratorExpire', 'postexpirator_expire_post' );
|
1081 |
+
|
1082 |
+
/**
|
1083 |
+
* Internal method to get category names corresponding to the category IDs.
|
1084 |
+
*
|
1085 |
+
* @internal
|
1086 |
+
*
|
1087 |
+
* @access private
|
1088 |
+
*/
|
1089 |
+
function _postexpirator_get_cat_names( $cats ) {
|
1090 |
+
$out = array();
|
1091 |
+
foreach ( $cats as $cat ) {
|
1092 |
+
$out[ $cat ] = get_the_category_by_id( $cat );
|
1093 |
+
}
|
1094 |
+
return $out;
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
/**
|
1098 |
+
* Build the menu for the options page
|
1099 |
+
*
|
1100 |
+
* @internal
|
1101 |
+
*
|
1102 |
+
* @access private
|
1103 |
+
*/
|
1104 |
+
function postexpirator_menu_tabs( $tab ) {
|
1105 |
+
echo '<p>';
|
1106 |
+
if ( empty( $tab ) ) {
|
1107 |
+
$tab = 'general';
|
1108 |
+
}
|
1109 |
+
echo '<a href="' . admin_url( 'options-general.php?page=post-expirator.php&tab=general' ) . '"' . ( $tab === 'general' ? ' style="font-weight: bold; text-decoration:none;"' : '' ) . '>' . __( 'General Settings', 'post-expirator' ) . '</a> | ';
|
1110 |
+
echo '<a href="' . admin_url( 'options-general.php?page=post-expirator.php&tab=defaults' ) . '"' . ( $tab === 'defaults' ? ' style="font-weight: bold; text-decoration:none;"' : '' ) . '>' . __( 'Defaults', 'post-expirator' ) . '</a> | ';
|
1111 |
+
echo '<a href="' . admin_url( 'options-general.php?page=post-expirator.php&tab=diagnostics' ) . '"' . ( $tab === 'diagnostics' ? ' style="font-weight: bold; text-decoration:none;"' : '' ) . '>' . __( 'Diagnostics', 'post-expirator' ) . '</a> | ';
|
1112 |
+
echo '<a href="' . admin_url( 'options-general.php?page=post-expirator.php&tab=viewdebug' ) . '"' . ( $tab === 'viewdebug' ? ' style="font-weight: bold; text-decoration:none;"' : '' ) . '>' . __( 'View Debug Logs', 'post-expirator' ) . '</a>';
|
1113 |
+
echo '</p><hr/>';
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
/**
|
1117 |
+
* Show the menu.
|
1118 |
+
*
|
1119 |
+
* @internal
|
1120 |
+
*
|
1121 |
+
* @access private
|
1122 |
+
*/
|
1123 |
+
function postexpirator_menu() {
|
1124 |
+
$tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
|
1125 |
+
|
1126 |
+
echo '<div class="wrap">';
|
1127 |
+
echo '<h2>' . __( 'Post Expirator Options', 'post-expirator' ) . '</h2>';
|
1128 |
+
|
1129 |
+
postexpirator_menu_tabs( $tab );
|
1130 |
+
if ( empty( $tab ) || $tab === 'general' ) {
|
1131 |
+
postexpirator_menu_general();
|
1132 |
+
} elseif ( $tab === 'defaults' ) {
|
1133 |
+
postexpirator_menu_defaults();
|
1134 |
+
} elseif ( $tab === 'diagnostics' ) {
|
1135 |
+
postexpirator_menu_diagnostics();
|
1136 |
+
} elseif ( $tab === 'viewdebug' ) {
|
1137 |
+
postexpirator_menu_debug();
|
1138 |
+
}
|
1139 |
+
echo '</div>';
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
/**
|
1143 |
+
* Hook's to add plugin page menu
|
1144 |
+
*
|
1145 |
+
* @internal
|
1146 |
+
*
|
1147 |
+
* @access private
|
1148 |
+
*/
|
1149 |
+
function postexpirator_add_menu() {
|
1150 |
+
add_submenu_page( 'options-general.php', __( 'Post Expirator Options', 'post-expirator' ), __( 'Post Expirator', 'post-expirator' ), 'manage_options', basename( __FILE__ ), 'postexpirator_menu' );
|
1151 |
+
}
|
1152 |
+
add_action( 'admin_menu', 'postexpirator_add_menu' );
|
1153 |
+
|
1154 |
+
/**
|
1155 |
+
* Show the Expiration Date options page
|
1156 |
+
*
|
1157 |
+
* @internal
|
1158 |
+
*
|
1159 |
+
* @access private
|
1160 |
+
*/
|
1161 |
+
function postexpirator_menu_general() {
|
1162 |
+
if ( isset( $_POST['expirationdateSave'] ) && $_POST['expirationdateSave'] ) {
|
1163 |
+
if ( ! isset( $_POST['_postExpiratorMenuGeneral_nonce'] ) || ! wp_verify_nonce( $_POST['_postExpiratorMenuGeneral_nonce'], 'postexpirator_menu_general' ) ) {
|
1164 |
+
print 'Form Validation Failure: Sorry, your nonce did not verify.';
|
1165 |
+
exit;
|
1166 |
+
} else {
|
1167 |
+
// Filter Content
|
1168 |
+
$_POST = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
|
1169 |
+
|
1170 |
+
update_option( 'expirationdateDefaultDateFormat', $_POST['expired-default-date-format'] );
|
1171 |
+
update_option( 'expirationdateDefaultTimeFormat', $_POST['expired-default-time-format'] );
|
1172 |
+
update_option( 'expirationdateDisplayFooter', $_POST['expired-display-footer'] );
|
1173 |
+
update_option( 'expirationdateEmailNotification', $_POST['expired-email-notification'] );
|
1174 |
+
update_option( 'expirationdateEmailNotificationAdmins', $_POST['expired-email-notification-admins'] );
|
1175 |
+
update_option( 'expirationdateEmailNotificationList', trim( $_POST['expired-email-notification-list'] ) );
|
1176 |
+
update_option( 'expirationdateFooterContents', $_POST['expired-footer-contents'] );
|
1177 |
+
update_option( 'expirationdateFooterStyle', $_POST['expired-footer-style'] );
|
1178 |
+
if ( isset( $_POST['expirationdate_category'] ) ) {
|
1179 |
+
update_option( 'expirationdateCategoryDefaults', $_POST['expirationdate_category'] );
|
1180 |
+
}
|
1181 |
+
update_option( 'expirationdateDefaultDate', $_POST['expired-default-expiration-date'] );
|
1182 |
+
if ( $_POST['expired-custom-expiration-date'] ) {
|
1183 |
+
update_option( 'expirationdateDefaultDateCustom', $_POST['expired-custom-expiration-date'] );
|
1184 |
+
}
|
1185 |
+
echo "<div id='message' class='updated fade'><p>";
|
1186 |
+
_e( 'Saved Options!', 'post-expirator' );
|
1187 |
+
echo '</p></div>';
|
1188 |
+
}
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
// phpcs:disable WordPress.NamingConventions.ValidVariableName.InterpolatedVariableNotSnakeCase
|
1192 |
+
// phpcs:disable WordPress.PHP.StrictComparisons.LooseComparison
|
1193 |
+
|
1194 |
+
// Get Option
|
1195 |
+
$expirationdateDefaultDateFormat = get_option( 'expirationdateDefaultDateFormat', POSTEXPIRATOR_DATEFORMAT );
|
1196 |
+
$expirationdateDefaultTimeFormat = get_option( 'expirationdateDefaultTimeFormat', POSTEXPIRATOR_TIMEFORMAT );
|
1197 |
+
$expireddisplayfooter = get_option( 'expirationdateDisplayFooter', POSTEXPIRATOR_FOOTERDISPLAY );
|
1198 |
+
$expiredemailnotification = get_option( 'expirationdateEmailNotification', POSTEXPIRATOR_EMAILNOTIFICATION );
|
1199 |
+
$expiredemailnotificationadmins = get_option( 'expirationdateEmailNotificationAdmins', POSTEXPIRATOR_EMAILNOTIFICATIONADMINS );
|
1200 |
+
$expiredemailnotificationlist = get_option( 'expirationdateEmailNotificationList', '' );
|
1201 |
+
$expirationdateFooterContents = get_option( 'expirationdateFooterContents', POSTEXPIRATOR_FOOTERCONTENTS );
|
1202 |
+
$expirationdateFooterStyle = get_option( 'expirationdateFooterStyle', POSTEXPIRATOR_FOOTERSTYLE );
|
1203 |
+
$expirationdateDefaultDate = get_option( 'expirationdateDefaultDate', POSTEXPIRATOR_EXPIREDEFAULT );
|
1204 |
+
$expirationdateDefaultDateCustom = get_option( 'expirationdateDefaultDateCustom' );
|
1205 |
+
|
1206 |
+
$categories = get_option( 'expirationdateCategoryDefaults' );
|
1207 |
+
|
1208 |
+
$expireddisplayfooterenabled = '';
|
1209 |
+
$expireddisplayfooterdisabled = '';
|
1210 |
+
if ( $expireddisplayfooter == 0 ) {
|
1211 |
+
$expireddisplayfooterdisabled = 'checked="checked"';
|
1212 |
+
} elseif ( $expireddisplayfooter == 1 ) {
|
1213 |
+
$expireddisplayfooterenabled = 'checked="checked"';
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
$expiredemailnotificationenabled = '';
|
1217 |
+
$expiredemailnotificationdisabled = '';
|
1218 |
+
if ( $expiredemailnotification == 0 ) {
|
1219 |
+
$expiredemailnotificationdisabled = 'checked="checked"';
|
1220 |
+
} elseif ( $expiredemailnotification == 1 ) {
|
1221 |
+
$expiredemailnotificationenabled = 'checked="checked"';
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
$expiredemailnotificationadminsenabled = '';
|
1225 |
+
$expiredemailnotificationadminsdisabled = '';
|
1226 |
+
if ( $expiredemailnotificationadmins == 0 ) {
|
1227 |
+
$expiredemailnotificationadminsdisabled = 'checked="checked"';
|
1228 |
+
} elseif ( $expiredemailnotificationadmins == 1 ) {
|
1229 |
+
$expiredemailnotificationadminsenabled = 'checked="checked"';
|
1230 |
+
}
|
1231 |
+
?>
|
1232 |
+
<p>
|
1233 |
+
<?php _e( 'The post expirator plugin sets a custom meta value, and then optionally allows you to select if you want the post changed to a draft status or deleted when it expires.', 'post-expirator' ); ?>
|
1234 |
+
</p>
|
1235 |
+
<p>
|
1236 |
+
<?php _e( 'Valid [postexpirator] attributes:', 'post-expirator' ); ?>
|
1237 |
+
<ul>
|
1238 |
+
<li><?php _e( 'type - defaults to full - valid options are full,date,time', 'post-expirator' ); ?></li>
|
1239 |
+
<li><?php _e( 'dateformat - format set here will override the value set on the settings page', 'post-expirator' ); ?></li>
|
1240 |
+
<li><?php _e( 'timeformat - format set here will override the value set on the settings page', 'post-expirator' ); ?></li>
|
1241 |
+
</ul>
|
1242 |
+
</p>
|
1243 |
+
<form method="post" id="expirationdate_save_options">
|
1244 |
+
<?php wp_nonce_field( 'postexpirator_menu_general', '_postExpiratorMenuGeneral_nonce' ); ?>
|
1245 |
+
<h3><?php _e( 'Defaults', 'post-expirator' ); ?></h3>
|
1246 |
+
<table class="form-table">
|
1247 |
+
<tr valign="top">
|
1248 |
+
<th scope="row"><label for="expired-default-date-format"><?php _e( 'Date Format:', 'post-expirator' ); ?></label></th>
|
1249 |
+
<td>
|
1250 |
+
<input type="text" name="expired-default-date-format" id="expired-default-date-format" value="<?php echo $expirationdateDefaultDateFormat; ?>" size="25" /> (<?php echo date_i18n( "$expirationdateDefaultDateFormat" ); ?>)
|
1251 |
+
<br/>
|
1252 |
+
<?php _e( 'The default format to use when displaying the expiration date within a post using the [postexpirator] shortcode or within the footer. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.', 'post-expirator' ); ?>
|
1253 |
+
</td>
|
1254 |
+
</tr>
|
1255 |
+
<tr valign="top">
|
1256 |
+
<th scope="row"><label for="expired-default-time-format"><?php _e( 'Time Format:', 'post-expirator' ); ?></label></th>
|
1257 |
+
<td>
|
1258 |
+
<input type="text" name="expired-default-time-format" id="expired-default-time-format" value="<?php echo $expirationdateDefaultTimeFormat; ?>" size="25" /> (<?php echo date_i18n( "$expirationdateDefaultTimeFormat" ); ?>)
|
1259 |
+
<br/>
|
1260 |
+
<?php _e( 'The default format to use when displaying the expiration time within a post using the [postexpirator] shortcode or within the footer. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.', 'post-expirator' ); ?>
|
1261 |
+
</td>
|
1262 |
+
</tr>
|
1263 |
+
<tr valign="top">
|
1264 |
+
<th scope="row"><label for="expired-default-expiration-date"><?php _e( 'Default Date/Time Duration:', 'post-expirator' ); ?></label></th>
|
1265 |
+
<td>
|
1266 |
+
<select name="expired-default-expiration-date" id="expired-default-expiration-date" onchange="expirationdate_toggle_defaultdate(this)">
|
1267 |
+
<option value="null" <?php echo ( $expirationdateDefaultDate == 'null' ) ? ' selected="selected"' : ''; ?>><?php _e( 'None', 'post-expirator' ); ?></option>
|
1268 |
+
<option value="custom" <?php echo ( $expirationdateDefaultDate == 'custom' ) ? ' selected="selected"' : ''; ?>><?php _e( 'Custom', 'post-expirator' ); ?></option>
|
1269 |
+
<option value="publish" <?php echo ( $expirationdateDefaultDate == 'publish' ) ? ' selected="selected"' : ''; ?>><?php _e( 'Post/Page Publish Time', 'post-expirator' ); ?></option>
|
1270 |
+
</select>
|
1271 |
+
<br/>
|
1272 |
+
<?php _e( 'Set the default expiration date to be used when creating new posts and pages. Defaults to none.', 'post-expirator' ); ?>
|
1273 |
+
<?php $show = ( $expirationdateDefaultDate == 'custom' ) ? 'block' : 'none'; ?>
|
1274 |
+
<div id="expired-custom-container" style="display: <?php echo $show; ?>;">
|
1275 |
+
<br/><label for="expired-custom-expiration-date">Custom:</label> <input type="text" value="<?php echo $expirationdateDefaultDateCustom; ?>" name="expired-custom-expiration-date" id="expired-custom-expiration-date" />
|
1276 |
+
<br/>
|
1277 |
+
<?php echo sprintf( __( 'Set the custom value to use for the default expiration date. For information on formatting, see %1$s. For example, you could enter %2$s+1 month%3$s or %4$s+1 week 2 days 4 hours 2 seconds%5$s or %6$snext Thursday%7$s.', 'post-expirator' ), '<a href="http://php.net/manual/en/function.strtotime.php" target="_new">PHP strtotime function</a>', '<code>', '</code>', '<code>', '</code>', '<code>', '</code>' ); ?>
|
1278 |
+
</div>
|
1279 |
+
</td>
|
1280 |
+
</tr>
|
1281 |
+
</table>
|
1282 |
+
<h3><?php _e( 'Category Expiration', 'post-expirator' ); ?></h3>
|
1283 |
+
<table class="form-table">
|
1284 |
+
<tr valign="top">
|
1285 |
+
<th scope="row"><?php _e( 'Default Expiration Category', 'post-expirator' ); ?>:</th>
|
1286 |
+
<td>
|
1287 |
+
<?php
|
1288 |
+
echo '<div class="wp-tab-panel" id="post-expirator-cat-list">';
|
1289 |
+
echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">';
|
1290 |
+
$walker = new Walker_PostExpirator_Category_Checklist();
|
1291 |
+
wp_terms_checklist( 0, array( 'taxonomy' => 'category', 'walker' => $walker, 'selected_cats' => $categories, 'checked_ontop' => false ) );
|
1292 |
+
echo '</ul>';
|
1293 |
+
echo '</div>';
|
1294 |
+
?>
|
1295 |
+
<br/>
|
1296 |
+
<?php _e( "Set's the default expiration category for the post.", 'post-expirator' ); ?>
|
1297 |
+
</td>
|
1298 |
+
</tr>
|
1299 |
+
</table>
|
1300 |
+
|
1301 |
+
<h3><?php _e( 'Expiration Email Notification', 'post-expirator' ); ?></h3>
|
1302 |
+
<p><?php _e( 'Whenever a post expires, an email can be sent to alert users of the expiration.', 'post-expirator' ); ?></p>
|
1303 |
+
<table class="form-table">
|
1304 |
+
<tr valign="top">
|
1305 |
+
<th scope="row"><?php _e( 'Enable Email Notification?', 'post-expirator' ); ?></th>
|
1306 |
+
<td>
|
1307 |
+
<input type="radio" name="expired-email-notification" id="expired-email-notification-true" value="1" <?php echo $expiredemailnotificationenabled; ?>/> <label for="expired-email-notification-true"><?php _e( 'Enabled', 'post-expirator' ); ?></label>
|
1308 |
+
<br/>
|
1309 |
+
<input type="radio" name="expired-email-notification" id="expired-email-notification-false" value="0" <?php echo $expiredemailnotificationdisabled; ?>/> <label for="expired-email-notification-false"><?php _e( 'Disabled', 'post-expirator' ); ?></label>
|
1310 |
+
<br/>
|
1311 |
+
<?php _e( 'This will enable or disable the send of email notification on post expiration.', 'post-expirator' ); ?>
|
1312 |
+
</td>
|
1313 |
+
</tr>
|
1314 |
+
<tr valign="top">
|
1315 |
+
<th scope="row"><?php _e( 'Include Blog Administrators?', 'post-expirator' ); ?></th>
|
1316 |
+
<td>
|
1317 |
+
<input type="radio" name="expired-email-notification-admins" id="expired-email-notification-admins-true" value="1" <?php echo $expiredemailnotificationadminsenabled; ?>/> <label for="expired-email-notification-admins-true"><?php _e( 'Enabled', 'post-expirator' ); ?></label>
|
1318 |
+
<br/>
|
1319 |
+
<input type="radio" name="expired-email-notification-admins" id="expired-email-notification-admins-false" value="0" <?php echo $expiredemailnotificationadminsdisabled; ?>/> <label for="expired-email-notification-admins-false"><?php _e( 'Disabled', 'post-expirator' ); ?></label>
|
1320 |
+
<br/>
|
1321 |
+
<?php _e( 'This will include all users with the role of "Administrator" in the post expiration email.', 'post-expirator' ); ?>
|
1322 |
+
</td>
|
1323 |
+
</tr>
|
1324 |
+
<tr valign="top">
|
1325 |
+
<th scope="row"><label for="expired-email-notification-list"><?php _e( 'Who to notify:', 'post-expirator' ); ?></label></th>
|
1326 |
+
<td>
|
1327 |
+
<input class="large-text" type="text" name="expired-email-notification-list" id="expired-email-notification-list" value="<?php echo $expiredemailnotificationlist; ?>" />
|
1328 |
+
<br/>
|
1329 |
+
<?php _e( 'Enter a comma seperate list of emails that you would like to be notified when the post expires. This will be applied to ALL post types. You can set post type specific emails on the Defaults tab.', 'post-expirator' ); ?>
|
1330 |
+
</td>
|
1331 |
+
</tr>
|
1332 |
+
</table>
|
1333 |
+
|
1334 |
+
<h3><?php _e( 'Post Footer Display', 'post-expirator' ); ?></h3>
|
1335 |
+
<p><?php _e( 'Enabling this below will display the expiration date automatically at the end of any post which is set to expire.', 'post-expirator' ); ?></p>
|
1336 |
+
<table class="form-table">
|
1337 |
+
<tr valign="top">
|
1338 |
+
<th scope="row"><?php _e( 'Show in post footer?', 'post-expirator' ); ?></th>
|
1339 |
+
<td>
|
1340 |
+
<input type="radio" name="expired-display-footer" id="expired-display-footer-true" value="1" <?php echo $expireddisplayfooterenabled; ?>/> <label for="expired-display-footer-true"><?php _e( 'Enabled', 'post-expirator' ); ?></label>
|
1341 |
+
<br/>
|
1342 |
+
<input type="radio" name="expired-display-footer" id="expired-display-footer-false" value="0" <?php echo $expireddisplayfooterdisabled; ?>/> <label for="expired-display-footer-false"><?php _e( 'Disabled', 'post-expirator' ); ?></label>
|
1343 |
+
<br/>
|
1344 |
+
<?php _e( 'This will enable or disable displaying the post expiration date in the post footer.', 'post-expirator' ); ?>
|
1345 |
+
</td>
|
1346 |
+
</tr>
|
1347 |
+
<tr valign="top">
|
1348 |
+
<th scope="row"><label for="expired-footer-contents"><?php _e( 'Footer Contents:', 'post-expirator' ); ?></label></th>
|
1349 |
+
<td>
|
1350 |
+
<textarea id="expired-footer-contents" name="expired-footer-contents" rows="3" cols="50"><?php echo $expirationdateFooterContents; ?></textarea>
|
1351 |
+
<br/>
|
1352 |
+
<?php _e( 'Enter the text you would like to appear at the bottom of every post that will expire. The following placeholders will be replaced with the post expiration date in the following format:', 'post-expirator' ); ?>
|
1353 |
+
<ul>
|
1354 |
+
<li>EXPIRATIONFULL -> <?php echo date_i18n( "$expirationdateDefaultDateFormat $expirationdateDefaultTimeFormat" ); ?></li>
|
1355 |
+
<li>EXPIRATIONDATE -> <?php echo date_i18n( "$expirationdateDefaultDateFormat" ); ?></li>
|
1356 |
+
<li>EXPIRATIONTIME -> <?php echo date_i18n( "$expirationdateDefaultTimeFormat" ); ?></li>
|
1357 |
+
</ul>
|
1358 |
+
</td>
|
1359 |
+
</tr>
|
1360 |
+
<tr valign="top">
|
1361 |
+
<th scope="row"><label for="expired-footer-style"><?php _e( 'Footer Style:', 'post-expirator' ); ?></label></th>
|
1362 |
+
<td>
|
1363 |
+
<input type="text" name="expired-footer-style" id="expired-footer-style" value="<?php echo $expirationdateFooterStyle; ?>" size="25" />
|
1364 |
+
(<span style="<?php echo $expirationdateFooterStyle; ?>"><?php _e( 'This post will expire on', 'post-expirator' ); ?> <?php echo date_i18n( "$expirationdateDefaultDateFormat $expirationdateDefaultTimeFormat" ); ?></span>)
|
1365 |
+
<br/>
|
1366 |
+
<?php _e( 'The inline css which will be used to style the footer text.', 'post-expirator' ); ?>
|
1367 |
+
</td>
|
1368 |
+
</tr>
|
1369 |
+
</table>
|
1370 |
+
<p class="submit">
|
1371 |
+
<input type="submit" name="expirationdateSave" class="button-primary" value="<?php _e( 'Save Changes', 'post-expirator' ); ?>" />
|
1372 |
+
</p>
|
1373 |
+
</form>
|
1374 |
+
<?php
|
1375 |
+
// phpcs:enable
|
1376 |
+
}
|
1377 |
+
|
1378 |
+
/**
|
1379 |
+
* The default menu.
|
1380 |
+
*
|
1381 |
+
* @internal
|
1382 |
+
*
|
1383 |
+
* @access private
|
1384 |
+
*/
|
1385 |
+
function postexpirator_menu_defaults() {
|
1386 |
+
$debug = postexpirator_debug();
|
1387 |
+
$types = get_post_types( array('public' => true, '_builtin' => false) );
|
1388 |
+
array_unshift( $types, 'post', 'page' );
|
1389 |
+
|
1390 |
+
if ( isset( $_POST['expirationdateSaveDefaults'] ) ) {
|
1391 |
+
if ( ! isset( $_POST['_postExpiratorMenuDefaults_nonce'] ) || ! wp_verify_nonce( $_POST['_postExpiratorMenuDefaults_nonce'], 'postexpirator_menu_defaults' ) ) {
|
1392 |
+
print 'Form Validation Failure: Sorry, your nonce did not verify.';
|
1393 |
+
exit;
|
1394 |
+
} else {
|
1395 |
+
// Filter Content
|
1396 |
+
$_POST = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
|
1397 |
+
|
1398 |
+
$defaults = array();
|
1399 |
+
foreach ( $types as $type ) {
|
1400 |
+
if ( isset( $_POST[ 'expirationdate_expiretype-' . $type ] ) ) {
|
1401 |
+
$defaults[ $type ]['expireType'] = $_POST[ 'expirationdate_expiretype-' . $type ];
|
1402 |
+
}
|
1403 |
+
if ( isset( $_POST[ 'expirationdate_autoenable-' . $type ] ) ) {
|
1404 |
+
$defaults[ $type ]['autoEnable'] = intval( $_POST[ 'expirationdate_autoenable-' . $type ] );
|
1405 |
+
}
|
1406 |
+
if ( isset( $_POST[ 'expirationdate_taxonomy-' . $type ] ) ) {
|
1407 |
+
$defaults[ $type ]['taxonomy'] = $_POST[ 'expirationdate_taxonomy-' . $type ];
|
1408 |
+
}
|
1409 |
+
if ( isset( $_POST[ 'expirationdate_activemeta-' . $type ] ) ) {
|
1410 |
+
$defaults[ $type ]['activeMetaBox'] = $_POST[ 'expirationdate_activemeta-' . $type ];
|
1411 |
+
}
|
1412 |
+
$defaults[ $type ]['emailnotification'] = trim( $_POST[ 'expirationdate_emailnotification-' . $type ] );
|
1413 |
+
|
1414 |
+
// Save Settings
|
1415 |
+
update_option( 'expirationdateDefaults' . ucfirst( $type ), $defaults[ $type ] );
|
1416 |
+
}
|
1417 |
+
echo "<div id='message' class='updated fade'><p>";
|
1418 |
+
_e( 'Saved Options!', 'post-expirator' );
|
1419 |
+
echo '</p></div>';
|
1420 |
+
}
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
?>
|
1424 |
+
<form method="post">
|
1425 |
+
<?php wp_nonce_field( 'postexpirator_menu_defaults', '_postExpiratorMenuDefaults_nonce' ); ?>
|
1426 |
+
<h3><?php _e( 'Default Expiration Values', 'post-expirator' ); ?></h3>
|
1427 |
+
<p>
|
1428 |
+
<?php _e( 'Use the values below to set the default actions/values to be used for each for the corresponding post types. These values can all be overwritten when creating/editing the post/page.', 'post-expirator' ); ?>
|
1429 |
+
</p>
|
1430 |
+
<?php
|
1431 |
+
foreach ( $types as $type ) {
|
1432 |
+
echo "<fieldset style='border: 1px solid black; border-radius: 6px; padding: 0px 12px; margin-bottom: 20px;'>";
|
1433 |
+
echo "<legend>Post Type: $type</legend>";
|
1434 |
+
$defaults = get_option( 'expirationdateDefaults' . ucfirst( $type ) );
|
1435 |
+
|
1436 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
1437 |
+
if ( isset( $defaults['autoEnable'] ) && $defaults['autoEnable'] == 1 ) {
|
1438 |
+
$expiredautoenabled = 'checked = "checked"';
|
1439 |
+
$expiredautodisabled = '';
|
1440 |
+
} else {
|
1441 |
+
$expiredautoenabled = '';
|
1442 |
+
$expiredautodisabled = 'checked = "checked"';
|
1443 |
+
}
|
1444 |
+
if ( isset( $defaults['activeMetaBox'] ) && $defaults['activeMetaBox'] === 'inactive' ) {
|
1445 |
+
$expiredactivemetaenabled = '';
|
1446 |
+
$expiredactivemetadisabled = 'checked = "checked"';
|
1447 |
+
} else {
|
1448 |
+
$expiredactivemetaenabled = 'checked = "checked"';
|
1449 |
+
$expiredactivemetadisabled = '';
|
1450 |
+
}
|
1451 |
+
if ( ! isset( $defaults['taxonomy'] ) ) {
|
1452 |
+
$defaults['taxonomy'] = false;
|
1453 |
+
}
|
1454 |
+
if ( ! isset( $defaults['emailnotification'] ) ) {
|
1455 |
+
$defaults['emailnotification'] = '';
|
1456 |
+
}
|
1457 |
+
?>
|
1458 |
+
<table class="form-table">
|
1459 |
+
<tr valign="top">
|
1460 |
+
<th scope="row"><label for="expirationdate_activemeta-<?php echo $type; ?>"><?php _e( 'Active:', 'post-expirator' ); ?></label></th>
|
1461 |
+
<td>
|
1462 |
+
<input type="radio" name="expirationdate_activemeta-<?php echo $type; ?>" id="expirationdate_activemeta-true-<?php echo $type; ?>" value="active" <?php echo $expiredactivemetaenabled; ?>/> <label for="expired-active-meta-true"><?php _e( 'Active', 'post-expirator' ); ?></label>
|
1463 |
+
<br/>
|
1464 |
+
<input type="radio" name="expirationdate_activemeta-<?php echo $type; ?>" id="expirationdate_activemeta-false-<?php echo $type; ?>" value="inactive" <?php echo $expiredactivemetadisabled; ?>/> <label for="expired-active-meta-false"><?php _e( 'Inactive', 'post-expirator' ); ?></label>
|
1465 |
+
<br/>
|
1466 |
+
<?php _e( 'Select whether the post expirator meta box is active for this post type.', 'post-expirator' ); ?>
|
1467 |
+
</td>
|
1468 |
+
</tr>
|
1469 |
+
<tr valign="top">
|
1470 |
+
<th scope="row"><label for="expirationdate_expiretype-<?php echo $type; ?>"><?php _e( 'How to expire:', 'post-expirator' ); ?></label></th>
|
1471 |
+
<td>
|
1472 |
+
<?php echo _postexpirator_expire_type( array('name' => 'expirationdate_expiretype-' . $type, 'selected' => $defaults['expireType']) ); ?>
|
1473 |
+
</select>
|
1474 |
+
<br/>
|
1475 |
+
<?php _e( 'Select the default expire action for the post type.', 'post-expirator' ); ?>
|
1476 |
+
</td>
|
1477 |
+
</tr>
|
1478 |
+
<tr valign="top">
|
1479 |
+
<th scope="row"><label for="expirationdate_autoenable-<?php echo $type; ?>"><?php _e( 'Auto-Enable?', 'post-expirator' ); ?></label></th>
|
1480 |
+
<td>
|
1481 |
+
<input type="radio" name="expirationdate_autoenable-<?php echo $type; ?>" id="expirationdate_autoenable-true-<?php echo $type; ?>" value="1" <?php echo $expiredautoenabled; ?>/> <label for="expired-auto-enable-true"><?php _e( 'Enabled', 'post-expirator' ); ?></label>
|
1482 |
+
<br/>
|
1483 |
+
<input type="radio" name="expirationdate_autoenable-<?php echo $type; ?>" id="expirationdate_autoenable-false-<?php echo $type; ?>" value="0" <?php echo $expiredautodisabled; ?>/> <label for="expired-auto-enable-false"><?php _e( 'Disabled', 'post-expirator' ); ?></label>
|
1484 |
+
<br/>
|
1485 |
+
<?php _e( 'Select whether the post expirator is enabled for all new posts.', 'post-expirator' ); ?>
|
1486 |
+
</td>
|
1487 |
+
</tr>
|
1488 |
+
<tr valign="top">
|
1489 |
+
<th scope="row"><label for="expirationdate_taxonomy-<?php echo $type; ?>"><?php _e( 'Taxonomy (hierarchical):', 'post-expirator' ); ?></label></th>
|
1490 |
+
<td>
|
1491 |
+
<?php echo _postexpirator_taxonomy( array('type' => $type, 'name' => 'expirationdate_taxonomy-' . $type, 'selected' => $defaults['taxonomy']) ); ?>
|
1492 |
+
</td>
|
1493 |
+
</tr>
|
1494 |
+
<tr valign="top">
|
1495 |
+
<th scope="row"><label for="expirationdate_emailnotification-<?php echo $type; ?>"><?php _e( 'Who to notify:', 'post-expirator' ); ?></label></th>
|
1496 |
+
<td>
|
1497 |
+
<input class="large-text" type="text" name="expirationdate_emailnotification-<?php echo $type; ?>" id="expirationdate_emailnotification-<?php echo $type; ?>" value="<?php echo $defaults['emailnotification']; ?>" />
|
1498 |
+
<br/>
|
1499 |
+
<?php _e( 'Enter a comma seperate list of emails that you would like to be notified when the post expires.', 'post-expirator' ); ?>
|
1500 |
+
</td>
|
1501 |
+
</tr>
|
1502 |
+
|
1503 |
+
</table>
|
1504 |
+
</fieldset>
|
1505 |
+
<?php
|
1506 |
+
}
|
1507 |
+
?>
|
1508 |
+
<p class="submit">
|
1509 |
+
<input type="submit" name="expirationdateSaveDefaults" class="button-primary" value="<?php _e( 'Save Changes', 'post-expirator' ); ?>" />
|
1510 |
+
</p>
|
1511 |
+
</form>
|
1512 |
+
<?php
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
/**
|
1516 |
+
* Diagnostics menu.
|
1517 |
+
*
|
1518 |
+
* @internal
|
1519 |
+
*
|
1520 |
+
* @access private
|
1521 |
+
*/
|
1522 |
+
function postexpirator_menu_diagnostics() {
|
1523 |
+
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
|
1524 |
+
if ( ! isset( $_POST['_postExpiratorMenuDiagnostics_nonce'] ) || ! wp_verify_nonce( $_POST['_postExpiratorMenuDiagnostics_nonce'], 'postexpirator_menu_diagnostics' ) ) {
|
1525 |
+
print 'Form Validation Failure: Sorry, your nonce did not verify.';
|
1526 |
+
exit;
|
1527 |
+
}
|
1528 |
+
if ( isset( $_POST['debugging-disable'] ) ) {
|
1529 |
+
update_option( 'expirationdateDebug', 0 );
|
1530 |
+
echo "<div id='message' class='updated fade'><p>";
|
1531 |
+
_e( 'Debugging Disabled', 'post-expirator' );
|
1532 |
+
echo '</p></div>';
|
1533 |
+
} elseif ( isset( $_POST['debugging-enable'] ) ) {
|
1534 |
+
update_option( 'expirationdateDebug', 1 );
|
1535 |
+
echo "<div id='message' class='updated fade'><p>";
|
1536 |
+
_e( 'Debugging Enabled', 'post-expirator' );
|
1537 |
+
echo '</p></div>';
|
1538 |
+
} elseif ( isset( $_POST['purge-debug'] ) ) {
|
1539 |
+
require_once( plugin_dir_path( __FILE__ ) . 'post-expirator-debug.php' );
|
1540 |
+
$debug = new PostExpiratorDebug();
|
1541 |
+
$debug->purge();
|
1542 |
+
echo "<div id='message' class='updated fade'><p>";
|
1543 |
+
_e( 'Debugging Table Emptied', 'post-expirator' );
|
1544 |
+
echo '</p></div>';
|
1545 |
+
}
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
$debug = postexpirator_debug();
|
1549 |
+
?>
|
1550 |
+
<form method="post" id="postExpiratorMenuUpgrade">
|
1551 |
+
<?php wp_nonce_field( 'postexpirator_menu_diagnostics', '_postExpiratorMenuDiagnostics_nonce' ); ?>
|
1552 |
+
<h3><?php _e( 'Advanced Diagnostics', 'post-expirator' ); ?></h3>
|
1553 |
+
<table class="form-table">
|
1554 |
+
<tr valign="top">
|
1555 |
+
<th scope="row"><label for="postexpirator-log"><?php _e( 'Post Expirator Debug Logging:', 'post-expirator' ); ?></label></th>
|
1556 |
+
<td>
|
1557 |
+
<?php
|
1558 |
+
if ( POSTEXPIRATOR_DEBUG ) {
|
1559 |
+
echo __( 'Status: Enabled', 'post-expirator' ) . '<br/>';
|
1560 |
+
echo '<input type="submit" class="button" name="debugging-disable" id="debugging-disable" value="' . __( 'Disable Debugging', 'post-expirator' ) . '" />';
|
1561 |
+
} else {
|
1562 |
+
echo __( 'Status: Disabled', 'post-expirator' ) . '<br/>';
|
1563 |
+
echo '<input type="submit" class="button" name="debugging-enable" id="debugging-enable" value="' . __( 'Enable Debugging', 'post-expirator' ) . '" />';
|
1564 |
+
}
|
1565 |
+
?>
|
1566 |
+
<br/>
|
1567 |
+
<a href="<?php echo admin_url( 'options-general.php?page=post-expirator.php&tab=viewdebug' ); ?>">View Debug Logs</a>
|
1568 |
+
</td>
|
1569 |
+
</tr>
|
1570 |
+
<tr valign="top">
|
1571 |
+
<th scope="row"><?php _e( 'Purge Debug Log:', 'post-expirator' ); ?></th>
|
1572 |
+
<td>
|
1573 |
+
<input type="submit" class="button" name="purge-debug" id="purge-debug" value="<?php _e( 'Purge Debug Log', 'post-expirator' ); ?>" />
|
1574 |
+
</td>
|
1575 |
+
</tr/>
|
1576 |
+
<tr valign="top">
|
1577 |
+
<th scope="row"><?php _e( 'WP-Cron Status:', 'post-expirator' ); ?></th>
|
1578 |
+
<td>
|
1579 |
+
<?php
|
1580 |
+
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON === true ) {
|
1581 |
+
_e( 'DISABLED', 'post-expirator' );
|
1582 |
+
} else {
|
1583 |
+
_e( 'ENABLED - OK', 'post-expirator' );
|
1584 |
+
}
|
1585 |
+
?>
|
1586 |
+
</td>
|
1587 |
+
</tr/>
|
1588 |
+
<tr valign="top">
|
1589 |
+
<th scope="row"><label for="cron-schedule"><?php _e( 'Current Cron Schedule:', 'post-expirator' ); ?></label></th>
|
1590 |
+
<td>
|
1591 |
+
<?php _e( 'The below table will show all currently scheduled cron events with the next run time.', 'post-expirator' ); ?><br/>
|
1592 |
+
<table>
|
1593 |
+
<tr>
|
1594 |
+
<th style="width: 200px;"><?php _e( 'Date', 'post-expirator' ); ?></th>
|
1595 |
+
<th style="width: 200px;"><?php _e( 'Event', 'post-expirator' ); ?></th>
|
1596 |
+
<th style="width: 500px;"><?php _e( 'Arguments / Schedule', 'post-expirator' ); ?></th>
|
1597 |
+
</tr>
|
1598 |
+
<?php
|
1599 |
+
$cron = _get_cron_array();
|
1600 |
+
foreach ( $cron as $key => $value ) {
|
1601 |
+
foreach ( $value as $eventkey => $eventvalue ) {
|
1602 |
+
print '<tr>';
|
1603 |
+
print '<td>' . date_i18n( 'r', $key ) . '</td>';
|
1604 |
+
print '<td>' . $eventkey . '</td>';
|
1605 |
+
$arrkey = array_keys( $eventvalue );
|
1606 |
+
print '<td>';
|
1607 |
+
foreach ( $arrkey as $eventguid ) {
|
1608 |
+
print '<table><tr>';
|
1609 |
+
if ( empty( $eventvalue[ $eventguid ]['args'] ) ) {
|
1610 |
+
print '<td>No Arguments</td>';
|
1611 |
+
} else {
|
1612 |
+
print '<td>';
|
1613 |
+
$args = array();
|
1614 |
+
foreach ( $eventvalue[ $eventguid ]['args'] as $key => $value ) {
|
1615 |
+
$args[] = "$key => $value";
|
1616 |
+
}
|
1617 |
+
print implode( "<br/>\n", $args );
|
1618 |
+
print '</td>';
|
1619 |
+
}
|
1620 |
+
if ( empty( $eventvalue[ $eventguid ]['schedule'] ) ) {
|
1621 |
+
print '<td>' . __( 'Single Event', 'post-expirator' ) . '</td>';
|
1622 |
+
} else {
|
1623 |
+
print '<td>' . $eventvalue[ $eventguid ]['schedule'] . ' (' . $eventvalue[ $eventguid ]['interval'] . ')</td>';
|
1624 |
+
}
|
1625 |
+
print '</tr></table>';
|
1626 |
+
}
|
1627 |
+
print '</td>';
|
1628 |
+
print '</tr>';
|
1629 |
+
}
|
1630 |
+
}
|
1631 |
+
?>
|
1632 |
+
</table>
|
1633 |
+
</td>
|
1634 |
+
</tr>
|
1635 |
+
</table>
|
1636 |
+
</form>
|
1637 |
+
<?php
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
/**
|
1641 |
+
* Debug menu.
|
1642 |
+
*
|
1643 |
+
* @internal
|
1644 |
+
*
|
1645 |
+
* @access private
|
1646 |
+
*/
|
1647 |
+
function postexpirator_menu_debug() {
|
1648 |
+
require_once( plugin_dir_path( __FILE__ ) . 'post-expirator-debug.php' );
|
1649 |
+
print '<p>' . __( 'Below is a dump of the debugging table, this should be useful for troubleshooting.', 'post-expirator' ) . '</p>';
|
1650 |
+
$debug = new PostExpiratorDebug();
|
1651 |
+
$debug->getTable();
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
/**
|
1655 |
+
* Register the shortcode.
|
1656 |
+
*
|
1657 |
+
* @internal
|
1658 |
+
*
|
1659 |
+
* @access private
|
1660 |
+
*/
|
1661 |
+
function postexpirator_shortcode( $atts ) {
|
1662 |
+
global $post;
|
1663 |
+
|
1664 |
+
$expirationdatets = get_post_meta( $post->ID, '_expiration-date', true );
|
1665 |
+
if ( empty( $expirationdatets ) ) {
|
1666 |
+
return false;
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
// @TODO remove extract
|
1670 |
+
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
1671 |
+
extract(
|
1672 |
+
shortcode_atts(
|
1673 |
+
array(
|
1674 |
+
'dateformat' => get_option( 'expirationdateDefaultDateFormat', POSTEXPIRATOR_DATEFORMAT ),
|
1675 |
+
'timeformat' => get_option( 'expirationdateDefaultTimeFormat', POSTEXPIRATOR_TIMEFORMAT ),
|
1676 |
+
'type' => 'full',
|
1677 |
+
'tz' => date( 'T' ),
|
1678 |
+
), $atts
|
1679 |
+
)
|
1680 |
+
);
|
1681 |
+
|
1682 |
+
if ( empty( $dateformat ) ) {
|
1683 |
+
global $expirationdateDefaultDateFormat;
|
1684 |
+
$dateformat = $expirationdateDefaultDateFormat;
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
if ( empty( $timeformat ) ) {
|
1688 |
+
global $expirationdateDefaultTimeFormat;
|
1689 |
+
$timeformat = $expirationdateDefaultTimeFormat;
|
1690 |
+
}
|
1691 |
+
|
1692 |
+
if ( $type === 'full' ) {
|
1693 |
+
$format = $dateformat . ' ' . $timeformat;
|
1694 |
+
} elseif ( $type === 'date' ) {
|
1695 |
+
$format = $dateformat;
|
1696 |
+
} elseif ( $type === 'time' ) {
|
1697 |
+
$format = $timeformat;
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
return date_i18n( $format, $expirationdatets + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
|
1701 |
+
}
|
1702 |
+
add_shortcode( 'postexpirator', 'postexpirator_shortcode' );
|
1703 |
+
|
1704 |
+
/**
|
1705 |
+
* Add the footer.
|
1706 |
+
*
|
1707 |
+
* @internal
|
1708 |
+
*
|
1709 |
+
* @access private
|
1710 |
+
*/
|
1711 |
+
function postexpirator_add_footer( $text ) {
|
1712 |
+
global $post;
|
1713 |
+
|
1714 |
+
// Check to see if its enabled
|
1715 |
+
$displayFooter = get_option( 'expirationdateDisplayFooter' );
|
1716 |
+
|
1717 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
1718 |
+
if ( $displayFooter === false || $displayFooter == 0 ) {
|
1719 |
+
return $text;
|
1720 |
+
}
|
1721 |
+
|
1722 |
+
$expirationdatets = get_post_meta( $post->ID, '_expiration-date', true );
|
1723 |
+
if ( ! is_numeric( $expirationdatets ) ) {
|
1724 |
+
return $text;
|
1725 |
+
}
|
1726 |
+
|
1727 |
+
$dateformat = get_option( 'expirationdateDefaultDateFormat', POSTEXPIRATOR_DATEFORMAT );
|
1728 |
+
$timeformat = get_option( 'expirationdateDefaultTimeFormat', POSTEXPIRATOR_TIMEFORMAT );
|
1729 |
+
$expirationdateFooterContents = get_option( 'expirationdateFooterContents', POSTEXPIRATOR_FOOTERCONTENTS );
|
1730 |
+
$expirationdateFooterStyle = get_option( 'expirationdateFooterStyle', POSTEXPIRATOR_FOOTERSTYLE );
|
1731 |
+
|
1732 |
+
$search = array(
|
1733 |
+
'EXPIRATIONFULL',
|
1734 |
+
'EXPIRATIONDATE',
|
1735 |
+
'EXPIRATIONTIME',
|
1736 |
+
);
|
1737 |
+
$replace = array(
|
1738 |
+
get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), "$dateformat $timeformat" ),
|
1739 |
+
get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), $dateformat ),
|
1740 |
+
get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $expirationdatets ), $timeformat ),
|
1741 |
+
);
|
1742 |
+
|
1743 |
+
$add_to_footer = '<p style="' . $expirationdateFooterStyle . '">' . str_replace( $search, $replace, $expirationdateFooterContents ) . '</p>';
|
1744 |
+
return $text . $add_to_footer;
|
1745 |
+
}
|
1746 |
+
add_action( 'the_content', 'postexpirator_add_footer', 0 );
|
1747 |
+
|
1748 |
+
/**
|
1749 |
+
* Check for Debug
|
1750 |
+
*
|
1751 |
+
* @internal
|
1752 |
+
*
|
1753 |
+
* @access private
|
1754 |
+
*/
|
1755 |
+
function postexpirator_debug() {
|
1756 |
+
$debug = get_option( 'expirationdateDebug' );
|
1757 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
1758 |
+
if ( $debug == 1 ) {
|
1759 |
+
if ( ! defined( 'POSTEXPIRATOR_DEBUG' ) ) {
|
1760 |
+
define( 'POSTEXPIRATOR_DEBUG', 1 );
|
1761 |
+
}
|
1762 |
+
require_once( plugin_dir_path( __FILE__ ) . 'post-expirator-debug.php' ); // Load Class
|
1763 |
+
return new PostExpiratorDebug();
|
1764 |
+
} else {
|
1765 |
+
if ( ! defined( 'POSTEXPIRATOR_DEBUG' ) ) {
|
1766 |
+
define( 'POSTEXPIRATOR_DEBUG', 0 );
|
1767 |
+
}
|
1768 |
+
return false;
|
1769 |
+
}
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
|
1773 |
+
/**
|
1774 |
+
* Add Stylesheet
|
1775 |
+
*
|
1776 |
+
* @internal
|
1777 |
+
*
|
1778 |
+
* @access private
|
1779 |
+
*/
|
1780 |
+
function postexpirator_css( $screen_id ) {
|
1781 |
+
switch ( $screen_id ) {
|
1782 |
+
case 'post.php':
|
1783 |
+
case 'post-new.php':
|
1784 |
+
case 'settings_page_post-expirator':
|
1785 |
+
wp_enqueue_style( 'postexpirator-css', POSTEXPIRATOR_BASEURL . '/assets/css/style.css', array(), POSTEXPIRATOR_VERSION );
|
1786 |
+
break;
|
1787 |
+
case 'edit.php':
|
1788 |
+
wp_enqueue_style( 'postexpirator-edit', POSTEXPIRATOR_BASEURL . '/assets/css/edit.css', array(), POSTEXPIRATOR_VERSION );
|
1789 |
+
break;
|
1790 |
+
}
|
1791 |
+
}
|
1792 |
+
add_action( 'admin_enqueue_scripts', 'postexpirator_css', 10, 1 );
|
1793 |
+
|
1794 |
+
/**
|
1795 |
+
* Post Expirator Activation/Upgrade
|
1796 |
+
*
|
1797 |
+
* @internal
|
1798 |
+
*
|
1799 |
+
* @access private
|
1800 |
+
*/
|
1801 |
+
function postexpirator_upgrade() {
|
1802 |
+
|
1803 |
+
// Check for current version, if not exists, run activation
|
1804 |
+
$version = get_option( 'postexpiratorVersion' );
|
1805 |
+
if ( $version === false ) { // not installed, run default activation
|
1806 |
+
postexpirator_activate();
|
1807 |
+
update_option( 'postexpiratorVersion', POSTEXPIRATOR_VERSION );
|
1808 |
+
} else {
|
1809 |
+
if ( version_compare( $version, '1.6.1' ) === -1 ) {
|
1810 |
+
update_option( 'postexpiratorVersion', POSTEXPIRATOR_VERSION );
|
1811 |
+
update_option( 'expirationdateDefaultDate', POSTEXPIRATOR_EXPIREDEFAULT );
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
if ( version_compare( $version, '1.6.2' ) === -1 ) {
|
1815 |
+
update_option( 'postexpiratorVersion', POSTEXPIRATOR_VERSION );
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
if ( version_compare( $version, '2.0.0-rc1' ) === -1 ) {
|
1819 |
+
global $wpdb;
|
1820 |
+
|
1821 |
+
// Schedule Events/Migrate Config
|
1822 |
+
$results = $wpdb->get_results( $wpdb->prepare( 'select post_id, meta_value from ' . $wpdb->postmeta . ' as postmeta, ' . $wpdb->posts . ' as posts where postmeta.post_id = posts.ID AND postmeta.meta_key = %s AND postmeta.meta_value >= %d', 'expiration-date', time() ) );
|
1823 |
+
foreach ( $results as $result ) {
|
1824 |
+
wp_schedule_single_event( $result->meta_value, 'postExpiratorExpire', array($result->post_id) );
|
1825 |
+
$opts = array();
|
1826 |
+
$opts['id'] = $result->post_id;
|
1827 |
+
$posttype = get_post_type( $result->post_id );
|
1828 |
+
if ( $posttype === 'page' ) {
|
1829 |
+
$opts['expireType'] = strtolower( get_option( 'expirationdateExpiredPageStatus', 'Draft' ) );
|
1830 |
+
} else {
|
1831 |
+
$opts['expireType'] = strtolower( get_option( 'expirationdateExpiredPostStatus', 'Draft' ) );
|
1832 |
+
}
|
1833 |
+
|
1834 |
+
$cat = get_post_meta( $result->post_id, '_expiration-date-category', true );
|
1835 |
+
if ( ( isset( $cat ) && ! empty( $cat ) ) ) {
|
1836 |
+
$opts['category'] = $cat;
|
1837 |
+
$opts['expireType'] = 'category';
|
1838 |
+
}
|
1839 |
+
update_post_meta( $result->post_id, '_expiration-date-options', $opts );
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
// update meta key to new format
|
1843 |
+
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_key = %s WHERE meta_key = %s", '_expiration-date', 'expiration-date' ) );
|
1844 |
+
|
1845 |
+
// migrate defaults
|
1846 |
+
$pagedefault = get_option( 'expirationdateExpiredPageStatus' );
|
1847 |
+
$postdefault = get_option( 'expirationdateExpiredPostStatus' );
|
1848 |
+
if ( $pagedefault ) {
|
1849 |
+
update_option( 'expirationdateDefaultsPage', array('expireType' => $pagedefault) );
|
1850 |
+
}
|
1851 |
+
if ( $postdefault ) {
|
1852 |
+
update_option( 'expirationdateDefaultsPost', array('expireType' => $postdefault) );
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
delete_option( 'expirationdateCronSchedule' );
|
1856 |
+
delete_option( 'expirationdateAutoEnabled' );
|
1857 |
+
delete_option( 'expirationdateExpiredPageStatus' );
|
1858 |
+
delete_option( 'expirationdateExpiredPostStatus' );
|
1859 |
+
update_option( 'postexpiratorVersion', POSTEXPIRATOR_VERSION );
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
if ( version_compare( $version, '2.0.1' ) === -1 ) {
|
1863 |
+
// Forgot to do this in 2.0.0
|
1864 |
+
if ( is_multisite() ) {
|
1865 |
+
global $current_blog;
|
1866 |
+
wp_clear_scheduled_hook( 'expirationdate_delete_' . $current_blog->blog_id );
|
1867 |
+
} else {
|
1868 |
+
wp_clear_scheduled_hook( 'expirationdate_delete' );
|
1869 |
+
}
|
1870 |
+
|
1871 |
+
update_option( 'postexpiratorVersion', POSTEXPIRATOR_VERSION );
|
1872 |
+
}
|
1873 |
+
|
1874 |
+
update_option( 'postexpiratorVersion', POSTEXPIRATOR_VERSION );
|
1875 |
+
|
1876 |
+
}
|
1877 |
+
}
|
1878 |
+
add_action( 'admin_init', 'postexpirator_upgrade' );
|
1879 |
+
|
1880 |
+
/**
|
1881 |
+
* Called at plugin activation
|
1882 |
+
*
|
1883 |
+
* @internal
|
1884 |
+
*
|
1885 |
+
* @access private
|
1886 |
+
*/
|
1887 |
+
function postexpirator_activate() {
|
1888 |
+
if ( get_option( 'expirationdateDefaultDateFormat' ) === false ) {
|
1889 |
+
update_option( 'expirationdateDefaultDateFormat', POSTEXPIRATOR_DATEFORMAT );
|
1890 |
+
}
|
1891 |
+
if ( get_option( 'expirationdateDefaultTimeFormat' ) === false ) {
|
1892 |
+
update_option( 'expirationdateDefaultTimeFormat', POSTEXPIRATOR_TIMEFORMAT );
|
1893 |
+
}
|
1894 |
+
if ( get_option( 'expirationdateFooterContents' ) === false ) {
|
1895 |
+
update_option( 'expirationdateFooterContents', POSTEXPIRATOR_FOOTERCONTENTS );
|
1896 |
+
}
|
1897 |
+
if ( get_option( 'expirationdateFooterStyle' ) === false ) {
|
1898 |
+
update_option( 'expirationdateFooterStyle', POSTEXPIRATOR_FOOTERSTYLE );
|
1899 |
+
}
|
1900 |
+
if ( get_option( 'expirationdateDisplayFooter' ) === false ) {
|
1901 |
+
update_option( 'expirationdateDisplayFooter', POSTEXPIRATOR_FOOTERDISPLAY );
|
1902 |
+
}
|
1903 |
+
if ( get_option( 'expirationdateDebug' ) === false ) {
|
1904 |
+
update_option( 'expirationdateDebug', POSTEXPIRATOR_DEBUGDEFAULT );
|
1905 |
+
}
|
1906 |
+
if ( get_option( 'expirationdateDefaultDate' ) === false ) {
|
1907 |
+
update_option( 'expirationdateDefaultDate', POSTEXPIRATOR_EXPIREDEFAULT );
|
1908 |
+
}
|
1909 |
+
}
|
1910 |
+
|
1911 |
+
/**
|
1912 |
+
* Called at plugin deactivation
|
1913 |
+
*
|
1914 |
+
* @internal
|
1915 |
+
*
|
1916 |
+
* @access private
|
1917 |
+
*/
|
1918 |
+
function expirationdate_deactivate() {
|
1919 |
+
global $current_blog;
|
1920 |
+
delete_option( 'expirationdateExpiredPostStatus' );
|
1921 |
+
delete_option( 'expirationdateExpiredPageStatus' );
|
1922 |
+
delete_option( 'expirationdateDefaultDateFormat' );
|
1923 |
+
delete_option( 'expirationdateDefaultTimeFormat' );
|
1924 |
+
delete_option( 'expirationdateDisplayFooter' );
|
1925 |
+
delete_option( 'expirationdateFooterContents' );
|
1926 |
+
delete_option( 'expirationdateFooterStyle' );
|
1927 |
+
delete_option( 'expirationdateCategory' );
|
1928 |
+
delete_option( 'expirationdateCategoryDefaults' );
|
1929 |
+
delete_option( 'expirationdateDebug' );
|
1930 |
+
delete_option( 'postexpiratorVersion' );
|
1931 |
+
delete_option( 'expirationdateCronSchedule' );
|
1932 |
+
delete_option( 'expirationdateDefaultDate' );
|
1933 |
+
delete_option( 'expirationdateDefaultDateCustom' );
|
1934 |
+
delete_option( 'expirationdateAutoEnabled' );
|
1935 |
+
delete_option( 'expirationdateDefaultsPage' );
|
1936 |
+
delete_option( 'expirationdateDefaultsPost' );
|
1937 |
+
// what about custom post types? - how to cleanup?
|
1938 |
+
if ( is_multisite() ) {
|
1939 |
+
wp_clear_scheduled_hook( 'expirationdate_delete_' . $current_blog->blog_id );
|
1940 |
+
} else {
|
1941 |
+
wp_clear_scheduled_hook( 'expirationdate_delete' );
|
1942 |
+
}
|
1943 |
+
require_once( plugin_dir_path( __FILE__ ) . 'post-expirator-debug.php' );
|
1944 |
+
$debug = new PostExpiratorDebug();
|
1945 |
+
$debug->removeDbTable();
|
1946 |
+
}
|
1947 |
+
register_deactivation_hook( __FILE__, 'expirationdate_deactivate' );
|
1948 |
+
|
1949 |
+
/**
|
1950 |
+
* The walker class for category checklist.
|
1951 |
+
*
|
1952 |
+
* @internal
|
1953 |
+
*
|
1954 |
+
* @access private
|
1955 |
+
*/
|
1956 |
+
class Walker_PostExpirator_Category_Checklist extends Walker {
|
1957 |
+
|
1958 |
+
/**
|
1959 |
+
* What the class handles.
|
1960 |
+
*
|
1961 |
+
* @var string
|
1962 |
+
*/
|
1963 |
+
var $tree_type = 'category';
|
1964 |
+
|
1965 |
+
/**
|
1966 |
+
* DB fields to use.
|
1967 |
+
*
|
1968 |
+
* @var array
|
1969 |
+
*/
|
1970 |
+
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); // TODO: decouple this
|
1971 |
+
|
1972 |
+
/**
|
1973 |
+
* The disabled attribute.
|
1974 |
+
*
|
1975 |
+
* @var string
|
1976 |
+
*/
|
1977 |
+
var $disabled = '';
|
1978 |
+
|
1979 |
+
/**
|
1980 |
+
* Set the disabled attribute.
|
1981 |
+
*/
|
1982 |
+
function setDisabled() {
|
1983 |
+
$this->disabled = 'disabled="disabled"';
|
1984 |
+
}
|
1985 |
+
|
1986 |
+
/**
|
1987 |
+
* Starts the list before the elements are added.
|
1988 |
+
*
|
1989 |
+
* The $args parameter holds additional values that may be used with the child
|
1990 |
+
* class methods. This method is called at the start of the output list.
|
1991 |
+
*
|
1992 |
+
* @param string $output Used to append additional content (passed by reference).
|
1993 |
+
* @param int $depth Depth of the item.
|
1994 |
+
* @param array $args An array of additional arguments.
|
1995 |
+
*/
|
1996 |
+
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
1997 |
+
$indent = str_repeat( "\t", $depth );
|
1998 |
+
$output .= "$indent<ul class='children'>\n";
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
/**
|
2002 |
+
* Ends the list of after the elements are added.
|
2003 |
+
*
|
2004 |
+
* The $args parameter holds additional values that may be used with the child
|
2005 |
+
* class methods. This method finishes the list at the end of output of the elements.
|
2006 |
+
*
|
2007 |
+
* @param string $output Used to append additional content (passed by reference).
|
2008 |
+
* @param int $depth Depth of the item.
|
2009 |
+
* @param array $args An array of additional arguments.
|
2010 |
+
*/
|
2011 |
+
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
2012 |
+
$indent = str_repeat( "\t", $depth );
|
2013 |
+
$output .= "$indent</ul>\n";
|
2014 |
+
}
|
2015 |
+
|
2016 |
+
/**
|
2017 |
+
* Start the element output.
|
2018 |
+
*
|
2019 |
+
* The $args parameter holds additional values that may be used with the child
|
2020 |
+
* class methods. Includes the element output also.
|
2021 |
+
*
|
2022 |
+
* @param string $output Used to append additional content (passed by reference).
|
2023 |
+
* @param object $category The data object.
|
2024 |
+
* @param int $depth Depth of the item.
|
2025 |
+
* @param array $args An array of additional arguments.
|
2026 |
+
* @param int $current_object_id ID of the current item.
|
2027 |
+
*/
|
2028 |
+
function start_el( &$output, $category, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
2029 |
+
// @TODO remove extract
|
2030 |
+
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
2031 |
+
extract( $args );
|
2032 |
+
if ( empty( $taxonomy ) ) {
|
2033 |
+
$taxonomy = 'category';
|
2034 |
+
}
|
2035 |
+
|
2036 |
+
$name = 'expirationdate_category';
|
2037 |
+
|
2038 |
+
$class = in_array( $category->term_id, $popular_cats, true ) ? ' class="expirator-category"' : '';
|
2039 |
+
$output .= "\n<li id='expirator-{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="expirator-in-' . $taxonomy . '-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats, true ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' ' . $this->disabled . '/> ' . esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
/**
|
2043 |
+
* Ends the element output, if needed.
|
2044 |
+
*
|
2045 |
+
* The $args parameter holds additional values that may be used with the child class methods.
|
2046 |
+
*
|
2047 |
+
* @param string $output Used to append additional content (passed by reference).
|
2048 |
+
* @param object $category The data object.
|
2049 |
+
* @param int $depth Depth of the item.
|
2050 |
+
* @param array $args An array of additional arguments.
|
2051 |
+
*/
|
2052 |
+
function end_el( &$output, $category, $depth = 0, $args = array() ) {
|
2053 |
+
$output .= "</li>\n";
|
2054 |
+
}
|
2055 |
+
}
|
2056 |
+
|
2057 |
+
/**
|
2058 |
+
* Get the HTML for expire type.
|
2059 |
+
*
|
2060 |
+
* @internal
|
2061 |
+
*
|
2062 |
+
* @access private
|
2063 |
+
*/
|
2064 |
+
function _postexpirator_expire_type( $opts ) {
|
2065 |
+
if ( empty( $opts ) ) {
|
2066 |
+
return false;
|
2067 |
+
}
|
2068 |
+
|
2069 |
+
// @TODO remove extract
|
2070 |
+
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
2071 |
+
extract( $opts );
|
2072 |
+
|
2073 |
+
if ( ! isset( $name ) ) {
|
2074 |
+
return false;
|
2075 |
+
}
|
2076 |
+
if ( ! isset( $id ) ) {
|
2077 |
+
$id = $name;
|
2078 |
+
}
|
2079 |
+
if ( ! isset( $disabled ) ) {
|
2080 |
+
$disabled = false;
|
2081 |
+
}
|
2082 |
+
if ( ! isset( $onchange ) ) {
|
2083 |
+
$onchange = '';
|
2084 |
+
}
|
2085 |
+
if ( ! isset( $type ) ) {
|
2086 |
+
$type = '';
|
2087 |
+
}
|
2088 |
+
|
2089 |
+
$rv = array();
|
2090 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
2091 |
+
$rv[] = '<select name="' . $name . '" id="' . $id . '"' . ( $disabled == true ? ' disabled="disabled"' : '' ) . ' onchange="' . $onchange . '">';
|
2092 |
+
$rv[] = '<option value="draft" ' . ( $selected === 'draft' ? 'selected="selected"' : '' ) . '>' . __( 'Draft', 'post-expirator' ) . '</option>';
|
2093 |
+
$rv[] = '<option value="delete" ' . ( $selected === 'delete' ? 'selected="selected"' : '' ) . '>' . __( 'Delete', 'post-expirator' ) . '</option>';
|
2094 |
+
$rv[] = '<option value="trash" ' . ( $selected === 'trash' ? 'selected="selected"' : '' ) . '>' . __( 'Trash', 'post-expirator' ) . '</option>';
|
2095 |
+
$rv[] = '<option value="private" ' . ( $selected === 'private' ? 'selected="selected"' : '' ) . '>' . __( 'Private', 'post-expirator' ) . '</option>';
|
2096 |
+
$rv[] = '<option value="stick" ' . ( $selected === 'stick' ? 'selected="selected"' : '' ) . '>' . __( 'Stick', 'post-expirator' ) . '</option>';
|
2097 |
+
$rv[] = '<option value="unstick" ' . ( $selected === 'unstick' ? 'selected="selected"' : '' ) . '>' . __( 'Unstick', 'post-expirator' ) . '</option>';
|
2098 |
+
if ( $type !== 'page' ) {
|
2099 |
+
$rv[] = '<option value="category" ' . ( $selected === 'category' ? 'selected="selected"' : '' ) . '>' . __( 'Category: Replace', 'post-expirator' ) . '</option>';
|
2100 |
+
$rv[] = '<option value="category-add" ' . ( $selected === 'category-add' ? 'selected="selected"' : '' ) . '>' . __( 'Category: Add', 'post-expirator' ) . '</option>';
|
2101 |
+
$rv[] = '<option value="category-remove" ' . ( $selected === 'category-remove' ? 'selected="selected"' : '' ) . '>' . __( 'Category: Remove', 'post-expirator' ) . '</option>';
|
2102 |
+
}
|
2103 |
+
$rv[] = '</select>';
|
2104 |
+
return implode( "<br/>\n", $rv );
|
2105 |
+
}
|
2106 |
+
|
2107 |
+
/**
|
2108 |
+
* Get the HTML for taxonomy.
|
2109 |
+
*
|
2110 |
+
* @internal
|
2111 |
+
*
|
2112 |
+
* @access private
|
2113 |
+
*/
|
2114 |
+
function _postexpirator_taxonomy( $opts ) {
|
2115 |
+
if ( empty( $opts ) ) {
|
2116 |
+
return false;
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
// @TODO remove extract
|
2120 |
+
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
2121 |
+
extract( $opts );
|
2122 |
+
if ( ! isset( $name ) ) {
|
2123 |
+
return false;
|
2124 |
+
}
|
2125 |
+
if ( ! isset( $id ) ) {
|
2126 |
+
$id = $name;
|
2127 |
+
}
|
2128 |
+
if ( ! isset( $disabled ) ) {
|
2129 |
+
$disabled = false;
|
2130 |
+
}
|
2131 |
+
if ( ! isset( $onchange ) ) {
|
2132 |
+
$onchange = '';
|
2133 |
+
}
|
2134 |
+
if ( ! isset( $type ) ) {
|
2135 |
+
$type = '';
|
2136 |
+
}
|
2137 |
+
|
2138 |
+
$taxonomies = get_object_taxonomies( $type, 'object' );
|
2139 |
+
$taxonomies = wp_filter_object_list( $taxonomies, array('hierarchical' => true) );
|
2140 |
+
|
2141 |
+
if ( empty( $taxonomies ) ) {
|
2142 |
+
$disabled = true;
|
2143 |
+
}
|
2144 |
+
|
2145 |
+
$rv = array();
|
2146 |
+
if ( $taxonomies ) {
|
2147 |
+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
|
2148 |
+
$rv[] = '<select name="' . $name . '" id="' . $id . '"' . ( $disabled == true ? ' disabled="disabled"' : '' ) . ' onchange="' . $onchange . '">';
|
2149 |
+
foreach ( $taxonomies as $taxonomy ) {
|
2150 |
+
$rv[] = '<option value="' . $taxonomy->name . '" ' . ( $selected === $taxonomy->name ? 'selected="selected"' : '' ) . '>' . $taxonomy->name . '</option>';
|
2151 |
+
}
|
2152 |
+
|
2153 |
+
$rv[] = '</select>';
|
2154 |
+
$rv[] = __( 'Select the hierarchical taxonomy to be used for "category" based expiration.', 'post-expirator' );
|
2155 |
+
} else {
|
2156 |
+
$rv[] = 'No taxonomies found for post type.';
|
2157 |
+
}
|
2158 |
+
return implode( "<br/>\n", $rv );
|
2159 |
+
}
|
2160 |
+
|
2161 |
+
/**
|
2162 |
+
* Include the JS.
|
2163 |
+
*
|
2164 |
+
* @internal
|
2165 |
+
*
|
2166 |
+
* @access private
|
2167 |
+
*/
|
2168 |
+
function postexpirator_quickedit_javascript() {
|
2169 |
+
// if using code as plugin
|
2170 |
+
wp_enqueue_script( 'postexpirator-edit', POSTEXPIRATOR_BASEURL . '/admin-edit.js', array( 'jquery', 'inline-edit-post' ), POSTEXPIRATOR_VERSION, true );
|
2171 |
+
wp_localize_script(
|
2172 |
+
'postexpirator-edit', 'config', array(
|
2173 |
+
'ajax' => array(
|
2174 |
+
'nonce' => wp_create_nonce( POSTEXPIRATOR_SLUG ),
|
2175 |
+
'bulk_edit' => 'manage_wp_posts_using_bulk_quick_save_bulk_edit',
|
2176 |
+
),
|
2177 |
+
)
|
2178 |
+
);
|
2179 |
+
}
|
2180 |
+
add_action( 'admin_print_scripts-edit.php', 'postexpirator_quickedit_javascript' );
|
2181 |
+
|
2182 |
+
/**
|
2183 |
+
* Receives AJAX call from bulk edit to process save.
|
2184 |
+
*
|
2185 |
+
* @internal
|
2186 |
+
*
|
2187 |
+
* @access private
|
2188 |
+
*/
|
2189 |
+
function postexpirator_date_save_bulk_edit() {
|
2190 |
+
check_ajax_referer( POSTEXPIRATOR_SLUG, 'nonce' );
|
2191 |
+
|
2192 |
+
// we need the post IDs
|
2193 |
+
$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : null;
|
2194 |
+
|
2195 |
+
// if we have post IDs
|
2196 |
+
if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
|
2197 |
+
|
2198 |
+
$status = $_POST['expirationdate_status'];
|
2199 |
+
|
2200 |
+
// if no change, do nothing
|
2201 |
+
if ( $status === 'no-change' ) {
|
2202 |
+
return;
|
2203 |
+
}
|
2204 |
+
|
2205 |
+
$month = intval( $_POST['expirationdate_month'] );
|
2206 |
+
$day = intval( $_POST['expirationdate_day'] );
|
2207 |
+
$year = intval( $_POST['expirationdate_year'] );
|
2208 |
+
$hour = intval( $_POST['expirationdate_hour'] );
|
2209 |
+
$minute = intval( $_POST['expirationdate_minute'] );
|
2210 |
+
|
2211 |
+
// default to current date and/or year if not provided by user.
|
2212 |
+
if ( empty( $day ) ) {
|
2213 |
+
$day = date( 'd' );
|
2214 |
+
}
|
2215 |
+
if ( empty( $year ) ) {
|
2216 |
+
$year = date( 'Y' );
|
2217 |
+
}
|
2218 |
+
|
2219 |
+
$ts = get_gmt_from_date( "$year-$month-$day $hour:$minute:0", 'U' );
|
2220 |
+
|
2221 |
+
if ( ! $ts ) {
|
2222 |
+
return;
|
2223 |
+
}
|
2224 |
+
|
2225 |
+
foreach ( $post_ids as $post_id ) {
|
2226 |
+
$ed = get_post_meta( $post_id, '_expiration-date', true );
|
2227 |
+
$update_expiry = false;
|
2228 |
+
|
2229 |
+
switch ( $status ) {
|
2230 |
+
case 'change-only':
|
2231 |
+
$update_expiry = ! empty( $ed );
|
2232 |
+
break;
|
2233 |
+
case 'add-only':
|
2234 |
+
$update_expiry = empty( $ed );
|
2235 |
+
break;
|
2236 |
+
case 'change-add':
|
2237 |
+
$update_expiry = true;
|
2238 |
+
break;
|
2239 |
+
case 'remove-only':
|
2240 |
+
delete_post_meta( $post_id, '_expiration-date' );
|
2241 |
+
postexpirator_unschedule_event( $post_id );
|
2242 |
+
break;
|
2243 |
+
}
|
2244 |
+
|
2245 |
+
if ( $update_expiry ) {
|
2246 |
+
update_post_meta( $post_id, '_expiration-date', $ts );
|
2247 |
+
postexpirator_schedule_event( $post_id, $ts, null );
|
2248 |
+
}
|
2249 |
+
}
|
2250 |
+
}
|
2251 |
+
}
|
2252 |
+
add_action( 'wp_ajax_manage_wp_posts_using_bulk_quick_save_bulk_edit', 'postexpirator_date_save_bulk_edit' );
|
readme.txt
CHANGED
@@ -4,41 +4,67 @@ Author: PublishPress
|
|
4 |
Author URI: https://publishpress.com
|
5 |
Tags: expire, posts, pages, schedule
|
6 |
Requires at least: 4.0
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 2.4.
|
9 |
|
10 |
Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
The Post Expirator plugin allows you to add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
|
15 |
|
16 |
-
|
17 |
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
* Categories: Replace
|
25 |
-
* Categories: Add
|
26 |
-
* Categories: Remove
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
default display format. See the [PHP Date Function](http://us2.php.net/manual/en/function.date.php) for valid date/time format options.
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
* dateformat - format set here will override the value set on the settings page
|
39 |
-
* timeformat - format set here will override the value set on the settings page
|
40 |
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
== Installation ==
|
44 |
|
@@ -55,6 +81,15 @@ This section describes how to install the plugin and get it working.
|
|
55 |
|
56 |
== Changelog ==
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
**Version 2.4.2**
|
59 |
|
60 |
* Fixed: Bulk edit does not change scheduled event bug, #29;
|
@@ -122,7 +157,7 @@ This section describes how to install the plugin and get it working.
|
|
122 |
|
123 |
* New: Added support for hierarchical custom taxonomy
|
124 |
* New: Enhanced custom post type support
|
125 |
-
* Fix: Updated debug function to be friendly for scripted calls
|
126 |
* Fix: Change to only show public custom post types on defaults screen
|
127 |
* Fix: Removed category expiration options for 'pages', which is currently unsupported
|
128 |
* Fix: Some date calls were getting "double" converted for the timezone pending how other plugins handled date - this issue should now be resolved
|
@@ -261,7 +296,6 @@ Quick Edit/Bulk Edit Added. Sortable Expiration Date Fields Added
|
|
261 |
Fixed PHP Strict errors with 5.4+
|
262 |
Removed temporary timezone conversion functions
|
263 |
|
264 |
-
|
265 |
= 2.1.3 =
|
266 |
Default category selection now saves correctly on default settings screen
|
267 |
|
4 |
Author URI: https://publishpress.com
|
5 |
Tags: expire, posts, pages, schedule
|
6 |
Requires at least: 4.0
|
7 |
+
Tested up to: 5.8
|
8 |
+
Stable tag: 2.4.3
|
9 |
|
10 |
Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
The Post Expirator plugin allows you to add an expiration date to posts. pages and other content type. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
|
15 |
|
16 |
+
Here's an overview of what you can do with Post Expirator:
|
17 |
|
18 |
+
* Choose expiry dates for content in any post type.
|
19 |
+
* Select expiry dates in the right sidebar when editing posts.
|
20 |
+
* Modify, remove or completely delete content when the expiry date arrives.
|
21 |
+
* Modify expiry dates using "Quick Edit" and "Bulk Edit".
|
22 |
+
* Receive email notifications when your content expires.
|
23 |
+
* Show expiry dates in your content, automatically or with shortcodes.
|
|
|
|
|
|
|
24 |
|
25 |
+
## Options for Expiring Posts
|
26 |
|
27 |
+
When your posts expire, you can perform these changes on your content:
|
|
|
28 |
|
29 |
+
* Change the status to "Draft".
|
30 |
+
* Delete the post.
|
31 |
+
* Send the post to the Trash.
|
32 |
+
* Change the status to "Private".
|
33 |
+
* Enable the “Stick to the top of the blog” option.
|
34 |
+
* Disable the “Stick to the top of the blog” option.
|
35 |
+
* Remove all existing categories, and add new categories.
|
36 |
+
* Keep all existing categories, and add new categories.
|
37 |
+
* Keep all existing categories, except for those specified in this change.
|
38 |
|
39 |
+
[Click here for more details on expiring posts](https://publishpress.com/knowledge-base/ways-to-expire-posts/).
|
40 |
|
41 |
+
## Display the Expiry Date in Your Content
|
|
|
|
|
42 |
|
43 |
+
Post Expirator allows you to place automatically show the expiry date inside your articles. The expiry will be added at the bottom of your post.
|
44 |
+
|
45 |
+
[Click here to see the Footer Display options](https://publishpress.com/knowledge-base/footer-display/).
|
46 |
+
|
47 |
+
You can use shortcodes to show the expiration date inside your posts. You can customize the shortcode output with several formatting options.
|
48 |
+
|
49 |
+
[Click here to see the shortcode options](https://publishpress.com/knowledge-base/shortcodes-to-show-expiration-date/).
|
50 |
+
|
51 |
+
## Expiry Defaults for Post Types
|
52 |
+
|
53 |
+
Post Expirator can support any post type in WordPress. Go to Settings > Post Expirator > Defaults and you can choose default expiry options for each post type.
|
54 |
+
|
55 |
+
[Click here to see the default options](https://publishpress.com/knowledge-base/defaults-for-post-types/).
|
56 |
+
|
57 |
+
## Post Expirator Email Notifications
|
58 |
+
|
59 |
+
The Post Expirator plugin can send you email notifications when your content is unpublished. You can control the emails by going to Settings > Post Expirator > General Settings.
|
60 |
+
|
61 |
+
[Click here to see the notification options](https://publishpress.com/knowledge-base/email-notifications/).
|
62 |
+
|
63 |
+
## Details on How Post Expiry Works
|
64 |
+
|
65 |
+
For each expiration event, a custom cron job is scheduled. This can help reduce server overhead for busy sites. This plugin REQUIRES that WP-CRON is setup and functional on your webhost. Some hosts do not support this, so please check and confirm if you run into issues using the plugin.
|
66 |
+
|
67 |
+
[Click here to see the technical details for this plugin](https://publishpress.com/knowledge-base/scheduling-cron-jobs/).
|
68 |
|
69 |
== Installation ==
|
70 |
|
81 |
|
82 |
== Changelog ==
|
83 |
|
84 |
+
**Version 2.4.3**
|
85 |
+
|
86 |
+
* Added: Expose wrappers for legacy functions, #40;
|
87 |
+
* Added: Support for quotes in Default expiry, #43;
|
88 |
+
* Fixed: Default expiry duration is broken for future years, #39;
|
89 |
+
* Fixed: Translation bug, #5;
|
90 |
+
* Fixed: Post expiring one year early, #24;
|
91 |
+
* Changed: Bulk and Quick Edit boxes default to current date/year, #46;
|
92 |
+
|
93 |
**Version 2.4.2**
|
94 |
|
95 |
* Fixed: Bulk edit does not change scheduled event bug, #29;
|
157 |
|
158 |
* New: Added support for hierarchical custom taxonomy
|
159 |
* New: Enhanced custom post type support
|
160 |
+
* Fix: Updated debug function to be friendly for scripted calls
|
161 |
* Fix: Change to only show public custom post types on defaults screen
|
162 |
* Fix: Removed category expiration options for 'pages', which is currently unsupported
|
163 |
* Fix: Some date calls were getting "double" converted for the timezone pending how other plugins handled date - this issue should now be resolved
|
296 |
Fixed PHP Strict errors with 5.4+
|
297 |
Removed temporary timezone conversion functions
|
298 |
|
|
|
299 |
= 2.1.3 =
|
300 |
Default category selection now saves correctly on default settings screen
|
301 |
|