X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FBoundariesPager.php;h=ebdd72c911abe2ad458080231e410a9dd810459a;hb=122ad0af14f046c2462a03fe33967dc41abfc8b5;hp=da296bd8cc95bda3a7e9c22c2aa3752717d1fca0;hpb=e89e606b8827f6dc43f29db0965e27b12249d9dd;p=friendica.git diff --git a/src/Content/BoundariesPager.php b/src/Content/BoundariesPager.php index da296bd8cc..ebdd72c911 100644 --- a/src/Content/BoundariesPager.php +++ b/src/Content/BoundariesPager.php @@ -21,17 +21,18 @@ namespace Friendica\Content; +use Friendica\Core\L10n; use Friendica\Core\Renderer; -use Friendica\DI; use Friendica\Util\Network; use Friendica\Util\Strings; /** - * This pager should be used by lists using the since_id/max_id parameters + * This pager should be used by lists using the min_id†/max_id† parameters * - * In this context, "id" refers to the value of the column that the list is ordered by. - * This pager automatically identifies if the sorting is done increasingly or decreasingly if the first item id - * and last item id are different. Otherwise it defaults to decreasingly like reverse chronological lists. + * This pager automatically identifies if the sorting is done increasingly or decreasingly if the first item id† + * and last item id† are different. Otherwise it defaults to decreasingly like reverse chronological lists. + * + * † In this context, "id" refers to the value of the column that the item list is ordered by. */ class BoundariesPager extends Pager { @@ -42,25 +43,26 @@ class BoundariesPager extends Pager /** * Instantiates a new Pager with the base parameters. * + * @param L10n $l10n * @param string $queryString The query string of the current page - * @param string $first_item_id The i - * @param string $last_item_id - * @param integer $itemsPerPage An optional number of items per page to override the default value + * @param string $first_item_id The id† of the first item in the displayed item list + * @param string $last_item_id The id† of the last item in the displayed item list + * @param integer $itemsPerPage An optional number of items per page to override the default value */ - public function __construct($queryString, $first_item_id = null, $last_item_id = null, $itemsPerPage = 50) + public function __construct(L10n $l10n, $queryString, $first_item_id = null, $last_item_id = null, $itemsPerPage = 50) { - parent::__construct($queryString, $itemsPerPage); + parent::__construct($l10n, $queryString, $itemsPerPage); $this->first_item_id = $first_item_id; $this->last_item_id = $last_item_id; $parsed = parse_url($this->getBaseQueryString()); - if ($parsed) { + if (!empty($parsed['query'])) { parse_str($parsed['query'], $queryParameters); - $this->first_page = !($queryParameters['since_id'] ?? null) && !($queryParameters['max_id'] ?? null); + $this->first_page = !($queryParameters['min_id'] ?? null) && !($queryParameters['max_id'] ?? null); - unset($queryParameters['since_id']); + unset($queryParameters['min_id']); unset($queryParameters['max_id']); $parsed['query'] = http_build_query($queryParameters); @@ -109,17 +111,17 @@ class BoundariesPager extends Pager 'prev' => [ 'url' => Strings::ensureQueryParameter($this->baseQueryString . ($this->first_item_id >= $this->last_item_id ? - '&since_id=' . $this->first_item_id : '&max_id=' . $this->first_item_id) + '&min_id=' . $this->first_item_id : '&max_id=' . $this->first_item_id) ), - 'text' => DI::l10n()->t('newer'), + 'text' => $this->l10n->t('newer'), 'class' => 'previous' . ($this->first_page ? ' disabled' : '') ], 'next' => [ 'url' => Strings::ensureQueryParameter($this->baseQueryString . ($this->first_item_id >= $this->last_item_id ? - '&max_id=' . $this->last_item_id : '&since_id=' . $this->last_item_id) + '&max_id=' . $this->last_item_id : '&min_id=' . $this->last_item_id) ), - 'text' => DI::l10n()->t('older'), + 'text' => $this->l10n->t('older'), 'class' => 'next' . ($displayedItemCount < $this->getItemsPerPage() ? ' disabled' : '') ] ];