From: Alexander Ebert Date: Tue, 21 Feb 2012 14:51:34 +0000 (+0100) Subject: Added option to skip option categories X-Git-Tag: 2.0.0_Beta_1~1328 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b3fcbaa4797988be2e6d0954a2e22c945b616c25;p=GitHub%2FWoltLab%2FWCF.git Added option to skip option categories --- diff --git a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php index 89c8dcb2ee..71827b6cf4 100644 --- a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php @@ -386,8 +386,14 @@ class OptionHandler implements IOptionHandler { * Creates a list of all active options. * * @param string $parentCategoryName + * @param array $ignoreCategories */ - protected function loadActiveOptions($parentCategoryName) { + protected function loadActiveOptions($parentCategoryName, array $ignoreCategories = array()) { + // skip ignored categories + if (in_array($parentCategoryName, $ignoreCategories)) { + return; + } + if (!isset($this->cachedCategories[$parentCategoryName]) || $this->checkCategory($this->cachedCategories[$parentCategoryName])) { if (isset($this->cachedOptionToCategories[$parentCategoryName])) { foreach ($this->cachedOptionToCategories[$parentCategoryName] as $optionName) { @@ -399,7 +405,7 @@ class OptionHandler implements IOptionHandler { if (isset($this->cachedCategoryStructure[$parentCategoryName])) { foreach ($this->cachedCategoryStructure[$parentCategoryName] as $categoryName) { - $this->loadActiveOptions($categoryName); + $this->loadActiveOptions($categoryName, $ignoreCategories); } } } diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index bdff954d88..e187271832 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -47,14 +47,15 @@ class UserOptionHandler extends OptionHandler { /** * Sets option values for a certain user. * - * @param wcf\data\user\User + * @param wcf\data\user\User $user + * @param array $ignoreCategories */ - public function setUser(User $user) { + public function setUser(User $user, array $ignoreCategories) { $this->optionValues = array(); $this->user = $user; if (!$this->didInit) { - $this->loadActiveOptions($this->categoryName); + $this->loadActiveOptions($this->categoryName, $ignoreCategories); $this->didInit = true; }