本文整理汇总了PHP中Horde_Url::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Url::toString方法的具体用法?PHP Horde_Url::toString怎么用?PHP Horde_Url::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Url
的用法示例。
在下文中一共展示了Horde_Url::toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUrlMissingScheme
public function testUrlMissingScheme()
{
$url = new Horde_Url('example.com/test?foo=1&bar=2');
$url->setScheme();
$this->assertEquals('/test?foo=1&bar=2', $url->toString(true, false));
$this->assertEquals('http://example.com/test?foo=1&bar=2', $url->toString(true, true));
}
示例2: _postRequest
/**
* Send a POST request
*
* @param string $method The method to call.
* @param array $params The method parameters.
*
* @return string The request results
* @throws Horde_Service_Facebook_Exception
*/
protected function _postRequest($method, &$params)
{
$this->_finalizeParams($params);
try {
$url = new Horde_Url(Horde_Service_Facebook::REST_SERVER_ADDR . $method);
$result = $this->_http->request('POST', $url->toString(), $this->_createPostString($params));
} catch (Exception $e) {
$this->_facebook->logger->err($e->getMessage());
throw new Horde_Service_Facebook_Exception(Horde_Service_Facebook_Translation::t("Facebook service is unavailable. Please try again later."));
}
return $result->getBody();
}
示例3: toString
/**
* Creates the full URL string.
*
* @param boolean $raw Whether to output the URL in the raw URL format
* or HTML-encoded.
* @param boolean $full Output the full URL?
*
* @return string The string representation of this object.
*/
public function toString($raw = false, $full = true)
{
if ($this->toStringCallback || !strlen($this->anchor)) {
$baseUrl = $this->_baseUrl->copy();
$baseUrl->parameters = array_merge($baseUrl->parameters, $this->parameters);
if (strlen($this->pathInfo)) {
$baseUrl->pathInfo = $this->pathInfo;
}
return $baseUrl->toString($raw, $full);
}
$url = $this->_baseUrl->toString($raw, $full);
if (strlen($this->pathInfo)) {
$url = rtrim($url, '/');
$url .= '/' . $this->pathInfo;
}
if ($this->anchor) {
$url .= '#' . ($raw ? $this->anchor : rawurlencode($this->anchor));
}
if ($params = $this->_getParameters()) {
$url .= '?' . implode($raw ? '&' : '&', $params);
}
return strval($url);
}
示例4: run
/**
* Run this request and return the data.
*
* @return mixed Either raw JSON, or an array of decoded values.
* @throws Horde_Service_Facebook_Exception
*/
public function run()
{
if ($this->_request != 'POST') {
$this->_endpoint->add($this->_params);
$params = array();
} else {
$params = $this->_params;
}
try {
$result = $this->_http->request($this->_request, $this->_endpoint->toString(true), $params);
} catch (Horde_Http_Exception $e) {
$this->_facebook->logger->err($e->getMessage());
throw new Horde_Service_Facebook_Exception($e);
}
if ($result->code != '200') {
$body = $result->getBody();
if (($error = json_decode($body, true)) && isset($error['error']['message'])) {
throw new Horde_Service_Facebook_Exception($error['error']['message']);
}
throw new Horde_Service_Facebook_Exception($body);
}
return json_decode($result->getBody());
}
示例5: catch
// Add the item to the inventory.
try {
$ret = $sesha_driver->add(array('stock_name' => $vars->get('stock_name'), 'note' => $vars->get('note')));
} catch (Sesha_Exception $e) {
$notification->push(sprintf(_("There was a problem adding the item: %s"), $ret->getMessage()), 'horde.error');
header('Location: ' . $url);
exit;
}
$stock_id = $ret;
$notification->push(_("The item was added succcessfully."), 'horde.success');
// Add categories to the item.
$sesha_driver->updateCategoriesForStock($stock_id, $vars->get('category_id'));
// Add properties to the item as well.
$sesha_driver->updatePropertiesForStock($stock_id, $vars->get('property'));
$url->add(array('actionId' => 'view_stock', 'stock_id' => $stock_id->stock_id));
header('Location: ' . $url->toString(true, true));
exit;
}
break;
case 'remove_stock':
if (Sesha::isAdmin(Horde_Perms::DELETE)) {
try {
$ret = $sesha_driver->delete($stock_id);
} catch (Sesha_Exception $e) {
$notification->push(sprintf(_("There was a problem with the driver while deleting: %s"), $e->getMessage()), 'horde.error');
header('Location: ' . Horde::url($baseUrl . '/list.php', true));
exit;
}
$notification->push(sprintf(_("Item number %d was successfully deleted"), $stock_id), 'horde.success');
} else {
$notification->push(_("You do not have sufficient permissions to delete."), 'horde.error');