1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-30 03:30:17 +02:00

[ticket/14323] Renamed AUTOLINK_TEXT to LINK_TEXT

Expanded link text shortening to [url] BBCodes with no parameters

PHPBB3-14323
This commit is contained in:
JoshyPHP
2015-12-27 16:43:45 +01:00
parent 5c8373dc20
commit 909f8653ec
5 changed files with 31 additions and 37 deletions

View File

@@ -23,9 +23,9 @@ use s9e\TextFormatter\Configurator\Items\UnsafeTemplate;
class factory implements \phpbb\textformatter\cache_interface
{
/**
* @var \phpbb\textformatter\s9e\autolink_helper
* @var \phpbb\textformatter\s9e\link_helper
*/
protected $autolink_helper;
protected $link_helper;
/**
* @var \phpbb\cache\driver\driver_interface
@@ -138,14 +138,14 @@ class factory implements \phpbb\textformatter\cache_interface
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\event\dispatcher_interface $dispatcher
* @param \phpbb\config\config $config
* @param \phpbb\textformatter\s9e\autolink_helper $autolink_helper
* @param \phpbb\textformatter\s9e\link_helper $link_helper
* @param string $cache_dir Path to the cache dir
* @param string $cache_key_parser Cache key used for the parser
* @param string $cache_key_renderer Cache key used for the renderer
*/
public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\autolink_helper $autolink_helper, $cache_dir, $cache_key_parser, $cache_key_renderer)
public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer)
{
$this->autolink_helper = $autolink_helper;
$this->link_helper = $link_helper;
$this->cache = $cache;
$this->cache_dir = $cache_dir;
$this->cache_key_parser = $cache_key_parser;
@@ -414,29 +414,28 @@ class factory implements \phpbb\textformatter\cache_interface
// Add a tag filter that creates a tag that stores and replace the
// content of a link created by the Autolink plugin
$configurator->Autolink->getTag()->filterChain
->add(array($this->autolink_helper, 'generate_autolink_text_tag'))
->add(array($this->link_helper, 'generate_link_text_tag'))
->resetParameters()
->addParameterByName('tag')
->addParameterByName('parser');
// 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 = $configurator->tags->add('LINK_TEXT');
$tag->attributes->add('text');
$tag->attributes->add('url', array('required' => false))->filterChain->add('#url');
$tag->template = '<xsl:value-of select="@text"/>';
$tag->filterChain
->add(array($this->autolink_helper, 'truncate_local_url'))
->add(array($this->link_helper, 'truncate_local_url'))
->resetParameters()
->addParameterByName('tag')
->addParameterByValue(generate_board_url() . '/');
$tag->filterChain
->add(array($this->autolink_helper, 'truncate_text'))
->add(array($this->link_helper, 'truncate_text'))
->resetParameters()
->addParameterByName('tag');
$tag->filterChain
->add(array($this->autolink_helper, 'cleanup_tag'))
->add(array($this->link_helper, 'cleanup_tag'))
->resetParameters()
->addParameterByName('tag')
->addParameterByName('parser');