This commit is contained in:
2026-03-11 15:57:27 +01:00
parent 481271c972
commit b4b460fd21
10775 changed files with 2071579 additions and 26409 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,284 @@
<?php
/**
* Provide a admin area view for the plugin
*
* This file is used to markup the admin-facing aspects of the plugin.
*
* @link https://wpvivid.com
* @since 0.9.1
*
* @package WPvivid
* @subpackage WPvivid/admin/partials
*/
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-backup-restore-page-display.php';
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-remote-storage-page-display.php';
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-settings-page-display.php';
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-schedule-page-display.php';
include_once WPVIVID_PLUGIN_DIR .'/admin/partials/wpvivid-website-info-page-display.php';
if (!defined('WPVIVID_PLUGIN_DIR'))
{
die;
}
global $wpvivid_plugin;
$schedule=WPvivid_Schedule::get_schedule();
do_action('show_notice');
?>
<?php
$page_array = array();
$page_array = apply_filters('wpvivid_add_tab_page', $page_array);
foreach ($page_array as $page_name){
add_action('wpvivid_backuprestore_add_tab', $page_name['tab_func'], $page_name['index']);
add_action('wpvivid_backuprestore_add_page', $page_name['page_func'], $page_name['index']);
}
?>
<div class="wrap">
<h1><?php
$plugin_display_name = 'WPvivid Backup Plugin';
$plugin_display_name = apply_filters('wpvivid_display_pro_name', $plugin_display_name);
esc_html_e('WPvivid Backup Plugin', 'wpvivid-backuprestore');
?></h1>
<div id="wpvivid_backup_notice">
<?php
if($schedule['enable'] == true) {
if($schedule['backup']['remote'] === 1)
{
$remoteslist=WPvivid_Setting::get_all_remote_options();
$default_remote_storage='';
foreach ($remoteslist['remote_selected'] as $value)
{
$default_remote_storage=$value;
}
if($default_remote_storage == ''){
echo '<div class="notice notice-warning is-dismissible"><p>';
esc_html_e('Warning: There is no default remote storage available for the scheduled backups, please set up it first.', 'wpvivid-backuprestore');
echo '</p></div>';
}
}
}
?>
</div>
<?php do_action('wpvivid_add_schedule_notice'); ?>
<div id="wpvivid_remote_notice"></div>
</div>
<h2 class="nav-tab-wrapper wpvivid-custom-table-manager">
<?php
do_action('wpvivid_backuprestore_add_tab');
?>
</h2>
<div class="wrap" style="max-width:1720px;">
<div id="poststuff" style="padding-top: 0;">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<div class="inside" style="margin-top:0;">
<?php
do_action('wpvivid_backuprestore_add_page');
?>
</div>
</div>
<div id="postbox-container-1" class="postbox-container">
<div class="meta-box-sortables">
<?php
$html = '';
//echo apply_filters('wpvivid_add_side_bar' ,$html, true);
do_action('wpvivid_add_side_bar' ,$html, true);
?>
</div>
</div>
</div>
<br class="clear">
</div>
</div>
<script>
function switchTabs(evt,contentName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("wrap-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="wrap-nav-tab" and remove the class "active"
tablinks = document.getElementsByClassName("wrap-nav-tab");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
}
// Show the current tab, and add an "nav-tab-active" class to the button that opened the tab
document.getElementById(contentName).style.display = "block";
evt.currentTarget.className += " nav-tab-active";
jQuery( document ).trigger( 'wpvivid-switch-tabs', contentName );
//nav-tab-active
}
function switchrestoreTabs(evt,contentName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="table-list-content" and hide them
tabcontent = document.getElementsByClassName("backup-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
tablinks = document.getElementsByClassName("backup-nav-tab");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
}
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
document.getElementById(contentName).style.display = "block";
evt.currentTarget.className += " nav-tab-active";
}
function switchlogTabs(evt,contentName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="table-list-content" and hide them
tabcontent = document.getElementsByClassName("log-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
tablinks = document.getElementsByClassName("log-nav-tab");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
}
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
document.getElementById(contentName).style.display = "block";
evt.currentTarget.className += " nav-tab-active";
}
function switchsettingTabs(evt,contentName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="table-list-content" and hide them
tabcontent = document.getElementsByClassName("setting-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
tablinks = document.getElementsByClassName("setting-nav-tab");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
}
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
document.getElementById(contentName).style.display = "block";
evt.currentTarget.className += " nav-tab-active";
}
function switchstorageTabs(remote_type,storage_page_id)
{
var i, tabcontent, tablinks,contentName;
contentName='storage-page';
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("wrap-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="wrap-nav-tab" and remove the class "active"
tablinks = document.getElementsByClassName("wrap-nav-tab");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
}
// Show the current tab, and add an "nav-tab-active" class to the button that opened the tab
document.getElementById(contentName).style.display = "block";
jQuery('#wpvivid_tab_remote_storage').addClass('nav-tab-active');
jQuery( document ).trigger( 'wpvivid-switch-tabs', contentName );
start_select_remote_storage(remote_type,storage_page_id);
}
function start_select_remote_storage(remote_type, storage_page_id)
{
var i, tablecontent, tablinks;
tablinks = document.getElementsByClassName("storage-providers");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace("storage-providers-active", "");
}
jQuery("div[remote_type='"+remote_type+"']").addClass('storage-providers-active');
jQuery(".storage-account-page").hide();
jQuery("#"+storage_page_id).show();
}
function wpvivid_getrequest()
{
wpvivid_click_switch_page('wrap', wpvivid_page_request, false);
}
function wpvivid_task_monitor()
{
setTimeout(function () {
wpvivid_task_monitor();
}, 120000);
var ajax_data = {
'action': 'wpvivid_task_monitor'
};
wpvivid_post_request(ajax_data, function (data)
{
},function (XMLHttpRequest, textStatus, errorThrown)
{
});
}
jQuery(document).ready(function ()
{
wpvivid_getrequest();
//wpvivid_task_monitor();
<?php
$default_task_type = array();
$default_task_type = apply_filters('wpvivid_get_task_type', $default_task_type);
if(empty($default_task_type)){
?>
//wpvivid_activate_cron();
//wpvivid_manage_task();
<?php
}
?>
<?php
if (isset($_GET['main_tab']))
{
$tab=esc_html($_GET['main_tab']);
if($tab=='storage')
{
$sub_tab=isset($_GET['sub_tab'])?$_GET['sub_tab']:'googledrive';
$sub_page=isset($_GET['sub_page'])?$_GET['sub_page']:'storage_account_google_drive';
if($sub_tab === 'googledrive' || $sub_tab === 'dropbox' || $sub_tab === 'one_drive')
{
if($sub_page === 'storage_account_google_drive' || $sub_page === 'storage_account_dropbox' || $sub_page === 'storage_account_one_drive')
{
?>
switchstorageTabs('<?php echo esc_attr($sub_tab); ?>','<?php echo esc_attr($sub_page) ?>');
<?php
}
}
}
}
?>
//switchTabs(event,'storage-page')
});
</script>

View File

