1616 * @since 2010-01-19
1717 */
1818
19- namespace phpMyFAQ \Helper ;
19+ namespace phpMyFAQ \Administration ;
2020
2121use phpMyFAQ \Enums \ReleaseType ;
2222use phpMyFAQ \Translation ;
2828 *
2929 * @package phpMyFAQ\Helper
3030 */
31- class AdministrationHelper
31+ class Helper
3232{
3333 /**
3434 * Array with permissions.
@@ -40,43 +40,34 @@ class AdministrationHelper
4040 * ',' stands for 'or', '*' stands for 'and'.
4141 *
4242 * @param string $restrictions Restrictions
43- * @param string $action Action parameter
4443 * @param string $caption Caption
4544 * @param string|null $route Route, will be used if it's not empty
4645 * @param bool $checkPerm Check permission (default: true)
4746 */
4847 public function addMenuEntry (
4948 string $ restrictions = '' ,
50- string $ action = '' ,
5149 string $ caption = '' ,
5250 ?string $ route = null ,
5351 bool $ checkPerm = true
5452 ): string {
5553
56- if ($ action !== '' ) {
57- $ action = '?action= ' . $ action ;
58- }
59-
60- if (!is_null ($ route )) {
61- $ action = './ ' . $ route ;
62- }
63-
6454 if (Translation::get ($ caption ) !== null ) {
6555 $ renderedCaption = Translation::get ($ caption );
6656 } else {
6757 $ renderedCaption = 'No string for ' . $ caption ;
6858 }
6959
7060 $ output = sprintf (
71- '<a class="nav-link" href="%s">%s</a>%s ' ,
72- $ action ,
61+ '<a class="nav-link" href="./ %s">%s</a>%s ' ,
62+ $ route ,
7363 $ renderedCaption ,
7464 "\n"
7565 );
7666
7767 if ($ checkPerm ) {
7868 return $ this ->evaluatePermission ($ restrictions ) ? $ output : '' ;
7969 }
70+
8071 return $ output ;
8172 }
8273
@@ -175,7 +166,7 @@ public static function sortingKeyOptions(string $current): string
175166 $ output = '' ;
176167
177168 foreach ($ options as $ option ) {
178- $ output .= AdministrationHelper ::generateOption (
169+ $ output .= Helper ::generateOption (
179170 $ current ,
180171 $ option ,
181172 'ad_conf_order_ ' . $ option
@@ -194,7 +185,7 @@ public static function sortingOrderOptions(string $current): string
194185 $ output = '' ;
195186
196187 foreach ($ options as $ option ) {
197- $ output .= AdministrationHelper ::generateOption (
188+ $ output .= Helper ::generateOption (
198189 $ current ,
199190 $ option ,
200191 'ad_conf_ ' . strtolower ($ option )
@@ -210,7 +201,7 @@ public static function sortingPopularFaqsOptions(string $current): string
210201 $ output = '' ;
211202
212203 foreach ($ options as $ option ) {
213- $ output .= AdministrationHelper ::generateOption (
204+ $ output .= Helper ::generateOption (
214205 $ current ,
215206 $ option ,
216207 'records.orderingPopularFaqs. ' . $ option
@@ -223,33 +214,33 @@ public static function sortingPopularFaqsOptions(string $current): string
223214 public static function searchRelevanceOptions (string $ current ): string
224215 {
225216 $ output = '' ;
226- $ output .= AdministrationHelper ::generateOption (
217+ $ output .= Helper ::generateOption (
227218 $ current ,
228219 'thema,content,keywords ' ,
229220 'search.relevance.thema-content-keywords '
230221 );
231- $ output .= AdministrationHelper ::generateOption (
222+ $ output .= Helper ::generateOption (
232223 $ current ,
233224 'thema,keywords,content ' ,
234225 'search.relevance.thema-keywords-content '
235226 );
236- $ output .= AdministrationHelper ::generateOption (
227+ $ output .= Helper ::generateOption (
237228 $ current ,
238229 'content,thema,keywords ' ,
239230 'search.relevance.content-thema-keywords '
240231 );
241- $ output .= AdministrationHelper ::generateOption (
232+ $ output .= Helper ::generateOption (
242233 $ current ,
243234 'content,keywords,thema ' ,
244235 'search.relevance.content-keywords-thema '
245236 );
246- $ output .= AdministrationHelper ::generateOption (
237+ $ output .= Helper ::generateOption (
247238 $ current ,
248239 'keywords,content,thema ' ,
249240 'search.relevance.keywords-content-thema '
250241 );
251242
252- return $ output . AdministrationHelper ::generateOption (
243+ return $ output . Helper ::generateOption (
253244 $ current ,
254245 'keywords,thema,content ' ,
255246 'search.relevance.keywords-thema-content '
0 commit comments