Plugin Directory

Changeset 2045313


Ignore:
Timestamp:
03/06/2019 02:34:42 PM (7 years ago)
Author:
X-NicON
Message:

fix small bugs

Location:
wp-post-expires/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-post-expires/trunk/readme.txt

    r2045296 r2045313  
    55Requires at least: 5.0
    66Tested up to: 5.1
    7 Stable tag: 1.2
     7Stable tag: 1.2.1
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4242== Changelog ==
    4343
     44= 1.2.1 =
     45
     46Small fixes:
     47https://wordpress.org/support/topic/fatal-error-3074/ ( tnx @marknopfler )
     48https://wordpress.org/support/topic/fix-js-and-php-error/ ( tnx @lastant )
     49
     50
    4451= 1.2 =
    4552
  • wp-post-expires/trunk/wp-post-expires.php

    r2045296 r2045313  
    33Plugin Name: WP Post Expires
    44Description: A simple plugin allow to set the posts, the time after which will be performed one of 3 actions: "Add prefix to title", "Move to drafts", "Move to trash".
    5 Version:     1.2
     5Version:     1.2.1
    66Author:      XNicON
    77Author URI:  https://xnicon.ru
     
    2828
    2929class XNPostExpires {
    30     private $plugin_version = '1.2';
     30    private $plugin_version = '1.2.1';
    3131    private $url_assets;
    3232    public $settings = [];
     
    247247                    $del_post = wp_trash_post($post_id);
    248248                    //check post to trash, or deleted
    249                     if($del_post['post_status'] == 'trash') {
     249                    if($del_post !== false) {
    250250                        update_post_meta($post_id, 'xn-wppe-expiration-action', 'add_prefix');
    251251                        update_post_meta($post_id, 'xn-wppe-expiration-prefix', $this->settings['prefix']);
     
    271271            $current = new DateTime();
    272272            $current->setTimestamp(current_time('timestamp'));
    273             $expiration = new DateTime($expires);
    274 
    275             if($current >= $expiration) {
     273            $expiration = DateTime::createFromFormat('Y-m-d H:i', $expires);
     274
     275            if($expiration && $expiration->format('Y-m-d H:i') == $expires && $current >= $expiration) {
    276276                return true;
    277277            }
Note: See TracChangeset for help on using the changeset viewer.