本文整理汇总了PHP中Net_URL2::getURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_URL2::getURL方法的具体用法?PHP Net_URL2::getURL怎么用?PHP Net_URL2::getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_URL2
的用法示例。
在下文中一共展示了Net_URL2::getURL方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init(array $options)
{
// base url
if (isset($options['baseURL'])) {
$this->baseURL = $options['baseURL'];
} else {
$this->baseURL = 'http://' . $_SERVER['SERVER_NAME'];
}
if (isset($options['ezrpPath'])) {
$this->ezrpPath = $options['ezrpPath'];
}
$this->sessionID = $options['sessionID'];
$verifyURL = new Net_URL2(rtrim($this->baseURL, '/') . $this->ezrpPath);
$verifyURL->setQueryVariable('ezrpd', $this->driver);
$this->verifyURL = $verifyURL->getURL();
}
示例2: get
/**
* Required to request the root i-name (XRI) XRD which will provide an
* error message that the i-name does not exist, or else return a valid
* XRD document containing the i-name's Canonical ID.
*
* @param string $url URI
* @param string $serviceType Optional service type
*
* @return HTTP_Request
* @todo Finish this a bit better using the QXRI rules.
*/
protected function get($url, $serviceType = null)
{
$request = new HTTP_Request2($url, HTTP_Request2::METHOD_GET, $this->getHttpRequestOptions());
$netURL = new Net_URL2($url);
$request->setHeader('Accept', 'application/xrds+xml');
if ($serviceType) {
$netURL->setQueryVariable('_xrd_r', 'application/xrds+xml');
$netURL->setQueryVariable('_xrd_t', $serviceType);
} else {
$netURL->setQueryVariable('_xrd_r', 'application/xrds+xml;sep=false');
}
$request->setURL($netURL->getURL());
try {
return $request->send();
} catch (HTTP_Request2_Exception $e) {
throw new Services_Yadis_Exception('Invalid response to Yadis protocol received: ' . $e->getMessage(), $e->getCode());
}
}
示例3: __toString
/**
* Gets actual URL string.
*
* @return string.
*/
public function __toString()
{
return $this->_url->getURL();
}
示例4: addNonce
/**
* Adds a nonce to the openid.return_to URL parameter. Only used in OpenID 1.1
*
* @return void
*/
protected function addNonce()
{
$nonce = $this->getNonce()->createNonceAndStore();
$returnToURL = new Net_URL2($this->message->get('openid.return_to'));
$returnToURL->setQueryVariable(OpenID_Nonce::RETURN_TO_NONCE, urlencode($nonce));
$this->message->set('openid.return_to', $returnToURL->getURL());
// Observing
$logMessage = "Nonce: {$nonce}\n";
$logMessage = 'New ReturnTo: ' . $returnToURL->getURL() . "\n";
$logMessage .= 'OP URIs: ' . print_r($this->serviceEndpoint->getURIs(), true);
OpenID::setLastEvent(__METHOD__, $logMessage);
}
示例5: getURL
/**
* Returns an absolute URL using Net_URL
*
* @param string $url All/part of a url
* @return string Full url
*/
function getURL($url)
{
include_once 'Net/URL2.php';
$obj = new Net_URL2($url);
return $obj->getURL();
}
示例6: validateDiscover
/**
* Validates and performs discovery on the openid.claimed_id paramter.
*
* @return void
* @throws OpenID_Assertion_Exception on failure
*/
protected function validateDiscover()
{
$claimedID = $this->message->get('openid.claimed_id');
if ($claimedID === null) {
throw new OpenID_Assertion_Exception_NoClaimedID('No claimed_id in message');
}
if ($claimedID === OpenID::SERVICE_2_0_SERVER) {
throw new OpenID_Assertion_Exception('Claimed identifier cannot be an OP identifier');
}
$url = new Net_URL2($claimedID);
// Remove the fragment, per the spec
$url->setFragment(false);
$discover = $this->getDiscover($url->getURL());
if (!$discover instanceof OpenID_Discover) {
throw new OpenID_Assertion_Exception('Unable to discover claimed_id');
}
$URIs = $discover->services[0]->getURIs();
$opURL = array_shift($URIs);
if ($opURL !== $this->message->get('openid.op_endpoint')) {
throw new OpenID_Assertion_Exception('This OP is not authorized to issue assertions for this claimed id');
}
}
示例7: array
$project_link->addFilter("htmlspecialchars");
$project_link->addRule('required', "Please enter your project link");
$is_active = $form->addElement("checkbox", 'is_active', array('checked' => $channel["is_active"] ? 'checked' : ''));
$is_active->setLabel("Active?");
$form->addElement("submit");
if ($form->validate()) {
$url = new Net_URL2($project_name->getValue());
try {
$req = new HTTP_Request2();
$dir = explode("/", $url->getPath());
if (!empty($dir)) {
array_pop($dir);
}
$dir[] = 'channel.xml';
$url->setPath(implode("/", $dir));
$req->setURL($url->getURL());
channel::validate($req, $chan);
channel::edit($channel['name'], $project_label->getValue(), $project_link->getValue(), $contact_name->getValue(), $contact_email->getValue());
if ($is_active->getValue()) {
channel::activate($channel['name']);
} else {
channel::deactivate($channel['name']);
}
echo "<div class=\"success\">Changes saved</div>\n";
} catch (Exception $exception) {
echo '<div class="errors">';
switch ($exception->getMessage()) {
case "Invalid channel site":
case "Empty channel.xml":
echo "The submitted URL does not ";
echo "appear to point to a valid channel site. You will ";
示例8: testValidateReturnToOneOneImmediateNegative
/**
* testValidateReturnToOneOneImmediateNegative
*
* @return void
*/
public function testValidateReturnToOneOneImmediateNegative()
{
$opEndpoint = new OpenID_ServiceEndpoint();
$opEndpoint->setURIs(array($this->opEndpointURL));
$opEndpoints = new OpenID_ServiceEndpoints($this->claimedID, $opEndpoint);
$nonce = new OpenID_Nonce($this->opEndpointURL);
$nonceValue = $nonce->createNonce();
$rt = new Net_URL2('http://examplerp.com');
$rt->setQueryVariable(OpenID_Nonce::RETURN_TO_NONCE, $nonceValue);
$setupMessage = new OpenID_Message();
$setupMessage->set('openid.identity', $this->claimedID);
$setupMessage->set('openid.return_to', $rt->getURL());
$setupMessage->set(OpenID_Nonce::RETURN_TO_NONCE, $nonceValue);
$this->message = new OpenID_Message();
$this->message->set('openid.mode', OpenID::MODE_ID_RES);
$this->message->set(OpenID_Nonce::RETURN_TO_NONCE, $nonceValue);
$this->message->set('openid.user_setup_url', 'http://examplerp.com/?' . $setupMessage->getHTTPFormat());
$this->discover = $this->getMock('OpenID_Discover', array('__get'), array($this->claimedID));
$this->discover->expects($this->once())->method('__get')->will($this->returnValue($opEndpoints));
$this->store->expects($this->once())->method('getDiscover')->will($this->returnValue($this->discover));
$this->store->expects($this->any())->method('getNonce')->will($this->returnValue($nonceValue));
$this->createObjects();
}
示例9: testSetFragment
/**
* Tests setting the fragment.
*/
public function testSetFragment()
{
$url = new Net_URL2('http://www.example.com/');
$url->setFragment('pear');
$this->assertEquals('http://www.example.com/#pear', $url->getURL());
}
示例10: __get
/**
* Property getter interceptor to handle "uri" and "host" special cases.
*
* @param string $property The property to retrieve
*
* @return mixed
*/
public function __get($property)
{
switch ($property) {
case 'uri':
if ($this->_uri !== null) {
return $this->_uri->getURL();
}
return null;
case 'proxy':
return $this->_proxy;
case 'path':
if ($this->_uri === null) {
return null;
}
if ($this->httpVersion == self::HTTP_VERSION_1_0 || $this->proxy) {
// if http 1.0 or proxy given, the request uri must be absolute
return $this->_uri->getURL();
}
if (($path = $this->_uri->getPath()) === false) {
$path = '/';
}
if (($query = $this->_uri->getQuery()) !== false) {
$path .= '?' . $query;
}
if (($fragment = $this->_uri->getFragment()) !== false) {
$path .= '#' . $fragment;
}
return $path;
case 'host':
if (isset($this->headers['host'])) {
return trim($this->headers['host']);
}
if ($this->_proxy !== null) {
return $this->_proxy;
}
if ($this->_uri !== null) {
$host = $this->_uri->getHost();
if (($port = $this->_uri->getPort()) !== false) {
$host .= ':' . $port;
}
}
return $host;
case 'port':
$port = $this->_uri->getPort();
if (!is_numeric($port)) {
return $this->isSecure() ? 443 : 80;
}
return $port;
case 'connection':
if ($this->_connection === null) {
include_once 'HTTP/Connection.php';
$this->_connection = HTTP_Connection::factory('Socket');
}
return $this->_connection;
default:
return parent::__get($property);
}
}
示例11: testComponentRecompositionAndNormalization
/**
* Tests Net_URL2 RFC 3986 5.3. Component Recomposition in the light
* of normalization
*
* This is also a regression test to test that a missing authority works well
* with normalization
*
* It was reported as Bug #20418 on 2014-10-02 22:10 UTC that there is an
* Incorrect normalization of URI with missing authority
*
* @param string $uri URI
*
* @return void
* @covers Net_URL2::getUrl()
* @covers Net_URL2::normalize()
* @dataProvider provideComposedAndNormalized
* @link https://pear.php.net/bugs/bug.php?id=20418
* @see testExampleUri
*/
public function testComponentRecompositionAndNormalization($uri)
{
$url = new Net_URL2($uri);
$this->assertSame($uri, $url->getURL());
$url->normalize();
$this->assertSame($uri, $url->getURL());
}
示例12: appDir
public function appDir($path = '')
{
$url = new \Net_URL2($this->path . '/app/' . Config::get('application.directory', 'dist') . '/' . ltrim($path, '/'));
$url->setQueryVariable('ver', Config::get('application.version', 'false'));
return $url->getURL();
}