Skip to content

Commit

Permalink
Minor changes / code style, method naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Sep 11, 2014
1 parent 2ae6823 commit 595b058
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions includes/Wpup/UpdateServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function __construct($serverUrl = null, $serverDirectory = null) {
$serverDirectory = realpath(__DIR__ . '/../..');
}
if ( $serverUrl === null ) {
$serverUrl = self::determineServerUrl();
$serverUrl = self::guessServerUrl();
}

$this->serverUrl = $serverUrl;
Expand All @@ -21,15 +21,15 @@ public function __construct($serverUrl = null, $serverDirectory = null) {
}

/**
* Determine the Server Url based on the current request.
* Guess the Server Url based on the current request.
*
* Defaults to the current URL minus the query and "index.php".
*
* @static
*
* @return string Url
*/
public static function determineServerUrl() {
public static function guessServerUrl() {
$serverUrl = ( self::isSsl() ? 'https' : 'http' );
$serverUrl .= '://' . $_SERVER['HTTP_HOST'];
$path = $_SERVER['SCRIPT_NAME'];
Expand Down Expand Up @@ -64,8 +64,7 @@ public static function isSsl() {
if ( $_SERVER['HTTPS'] == '1' || strtolower($_SERVER['HTTPS']) === 'on' ) {
return true;
}
}
elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
return false;
Expand Down Expand Up @@ -389,7 +388,7 @@ protected function exitWithError($message = '', $httpStatus = 500) {
*/
protected static function addQueryArg($args, $url = null ) {
if ( !isset($url) ) {
$url = self::determineServerUrl();
$url = self::guessServerUrl();
}
if ( strpos($url, '?') !== false ) {
$parts = explode('?', $url, 2);
Expand Down

0 comments on commit 595b058

Please sign in to comment.