Define-ify excluded end-characters of URL autolinking
This commit is contained in:
parent
c769924505
commit
bd75305560
@ -62,9 +62,10 @@ define('NOTICE_INBOX_SOURCE_GATEWAY', -1);
|
|||||||
* Some of those characters can be troublesome when auto-linking plain text. Such as "http://some.com/)"
|
* Some of those characters can be troublesome when auto-linking plain text. Such as "http://some.com/)"
|
||||||
* URL encoding should be used whenever a weird character is used, the following strings are not definitive.
|
* URL encoding should be used whenever a weird character is used, the following strings are not definitive.
|
||||||
*/
|
*/
|
||||||
define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\-\_\+\/\=\:\;\%\~\*');
|
define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\!\.\:\-\_\+\/\=\;\%\~\*');
|
||||||
define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS . '\&');
|
define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS . '\&');
|
||||||
define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_QSTRING_CHARS . '\?\#');
|
define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_QSTRING_CHARS . '\?\#');
|
||||||
|
define('URL_REGEX_EXCLUDED_END_CHARS', '\?\.\,\!\#\:\''); // don't include these if they are directly after a URL
|
||||||
|
|
||||||
// append our extlib dir as the last-resort place to find libs
|
// append our extlib dir as the last-resort place to find libs
|
||||||
|
|
||||||
|
@ -1016,7 +1016,7 @@ function common_replace_urls_callback($text, $callback, $arg = null) {
|
|||||||
'(?:/[' . URL_REGEX_VALID_PATH_CHARS . ']*)?'. // path
|
'(?:/[' . URL_REGEX_VALID_PATH_CHARS . ']*)?'. // path
|
||||||
'(?:\?[' . URL_REGEX_VALID_QSTRING_CHARS . ']*)?'. // ?query string
|
'(?:\?[' . URL_REGEX_VALID_QSTRING_CHARS . ']*)?'. // ?query string
|
||||||
'(?:\#[' . URL_REGEX_VALID_FRAGMENT_CHARS . ']*)?'. // #fragment
|
'(?:\#[' . URL_REGEX_VALID_FRAGMENT_CHARS . ']*)?'. // #fragment
|
||||||
')(?<![\?\.\,\#\,])'.
|
')(?<!['. URL_REGEX_EXCLUDED_END_CHARS .'])'.
|
||||||
')'.
|
')'.
|
||||||
'#ixu';
|
'#ixu';
|
||||||
//preg_match_all($regex,$text,$matches);
|
//preg_match_all($regex,$text,$matches);
|
||||||
|
Loading…
Reference in New Issue
Block a user