function wfMakeUrlIndex( $url ) {
wfSuppressWarnings();
$bits = parse_url( $url );
+ $prots = array( 'http', 'https', 'ftp', 'irc', 'news' );
wfRestoreWarnings();
- if ( !$bits || $bits['scheme'] !== 'http' ) {
+ if ( !$bits || !in_array( $bits['scheme'], $prots ) ) {
return false;
}
// Reverse the labels in the hostname, convert to lower case
$reversedHost .= '.';
}
// Reconstruct the pseudo-URL
- $index = "http://$reversedHost";
+ $prot = $bits['scheme'];
+ $index = "$prot://$reversedHost";
// Leave out user and password. Add the port, path, query and fragment
if ( isset( $bits['port'] ) ) $index .= ':' . $bits['port'];
if ( isset( $bits['path'] ) ) {
* Asterisks in any other location are considered invalid.
*
* @static
+ * @param $filterEntry String: domainparts
+ * @param $prot String: protocol
*/
- function makeLike( $filterEntry ) {
+ function makeLike( $filterEntry , $prot = 'http' ) {
if ( substr( $filterEntry, 0, 2 ) == '*.' ) {
$subdomains = true;
$filterEntry = substr( $filterEntry, 2 );
if ( substr( $host, -1, 1 ) !== '.' ) {
$host .= '.';
}
- $like = "http://$host";
+ $like = "$prot://$host";
if ( $subdomains ) {
$like .= '%';