HEX
Server: nginx/1.18.0
System: Linux iZj6c1ieg2jrpk1z5tzi19Z 6.3.9-1.el7.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 21 22:18:40 EDT 2023 x86_64
User: www (1001)
PHP: 8.2.4
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.cytocare.cn/wp-content/plugins/gwolle-gb/frontend/gb-pagination.php
<?php


if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly



/*
 * gwolle_gb_pagination_frontend
 * Pagination of the entries for the guestbook frontend
 *
 * @param int $page_num the number of the requested page.
 * @param int $pages_total the total number of pages.
 * @return string $pagination the html of the pagination.
 */
function gwolle_gb_pagination_frontend( $page_num, $pages_total ) {

	$high_dots_made = false;
	$pages_done = array();

	$permalink = gwolle_gb_get_permalink(get_the_ID());
	$is_search = gwolle_gb_is_search();
	if ( $is_search ) {
		$search_query = gwolle_gb_sanitize_input( $_GET['gwolle-gb-search-input'] );
		$permalink = add_query_arg( 'gwolle-gb-search-input', $search_query, $permalink );
	}

	$pagination = '
				<div class="page-navigation">
					<span class="screen-reader-text">' . esc_html__('Guestbook list navigation', 'gwolle-gb') . '</span>';

	if ($page_num > 1) {
		$pagination .= '<a href="' . add_query_arg( 'pageNum', round($page_num - 1), $permalink ) . '" title="' . esc_attr__('Previous page', 'gwolle-gb') . '" rel="prev">&larr;</a>';
	}

	if ($page_num < 5) {
		$showrange = 5;
		if ($pages_total < 6) {
			$showrange = $pages_total;
			$high_dots_made = true; // no need for highdots.
		}
		for ( $i = 1; $i < ( $showrange + 1 ); $i++ ) {
			if ($i === $page_num) {
				if ( in_array( $i, $pages_done ) ) { continue; }
				$pagination .= '<span class="page-numbers current">' . $i . '</span>';
				$pages_done[] = $i;
			} else {
				if ( in_array( $i, $pages_done ) ) { continue; }
				$pagination .= '<a href="' . add_query_arg( 'pageNum', $i, $permalink ) . '" title="' . esc_attr__('Page', 'gwolle-gb') . ' ' . $i . '">' . $i . '</a>';
				$pages_done[] = $i;
				if ( $i === $pages_total ) { break; }
			}
		}

		if ( ( $page_num + 4 < $pages_total ) && ( ! $high_dots_made ) ) {
			$pagination .= '<span class="page-numbers dots">...</span>';
			$high_dots_made = true;
		}
	} else if ($page_num > 4) {
		$pagination .= '<a href="' . add_query_arg( 'pageNum', 1, $permalink ) . '" title="' . esc_attr__('Page', 'gwolle-gb') . ' 1">1</a>';
		if ($pages_total > 4) {
			$pagination .= '<span class="page-numbers dots">...</span>';
		}
		if ( ($page_num + 2 ) < $pages_total ) {
			$minrange = $page_num - 2;
			$showrange = $page_num + 2;
		} else {
			$minrange = $page_num - 3;
			$showrange = $pages_total - 1;
		}
		for ($i = $minrange; $i <= $showrange; $i++) {
			if ($i === $page_num) {
				$pagination .= '<span class="page-numbers current">' . $i . '</span>';
			} else {
				$pagination .= '<a href="' . add_query_arg( 'pageNum', $i, $permalink ) . '" title="' . esc_attr__('Page', 'gwolle-gb') . ' ' . $i . '">' . $i . '</a>';
			}
		}
		if ($page_num === $pages_total) {
			$pagination .= '<span class="page-numbers current">' . $page_num . '</span>';
		}
	}

	if ($page_num < $pages_total) {
		if ( ( ( $page_num + 3 ) < $pages_total ) && ( ! $high_dots_made ) ) {
			$pagination .= '<span class="page-numbers dots">...</span>';
			$high_dots_made = true;
		}
		if ( ! in_array( $pages_total, $pages_done ) ) {
			$pagination .= '<a href="' . add_query_arg( 'pageNum', $pages_total, $permalink ) . '" title="' . esc_attr__('Page', 'gwolle-gb') . ' ' . $pages_total . '">' . $pages_total . '</a>';
		}
		$pagination .= '<a href="' . add_query_arg( 'pageNum', round($page_num + 1), $permalink ) . '" title="' . esc_attr__('Next page', 'gwolle-gb') . '" rel="next">&rarr;</a>';
	}

	// 'All' link
	if ( $pages_total >= 2 && get_option( 'gwolle_gb-paginate_all', 'false' ) === 'true' && ! $is_search ) {
		if ( isset($_GET['show_all']) && $_GET['show_all'] === 'true' ) {
			$pagination .= '<span class="page-numbers all">' . esc_html__('All', 'gwolle-gb') . '</span>';
		} else {
			$pagination .= '<a href="' . add_query_arg( 'show_all', 'true', $permalink ) . '" title="' . esc_attr__('All entries', 'gwolle-gb') . '">' . esc_html__('All', 'gwolle-gb') . '</a>';
		}
	}

	$pagination .= '</div>
		';

	if ($pages_total > 1) {
		return $pagination;
	}

}