예제 #1
0
파일: S3.php 프로젝트: heiglandreas/zf2
 /**
  * Set S3 endpoint to use
  *
  * @param string|Zend_Uri_Http $endpoint
  * @return Zend_Service_Amazon_S3
  */
 public function setEndpoint($endpoint)
 {
     if (!$endpoint instanceof \Zend\Uri\Url) {
         $endpoint = new \Zend\Uri\Url($endpoint);
     }
     if (!$endpoint->isValid()) {
         throw new Exception('Invalid endpoint supplied');
     }
     $this->_endpoint = $endpoint;
     return $this;
 }
예제 #2
0
파일: Loc.php 프로젝트: heiglandreas/zf2
 /**
  * Validates if a string is valid as a sitemap location
  *
  * @link http://www.sitemaps.org/protocol.php#locdef <loc>
  *
  * @param  string  $value  value to validate
  * @return boolean
  */
 public function isValid($value)
 {
     if (!is_string($value)) {
         $this->_error(self::INVALID);
         return false;
     }
     $this->_setValue($value);
     $uri = new \Zend\Uri\Url($value);
     $uri->setAllowUnwise(false);
     if (!$uri->isValid()) {
         $this->_error(self::NOT_VALID);
         return false;
     }
     return true;
 }
예제 #3
0
 /**
  * Sets server url (scheme and host-related stuff without request URI)
  *
  * E.g. http://www.example.com
  *
  * @param  string $serverUrl                    server URL to set (only
  *                                              scheme and host)
  * @throws \Zend\Uri\Exception                   if invalid server URL
  * @return \Zend\View\Helper\Navigation\Sitemap  fluent interface, returns
  *                                              self
  */
 public function setServerUrl($serverUrl)
 {
     $uri = new \Zend\Uri\Url($serverUrl);
     $uri->setFragment('');
     $uri->setPath('');
     $uri->setQuery('');
     if ($uri->isValid()) {
         $this->_serverUrl = $uri->generate();
     } else {
         $e = new \Zend\Uri\Exception(sprintf('Invalid server URL: "%s"', $serverUrl));
         $e->setView($this->view);
         throw $e;
     }
     return $this;
 }