You are here

public static function OSMPlayer::getPlayerPath in MediaFront 7

Same name and namespace in other branches
  1. 6 players/osmplayer/player/OSMPlayer.php \OSMPlayer::getPlayerPath()

Returns the paths to this player library.

1 call to OSMPlayer::getPlayerPath()
OSMPlayer::getPlayerSettings in players/osmplayer/player/OSMPlayer.php
Returns the player settings.

File

players/osmplayer/player/OSMPlayer.php, line 97

Class

OSMPlayer
PHP wrapper class for the Open Standard Media (OSM) player.

Code

public static function getPlayerPath() {
  static $playerPath;

  // Get the player path.
  if (!$playerPath) {

    // Set the base path and url of this class.
    $base_root = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
    $base_url = $base_root .= '://' . check_plain($_SERVER['HTTP_HOST']);
    if ($dir = trim(dirname(check_plain($_SERVER['SCRIPT_NAME'])), '\\,/')) {
      $base_url .= "/{$dir}";
    }
    $path = parse_url($base_url);
    $path = isset($path['path']) ? $path['path'] : '';
    $playerPath = trim(str_replace(realpath('.'), '', dirname(__FILE__)), '/');
    $playerPath = trim(str_replace('\\', '/', $playerPath), '/');
    $playerPath = $playerPath ? $path . '/' . $playerPath . '/' : $playerPath;
  }

  // Return the player path.
  return $playerPath;
}