Merge pull request #3561 from s9e/ticket/10922

[ticket/10922] Added support for body and subject in email BBCode
This commit is contained in:
Tristan Darricau 2015-05-29 16:15:04 +02:00
commit 86ad1a92c8
3 changed files with 31 additions and 4 deletions

View file

@ -68,7 +68,7 @@ class factory implements \phpbb\textformatter\cache_interface
'b' => '[B]{TEXT}[/B]', 'b' => '[B]{TEXT}[/B]',
'code' => '[CODE]{TEXT}[/CODE]', 'code' => '[CODE]{TEXT}[/CODE]',
'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]',
'email' => '[EMAIL={EMAIL;useContent}]{TEXT}[/EMAIL]', 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT;optional;postFilter=rawurlencode} body={TEXT;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]',
'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]',
'i' => '[I]{TEXT}[/I]', 'i' => '[I]{TEXT}[/I]',
'img' => '[IMG src={IMAGEURL;useContent}]', 'img' => '[IMG src={IMAGEURL;useContent}]',
@ -97,7 +97,18 @@ class factory implements \phpbb\textformatter\cache_interface
'img' => '<img src="{IMAGEURL}" alt="{L_IMAGE}"/>', 'img' => '<img src="{IMAGEURL}" alt="{L_IMAGE}"/>',
'size' => '<span style="font-size: {FONTSIZE}%; line-height: normal"><xsl:apply-templates/></span>', 'size' => '<span style="font-size: {FONTSIZE}%; line-height: normal"><xsl:apply-templates/></span>',
'color' => '<span style="color: {COLOR}"><xsl:apply-templates/></span>', 'color' => '<span style="color: {COLOR}"><xsl:apply-templates/></span>',
'email' => '<a href="mailto:{EMAIL}"><xsl:apply-templates/></a>', 'email' => '<a>
<xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:value-of select="@email"/>
<xsl:if test="@subject or @body">
<xsl:text>?</xsl:text>
<xsl:if test="@subject">subject=<xsl:value-of select="@subject"/></xsl:if>
<xsl:if test="@body"><xsl:if test="@subject">&amp;</xsl:if>body=<xsl:value-of select="@body"/></xsl:if>
</xsl:if>
</xsl:attribute>
<xsl:apply-templates/>
</a>',
); );
/** /**

View file

@ -1 +1,9 @@
<a href="mailto:user@example.org">user@example.org</a><a href="mailto:user@example.org">...</a> <a href="mailto:user@example.org">user@example.org</a><br>
<a href="mailto:user@example.org">...</a><br>
<a href="mailto:user@example.org">...</a><br>
<a href="mailto:user@example.org?subject=Hello">...</a><br>
<a href="mailto:user@example.org?subject=Hi%20there">user@example.org</a><br>
<a href="mailto:user@example.org?body=Hi%20there">user@example.org</a><br>
<a href="mailto:user@example.org?subject=Hello&amp;body=Sent%20from%20phpBB">user@example.org</a><br>
<a href="mailto:user@example.org?subject=Hello&amp;body=Sent%20from%20phpBB">user@example.org</a><br>
<a href="mailto:user@example.org?subject=Hello&amp;body=Sent%20from%20phpBB">...</a><br>

View file

@ -1 +1,9 @@
[email]user@example.org[/email][email=user@example.org]...[/email] [email]user@example.org[/email]
[email=user@example.org]...[/email]
[email=user@example.org ]...[/email]
[email=user@example.org subject="Hello"]...[/email]
[email subject="Hi there"]user@example.org[/email]
[email body="Hi there"]user@example.org[/email]
[email subject="Hello" body="Sent from phpBB"]user@example.org[/email]
[email body="Sent from phpBB" subject="Hello"]user@example.org[/email]
[email body="Sent from phpBB" subject="Hello" email="user@example.org"]...[/email]