Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php |
— | — | @@ -345,8 +345,8 @@ |
346 | 346 | if( ! $this->debug ) { |
347 | 347 | $cssOptions[ 'preserveComments' ] = false; |
348 | 348 | } |
349 | | - $serverUri = $_SERVER['SCRIPT_URI']; |
350 | | - |
| 349 | + $serverUri = $this->getScriptLoaderUri(); |
| 350 | + |
351 | 351 | // Check for the two jsScriptLoader entry points: |
352 | 352 | if( strpos( $serverUri, 'mwScriptLoader.php') !== false ){ |
353 | 353 | $cssOptions[ 'prependRelativePath' ] = |
— | — | @@ -364,6 +364,28 @@ |
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
| 368 | + * Get the URI of the scriptLoader |
| 369 | + */ |
| 370 | + private function getScriptLoaderUri() { |
| 371 | + |
| 372 | + // protocol is http or https |
| 373 | + $protocol = 'http'; |
| 374 | + if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) { |
| 375 | + $protocol .= 's'; |
| 376 | + $protocol_port = $_SERVER['SERVER_PORT']; |
| 377 | + } else { |
| 378 | + $protocol_port = 80; |
| 379 | + } |
| 380 | + |
| 381 | + // $port will be "" or something like ":8100" |
| 382 | + $port = ( $_SERVER['SERVER_PORT'] == $protocol_port ) ? '' : ':' . $_SERVER['SERVER_PORT']; |
| 383 | + |
| 384 | + // php_self is the URL that invoked this script, without CGI parameters or fragment. |
| 385 | + return $protocol . '://' . $_SERVER['HTTP_HOST'] . $port . $_SERVER['PHP_SELF']; |
| 386 | + } |
| 387 | + |
| 388 | + |
| 389 | + /** |
368 | 390 | * Outputs the script headers |
369 | 391 | */ |
370 | 392 | function outputJsHeaders() { |