当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Url::toString方法代码示例

本文整理汇总了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));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:TostringTest.php

示例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();
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:21,代码来源:Rest.php

示例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);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:32,代码来源:Url.php

示例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());
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:29,代码来源:Graph.php

示例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');
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:stock.php


注:本文中的Horde_Url::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。