From 422bbbc69c7c00f7df82699755d0a8ad19d16215 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= <grosse@cosmocode.de>
Date: Thu, 29 Mar 2018 15:29:39 +0200
Subject: [PATCH] refactor: rename dta and dtb parameters

They are now named min and max respectively, which is hopefully less
cryptic.
---
 inc/Action/Search.php  |  4 ++--
 inc/Ui/Search.php      | 12 ++++++------
 inc/Ui/SearchState.php |  8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/inc/Action/Search.php b/inc/Action/Search.php
index 42a5945bf..c182ca3e9 100644
--- a/inc/Action/Search.php
+++ b/inc/Action/Search.php
@@ -64,8 +64,8 @@ class Search extends AbstractAction {
     protected function execute()
     {
         global $INPUT, $QUERY;
-        $after = $INPUT->str('dta');
-        $before = $INPUT->str('dtb');
+        $after = $INPUT->str('min');
+        $before = $INPUT->str('max');
         $this->pageLookupResults = ft_pageLookup($QUERY, true, useHeading('navigation'), $after, $before);
         $this->fullTextResults = ft_pageSearch($QUERY, $highlight, $INPUT->str('srt'), $after, $before);
         $this->highlight = $highlight;
diff --git a/inc/Ui/Search.php b/inc/Ui/Search.php
index 47da90655..c27cd7764 100644
--- a/inc/Ui/Search.php
+++ b/inc/Ui/Search.php
@@ -69,11 +69,11 @@ class Search extends Ui
         $searchForm->setHiddenField('do', 'search');
         $searchForm->setHiddenField('id', $ID);
         $searchForm->setHiddenField('sf', '1');
-        if ($INPUT->has('dta')) {
-            $searchForm->setHiddenField('dta', $INPUT->str('dta'));
+        if ($INPUT->has('min')) {
+            $searchForm->setHiddenField('min', $INPUT->str('min'));
         }
-        if ($INPUT->has('dtb')) {
-            $searchForm->setHiddenField('dtb', $INPUT->str('dtb'));
+        if ($INPUT->has('max')) {
+            $searchForm->setHiddenField('max', $INPUT->str('max'));
         }
         if ($INPUT->has('srt')) {
             $searchForm->setHiddenField('srt', $INPUT->str('srt'));
@@ -421,7 +421,7 @@ class Search extends Ui
         ];
         $activeOption = 'any';
         foreach ($options as $key => $option) {
-            if ($INPUT->str('dta') === $option['after']) {
+            if ($INPUT->str('min') === $option['after']) {
                 $activeOption = $key;
                 break;
             }
@@ -430,7 +430,7 @@ class Search extends Ui
         $searchForm->addTagOpen('div')->addClass('toggle')->attr('aria-haspopup', 'true');
         // render current
         $currentWrapper = $searchForm->addTagOpen('div')->addClass('current');
-        if ($INPUT->has('dtb') || $INPUT->has('dta')) {
+        if ($INPUT->has('max') || $INPUT->has('min')) {
             $currentWrapper->addClass('changed');
         }
         $searchForm->addHTML($options[$activeOption]['label']);
diff --git a/inc/Ui/SearchState.php b/inc/Ui/SearchState.php
index beaac4e1c..f45156d28 100644
--- a/inc/Ui/SearchState.php
+++ b/inc/Ui/SearchState.php
@@ -20,10 +20,10 @@ class SearchState
 
         $this->parsedQuery = $parsedQuery;
         if (!isset($parsedQuery['after'])) {
-            $this->parsedQuery['after'] = $INPUT->str('dta');
+            $this->parsedQuery['after'] = $INPUT->str('min');
         }
         if (!isset($parsedQuery['before'])) {
-            $this->parsedQuery['before'] = $INPUT->str('dtb');
+            $this->parsedQuery['before'] = $INPUT->str('max');
         }
         if (!isset($parsedQuery['sort'])) {
             $this->parsedQuery['sort'] = $INPUT->str('srt');
@@ -126,10 +126,10 @@ class SearchState
         );
         $hrefAttributes = ['do' => 'search', 'sf' => '1', 'q' => $newQuery];
         if ($parsedQuery['after']) {
-            $hrefAttributes['dta'] = $parsedQuery['after'];
+            $hrefAttributes['min'] = $parsedQuery['after'];
         }
         if ($parsedQuery['before']) {
-            $hrefAttributes['dtb'] = $parsedQuery['before'];
+            $hrefAttributes['max'] = $parsedQuery['before'];
         }
         if ($parsedQuery['sort']) {
             $hrefAttributes['srt'] = $parsedQuery['sort'];
-- 
GitLab