mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12705] Store the regular expression matches based on server_url
PHPBB3-12705
This commit is contained in:
parent
828e995f03
commit
f1adf82aea
1 changed files with 10 additions and 7 deletions
|
@ -773,44 +773,47 @@ function make_clickable($text, $server_url = false, $class = 'postlink')
|
|||
static $static_class;
|
||||
static $magic_url_match_args;
|
||||
|
||||
if (!is_array($magic_url_match_args) || $static_class != $class)
|
||||
if (!isset($magic_url_match_args[$server_url]) || $static_class != $class)
|
||||
{
|
||||
$static_class = $class;
|
||||
$class = ($static_class) ? ' class="' . $static_class . '"' : '';
|
||||
$local_class = ($static_class) ? ' class="' . $static_class . '-local"' : '';
|
||||
|
||||
if (!is_array($magic_url_match_args))
|
||||
{
|
||||
$magic_url_match_args = array();
|
||||
}
|
||||
|
||||
// relative urls for this board
|
||||
$magic_url_match_args[] = array(
|
||||
$magic_url_match_args[$server_url][] = array(
|
||||
'#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#i',
|
||||
MAGIC_URL_LOCAL,
|
||||
$local_class,
|
||||
);
|
||||
|
||||
// matches a xxxx://aaaaa.bbb.cccc. ...
|
||||
$magic_url_match_args[] = array(
|
||||
$magic_url_match_args[$server_url][] = array(
|
||||
'#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#i',
|
||||
MAGIC_URL_FULL,
|
||||
$class,
|
||||
);
|
||||
|
||||
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
|
||||
$magic_url_match_args[] = array(
|
||||
$magic_url_match_args[$server_url][] = array(
|
||||
'#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#i',
|
||||
MAGIC_URL_WWW,
|
||||
$class,
|
||||
);
|
||||
|
||||
// matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode.
|
||||
$magic_url_match_args[] = array(
|
||||
$magic_url_match_args[$server_url][] = array(
|
||||
'/(^|[\n\t (>])(' . get_preg_expression('email') . ')/i',
|
||||
MAGIC_URL_EMAIL,
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($magic_url_match_args as $magic_args)
|
||||
foreach ($magic_url_match_args[$server_url] as $magic_args)
|
||||
{
|
||||
if (preg_match($magic_args[0], $text, $matches))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue