/** * 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; }
/** * 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; }
/** * 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; }