Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove compatibility code for Sanitizer::validateEmail ......................................................................
Remove compatibility code for Sanitizer::validateEmail Sanitizer::validateEmail was added in 1.18, mw.org says min version is 1.19+, so this compat code is no longer needed. Change-Id: I1ba1a8bd645c7e1c6cabe14f5efebfb8128ebf19 --- M docs/technical/hooks.md M includes/datavalues/SMW_DV_URI.php 2 files changed, 1 insertion(+), 31 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/docs/technical/hooks.md b/docs/technical/hooks.md index 189b328..1dd826a 100644 --- a/docs/technical/hooks.md +++ b/docs/technical/hooks.md @@ -68,7 +68,6 @@ * <code>\SMW\DIProperty</code>, smwInitProperties (SMW::DataItem::initProperties) * <code>\SMW\DataValueFactory</code>, smwInitDatatypes (SMW::DataValue::initDataTypes) -* <code>SMWURIValue</code>, isValidEmailAddr * <code>SMWExportController</code>, smwAddToRDFExport * <code>SMWParamFormat</code>, SMWResultFormat * <code>\SMW\Store</code>, SMWStore::updateDataBefore (SMW::Store::updateDataBefore) diff --git a/includes/datavalues/SMW_DV_URI.php b/includes/datavalues/SMW_DV_URI.php index 4dcba91..ed3f651 100644 --- a/includes/datavalues/SMW_DV_URI.php +++ b/includes/datavalues/SMW_DV_URI.php @@ -132,7 +132,7 @@ $this->m_wikitext = $value; } - $check = method_exists( 'Sanitizer', 'validateEmail' ) ? Sanitizer::validateEmail( $value ) : self::validateEmail( $value ); + $check = Sanitizer::validateEmail( $value ); if ( !$check ) { /// TODO: introduce error-message for "bad" email $this->addError( wfMessage( 'smw_baduri', $value )->inContentLanguage()->text() ); @@ -280,35 +280,6 @@ } else { // note: use "noprotocol" to avoid accidental use in an MW link, see getURL() return new SMWDIUri( 'noprotocol', 'x', '', '', $this->m_typeid ); } - } - - /** - * This is a copy of - * @see Sanitizer::validateEmail - * which was introduced in MW 1.18, and is thus used for compatibility with earlier versions. - */ - public static function validateEmail( $addr ) { - $result = null; - if ( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result ) ) ) { - return $result; - } - - // Please note strings below are enclosed in brackets [], this make the - // hyphen "-" a range indicator. Hence it is double backslashed below. - // See bug 26948 - $rfc5322_atext = "a-z0-9!#$%&'*+\\-\/=?^_`{|}~" ; - $rfc1034_ldh_str = "a-z0-9\\-" ; - - $HTML5_email_regexp = "/ - ^ # start of string - [$rfc5322_atext\\.]+ # user part which is liberal :p - @ # 'apostrophe' - [$rfc1034_ldh_str]+ # First domain part - (\\.[$rfc1034_ldh_str]+)* # Following part prefixed with a dot - $ # End of string - /ix" ; // case Insensitive, eXtended - - return (bool) preg_match( $HTML5_email_regexp, $addr ); } /** -- To view, visit https://gerrit.wikimedia.org/r/144263 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1ba1a8bd645c7e1c6cabe14f5efebfb8128ebf19 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SemanticMediaWiki Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: Mwjames <jamesin.hongkon...@gmail.com> Gerrit-Reviewer: Nischayn22 <nischay...@gmail.com> Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits