aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorchita <Máté Bartus>2018-12-29 15:56:44 +0100
committerchita <Máté Bartus>2018-12-29 15:56:44 +0100
commita578ce01199a0296a5c83212acb2d8a503ca6c58 (patch)
tree9079b919d8612aa9cf967961f30d7c6b06906c13 /phpBB/phpbb
parent86c773fbf9ecba9074e6fb6c5fa767117ba997ed (diff)
parente9310c928e8531a560d3034dba2db1a0d2f9a395 (diff)
downloadforums-a578ce01199a0296a5c83212acb2d8a503ca6c58.tar
forums-a578ce01199a0296a5c83212acb2d8a503ca6c58.tar.gz
forums-a578ce01199a0296a5c83212acb2d8a503ca6c58.tar.bz2
forums-a578ce01199a0296a5c83212acb2d8a503ca6c58.tar.xz
forums-a578ce01199a0296a5c83212acb2d8a503ca6c58.zip
Merge pull request #5488 from marc1706/ticket/15921
[ticket/15921] Update textformattter to 1.3.2
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php8
-rw-r--r--phpBB/phpbb/textformatter/s9e/link_helper.php25
2 files changed, 18 insertions, 15 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index c0bbc7b0e8..6191b9a315 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -354,6 +354,14 @@ class factory implements \phpbb\textformatter\cache_interface
// Load the Emoji plugin and modify its tag's template to obey viewsmilies
$tag = $configurator->Emoji->getTag();
+ $tag->template = '<xsl:choose>
+ <xsl:when test="@tseq">
+ <img alt="{.}" class="emoji" draggable="false" src="//twemoji.maxcdn.com/2/svg/{@tseq}.svg"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <img alt="{.}" class="emoji" draggable="false" src="https://cdn.jsdelivr.net/gh/s9e/emoji-assets-twemoji@11.2/dist/svgz/{@seq}.svgz"/>
+ </xsl:otherwise>
+ </xsl:choose>';
$tag->template = '<xsl:choose><xsl:when test="$S_VIEWSMILIES">' . str_replace('class="emoji"', 'class="emoji smilies"', $tag->template) . '</xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose>';
/**
diff --git a/phpBB/phpbb/textformatter/s9e/link_helper.php b/phpBB/phpbb/textformatter/s9e/link_helper.php
index 0f44603dec..1e113b6449 100644
--- a/phpBB/phpbb/textformatter/s9e/link_helper.php
+++ b/phpBB/phpbb/textformatter/s9e/link_helper.php
@@ -23,14 +23,16 @@ class link_helper
*
* @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag
* @param \s9e\TextFormatter\Parser $parser Parser
- * @return bool Whether the tag is valid
+ * @return void
*/
public function cleanup_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser)
{
// Invalidate if the content of the tag matches the text attribute
$text = substr($parser->getText(), $tag->getPos(), $tag->getLen());
-
- return ($text !== $tag->getAttribute('text'));
+ if ($text === $tag->getAttribute('text'))
+ {
+ $tag->invalidate();
+ }
}
/**
@@ -40,7 +42,7 @@ class link_helper
*
* @param \s9e\TextFormatter\Parser\Tag $tag URL tag (start tag)
* @param \s9e\TextFormatter\Parser $parser Parser
- * @return bool Always true to indicate that the tag is valid
+ * @return void
*/
public function generate_link_text_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser)
{
@@ -49,7 +51,7 @@ class link_helper
// the [url] BBCode when its content is used for the URL
if (!$tag->getEndTag() || !$this->should_shorten($tag, $parser->getText()))
{
- return true;
+ return;
}
// Capture the text between the start tag and its end tag
@@ -60,8 +62,6 @@ class link_helper
// Create a tag that consumes the link's text
$parser->addSelfClosingTag('LINK_TEXT', $start, $length)->setAttribute('text', $text);
-
- return true;
}
/**
@@ -84,7 +84,7 @@ class link_helper
*
* @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag
* @param string $board_url Forum's root URL (with trailing slash)
- * @return bool Always true to indicate that the tag is valid
+ * @return void
*/
public function truncate_local_url(\s9e\TextFormatter\Parser\Tag $tag, $board_url)
{
@@ -93,15 +93,13 @@ class link_helper
{
$tag->setAttribute('text', substr($text, strlen($board_url)));
}
-
- return true;
}
/**
* Truncate the replacement text set in a LINK_TEXT tag
*
* @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag
- * @return bool Always true to indicate that the tag is valid
+ * @return void
*/
public function truncate_text(\s9e\TextFormatter\Parser\Tag $tag)
{
@@ -109,10 +107,7 @@ class link_helper
if (utf8_strlen($text) > 55)
{
$text = utf8_substr($text, 0, 39) . ' ... ' . utf8_substr($text, -10);
+ $tag->setAttribute('text', $text);
}
-
- $tag->setAttribute('text', $text);
-
- return true;
}
}