WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/12/2019 11:55:19 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Plugins: Introduce is_wp_version_compatible() and is_php_version_compatible() for checking compatibility with the current WordPress or PHP version.

Props afragen.
Fixes #46599.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    r45043 r45185  
    503503            }
    504504
    505             $wp_version = get_bloginfo( 'version' );
    506 
    507             $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) );
    508             $tested_wp      = ( empty( $plugin['tested'] ) || version_compare( $wp_version, $plugin['tested'], '<=' ) );
    509             $compatible_wp  = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) );
     505            $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
     506            $requires_wp  = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
     507
     508            $compatible_php = is_php_version_compatible( $requires_php );
     509            $compatible_wp  = is_wp_version_compatible( $requires_wp );
     510            $tested_wp      = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) );
    510511
    511512            $action_links = array();
Note: See TracChangeset for help on using the changeset viewer.