'upload_files', 'screen' => 'upload_files', ) ); } public function set_parent($parent) { $this->parent=$parent; } public function set_list($list,$page_num=1) { $this->list=$list; $this->page_num=$page_num; } protected function get_table_classes() { return array( 'widefat striped' ); } public function get_columns() { $sites_columns = array( 'cb' => ' ', 'file_regex' => __( 'File Regex', 'wpvivid-backuprestore' ) ); return $sites_columns; } 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 column_cb( $item ) { echo ''; } public function column_file_regex( $item ) { echo esc_html($item); } public function has_items() { return !empty($this->list); } public function prepare_items() { $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $total_items =sizeof($this->list); $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => 10, ) ); } public function display_rows() { $this->_display_rows( $this->list ); } private function _display_rows( $list ) { $page=$this->get_pagenum(); $page_list=$list; $temp_page_list=array(); $count=0; while ( $count<$page ) { $temp_page_list = array_splice( $page_list, 0, 10); $count++; } foreach ( $temp_page_list as $key=>$item) { $this->single_row($item); } } public function single_row($item) { ?> single_row_columns( $item ); ?> _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(); ?> print_column_headers( false ); ?>
'upload_files', 'screen' => 'upload_files', ) ); } public function set_parent($parent) { $this->parent=$parent; } public function set_list($list,$page_num=1) { $this->list=$list; $this->page_num=$page_num; } protected function get_table_classes() { return array( 'widefat striped' ); } public function get_columns() { $sites_columns = array( 'cb' => ' ', 'post_type' => __( 'Post Type', 'wpvivid-backuprestore' ) ); return $sites_columns; } 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 column_cb( $item ) { echo ''; } public function column_post_type( $item ) { echo esc_attr($item); } public function has_items() { return !empty($this->list); } public function prepare_items() { $columns = $this->get_columns(); $hidden = array(); $sortable = array(); $this->_column_headers = array($columns, $hidden, $sortable); $total_items =sizeof($this->list); $this->set_pagination_args( array( 'total_items' => $total_items, 'per_page' => 10, ) ); } public function display_rows() { $this->_display_rows( $this->list ); } private function _display_rows( $list ) { $page=$this->get_pagenum(); $page_list=$list; $temp_page_list=array(); $count=0; while ( $count<$page ) { $temp_page_list = array_splice( $page_list, 0, 10); $count++; } foreach ( $temp_page_list as $key=>$item) { $this->single_row($item); } } public function single_row($item) { ?> single_row_columns( $item ); ?> _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(); ?> print_column_headers( false ); ?>
'3', 'tab_func' => array($this, 'wpvivid_settingpage_add_tab_uc'), 'page_func' => array($this, 'wpvivid_settingpage_add_page_uc')); return $setting_array; } public function wpvivid_settingpage_add_tab_uc() { ?>
add_uc_cell(); ?>
set_list($white_list,sanitize_text_field($_POST['page'])); } else { $list->set_list($white_list); } $list->prepare_items(); ob_start(); $list->display(); $html = ob_get_clean(); $ret['result']='success'; $ret['html']=$html; echo wp_json_encode($ret); } catch (Exception $error) { $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; error_log($message); echo wp_json_encode(array('result'=>'failed','error'=>$message)); } die(); } public function delete_exclude_files() { check_ajax_referer( 'wpvivid_ajax', 'nonce' ); $check=current_user_can('manage_options'); $check=apply_filters('wpvivid_ajax_check_security',$check); if(!$check) { die(); } try { $json = sanitize_text_field($_POST['selected']); $json = stripslashes($json); $json = json_decode($json, true); $files=$json['selected']; $white_list=get_option('wpvivid_uc_exclude_files_regex',array()); $white_list = array_diff($white_list, $files); update_option('wpvivid_uc_exclude_files_regex',$white_list,'no'); $white_list=get_option('wpvivid_uc_exclude_files_regex',array()); $list=new WPvivid_Exclude_Files_List(); if(isset($_POST['page'])) { $list->set_list($white_list,sanitize_key($_POST['page'])); } else { $list->set_list($white_list); } $list->prepare_items(); ob_start(); $list->display(); $html = ob_get_clean(); $ret['result']='success'; $ret['html']=$html; echo wp_json_encode($ret); } catch (Exception $error) { $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; error_log($message); echo wp_json_encode(array('result'=>'failed','error'=>$message)); } die(); } public function get_post_type_list() { check_ajax_referer( 'wpvivid_ajax', 'nonce' ); $check=current_user_can('manage_options'); $check=apply_filters('wpvivid_ajax_check_security',$check); if(!$check) { die(); } try { $default_post_types=array(); $default_post_types[]='attachment'; $default_post_types[]='revision'; $default_post_types[]='auto-draft'; $default_post_types[]='nav_menu_item'; $default_post_types[]='shop_order'; $default_post_types[]='shop_order_refund'; $default_post_types[]='oembed_cache'; $post_type=sanitize_text_field($_POST['post_type']); if(isset($post_type)&&!empty($post_type)) { $file_exclude=$post_type; $post_types=get_option('wpvivid_uc_post_types',$default_post_types); $post_types[]=$file_exclude; update_option('wpvivid_uc_post_types',$post_types,'no'); } $post_types=get_option('wpvivid_uc_post_types',array()); $list=new WPvivid_Post_Type_List(); if(isset($_POST['page'])) { $list->set_list($post_types,sanitize_key($_POST['page'])); } else { $list->set_list($post_types); } $list->prepare_items(); ob_start(); $list->display(); $html = ob_get_clean(); $ret['result']='success'; $ret['html']=$html; echo wp_json_encode($ret); } catch (Exception $error) { $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; error_log($message); echo wp_json_encode(array('result'=>'failed','error'=>$message)); } die(); } public function delete_post_type() { check_ajax_referer( 'wpvivid_ajax', 'nonce' ); $check=current_user_can('manage_options'); $check=apply_filters('wpvivid_ajax_check_security',$check); if(!$check) { die(); } try { $default_post_types=array(); $default_post_types[]='attachment'; $default_post_types[]='revision'; $default_post_types[]='auto-draft'; $default_post_types[]='nav_menu_item'; $default_post_types[]='shop_order'; $default_post_types[]='shop_order_refund'; $default_post_types[]='oembed_cache'; $json = sanitize_text_field($_POST['selected']); $json = stripslashes($json); $json = json_decode($json, true); $files=$json['selected']; $post_types=get_option('wpvivid_uc_post_types',$default_post_types); $post_types = array_diff($post_types, $files); update_option('wpvivid_uc_post_types',$post_types,'no'); $post_types=get_option('wpvivid_uc_post_types',$default_post_types); $list=new WPvivid_Post_Type_List(); if(isset($_POST['page'])) { $list->set_list($post_types,sanitize_key($_POST['page'])); } else { $list->set_list($post_types); } $list->prepare_items(); ob_start(); $list->display(); $html = ob_get_clean(); $ret['result']='success'; $ret['html']=$html; echo wp_json_encode($ret); } catch (Exception $error) { $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; error_log($message); echo wp_json_encode(array('result'=>'failed','error'=>$message)); } die(); } }