Version Description
Fixed PHP Strict errors with 5.4+ Removed temporary timezone conversion functions
Download this release
Release Info
Developer | axelseaa |
Plugin | Post Expirator |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- post-expirator.php +20 -37
- readme.txt +13 -3
post-expirator.php
CHANGED
@@ -4,7 +4,7 @@ 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.1.
|
8 |
Author URI: http://postexpirator.tuxdocs.net/
|
9 |
Translation: Thierry (http://palijn.info)
|
10 |
Text Domain: post-expirator
|
@@ -76,7 +76,7 @@ function expirationdate_show_value ($column_name) {
|
|
76 |
$id = $post->ID;
|
77 |
if ($column_name === 'expirationdate') {
|
78 |
$ed = get_post_meta($id,'_expiration-date',true);
|
79 |
-
echo ($ed ?
|
80 |
}
|
81 |
}
|
82 |
add_action ('manage_posts_custom_column', 'expirationdate_show_value');
|
@@ -127,11 +127,11 @@ function expirationdate_meta_box($post) {
|
|
127 |
|
128 |
if ( $tz ) date_default_timezone_set('UTC');
|
129 |
}
|
130 |
-
$defaultmonth =
|
131 |
-
$defaultday =
|
132 |
-
$defaultyear =
|
133 |
-
$defaulthour =
|
134 |
-
$defaultminute =
|
135 |
}
|
136 |
|
137 |
$enabled = '';
|
@@ -147,11 +147,11 @@ function expirationdate_meta_box($post) {
|
|
147 |
$disabled='';
|
148 |
}
|
149 |
} else {
|
150 |
-
$defaultmonth =
|
151 |
-
$defaultday =
|
152 |
-
$defaultyear =
|
153 |
-
$defaulthour =
|
154 |
-
$defaultminute =
|
155 |
$enabled = ' checked="checked"';
|
156 |
$disabled = '';
|
157 |
$opts = get_post_meta($post->ID,'_expiration-date-options',true);
|
@@ -1057,7 +1057,7 @@ function postexpirator_shortcode($atts) {
|
|
1057 |
else if ($type == 'time')
|
1058 |
$format = $timeformat;
|
1059 |
|
1060 |
-
return
|
1061 |
}
|
1062 |
add_shortcode('postexpirator', 'postexpirator_shortcode');
|
1063 |
|
@@ -1084,9 +1084,9 @@ function postexpirator_add_footer($text) {
|
|
1084 |
'EXPIRATIONTIME'
|
1085 |
);
|
1086 |
$replace = array(
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
);
|
1091 |
|
1092 |
$add_to_footer = '<p style="'.$expirationdateFooterStyle.'">'.str_replace($search,$replace,$expirationdateFooterContents).'</p>';
|
@@ -1264,17 +1264,17 @@ class Walker_PostExpirator_Category_Checklist extends Walker {
|
|
1264 |
$this->disabled = 'disabled="disabled"';
|
1265 |
}
|
1266 |
|
1267 |
-
function start_lvl(&$output, $depth, $args) {
|
1268 |
$indent = str_repeat("\t", $depth);
|
1269 |
$output .= "$indent<ul class='children'>\n";
|
1270 |
}
|
1271 |
|
1272 |
-
function end_lvl(&$output, $depth, $args) {
|
1273 |
$indent = str_repeat("\t", $depth);
|
1274 |
$output .= "$indent</ul>\n";
|
1275 |
}
|
1276 |
|
1277 |
-
function start_el(&$output, $category, $depth, $args) {
|
1278 |
extract($args);
|
1279 |
if ( empty($taxonomy) )
|
1280 |
$taxonomy = 'category';
|
@@ -1285,7 +1285,7 @@ class Walker_PostExpirator_Category_Checklist extends Walker {
|
|
1285 |
$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, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' '.$this->disabled.'/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
|
1286 |
}
|
1287 |
|
1288 |
-
function end_el(&$output, $category, $depth, $args) {
|
1289 |
$output .= "</li>\n";
|
1290 |
}
|
1291 |
}
|
@@ -1338,20 +1338,3 @@ function _postExpiratorTaxonomy($opts) {
|
|
1338 |
$rv[] = '</select>';
|
1339 |
return implode("<br/>/n",$rv);
|
1340 |
}
|
1341 |
-
|
1342 |
-
/**
|
1343 |
-
* TEMPORARY FUNCTION UNTIL TICKET 20328 IS FIXED
|
1344 |
-
*/
|
1345 |
-
function postexpirator_get_date_from_gmt($string,$format = 'Y-m-d H:i:s') {
|
1346 |
-
$tz = get_option('timezone_string');
|
1347 |
-
if ( $tz ) {
|
1348 |
-
$datetime = new DateTime( $string , new DateTimeZone('UTC') );
|
1349 |
-
$datetime->setTimezone( new DateTimeZone($tz) );
|
1350 |
-
$string_localtime = $datetime->format($format);
|
1351 |
-
} else {
|
1352 |
-
preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
|
1353 |
-
$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
|
1354 |
-
$string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600);
|
1355 |
-
}
|
1356 |
-
return $string_localtime;
|
1357 |
-
}
|
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.1.4
|
8 |
Author URI: http://postexpirator.tuxdocs.net/
|
9 |
Translation: Thierry (http://palijn.info)
|
10 |
Text Domain: post-expirator
|
76 |
$id = $post->ID;
|
77 |
if ($column_name === 'expirationdate') {
|
78 |
$ed = get_post_meta($id,'_expiration-date',true);
|
79 |
+
echo ($ed ? get_date_from_gmt(gmdate('Y-m-d H:i:s',$ed),get_option('date_format').' '.get_option('time_format')) : __("Never",'post-expirator'));
|
80 |
}
|
81 |
}
|
82 |
add_action ('manage_posts_custom_column', 'expirationdate_show_value');
|
127 |
|
128 |
if ( $tz ) date_default_timezone_set('UTC');
|
129 |
}
|
130 |
+
$defaultmonth = get_date_from_gmt(gmdate('Y-m-d H:i:s',$ts),'m');
|
131 |
+
$defaultday = get_date_from_gmt(gmdate('Y-m-d H:i:s',$ts),'d');
|
132 |
+
$defaultyear = get_date_from_gmt(gmdate('Y-m-d H:i:s',$ts),'Y');;
|
133 |
+
$defaulthour = get_date_from_gmt(gmdate('Y-m-d H:i:s',$ts),'H');
|
134 |
+
$defaultminute = get_date_from_gmt(gmdate('Y-m-d H:i:s',$ts),'i');
|
135 |
}
|
136 |
|
137 |
$enabled = '';
|
147 |
$disabled='';
|
148 |
}
|
149 |
} else {
|
150 |
+
$defaultmonth = get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),'m');
|
151 |
+
$defaultday = get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),'d');
|
152 |
+
$defaultyear = get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),'Y');
|
153 |
+
$defaulthour = get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),'H');
|
154 |
+
$defaultminute = get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),'i');
|
155 |
$enabled = ' checked="checked"';
|
156 |
$disabled = '';
|
157 |
$opts = get_post_meta($post->ID,'_expiration-date-options',true);
|
1057 |
else if ($type == 'time')
|
1058 |
$format = $timeformat;
|
1059 |
|
1060 |
+
return get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),$format);
|
1061 |
}
|
1062 |
add_shortcode('postexpirator', 'postexpirator_shortcode');
|
1063 |
|
1084 |
'EXPIRATIONTIME'
|
1085 |
);
|
1086 |
$replace = array(
|
1087 |
+
get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),"$dateformat $timeformat"),
|
1088 |
+
get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),$dateformat),
|
1089 |
+
get_date_from_gmt(gmdate('Y-m-d H:i:s',$expirationdatets),$timeformat)
|
1090 |
);
|
1091 |
|
1092 |
$add_to_footer = '<p style="'.$expirationdateFooterStyle.'">'.str_replace($search,$replace,$expirationdateFooterContents).'</p>';
|
1264 |
$this->disabled = 'disabled="disabled"';
|
1265 |
}
|
1266 |
|
1267 |
+
function start_lvl(&$output, $depth = 0, $args = array()) {
|
1268 |
$indent = str_repeat("\t", $depth);
|
1269 |
$output .= "$indent<ul class='children'>\n";
|
1270 |
}
|
1271 |
|
1272 |
+
function end_lvl(&$output, $depth = 0, $args = array()) {
|
1273 |
$indent = str_repeat("\t", $depth);
|
1274 |
$output .= "$indent</ul>\n";
|
1275 |
}
|
1276 |
|
1277 |
+
function start_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0) {
|
1278 |
extract($args);
|
1279 |
if ( empty($taxonomy) )
|
1280 |
$taxonomy = 'category';
|
1285 |
$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, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' '.$this->disabled.'/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
|
1286 |
}
|
1287 |
|
1288 |
+
function end_el(&$output, $category, $depth = 0, $args = array()) {
|
1289 |
$output .= "</li>\n";
|
1290 |
}
|
1291 |
}
|
1338 |
$rv[] = '</select>';
|
1339 |
return implode("<br/>/n",$rv);
|
1340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: axelseaa
|
3 |
Donate link: http://aaron.axelsen.us/donate
|
4 |
Tags: expire, posts, pages, schedule
|
5 |
-
Requires at least:
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 2.1.
|
8 |
|
9 |
Allows you to add an expiration date to posts which you can configure to either delete the post, change it to a draft, or update the
|
10 |
post categories.
|
@@ -48,6 +48,11 @@ This section describes how to install the plugin and get it working.
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
|
|
51 |
**Version 2.1.3**
|
52 |
|
53 |
* Fix: Default category selection now saves correctly on default settings screen
|
@@ -200,6 +205,11 @@ NOTE: After upgrading, you may need to reset the cron schedules. Following onsc
|
|
200 |
|
201 |
== Upgrade Notice ==
|
202 |
|
|
|
|
|
|
|
|
|
|
|
203 |
= 2.1.3 =
|
204 |
Default category selection now saves correctly on default settings screen
|
205 |
|
2 |
Contributors: axelseaa
|
3 |
Donate link: http://aaron.axelsen.us/donate
|
4 |
Tags: expire, posts, pages, schedule
|
5 |
+
Requires at least: 4.0
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 2.1.4
|
8 |
|
9 |
Allows you to add an expiration date to posts which you can configure to either delete the post, change it to a draft, or update the
|
10 |
post categories.
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
**Version 2.1.4**
|
52 |
+
|
53 |
+
* Fix: PHP Strict errors with 5.4+
|
54 |
+
* Fix: Removed temporary timezone conversion - now using core functions again
|
55 |
+
|
56 |
**Version 2.1.3**
|
57 |
|
58 |
* Fix: Default category selection now saves correctly on default settings screen
|
205 |
|
206 |
== Upgrade Notice ==
|
207 |
|
208 |
+
= 2.1.4 =
|
209 |
+
Fixed PHP Strict errors with 5.4+
|
210 |
+
Removed temporary timezone conversion functions
|
211 |
+
|
212 |
+
|
213 |
= 2.1.3 =
|
214 |
Default category selection now saves correctly on default settings screen
|
215 |
|