<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class PageHtmlUtil { private static function itemRender($E3ils, $s3Bxz, $j7lI_, $YjgEW) { goto FrSvZ; FrSvZ: $STW4e = array(); goto VyK9u; VyK9u: for ($VJ5vg = $E3ils; $VJ5vg <= $s3Bxz; $VJ5vg++) { if ($VJ5vg == $j7lI_) { $STW4e[] = '<span class="current">' . $VJ5vg . '</span>'; } else { $STW4e[] = '<a class="page" href="' . str_replace('{page}', $VJ5vg, $YjgEW) . '">' . $VJ5vg . '</a>'; } } goto nCTL6; nCTL6: return join('', $STW4e); goto TdH0a; TdH0a: } public static function nextPageUrl($m8DRO, $dULcu, $j7lI_, $YjgEW = '/url/for/path?page={page}') { goto tO6od; tO6od: $HSXbY = ceil($m8DRO / $dULcu); goto xJKYT; xJKYT: if ($j7lI_ < $HSXbY) { return str_replace('{page}', $j7lI_ + 1, $YjgEW); } goto Ix3iA; Ix3iA: return null; goto eJ1XB; eJ1XB: } public static function prevPageUrl($m8DRO, $dULcu, $j7lI_, $YjgEW = '/url/for/path?page={page}') { if ($j7lI_ > 1) { return str_replace('{page}', $j7lI_ - 1, $YjgEW); } return null; } public static function render($m8DRO, $dULcu, $j7lI_, $YjgEW = '/url/for/path?page={page}') { goto mkxj_; WFRAd: if ($j7lI_ < 1) { $j7lI_ = 1; } else { if ($j7lI_ > $HSXbY) { $j7lI_ = $HSXbY; } } goto M5E4C; QDmMX: if ($HSXbY < 6) { if ($HSXbY > 0) { $STW4e[] = self::itemRender(1, $HSXbY, $j7lI_, $YjgEW); } } else { goto zI7D8; IyAIy: if ($S5T8H > $HSXbY - 3) { $S5T8H = $HSXbY - 3; } goto vjPaU; vjPaU: if ($g99Yj > 3 + 1) { $STW4e[] = '<span class="more">...</span>'; } goto F4jXc; ZMH2f: if ($S5T8H < $HSXbY - 3) { $STW4e[] = '<span class="more">...</span>'; } goto OgEgb; F4jXc: $STW4e[] = self::itemRender($g99Yj, $S5T8H, $j7lI_, $YjgEW); goto ZMH2f; x9HcX: if ($g99Yj < 4) { $g99Yj = 4; } goto IyAIy; wmX9v: $S5T8H = $j7lI_ + 3; goto x9HcX; DNke7: $g99Yj = $j7lI_ - 3; goto wmX9v; zI7D8: $STW4e[] = self::itemRender(1, 3, $j7lI_, $YjgEW); goto DNke7; OgEgb: $STW4e[] = self::itemRender($HSXbY - 2, $HSXbY, $j7lI_, $YjgEW); goto itXWx; itXWx: } goto ae20_; KSc5g: $STW4e[] = '</div>'; goto udIVF; r7VpP: $STW4e[] = '<div class="pages">'; goto QDmMX; udIVF: return join('', $STW4e); goto SQeqj; mkxj_: $HSXbY = ceil($m8DRO / $dULcu); goto WFRAd; M5E4C: $STW4e = array(); goto r7VpP; MWkbB: if ($j7lI_ < $HSXbY) { $STW4e[] = '<a class="page" href="' . str_replace('{page}', $j7lI_ + 1, $YjgEW) . '">下一页</a>'; } goto KSc5g; ae20_: if ($j7lI_ > 1) { $STW4e[] = '<a class="page" href="' . str_replace('{page}', $j7lI_ - 1, $YjgEW) . '">上一页</a>'; } goto MWkbB; SQeqj: } }