You are here

protected function LingotekOAuthRequest::parseUri in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.4 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::parseUri()
  2. 7.5 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::parseUri()
  3. 7.6 lib/oauth-php/library/LingotekOAuthRequest.php \LingotekOAuthRequest::parseUri()

* Parse the uri into its parts. Fill in the missing parts. * *

Parameters

string $parameters optional extra parameters (from eg the http post):

1 call to LingotekOAuthRequest::parseUri()
LingotekOAuthRequest::__construct in lib/oauth-php/library/LingotekOAuthRequest.php
* Construct from the current request. Useful for checking the signature of a request. * When not supplied with any parameters this will use the current request. * *

File

lib/oauth-php/library/LingotekOAuthRequest.php, line 453

Class

LingotekOAuthRequest
Object to parse an incoming OAuth request or prepare an outgoing OAuth request

Code

protected function parseUri() {
  $ps = @parse_url($this->uri);

  // Get the current/requested method
  $ps['scheme'] = strtolower($ps['scheme']);

  // Get the current/requested host
  if (function_exists('mb_strtolower')) {
    $ps['host'] = mb_strtolower($ps['host']);
  }
  else {
    $ps['host'] = strtolower($ps['host']);
  }
  if (!preg_match('/^[a-z0-9\\.\\-]+$/', $ps['host'])) {
    throw new OAuthException2('Unsupported characters in host name');
  }

  // Get the port we are talking on
  if (empty($ps['port'])) {
    $ps['port'] = $this
      ->defaultPortForScheme($ps['scheme']);
  }
  if (empty($ps['user'])) {
    $ps['user'] = '';
  }
  if (empty($ps['pass'])) {
    $ps['pass'] = '';
  }
  if (empty($ps['path'])) {
    $ps['path'] = '/';
  }
  if (empty($ps['query'])) {
    $ps['query'] = '';
  }
  if (empty($ps['fragment'])) {
    $ps['fragment'] = '';
  }
  $this->uri_parts = $ps;
}