Version Description
Download this release
Release Info
| Developer | axelseaa |
| Plugin | |
| Version | 1.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.1 to 1.3
- post-expirator.php +181 -13
- readme.txt +13 -1
post-expirator.php
CHANGED
|
@@ -4,12 +4,15 @@ Plugin Name: Post Expirator
|
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
|
| 5 |
Description: Allows you to add an expiration date (hourly) to posts which you can configure to either delete the post or change it to a draft.
|
| 6 |
Author: Aaron Axelsen
|
| 7 |
-
Version: 1.
|
| 8 |
Author URI: http://www.frozenpc.net
|
| 9 |
*/
|
| 10 |
|
| 11 |
// Default Values
|
| 12 |
-
$expirationdateDefaultDateFormat = 'l F jS, Y
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
/**
|
| 15 |
* Function that does the actualy deleting - called by wp_cron
|
|
@@ -42,10 +45,15 @@ add_action ('expirationdate_delete_'.$current_blog->blog_id, 'expirationdate_del
|
|
| 42 |
* Called at plugin activation
|
| 43 |
*/
|
| 44 |
function expirationdate_activate () {
|
| 45 |
-
global $current_blog,$expirationdateDefaultDateFormat;
|
| 46 |
update_option('expirationdateExpiredPostStatus','Draft');
|
| 47 |
update_option('expirationdateExpiredPageStatus','Draft');
|
| 48 |
update_option('expirationdateDefaultDateFormat',$expirationdateDefaultDateFormat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'hourly', 'expirationdate_delete_'.$current_blog->blog_id);
|
| 50 |
}
|
| 51 |
register_activation_hook (__FILE__, 'expirationdate_activate');
|
|
@@ -58,6 +66,10 @@ function expirationdate_deactivate () {
|
|
| 58 |
delete_option('expirationdateExpiredPostStatus');
|
| 59 |
delete_option('expirationdateExpiredPageStatus');
|
| 60 |
delete_option('expirationdateDefaultDateFormat');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
wp_clear_scheduled_hook('expirationdate_delete_'.$current_blog->blog_id);
|
| 62 |
}
|
| 63 |
register_deactivation_hook (__FILE__, 'expirationdate_deactivate');
|
|
@@ -162,6 +174,7 @@ function expirationdate_meta_box($post) {
|
|
| 162 |
$rv[] = '</select>';
|
| 163 |
$rv[] = '</td><td>@</td><td>';
|
| 164 |
$rv[] = '<input type="text" id="expirationdate_hour" name="expirationdate_hour" value="'.$defaulthour.'" size="2"'.$disabled.'" />';
|
|
|
|
| 165 |
$rv[] = '</td></tr></table>';
|
| 166 |
|
| 167 |
$rv[] = '<div id="expirationdate_ajax_result"></div>';
|
|
@@ -240,8 +253,8 @@ function expirationdate_get_blog_url() {
|
|
| 240 |
* Called when post is saved - stores expiration-date meta value
|
| 241 |
*/
|
| 242 |
function expirationdate_update_post_meta($id) {
|
| 243 |
-
|
| 244 |
-
return;
|
| 245 |
|
| 246 |
$month = $_POST['expirationdate_month'];
|
| 247 |
$day = $_POST['expirationdate_day'];
|
|
@@ -277,6 +290,10 @@ function expirationdate_show_options() {
|
|
| 277 |
update_option('expirationdateExpiredPostStatus',$_POST['expired-post-status']);
|
| 278 |
update_option('expirationdateExpiredPageStatus',$_POST['expired-page-status']);
|
| 279 |
update_option('expirationdateDefaultDateFormat',$_POST['expired-default-date-format']);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
echo "<div id='message' class='updated fade'><p>Saved Options!</p></div>";
|
| 281 |
}
|
| 282 |
|
|
@@ -295,6 +312,35 @@ function expirationdate_show_options() {
|
|
| 295 |
$expirationdateDefaultDateFormat = $expirationdateDefaultDateFormat;
|
| 296 |
}
|
| 297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
?>
|
| 299 |
<div class="wrap">
|
| 300 |
<h2><?php _e('Post Expirator Options'); ?></h2>
|
|
@@ -302,7 +348,15 @@ function expirationdate_show_options() {
|
|
| 302 |
The post expirator plugin sets a custom meta value, and then optionally allows you to select if you want the post
|
| 303 |
changed to a draft status or deleted when it expires.
|
| 304 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
<form method="post" id="expirationdate_save_options">
|
|
|
|
| 306 |
<table class="form-table">
|
| 307 |
<tr valign-"top">
|
| 308 |
<th scope="row"><label for="expired-post-status">Set Post To:</label></th>
|
|
@@ -327,12 +381,57 @@ function expirationdate_show_options() {
|
|
| 327 |
</td>
|
| 328 |
</tr>
|
| 329 |
<tr valign-"top">
|
| 330 |
-
<th scope="row"><label for="expired-default-date-format">
|
| 331 |
<td>
|
| 332 |
<input type="text" name="expired-default-date-format" id="expired-default-date-format" value="<?php echo $expirationdateDefaultDateFormat ?>" size="25" /> (<?php echo date("$expirationdateDefaultDateFormat") ?>)
|
| 333 |
<br/>
|
| 334 |
The default format to use when displaying the expiration date within a post using the [postexpirator]
|
| 335 |
-
shortcode. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
</td>
|
| 337 |
</tr>
|
| 338 |
</table>
|
|
@@ -346,19 +445,88 @@ function expirationdate_show_options() {
|
|
| 346 |
|
| 347 |
// [postexpirator format="l F jS, Y g:ia" tz="foo"]
|
| 348 |
function postexpirator_shortcode($atts) {
|
| 349 |
-
global $post
|
|
|
|
| 350 |
$expirationdatets = get_post_meta($post->ID,'expiration-date',true);
|
| 351 |
if (empty($expirationdatets))
|
| 352 |
return false;
|
|
|
|
| 353 |
extract(shortcode_atts(array(
|
| 354 |
-
'
|
| 355 |
-
'
|
|
|
|
|
|
|
| 356 |
), $atts));
|
| 357 |
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
|
| 362 |
return date("$format",$expirationdatets);
|
| 363 |
}
|
| 364 |
add_shortcode('postexpirator', 'postexpirator_shortcode');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
|
| 5 |
Description: Allows you to add an expiration date (hourly) to posts which you can configure to either delete the post or change it to a draft.
|
| 6 |
Author: Aaron Axelsen
|
| 7 |
+
Version: 1.3
|
| 8 |
Author URI: http://www.frozenpc.net
|
| 9 |
*/
|
| 10 |
|
| 11 |
// Default Values
|
| 12 |
+
$expirationdateDefaultDateFormat = 'l F jS, Y';
|
| 13 |
+
$expirationdateDefaultTimeFormat = 'g:ia';
|
| 14 |
+
$expirationdateDefaultFooterContents = 'Post expires at EXPIRATIONTIME on EXPIRATIONDATE';
|
| 15 |
+
$expirationdateDefaultFooterStyle = 'font-style: italic;';
|
| 16 |
|
| 17 |
/**
|
| 18 |
* Function that does the actualy deleting - called by wp_cron
|
| 45 |
* Called at plugin activation
|
| 46 |
*/
|
| 47 |
function expirationdate_activate () {
|
| 48 |
+
global $current_blog,$expirationdateDefaultDateFormat,$expirationdateDefaultTimeFormat,$expirationdateDefaultFooterContents,$expirationdateDefaultFooterStyle;
|
| 49 |
update_option('expirationdateExpiredPostStatus','Draft');
|
| 50 |
update_option('expirationdateExpiredPageStatus','Draft');
|
| 51 |
update_option('expirationdateDefaultDateFormat',$expirationdateDefaultDateFormat);
|
| 52 |
+
update_option('expirationdateDefaultTimeFormat',$expirationdateDefaultTimeFormat);
|
| 53 |
+
update_option('expirationdateFooterContents',$expirationdateDefaultFooterContents);
|
| 54 |
+
update_option('expirationdateFooterStyle',$expirationdateDefaultFooterStyle);
|
| 55 |
+
update_option('expirationdateDisplayFooter',0);
|
| 56 |
+
|
| 57 |
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'hourly', 'expirationdate_delete_'.$current_blog->blog_id);
|
| 58 |
}
|
| 59 |
register_activation_hook (__FILE__, 'expirationdate_activate');
|
| 66 |
delete_option('expirationdateExpiredPostStatus');
|
| 67 |
delete_option('expirationdateExpiredPageStatus');
|
| 68 |
delete_option('expirationdateDefaultDateFormat');
|
| 69 |
+
delete_option('expirationdateDefaultTimeFormat');
|
| 70 |
+
delete_option('expirationdateDisplayFooter');
|
| 71 |
+
delete_option('expirationdateFooterContents');
|
| 72 |
+
delete_option('expirationdateFooterStyle');
|
| 73 |
wp_clear_scheduled_hook('expirationdate_delete_'.$current_blog->blog_id);
|
| 74 |
}
|
| 75 |
register_deactivation_hook (__FILE__, 'expirationdate_deactivate');
|
| 174 |
$rv[] = '</select>';
|
| 175 |
$rv[] = '</td><td>@</td><td>';
|
| 176 |
$rv[] = '<input type="text" id="expirationdate_hour" name="expirationdate_hour" value="'.$defaulthour.'" size="2"'.$disabled.'" />';
|
| 177 |
+
$rv[] = '<input type="hidden" name="expirationdate_formcheck" value="true" />';
|
| 178 |
$rv[] = '</td></tr></table>';
|
| 179 |
|
| 180 |
$rv[] = '<div id="expirationdate_ajax_result"></div>';
|
| 253 |
* Called when post is saved - stores expiration-date meta value
|
| 254 |
*/
|
| 255 |
function expirationdate_update_post_meta($id) {
|
| 256 |
+
if (!isset($_POST['expirationdate_formcheck']))
|
| 257 |
+
return false;
|
| 258 |
|
| 259 |
$month = $_POST['expirationdate_month'];
|
| 260 |
$day = $_POST['expirationdate_day'];
|
| 290 |
update_option('expirationdateExpiredPostStatus',$_POST['expired-post-status']);
|
| 291 |
update_option('expirationdateExpiredPageStatus',$_POST['expired-page-status']);
|
| 292 |
update_option('expirationdateDefaultDateFormat',$_POST['expired-default-date-format']);
|
| 293 |
+
update_option('expirationdateDefaultTimeFormat',$_POST['expired-default-time-format']);
|
| 294 |
+
update_option('expirationdateDisplayFooter',$_POST['expired-display-footer']);
|
| 295 |
+
update_option('expirationdateFooterContents',$_POST['expired-footer-contents']);
|
| 296 |
+
update_option('expirationdateFooterStyle',$_POST['expired-footer-style']);
|
| 297 |
echo "<div id='message' class='updated fade'><p>Saved Options!</p></div>";
|
| 298 |
}
|
| 299 |
|
| 312 |
$expirationdateDefaultDateFormat = $expirationdateDefaultDateFormat;
|
| 313 |
}
|
| 314 |
|
| 315 |
+
$expirationdateDefaultTimeFormat = get_option('expirationdateDefaultTimeFormat');
|
| 316 |
+
if (empty($expirationdateDefaultTimeFormat)) {
|
| 317 |
+
global $expirationdateDefaultTimeFormat;
|
| 318 |
+
$expirationdateDefaultTimeFormat = $expirationdateDefaultTimeFormat;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
$expireddisplayfooter = get_option('expirationdateDisplayFooter');
|
| 322 |
+
if (empty($expireddisplayfooter))
|
| 323 |
+
$expireddisplayfooter = 0;
|
| 324 |
+
|
| 325 |
+
$expireddisplayfooterenabled = '';
|
| 326 |
+
$expireddisplayfooterdisabled = '';
|
| 327 |
+
if ($expireddisplayfooter == 0)
|
| 328 |
+
$expireddisplayfooterdisabled = 'checked="checked"';
|
| 329 |
+
else if ($expireddisplayfooter == 1)
|
| 330 |
+
$expireddisplayfooterenabled = 'checked="checked"';
|
| 331 |
+
|
| 332 |
+
$expirationdateFooterContents = get_option('expirationdateFooterContents');
|
| 333 |
+
if (empty($expirationdateFooterContents)) {
|
| 334 |
+
global $expirationdateDefaultFooterContents;
|
| 335 |
+
$expirationdateFooterContents = $expirationdateDefaultFooterContents;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
$expirationdateFooterStyle = get_option('expirationdateFooterStyle');
|
| 339 |
+
if (empty($expirationdateFooterStyle)) {
|
| 340 |
+
global $expirationdateDefaultFooterStyle;
|
| 341 |
+
$expirationdateFooterStyle = $expirationdateDefaultFooterStyle;
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
?>
|
| 345 |
<div class="wrap">
|
| 346 |
<h2><?php _e('Post Expirator Options'); ?></h2>
|
| 348 |
The post expirator plugin sets a custom meta value, and then optionally allows you to select if you want the post
|
| 349 |
changed to a draft status or deleted when it expires.
|
| 350 |
</p>
|
| 351 |
+
<p>Valid [postexpiration] attributes:
|
| 352 |
+
<ul>
|
| 353 |
+
<li>type - defaults to full - valid options are full,date,time</li>
|
| 354 |
+
<li>dateformat - format set here will override the value set on the settings page</li>
|
| 355 |
+
<li>timeformat - format set here will override the value set on the settings page</li>
|
| 356 |
+
</ul>
|
| 357 |
+
</p>
|
| 358 |
<form method="post" id="expirationdate_save_options">
|
| 359 |
+
<h3>Defaults</h3>
|
| 360 |
<table class="form-table">
|
| 361 |
<tr valign-"top">
|
| 362 |
<th scope="row"><label for="expired-post-status">Set Post To:</label></th>
|
| 381 |
</td>
|
| 382 |
</tr>
|
| 383 |
<tr valign-"top">
|
| 384 |
+
<th scope="row"><label for="expired-default-date-format">Date Format:</label></th>
|
| 385 |
<td>
|
| 386 |
<input type="text" name="expired-default-date-format" id="expired-default-date-format" value="<?php echo $expirationdateDefaultDateFormat ?>" size="25" /> (<?php echo date("$expirationdateDefaultDateFormat") ?>)
|
| 387 |
<br/>
|
| 388 |
The default format to use when displaying the expiration date within a post using the [postexpirator]
|
| 389 |
+
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>.
|
| 390 |
+
</td>
|
| 391 |
+
</tr>
|
| 392 |
+
<tr valign-"top">
|
| 393 |
+
<th scope="row"><label for="expired-default-time-format">Time Format:</label></th>
|
| 394 |
+
<td>
|
| 395 |
+
<input type="text" name="expired-default-time-format" id="expired-default-time-format" value="<?php echo $expirationdateDefaultTimeFormat ?>" size="25" /> (<?php echo date("$expirationdateDefaultTimeFormat") ?>)
|
| 396 |
+
<br/>
|
| 397 |
+
The default format to use when displaying the expiration time within a post using the [postexpirator]
|
| 398 |
+
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>.
|
| 399 |
+
</td>
|
| 400 |
+
</tr>
|
| 401 |
+
</table>
|
| 402 |
+
<h3>Post Footer Display</h3>
|
| 403 |
+
<p>Enabling this below will display the expiration date automatically at the end of any post which is set to expire.</p>
|
| 404 |
+
<table class="form-table">
|
| 405 |
+
<tr valign-"top">
|
| 406 |
+
<th scope="row">Show in post footer?</th>
|
| 407 |
+
<td>
|
| 408 |
+
<input type="radio" name="expired-display-footer" id="expired-display-footer-true" value="1" <?php echo $expireddisplayfooterenabled ?>/> <label for="expired-display-footer-true">Enabled</label>
|
| 409 |
+
<input type="radio" name="expired-display-footer" id="expired-display-footer-false" value="0" <?php echo $expireddisplayfooterdisabled ?>/> <label for="expired-display-footer-false">Disabled</label>
|
| 410 |
+
<br/>
|
| 411 |
+
This will enable or disable displaying the post expiration date in the post footer.
|
| 412 |
+
</td>
|
| 413 |
+
</tr>
|
| 414 |
+
<tr valign-"top">
|
| 415 |
+
<th scope="row"><label for="expired-footer-contents">Footer Contents:</label></th>
|
| 416 |
+
<td>
|
| 417 |
+
<textarea id="expired-footer-contents" name="expired-footer-contents" rows="3" cols="50"><?php echo $expirationdateFooterContents; ?></textarea>
|
| 418 |
+
<br/>
|
| 419 |
+
Enter the text you would like to appear at the bottom of every post that will expire. The following placeholders will be replaced
|
| 420 |
+
with the post expiration date in the following format:
|
| 421 |
+
<ul>
|
| 422 |
+
<li>EXPIRATIONFULL -> <?php echo date("$expirationdateDefaultDateFormat $expirationdateDefaultTimeFormat") ?></li>
|
| 423 |
+
<li>EXPIRATIONDATE -> <?php echo date("$expirationdateDefaultDateFormat") ?></li>
|
| 424 |
+
<li>EXPIRATIONTIME -> <?php echo date("$expirationdateDefaultTimeFormat") ?></li>
|
| 425 |
+
</ul>
|
| 426 |
+
</td>
|
| 427 |
+
</tr>
|
| 428 |
+
<tr valign-"top">
|
| 429 |
+
<th scope="row"><label for="expired-footer-style">Footer Style:</label></th>
|
| 430 |
+
<td>
|
| 431 |
+
<input type="text" name="expired-footer-style" id="expired-footer-style" value="<?php echo $expirationdateFooterStyle ?>" size="25" />
|
| 432 |
+
(<span style="<?php echo $expirationdateFooterStyle ?>">This post will expire on <?php echo date("$expirationdateDefaultDateFormat $expirationdateDefaultTimeFormat"); ?></span>)
|
| 433 |
+
<br/>
|
| 434 |
+
The inline css which will be used to style the footer text.
|
| 435 |
</td>
|
| 436 |
</tr>
|
| 437 |
</table>
|
| 445 |
|
| 446 |
// [postexpirator format="l F jS, Y g:ia" tz="foo"]
|
| 447 |
function postexpirator_shortcode($atts) {
|
| 448 |
+
global $post;
|
| 449 |
+
|
| 450 |
$expirationdatets = get_post_meta($post->ID,'expiration-date',true);
|
| 451 |
if (empty($expirationdatets))
|
| 452 |
return false;
|
| 453 |
+
|
| 454 |
extract(shortcode_atts(array(
|
| 455 |
+
'dateformat' => get_option('expirationdateDefaultDateFormat'),
|
| 456 |
+
'timeformat' => get_option('expirationdateDefaultTimeFormat'),
|
| 457 |
+
'type' => full,
|
| 458 |
+
'tz' => date('T')
|
| 459 |
), $atts));
|
| 460 |
|
| 461 |
+
if (empty($dateformat)) {
|
| 462 |
+
global $expirationdateDefaultDateFormat;
|
| 463 |
+
$dateformat = $expirationdateDefaultDateFormat;
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
if (empty($timeformat)) {
|
| 467 |
+
global $expirationdateDefaultTimeFormat;
|
| 468 |
+
$timeformat = $expirationdateDefaultTimeFormat;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
if ($type == 'full')
|
| 472 |
+
$format = $dateformat.' '.$timeformat;
|
| 473 |
+
else if ($type == 'date')
|
| 474 |
+
$format = $dateformat;
|
| 475 |
+
else if ($type == 'time')
|
| 476 |
+
$format = $timeformat;
|
| 477 |
|
| 478 |
return date("$format",$expirationdatets);
|
| 479 |
}
|
| 480 |
add_shortcode('postexpirator', 'postexpirator_shortcode');
|
| 481 |
+
|
| 482 |
+
function postexpirator_add_footer($text) {
|
| 483 |
+
global $post;
|
| 484 |
+
|
| 485 |
+
// Check to see if its enabled
|
| 486 |
+
$displayFooter = get_option('expirationdateDisplayFooter');
|
| 487 |
+
if ($displayFooter === false || $displayFooter == 0)
|
| 488 |
+
return $text;
|
| 489 |
+
|
| 490 |
+
$expirationdatets = get_post_meta($post->ID,'expiration-date',true);
|
| 491 |
+
if (!is_numeric($expirationdatets))
|
| 492 |
+
return $text;
|
| 493 |
+
|
| 494 |
+
$dateformat = get_option('expirationdateDefaultDateFormat');
|
| 495 |
+
if (empty($dateformat)) {
|
| 496 |
+
global $expirationdateDefaultDateFormat;
|
| 497 |
+
$dateformat = $expirationdateDefaultDateFormat;
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
$timeformat = get_option('expirationdateDefaultTimeFormat');
|
| 501 |
+
if (empty($timeformat)) {
|
| 502 |
+
global $expirationdateDefaultTimeFormat;
|
| 503 |
+
$timeformat = $expirationdateDefaultTimeFormat;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
$expirationdateFooterContents = get_option('expirationdateFooterContents');
|
| 507 |
+
if (empty($expirationdateFooterContents)) {
|
| 508 |
+
global $expirationdateDefaultFooterContents;
|
| 509 |
+
$expirationdateFooterContents = $expirationdateDefaultFooterContents;
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
$expirationdateFooterStyle = get_option('expirationdateFooterStyle');
|
| 513 |
+
if (empty($expirationdateFooterStyle)) {
|
| 514 |
+
global $expirationdateDefaultFooterStyle;
|
| 515 |
+
$expirationdateFooterStyle = $expirationdateDefaultFooterStyle;
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
$search = array(
|
| 519 |
+
'EXPIRATIONFULL',
|
| 520 |
+
'EXPIRATIONDATE',
|
| 521 |
+
'EXPIRATIONTIME'
|
| 522 |
+
);
|
| 523 |
+
$replace = array(
|
| 524 |
+
date("$dateformat $timeformat",$expirationdatets),
|
| 525 |
+
date("$dateformat",$expirationdatets),
|
| 526 |
+
date("$timeformat",$expirationdatets)
|
| 527 |
+
);
|
| 528 |
+
|
| 529 |
+
$add_to_footer = '<p style="'.$expirationdateFooterStyle.'">'.str_replace($search,$replace,$expirationdateFooterContents).'</p>';
|
| 530 |
+
return $text.$add_to_footer;
|
| 531 |
+
}
|
| 532 |
+
add_action('the_content','postexpirator_add_footer',0);
|
readme.txt
CHANGED
|
@@ -15,7 +15,13 @@ area that will allow you to seperataly control whether or not posts/pages are wi
|
|
| 15 |
The plugin hooks into the wp cron processes and runs every hour.
|
| 16 |
|
| 17 |
The expiration date can be displayed within the actual post by using the [postexpirator] tag. The format attribute will override the plugin
|
| 18 |
-
default display format. See the [PHP Date Function](http://us2.php.net/manual/en/function.date.php) for valid format options.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
== Wordpress MU ==
|
| 21 |
|
|
@@ -35,6 +41,12 @@ This section describes how to install the plugin and get it working.
|
|
| 35 |
|
| 36 |
== Changelog ==
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
**Version 1.2.1**
|
| 39 |
|
| 40 |
* Fixed issue with display date format not being recognized after upgrade
|
| 15 |
The plugin hooks into the wp cron processes and runs every hour.
|
| 16 |
|
| 17 |
The expiration date can be displayed within the actual post by using the [postexpirator] tag. The format attribute will override the plugin
|
| 18 |
+
default display format. See the [PHP Date Function](http://us2.php.net/manual/en/function.date.php) for valid date/time format options.
|
| 19 |
+
|
| 20 |
+
**[postexpirator] shortcode attributes**
|
| 21 |
+
|
| 22 |
+
* type - defaults to full - valid options are full,date,time
|
| 23 |
+
* dateformat - format set here will override the value set on the settings page
|
| 24 |
+
* timeformat - format set here will override the value set on the settings page
|
| 25 |
|
| 26 |
== Wordpress MU ==
|
| 27 |
|
| 41 |
|
| 42 |
== Changelog ==
|
| 43 |
|
| 44 |
+
**Version 1.3**
|
| 45 |
+
|
| 46 |
+
* Expiration date is now retained across all post status changes
|
| 47 |
+
* Modified date/time format options for shortcode postexpirator tag
|
| 48 |
+
* Added the ability to add text automatically to the post footer if expiration date is set
|
| 49 |
+
|
| 50 |
**Version 1.2.1**
|
| 51 |
|
| 52 |
* Fixed issue with display date format not being recognized after upgrade
|
