Changeset 3088341
- Timestamp:
- 05/17/2024 01:11:42 PM (19 months ago)
- Location:
- auto-post-expiration/trunk
- Files:
-
- 1 added
- 3 edited
-
admin/css/style.css (added)
-
auto-post-expiration.php (modified) (7 diffs)
-
auto-post-expire-options.php (modified) (13 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
auto-post-expiration/trunk/auto-post-expiration.php
r3025630 r3088341 4 4 * Plugin URI: https://wordpress.org/plugins/auto-post-expiration/ 5 5 * Description: This simple plugin allows to set expiry date of post and it set post to "draft" status automatic on desire expire date. 6 * Version: 2.0.06 * Version:3.0.0 7 7 * Author: VIITORCLOUD 8 8 * Author URI: https://viitorcloud.com/ … … 39 39 * 40 40 * @package Auto Post Expiration 41 * @since 1.0.041 * @since 3.0.0 42 42 */ 43 43 load_plugin_textdomain( 'auto_post_exp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); … … 48 48 * 49 49 * @package Auto Post Expiration 50 *@since 1.0.050 *@since 3.0.0 51 51 */ 52 52 register_activation_hook( __FILE__, 'auto_post_exp_install' ); … … 58 58 * 59 59 * @package Auto Post Expiration 60 * @since 1.0.060 * @since 3.0.0 61 61 */ 62 62 register_deactivation_hook( __FILE__, 'auto_post_exp_uninstall' ); … … 69 69 * 70 70 * @package Auto Post Expiration 71 * @since 1.0.071 * @since 3.0.0 72 72 */ 73 73 function auto_post_exp_install() { … … 82 82 * 83 83 * @package Auto Post Expiration 84 * @since 1.0.084 * @since 3.0.0 85 85 */ 86 86 function auto_post_exp_uninstall() { … … 95 95 * 96 96 * @package Auto Post Expiration 97 * @since 1.0.097 * @since 3.0.0 98 98 */ 99 99 -
auto-post-expiration/trunk/auto-post-expire-options.php
r3025630 r3088341 30 30 * 31 31 * @package Auto_Post_Expiration 32 * @since 1.0.032 * @since 3.0.0 33 33 * 34 34 * @param int $post_id The ID of the post. … … 37 37 */ 38 38 function auto_post_exp_cal_datetime( $post_id ) { 39 39 // Get the WordPress timezone string or offset. 40 40 $tz = get_option( 'timezone_string' ); 41 // Change the line below to your timezone! 42 date_default_timezone_set( $tz ); 43 $field_date = get_post_meta( $post_id, '_expire_date', true ); 44 $first_date = new DateTime( current_time( 'mysql' ) ); 45 $second_date = new DateTime( $field_date ); 46 $interval = $first_date->diff( $second_date ); 41 if ( empty( $tz ) ) { 42 // If timezone string is empty, fallback to the offset. 43 $offset = get_option( 'gmt_offset' ); 44 $tz = $offset ? sprintf( 'Etc/GMT%+d', $offset ) : 'UTC'; 45 } 46 // Get the current time and the expiration time from the post meta. 47 $field_date = get_post_meta( $post_id, '_expire_date', true ); 48 $current_time = current_time( 'mysql' ); 49 // Create DateTime objects using the timezone. 50 $first_date = new DateTime( $current_time, new DateTimeZone( $tz ) ); 51 $second_date = new DateTime( $field_date, new DateTimeZone( $tz ) ); 52 // Calculate the interval and return the invert property. 53 $interval = $first_date->diff( $second_date ); 47 54 return $interval->invert; 48 55 } … … 53 60 * 54 61 * @package Auto_Post_Expiration 55 * @since 1.0.062 * @since 3.0.0 56 63 */ 57 64 add_action( 'auto_post_exp_add_every_three_minutes', 'auto_post_exp_every_three_minutes_event_func' ); … … 60 67 * 61 68 * @package Auto_Post_Expiration 62 * @since 1.0.069 * @since 3.0.0 63 70 */ 64 71 function auto_post_exp_every_three_minutes_event_func() { … … 97 104 * 98 105 * @package Auto Post Expiration 99 * @since 1.0.0106 * @since 3.0.0 100 107 * @param WP_Post $post The post object. 101 108 */ … … 118 125 * 119 126 * @package Auto_Post_Expiration 120 * @since 1.0.0127 * @since 3.0.0 121 128 */ 122 129 function auto_post_exp_add_datepicker_scripts() { … … 125 132 plugin_dir_url( __FILE__ ) . 'admin/datetime/css/jquery.datetimepicker.min.css', 126 133 array(), 127 '2.0.0', 134 '3.0.0', 135 'all' 136 ); 137 wp_enqueue_style( 138 'vc-styles', 139 plugin_dir_url( __FILE__ ) . 'admin/css/style.css', 140 array(), 141 '3.0.0', 128 142 'all' 129 143 ); … … 132 146 plugin_dir_url( __FILE__ ) . 'admin/datetime/js/jquery.datetimepicker.js', 133 147 array( 'jquery' ), 134 ' 2.0.0',148 '3.0.0', 135 149 true 136 150 ); … … 139 153 plugin_dir_url( __FILE__ ) . 'admin/js/custom.js', 140 154 array( 'jquery' ), 141 ' 2.0.0',155 '3.0.0', 142 156 true 143 157 ); … … 148 162 * 149 163 * @package Auto Post Expiration 150 * @since 1.0.0164 * @since 3.0.0 151 165 * @param WP_Post $post The post object. 152 166 */ … … 157 171 158 172 $passed_date = get_post_meta( $post->ID, '_expire_date', true ); 159 echo '<input type="text" name="expire_date" id="expire_date" size="35" value="' . esc_attr( $passed_date ) . '"173 echo '<input type="text" name="expire_date" id="expire_date" class="date-vc" size="35" value="' . esc_attr( $passed_date ) . '" 160 174 readonly>'; 161 175 } … … 166 180 * 167 181 * @package Auto_Post_Expiration 168 * @since 1.0.0182 * @since 3.0.0 169 183 * 170 184 * @param int $post_id The ID of the post. … … 214 228 ** create custom column 215 229 * @package Auto Post Expiration 216 * @since 1.0.0230 * @since 3.0.0 217 231 */ 218 232 -
auto-post-expiration/trunk/readme.txt
r3025630 r3088341 4 4 Tags: post_expire, expire, expiration, expire_post, expire_event, post_expire_date, schedule_post, post_draft, set_post_expire 5 5 Requires at least: 3.8 6 Tested up to: 6. 4.27 Requires PHP: 5.2.48 Stable tag: 1.0.06 Tested up to: 6.5.3 7 Requires PHP: 7.4.0 8 Stable tag: 6.5.3 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html
Note: See TracChangeset
for help on using the changeset viewer.