= '1.5.1') ? self::DEFAULT_IMG.'_default' : self::DEFAULT_IMG; } public static function pagination($page = 1, $maxInPage = 10, $totalInvoice = 0, $pageAddress = false, $selectorName = 'page') { $container = 'div'; $style = 'class'; $link = 'a'; $currentPage = $page; $html = '<'.$container.' '.$style.'="pagination">'; if (empty($page)) { $page = 1; $currentPage = 1; } if ($maxInPage >= $totalInvoice) { $html .= ''; return array (0, $maxInPage, $html); } $start = ($maxInPage * $page) - $maxInPage; if ($totalInvoice <= $maxInPage) { $num_of_pages = 1; } elseif (($totalInvoice % $maxInPage) == 0) { $num_of_pages = $totalInvoice / $maxInPage; } else { $num_of_pages = $totalInvoice / $maxInPage + 1; } if ($currentPage > 1) { $back = $currentPage - 1; $html .= '<'.$link.' href = "'.$pageAddress.$selectorName.'='.$back.'">«' . ' '; } $html .= '|'; $num_of_pages_f = (int)$num_of_pages; if ($currentPage - 4 > 1) { $html .= '<'.$link.' href = "'.$pageAddress.$selectorName.'=1">1|'; } if ($currentPage - 5 > 1) { $html .= ' ... |'; } $firs_element = $currentPage - 4; if ($firs_element < 1) { $firs_element = 1; } for ($i = $firs_element; $i < $currentPage; $i++) { $html .= '<'.$link.' href = "'.$pageAddress.$selectorName.'='.$i.'">'.$i.'|'; } $html .= ' '.$currentPage . ' |'; for ($i = $currentPage + 1; $i < $currentPage + 5; $i++) { if ($i > $num_of_pages_f) { break; } $html .= '<'.$link.' href = "'.$pageAddress.$selectorName.'='.$i.'">'.$i.'|'; } if ($currentPage + 5 < $num_of_pages_f) { $html .= ' ... |'; } if ($currentPage + 4 < $num_of_pages_f) { $html .= '<'.$link.' href = "'.$pageAddress.$selectorName.'='.$num_of_pages_f.'">'.$num_of_pages_f.'|'; } if ($currentPage + 1 < $num_of_pages) { $next = $currentPage + 1; $html .= '<'.$link.' href = "'.$pageAddress.$selectorName.'='.$next.'">»'; } $html .= ''; return array($start, $maxInPage, $html); } public static function getUrlProtocolWithoutSlash() { if (method_exists('Tools', 'getShopProtocol')) { return str_replace('/', '', Tools::getShopProtocol()); } return (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && Tools::strtolower($_SERVER['HTTPS']) != 'off')) ? 'https:' : 'http:'; } }