當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。