'.__( '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 $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 ) ); $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 $send = isset( $_POST['cau_send'] ) ? sanitize_text_field( $_POST['cau_send'] ) : ''; $sendupdate = isset( $_POST['cau_send_update'] ) ? sanitize_text_field( $_POST['cau_send_update'] ) : ''; $sendoutdated = isset( $_POST['cau_send_outdated'] ) ? sanitize_text_field( $_POST['cau_send_outdated'] ) : ''; $wpemails = isset( $_POST['wpemails'] ) ? sanitize_text_field( $_POST['wpemails'] ) : ''; $email = isset( $_POST['cau_email'] ) ? sanitize_text_field( $_POST['cau_email'] ) : ''; $html_or_text = isset( $_POST['html_or_text'] ) ? sanitize_text_field( $_POST['html_or_text'] ) : 'html'; $dbupdateemails = isset( $_POST['dbupdateemails'] ) ? sanitize_text_field( $_POST['dbupdateemails'] ) : ''; $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 ) ); $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'] ) : ''; $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'] ) : ''; $update_delay_days = isset( $_POST['update_delay_days'] ) ? sanitize_text_field( $_POST['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'] ); // 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' ).'

'; } $cs_hooks_p = wp_get_schedule( 'cau_custom_hooks_plugins' ); $cs_hooks_t = wp_get_schedule( 'cau_custom_hooks_themes' ); ?>

'; 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