}
// Add parameter
- if ( false === strpos( $url, '?' ) ) {
+ if ( strpos( $url, '?' ) === false ) {
$url .= '?';
} else {
$url .= '&';
/**
* Make URL indexes, appropriate for the el_index field of externallinks.
*
+ * @deprecated since 1.33, use LinkFilter::makeIndexes() instead
* @param string $url
* @return array
*/
function wfMakeUrlIndexes( $url ) {
- $bits = wfParseUrl( $url );
-
- // Reverse the labels in the hostname, convert to lower case
- // For emails reverse domainpart only
- if ( $bits['scheme'] == 'mailto' ) {
- $mailparts = explode( '@', $bits['host'], 2 );
- if ( count( $mailparts ) === 2 ) {
- $domainpart = strtolower( implode( '.', array_reverse( explode( '.', $mailparts[1] ) ) ) );
- } else {
- // No domain specified, don't mangle it
- $domainpart = '';
- }
- $reversedHost = $domainpart . '@' . $mailparts[0];
- } else {
- $reversedHost = strtolower( implode( '.', array_reverse( explode( '.', $bits['host'] ) ) ) );
- }
- // Add an extra dot to the end
- // Why? Is it in wrong place in mailto links?
- if ( substr( $reversedHost, -1, 1 ) !== '.' ) {
- $reversedHost .= '.';
- }
- // Reconstruct the pseudo-URL
- $prot = $bits['scheme'];
- $index = $prot . $bits['delimiter'] . $reversedHost;
- // Leave out user and password. Add the port, path, query and fragment
- if ( isset( $bits['port'] ) ) {
- $index .= ':' . $bits['port'];
- }
- if ( isset( $bits['path'] ) ) {
- $index .= $bits['path'];
- } else {
- $index .= '/';
- }
- if ( isset( $bits['query'] ) ) {
- $index .= '?' . $bits['query'];
- }
- if ( isset( $bits['fragment'] ) ) {
- $index .= '#' . $bits['fragment'];
- }
-
- if ( $prot == '' ) {
- return [ "http:$index", "https:$index" ];
- } else {
- return [ $index ];
- }
+ wfDeprecated( __FUNCTION__, '1.33' );
+ return LinkFilter::makeIndexes( $url );
}
/**
/**
* Throws a warning that $function is deprecated
*
- * @param string $function
+ * @param string $function Function that is deprecated.
* @param string|bool $version Version of MediaWiki that the function
* was deprecated in (Added in 1.19).
- * @param string|bool $component Added in 1.19.
+ * @param string|bool $component Component to which the function belongs.
+ * If false, it is assumed the function is in MediaWiki core (Added in 1.19).
* @param int $callerOffset How far up the call stack is the original
* caller. 2 = function that called the function that called
- * wfDeprecated (Added in 1.20)
- *
- * @return null
+ * wfDeprecated (Added in 1.20).
*/
function wfDeprecated( $function, $version = false, $component = false, $callerOffset = 2 ) {
MWDebug::deprecated( $function, $version, $component, $callerOffset + 1 );