mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-12 10:35:20 +02:00
[ticket/11768] Added limited support for [url] in [quote] author
PHPBB3-11768
This commit is contained in:
parent
42c1297345
commit
6578e1c6ec
@ -74,7 +74,14 @@ class factory implements \phpbb\textformatter\cache
|
|||||||
'img' => '[IMG src={IMAGEURL;useContent}]',
|
'img' => '[IMG src={IMAGEURL;useContent}]',
|
||||||
'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext}]{TEXT}[/LIST]',
|
'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext}]{TEXT}[/LIST]',
|
||||||
'li' => '[* $tagName=LI]{TEXT}[/*]',
|
'li' => '[* $tagName=LI]{TEXT}[/*]',
|
||||||
'quote' => '[QUOTE author={TEXT1;optional}]{TEXT2}[/QUOTE]',
|
'quote' =>
|
||||||
|
"[QUOTE
|
||||||
|
author={TEXT1;optional}
|
||||||
|
url={URL;optional}
|
||||||
|
author={PARSE=/^\\[url=(?'url'.*?)](?'author'.*)\\[\\/url]$/i}
|
||||||
|
author={PARSE=/^\\[url](?'author'(?'url'.*?))\\[\\/url]$/i}
|
||||||
|
author={PARSE=/(?'url'https?:\\/\\/[^[\\]]+)/i}
|
||||||
|
]{TEXT2}[/QUOTE]",
|
||||||
'size' => '[SIZE={FONTSIZE}]{TEXT}[/SIZE]',
|
'size' => '[SIZE={FONTSIZE}]{TEXT}[/SIZE]',
|
||||||
'u' => '[U]{TEXT}[/U]',
|
'u' => '[U]{TEXT}[/U]',
|
||||||
'url' => '[URL={URL;useContent}]{TEXT}[/URL]',
|
'url' => '[URL={URL;useContent}]{TEXT}[/URL]',
|
||||||
@ -424,6 +431,15 @@ class factory implements \phpbb\textformatter\cache
|
|||||||
|
|
||||||
$templates['li'] = $fragments['listitem'] . '<xsl:apply-templates/>' . $fragments['listitem_close'];
|
$templates['li'] = $fragments['listitem'] . '<xsl:apply-templates/>' . $fragments['listitem_close'];
|
||||||
|
|
||||||
|
$fragments['quote_username_open'] = str_replace(
|
||||||
|
'{USERNAME}',
|
||||||
|
'<xsl:choose>
|
||||||
|
<xsl:when test="@url">' . str_replace('{DESCRIPTION}', '{USERNAME}', $fragments['url']) . '</xsl:when>
|
||||||
|
<xsl:otherwise>{USERNAME}</xsl:otherwise>
|
||||||
|
</xsl:choose>',
|
||||||
|
$fragments['quote_username_open']
|
||||||
|
);
|
||||||
|
|
||||||
$templates['quote'] =
|
$templates['quote'] =
|
||||||
'<xsl:choose>
|
'<xsl:choose>
|
||||||
<xsl:when test="@author">
|
<xsl:when test="@author">
|
||||||
@ -438,7 +454,7 @@ class factory implements \phpbb\textformatter\cache
|
|||||||
// is post-processed by parse_attachments()
|
// is post-processed by parse_attachments()
|
||||||
$templates['attachment'] = $fragments['inline_attachment_open'] . '<xsl:comment> ia<xsl:value-of select="@index"/> </xsl:comment><xsl:value-of select="@filename"/><xsl:comment> ia<xsl:value-of select="@index"/> </xsl:comment>' . $fragments['inline_attachment_close'];
|
$templates['attachment'] = $fragments['inline_attachment_open'] . '<xsl:comment> ia<xsl:value-of select="@index"/> </xsl:comment><xsl:value-of select="@filename"/><xsl:comment> ia<xsl:value-of select="@index"/> </xsl:comment>' . $fragments['inline_attachment_close'];
|
||||||
|
|
||||||
// Finally save fragments whose names look like the name of a BBCode, e.g. "flash"
|
// Add fragments as templates
|
||||||
foreach ($fragments as $fragment_name => $fragment)
|
foreach ($fragments as $fragment_name => $fragment)
|
||||||
{
|
{
|
||||||
if (preg_match('#^\\w+$#', $fragment_name))
|
if (preg_match('#^\\w+$#', $fragment_name))
|
||||||
@ -447,6 +463,9 @@ class factory implements \phpbb\textformatter\cache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep only templates that are named after an existing BBCode
|
||||||
|
$templates = array_intersect_key($templates, $this->default_definitions);
|
||||||
|
|
||||||
return $templates;
|
return $templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +201,18 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case
|
|||||||
'... www.example.org ...',
|
'... www.example.org ...',
|
||||||
'... <a href="http://www.example.org" class="postlink">www.example.org</a> ...'
|
'... <a href="http://www.example.org" class="postlink">www.example.org</a> ...'
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'[quote="[url=http://example.org]xxx[/url]"]...[/quote]',
|
||||||
|
'<blockquote><div><cite><a href="http://example.org" class="postlink">xxx</a> wrote:</cite>...</div></blockquote>'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'[quote="[url]http://example.org[/url]"]...[/quote]',
|
||||||
|
'<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'[quote="http://example.org"]...[/quote]',
|
||||||
|
'<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user