<allowedchildren>all^sup</allowedchildren>
</bbcode>
<bbcode name="email">
- <htmlopen>a</htmlopen>
- <htmlclose>a</htmlclose>
+ <classname><![CDATA[wcf\system\bbcode\EmailBBCode]]></classname>
<allowedchildren>none^img,b,i,u,s,sub,sup,color,size,font</allowedchildren>
<attributes>
<attribute name="0">
- <html>href="mailto:%s"</html>
<required>1</required>
<usetext>1</usetext>
<validationpattern>^[^\s]+@[^\s]+$</validationpattern>
--- /dev/null
+<?php
+namespace wcf\system\bbcode;
+use wcf\util\StringUtil;
+
+/**
+ * Parses the [email] bbcode tag.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.bbcode
+ * @category Community Framework
+ */
+class EmailBBCode extends AbstractBBCode {
+ /**
+ * @see \wcf\system\bbcode\IBBCode::getParsedTag()
+ */
+ public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) {
+ $email = '';
+ if (isset($openingTag['attributes'][0])) {
+ $email = $openingTag['attributes'][0];
+ }
+ $email = StringUtil::decodeHTML($email);
+
+ return '<a href="mailto:' . StringUtil::encodeAllChars($email) . '">' . $content . '</a>';
+ }
+}