PluginProbe
User Access Manager / 2.1.11
User Access Manager v2.1.11
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/Controller/Backend/ControllerTabNavigationTrait.php +89 -17 2.3.16 → 2.1.11 View file →
@@ -1,8 +1,18 @@
1 1 <?php
2 -
3 -declare(strict_types=1);
4 -
2 +/**
3 + * ControllerTabNavigationTrait.php
4 + *
5 + * The ControllerTabNavigationTrait class file.
6 + *
7 + * PHP versions 5
8 + *
9 + * @author Alexander Schneider <[email protected]>
10 + * @copyright 2008-2017 Alexander Schneider
11 + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 + * @version SVN: $id$
13 + * @link http://wordpress.org/extend/plugins/user-access-manager/
14 + */
5 15 namespace UserAccessManager\Controller\Backend;
6 16
7 17 /**
8 18 * Trait ControllerTabNavigationTrait
@@ -10,27 +20,69 @@
10 20 * @package UserAccessManager\Controller
11 21 */
12 22 trait ControllerTabNavigationTrait
13 23 {
14 - abstract public function getRequestUrl(): string;
24 + /**
25 + * Returns the current request url.
26 + *
27 + * @return string
28 + */
29 + abstract public function getRequestUrl();
15 30
16 - abstract public function getRequestParameter(string $name, $default = null): mixed;
31 + /**
32 + * Returns the request parameter.
33 + *
34 + * @param string $name
35 + * @param mixed $default
36 + *
37 + * @return mixed
38 + */
39 + abstract public function getRequestParameter($name, $default = null);
17 40
18 - abstract public function getGroupText(string $key): string;
41 + /**
42 + * Translates the given group by the group key.
43 + *
44 + * @param string $key
45 + *
46 + * @return string
47 + */
48 + abstract public function getGroupText($key);
19 49
20 - abstract public function getGroupSectionText(string $key): string;
50 + /**
51 + * Translates the given group section by the group key.
52 + *
53 + * @param string $key
54 + *
55 + * @return string
56 + */
57 + abstract public function getGroupSectionText($key);
21 58
22 - abstract public function getTabGroups(): array;
59 + /**
60 + * Returns the tab groups.
61 + *
62 + * @return array
63 + */
64 + abstract public function getTabGroups();
23 65
24 - public function getCurrentTabGroup(): string
66 + /**
67 + * Returns the current tab group.
68 + *
69 + * @return string
70 + */
71 + public function getCurrentTabGroup()
25 72 {
26 73 $groups = $this->getTabGroups();
27 74 $keys = array_keys($groups);
28 75
29 - return (string) $this->getRequestParameter('tab_group', reset($keys));
76 + return (string)$this->getRequestParameter('tab_group', reset($keys));
30 77 }
31 78
32 - public function getSections(): array
79 + /**
80 + * Returns the tab group sections.
81 + *
82 + * @return array
83 + */
84 + public function getSections()
33 85 {
34 86 $groups = $this->getTabGroups();
35 87 $group = $this->getCurrentTabGroup();
36 88
@@ -36,9 +88,14 @@
36 88
37 89 return isset($groups[$group]) === true ? $groups[$group] : [];
38 90 }
39 91
40 - public function getCurrentTabGroupSection(): string
92 + /**
93 + * Returns the current tab group section.
94 + *
95 + * @return string
96 + */
97 + public function getCurrentTabGroupSection()
41 98 {
42 99 $groups = $this->getTabGroups();
43 100 $group = $this->getCurrentTabGroup();
44 101
@@ -48,21 +105,36 @@
48 105 $firstGroup = reset($groups);
49 106 $default = reset($firstGroup);
50 107 }
51 108
52 - return (string) $this->getRequestParameter('tab_group_section', $default);
109 + return (string)$this->getRequestParameter('tab_group_section', $default);
53 110 }
54 111
55 - public function getTabGroupLink(string $groupKey): string
112 + /**
113 + * Returns the settings group link by the given group key.
114 + *
115 + * @param string $groupKey
116 + *
117 + * @return string
118 + */
119 + public function getTabGroupLink($groupKey)
56 120 {
57 121 $rawUrl = $this->getRequestUrl();
58 122 $url = preg_replace('/&amp;tab_group[^&]*/i', '', $rawUrl);
59 - return $url . '&tab_group=' . $groupKey;
123 + return $url.'&tab_group='.$groupKey;
60 124 }
61 125
62 - public function getTabGroupSectionLink(string $groupKey, string $sectionKey): string
126 + /**
127 + * Returns the settings section link by the given group and section key.
128 + *
129 + * @param string $groupKey
130 + * @param string $sectionKey
131 + *
132 + * @return string
133 + */
134 + public function getTabGroupSectionLink($groupKey, $sectionKey)
63 135 {
64 136 $rawUrl = $this->getTabGroupLink($groupKey);
65 137 $url = preg_replace('/&amp;tab_group_section[^&]*/i', '', $rawUrl);
66 - return $url . '&tab_group_section=' . $sectionKey;
138 + return $url.'&tab_group_section='.$sectionKey;
67 139 }
68 140 }