Allow users to filter albums by contributors #48
@ -155,24 +155,20 @@ class PageIndex
|
|||||||
|
|
||||||
public function getLink($start = null, $order = null, $dir = null)
|
public function getLink($start = null, $order = null, $dir = null)
|
||||||
{
|
{
|
||||||
$url = $this->base_url;
|
$page = !is_string($start) ? ($start / $this->items_per_page) + 1 : $start;
|
||||||
$amp = strpos($this->base_url, '?') ? '&' : '?';
|
$url = $this->base_url . str_replace('%PAGE%', $page, $this->page_slug);
|
||||||
|
|
||||||
if (!empty($start))
|
$urlParams = [];
|
||||||
{
|
|
||||||
$page = $start !== '%d' ? ($start / $this->items_per_page) + 1 : $start;
|
|
||||||
$url .= strtr($this->page_slug, ['%PAGE%' => $page, '%AMP%' => $amp]);
|
|
||||||
$amp = '&';
|
|
||||||
}
|
|
||||||
if (!empty($order))
|
if (!empty($order))
|
||||||
{
|
$urlParams['order'] = $order;
|
||||||
$url .= $amp . 'order=' . $order;
|
|
||||||
$amp = '&';
|
|
||||||
}
|
|
||||||
if (!empty($dir))
|
if (!empty($dir))
|
||||||
|
$urlParams['dir'] = $dir;
|
||||||
|
|
||||||
|
if (!empty($urlParams))
|
||||||
{
|
{
|
||||||
$url .= $amp . 'dir=' . $dir;
|
$queryString = (strpos($uri, '?') !== false ? '&' : '?');
|
||||||
$amp = '&';
|
$queryString .= http_build_query($urlParams);
|
||||||
|
$url .= $queryString;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
|
Loading…
Reference in New Issue
Block a user