<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class PageHtmlUtil { private static function itemRender($nktn1, $R96Y0, $x_kpJ, $iERFh) { goto PVlrz; S_3TN: for ($Xn_Rr = $nktn1; $Xn_Rr <= $R96Y0; $Xn_Rr++) { if ($Xn_Rr == $x_kpJ) { $f6TlW[] = '<span class="current">' . $Xn_Rr . '</span>'; } else { $f6TlW[] = '<a class="page" href="' . str_replace('{page}', $Xn_Rr, $iERFh) . '">' . $Xn_Rr . '</a>'; } } goto aU0Cn; PVlrz: $f6TlW = array(); goto S_3TN; aU0Cn: return join('', $f6TlW); goto dUJ8U; dUJ8U: } public static function nextPageUrl($rSN7C, $guJef, $x_kpJ, $iERFh = '/url/for/path?page={page}') { goto C06XU; C06XU: $yJUKj = ceil($rSN7C / $guJef); goto pv1D2; vzRy5: return null; goto wuH8w; pv1D2: if ($x_kpJ < $yJUKj) { return str_replace('{page}', $x_kpJ + 1, $iERFh); } goto vzRy5; wuH8w: } public static function prevPageUrl($rSN7C, $guJef, $x_kpJ, $iERFh = '/url/for/path?page={page}') { if ($x_kpJ > 1) { return str_replace('{page}', $x_kpJ - 1, $iERFh); } return null; } public static function render($rSN7C, $guJef, $x_kpJ, $iERFh = '/url/for/path?page={page}') { goto EkJs8; c3E2w: if ($x_kpJ < $yJUKj) { $f6TlW[] = '<a class="page" href="' . str_replace('{page}', $x_kpJ + 1, $iERFh) . '">下一页</a>'; } goto SzDfy; CAZp7: return join('', $f6TlW); goto ehA2H; ar08e: if ($x_kpJ > 1) { $f6TlW[] = '<a class="page" href="' . str_replace('{page}', $x_kpJ - 1, $iERFh) . '">上一页</a>'; } goto c3E2w; qJPfD: $f6TlW[] = '<div class="pages">'; goto sDroC; EkJs8: $yJUKj = ceil($rSN7C / $guJef); goto O1nnq; PefgM: $f6TlW = array(); goto qJPfD; SzDfy: $f6TlW[] = '</div>'; goto CAZp7; O1nnq: if ($x_kpJ < 1) { $x_kpJ = 1; } else { if ($x_kpJ > $yJUKj) { $x_kpJ = $yJUKj; } } goto PefgM; sDroC: if ($yJUKj < 6) { if ($yJUKj > 0) { $f6TlW[] = self::itemRender(1, $yJUKj, $x_kpJ, $iERFh); } } else { goto cBhc2; Om3fW: $DJU0U = $x_kpJ - 3; goto zCY0c; Ztmxr: $f6TlW[] = self::itemRender($DJU0U, $MKppF, $x_kpJ, $iERFh); goto Tb3wP; X3mYR: if ($MKppF > $yJUKj - 3) { $MKppF = $yJUKj - 3; } goto OWpyY; cBhc2: $f6TlW[] = self::itemRender(1, 3, $x_kpJ, $iERFh); goto Om3fW; OWpyY: if ($DJU0U > 3 + 1) { $f6TlW[] = '<span class="more">...</span>'; } goto Ztmxr; XJNSR: if ($DJU0U < 4) { $DJU0U = 4; } goto X3mYR; Tb3wP: if ($MKppF < $yJUKj - 3) { $f6TlW[] = '<span class="more">...</span>'; } goto bo5b7; bo5b7: $f6TlW[] = self::itemRender($yJUKj - 2, $yJUKj, $x_kpJ, $iERFh); goto P4BrD; zCY0c: $MKppF = $x_kpJ + 3; goto XJNSR; P4BrD: } goto ar08e; ehA2H: } }