From 93745b9ce4ebfc7f00dc9819c047cf7dcfebb61f Mon Sep 17 00:00:00 2001 From: Lai Power Date: Sun, 17 Jan 2021 21:29:01 +0000 Subject: [PATCH] updated plugin `Companion Auto Update` version 3.8.0 --- .../companion-auto-update/admin/dashboard.php | 333 ++++++++---------- .../companion-auto-update/admin/status.php | 7 +- .../companion-auto-update/backend/style.css | 3 +- .../companion-auto-update/cau_emails.php | 20 +- .../companion-auto-update/cau_functions.php | 79 ++++- .../companion-auto-update.php | 37 +- .../plugins/companion-auto-update/readme.txt | 9 +- 7 files changed, 264 insertions(+), 224 deletions(-) diff --git a/wp-content/plugins/companion-auto-update/admin/dashboard.php b/wp-content/plugins/companion-auto-update/admin/dashboard.php index 8794f03..18253c7 100644 --- a/wp-content/plugins/companion-auto-update/admin/dashboard.php +++ b/wp-content/plugins/companion-auto-update/admin/dashboard.php @@ -70,11 +70,12 @@ if( isset( $_POST['submit'] ) ) { // Intervals // Set variables - $plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] ); - $theme_sc = sanitize_text_field( $_POST['theme_schedule'] ); - $core_sc = sanitize_text_field( $_POST['core_schedule'] ); - $schedule_mail = sanitize_text_field( $_POST['schedule_mail'] ); - $html_or_text = sanitize_text_field( $_POST['html_or_text'] ); + $plugin_sc = sanitize_text_field( $_POST['plugin_schedule'] ); + $theme_sc = sanitize_text_field( $_POST['theme_schedule'] ); + $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'] ); // First clear schedules wp_clear_scheduled_hook('wp_update_plugins'); @@ -84,6 +85,7 @@ if( isset( $_POST['submit'] ) ) { wp_clear_scheduled_hook('cau_custom_hooks_plugins'); wp_clear_scheduled_hook('cau_custom_hooks_themes'); wp_clear_scheduled_hook('cau_log_updater'); + wp_clear_scheduled_hook('cau_outdated_notifier'); // Then set the new times @@ -91,8 +93,8 @@ if( isset( $_POST['submit'] ) ) { if( $plugin_sc == 'daily' ) { $date = date( 'Y-m-d' ); - $hours = sanitize_text_field( $_POST['pluginScheduleTimeH'] ); - $minutes = sanitize_text_field( $_POST['pluginScheduleTimeM'] ); + $hours = sanitize_text_field( $_POST['plugin_schedule-sethour'] ); + $minutes = sanitize_text_field( $_POST['plugin_schedule-setminutes'] ); $seconds = date( 's' ); $fullDate = $date.' '.$hours.':'.$minutes.':'.$seconds; $pluginSetTime = strtotime( $fullDate ); @@ -113,8 +115,8 @@ if( isset( $_POST['submit'] ) ) { if( $theme_sc == 'daily' ) { $dateT = date( 'Y-m-d' ); - $hoursT = sanitize_text_field( $_POST['ThemeScheduleTimeH'] ); - $minutesT = sanitize_text_field( $_POST['ThemeScheduleTimeM'] ); + $hoursT = sanitize_text_field( $_POST['theme_schedule-sethour'] ); + $minutesT = sanitize_text_field( $_POST['theme_schedule-setminutes'] ); $secondsT = date( 's' ); $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT; $themeSetTime = strtotime( $fullDateT ); @@ -133,8 +135,8 @@ if( isset( $_POST['submit'] ) ) { if( $core_sc == 'daily' ) { $dateC = date( 'Y-m-d' ); - $hoursC = sanitize_text_field( $_POST['CoreScheduleTimeH'] ); - $minutesC = sanitize_text_field( $_POST['CoreScheduleTimeM'] ); + $hoursC = sanitize_text_field( $_POST['core_schedule-sethour'] ); + $minutesC = sanitize_text_field( $_POST['core_schedule-setminutes'] ); $secondsC = date( 's' ); $fullDateC = $dateC.' '.$hoursC.':'.$minutesC.':'.$secondsC; $coreSetTime = strtotime( $fullDateC ); @@ -147,12 +149,12 @@ if( isset( $_POST['submit'] ) ) { } - // Emails + // Update notifications if( $schedule_mail == 'daily' ) { $dateT = date( 'Y-m-d' ); - $hoursT = sanitize_text_field( $_POST['timeScheduleEmailTimeH'] ); - $minutesT = sanitize_text_field( $_POST['timeScheduleEmailTimeM'] ); + $hoursT = sanitize_text_field( $_POST['update_notifications-sethour'] ); + $minutesT = sanitize_text_field( $_POST['update_notifications-setminutes'] ); $secondsT = date( 's' ); $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT; $emailSetTime = strtotime( $fullDateT ); @@ -165,6 +167,25 @@ if( isset( $_POST['submit'] ) ) { } + // Outdated notifications + if( $outdated_notifier == 'daily' ) { + + $dateT = date( 'Y-m-d' ); + $hoursT = sanitize_text_field( $_POST['outdated_notifier-sethour'] ); + $minutesT = sanitize_text_field( $_POST['outdated_notifier-setminutes'] ); + $secondsT = date( 's' ); + $fullDateT = $dateT.' '.$hoursT.':'.$minutesT.':'.$secondsT; + $emailSetTime = strtotime( $fullDateT ); + + wp_schedule_event( $emailSetTime, $outdated_notifier, 'cau_outdated_notifier' ); + + } else { + + wp_schedule_event( time(), $outdated_notifier, 'cau_outdated_notifier' ); + + } + + echo '

'.__( 'Settings saved.' ).'

'; } @@ -191,6 +212,7 @@ $plugin_schedule = wp_get_schedule( 'wp_update_plugins' ); $theme_schedule = wp_get_schedule( 'wp_update_themes' ); $core_schedule = wp_get_schedule( 'wp_version_check' ); $schedule_mail = wp_get_schedule( 'cau_set_schedule_mail' ); +$outdated_notifier = wp_get_schedule( 'cau_outdated_notifier' ); $cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' ); $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' ); $availableIntervals = cau_wp_get_schedules(); @@ -252,21 +274,16 @@ $availableIntervals = cau_wp_get_schedules(); - - - - - + @@ -274,12 +291,12 @@ $availableIntervals = cau_wp_get_schedules(); - + > @@ -548,7 +506,14 @@ $availableIntervals = cau_wp_get_schedules(); -

