Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -298,7 +298,7 @@ |
299 | 299 | $needle = null; |
300 | 300 | return; |
301 | 301 | } |
302 | | - |
| 302 | + |
303 | 303 | if ( is_null( $needle ) ) { |
304 | 304 | $needle = array( '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F' ); |
305 | 305 | if ( !isset( $_SERVER['SERVER_SOFTWARE'] ) || ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7' ) === false ) ) { |
— | — | @@ -431,7 +431,7 @@ |
432 | 432 | /** |
433 | 433 | * Expand a potentially local URL to a fully-qualified URL. Assumes $wgServer |
434 | 434 | * is correct. |
435 | | - * |
| 435 | + * |
436 | 436 | * The meaning of the PROTO_* constants is as follows: |
437 | 437 | * PROTO_HTTP: Output a URL starting with http:// |
438 | 438 | * PROTO_HTTPS: Output a URL starting with https:// |
— | — | @@ -449,15 +449,15 @@ |
450 | 450 | function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { |
451 | 451 | global $wgServer, $wgCanonicalServer; |
452 | 452 | $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer; |
453 | | - |
| 453 | + |
454 | 454 | if ( $defaultProto === PROTO_CURRENT ) { |
455 | 455 | $defaultProto = WebRequest::detectProtocol() . '://'; |
456 | 456 | } |
457 | | - |
| 457 | + |
458 | 458 | // Analyze $serverUrl to obtain its protocol |
459 | 459 | $bits = wfParseUrl( $serverUrl ); |
460 | 460 | $serverHasProto = $bits && $bits['scheme'] != ''; |
461 | | - |
| 461 | + |
462 | 462 | if ( $defaultProto === PROTO_CANONICAL ) { |
463 | 463 | if ( $serverHasProto ) { |
464 | 464 | $defaultProto = $bits['scheme'] . '://'; |
— | — | @@ -467,9 +467,9 @@ |
468 | 468 | $defaultProto = PROTO_HTTP; |
469 | 469 | } |
470 | 470 | } |
471 | | - |
| 471 | + |
472 | 472 | $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 ); |
473 | | - |
| 473 | + |
474 | 474 | if( substr( $url, 0, 2 ) == '//' ) { |
475 | 475 | return $defaultProtoWithoutSlashes . $url; |
476 | 476 | } elseif( substr( $url, 0, 1 ) == '/' ) { |
— | — | @@ -516,7 +516,7 @@ |
517 | 517 | // URLs weren't supported until 1.18 |
518 | 518 | $retval = $wgUrlProtocols; |
519 | 519 | } |
520 | | - |
| 520 | + |
521 | 521 | // Cache return value |
522 | 522 | if ( $includeProtocolRelative ) { |
523 | 523 | $withProtRel = $retval; |
— | — | @@ -1407,6 +1407,8 @@ |
1408 | 1408 | * debug_backtrace is disabled, otherwise the output from |
1409 | 1409 | * debug_backtrace() (trimmed). |
1410 | 1410 | * |
| 1411 | + * @param $limit int This parameter can be used to limit the number of stack frames returned |
| 1412 | + * |
1411 | 1413 | * @return array of backtrace information |
1412 | 1414 | */ |
1413 | 1415 | function wfDebugBacktrace( $limit = 0 ) { |
— | — | @@ -1432,7 +1434,7 @@ |
1433 | 1435 | } |
1434 | 1436 | |
1435 | 1437 | if ( $limit && version_compare( PHP_VERSION, '5.4.0', '>=' ) ) { |
1436 | | - return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, 1 ), 1 ); |
| 1438 | + return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $limit ), 1 ); |
1437 | 1439 | } else { |
1438 | 1440 | return array_slice( debug_backtrace(), 1 ); |
1439 | 1441 | } |