| @@ -1,17 +1,37 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -declare(strict_types=1); | |
| 4 | - | |
| 2 | +/** | |
| 3 | + * TermObjectController.php | |
| 4 | + * | |
| 5 | + * The TermObjectController 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 | use UserAccessManager\Object\ObjectHandler; |
| 8 | -use UserAccessManager\UserGroup\UserGroupTypeException; | |
| 9 | -use WP_Term; | |
| 10 | 18 | |
| 19 | +/** | |
| 20 | + * Class TermObjectController | |
| 21 | + * | |
| 22 | + * @package UserAccessManager\Controller\Backend | |
| 23 | + */ | |
| 11 | 24 | class TermObjectController extends ObjectController |
| 12 | 25 | { |
| 13 | - public function addTermColumnsHeader(array $defaults): array | |
| 26 | + /** | |
| 27 | + * The function for the manage_categories_columns filter. | |
| 28 | + * | |
| 29 | + * @param array $defaults The table headers. | |
| 30 | + * | |
| 31 | + * @return array | |
| 32 | + */ | |
| 33 | + public function addTermColumnsHeader($defaults) | |
| 14 | 34 | { |
| 15 | 35 | $defaults[self::COLUMN_NAME] = TXT_UAM_COLUMN_ACCESS; |
| 16 | 36 | return $defaults; |
| 17 | 37 | } |
| @@ -16,11 +36,17 @@ | ||
| 16 | 36 | return $defaults; |
| 17 | 37 | } |
| 18 | 38 | |
| 19 | 39 | /** |
| 20 | - * @throws UserGroupTypeException | |
| 40 | + * The function for the manage_categories_custom_column action. | |
| 41 | + * | |
| 42 | + * @param string $content Content for the column. Multiple filter calls are possible, so we need to append. | |
| 43 | + * @param string $columnName The column name. | |
| 44 | + * @param integer $id The id. | |
| 45 | + * | |
| 46 | + * @return string $content with content appended for self::COLUMN_NAME column | |
| 21 | 47 | */ |
| 22 | - public function addTermColumn(?string $content, string $columnName, int|string|null $id): ?string | |
| 48 | + public function addTermColumn($content, $columnName, $id) | |
| 23 | 49 | { |
| 24 | 50 | if ($columnName === self::COLUMN_NAME) { |
| 25 | 51 | $term = $this->objectHandler->getTerm($id); |
| 26 | 52 | $objectType = ($term !== false) ? $term->taxonomy : ObjectHandler::GENERAL_TERM_OBJECT_TYPE; |
| @@ -30,13 +56,15 @@ | ||
| 30 | 56 | return $content; |
| 31 | 57 | } |
| 32 | 58 | |
| 33 | 59 | /** |
| 34 | - * @throws UserGroupTypeException | |
| 60 | + * The function for the edit_{term}_form action. | |
| 61 | + * | |
| 62 | + * @param string|\WP_Term $term The term. | |
| 35 | 63 | */ |
| 36 | - public function showTermEditForm($term): void | |
| 64 | + public function showTermEditForm($term) | |
| 37 | 65 | { |
| 38 | - if ($term instanceof WP_Term) { | |
| 66 | + if ($term instanceof \WP_Term) { | |
| 39 | 67 | $this->setObjectInformation($term->taxonomy, $term->term_id); |
| 40 | 68 | } else { |
| 41 | 69 | $this->setObjectInformation($term, null); |
| 42 | 70 | } |
| @@ -44,11 +72,13 @@ | ||
| 44 | 72 | echo $this->getIncludeContents('TermEditForm.php'); |
| 45 | 73 | } |
| 46 | 74 | |
| 47 | 75 | /** |
| 48 | - * @throws UserGroupTypeException | |
| 76 | + * The function for the edit_term action. | |
| 77 | + * | |
| 78 | + * @param integer $termId The term id. | |
| 49 | 79 | */ |
| 50 | - public function saveTermData($termId): void | |
| 80 | + public function saveTermData($termId) | |
| 51 | 81 | { |
| 52 | 82 | $term = $this->objectHandler->getTerm($termId); |
| 53 | 83 | $objectType = ($term !== false) ? $term->taxonomy : ObjectHandler::GENERAL_TERM_OBJECT_TYPE; |
| 54 | 84 | $this->saveObjectData($objectType, $termId); |
| @@ -53,9 +83,14 @@ | ||
| 53 | 83 | $objectType = ($term !== false) ? $term->taxonomy : ObjectHandler::GENERAL_TERM_OBJECT_TYPE; |
| 54 | 84 | $this->saveObjectData($objectType, $termId); |
| 55 | 85 | } |
| 56 | 86 | |
| 57 | - public function removeTermData(int|string|null $termId): void | |
| 87 | + /** | |
| 88 | + * The function for the delete_{term} action. | |
| 89 | + * | |
| 90 | + * @param integer $termId The id of the term. | |
| 91 | + */ | |
| 92 | + public function removeTermData($termId) | |
| 58 | 93 | { |
| 59 | 94 | $this->removeObjectData(ObjectHandler::GENERAL_TERM_OBJECT_TYPE, $termId); |
| 60 | 95 | } |
| 61 | 96 | } |