<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class PageHtmlUtil { private static function itemRender($X9g7N, $bWtXG, $pnj3S, $MiLaY, $MA0DR) { goto lUvgg; zf2x7: return join('', $eAyzj); goto Rkk1N; ICd25: for ($jqibn = $X9g7N; $jqibn <= $bWtXG; $jqibn++) { if ($jqibn == $pnj3S) { $eAyzj[] = self::replace($MA0DR['current'], array('%p%' => $jqibn)); } else { $eAyzj[] = self::replace($MA0DR['item'], array('%p%' => $jqibn, '%s%' => self::buildPage($MiLaY, $jqibn))); } } goto zf2x7; lUvgg: $eAyzj = array(); goto ICd25; Rkk1N: } public static function nextPageUrl($sseUJ, $FaV7Q, $pnj3S, $MiLaY = '/url/for/path?page={page}') { goto tLYya; i0u3W: if ($pnj3S < $O8apb) { return self::buildPage($MiLaY, $pnj3S + 1); } goto SBocv; SBocv: return null; goto K7b7F; tLYya: $O8apb = ceil($sseUJ / $FaV7Q); goto i0u3W; K7b7F: } public static function prevPageUrl($sseUJ, $FaV7Q, $pnj3S, $MiLaY = '/url/for/path?page={page}') { if ($pnj3S > 1) { return self::buildPage($MiLaY, $pnj3S - 1); } return null; } private static function replace($AJKeI, $mattM = array()) { return str_replace(array_keys($mattM), array_values($mattM), $AJKeI); } private static function buildPage($MiLaY, $DbaB3) { return str_replace('{page}', $DbaB3, $MiLaY); } public static function render($sseUJ, $FaV7Q, $pnj3S, $MiLaY = '/url/for/path?page={page}', $MA0DR = null) { goto vJjuQ; Ebinl: $O8apb = ceil($sseUJ / $FaV7Q); goto GldKe; j40gh: if (!empty($MA0DR['last'])) { $eAyzj[] = self::replace($MA0DR['last'], array('%s%' => self::buildPage($MiLaY, $O8apb))); } goto toIsJ; toIsJ: return self::replace($MA0DR['warp'], array('%s%' => join('', $eAyzj))); goto tOg6x; jvTOW: if ($O8apb < 6) { if ($O8apb > 0) { $eAyzj[] = self::itemRender(1, $O8apb, $pnj3S, $MiLaY, $MA0DR); } } else { goto jtQea; Ww5OB: if ($kvx0s > $O8apb - 3) { $kvx0s = $O8apb - 3; } goto Ggs1F; jtQea: $eAyzj[] = self::itemRender(1, 3, $pnj3S, $MiLaY, $MA0DR); goto OTro0; OTro0: $BEw6p = $pnj3S - 3; goto TWEyg; TWEyg: $kvx0s = $pnj3S + 3; goto Ai9vs; Ai9vs: if ($BEw6p < 4) { $BEw6p = 4; } goto Ww5OB; Ggs1F: if ($BEw6p > 3 + 1) { $eAyzj[] = $MA0DR['more']; } goto uMFkM; zLD5D: $eAyzj[] = self::itemRender($O8apb - 2, $O8apb, $pnj3S, $MiLaY, $MA0DR); goto DZQYw; nX5Uo: if ($kvx0s < $O8apb - 3) { $eAyzj[] = $MA0DR['more']; } goto zLD5D; uMFkM: $eAyzj[] = self::itemRender($BEw6p, $kvx0s, $pnj3S, $MiLaY, $MA0DR); goto nX5Uo; DZQYw: } goto LiDzR; SXq2m: $eAyzj = array(); goto PHf9C; LiDzR: if ($pnj3S < $O8apb) { $eAyzj[] = self::replace($MA0DR['next'], array('%s%' => self::buildPage($MiLaY, $pnj3S + 1))); } else { if (!empty($MA0DR['nextDisabled'])) { $eAyzj[] = $MA0DR['nextDisabled']; } } goto j40gh; GldKe: if ($pnj3S < 1) { $pnj3S = 1; } else { if ($pnj3S > $O8apb) { $pnj3S = $O8apb; } } goto SXq2m; hBNVd: if ($pnj3S > 1) { $eAyzj[] = self::replace($MA0DR['prev'], array('%s%' => self::buildPage($MiLaY, $pnj3S - 1), '%p%' => $pnj3S - 1)); } else { if (!empty($MA0DR['prevDisabled'])) { $eAyzj[] = $MA0DR['prevDisabled']; } } goto jvTOW; vJjuQ: if (is_null($MA0DR)) { $MA0DR = array('warp' => '<div class="pages">%s%</div>', 'more' => '<span class="more">...</span>', 'prev' => '<a class="page" href="%s%">' . L('PrevPage') . '</a>', 'prevDisabled' => null, 'next' => '<a class="page" href="%s%">' . L('NextPage') . '</a>', 'nextDisabled' => null, 'current' => '<span class="current">%p%</span>', 'item' => '<a class="page" href="%s%">%p%</a>'); } goto Ebinl; PHf9C: if (!empty($MA0DR['first'])) { $eAyzj[] = self::replace($MA0DR['first'], array('%s%' => self::buildPage($MiLaY, 1))); } goto hBNVd; tOg6x: } }