Skip to content

Commit

Permalink
Adding get root url method. Refers #29.
Browse files Browse the repository at this point in the history
  • Loading branch information
piraz committed Dec 11, 2008
1 parent 765f6be commit b3d268b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions MyFuses.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,27 @@ public static function getSelfPath() {
return $self;
}

public static function getRootUrl() {

$rootUrl = "http://" . $_SERVER[ 'HTTP_HOST' ];

if( substr( $rootUrl, -1 ) != "/" ) {
$rootUrl .= "/";
}

$scriptNameX = explode( "/", $_SERVER[ 'SCRIPT_NAME' ] );

$pos = ( count( $scriptNameX ) - 1 );

unset( $scriptNameX[ 0 ] );
unset( $scriptNameX[ $pos ] );

$rootUrl = $rootUrl . implode( "/", $scriptNameX ) . "/";

return $rootUrl;

}

public static function getSelf() {
$self = "http://" . $_SERVER[ 'HTTP_HOST' ];

Expand Down

0 comments on commit b3d268b

Please sign in to comment.