lse $time['start_time']['current_day'] = "00:00"; $time['type']=$schedule_value['type']; $next_timestamp = WPvivid_Schedule_addon::get_start_time($time); } $current_timestamp = time(); if ($current_timestamp - $next_timestamp >= 86400) { echo '

' . esc_html__('We have detected that a backup was not triggered as scheduled. Please check whether your server-level cron is working properly.', 'wpvivid-backup-pro') . '

'; break; } } } } } public function check_extensions() { $common_setting = get_option('wpvivid_common_setting'); $db_connect_method = isset($common_setting['options']['wpvivid_common_setting']['db_connect_method']) ? $common_setting['options']['wpvivid_common_setting']['db_connect_method'] : 'wpdb'; $need_php_extensions = array(); $need_extensions_count = 0; $extensions=get_loaded_extensions(); if(!function_exists("curl_init")){ $need_php_extensions[$need_extensions_count] = 'curl'; $need_extensions_count++; } if(!class_exists('PDO')){ $need_php_extensions[$need_extensions_count] = 'PDO'; $need_extensions_count++; } if(!function_exists("gzopen")) { $need_php_extensions[$need_extensions_count] = 'zlib'; $need_extensions_count++; } if(!array_search('pdo_mysql',$extensions) && $db_connect_method === 'pdo') { $need_php_extensions[$need_extensions_count] = 'pdo_mysql'; $need_extensions_count++; } if(!array_search('mbstring',$extensions)) { $need_php_extensions[$need_extensions_count] = 'mbstring'; $need_extensions_count++; } if(!empty($need_php_extensions)){ $msg = ''; $figure = 0; foreach ($need_php_extensions as $extension){ $figure++; if($figure == 1){ $msg .= $extension; } else if($figure < $need_extensions_count) { $msg .= ', '.$extension; } else if($figure == $need_extensions_count){ $msg .= ' and '.$extension; } } if($figure == 1){ echo '

'.sprintf(__('The %s extension is not detected. Please install the extension first.', 'wpvivid-backup-pro'), $msg).'

'; } else{ echo '

'.sprintf(__('The %s extensions are not detected. Please install the extensions first.', 'wpvivid-backup-pro'), $msg).'

'; } } if (!class_exists('PclZip')) include_once(ABSPATH.'/wp-admin/includes/class-pclzip.php'); if (!class_exists('PclZip')) { echo '

'.__('Class PclZip is not detected. Please update or reinstall your WordPress.', 'wpvivid-backup-pro').'

'; } $hide_notice = get_option('wpvivid_hide_wp_cron_notice', false); if(defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && $hide_notice === false){ echo '

'.__('In order to execute the scheduled backups properly, please set the DISABLE_WP_CRON constant to false.', 'wpvivid-backup-pro').'

'; } } public function check_custom_backup_default_exclude() { $custom_backup_history = get_option('wpvivid_custom_backup_history'); $default_exclude = array(); $uploads_exclude = get_option('wpvivid_custom_backup_default_exclude_uploads', $default_exclude); $upload_dir = wp_upload_dir(); $upload_path = str_replace('\\','/', $upload_dir['basedir']); $upload_path = explode('/', $upload_path); $upload_path = implode(DIRECTORY_SEPARATOR, $upload_path); $check_upload_array = array('backwpup', 'ShortpixelBackups', 'backup', 'backup-guard'); foreach ($check_upload_array as $upload_folder){ if(file_exists($upload_path.DIRECTORY_SEPARATOR.$upload_folder)){ if(!in_array($upload_folder, $uploads_exclude)){ $uploads_exclude[] = $upload_folder; $need_push_array = true; if(!empty($custom_backup_history['uploads_option']['exclude_uploads_list'])){ foreach ($custom_backup_history['uploads_option']['exclude_uploads_list'] as $key => $value){ if($key === $upload_folder){ $need_push_array = false; } } } if($need_push_array){ $temp_array = array(); $temp_array['name'] = $upload_folder; $temp_array['type'] = 'wpvivid-custom-li-folder-icon'; $custom_backup_history['uploads_option']['exclude_uploads_list'][$upload_folder] = $temp_array; } } } } update_option('wpvivid_custom_backup_history', $custom_backup_history, 'no'); update_option('wpvivid_custom_backup_default_exclude_uploads', $uploads_exclude, 'no'); } public function ajax_check_security($role='administrator') { check_ajax_referer( 'wpvivid_ajax', 'nonce' ); if(is_admin()&¤t_user_can('administrator')) { return; } else { $check=is_admin()&¤t_user_can($role); $check=apply_filters('wpvivid_ajax_check_security',$check); if(!$check) { die(); } } } public function is_plugin_enabled($is_enabled, $plugin_slug) { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $is_installed=false; $is_actived=false; $all_plugins = get_plugins(); if ( isset( $all_plugins[ $plugin_slug ] ) ) { $is_installed = true; } if ( is_plugin_active( $plugin_slug ) ) { $is_actived = true; } if($is_installed && $is_actived) { $is_enabled=true; } else { $is_enabled=false; } return $is_enabled; } public function dismiss_remote_password_crypt_import_notice() { global $wpvivid_backup_pro; $wpvivid_backup_pro->ajax_check_security('manage_options'); delete_option('wpvivid_remote_password_crypt_import_notice'); echo json_encode(array('result' => 'success')); die(); } }