@@ -133,71 +133,74 @@ |
||
| 133 | 133 | $ext=$this->getParam(); |
| 134 | 134 | } |
| 135 | 135 | $pagination.="<ul class='pager'>"; |
| 136 | - if ($this->_page > 1) |
|
| 137 | - $pagination.="<li class='previous'><a href='".$path."$this->_instance=$prev"."$ext'><<</a></li>"; |
|
| 138 | - else |
|
| 139 | - $pagination.="<li class='disabled previous'><span class='disabled'><<</span></li>"; |
|
| 136 | + if ($this->_page > 1) { |
|
| 137 | + $pagination.="<li class='previous'><a href='".$path."$this->_instance=$prev"."$ext'><<</a></li>"; |
|
| 138 | + } else { |
|
| 139 | + $pagination.="<li class='disabled previous'><span class='disabled'><<</span></li>"; |
|
| 140 | + } |
|
| 140 | 141 | |
| 141 | 142 | if ($lastpage < 7 + ($adjacents * 2)) |
| 142 | 143 | { |
| 143 | 144 | for ($counter=1; $counter <= $lastpage; $counter++) |
| 144 | 145 | { |
| 145 | - if ($counter == $this->_page) |
|
| 146 | - $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 147 | - else |
|
| 148 | - $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 146 | + if ($counter == $this->_page) { |
|
| 147 | + $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 148 | + } else { |
|
| 149 | + $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 150 | + } |
|
| 149 | 151 | } |
| 150 | - } |
|
| 151 | - elseif ($lastpage > 5 + ($adjacents * 2)) |
|
| 152 | + } elseif ($lastpage > 5 + ($adjacents * 2)) |
|
| 152 | 153 | { |
| 153 | 154 | if ($this->_page < 1 + ($adjacents * 2)) |
| 154 | 155 | { |
| 155 | 156 | for ($counter=1; $counter < 4 + ($adjacents * 2); $counter++) |
| 156 | 157 | { |
| 157 | - if ($counter == $this->_page) |
|
| 158 | - $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 159 | - else |
|
| 160 | - $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 158 | + if ($counter == $this->_page) { |
|
| 159 | + $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 160 | + } else { |
|
| 161 | + $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 162 | + } |
|
| 161 | 163 | } |
| 162 | 164 | $pagination.="..."; |
| 163 | 165 | $pagination.="<li><a href='".$path."$this->_instance=$lpm1"."$ext'>$lpm1</a></li>"; |
| 164 | 166 | $pagination.="<li><a href='".$path."$this->_instance=$lastpage"."$ext'>$lastpage</a></li>"; |
| 165 | - } |
|
| 166 | - elseif ($lastpage - ($adjacents * 2) > $this->_page && $this->_page > ($adjacents * 2)) |
|
| 167 | + } elseif ($lastpage - ($adjacents * 2) > $this->_page && $this->_page > ($adjacents * 2)) |
|
| 167 | 168 | { |
| 168 | 169 | $pagination.="<li><a href='".$path."$this->_instance=1"."$ext'>1</a></li>"; |
| 169 | 170 | $pagination.="<li><a href='".$path."$this->_instance=2"."$ext'>2</a></li>"; |
| 170 | 171 | $pagination.="..."; |
| 171 | 172 | for ($counter=$this->_page - $adjacents; $counter <= $this->_page + $adjacents; $counter++) |
| 172 | 173 | { |
| 173 | - if ($counter == $this->_page) |
|
| 174 | - $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 175 | - else |
|
| 176 | - $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 174 | + if ($counter == $this->_page) { |
|
| 175 | + $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 176 | + } else { |
|
| 177 | + $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 178 | + } |
|
| 177 | 179 | } |
| 178 | 180 | $pagination.=".."; |
| 179 | 181 | $pagination.="<li><a href='".$path."$this->_instance=$lpm1"."$ext'>$lpm1</a></li>"; |
| 180 | 182 | $pagination.="<li><a href='".$path."$this->_instance=$lastpage"."$ext'>$lastpage</a></li>"; |
| 181 | - } |
|
| 182 | - else |
|
| 183 | + } else |
|
| 183 | 184 | { |
| 184 | 185 | $pagination.="<li><a href='".$path."$this->_instance=1"."$ext'>1</a></li>"; |
| 185 | 186 | $pagination.="<li><a href='".$path."$this->_instance=2"."$ext'>2</a></li>"; |
| 186 | 187 | $pagination.=".."; |
| 187 | 188 | for ($counter=$lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) |
| 188 | 189 | { |
| 189 | - if ($counter == $this->_page) |
|
| 190 | - $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 191 | - else |
|
| 192 | - $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 190 | + if ($counter == $this->_page) { |
|
| 191 | + $pagination.="<li class='current'><span>$counter</span></li>"; |
|
| 192 | + } else { |
|
| 193 | + $pagination.="<li><a href='".$path."$this->_instance=$counter"."$ext'>$counter</a></li>"; |
|
| 194 | + } |
|
| 193 | 195 | } |
| 194 | 196 | } |
| 195 | 197 | } |
| 196 | 198 | |
| 197 | - if ($this->_page < $counter - 1) |
|
| 198 | - $pagination.="<li class='next'><a href='".$path."$this->_instance=$next"."$ext'>>></a></li>"; |
|
| 199 | - else |
|
| 200 | - $pagination.="<li class='next disabled'><span class='disabled'>>></span></li>"; |
|
| 199 | + if ($this->_page < $counter - 1) { |
|
| 200 | + $pagination.="<li class='next'><a href='".$path."$this->_instance=$next"."$ext'>>></a></li>"; |
|
| 201 | + } else { |
|
| 202 | + $pagination.="<li class='next disabled'><span class='disabled'>>></span></li>"; |
|
| 203 | + } |
|
| 201 | 204 | $pagination.="</ul>\n"; |
| 202 | 205 | } |
| 203 | 206 | |
@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | if(isset($arr['status']) && $type==2){ |
| 42 | 42 | $ret=$arr; |
| 43 | - } |
|
| 44 | - else{ |
|
| 43 | + } else{ |
|
| 45 | 44 | $ret['status'] = $type; |
| 46 | 45 | $ret['data'] = $arr; |
| 47 | 46 | } |
@@ -156,7 +155,7 @@ discard block |
||
| 156 | 155 | // 重新生成id |
| 157 | 156 | session_regenerate_id(); |
| 158 | 157 | } |
| 159 | - }else { |
|
| 158 | + } else { |
|
| 160 | 159 | if (strpos($name, '.')) { |
| 161 | 160 | list($name1, $name2) = explode('.', $name); |
| 162 | 161 | return isset($_SESSION[$name1][$name2]) ? $_SESSION[$name1][$name2] : null; |
@@ -328,12 +327,11 @@ discard block |
||
| 328 | 327 | if ($filters) { |
| 329 | 328 | if (is_string($filters)) { |
| 330 | 329 | $filters = explode(',', $filters); |
| 331 | - } |
|
| 332 | - else if (is_array($filters)){ |
|
| 330 | + } else if (is_array($filters)){ |
|
| 333 | 331 | foreach ($filters as $filter) { |
| 334 | 332 | $data = array_map_recursive($filter, $data); // 参数过滤 |
| 335 | 333 | } |
| 336 | - }else{ |
|
| 334 | + } else{ |
|
| 337 | 335 | throw new \RuntimeException('$filters must be an array or string.'); |
| 338 | 336 | } |
| 339 | 337 | } |