@@ -0,0 +1,498 @@
<?php
function wpvivid_add_tab_storage_list()
{
?>
<a href="#" id="wpvivid_tab_storage_list" class="nav-tab storage-nav-tab nav-tab-active" onclick="switchstorageTabs(event,'page-storage-list','page-storage-list')"><?php esc_html_e('Storages', 'wpvivid-backuprestore'); ?></a>
<?php
}
function wpvivid_add_tab_storage_edit()
{
?>
<a href="#" id="wpvivid_tab_storage_edit" class="nav-tab storage-nav-tab delete" onclick="switchstorageTabs(event,'page-storage_edit','page-storage_edit')" style="display: none;">
<div id="wpvivid_tab_storage_edit_text" style="margin-right: 15px;"><?php esc_html_e('Storage Edit', 'wpvivid-backuprestore'); ?></div>
<div class="nav-tab-delete-img">
<img src="<?php echo esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )); ?>" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, 'wpvivid_tab_storage_edit', 'storage', 'wpvivid_tab_storage_list');" />
</div>
</a>
<?php
}
function wpvivid_add_page_storage_list()
{
?>
<div class="storage-tab-content wpvivid_tab_storage_list" id="page-storage-list">
<div style="margin-top:10px;"><p><strong><?php esc_html_e('Please choose one storage to save your backups (remote storage)', 'wpvivid-backuprestore'); ?></strong></p></div>
<div class="schedule-tab-block"></div>
<div class="">
<table class="widefat">
<thead>
<tr>
<th></th>
<th></th>
<th><?php esc_html_e( 'Storage Provider', 'wpvivid-backuprestore' ); ?></th>
<th class="row-title"><?php esc_html_e( 'Remote Storage Alias', 'wpvivid-backuprestore' ); ?></th>
<th><?php esc_html_e( 'Actions', 'wpvivid-backuprestore' ); ?></th>
</tr>
</thead>
<tbody class="wpvivid-remote-storage-list" id="wpvivid_remote_storage_list">
<?php
$remoteslist=WPvivid_Setting::get_all_remote_options();
$default_remote_storage='';
foreach ($remoteslist['remote_selected'] as $value) {
$default_remote_storage=$value;
}
$i=1;
foreach ($remoteslist as $key=>$value)
{
if($key === 'remote_selected')
{
continue;
}
if ($key === $default_remote_storage)
{
$check_status = 'checked';
}
else
{
$check_status='';
}
$storage_type = $value['type'];
$storage_type=apply_filters('wpvivid_storage_provider_tran', $storage_type);
echo '<tr>
<td>'.esc_html($i++).'</td>
<td><input type="checkbox" name="remote_storage" value="'.esc_attr($key).'" '.esc_attr($check_status).' /></td>
<td>'.esc_html($storage_type).'</td>
<td class="row-title"><label for="tablecell">'.esc_html($value['name']).'</label></td>
<td>
<div style="float: left;"><img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Edit.png').'" onclick="click_retrieve_remote_storage(\''.esc_attr($key).'\',\''.esc_attr($value['type']).'\',\''.esc_attr($value['name']).'\'
);" style="vertical-align:middle; cursor:pointer;" title="'. esc_html__('Edit the remote storage', 'wpvivid-backuprestore') .'"/></div>
<div><img src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/Delete.png').'" onclick="wpvivid_delete_remote_storage(\''.esc_attr($key).'\'
);" style="vertical-align:middle; cursor:pointer;" title="'. esc_html__('Remove the remote storage', 'wpvivid-backuprestore') .'"/></div>
</td>
</tr>';
}
?>
</tbody>
<tfoot>
<tr>
<th colspan="5" class="row-title"><input class="button-primary" id="wpvivid_set_default_remote_storage" type="submit" name="choose-remote-storage" value="<?php esc_attr_e( 'Save Changes', 'wpvivid-backuprestore' ); ?>" /></th>
</tr>
</tfoot>
</table>
</div>
</div>
<script>
jQuery('input[option=add-remote]').click(function(){
var storage_type = jQuery(".storage-providers-active").attr("remote_type");
wpvivid_add_remote_storage(storage_type);
wpvivid_settings_changed = false;
});
jQuery('#wpvivid_set_default_remote_storage').click(function(){
wpvivid_set_default_remote_storage();
wpvivid_settings_changed = false;
});
/**
* Add remote storages to the list
*
* @param action - The action to add or test a remote storage
* @param storage_type - Remote storage types (Amazon S3, SFTP and FTP server)
*/
function wpvivid_add_remote_storage(storage_type)
{
var remote_from = wpvivid_ajax_data_transfer(storage_type);
var ajax_data;
ajax_data = {
'action': 'wpvivid_add_remote',
'remote': remote_from,
'type': storage_type
};
jQuery('input[option=add-remote]').css({'pointer-events': 'none', 'opacity': '0.4'});
jQuery('#wpvivid_remote_notice').html('');
wpvivid_post_request(ajax_data, function (data)
{
try
{
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success')
{
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('input:text[option='+storage_type+']').each(function(){
jQuery(this).val('');
});
jQuery('input:password[option='+storage_type+']').each(function(){
jQuery(this).val('');
});
wpvivid_handle_remote_storage_data(data);
}
else if (jsonarray.result === 'failed')
{
jQuery('#wpvivid_remote_notice').html(jsonarray.notice);
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
}
}
catch (err)
{
alert(err);
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
}
}, function (XMLHttpRequest, textStatus, errorThrown)
{
var error_message = wpvivid_output_ajaxerror('adding the remote storage', textStatus, errorThrown);
alert(error_message);
jQuery('input[option=add-remote]').css({'pointer-events': 'auto', 'opacity': '1'});
});
}
function wpvivid_edit_remote_storage() {
var data_tran = 'edit-'+wpvivid_editing_storage_type;
var remote_data = wpvivid_ajax_data_transfer(data_tran);
var ajax_data;
ajax_data = {
'action': 'wpvivid_edit_remote',
'remote': remote_data,
'id': wpvivid_editing_storage_id,
'type': wpvivid_editing_storage_type
};
jQuery('#wpvivid_remote_notice').html('');
wpvivid_post_request(ajax_data, function(data){
try {
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success') {
jQuery('#wpvivid_tab_storage_edit').hide();
wpvivid_click_switch_page('storage', 'wpvivid_tab_storage_list', true);
wpvivid_handle_remote_storage_data(data);
}
else if (jsonarray.result === 'failed') {
jQuery('#wpvivid_remote_notice').html(jsonarray.notice);
}
}
catch(err){
alert(err);
}
},function(XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('editing the remote storage', textStatus, errorThrown);
alert(error_message);
});
}
/**
* Set a default remote storage for backups.
*/
function wpvivid_set_default_remote_storage(){
var remote_storage = new Array();
//remote_storage[0] = jQuery("input[name='remote_storage']:checked").val();
jQuery.each(jQuery("input[name='remote_storage']:checked"), function()
{
remote_storage.push(jQuery(this).val());
});
var ajax_data = {
'action': 'wpvivid_set_default_remote_storage',
'remote_storage': remote_storage
};
jQuery('#wpvivid_remote_notice').html('');
wpvivid_post_request(ajax_data, function(data){
wpvivid_handle_remote_storage_data(data);
}, function(XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('setting up the default remote storage', textStatus, errorThrown);
alert(error_message);
});
}
jQuery('#wpvivid_remote_storage_list').on("click", "input", function(){
var check_status = true;
if(jQuery(this).prop('checked') === true){
check_status = true;
}
else {
check_status = false;
}
jQuery('input[name="remote_storage"]').prop('checked', false);
if(check_status === true){
jQuery(this).prop('checked', true);
}
else {
jQuery(this).prop('checked', false);
}
});
function wpvivid_delete_remote_storage(storage_id){
var descript = '<?php esc_html_e('Deleting a remote storage will make it unavailable until it is added again. Are you sure to continue?', 'wpvivid-backuprestore'); ?>';
var ret = confirm(descript);
if(ret === true){
var ajax_data = {
'action': 'wpvivid_delete_remote',
'remote_id': storage_id
};
wpvivid_post_request(ajax_data, function(data){
wpvivid_handle_remote_storage_data(data);
},function(XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('deleting the remote storage', textStatus, errorThrown);
alert(error_message);
});
}
}
function wpvivid_handle_remote_storage_data(data){
var i = 0;
try {
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success') {
jQuery('#wpvivid_remote_storage_list').html('');
jQuery('#wpvivid_remote_storage_list').append(jsonarray.html);
jQuery('#upload_storage').html(jsonarray.pic);
jQuery('#schedule_upload_storage').html(jsonarray.pic);
jQuery('#wpvivid_out_of_date_remote_path').html(jsonarray.dir);
jQuery('#wpvivid_schedule_backup_local_remote').html(jsonarray.local_remote);
wpvivid_control_remote_storage(jsonarray.remote_storage);
jQuery('#wpvivid_remote_notice').html(jsonarray.notice);
}
else if(jsonarray.result === 'failed'){
alert(jsonarray.error);
}
}
catch(err){
alert(err);
}
}
function wpvivid_control_remote_storage(has_remote){
if(!has_remote){
if(jQuery("input:radio[name='save_local_remote'][value='remote']").prop('checked')) {
alert("<?php esc_html_e('There is no default remote storage configured. Please set it up first.', 'wpvivid-backuprestore'); ?>");
jQuery("input:radio[name='save_local_remote'][value='local']").prop('checked', true);
}
}
}
function wpvivid_toggle_sensitive_hint($input)
{
var $hint = $input.next('.wpvivid-sensitive-hint');
if($hint.length === 0) return;
if(($input.val() || '').length > 0){
$hint.hide();
}else{
$hint.show();
}
}
function click_retrieve_remote_storage(id,type,name)
{
wpvivid_editing_storage_id = id;
jQuery('.remote-storage-edit').hide();
jQuery('#wpvivid_tab_storage_edit').show();
jQuery('#wpvivid_tab_storage_edit_text').html(name);
wpvivid_editing_storage_type=type;
jQuery('#remote_storage_edit_'+wpvivid_editing_storage_type).fadeIn();
wpvivid_click_switch_page('storage', 'wpvivid_tab_storage_edit', true);
var ajax_data = {
'action': 'wpvivid_retrieve_remote',
'remote_id': id
};
wpvivid_post_request(ajax_data, function(data)
{
try
{
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success')
{
var sensitive_keys = ['host','server','password','access','secret'];
jQuery('input:text[option=edit-'+jsonarray.type+'], textarea[option=edit-'+jsonarray.type+'], select[option=edit-'+jsonarray.type+']').each(function(){
var key = jQuery(this).prop('name');
if(sensitive_keys.indexOf(key) !== -1 && jsonarray[key]){
var $input = jQuery(this);
$input.val('');
$input.attr('placeholder','********');
if ($input.next('.wpvivid-sensitive-hint').length === 0) {
$input.after(
'<div class="wpvivid-sensitive-hint" style="margin-top:4px;color:#999;font-size:12px;">' +
'⚠️ This value is hidden for security reasons. Please re-enter it to save changes.' +
'</div>'
);
}
$input.off('input.wpvividSensitive').on('input.wpvividSensitive', function(){
wpvivid_toggle_sensitive_hint(jQuery(this));
});
wpvivid_toggle_sensitive_hint($input);
}
else{
jQuery(this).val(jsonarray[key]);
}
});
jQuery('input:password[option=edit-'+jsonarray.type+']').each(function(){
var key = jQuery(this).prop('name');
if(sensitive_keys.indexOf(key) !== -1 && jsonarray[key]){
var $input = jQuery(this);
$input.val('');
$input.attr('placeholder','********');
if ($input.next('.wpvivid-sensitive-hint').length === 0) {
$input.after(
'<div class="wpvivid-sensitive-hint" style="margin-top:4px;color:#999;font-size:12px;">' +
'⚠️ This value is hidden for security reasons. Please re-enter it to save changes.' +
'</div>'
);
}
$input.off('input.wpvividSensitive').on('input.wpvividSensitive', function(){
wpvivid_toggle_sensitive_hint(jQuery(this));
});
wpvivid_toggle_sensitive_hint($input);
}
else{
jQuery(this).val(jsonarray[key]);
}
});
jQuery('input:checkbox[option=edit-'+jsonarray.type+']').each(function() {
var key = jQuery(this).prop('name');
var value;
if(jsonarray[key] == '0'){
value = false;
}
else{
value = true;
}
jQuery(this).prop('checked', value);
});
}
else
{
alert(jsonarray.error);
}
}
catch(err)
{
alert(err);
}
},function(XMLHttpRequest, textStatus, errorThrown)
{
var error_message = wpvivid_output_ajaxerror('retrieving the remote storage', textStatus, errorThrown);
alert(error_message);
});
}
</script>
<?php
}
function wpvivid_add_page_storage_edit()
{
?>
<div class="storage-tab-content wpvivid_tab_storage_edit" id="page-storage_edit" style="display:none;">
<div><?php do_action('wpvivid_edit_remote_page'); ?></div>
</div>
<script>
jQuery('input[option=edit-remote]').click(function(){
wpvivid_edit_remote_storage();
});
</script>
<?php
}
function wpvivid_storage_list($html)
{
$html='<h2 class="nav-tab-wrapper" style="padding-bottom:0!important;">';
$html.='<a href="#" id="wpvivid_tab_storage_list" class="nav-tab storage-nav-tab nav-tab-active" onclick="switchstorageTabs(event,\'page-storage-list\',\'page-storage-list\')">'. __('Storages', 'wpvivid-backuprestore').'</a>';
$html.='<a href="#" id="wpvivid_tab_storage_edit" class="nav-tab storage-nav-tab delete" onclick="switchstorageTabs(event,\'page-storage_edit\',\'page-storage_edit\')" style="display: none;">
<div id="wpvivid_tab_storage_edit_text" style="margin-right: 15px;">'.__('Storage Edit', 'wpvivid-backuprestore').'</div>
<div class="nav-tab-delete-img">
<img src="'.esc_url(plugins_url( 'images/delete-tab.png', __FILE__ )).'" style="vertical-align:middle; cursor:pointer;" onclick="wpvivid_close_tab(event, \'wpvivid_tab_storage_edit\', \'storage\', \'wpvivid_tab_storage_list\');" />
</div>
</a>';
$html.='</h2>';
$html.='<div class="storage-tab-content wpvivid_tab_storage_list" id="page-storage-list">
<div style="margin-top:10px;"><p><strong>'.__('Please choose one storage to save your backups (remote storage)', 'wpvivid-backuprestore').'</strong></p></div>
<div class="schedule-tab-block"></div>
<div class="">
<table class="widefat">
<thead>
<tr>
<th></th>
<th></th>
<th>'. __( 'Storage Provider', 'wpvivid-backuprestore' ).'</th>
<th class="row-title">'. __( 'Remote Storage Alias', 'wpvivid-backuprestore' ).'</th>
<th>'. __( 'Actions', 'wpvivid-backuprestore' ).'</th>
</tr>
</thead>
<tbody class="wpvivid-remote-storage-list" id="wpvivid_remote_storage_list">
';
$html_list='';
$html.= apply_filters('wpvivid_add_remote_storage_list', $html_list);
$html.='</tbody><tfoot><tr>
<th colspan="5" class="row-title"><input class="button-primary" id="wpvivid_set_default_remote_storage" type="submit" name="choose-remote-storage" value="'.esc_attr__( 'Save Changes', 'wpvivid-backuprestore' ).'" /></th>
</tr></tfoot></table></div></div>';
$html .= '<script>
jQuery(\'#wpvivid_remote_storage_list\').on("click", "input", function(){
var check_status = true;
if(jQuery(this).prop(\'checked\') === true){
check_status = true;
}
else {
check_status = false;
}
jQuery(\'input[name = "remote_storage"]\').prop(\'checked\', false);
if(check_status === true){
jQuery(this).prop(\'checked\', true);
}
else {
jQuery(this).prop(\'checked\', false);
}
});
</script>';
return $html;
}
add_action('wpvivid_storage_add_tab', 'wpvivid_add_tab_storage_list', 10);
add_action('wpvivid_storage_add_tab', 'wpvivid_add_tab_storage_edit', 11);
add_action('wpvivid_storage_add_page', 'wpvivid_add_page_storage_list', 10);
add_action('wpvivid_storage_add_page', 'wpvivid_add_page_storage_edit', 11);
//add_filter('wpvivid_storage_list','wpvivid_storage_list',10);
?>
<script>
function select_remote_storage(evt, storage_page_id)
{
var i, tablecontent, tablinks;
tablinks = document.getElementsByClassName("storage-providers");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace("storage-providers-active", "");
}
evt.currentTarget.className += " storage-providers-active";
jQuery(".storage-account-page").hide();
jQuery("#"+storage_page_id).show();
}
function switchstorageTabs(evt,contentName,storage_page_id) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="table-list-content" and hide them
tabcontent = document.getElementsByClassName("storage-tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="table-nav-tab" and remove the class "nav-tab-active"
tablinks = document.getElementsByClassName("storage-nav-tab");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" nav-tab-active", "");
}
// Show the current tab, and add an "storage-menu-active" class to the button that opened the tab
document.getElementById(contentName).style.display = "block";
evt.currentTarget.className += " nav-tab-active";
var top = jQuery('#'+storage_page_id).offset().top-jQuery('#'+storage_page_id).height();
jQuery('html, body').animate({scrollTop:top}, 'slow');
}
</script>

