'files', 'screen' => 'files' ) ); } protected function get_table_classes() { return array( 'widefat striped' ); } public function print_column_headers( $with_id = true ) { list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); if (!empty($columns['cb'])) { static $cb_counter = 1; $columns['cb'] = '' . ''; $cb_counter++; } foreach ( $columns as $column_key => $column_display_name ) { $class = array( 'manage-column', "column-$column_key" ); if ( in_array( $column_key, $hidden ) ) { $class[] = 'hidden'; } if ( $column_key === $primary ) { $class[] = 'column-primary'; } if ( $column_key === 'cb' ) { $class[] = 'check-column'; } $tag = ( 'cb' === $column_key ) ? 'td' : 'th'; $scope = ( 'th' === $tag ) ? 'scope="col"' : ''; $id = $with_id ? "id='$column_key'" : ''; if ( ! empty( $class ) ) { $class = "class='" . join( ' ', $class ) . "'"; } echo "<$tag $scope $id $class>$column_display_name"; } } public function get_columns() { $columns = array(); $columns['wpvivid_file'] = __( 'File', 'wpvivid-backuprestore' ); return $columns; } public function _column_wpvivid_file( $file ) { $html='
'. $file['key'].'
'; if($file['status']=='completed') { $html.=''.__('File Size: ', 'wpvivid-backuprestore').''.$file['size'].'|'. __('Download', 'wpvivid-backuprestore').''; } else if($file['status']=='file_not_found') { $html.='' . __('File not found', 'wpvivid-backuprestore') . ''; } else if($file['status']=='need_download') { $html.=''.__('File Size: ', 'wpvivid-backuprestore').''.$file['size'].'|'. __('Prepare to Download', 'wpvivid-backuprestore').''; } else if($file['status']=='running') { $html.='
' . __('Retriving (remote storage to web server)', 'wpvivid-backuprestore') . '|' . __('File Size: ', 'wpvivid-backuprestore') . ''.$file['size'].'|'. __('Downloaded Size: ', 'wpvivid-backuprestore').''.$file['downloaded_size'].'
'; } else if($file['status']=='timeout') { $html.='
Download timeout, please retry.
'.__('File Size: ', 'wpvivid-backuprestore').''.$file['size'].'|'. __('Prepare to Download', 'wpvivid-backuprestore').'
'; } else if($file['status']=='error') { $html.='
'.$file['error'].'
'.__('File Size: ', 'wpvivid-backuprestore').''.$file['size'].'|'. __('Prepare to Download', 'wpvivid-backuprestore').'
'; } $html.='
'; echo $html; //size } public function set_files_list($file_list,$backup_id,$page_num=1) { $this->file_list=$file_list; $this->backup_id=$backup_id; $this->page_num=$page_num; } public function get_pagenum() { if($this->page_num=='first') { $this->page_num=1; } else if($this->page_num=='last') { $this->page_num=$this->_pagination_args['total_pages']; } $pagenum = $this->page_num ? $this->page_num : 0; if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) { $pagenum = $this->_pagination_args['total_pages']; } return max( 1, $pagenum ); } public function prepare_items() { $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $total_items =sizeof($this->file_list); $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => 10, ) ); } public function has_items() { return !empty($this->file_list); } public function display_rows() { $this->_display_rows($this->file_list); } private function _display_rows($file_list) { $page=$this->get_pagenum(); $page_file_list=array(); $count=0; while ( $count<$page ) { $page_file_list = array_splice( $file_list, 0, 10); $count++; } foreach ( $page_file_list as $key=>$file) { $file['key']=$key; $this->single_row($file); } } public function single_row($file) { ?> single_row_columns( $file ); ?> _pagination_args ) ) { return; } $total_items = $this->_pagination_args['total_items']; $total_pages = $this->_pagination_args['total_pages']; $infinite_scroll = false; if ( isset( $this->_pagination_args['infinite_scroll'] ) ) { $infinite_scroll = $this->_pagination_args['infinite_scroll']; } if ( 'top' === $which && $total_pages > 1 ) { $this->screen->render_screen_reader_content( 'heading_pagination' ); } $output = '' . sprintf( _n( '%s item', '%s items', $total_items, 'wpvivid-backuprestore' ), number_format_i18n( $total_items ) ) . ''; $current = $this->get_pagenum(); $page_links = array(); $total_pages_before = ''; $total_pages_after = ''; $disable_first = $disable_last = $disable_prev = $disable_next = false; if ( $current == 1 ) { $disable_first = true; $disable_prev = true; } if ( $current == 2 ) { $disable_first = true; } if ( $current == $total_pages ) { $disable_last = true; $disable_next = true; } if ( $current == $total_pages - 1 ) { $disable_last = true; } if ( $disable_first ) { $page_links[] = ''; } else { $page_links[] = sprintf( "
%s
", __( 'First page', 'wpvivid-backuprestore' ), '«' ); } if ( $disable_prev ) { $page_links[] = ''; } else { $page_links[] = sprintf( "
%s
", $current, __( 'Previous page', 'wpvivid-backuprestore' ), '‹' ); } if ( 'bottom' === $which ) { $html_current_page = $current; $total_pages_before = '' . __( 'Current Page', 'wpvivid-backuprestore' ) . ''; } else { $html_current_page = sprintf( "%s", '', $current, strlen( $total_pages ) ); } $html_total_pages = sprintf( "%s", number_format_i18n( $total_pages ) ); $page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging', 'wpvivid-backuprestore' ), $html_current_page, $html_total_pages ) . $total_pages_after; if ( $disable_next ) { $page_links[] = ''; } else { $page_links[] = sprintf( "
%s
", $current, __( 'Next page', 'wpvivid-backuprestore' ), '›' ); } if ( $disable_last ) { $page_links[] = ''; } else { $page_links[] = sprintf( "
%s
", __( 'Last page', 'wpvivid-backuprestore' ), '»' ); } $pagination_links_class = 'pagination-links'; if ( ! empty( $infinite_scroll ) ) { $pagination_links_class .= ' hide-if-js'; } $output .= "\n" . join( "\n", $page_links ) . ''; if ( $total_pages ) { $page_class = $total_pages < 2 ? ' one-page' : ''; } else { $page_class = ' no-pages'; } $this->_pagination = "
$output
"; echo $this->_pagination; } protected function display_tablenav( $which ) { $css_type = ''; if ( 'top' === $which ) { wp_nonce_field( 'bulk-' . $this->_args['plural'] ); $css_type = 'margin: 0 0 10px 0'; } else if( 'bottom' === $which ) { $css_type = 'margin: 10px 0 0 0'; } $total_pages = $this->_pagination_args['total_pages']; if ( $total_pages >1) { ?>
extra_tablenav( $which ); $this->pagination( $which ); ?>
_args['singular']; $this->display_tablenav( 'top' ); $this->screen->render_screen_reader_content( 'heading_list' ); ?> print_column_headers(); ?> > display_rows_or_placeholder(); ?>
display_tablenav( 'bottom' ); } } function wpvivid_add_backup_type($html, $type_name) { $html .= '



'; return $html; } function wpvivid_backup_do_js() { global $wpvivid_plugin; $backup_task=$wpvivid_plugin->backup2->_list_tasks_ex(); $general_setting=WPvivid_Setting::get_setting(true, ""); if( (isset($general_setting['options']['wpvivid_common_setting']['estimate_backup'])) &&($general_setting['options']['wpvivid_common_setting']['estimate_backup'] == 0) ) { ?> jQuery('#wpvivid_estimate_backup_info').hide(); jQuery('#wpvivid_postbox_backup_percent').hide(); jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'}); jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'}); var string = ''; jQuery('#wpvivid_postbox_backup_percent').show(); jQuery('#wpvivid_postbox_backup_percent').html(string); jQuery('#wpvivid_postbox_backup_percent').hide(); jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'auto', 'opacity': '1'}); jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'auto', 'opacity': '1'}); $value){ if($value['status']['str'] === 'running'){ $percent=$value['data']['progress']; ?> jQuery('#wpvivid_postbox_backup_percent').show(); jQuery('#wpvivid_backup_cancel_btn').css({'pointer-events': 'none', 'opacity': '0.4'}); jQuery('#wpvivid_quickbackup_btn').css({'pointer-events': 'none', 'opacity': '0.4'}); jQuery('#wpvivid_action_progress_bar_percent').css('width', +'%'); jQuery('#wpvivid_backup_database_size').html(''); jQuery('#wpvivid_backup_file_size').html(''); 'day', 3600 => 'hour', 60 => 'min', 1 => 'second') as $key => $value) { if ($backup_running_time >= $key) $output .= floor($backup_running_time/$key) . $value; $backup_running_time %= $key; } if($output==''){ $output=0; } ?> jQuery('#wpvivid_current_doing').html(' Progress: %, running time: '); jQuery('#wpvivid_current_doing').html('The backup will be canceled after backing up the current chunk ends.'); '.__('About backup download', 'wpvivid-backuprestore').'

'; $html .= '
    '; $html .= '
  • '.__('->If backups are stored in remote storage, our plugin will retrieve the backup to your web server first. This may take a little time depending on the size of backup files. Please be patient. Then you can download them to your PC.', 'wpvivid-backuprestore').'
  • '; $html .= '
  • '.__('->If backups are stored in web server, the plugin will list all relevant files immediately.', 'wpvivid-backuprestore').'
  • '; $html .= '
'; return $html; } function wpvivid_restore_website_descript($html){ $html = '

'.__('How to restore your website from a backup(scheduled, manual, uploaded and received backup)', 'wpvivid-backuprestore').'

'; $html .= '
'; return $html; } function wpvivid_backuppage_load_backuplist($backuplist_array){ $backuplist_array['list_backup'] = array('index' => '1', 'tab_func' => 'wpvivid_backuppage_add_tab_backup', 'page_func' => 'wpvivid_backuppage_add_page_backup'); $backuplist_array['list_log'] = array('index' => '3', 'tab_func' => 'wpvivid_backuppage_add_tab_log', 'page_func' => 'wpvivid_backuppage_add_page_log'); $backuplist_array['list_restore'] = array('index' => '4', 'tab_func' => 'wpvivid_backuppage_add_tab_restore', 'page_func' => 'wpvivid_backuppage_add_page_restore'); $backuplist_array['list_download'] = array('index' => '5', 'tab_func' => 'wpvivid_backuppage_add_tab_downlaod', 'page_func' => 'wpvivid_backuppage_add_page_downlaod'); return $backuplist_array; } function wpvivid_backuppage_add_tab_backup(){ ?>
|
input type="radio"
input type="checkbox"