updated plugin Companion Auto Update version 3.8.3

This commit is contained in:
2021-12-20 13:41:55 +00:00
committed by Gitium
parent a3fd251a0c
commit 132b46b78f
10 changed files with 2776 additions and 2733 deletions

View File

@ -1026,6 +1026,10 @@ function cau_list_outdated() {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if( !function_exists( 'plugins_api' ) ) {
require_once( ABSPATH.'wp-admin/includes/plugin-install.php' );
}
foreach ( get_plugins() as $key => $value) {
@ -1037,17 +1041,24 @@ function cau_list_outdated() {
foreach ( $value as $k => $v ) if( $k == "Name" ) $name = $v;
// Get plugins tested up to version
if( !function_exists( 'plugins_api' ) ) require_once( ABSPATH.'wp-admin/includes/plugin-install.php' );
$api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $actualSlug ) ) );
$api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $actualSlug ), 'tested' => true ) );
// Version compare
$tested_version = substr( $api->tested, 0, 3 ); // Format version number
$current_version = substr( get_bloginfo( 'version' ), 0, 3 ); // Format version number
$version_difference = ($current_version - $tested_version); // Get the difference
// $tested_wp = ( empty( $api->tested ) || cau_version_compare( get_bloginfo( 'version' ), $api->tested, '<' ) );
if( $version_difference >= '0.3' ) {
$outdatedList[$name] = substr( $api->tested, 0, 3 );
// Check if "tested up to" version number is set
if( $tested_version != '' ) {
$current_version = substr( get_bloginfo( 'version' ), 0, 3 ); // Format version number
$version_difference = ( (int)$current_version - (int)$tested_version ); // Get the difference
// $tested_wp = ( empty( $api->tested ) || cau_version_compare( get_bloginfo( 'version' ), $api->tested, '<' ) );
if( $version_difference >= '0.3' ) {
$outdatedList[$name] = substr( $api->tested, 0, 3 );
}
} else {
$outdatedList[$name] = ''; // We'll catch this when sending the e-mail
}
}