View File

@@ -0,0 +1,307 @@
<?php
function wpvivid_schedule_settings()
{
?>
<tr>
<td class="row-title wpvivid-backup-settings-table tablelistcolumn"><label for="tablecell"><?php esc_html_e('Schedule Settings', 'wpvivid-backuprestore'); ?></label></td>
<td class="tablelistcolumn">
<div id="storage-brand-3">
<div>
<div>
<div class="postbox schedule-tab-block">
<label for="wpvivid_schedule_enable">
<input option="schedule" name="enable" type="checkbox" id="wpvivid_schedule_enable" />
<span><?php esc_html_e( 'Enable backup schedule', 'wpvivid-backuprestore' ); ?></span>
</label><br>
<label>
<div style="float: left;">
<input type="checkbox" disabled />
<span class="wpvivid-element-space-right" style="color: #ddd;"><?php esc_html_e('Enable Incremental Backup', 'wpvivid-backuprestore'); ?></span>
</div>
<div style="float: left; height: 32px; line-height: 32px;">
<span class="wpvivid-feature-pro">
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-incremental-backups.html"><?php esc_html_e('Pro feature: learn more', 'wpvivid-backuprestore'); ?></a>
</span>
</div>
<div style="clear: both;"></div>
</label>
<label>
<div style="float: left;">
<input type="checkbox" disabled />
<span class="wpvivid-element-space-right" style="color: #ddd;"><?php esc_html_e('Advanced Schedule', 'wpvivid-backuprestore'); ?></span>
</div>
<div style="float: left; height: 32px; line-height: 32px;">
<span class="wpvivid-feature-pro">
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-schedule-overview.html"><?php esc_html_e('Pro feature: learn more', 'wpvivid-backuprestore'); ?></a>
</span>
</div>
<div style="clear: both;"></div>
</label>
<div style="clear: both;"></div>
<div>
<?php
$time = '00:00:00';
$utime_1 = strtotime($time);
$time = '00:00:15';
$utime_2 = strtotime($time);
echo '<p>1) '.'Backup schedule will start at a random time between '.esc_html(gmdate('H:i:s', $utime_1)).' and '.esc_html(gmdate('H:i:s', $utime_2)).' <strong>UTC</strong> to prevent possible server overload from simultaneous backups of many sites.</p>';
echo '<p>2) ';
esc_html_e('Being subjected to mechanisms of PHP, a scheduled backup task for your site will be triggered only when the site receives at least a visit at any page.', 'wpvivid-backuprestore');
echo '</p>';
?>
</div>
</div>
<div class="postbox schedule-tab-block">
<fieldset>
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
<?php
$display_array = array("12Hours", "Daily", "Weekly", "Fortnightly", "Monthly");
foreach($display_array as $display)
{
$schedule_check = wpvivid_check_schedule_type($display);
if($schedule_check['result'])
{
echo ' <label><input type="radio" option="schedule" name="recurrence" value="'.esc_attr($schedule_check['type']).'" />';
if($display === '12Hours'){
echo '<span>'.esc_html__('12Hours', 'wpvivid-backuprestore').'</span></label><br>';
}
if($display === 'Daily'){
echo '<span>'.esc_html__('Daily', 'wpvivid-backuprestore').'</span></label><br>';
}
if($display === 'Weekly'){
echo '<span>'.esc_html__('Weekly', 'wpvivid-backuprestore').'</span></label><br>';
}
if($display === 'Fortnightly'){
echo '<span>'.esc_html__('Fortnightly', 'wpvivid-backuprestore').'</span></label><br>';
}
if($display === 'Monthly'){
echo '<span>'.esc_html__('Monthly', 'wpvivid-backuprestore').'</span></label><br>';
}
}
else{
echo '<p>Warning: Unable to set '.esc_html($display).' backup schedule</p>';
}
}
echo '<label>';
echo '<div style="float: left;">';
echo '<input type="radio" disabled />';
echo '<span class="wpvivid-element-space-right" style="color: #ddd;">';esc_html_e('Custom', 'wpvivid-backuprestore');echo '</span>';
echo '</div>';
echo '<div style="float: left; height: 32px; line-height: 32px;">';
echo '<span class="wpvivid-feature-pro">';
echo '<a href="https://docs.wpvivid.com/wpvivid-backup-pro-customize-start-time.html" style="text-decoration: none; margin-top: 10px;">';esc_html_e('Pro feature: learn more', 'wpvivid-backuprestore');echo '</a>';
echo '</span>';
echo '</div>';
echo '</label><br>';
?>
</fieldset>
</div>
</div>
</div>
<div class="postbox schedule-tab-block" id="wpvivid_schedule_backup_type">
<div>
<div>
<fieldset>
<legend class="screen-reader-text"><span>input type="radio"</span></legend>
<?php
echo '<label>';
echo '<input type="radio" option="schedule" name="backup_type" value="files+db"/>';
echo '<span>'.esc_html__('Database + Files (WordPress Files)', 'wpvivid-backuprestore').'</span>';
echo '</label><br>';
echo '<label>';
echo '<input type="radio" option="schedule" name="backup_type" value="files"/>';
echo '<span>'.esc_html__('WordPress Files (Exclude Database)', 'wpvivid-backuprestore').'</span>';
echo '</label><br>';
echo '<label>';
echo '<input type="radio" option="schedule" name="backup_type" value="db"/>';
echo '<span>'.esc_html__('Only Database', 'wpvivid-backuprestore').'</span>';
echo '</label><br>';
echo '<label>';
echo '<div style="float: left;">';
echo '<input type="radio" disabled />';
echo '<span class="wpvivid-element-space-right" style="color: #ddd;">'.esc_html__('Custom', 'wpvivid-backuprestore').'</span>';
echo '</div>';
echo '<div style="float: left; height: 32px; line-height: 32px;">';
echo '<span class="wpvivid-feature-pro">';
echo '<a href="https://docs.wpvivid.com/wpvivid-backup-pro-customize-what-to-backup-for-schedule.html" style="text-decoration: none;">'.esc_html__('Pro feature: learn more', 'wpvivid-backuprestore').'</a>';
echo '</span>';
echo '</div>';
echo '</label><br>';
?>
</fieldset>
</div>
<div style="clear:both;"></div>
</div>
</div>
<div class="postbox schedule-tab-block" id="wpvivid_schedule_remote_storage">
<div id="wpvivid_schedule_backup_local_remote">
<?php
$schedule=WPvivid_Schedule::get_schedule();
$backup_local = 'checked';
$backup_remote = '';
if($schedule['enable'] == true)
{
if($schedule['backup']['remote'] === 1)
{
$backup_local = '';
$backup_remote = 'checked';
}
else{
$backup_local = 'checked';
$backup_remote = '';
}
}
echo '<fieldset>
<label title="">
<input type="radio" option="schedule" name="save_local_remote" value="local" '.esc_attr($backup_local).' />
<span>'.esc_html__( 'Save backups on localhost (web server)', 'wpvivid-backuprestore' ).'</span>
</label><br>
<label title="">
<input type="radio" option="schedule" name="save_local_remote" value="remote" '.esc_attr($backup_remote).' />
<span>'.esc_html__( 'Send backups to remote storage (You can choose whether to keep the backup in localhost after it is uploaded to cloud storage in Settings.)', 'wpvivid-backuprestore' ).'</span>
</label>
<label style="display: none;">
<input type="checkbox" option="schedule" name="lock" value="0" />
</label>
</fieldset>';
?>
</div>
<div id="schedule_upload_storage" style="cursor:pointer;" title="<?php esc_html_e('Highlighted icon illuminates that you have choosed a remote storage to store backups', 'wpvivid-backuprestore'); ?>">
<?php
$remoteslist=WPvivid_Setting::get_all_remote_options();
$default_remote_storage=array();
foreach ($remoteslist['remote_selected'] as $value) {
$default_remote_storage[]=$value;
}
$remote_storage_type=array();
foreach ($remoteslist as $key=>$value)
{
if(in_array($key, $default_remote_storage))
{
$remote_storage_type[]=$value['type'];
}
}
$remote=array();
$remote=apply_filters('wpvivid_remote_pic', $remote);
if(is_array($remote))
{
foreach ($remote as $key => $value) {
$title = $value['title'];
if (in_array($key, $remote_storage_type)) {
$pic = $value['selected_pic'];
} else {
$pic = $value['default_pic'];
}
$url = apply_filters('wpvivid_get_wpvivid_pro_url', WPVIVID_PLUGIN_URL, $key);
echo '<img src="' . esc_url($url . $pic) . '" style="vertical-align:middle; " title="' . esc_attr($title) . '"/>';
}
echo '<img onclick="wpvivid_click_switch_page(\'wrap\', \'wpvivid_tab_remote_storage\', true);" src="'.esc_url(WPVIVID_PLUGIN_URL.'/admin/partials/images/add-storages.png').'" style="vertical-align:middle;" title="'.esc_attr__('Add a storage', 'wpvivid-backuprestore').'"/>';
}
?>
</div>
</div>
<div class="postbox schedule-tab-block">
<div style="float:left; color: #ddd; margin-right: 10px;">
<?php esc_html_e('+ Add another schedule', 'wpvivid-backuprestore'); ?>
</div>
<span class="wpvivid-feature-pro">
<a href="https://docs.wpvivid.com/wpvivid-backup-pro-creating-schedules.html"><?php esc_html_e('Pro feature: learn more', 'wpvivid-backuprestore'); ?></a>
</span>
</div>
</div>
</td>
</tr>
<script>
<?php
do_action('wpvivid_schedule_do_js');
?>
</script>
<?php
}
function wpvivid_check_schedule_type($display)
{
$schedule_type = array(
'wpvivid_12hours' => '12Hours',
'twicedaily' => '12Hours',
'wpvivid_daily' => 'Daily',
'daily' => 'Daily',
'onceday' => 'Daily',
'wpvivid_weekly' => 'Weekly',
'weekly' => 'Weekly',
'wpvivid_fortnightly' => 'Fortnightly',
'fortnightly' => 'Fortnightly',
'wpvivid_monthly' => 'Monthly',
'monthly' => 'Monthly',
'montly' => 'Monthly'
);
$schedules = wp_get_schedules();
$check_res = false;
$ret = array();
foreach ($schedule_type as $key => $value){
if($value == $display){
if(isset($schedules[$key])){
$check_res = true;
$ret['type']=$key;
break;
}
}
}
$ret['result']=$check_res;
return $ret;
}
function wpvivid_schedule_do_js()
{
$schedule=WPvivid_Schedule::get_schedule();
if($schedule['enable'] == true)
{
?>
jQuery("#wpvivid_schedule_enable").prop('checked', true);
<?php
if($schedule['backup']['remote'] === 1)
{
$schedule_remote='remote';
}
else{
$schedule_remote='local';
}
}
else{
$schedule['recurrence']='wpvivid_daily';
$schedule['backup']['backup_files']='files+db';
$schedule_remote='local';
}
?>
jQuery("input:radio[value='<?php echo esc_attr($schedule['recurrence'])?>']").prop('checked', true);
jQuery("input:radio[value='<?php echo esc_attr($schedule['backup']['backup_files'])?>']").prop('checked', true);
jQuery("input:radio[name='save_local_remote'][value='remote']").click(function()
{
<?php
$remote_id_array = WPvivid_Setting::get_user_history('remote_selected');
$remote_id = '';
foreach ($remote_id_array as $value)
{
$remote_id = $value;
}
if(empty($remote_id))
{
?>
alert("<?php esc_html_e('There is no default remote storage configured. Please set it up first.', 'wpvivid-backuprestore'); ?>");
jQuery("input:radio[name='save_local_remote'][value='local']").prop('checked', true);
<?php
}
?>
});
<?php
}
add_action('wpvivid_schedule_add_cell','wpvivid_schedule_settings',11);
add_action('wpvivid_schedule_do_js','wpvivid_schedule_do_js',10);
?>

