updated plugin Companion Auto Update
version 3.8.3
This commit is contained in:
parent
a3fd251a0c
commit
132b46b78f
@ -26,11 +26,11 @@ if( isset( $_POST['submit'] ) ) {
|
||||
$table_name = $wpdb->prefix . "auto_updates";
|
||||
|
||||
// Auto updater
|
||||
$plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : '';
|
||||
$themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : '';
|
||||
$minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : '';
|
||||
$major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : '';
|
||||
$translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : '';
|
||||
$plugins = isset( $_POST['plugins'] ) ? sanitize_text_field( $_POST['plugins'] ) : '';
|
||||
$themes = isset( $_POST['themes'] ) ? sanitize_text_field( $_POST['themes'] ) : '';
|
||||
$minor = isset( $_POST['minor'] ) ? sanitize_text_field( $_POST['minor'] ) : '';
|
||||
$major = isset( $_POST['major'] ) ? sanitize_text_field( $_POST['major'] ) : '';
|
||||
$translations = isset( $_POST['translations'] ) ? sanitize_text_field( $_POST['translations'] ) : '';
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugins'", $plugins ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'themes'", $themes ) );
|
||||
@ -56,13 +56,15 @@ if( isset( $_POST['submit'] ) ) {
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'dbupdateemails'", $dbupdateemails ) );
|
||||
|
||||
// Advanced
|
||||
$allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : '';
|
||||
$allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : '';
|
||||
$advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : '';
|
||||
$allow_editor = isset( $_POST['allow_editor'] ) ? sanitize_text_field( $_POST['allow_editor'] ) : '';
|
||||
$allow_author = isset( $_POST['allow_author'] ) ? sanitize_text_field( $_POST['allow_author'] ) : '';
|
||||
$advanced_info_emails = isset( $_POST['advanced_info_emails'] ) ? sanitize_text_field( $_POST['advanced_info_emails'] ) : '';
|
||||
$plugin_links_emails = isset( $_POST['plugin_links_emails'] ) ? sanitize_text_field( $_POST['plugin_links_emails'] ) : '';
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'allow_editor'", $allow_editor ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'allow_author'", $allow_author ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'advanced_info_emails'", $advanced_info_emails ) );
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'plugin_links_emails'", $plugin_links_emails ) );
|
||||
|
||||
// Delay
|
||||
$update_delay = isset( $_POST['update_delay'] ) ? sanitize_text_field( $_POST['update_delay'] ) : '';
|
||||
@ -79,8 +81,6 @@ if( isset( $_POST['submit'] ) ) {
|
||||
$core_sc = sanitize_text_field( $_POST['core_schedule'] );
|
||||
$schedule_mail = sanitize_text_field( $_POST['update_notifications'] );
|
||||
$outdated_notifier = sanitize_text_field( $_POST['outdated_notifier'] );
|
||||
$html_or_text = sanitize_text_field( $_POST['html_or_text'] );
|
||||
$dbupdateemails = sanitize_text_field( $_POST['dbupdateemails'] );
|
||||
|
||||
// First clear schedules
|
||||
wp_clear_scheduled_hook('wp_update_plugins');
|
||||
@ -218,7 +218,7 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
|
||||
|
||||
?>
|
||||
|
||||
<div class="cau-column-wide">
|
||||
<div class="cau-dashboard cau-column-wide">
|
||||
|
||||
<form method="POST">
|
||||
|
||||
@ -322,6 +322,9 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
|
||||
<p>
|
||||
<label for="advanced_info_emails"><input name="advanced_info_emails" type="checkbox" id="advanced_info_emails" <?php if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) { echo "CHECKED"; } ?>> <?php _e( 'Show the time of the update', 'companion-auto-update' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="plugin_links_emails"><input name="plugin_links_emails" type="checkbox" id="plugin_links_emails" <?php if( cau_get_db_value( 'plugin_links_emails' ) == 'on' ) { echo "CHECKED"; } ?>> <?php _e( 'Show links to WordPress.org pages', 'companion-auto-update' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -475,6 +478,8 @@ $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' );
|
||||
</div>
|
||||
<div class="cau_save_button__space"></div>
|
||||
|
||||
<script>jQuery( '.cau-dashboard input, .cau-dashboard select, .cau-dashboard textarea' ).on( 'change', function() { jQuery('.cau_save_button').addClass( 'fixed_button' ); } );</script>
|
||||
|
||||
</form>
|
||||
|
||||
</div><div class="cau-column-small">
|
||||
|
@ -113,22 +113,30 @@ select.schedule_interval {
|
||||
max-width: 90%;
|
||||
width: 225px;
|
||||
}
|
||||
.cau_save_button {
|
||||
.cau_save_button.fixed_button {
|
||||
background: #FFF;
|
||||
box-sizing: border-box;
|
||||
padding: 0 25px;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin-left: -25px;
|
||||
z-index: 1001;
|
||||
padding: 5px;
|
||||
box-shadow: 0 -8px 16px 0 rgb(85 93 102 / 30%);
|
||||
}
|
||||
.cau_save_button p.submit {
|
||||
.cau_save_button.fixed_button p.submit {
|
||||
display: block;
|
||||
text-align: right;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.cau_save_button.fixed_button p.submit input {
|
||||
width: 100%;
|
||||
max-width: 250px;
|
||||
height: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
.cau_save_button__space {
|
||||
height: 75px;
|
||||
|
@ -389,24 +389,37 @@ function cau_plugin_updated() {
|
||||
|
||||
foreach ( $pluginDates as $key => $value ) {
|
||||
|
||||
if( cau_get_db_value( 'html_or_text' ) == 'html' ) {
|
||||
|
||||
$more_info = '';
|
||||
if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) $more_info = "<br /><span style='opacity: 0.5;'>".__( "Time of update", "companion-auto-update" ).": ".$pluginTimes[$key]."</span>";
|
||||
|
||||
$updatedListP .= "<li>
|
||||
<strong>".$pluginNames[$key]." </strong><br />
|
||||
".__( "to version", "companion-auto-update" )." ".$pluginVersion[$key]." <a href='https://wordpress.org/plugins/".$pluginSlug[$key]."/#developers'>".__( "Release notes", "companion-auto-update" )."</a>
|
||||
".$more_info."
|
||||
</li>";
|
||||
|
||||
} else {
|
||||
|
||||
$updatedListP .= "- ".$pluginNames[$key]." ".__( "to version", "companion-auto-update" )." ".$pluginVersion[$key]."\n";
|
||||
$updatedListP .= " ".__( "Release notes", "companion-auto-update" ).": https://wordpress.org/plugins/".$pluginSlug[$key]."/#developers\n";
|
||||
// Set up some var
|
||||
$plugin_name = $pluginNames[$key];
|
||||
$plugin_slug = $pluginSlug[$key];
|
||||
$to_version = __( "to version", "companion-auto-update" ).' '.$pluginVersion[$key];
|
||||
$more_info_arr = array( __( "Time of update", "companion-auto-update" ) => $pluginTimes[$key] );
|
||||
|
||||
// Plugin links
|
||||
if( cau_get_db_value( 'plugin_links_emails' ) == 'on' ) {
|
||||
$more_info_arr[__( "Plugin details", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
|
||||
$more_info_arr[__( "Release notes", "companion-auto-update" )] = "<a href='https://wordpress.org/plugins/{$plugin_slug}/#developers'>".__( "Visit", "companion-auto-update" )."</a>";
|
||||
$more_info_arr[__( "Support", "companion-auto-update" )] = "<a href='https://wordpress.org/support/plugin/{$plugin_slug}/'>".__( "Visit", "companion-auto-update" )."</a>";
|
||||
}
|
||||
|
||||
// Email format
|
||||
$use_html = ( cau_get_db_value( 'html_or_text' ) == 'html' ) ? true : false;
|
||||
|
||||
// Email content
|
||||
$updatedListP .= $use_html ? "<li>" : "-"; // Start row
|
||||
|
||||
$updatedListP .= $use_html ? "<strong>{$plugin_name}</strong> " : "{$plugin_name} "; // Show plugin name
|
||||
$updatedListP .= $to_version; // To version
|
||||
|
||||
// Get advanced info
|
||||
if( cau_get_db_value( 'advanced_info_emails' ) == 'on' ) {
|
||||
foreach( $more_info_arr as $label => $value ) {
|
||||
$updatedListP .= $use_html ? "<br />{$label}: {$value}" : "\n{$label}: {$value}";
|
||||
}
|
||||
}
|
||||
|
||||
$updatedListP .= $use_html ? "</li>" : "\n"; // End row
|
||||
|
||||
$totalNumP++;
|
||||
}
|
||||
|
||||
|
@ -1027,6 +1027,10 @@ function cau_list_outdated() {
|
||||
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) {
|
||||
|
||||
$slug = $key;
|
||||
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Plugin Name: Companion Auto Update
|
||||
* Plugin URI: http://codeermeneer.nl/portfolio/companion-auto-update/
|
||||
* Description: This plugin auto updates all plugins, all themes and the wordpress core.
|
||||
* Version: 3.8.2
|
||||
* Version: 3.8.3
|
||||
* Author: Papin Schipper
|
||||
* Author URI: http://codeermeneer.nl/
|
||||
* Contributors: papin
|
||||
@ -79,7 +79,7 @@ function cau_donateUrl() {
|
||||
|
||||
// Database version
|
||||
function cau_db_version() {
|
||||
return '3.8.1';
|
||||
return '3.8.3';
|
||||
}
|
||||
function cau_database_creation() {
|
||||
|
||||
@ -179,6 +179,7 @@ function cau_install_data() {
|
||||
if( !cau_check_if_exists( 'advanced_info_emails' ) ) $wpdb->insert( $table_name, array( 'name' => 'advanced_info_emails', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'update_delay' ) ) $wpdb->insert( $table_name, array( 'name' => 'update_delay', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'update_delay_days' ) ) $wpdb->insert( $table_name, array( 'name' => 'update_delay_days', 'onoroff' => '' ) );
|
||||
if( !cau_check_if_exists( 'plugin_links_emails' ) ) $wpdb->insert( $table_name, array( 'name' => 'plugin_links_emails', 'onoroff' => '' ) );
|
||||
|
||||
}
|
||||
register_activation_hook( __FILE__, 'cau_install' );
|
||||
|
@ -3,9 +3,9 @@ Contributors: Papin, qweb
|
||||
Donate link: https://www.paypal.me/dakel/10/
|
||||
Tags: auto, automatic, background, update, updates, updating, automatic updates, automatic background updates, easy update, wordpress update, theme update, plugin update, up-to-date, security, update latest version, update core, update wp, update wp core, major updates, minor updates, update to new version, update core, update plugin, update plugins, update plugins automatically, update theme, plugin, theme, advance, control, mail, notifations, enable
|
||||
Requires at least: 3.6.0
|
||||
Tested up to: 5.7
|
||||
Tested up to: 5.9
|
||||
Requires PHP: 5.1
|
||||
Stable tag: 3.8.2
|
||||
Stable tag: 3.8.3
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@ -81,6 +81,11 @@ So obviously, some of you wondered what the difference would be between the defa
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.8.3 (December 9, 2021) =
|
||||
* New: Plugin update e-mails now have an option to link to a few important pages
|
||||
* Fix: Error: Undefined index: dbupdateemails
|
||||
* Fix: Error: A non-numeric value encountered
|
||||
|
||||
= 3.8.2 (July 1, 2021) =
|
||||
* Fix: Error: Call to undefined function get_plugin_updates()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user