Donations via PayPal. Amount can be changed.

+

+ + +
+

Plugin Promotion

+

Keep your site fast with our Revision Manager

+

Post Revisions are great, but will also slow down your site. Take back control over revisions with Companion Revision Manager!

+ Read more
@@ -565,50 +530,28 @@ $availableIntervals = cau_wp_get_schedules(); jQuery( '#update_delay_days_block' ).toggleClass( 'disabled_option' ); }); - jQuery( '#plugin_schedule' ).change( function() { + jQuery( '.interval_scheduler' ).change( function() { - var selected = jQuery(this).val(); + var selected = jQuery(this).val(); // Selected value + var timeblock = jQuery(this).data( 'timeblock' ); // Corresponding time block if( selected == 'daily' ) { - jQuery('.timeSchedulePlugins').show(); + jQuery( '.timeblock-'+timeblock ).show(); } else { - jQuery('.timeSchedulePlugins').hide(); + jQuery( '.timeblock-'+timeblock ).hide(); } }); - jQuery( '#theme_schedule' ).change( function() { + jQuery( '.interval_scheduler' ).each( function() { - var selected = jQuery(this).val(); + var selected = jQuery(this).val(); // Selected value + var timeblock = jQuery(this).data( 'timeblock' ); // Corresponding time block if( selected == 'daily' ) { - jQuery('.timeScheduleThemes').show(); + jQuery( '.timeblock-'+timeblock ).show(); } else { - jQuery('.timeScheduleThemes').hide(); - } - - }); - - jQuery( '#core_schedule' ).change( function() { - - var selected = jQuery(this).val(); - - if( selected == 'daily' ) { - jQuery('.timeScheduleCore').show(); - } else { - jQuery('.timeScheduleCore').hide(); - } - - }); - - jQuery( '#schedule_mail' ).change( function() { - - var selected = jQuery(this).val(); - - if( selected == 'daily' ) { - jQuery('.timeScheduleEmail').show(); - } else { - jQuery('.timeScheduleEmail').hide(); + jQuery( '.timeblock-'+timeblock ).hide(); } }); diff --git a/wp-content/plugins/companion-auto-update/admin/status.php b/wp-content/plugins/companion-auto-update/admin/status.php index f28ee19..fae6a14 100644 --- a/wp-content/plugins/companion-auto-update/admin/status.php +++ b/wp-content/plugins/companion-auto-update/admin/status.php @@ -36,6 +36,7 @@ global $wpdb; $table_name = $wpdb->prefix . "auto_updates"; $schedules = wp_get_schedules(); + $interval_names = cau_wp_get_schedules(); ?> @@ -75,7 +76,7 @@ $__status = 'enabled'; $__icon = 'yes-alt'; $__text = __( 'Enabled', 'companion-auto-update' ); - $__interval = wp_get_schedule( $eventNames[$key] ); + $__interval = $interval_names[wp_get_schedule( $eventNames[$key] )]; $__next = date_i18n( $dateFormat, wp_next_scheduled( $eventNames[$key] ) ); } else { $__status = 'disabled'; @@ -132,7 +133,7 @@ $__status = 'enabled'; $__icon = 'yes-alt'; $__text = __( 'Enabled', 'companion-auto-update' ); - $__interval = wp_get_schedule( $other_eventNames[$key] ); + $__interval = $interval_names[wp_get_schedule( $other_eventNames[$key] )]; $__next = date_i18n( $dateFormat, wp_next_scheduled( $other_eventNames[$key] ) ); } else { $__status = 'warning'; @@ -322,7 +323,7 @@
-

- /> - -

-

/>

+

+ /> + +

/> - +

@@ -330,142 +347,83 @@ $availableIntervals = cau_wp_get_schedules();

-

- -
+

+ + "; + echo ""; + echo "

"; + + // Set the time when daily is selected + echo ""; + + } + + ?> + +

-

- -

-
> - - - -
- -
- : -
- -
- - daily.', 'companion-auto-update'); ?> - - -
- -
- -
- -

-

- -

-
> - - - -
- -
- : -
- -
- - daily.', 'companion-auto-update'); ?> - - -
-
- -
- -

-

- -

-
> - - - -
- -
- : -
- -
- - daily.', 'companion-auto-update'); ?> - - -
-
- -
- -

-

- -

-
> - - - -
- -
- : -
- -
- - - -
-
+
+ +
+ +

+ + +
+ +
+ +

+ + +
+ +
+ +

+ + +
+ +
+ +

+ + +
+
@@ -477,15 +435,15 @@ $availableIntervals = cau_wp_get_schedules();
-

-

-

+

+

+

-

+

-
Toggle
+