View File

@@ -0,0 +1,868 @@
<?php
function wpvivid_general_settings()
{
$general_setting=WPvivid_Setting::get_setting(true, "");
$display_backup_count=isset($general_setting['options']['wpvivid_common_setting']['max_backup_count'])?$general_setting['options']['wpvivid_common_setting']['max_backup_count']:WPVIVID_DEFAULT_BACKUP_COUNT;
//
$display_backup_count=intval($display_backup_count);
if($display_backup_count > 7)
{
$display_backup_count = 7;
}
if($general_setting['options']['wpvivid_common_setting']['estimate_backup'])
{
$wpvivid_setting_estimate_backup='checked';
}
else{
$wpvivid_setting_estimate_backup='';
}
/*if(!isset($general_setting['options']['wpvivid_common_setting']['show_tab_menu'])){
$wpvivid_show_tab_menu='checked';
}
else {
if ($general_setting['options']['wpvivid_common_setting']['show_tab_menu']) {
$wpvivid_show_tab_menu = 'checked';
} else {
$wpvivid_show_tab_menu = '';
}
}*/
if(!isset($general_setting['options']['wpvivid_common_setting']['show_admin_bar'])){
$show_admin_bar = 'checked';
}
else{
if($general_setting['options']['wpvivid_common_setting']['show_admin_bar']){
$show_admin_bar = 'checked';
}
else{
$show_admin_bar = '';
}
}
if(!isset($general_setting['options']['wpvivid_common_setting']['domain_include'])){
$wpvivid_domain_include = 'checked';
}
else{
if($general_setting['options']['wpvivid_common_setting']['domain_include']){
$wpvivid_domain_include = 'checked';
}
else{
$wpvivid_domain_include = '';
}
}
if(!isset($general_setting['options']['wpvivid_common_setting']['ismerge'])){
$wpvivid_ismerge = 'checked';
}
else{
if($general_setting['options']['wpvivid_common_setting']['ismerge'] == '1'){
$wpvivid_ismerge = 'checked';
}
else{
$wpvivid_ismerge = '';
}
}
if(!isset($general_setting['options']['wpvivid_common_setting']['retain_local'])){
$wpvivid_retain_local = '';
}
else{
if($general_setting['options']['wpvivid_common_setting']['retain_local'] == '1'){
$wpvivid_retain_local = 'checked';
}
else{
$wpvivid_retain_local = '';
}
}
if(!isset($general_setting['options']['wpvivid_common_setting']['uninstall_clear_folder'])){
$uninstall_clear_folder = '';
}
else{
if($general_setting['options']['wpvivid_common_setting']['uninstall_clear_folder'] == '1'){
$uninstall_clear_folder = 'checked';
}
else{
$uninstall_clear_folder = '';
}
}
if(!isset($general_setting['options']['wpvivid_common_setting']['backup_symlink_folder'])){
$backup_symlink_folder = '';
}
else{
if($general_setting['options']['wpvivid_common_setting']['backup_symlink_folder'] == '1'){
$backup_symlink_folder = 'checked';
}
else{
$backup_symlink_folder = '';
}
}
global $wpvivid_plugin;
$out_of_date=$wpvivid_plugin->_get_out_of_date_info();
?>
<div class="postbox schedule-tab-block">
<div>
<select option="setting" name="max_backup_count" id="wpvivid_max_backup_count">
<?php
for($i=1; $i<8;$i++){
if($i === $display_backup_count){
echo '<option selected="selected" value="' . esc_attr($i) . '">' . esc_attr($i) . '</option>';
}
else {
echo '<option value="' . esc_attr($i) . '">' . esc_attr($i) . '</option>';
}
}
?>
</select><strong style="margin-right: 10px;"><?php esc_html_e('backups retained', 'wpvivid-backuprestore'); ?></strong><a href="https://docs.wpvivid.com/wpvivid-backup-pro-backup-retention.html" style="text-decoration: none;"><?php esc_html_e('Pro feature: Retain more backups', 'wpvivid-backuprestore'); ?></a>
</div>
<div>
<label for="wpvivid_estimate_backup">
<input type="checkbox" option="setting" name="estimate_backup" id="wpvivid_estimate_backup" value="1" <?php echo esc_attr($wpvivid_setting_estimate_backup); ?> />
<span><?php esc_html_e('Calculate the size of files, folder and database before backing up', 'wpvivid-backuprestore' ); ?></span>
</label>
</div>
<div>
<label>
<input type="checkbox" option="setting" name="show_admin_bar" <?php echo esc_attr($show_admin_bar); ?> />
<span><?php esc_html_e('Show WPvivid backup plugin on top admin bar', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div>
<label>
<input type="checkbox" option="setting" name="ismerge" <?php echo esc_attr($wpvivid_ismerge); ?> />
<span><?php esc_html_e('Merge all the backup files into single package when a backup completes. This will save great disk spaces, though takes longer time. We recommended you check the option especially on sites with insufficient server resources.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div>
<label>
<input type="checkbox" option="setting" name="retain_local" <?php echo esc_attr($wpvivid_retain_local); ?> />
<span><?php esc_html_e('Keep storing the backups in localhost after uploading to remote storage', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div>
<label>
<input type="checkbox" option="setting" name="uninstall_clear_folder" <?php echo esc_attr($uninstall_clear_folder); ?> />
<span><?php echo esc_html(sprintf('Delete the /%s folder and all backups in it when deleting WPvivid Backup plugin.', $general_setting['options']['wpvivid_local_setting']['path'])); ?></span>
</label>
</div>
<div>
<label>
<input type="checkbox" option="setting" name="backup_symlink_folder" <?php echo esc_attr($backup_symlink_folder); ?> />
<span><?php esc_html_e('Back up symlink folders. Including symlink folders may cause backup/migration failure. Uncheck this option unless you know how symlink folders work.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
</div>
<div class="postbox schedule-tab-block">
<div><strong><?php esc_html_e('Backup Folder', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<div><p><?php esc_html_e('Name your folder, this folder must be writable for creating backup files.', 'wpvivid-backuprestore' ); ?><p> </div>
<input type="text" placeholder="wpvividbackups" option="setting" name="path" id="wpvivid_option_backup_dir" class="all-options" value="<?php echo esc_attr($general_setting['options']['wpvivid_local_setting']['path']); ?>" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" onpaste="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" />
<p><span class="wpvivid-element-space-right"><?php esc_html_e('Local storage directory:', 'wpvivid-backuprestore'); ?></span><span><?php echo esc_html(WP_CONTENT_DIR.'/'); ?><span id="wpvivid_setting_local_storage_path"><?php echo esc_html($general_setting['options']['wpvivid_local_setting']['path']); ?></span></span></p>
</div>
<div>
<label>
<input type="checkbox" option="setting" name="domain_include" <?php echo esc_attr($wpvivid_domain_include); ?> />
<span><?php esc_html_e('Display domain(url) of current site in backup name. (e.g. domain_wpvivid-5ceb938b6dca9_2019-05-27-07-36_backup_all.zip)', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
</div>
<div class="postbox schedule-tab-block">
<div><strong><?php esc_html_e('Remove out-of-date backups', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block" style="padding-bottom: 0;">
<fieldset>
<label for="users_can_register">
<p><span class="wpvivid-element-space-right"><?php esc_html_e('Web Server Directory:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_out_of_date_local_path"><?php echo esc_html($out_of_date['web_server']); ?></span></p>
<p><span style="margin-right: 2px;"><?php esc_html_e('Remote Storage Directory:', 'wpvivid-backuprestore'); ?></span><span id="wpvivid_out_of_date_remote_path">
<?php
$wpvivid_get_remote_directory = '';
$wpvivid_get_remote_directory = apply_filters('wpvivid_get_remote_directory', $wpvivid_get_remote_directory);
echo esc_html($wpvivid_get_remote_directory);
?>
</span>
</p>
</label>
</fieldset>
</div>
<div class="setting-tab-block" style="padding: 10px 10px 0 0;">
<input class="button-primary" id="wpvivid_delete_out_of_backup" style="margin-right:10px;" type="submit" name="delete-out-of-backup" value="<?php esc_attr_e( 'Remove', 'wpvivid-backuprestore' ); ?>" />
<p><?php esc_html_e('The action is irreversible! It will remove all backups are out-of-date (including local web server and remote storage) if they exist.', 'wpvivid-backuprestore'); ?> </p>
</div>
</div>
<script>
jQuery('#wpvivid_delete_out_of_backup').click(function(){
wpvivid_delete_out_of_date_backups();
});
/**
* This function will delete out of date backups.
*/
function wpvivid_delete_out_of_date_backups(){
var ajax_data={
'action': 'wpvivid_clean_out_of_date_backup'
};
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'none', 'opacity': '0.4'});
wpvivid_post_request(ajax_data, function(data){
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
try {
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === "success") {
alert("<?php esc_html_e('Out of date backups have been removed.', 'wpvivid-backuprestore'); ?>");
wpvivid_handle_backup_data(data);
}
}
catch(err){
alert(err);
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
}
}, function(XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('deleting out of date backups', textStatus, errorThrown);
alert(error_message);
jQuery('#wpvivid_delete_out_of_backup').css({'pointer-events': 'auto', 'opacity': '1'});
});
}
</script>
<?php
}
function wpvivid_email_report()
{
$general_setting=WPvivid_Setting::get_setting(true, "");
$setting_email_enable='';
$setting_email_display = 'display: none;';
if(isset($general_setting['options']['wpvivid_email_setting']['email_enable'])){
if($general_setting['options']['wpvivid_email_setting']['email_enable']){
$setting_email_enable='checked';
$setting_email_display = '';
}
}
$wpvivid_setting_email_always='';
$wpvivid_setting_email_failed='';
if(isset($general_setting['options']['wpvivid_email_setting']['always'])&&$general_setting['options']['wpvivid_email_setting']['always']) {
$wpvivid_setting_email_always='checked';
}
else{
$wpvivid_setting_email_failed='checked';
}
?>
<div class="postbox schedule-tab-block" id="wpvivid_email_report">
<div><p>In order to use this function, please install a <strong><a target="_blank" href="https://wpvivid.com/8-best-smtp-plugins-for-wordpress.html" style="text-decoration: none;">WordPress SMTP plugin</a></strong> of your preference and configure your SMTP server first. This is because WordPress uses the PHP Mail function to send its emails by default, which is not supported by many hosts and can cause issues if it is not set properly.
</div>
<div>
<label for="wpvivid_general_email_enable">
<input type="checkbox" option="setting" name="email_enable" id="wpvivid_general_email_enable" value="1" <?php echo esc_attr($setting_email_enable); ?> />
<span><strong><?php esc_html_e( 'Enable email report', 'wpvivid-backuprestore' ); ?></strong></span>
</label>
</div>
<div id="wpvivid_general_email_setting" style="<?php echo esc_attr($setting_email_display); ?>" >
<input type="text" placeholder="example@yourdomain.com" option="setting" name="send_to" class="regular-text" id="wpvivid_mail" value="<?php
if(!empty($general_setting['options']['wpvivid_email_setting']['send_to'])) {
foreach ($general_setting['options']['wpvivid_email_setting']['send_to'] as $mail) {
if(!empty($mail) && !is_array($mail)) {
echo esc_attr($mail);
break;
}
}
}
?>" />
<input class="button-secondary" id="wpvivid_send_email_test" style="margin-top:10px;" type="submit" name="" value="<?php esc_attr_e( 'Test Email', 'wpvivid-backuprestore' ); ?>" title="Send an email for testing mail function"/>
<div id="wpvivid_send_email_res"></div>
<fieldset class="setting-tab-block">
<label >
<input type="radio" option="setting" name="always" value="1" <?php echo esc_attr($wpvivid_setting_email_always); ?> />
<span><?php esc_html_e( 'Always send an email notification when a backup is complete', 'wpvivid-backuprestore' ); ?></span>
</label><br>
<label >
<input type="radio" option="setting" name="always" value="0" <?php echo esc_attr($wpvivid_setting_email_failed); ?> />
<span><?php esc_html_e( 'Only send an email notification when a backup fails', 'wpvivid-backuprestore' ); ?></span>
</label><br>
</fieldset>
<div style="margin-bottom: 10px;">
<a href="https://wpvivid.com/wpvivid-backup-pro-email-report?utm_source=client_email_report&utm_medium=inner_link&utm_campaign=access" style="text-decoration: none;"><?php esc_html_e('Pro feature: Add another email address to get report', 'wpvivid-backuprestore'); ?></a>
</div>
</div>
</div>
<script>
jQuery('#wpvivid_send_email_test').click(function(){
wpvivid_email_test();
});
/**
* After enabling email report feature, and test if an email address works or not
*/
function wpvivid_email_test(){
var mail = jQuery('#wpvivid_mail').val();
var ajax_data = {
'action': 'wpvivid_test_send_mail',
'send_to': mail
};
wpvivid_post_request(ajax_data, function(data){
try {
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success') {
jQuery('#wpvivid_send_email_res').html('Test succeeded.');
}
else {
jQuery('#wpvivid_send_email_res').html('Test failed, ' + jsonarray.error);
}
}
catch(err){
alert(err);
}
}, function(XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('sending test mail', textStatus, errorThrown);
alert(error_message);
});
}
</script>
<?php
}
function wpvivid_clean_junk()
{
global $wpvivid_plugin;
$junk_file=$wpvivid_plugin->_junk_files_info_ex();
?>
<div class="postbox schedule-tab-block" id="wpvivid_clean_junk">
<div>
<strong><?php esc_html_e('Web-server disk space in use by WPvivid', 'wpvivid-backuprestore'); ?></strong>
</div>
<div class="setting-tab-block">
<div class="setting-tab-block">
<span class="wpvivid-element-space-right"><?php esc_html_e('Total Size:', 'wpvivid-backuprestore'); ?></span>
<span class="wpvivid-size-calc wpvivid-element-space-right" id="wpvivid_junk_sum_size"><?php echo esc_html($junk_file['sum_size']); ?></span>
<span class="wpvivid-element-space-right"><?php esc_html_e( 'Backup Size:', 'wpvivid-backuprestore' ); ?></span>
<span class="wpvivid-size-calc wpvivid-element-space-right" id="wpvivid_backup_size"><?php echo esc_html($junk_file['backup_size']); ?></span>
<input class="button-secondary" id="wpvivid_calculate_size" style="margin-left:10px;" type="submit" name="Calculate-Sizes" value="<?php esc_attr_e( 'Calculate Sizes', 'wpvivid-backuprestore' ); ?>" />
</div>
<fieldset>
<label for="wpvivid_junk_log">
<input type="checkbox" id="wpvivid_junk_log" option="junk-files" name="log" value="junk-log" />
<span class="wpvivid-element-space-right"><?php esc_html_e( 'Logs Size:', 'wpvivid-backuprestore' ); ?></span>
<span class="wpvivid-size-calc" id="wpvivid_log_size"><?php echo esc_html($junk_file['log_dir_size']); ?></span>
</label>
</fieldset>
<fieldset>
<label for="wpvivid_junk_backup_cache">
<input type="checkbox" id="wpvivid_junk_backup_cache" option="junk-files" name="backup_cache" value="junk-backup-cache" />
<span class="wpvivid-element-space-right"><?php esc_html_e( 'Backup Cache Size:', 'wpvivid-backuprestore' ); ?></span>
<span class="wpvivid-size-calc" id="wpvivid_backup_cache_size"><?php echo esc_html($junk_file['backup_cache_size']); ?></span>
</label>
</fieldset>
<fieldset>
<label for="wpvivid_junk_file">
<input type="checkbox" id="wpvivid_junk_file" option="junk-files" name="junk_files" value="junk-files" />
<span class="wpvivid-element-space-right"><?php esc_html_e( 'Junk Size:', 'wpvivid-backuprestore' ); ?></span>
<span class="wpvivid-size-calc" id="wpvivid_junk_size"><?php echo esc_html($junk_file['junk_size']); ?></span>
</label>
</fieldset>
</div>
<div><input class="button-primary" id="wpvivid_clean_junk_file" type="submit" name="Empty-all-files" value="<?php esc_attr_e( 'Empty', 'wpvivid-backuprestore' ); ?>" /></div>
<div style="clear:both;"></div>
</div>
<script>
jQuery('#wpvivid_calculate_size').click(function(){
wpvivid_calculate_diskspaceused();
});
jQuery('#wpvivid_clean_junk_file').click(function(){
wpvivid_clean_junk_files();
});
/**
* Calculate the server disk space in use by WPvivid.
*/
function wpvivid_calculate_diskspaceused(){
var ajax_data={
'action': 'wpvivid_junk_files_info'
};
var current_size = jQuery('#wpvivid_junk_sum_size').html();
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'none', 'opacity': '0.4'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'none', 'opacity': '0.4'});
jQuery('.wpvivid-size-calc').html("calculating...");
wpvivid_post_request(ajax_data, function(data){
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
try {
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === "success") {
jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
jQuery('#wpvivid_log_size').html(jsonarray.data.log_dir_size);
jQuery('#wpvivid_backup_cache_size').html(jsonarray.data.backup_cache_size);
jQuery('#wpvivid_junk_size').html(jsonarray.data.junk_size);
jQuery('#wpvivid_backup_size').html(jsonarray.data.backup_size);
}
}
catch(err){
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_junk_sum_size').html(current_size);
}
}, function(XMLHttpRequest, textStatus, errorThrown) {
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_junk_sum_size').html(current_size);
});
}
/**
* Clean junk files created during backups and restorations off your web server disk.
*/
function wpvivid_clean_junk_files(){
var descript = '<?php esc_html_e('The selected item(s) will be permanently deleted. Are you sure you want to continue?', 'wpvivid-backuprestore'); ?>';
var ret = confirm(descript);
if(ret === true){
var option_data = wpvivid_ajax_data_transfer('junk-files');
var ajax_data = {
'action': 'wpvivid_clean_local_storage',
'options': option_data
};
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'none', 'opacity': '0.4'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'none', 'opacity': '0.4'});
wpvivid_post_request(ajax_data, function (data) {
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('input[option="junk-files"]').prop('checked', false);
try {
var jsonarray = jQuery.parseJSON(data);
alert(jsonarray.msg);
if (jsonarray.result === "success") {
jQuery('#wpvivid_junk_sum_size').html(jsonarray.data.sum_size);
jQuery('#wpvivid_log_size').html(jsonarray.data.log_dir_size);
jQuery('#wpvivid_backup_cache_size').html(jsonarray.data.backup_cache_size);
jQuery('#wpvivid_junk_size').html(jsonarray.data.junk_size);
jQuery('#wpvivid_backup_size').html(jsonarray.data.backup_size);
jQuery('#wpvivid_loglist').html("");
jQuery('#wpvivid_loglist').append(jsonarray.html);
wpvivid_log_count = jsonarray.log_count;
wpvivid_display_log_page();
}
}
catch(err){
alert(err);
}
}, function (XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('cleaning out junk files', textStatus, errorThrown);
alert(error_message);
jQuery('#wpvivid_calculate_size').css({'pointer-events': 'auto', 'opacity': '1'});
jQuery('#wpvivid_clean_junk_file').css({'pointer-events': 'auto', 'opacity': '1'});
});
}
}
jQuery(document).ready(function ()
{
//wpvivid_calculate_diskspaceused();
});
</script>
<?php
}
function wpvivid_export_import_settings()
{
?>
<div class="postbox schedule-tab-block" id="wpvivid_export_import">
<div class="setting-tab-block" style="padding-bottom: 0;">
<input class="button-primary" id="wpvivid_setting_export" type="button" name="" value="<?php esc_attr_e( 'Export', 'wpvivid-backuprestore' ); ?>" />
<p><?php esc_html_e('Click \'Export\' button to save WPvivid settings on your local computer.', 'wpvivid-backuprestore'); ?> </p>
</div>
<div class="setting-tab-block" style="padding: 0 10px 0 0;">
<input type="file" name="fileTrans" id="wpvivid_select_import_file"></br>
<input class="button-primary" id="wpvivid_setting_import" type="button" name="" value="<?php esc_attr_e( 'Import', 'wpvivid-backuprestore' ); ?>" />
<p><?php esc_html_e('Importing the json file can help you set WPvivid\'s configuration on another wordpress site quickly.', 'wpvivid-backuprestore'); ?></p>
</div>
<div style="clear:both;"></div>
</div>
<script>
jQuery('#wpvivid_setting_export').click(function(){
wpvivid_export_settings();
});
jQuery('#wpvivid_setting_import').click(function(){
wpvivid_import_settings();
});
function wpvivid_export_settings() {
wpvivid_location_href=true;
location.href =ajaxurl+'?_wpnonce='+wpvivid_ajax_object.ajax_nonce+'&action=wpvivid_export_setting&setting=1&history=1&review=0';
}
function wpvivid_import_settings(){
var files = jQuery('input[name="fileTrans"]').prop('files');
if(files.length == 0){
alert('Choose a settings file and import it by clicking Import button.');
return;
}
else{
var reader = new FileReader();
reader.readAsText(files[0], "UTF-8");
reader.onload = function(evt){
var fileString = evt.target.result;
var ajax_data = {
'action': 'wpvivid_import_setting',
'data': fileString
};
wpvivid_post_request(ajax_data, function(data){
try {
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success') {
alert('The plugin settings were imported successfully.');
location.reload();
}
else {
alert('Error: ' + jsonarray.error);
}
}
catch(err){
alert(err);
}
}, function(XMLHttpRequest, textStatus, errorThrown) {
var error_message = wpvivid_output_ajaxerror('importing the previously-exported settings', textStatus, errorThrown);
jQuery('#wpvivid_display_log_content').html(error_message);
});
}
}
}
</script>
<?php
}
function wpvivid_advanced_settings()
{
//wpvivid_compress_setting backup
$common_setting=get_option('wpvivid_common_setting',array());
$max_file_size=isset($common_setting['max_file_size'])?$common_setting['max_file_size']:WPVIVID_DEFAULT_MAX_FILE_SIZE;
$exclude_file_size=isset($common_setting['exclude_file_size'])?$common_setting['exclude_file_size']:WPVIVID_DEFAULT_EXCLUDE_FILE_SIZE;
$max_execution_time=isset($common_setting['max_execution_time'])?$common_setting['max_execution_time']:WPVIVID_MAX_EXECUTION_TIME;
$memory_limit=isset($common_setting['memory_limit'])?$common_setting['memory_limit']:WPVIVID_MEMORY_LIMIT;
$migrate_size=isset($common_setting['migrate_size'])?$common_setting['migrate_size']:WPVIVID_MIGRATE_SIZE;
$wpvivid_max_resume_count=isset($common_setting['max_resume_count'])?$common_setting['max_resume_count']:WPVIVID_RESUME_RETRY_TIMES;
//$compress_file_use_cache=isset($common_setting['compress_file_use_cache'])?$common_setting['compress_file_use_cache']:false;
$compress_file_count=isset($common_setting['compress_file_count'])?$common_setting['compress_file_count']:500;
$max_sql_file_size=isset($common_setting['max_sql_file_size'])?$common_setting['max_sql_file_size']:200;
//restore
$restore_max_execution_time=isset($common_setting['restore_max_execution_time'])?$common_setting['restore_max_execution_time']:WPVIVID_RESTORE_MAX_EXECUTION_TIME;
$restore_memory_limit=isset($common_setting['restore_memory_limit'])?$common_setting['restore_memory_limit']:WPVIVID_RESTORE_MEMORY_LIMIT;
$replace_rows_pre_request=isset($common_setting['replace_rows_pre_request'])?$common_setting['replace_rows_pre_request']:10000;
$sql_file_buffer_pre_request=isset($common_setting['sql_file_buffer_pre_request'])?$common_setting['sql_file_buffer_pre_request']:'5';
$use_index=isset($common_setting['use_index'])?$common_setting['use_index']:1;
if($use_index)
{
$use_index=' checked';
}
else
{
$use_index=' ';
}
$unzip_files_pre_request=isset($common_setting['unzip_files_pre_request'])?$common_setting['unzip_files_pre_request']:1000;
//common
if(isset($common_setting['db_connect_method']))
{
if($common_setting['db_connect_method'] === 'wpdb')
{
$db_method_wpdb = 'checked';
$db_method_pdo = '';
}
else
{
$db_method_wpdb = '';
$db_method_pdo = 'checked';
}
}
else
{
$db_method_wpdb = 'checked';
$db_method_pdo = '';
}
if(isset($common_setting['zip_method']))
{
if($common_setting['zip_method'] === 'ziparchive')
{
$zip_method_archive = 'checked';
$zip_method_pclzip = '';
}
else{
$zip_method_archive = '';
$zip_method_pclzip = 'checked';
}
}
else
{
if(class_exists('ZipArchive'))
{
if(method_exists('ZipArchive', 'addFile'))
{
$zip_method_archive = 'checked';
$zip_method_pclzip = '';
}
else
{
$zip_method_archive = '';
$zip_method_pclzip = 'checked';
}
}
else
{
$zip_method_archive = '';
$zip_method_pclzip = 'checked';
}
}
if(isset($common_setting['backup_params']))
{
if($common_setting['backup_params'] === 'low')
{
$backup_params_low = 'checked';
$backup_params_mid = '';
$backup_params_high = '';
$backup_params_custom = '';
$backup_custom_setting_display = 'display: none;';
}
else if($common_setting['backup_params'] === 'mid')
{
$backup_params_low = '';
$backup_params_mid = 'checked';
$backup_params_high = '';
$backup_params_custom = '';
$backup_custom_setting_display = 'display: none;';
}
else if($common_setting['backup_params'] === 'high')
{
$backup_params_low = '';
$backup_params_mid = '';
$backup_params_high = 'checked';
$backup_params_custom = '';
$backup_custom_setting_display = 'display: none;';
}
else if($common_setting['backup_params'] === 'custom')
{
$backup_params_low = '';
$backup_params_mid = '';
$backup_params_high = '';
$backup_params_custom = 'checked';
$backup_custom_setting_display = '';
}
else
{
$backup_params_low = 'checked';
$backup_params_mid = '';
$backup_params_high = '';
$backup_params_custom = '';
$backup_custom_setting_display = 'display: none;';
}
}
else if(isset($common_setting['compress_file_count']))
{
$backup_params_low = '';
$backup_params_mid = '';
$backup_params_high = '';
$backup_params_custom = 'checked';
$backup_custom_setting_display = '';
}
else
{
$backup_params_low = 'checked';
$backup_params_mid = '';
$backup_params_high = '';
$backup_params_custom = '';
$backup_custom_setting_display = 'display: none;';
}
?>
<div class="postbox schedule-tab-block wpvivid-setting-addon" style="margin-bottom: 10px; padding-bottom: 0;">
<div class="wpvivid-element-space-bottom">
<strong><?php esc_html_e('Database access method.', 'wpvivid-backuprestore'); ?></strong>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="db_connect_method" value="wpdb" <?php echo esc_attr($db_method_wpdb); ?> />
<span class="wpvivid-element-space-right"><strong>WPDB</strong></span><span><?php esc_html_e('WPDB option has a better compatibility, but the speed of backup and restore is slower.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="db_connect_method" value="pdo" <?php echo esc_attr($db_method_pdo); ?> />
<span class="wpvivid-element-space-right"><strong>PDO</strong></span><span><?php esc_html_e('It is recommended to choose PDO option if pdo_mysql extension is installed on your server, which lets you backup and restore your site faster.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
</div>
<div class="postbox schedule-tab-block wpvivid-setting-addon" style="margin-bottom: 10px; padding-bottom: 0;">
<div class="wpvivid-element-space-bottom">
<strong><?php esc_html_e('Backup compression method.', 'wpvivid-backuprestore'); ?></strong>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="zip_method" value="ziparchive" <?php echo esc_attr($zip_method_archive); ?> />
<span class="wpvivid-element-space-right"><strong>ZipArchive</strong></span><span><?php esc_html_e('ZipArchive has a better flexibility which provides a higher backup success rate and speed. WPvivid Backup Plugin uses ZipArchive method by default. Using this method requires the ZIP extension to be installed within your PHP.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="zip_method" value="pclzip" <?php echo esc_attr($zip_method_pclzip); ?> />
<span class="wpvivid-element-space-right"><strong>PCLZIP</strong></span><span><?php esc_html_e('PclZip is a much slower but more stable zip method that is included in every WordPress install. WPvivid will automatically switch to PclZip if the ZIP extension is not installed within your PHP.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
</div>
<div class="postbox schedule-tab-block setting-page-content">
<div style="padding-top: 10px;">
<div class="wpvivid-element-space-bottom">
<strong><?php esc_html_e('Backup performance mode.', 'wpvivid-backuprestore'); ?></strong>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="backup_params" value="low" <?php esc_attr_e($backup_params_low); ?> />
<span class="wpvivid-element-space-right"><strong>Low (Balanced)</strong></span><span><?php esc_html_e('Use this default setting for minimal server resource usage, but expect longer backup times. Best for shared hosting or limited resources. Backups are split into 200MB chunks.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="backup_params" value="mid" <?php esc_attr_e($backup_params_mid); ?> />
<span class="wpvivid-element-space-right"><strong>Mid (Standard)</strong></span><span><?php esc_html_e('This mode offers a good balance between backup speed and resource usage. It\'s suitable for most web hosting environments.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="backup_params" value="high" <?php esc_attr_e($backup_params_high); ?> />
<span class="wpvivid-element-space-right"><strong>High (Accelerated)</strong></span><span><?php esc_html_e('This mode uses more server resources to reduce backup time, but is only recommended for dedicated servers. If backups time out or get stuck, consider Mid or Low mode. Backups are split into 4GB chunks.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div class="wpvivid-element-space-bottom">
<label>
<input type="radio" option="setting" name="backup_params" value="custom" <?php esc_attr_e($backup_params_custom); ?> />
<span class="wpvivid-element-space-right"><strong>Custom (Advanced)</strong></span><span><?php esc_html_e('This mode allows fine-tuning of backup parameters. Incorrect configuration can lead to backup failures. It is recommended to use only with specific guidance from our support team.', 'wpvivid-backuprestore'); ?></span>
</label>
</div>
<div id="wpvivid_custom_backup_params" style="<?php esc_attr_e($backup_custom_setting_display); ?>">
<div><strong><?php esc_html_e('Compress Files Every', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="200" option="setting" name="max_file_size" id="wpvivid_max_zip" class="all-options" value="<?php echo esc_attr(str_replace('M', '', $max_file_size)); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
<div><p><?php esc_html_e( 'Some web hosting providers limit large zip files (e.g. 200MB), and therefore splitting your backup into many parts is an ideal way to avoid hitting the limitation if you are running a big website. Please try to adjust the value if you are encountering backup errors. When you set a value of 0MB, backups will be split every 4GB.', 'wpvivid-backuprestore' ); ?></div></p>
</div>
<div><strong><?php esc_html_e('Exclude the files which are larger than', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="0" option="setting" name="exclude_file_size" id="wpvivid_ignore_large" class="all-options" value="<?php echo esc_attr($exclude_file_size); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
<div><p><?php esc_html_e( 'Using the option will ignore the file larger than the certain size in MB when backing up, \'0\' (zero) means unlimited.', 'wpvivid-backuprestore' ); ?></p></div>
</div>
<div><strong><?php esc_html_e('PHP script execution timeout for backup', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="900" option="setting" name="max_execution_time" id="wpvivid_option_timeout" class="all-options" value="<?php echo esc_attr($max_execution_time); ?>" onkeyup="value=value.replace(/\D/g,'')" /><?php esc_html_e('Seconds', 'wpvivid-backuprestore'); ?>
<div><p><?php esc_html_e( 'The time-out is not your server PHP time-out. With the execution time exhausted, our plugin will shut the process of backup down. If the progress of backup encounters a time-out, that means you have a medium or large sized website, please try to scale the value bigger.', 'wpvivid-backuprestore' ); ?></p></div>
</div>
<div><strong><?php esc_html_e('PHP Memory Limit for backup', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="256" option="setting" name="memory_limit" class="all-options" value="<?php echo esc_attr(str_replace('M', '', $memory_limit)); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
<div><p><?php esc_html_e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin to run a backup. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid-backuprestore'); ?></p></div>
</div>
<div><strong><?php esc_html_e('The number of files compressed to the backup zip each time', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="500" option="setting" name="compress_file_count" id="wpvivid_compress_file_count" class="all-options" value="<?php echo esc_attr($compress_file_count); ?>" onkeyup="value=value.replace(/\D/g,'')" /><?php esc_html_e('Files', 'wpvivid-backuprestore'); ?>
<div><p><?php esc_html_e( 'When taking a backup, the plugin will compress this number of files to the backup zip each time. The default value is 500. The lower the value, the longer time the backup will take, but the higher the backup success rate. If you encounter a backup timeout issue, try to decrease this value.', 'wpvivid-backuprestore' ); ?></p></div>
</div>
<div><strong><?php esc_html_e('Split a sql file every this size', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="200" option="setting" name="max_sql_file_size" id="wpvivid_max_sql_file_size" class="all-options" value="<?php echo esc_attr($max_sql_file_size); ?>" onkeyup="value=value.replace(/\D/g,'')" /><?php esc_html_e('MB', 'wpvivid-backuprestore'); ?>
<div><p><?php esc_html_e( 'Some web hosting providers limit large zip files (e.g. 200MB), and therefore splitting your backup into many parts is an ideal way to avoid hitting the limitation if you are running a big website. Please try to adjust the value if you are encountering backup errors. If you use a value of 0 MB, any backup files won\'t be split.', 'wpvivid-backuprestore' ); ?></p></div>
</div>
<div><strong><?php esc_html_e('Chunk Size', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="2048" option="setting" name="migrate_size" class="all-options" value="<?php echo esc_attr($migrate_size); ?>" onkeyup="value=value.replace(/\D/g,'')" />KB
<div><p><?php esc_html_e('e.g. if you choose a chunk size of 2MB, a 8MB file will use 4 chunks. Decreasing this value will break the ISP\'s transmission limit, for example:512KB', 'wpvivid-backuprestore'); ?></p></div>
</div>
<div>
<strong>Retrying </strong>
<select option="setting" name="max_resume_count">
<?php
for($resume_count=3; $resume_count<10; $resume_count++){
if($resume_count === $wpvivid_max_resume_count){
echo '<option selected="selected" value="'.esc_attr($resume_count).'">'.esc_html($resume_count).'</option>';
}
else{
echo '<option value="'.esc_attr($resume_count).'">'.esc_html($resume_count).'</option>';
}
}
?>
</select>
<strong> times when encountering a time-out error</strong>
</div>
</div>
</div>
</div>
<div class="postbox schedule-tab-block wpvivid-setting-addon" style="margin-bottom: 10px; padding-bottom: 0;">
<div>
<div>
<input type="checkbox" option="setting" name="use_index" style="margin-right: 0px;" <?php echo esc_attr($use_index); ?> />
<strong><?php esc_html_e('Extract files by index for restoration', 'wpvivid-backuprestore'); ?></strong>
</div>
<div><p><?php esc_html_e('Specify the number of files to be extracted per request. The lower the number is, the slower the restoration, but the lower the chance of a timeout error or restore failure.', 'wpvivid-backuprestore'); ?></p></div>
</div>
<div class="setting-tab-block">
<input type="text" placeholder="1000" option="setting" name="unzip_files_pre_request" class="all-options" value="<?php echo esc_attr($unzip_files_pre_request); ?>" onkeyup="value=value.replace(/\D/g,'')" />Files are unzipped every PHP request
</div>
<div><strong><?php esc_html_e('PHP script execution timeout for restore', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="300" option="setting" name="restore_max_execution_time" class="all-options" value="<?php echo esc_attr($restore_max_execution_time); ?>" onkeyup="value=value.replace(/\D/g,'')" /><?php esc_html_e('Seconds', 'wpvivid-backuprestore'); ?>
<div><p><?php esc_html_e( 'The time-out is not your server PHP time-out. With the execution time exhausted, our plugin will shut the process of restore down. If the progress of restore encounters a time-out, that means you have a medium or large sized website, please try to scale the value bigger.', 'wpvivid-backuprestore' ); ?></p></div>
</div>
<div><strong><?php esc_html_e('PHP Memory Limit for restoration', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="256" option="setting" name="restore_memory_limit" class="all-options" value="<?php echo esc_attr(str_replace('M', '', $restore_memory_limit)); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
<div><p><?php esc_html_e('Adjust this value to apply for a temporary PHP memory limit for WPvivid backup plugin in restore process. We set this value to 256M by default. Increase the value if you encounter a memory exhausted error. Note: some web hosting providers may not support this.', 'wpvivid-backuprestore'); ?></p></div>
</div>
<div><strong><?php esc_html_e('Maximum rows of data to be processed per request for restoration', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="10000" option="setting" name="replace_rows_pre_request" class="all-options" value="<?php echo esc_attr($replace_rows_pre_request); ?>" onkeyup="value=value.replace(/\D/g,'')" />rows
<div><p><?php esc_html_e('The smaller it is, the slower the restoration will be, but the lower the chance of a timeout error.', 'wpvivid-backuprestore'); ?></p></div>
</div>
<div><strong><?php esc_html_e('Maximum size of sql file to be imported per request for restoration', 'wpvivid-backuprestore'); ?></strong></div>
<div class="setting-tab-block">
<input type="text" placeholder="5" option="setting" name="sql_file_buffer_pre_request" class="all-options" value="<?php echo esc_attr($sql_file_buffer_pre_request); ?>" onkeyup="value=value.replace(/\D/g,'')" />MB
<div><p><?php esc_html_e('Maximum rows of data to be processed per request.', 'wpvivid-backuprestore'); ?></p></div>
</div>
</div>
<?php
}
function wpvivid_add_setting_tab_page($setting_array){
$setting_array['general_setting'] = array('index' => '1', 'tab_func' => 'wpvivid_settingpage_add_tab_general', 'page_func' => 'wpvivid_settingpage_add_page_general');
$setting_array['advance_setting'] = array('index' => '2', 'tab_func' => 'wpvivid_settingpage_add_tab_advance', 'page_func' => 'wpvivid_settingpage_add_page_advance');
return $setting_array;
}
function wpvivid_settingpage_add_tab_general(){
?>
<a href="#" id="wpvivid_tab_general_setting" class="nav-tab setting-nav-tab nav-tab-active" onclick="switchsettingTabs(event,'page-general-setting')"><?php esc_html_e('General Settings', 'wpvivid-backuprestore'); ?></a>
<?php
}
function wpvivid_settingpage_add_tab_advance(){
?>
<a href="#" id="wpvivid_tab_advance_setting" class="nav-tab setting-nav-tab" onclick="switchsettingTabs(event,'page-advance-setting')"><?php esc_html_e('Advanced Settings', 'wpvivid-backuprestore'); ?></a>
<?php
}
function wpvivid_settingpage_add_page_general(){
?>
<div class="setting-tab-content wpvivid_tab_general_setting" id="page-general-setting" style="margin-top: 10px;">
<?php do_action('wpvivid_setting_add_general_cell'); ?>
</div>
<?php
}
function wpvivid_settingpage_add_page_advance(){
?>
<div class="setting-tab-content wpvivid_tab_advance_setting" id="page-advance-setting" style="margin-top: 10px; display: none;">
<?php do_action('wpvivid_setting_add_advance_cell'); ?>
</div>
<?php
}
add_filter('wpvivid_add_setting_tab_page', 'wpvivid_add_setting_tab_page', 10);
add_action('wpvivid_setting_add_general_cell','wpvivid_general_settings',10);
add_action('wpvivid_setting_add_advance_cell','wpvivid_advanced_settings',13);
add_action('wpvivid_setting_add_general_cell','wpvivid_email_report',14);
add_action('wpvivid_setting_add_general_cell','wpvivid_clean_junk',15);
add_action('wpvivid_setting_add_general_cell','wpvivid_export_import_settings',16);
?>

View File

@@ -0,0 +1,59 @@
<?php
?>
<script>
function wpvivid_get_ini_memory_limit() {
var ajax_data = {
'action': 'wpvivid_get_ini_memory_limit'
};
wpvivid_post_request(ajax_data, function (data) {
try {
jQuery('#wpvivid_websiteinfo_list tr').each(function (i) {
jQuery(this).children('td').each(function (j) {
if (j == 0) {
if (jQuery(this).html().indexOf('memory_limit') >= 0) {
jQuery(this).next().html(data);
}
}
});
});
}
catch (err) {
setTimeout(function ()
{
wpvivid_get_ini_memory_limit();
}, 3000);
}
}, function (XMLHttpRequest, textStatus, errorThrown) {
setTimeout(function ()
{
wpvivid_get_ini_memory_limit();
}, 3000);
});
}
//
jQuery('#wpvivid_tab_debug').click(function()
{
wpvivid_get_ini_memory_limit();
});
jQuery(document).ready(function ()
{
jQuery(document).on('wpvivid-switch-tabs', function(event,contentName)
{
if(contentName=='debug-page')
{
wpvivid_get_ini_memory_limit();
}
if(contentName=='settings-page')
{
wpvivid_calculate_diskspaceused();
}
});
//wpvivid_get_ini_memory_limit();
});
</script>
<?php
?>