aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textformatter/s9e/link_helper.php
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2018-12-24 02:27:45 +0100
committerMarc Alexander <admin@m-a-styles.de>2018-12-26 23:06:18 +0100
commit31c04668156638017a1c211100d7b86e5faff4d4 (patch)
tree9ab79bf94c59b65d0bb7f4a8b512a11cb9d4f912 /phpBB/phpbb/textformatter/s9e/link_helper.php
parent95424f1b98a60e3b9a803e0a6262b368f2886219 (diff)
downloadforums-31c04668156638017a1c211100d7b86e5faff4d4.tar
forums-31c04668156638017a1c211100d7b86e5faff4d4.tar.gz
forums-31c04668156638017a1c211100d7b86e5faff4d4.tar.bz2
forums-31c04668156638017a1c211100d7b86e5faff4d4.tar.xz
forums-31c04668156638017a1c211100d7b86e5faff4d4.zip
[ticket/15921] Updated dependencies to latest textformatter
PHPBB3-15921
Diffstat (limited to 'phpBB/phpbb/textformatter/s9e/link_helper.php')
-rw-r--r--phpBB/phpbb/textformatter/s9e/link_helper.php25
1 files changed, 10 insertions, 15 deletions
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;
}
}