From 5e7a7701b94ee63927750064a39b188d9e17164a Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 22 Apr 2017 11:07:38 +0200 Subject: [PATCH] Domain name regular expression into lib/framework.php cherry-pick-merge --- lib/framework.php | 11 +++++++++++ plugins/OStatus/OStatusPlugin.php | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/framework.php b/lib/framework.php index 620730370f..29f1d694d4 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -57,6 +57,17 @@ define('NOTICE_INBOX_SOURCE_FORWARD', 4); define('NOTICE_INBOX_SOURCE_PROFILE_TAG', 5); define('NOTICE_INBOX_SOURCE_GATEWAY', -1); +/** + * StatusNet had this string as valid path characters: '\pN\pL\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\'\@' + * 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. + */ +define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\!\.\:\-\_\+\/\@\=\;\%\~\*'); +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_EXCLUDED_END_CHARS', '\?\.\,\!\#\:\''); // don't include these if they are directly after a URL +define('URL_REGEX_DOMAIN_NAME', '(?:(?!-)[A-Za-z0-9\-]{1,63}(?