Пример #1
0
 /**
  *  Attempt to turn a relative URI into an absolute URI
  */
 protected function _absolutiseUri($link, $uri = null)
 {
     if (!URI\URL::validate($link)) {
         if (!is_null($uri)) {
             $uri = new URI\URL($uri);
             if ($link[0] !== '/') {
                 $link = $uri->getPath() . '/' . $link;
             }
             $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link);
             if (!URI\Zend\Uri\Uri::check($link)) {
                 $link = null;
             }
         }
     }
     return $link;
 }
Пример #2
0
 /**
  * Notifies a single Hub Server URL of changes
  *
  * @param  string $url The Hub Server's URL
  * @return void
  * @throws \Zend\Feed\PubSubHubbub\Exception Thrown on failure
  */
 public function notifyHub($url)
 {
     if (empty($url) || !is_string($url) || !URI\Zend\Uri\Uri::check($url)) {
         throw new Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . 'URL');
     }
     $client = $this->_getHttpClient();
     $client->setUri($url);
     $response = $client->request();
     if ($response->getStatus() !== 204) {
         throw new Exception('Notification to Hub Server ' . 'at "' . $url . '" appears to have failed with a status code of "' . $response->getStatus() . '" and message "' . $response->getMessage() . '"');
     }
 }