You are here

protected function AbstractCallback::_detectCallbackUrl in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php \Zend\Feed\PubSubHubbub\AbstractCallback::_detectCallbackUrl()

Attempt to detect the callback URL (specifically the path forward)

Return value

string

File

vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php, line 199

Class

AbstractCallback

Namespace

Zend\Feed\PubSubHubbub

Code

protected function _detectCallbackUrl() {
  $callbackUrl = '';
  if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
    $callbackUrl = $_SERVER['HTTP_X_ORIGINAL_URL'];
  }
  elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
    $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL'];
  }
  elseif (isset($_SERVER['REQUEST_URI'])) {
    $callbackUrl = $_SERVER['REQUEST_URI'];
    $scheme = 'http';
    if ($_SERVER['HTTPS'] == 'on') {
      $scheme = 'https';
    }
    $schemeAndHttpHost = $scheme . '://' . $this
      ->_getHttpHost();
    if (strpos($callbackUrl, $schemeAndHttpHost) === 0) {
      $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost));
    }
  }
  elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
    $callbackUrl = $_SERVER['ORIG_PATH_INFO'];
    if (!empty($_SERVER['QUERY_STRING'])) {
      $callbackUrl .= '?' . $_SERVER['QUERY_STRING'];
    }
  }
  return $callbackUrl;
}