Added wildcard support
authorAlexander Ebert <ebert@woltlab.com>
Sun, 23 Jun 2013 18:13:45 +0000 (20:13 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 23 Jun 2013 18:13:45 +0000 (20:13 +0200)
com.woltlab.wcf/userGroupOption.xml
wcfsetup/install/files/lib/system/option/TextareaOptionType.class.php

index 221283e8500a9a7fe74c8637ab4c5308dba8d1cd..46add8db970ac88bfabd4af2cdf32af722c9e8d5 100644 (file)
@@ -284,6 +284,7 @@ bmp
 zip
 txt
 pdf]]></defaultvalue>
+                               <wildcard><![CDATA[*]]></wildcard>
                        </option>
                        <option name="user.attachment.maxCount">
                                <categoryname>user.message.attachment</categoryname>
index 47d6d167e20850c380e850dcce9a5ecc90be81c6..7b5036f2d8b6ec1a98745b7d44823a789ea1064d 100644 (file)
@@ -8,7 +8,7 @@ use wcf\util\StringUtil;
  * Option type implementation for textareas.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2012 WoltLab GmbH
+ * @copyright  2001-2013 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.option
@@ -30,6 +30,16 @@ class TextareaOptionType extends TextOptionType {
         * @see wcf\system\option\IOptionType::getData()
         */
        public function getData(Option $option, $newValue) {
-               return StringUtil::unifyNewlines(parent::getData($option, $newValue));
+               $newValue = StringUtil::unifyNewlines(parent::getData($option, $newValue));
+               
+               // check for wildcard
+               if ($option->wildcard) {
+                       $values = explode("\n", $newValue);
+                       if (in_array($option->wildcard, $values)) {
+                               $newValue = $option->wildcard;
+                       }
+               }
+               
+               return $newValue;
        }
 }