aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textformatter/s9e/factory.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/textformatter/s9e/factory.php')
-rw-r--r--phpBB/phpbb/textformatter/s9e/factory.php28
1 files changed, 26 insertions, 2 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 63b23d2fd0..dd3102d4de 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -332,8 +332,7 @@ class factory implements \phpbb\textformatter\cache_interface
}
// Load the magic links plugins. We do that after BBCodes so that they use the same tags
- $configurator->plugins->load('Autoemail');
- $configurator->plugins->load('Autolink', array('matchWww' => true));
+ $this->configure_autolink($configurator);
// Register some vars with a default value. Those should be set at runtime by whatever calls
// the parser
@@ -395,6 +394,31 @@ class factory implements \phpbb\textformatter\cache_interface
}
/**
+ * Configure the Autolink / Autoemail plugins used to linkify text
+ *
+ * @param \s9e\TextFormatter\Configurator $configurator
+ * @return void
+ */
+ protected function configure_autolink(Configurator $configurator)
+ {
+ $configurator->plugins->load('Autoemail');
+ $configurator->plugins->load('Autolink', array('matchWww' => true));
+
+ // Create a tag that will be used to display the truncated text by replacing the original
+ // content with the content of the @text attribute
+ $tag = $configurator->tags->add('AUTOLINK_TEXT');
+ $tag->attributes->add('text');
+ $tag->template = '<xsl:value-of select="@text"/>';
+
+ // Add a tag filter that replaces the text of links that were created by the Autolink plugin
+ $configurator->Autolink->getTag()->filterChain
+ ->add(__NAMESPACE__ . '\\parser::generate_autolink_text')
+ ->resetParameters()
+ ->addParameterByName('tag')
+ ->addParameterByName('parser');
+ }
+
+ /**
* Return the default BBCodes configuration
*
* @return array 2D array. Each element has a 'usage' key, a 'template' key, and an optional 'options' key