Pull the logic for Media REST API out of the controller

This commit is contained in:
Albert Santoni 2015-02-19 15:10:01 -05:00
parent 487ab9bd99
commit 0177e40083
5 changed files with 482 additions and 335 deletions

View file

@ -17,4 +17,22 @@ class Application_Common_HTTPHelper
$request->getParam("timezone", null)
);
}
public static function getStationUrl()
{
$scheme = "http";
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
$scheme = "https";
}
$CC_CONFIG = Config::getConfig();
$baseUrl = $CC_CONFIG['baseUrl'];
$baseDir = $CC_CONFIG['baseDir'];
$basePort = $CC_CONFIG['basePort'];
if (empty($baseDir)) {
$baseDir = "/";
}
$stationUrl = "$scheme://${baseUrl}:${basePort}${baseDir}";
return $stationUrl;
}
}