'.__( 'Companion Auto Update was not able to set the event for sending you emails, please re-activate the plugin in order to set the event', 'companion-auto-update' ).'.

'; } // Database requires an update if ( cau_incorrectDatabaseVersion() ) { echo '

'.__( 'Companion Auto Update Database Update', 'companion-auto-update' ).' – '.__( 'We need you to update to the latest database version', 'companion-auto-update' ).'. '.__( 'Run updater now', 'companion-auto-update' ).'

'; } // Update log DB is empty if ( cau_updateLogDBisEmpty() ) { echo '

'.__( 'Companion Auto Update Database Update', 'companion-auto-update' ).' – '.__( 'We need to add some information to your database', 'companion-auto-update' ).'. '.__( 'Run updater now', 'companion-auto-update' ).'

'; } // Save settings if( isset( $_POST['submit'] ) ) { check_admin_referer( 'cau_save_settings' ); global $wpdb; $table_name = $wpdb->prefix . "auto_updates"; // Auto updater if( isset( $_POST['plugins'] ) ) $plugins = sanitize_text_field( $_POST['plugins'] ); else $plugins = ''; if( isset( $_POST['themes'] ) ) $themes = sanitize_text_field( $_POST['themes'] ); else $themes = ''; if( isset( $_POST['minor'] ) ) $minor = sanitize_text_field( $_POST['minor'] ); else $minor = ''; if( isset( $_POST['major'] ) ) $major = sanitize_text_field( $_POST['major'] ); else $major = ''; if( isset( $_POST['translations'] ) ) $translations = sanitize_text_field( $_POST['translations'] ); else $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 ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'minor'", $minor ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'major'", $major ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'translations'", $translations ) ); // Emails if( isset( $_POST['cau_send'] ) ) $send = sanitize_text_field( $_POST['cau_send'] ); else $send = ''; if( isset( $_POST['cau_send_update'] ) ) $sendupdate = sanitize_text_field( $_POST['cau_send_update'] ); else $sendupdate = ''; if( isset( $_POST['cau_send_outdated'] ) ) $sendoutdated = sanitize_text_field( $_POST['cau_send_outdated'] ); else $sendoutdated = ''; if( isset( $_POST['wpemails'] ) ) $wpemails = sanitize_text_field( $_POST['wpemails'] ); else $wpemails = ''; if( isset( $_POST['cau_email'] ) ) $email = sanitize_text_field( $_POST['cau_email'] ); if( isset( $_POST['html_or_text'] ) ) $html_or_text = sanitize_text_field( $_POST['html_or_text'] ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'email'", $email ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'send'", $send ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'sendupdate'", $sendupdate ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'sendoutdated'", $sendoutdated ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'wpemails'", $wpemails ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'html_or_text'", $html_or_text ) ); // Advanced if( isset( $_POST['allow_editor'] ) ) $allow_editor = sanitize_text_field( $_POST['allow_editor'] ); else $allow_editor = ''; if( isset( $_POST['allow_author'] ) ) $allow_author = sanitize_text_field( $_POST['allow_author'] ); else $allow_author = ''; if( isset( $_POST['advanced_info_emails'] ) ) $advanced_info_emails = sanitize_text_field( $_POST['advanced_info_emails'] ); else $advanced_info_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 ) ); // Delay if( isset( $_POST['update_delay'] ) ) $update_delay = sanitize_text_field( $_POST['update_delay'] ); else $update_delay = ''; if( isset( $_POST['update_delay_days'] ) ) $update_delay_days = sanitize_text_field( $_POST['update_delay_days'] ); else $update_delay_days = ''; $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay'", $update_delay ) ); $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'update_delay_days'", $update_delay_days ) ); // 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['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'); wp_clear_scheduled_hook('wp_update_themes'); wp_clear_scheduled_hook('wp_version_check'); wp_clear_scheduled_hook('cau_set_schedule_mail'); 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 // Plugins if( $plugin_sc == 'daily' ) { $date = date( 'Y-m-d' ); $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 ); wp_schedule_event( $pluginSetTime, $plugin_sc, 'wp_update_plugins' ); wp_schedule_event( $pluginSetTime, $plugin_sc, 'cau_custom_hooks_plugins' ); wp_schedule_event( ( $pluginSetTime - 1800 ), $plugin_sc, 'cau_log_updater' ); } else { wp_schedule_event( time(), $plugin_sc, 'wp_update_plugins' ); wp_schedule_event( time(), $plugin_sc, 'cau_custom_hooks_plugins' ); wp_schedule_event( ( time() - 1800 ), $plugin_sc, 'cau_log_updater' ); } // Themes if( $theme_sc == 'daily' ) { $dateT = date( 'Y-m-d' ); $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 ); wp_schedule_event( $themeSetTime, $theme_sc, 'wp_update_themes' ); wp_schedule_event( $themeSetTime, $theme_sc, 'cau_custom_hooks_themes' ); } else { wp_schedule_event( time(), $theme_sc, 'wp_update_themes' ); wp_schedule_event( time(), $theme_sc, 'cau_custom_hooks_themes' ); } // Core if( $core_sc == 'daily' ) { $dateC = date( 'Y-m-d' ); $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 ); wp_schedule_event( $coreSetTime, $core_sc, 'wp_version_check' ); } else { wp_schedule_event( time(), $core_sc, 'wp_version_check' ); } // Update notifications if( $schedule_mail == 'daily' ) { $dateT = date( 'Y-m-d' ); $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 ); wp_schedule_event( $emailSetTime, $schedule_mail, 'cau_set_schedule_mail' ); } else { wp_schedule_event( time(), $schedule_mail, 'cau_set_schedule_mail' ); } // 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.' ).'

'; } if( isset( $_GET['welcome'] ) ) { echo '

'.__( 'Welcome to Companion Auto Update', 'companion-auto-update' ).'


'.__( 'You\'re set and ready to go', 'companion-auto-update' ).'

'.__( 'The plugin is all set and ready to go with the recommended settings, but if you\'d like you can change them below.' ).'


'.__( 'Get Started' ).': '.__( 'Update filter', 'companion-auto-update' ).'   |   '.__( 'More Actions' ).': '.__('Give feedback', 'companion-auto-update').' - '.__( 'Help us translate', 'companion-auto-update' ).'

'; } $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(); ?>

'; echo '

'; echo '

'; echo '

'; echo '

'; ?>

"; echo ""; echo "

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

>

You get useful software and we get to carry on making it better.', 'companion-auto-update'); ?>

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