@@ -158,8 +158,7 @@ discard block |
||
| 158 | 158 | if(! headers_sent()){ |
| 159 | 159 | header('Location: '.$url); |
| 160 | 160 | exit; |
| 161 | - } |
|
| 162 | - else{ |
|
| 161 | + } else{ |
|
| 163 | 162 | echo '<script> |
| 164 | 163 | location.href = "'.$url.'"; |
| 165 | 164 | </script>'; |
@@ -208,12 +207,10 @@ discard block |
||
| 208 | 207 | if($moduleViewPath){ |
| 209 | 208 | $path = $moduleViewPath; |
| 210 | 209 | $logger->info('Found view [' . $view . '] in module [' .$mod. '], the file path is [' .$moduleViewPath. '] we will used it'); |
| 211 | - } |
|
| 212 | - else{ |
|
| 210 | + } else{ |
|
| 213 | 211 | $logger->info('Cannot find view [' . $view . '] in module [' .$mod. '] using the default location'); |
| 214 | 212 | } |
| 215 | - } |
|
| 216 | - else{ |
|
| 213 | + } else{ |
|
| 217 | 214 | $logger->info('The current request does not use module using the default location.'); |
| 218 | 215 | } |
| 219 | 216 | } |
@@ -358,8 +355,7 @@ discard block |
||
| 358 | 355 | echo $content; |
| 359 | 356 | ob_end_flush(); |
| 360 | 357 | return; |
| 361 | - } |
|
| 362 | - else{ |
|
| 358 | + } else{ |
|
| 363 | 359 | $logger->info('The page cache content for the URL [' . $url . '] is not valid may be already expired'); |
| 364 | 360 | $cache->delete($pageCacheKey); |
| 365 | 361 | } |
@@ -407,8 +403,7 @@ discard block |
||
| 407 | 403 | $output = ob_get_clean(); |
| 408 | 404 | self::sendHeaders(404); |
| 409 | 405 | echo $output; |
| 410 | - } |
|
| 411 | - else{ |
|
| 406 | + } else{ |
|
| 412 | 407 | show_error('The 404 view [' .$path. '] does not exist'); |
| 413 | 408 | } |
| 414 | 409 | } |
@@ -431,8 +426,7 @@ discard block |
||
| 431 | 426 | $output = ob_get_clean(); |
| 432 | 427 | self::sendHeaders(503); |
| 433 | 428 | echo $output; |
| 434 | - } |
|
| 435 | - else{ |
|
| 429 | + } else{ |
|
| 436 | 430 | //can't use show_error() at this time because some dependencies not yet loaded and to prevent loop |
| 437 | 431 | set_http_status_header(503); |
| 438 | 432 | echo 'The error view [' . $path . '] does not exist'; |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | require_once CONFIG_PATH . 'config_pagination.php'; |
| 49 | 49 | if (empty($config) || ! is_array($config)){ |
| 50 | 50 | show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php'); |
| 51 | - } |
|
| 52 | - else{ |
|
| 51 | + } else{ |
|
| 53 | 52 | if (! empty($overwriteConfig)){ |
| 54 | 53 | $config = array_merge($config, $overwriteConfig); |
| 55 | 54 | } |
@@ -58,8 +57,7 @@ discard block |
||
| 58 | 57 | Config::setAll($config); |
| 59 | 58 | unset($config); |
| 60 | 59 | } |
| 61 | - } |
|
| 62 | - else{ |
|
| 60 | + } else{ |
|
| 63 | 61 | show_error('Unable to find the pagination configuration file'); |
| 64 | 62 | } |
| 65 | 63 | } |
@@ -119,18 +117,15 @@ discard block |
||
| 119 | 117 | $query = ''; |
| 120 | 118 | if ($queryString == ''){ |
| 121 | 119 | $query = '?' . $pageQueryName . '='; |
| 122 | - } |
|
| 123 | - else{ |
|
| 120 | + } else{ |
|
| 124 | 121 | $tab = explode($pageQueryName . '=', $queryString); |
| 125 | 122 | $nb = count($tab); |
| 126 | 123 | if ($nb == 1){ |
| 127 | 124 | $query = '?' . $queryString . '&' . $pageQueryName . '='; |
| 128 | - } |
|
| 129 | - else{ |
|
| 125 | + } else{ |
|
| 130 | 126 | if ($tab[0] == ''){ |
| 131 | 127 | $query = '?' . $pageQueryName . '='; |
| 132 | - } |
|
| 133 | - else{ |
|
| 128 | + } else{ |
|
| 134 | 129 | $query = '?' . $tab[0] . '' . $pageQueryName . '='; |
| 135 | 130 | } |
| 136 | 131 | } |
@@ -175,20 +170,17 @@ discard block |
||
| 175 | 170 | if ($numberOfLink % 2 == 0){ |
| 176 | 171 | $start = $currentPageNumber - ($numberOfLink / 2) + 1; |
| 177 | 172 | $end = $currentPageNumber + ($numberOfLink / 2); |
| 178 | - } |
|
| 179 | - else{ |
|
| 173 | + } else{ |
|
| 180 | 174 | $start = $currentPageNumber - floor($numberOfLink / 2); |
| 181 | 175 | $end = $currentPageNumber + floor($numberOfLink / 2); |
| 182 | 176 | } |
| 183 | 177 | if ($start <= 1){ |
| 184 | 178 | $begin = 1; |
| 185 | 179 | $end = $numberOfLink; |
| 186 | - } |
|
| 187 | - else if ($start > 1 && $end < $numberOfPage){ |
|
| 180 | + } else if ($start > 1 && $end < $numberOfPage){ |
|
| 188 | 181 | $begin = $start; |
| 189 | 182 | $end = $end; |
| 190 | - } |
|
| 191 | - else{ |
|
| 183 | + } else{ |
|
| 192 | 184 | $begin = ($numberOfPage - $numberOfLink) + 1; |
| 193 | 185 | $end = $numberOfPage; |
| 194 | 186 | } |
@@ -204,8 +196,7 @@ discard block |
||
| 204 | 196 | /////////// |
| 205 | 197 | else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){ |
| 206 | 198 | $navbar .= $this->buildPaginationLinkForMiddlePage($begin, $end, $currentPageNumber); |
| 207 | - } |
|
| 208 | - else if ($currentPageNumber == $numberOfPage){ |
|
| 199 | + } else if ($currentPageNumber == $numberOfPage){ |
|
| 209 | 200 | $navbar .= $this->buildPaginationLinkForLastPage($begin, $end, $currentPageNumber); |
| 210 | 201 | } |
| 211 | 202 | $navbar = $this->config['pagination_open'] . $navbar . $this->config['pagination_close']; |
@@ -225,8 +216,7 @@ discard block |
||
| 225 | 216 | for($i = $begin; $i <= $end; $i++){ |
| 226 | 217 | if ($i == $currentPageNumber){ |
| 227 | 218 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
| 228 | - } |
|
| 229 | - else{ |
|
| 219 | + } else{ |
|
| 230 | 220 | $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close']; |
| 231 | 221 | } |
| 232 | 222 | } |
@@ -248,8 +238,7 @@ discard block |
||
| 248 | 238 | for($i = $begin; $i <= $end; $i++){ |
| 249 | 239 | if ($i == $currentPageNumber){ |
| 250 | 240 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
| 251 | - } |
|
| 252 | - else{ |
|
| 241 | + } else{ |
|
| 253 | 242 | $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close']; |
| 254 | 243 | } |
| 255 | 244 | } |
@@ -271,8 +260,7 @@ discard block |
||
| 271 | 260 | for($i = $begin; $i <= $end; $i++){ |
| 272 | 261 | if ($i == $currentPageNumber){ |
| 273 | 262 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
| 274 | - } |
|
| 275 | - else{ |
|
| 263 | + } else{ |
|
| 276 | 264 | $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close']; |
| 277 | 265 | } |
| 278 | 266 | } |