← All changes
|
src/Controller/Frontend/AdminOutputControllerTrait.php
+51
-1
2.3.13
→
2.2.3
View file →
| @@ -1,5 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * FrontendAdminOutputControllerTrait.php | |
| 4 | + * | |
| 5 | + * The FrontendTermController trait file. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <alexanderschneider85@gmail.com> | |
| 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 | + */ | |
| 2 | 15 | |
| 3 | 16 | declare(strict_types=1); |
| 4 | 17 | |
| 5 | 18 | namespace UserAccessManager\Controller\Frontend; |
| @@ -11,17 +24,49 @@ | ||
| 11 | 24 | use UserAccessManager\UserGroup\UserGroupTypeException; |
| 12 | 25 | use UserAccessManager\Util\Util; |
| 13 | 26 | use UserAccessManager\Wrapper\Wordpress; |
| 14 | 27 | |
| 28 | +/** | |
| 29 | + * Trait FrontendAdminOutputControllerTrait | |
| 30 | + * | |
| 31 | + * @package UserAccessManager\Controller | |
| 32 | + */ | |
| 15 | 33 | trait AdminOutputControllerTrait |
| 16 | 34 | { |
| 35 | + /** | |
| 36 | + * @return Wordpress | |
| 37 | + */ | |
| 17 | 38 | abstract protected function getWordpress(): Wordpress; |
| 39 | + | |
| 40 | + /** | |
| 41 | + * @return WordpressConfig | |
| 42 | + */ | |
| 18 | 43 | abstract protected function getWordpressConfig(): WordpressConfig; |
| 44 | + | |
| 45 | + /** | |
| 46 | + * @return MainConfig | |
| 47 | + */ | |
| 19 | 48 | abstract protected function getMainConfig(): MainConfig; |
| 49 | + | |
| 50 | + /** | |
| 51 | + * @return Util | |
| 52 | + */ | |
| 20 | 53 | abstract protected function getUtil(): Util; |
| 54 | + | |
| 55 | + /** | |
| 56 | + * @return UserHandler | |
| 57 | + */ | |
| 21 | 58 | abstract protected function getUserHandler(): UserHandler; |
| 59 | + | |
| 60 | + /** | |
| 61 | + * @return UserGroupHandler | |
| 62 | + */ | |
| 22 | 63 | abstract protected function getUserGroupHandler(): UserGroupHandler; |
| 23 | 64 | |
| 65 | + /** | |
| 66 | + * Returns true if the hint text should be shown. | |
| 67 | + * @return bool | |
| 68 | + */ | |
| 24 | 69 | private function showAdminHint(): bool |
| 25 | 70 | { |
| 26 | 71 | return $this->getWordpressConfig()->atAdminPanel() === false |
| 27 | 72 | && $this->getMainConfig()->blogAdminHint() === true; |
| @@ -27,11 +72,16 @@ | ||
| 27 | 72 | && $this->getMainConfig()->blogAdminHint() === true; |
| 28 | 73 | } |
| 29 | 74 | |
| 30 | 75 | /** |
| 76 | + * Returns the admin hint. | |
| 77 | + * @param string $objectType The object type. | |
| 78 | + * @param int|string $objectId The object id we want to check. | |
| 79 | + * @param null $text The text on which we want to append the hint. | |
| 80 | + * @return string | |
| 31 | 81 | * @throws UserGroupTypeException |
| 32 | 82 | */ |
| 33 | - public function adminOutput(string $objectType, int|string|null $objectId, $text = null): string | |
| 83 | + public function adminOutput(string $objectType, $objectId, $text = null): string | |
| 34 | 84 | { |
| 35 | 85 | if ($this->showAdminHint() === true) { |
| 36 | 86 | $hintText = $this->getMainConfig()->getBlogAdminHintText(); |
| 37 | 87 | |