Page MenuHomePhabricator

GlobalFunctions.php.patch

Authored By
bzimport
Nov 21 2014, 10:36 PM
Size
752 B
Referenced Files
None
Subscribers
None

GlobalFunctions.php.patch

--- ../prod/base/w/includes/GlobalFunctions.php 2009-02-22 19:38:43.000000000 -0500
+++ ../prod/pool/w/includes/GlobalFunctions.php 2009-05-03 17:56:57.000000000 -0400
@@ -1199,9 +1199,20 @@
* @return string Fully-qualified URL
*/
function wfExpandUrl( $url ) {
+ // Allow for both site- and protocol-relative URLs
if( substr( $url, 0, 1 ) == '/' ) {
global $wgServer;
- return $wgServer . $url;
+ if ( substr( $url, 0, 2 ) == '//' ) {
+ // Try to extract the protocol from the server
+ if ( $protocolPos = strpos( $wgServer, '//' ) ) {
+ $protocol = substr( $wgServer, 0, $protocolPos );
+ return $protocol . $url;
+ } else {
+ return $url;
+ }
+ } else {
+ return $wgServer . $url;
+ }
} else {
return $url;
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5230
Default Alt Text
GlobalFunctions.php.patch (752 B)

Event Timeline