diff options
Diffstat (limited to 'phpBB/phpbb/textformatter/s9e/parser.php')
| -rw-r--r-- | phpBB/phpbb/textformatter/s9e/parser.php | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php index beb737c816..ffaffbc63c 100644 --- a/phpBB/phpbb/textformatter/s9e/parser.php +++ b/phpBB/phpbb/textformatter/s9e/parser.php @@ -393,51 +393,4 @@ class parser implements \phpbb\textformatter\parser_interface return $url; } - - /** - * Replace the content displayed inside of a URL tag - * - * Will only apply to URL tags that do not use any markup (e.g. not "[url]") - * on the assumption that those tags were created by the Autolink plugin to - * linkify URLs found in plain text - * - * @param \s9e\TextFormatter\Parser\Tag $url_tag URL tag (start tag) - * @param \s9e\TextFormatter\Parser $parser Parser - * @param string $board_url Forum's root URL (with trailing slash) - * @return bool Always true to indicate that the tag is valid - */ - public static function generate_autolink_text(\s9e\TextFormatter\Parser\Tag $url_tag, \s9e\TextFormatter\Parser $parser, $board_url) - { - // If the tag consumes any text then we ignore it because it's not a - // linkified URL. Same if it's not paired with an end tag that doesn't - // consume any text either - if ($url_tag->getLen() > 0 || !$url_tag->getEndTag()) - { - return true; - } - - // Capture the text between the start tag and its end tag - $start = $url_tag->getPos(); - $end = $url_tag->getEndTag()->getPos(); - $length = $end - $start; - $text = substr($parser->getText(), $start, $length); - - // Remove the board's root URL from the link if applicable - if (stripos($text, $board_url) === 0 && strlen($text) > strlen($board_url)) - { - $text = substr($text, strlen($board_url)); - } - - // Truncate the text if it's longer than 55 characters - if (utf8_strlen($text) > 55) - { - $text = utf8_substr($text, 0, 39) . ' ... ' . utf8_substr($text, -10); - } - - // Create a tag that consumes the link's text - $tag = $parser->addSelfClosingTag('AUTOLINK_TEXT', $start, $length); - $tag->setAttribute('text', $text); - - return true; - } } |
