Plugin Directory

Changeset 3104434

Timestamp:
06/19/2024 09:33:38 AM (4 weeks ago)
Author:
markhowellsmead
Message:

Remove manual compatibility checks

Location:
mhm-list-postthumbnail/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mhm-list-postthumbnail/trunk/README.txt

    r3097983 r3104434  
    22Contributors: markhowellsmead
    33Donate link: https://www.paypal.me/mhmli
    4 Tags: wp-admin, list, thumbnail, post thumbnail, sayhellogmbh
     4Tags: , thumbnail, post thumbnail, sayhellogmbh
    55Requires at least: 4.0
    6 Tested up to: 6.5.3
     6Tested up to: 6.5.
    77Stable tag: trunk
    88License: GPLv3
     
    2525
    2626== Changelog ==
     27
     28
     29
     30
    2731
    2832= 1.3.3 =
  • mhm-list-postthumbnail/trunk/index.php

    r3097983 r3104434  
    44Plugin URI: https://wordpress.org/plugins/mhm-list-postthumbnail/
    55Description: Adds a new column to the WordPress admin post list view, containing a thumbnail-sized preview of the post thumbnail (where available).
    6 Version: 1.3.3
     6Version: 1.3.
    77Requires at least: 4.0
    88Requires PHP: 5.6
     
    1717{
    1818
    19     public $version   = '1.3.3';
    20     public $wpversion = '4.0';
    2119    private $excluded_posttypes = [];
    2220
    2321    public function __construct()
    2422    {
    25         register_activation_hook(__FILE__, array($this, 'checkVersion'));
    26         add_action('admin_init', array($this, 'checkVersion'));
    2723        add_action('plugins_loaded', array($this, 'loadTextdomain'));
    2824        add_filter('manage_posts_columns', array($this, 'adminColumnHeader'), 20);
    2925        add_action('manage_posts_custom_column', array($this, 'adminColumnContent'), 5, 2);
    30     }
    31 
    32     public function checkVersion()
    33     {
    34         // Check that this plugin is compatible with the current version of WordPress
    35         if (!$this->compatibleVersion()) {
    36             if (is_plugin_active(plugin_basename(__FILE__))) {
    37                 deactivate_plugins(plugin_basename(__FILE__));
    38                 add_action('admin_notices', array($this, 'disabledNotice'));
    39                 if (isset($_GET['activate'])) {
    40                     unset($_GET['activate']);
    41                 }
    42             }
    43         }
    44     }
    45 
    46     public function disabledNotice()
    47     {
    48         echo '<div class="notice notice-error is-dismissible">
    49             <p>' . sprintf(
    50             _x('The plugin “%1$s” requires WordPress %2$s or higher!', 'Compatibility warning message on activation', 'mhm-list-postthumbnail'),
    51             _x('Post thumbnail in Post admin list', 'Plugin name in compatibility warning message', 'mhm-list-postthumbnail'),
    52             $this->wpversion
    53         ) . '</p>
    54         </div>';
    55     }
    56 
    57     private function compatibleVersion()
    58     {
    59         if (version_compare($GLOBALS['wp_version'], $this->wpversion, '<')) {
    60             return false;
    61         }
    62 
    63         return true;
    6426    }
    6527
Note: See TracChangeset for help on using the changeset viewer.