",
'',
$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%s
",
$current,
__( 'Next page', 'wpvivid-backuprestore' ),
'›'
);
}
if ( $disable_last ) {
$page_links[] = '»';
} else {
$page_links[] = sprintf(
"%s%s
",
__( 'Last page', 'wpvivid-backuprestore' ),
'»'
);
}
$pagination_links_class = 'pagination-links';
if ( ! empty( $infinite_scroll ) ) {
$pagination_links_class .= ' hide-if-js';
}
$output .= "\n';
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)
{
?>
_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[] = '