當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Uri_Http::fromString方法代碼示例

本文整理匯總了PHP中Zend_Uri_Http::fromString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Uri_Http::fromString方法的具體用法?PHP Zend_Uri_Http::fromString怎麽用?PHP Zend_Uri_Http::fromString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Uri_Http的用法示例。


在下文中一共展示了Zend_Uri_Http::fromString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _requireValidSchacHomeOrganization

 protected function _requireValidSchacHomeOrganization($responseAttributes)
 {
     if (!isset($responseAttributes[self::URN_MACE_TERENA_SCHACHOMEORG])) {
         return self::URN_MACE_TERENA_SCHACHOMEORG . " missing in attributes!";
     }
     $schacHomeOrganizationValues = $responseAttributes[self::URN_MACE_TERENA_SCHACHOMEORG];
     if (count($schacHomeOrganizationValues) === 0) {
         return self::URN_MACE_TERENA_SCHACHOMEORG . " has no values";
     }
     if (count($schacHomeOrganizationValues) > 1) {
         return self::URN_MACE_TERENA_SCHACHOMEORG . " has too many values";
     }
     $schacHomeOrganization = $schacHomeOrganizationValues[0];
     $reservedSchacHomeOrganization = $this->_isReservedSchacHomeOrganization($schacHomeOrganization);
     if ($reservedSchacHomeOrganization === TRUE) {
         return self::URN_MACE_TERENA_SCHACHOMEORG . " is reserved for another IdP!";
     }
     $validHostName = false;
     try {
         $uri = Zend_Uri_Http::fromString('http://' . $schacHomeOrganization);
         $validHostName = $uri->validateHost($schacHomeOrganization);
     } catch (Zend_Validate_Exception $e) {
     }
     if (!$validHostName) {
         return self::URN_MACE_TERENA_SCHACHOMEORG . " is not a valid hostname!";
     }
     // Passed all the checks, valid SHO!
     return false;
 }
開發者ID:newlongwhitecloudy,項目名稱:OpenConext-engineblock,代碼行數:29,代碼來源:ValidateRequiredAttributes.php

示例2: _getWechatOAuthUrl

 private function _getWechatOAuthUrl($appid, $scope, $callbackurl, $state)
 {
     $client = Zend_Uri_Http::fromString("https://open.weixin.qq.com/connect/oauth2/authorize");
     $client->addReplaceQueryParameters(array("appid" => $appid, "redirect_uri" => $callbackurl, "response_type" => "code", "scope" => $scope, "sate" => $state));
     $client->setFragment("wechat_redirect");
     return $client->getUri();
 }
開發者ID:patrickouc,項目名稱:fwm-wechatsso,代碼行數:7,代碼來源:IndexController.php

示例3: isValid

    /**
     * Defined by Zend_Validate_Interface
     *
     * Returns true if and only if the $value is a valid url that starts with http(s)://
     * and the hostname is a valid TLD
     *
     * @param  string $value
     * @throws Zend_Validate_Exception if a fatal error occurs for validation process
     * @return boolean
     */
    public function isValid($value)
    {
        if (!is_string($value)) {
            $this->_error(self::INVALID_URL);
             return false;
        }
		
        $this->_setValue($value);
        //get a Zend_Uri_Http object for our URL, this will only accept http(s) schemes
        try {
            $uriHttp = Zend_Uri_Http::fromString($value);
        } catch (Zend_Uri_Exception $e) {
            $this->_error(self::INVALID_URL);
            return false;
        }
        
        //if we have a valid URI then we check the hostname for valid TLDs, and not local urls
        $hostnameValidator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS); //do not allow local hostnames, this is the default

        if (!$hostnameValidator->isValid($uriHttp->getHost())) {
            $this->_error(self::INVALID_URL);
            return false;
        }
        return true;
    }
開發者ID:rondobley,項目名稱:Zend-Framework-Validate-URL,代碼行數:35,代碼來源:IsUrl.php

示例4: testSimpleFromString

    public function testSimpleFromString()
    {
        $uri = 'http://www.zend.com';

        $obj = Zend_Uri_Http::fromString($uri);
        $this->assertEquals($uri, $obj->getUri(), 'getUri() returned value that differs from input');
    }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:7,代碼來源:HttpTest.php

示例5: regenerateMediaFiles

 /**
  * Delete content of media/js and media/css folders to refresh with updated compressed/minified js/css content
  * If disabled, the updates are done each time an original file is updated. Can be resource overload on live website.
  * 
  * @param Mage_Core_Model_Observer $observer
  */
 public function regenerateMediaFiles($observer)
 {
     if (Mage::getStoreConfigFlag('uioptimization/general/cronupdate') && (Mage::getStoreConfigFlag('uioptimization/csscompression/enabled') || Mage::getStoreConfigFlag('uioptimization/jscompression/enabled'))) {
         // Clean up media/css and media/js folders and recreate the folders if necessary
         try {
             Mage::getModel('core/design_package')->cleanMergedJsCss();
             Mage::dispatchEvent('clean_media_cache_after');
         } catch (Exception $e) {
             Mage::logException($e);
             return;
         }
         $stores = Mage::app()->getStores();
         foreach ($stores as $id => $v) {
             $url = Zend_Uri_Http::fromString(Mage::app()->getStore($id)->getBaseUrl());
             // Recreate the js and css compressed file by using the normal process
             try {
                 $curl = new Zend_Http_Client_Adapter_Curl();
                 $curl->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
                 $curl->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
                 $curl->connect($url->getHost(), $url->getPort(), Mage_Core_Model_Store::isCurrentlySecure());
                 $curl->write(Zend_Http_Client::GET, $url);
                 $curl->close();
                 Mage::log('[Diglin_UIOptimization_Model_Observer] Update media js/css content for the different stores', ZEND_LOG::DEBUG);
             } catch (Exception $e) {
                 Mage::logException($e);
                 return;
             }
         }
     }
 }
開發者ID:FranchuCorraliza,項目名稱:magento,代碼行數:36,代碼來源:Observer.php

示例6: _processRequest

 /**
  * Process oauth related protocol information and return as an array
  *
  * @param string $authHeaderValue
  * @param string $contentTypeHeader
  * @param string $requestBodyString
  * @param string $requestUrl
  * @return array
  * merged array of oauth protocols and request parameters. eg :
  * <pre>
  * array (
  *         'oauth_version' => '1.0',
  *         'oauth_signature_method' => 'HMAC-SHA1',
  *         'oauth_nonce' => 'rI7PSWxTZRHWU3R',
  *         'oauth_timestamp' => '1377183099',
  *         'oauth_consumer_key' => 'a6aa81cc3e65e2960a4879392445e718',
  *         'oauth_signature' => 'VNg4mhFlXk7%2FvsxMqqUd5DWIj9s%3D'
  * )
  * </pre>
  */
 protected function _processRequest($authHeaderValue, $contentTypeHeader, $requestBodyString, $requestUrl)
 {
     $protocolParams = [];
     if (!$this->_processHeader($authHeaderValue, $protocolParams)) {
         return [];
     }
     if ($contentTypeHeader && 0 === strpos($contentTypeHeader, \Zend_Http_Client::ENC_URLENCODED)) {
         $protocolParamsNotSet = !$protocolParams;
         parse_str($requestBodyString, $protocolBodyParams);
         foreach ($protocolBodyParams as $bodyParamName => $bodyParamValue) {
             if (!$this->_isProtocolParameter($bodyParamName)) {
                 $protocolParams[$bodyParamName] = $bodyParamValue;
             } elseif ($protocolParamsNotSet) {
                 $protocolParams[$bodyParamName] = $bodyParamValue;
             }
         }
     }
     $protocolParamsNotSet = !$protocolParams;
     $queryString = \Zend_Uri_Http::fromString($requestUrl)->getQuery();
     $this->_extractQueryStringParams($protocolParams, $queryString);
     if ($protocolParamsNotSet) {
         $this->_fetchProtocolParamsFromQuery($protocolParams, $queryString);
     }
     // Combine request and header parameters
     return $protocolParams;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:46,代碼來源:Request.php

示例7: getUrl

 /**
  * Generate a redirect URL from the allowable parameters and configured
  * values.
  *
  * @return string
  */
 public function getUrl()
 {
     $params = $this->assembleParams();
     $uri = Zend_Uri_Http::fromString($this->_consumer->getUserAuthorizationUrl());
     $uri->setQuery($this->_httpUtility->toEncodedQueryString($params));
     return $uri->getUri();
 }
開發者ID:fredcido,項目名稱:simuweb,代碼行數:13,代碼來源:UserAuthorization.php

示例8: getEndpoint

 /**
  * Gets the provided endpoint
  * 
  * @return Zend_Uri_Http
  */
 public function getEndpoint()
 {
     if (empty($this->_endpoint)) {
         $this->_endpoint = Zend_Uri_Http::fromString(self::ENDPOINT_URL);
     }
     return $this->_endpoint;
 }
開發者ID:NicholasMiller,項目名稱:Zend_Servce_Amazon_Ses,代碼行數:12,代碼來源:Ses.php

示例9: __construct

 /**
  * 初始化趣樂平台地址
  * 
  * @param string $url
  */
 public function __construct($url = null)
 {
     if (empty($url)) {
         $this->_uri = self::$_defaultUri;
     } else {
         $this->_uri = Zend_Uri_Http::fromString($url);
     }
 }
開發者ID:starflash,項目名稱:ZtChart-ZF1-Example,代碼行數:13,代碼來源:Qule.php

示例10: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->_config = new binumi_config();
     // We have to use the fromString method because the 'host' we pass in
     // may actually contain a port (e.g. 'blah.com:8080' not just 'blah.com')
     // so we can't just pass it to Zend_Uri_Http.setHost(), like one might
     // expect
     $url = $this->_config->get_scheme() . '://' . $this->_config->get_host();
     $this->_uri = Zend_Uri_Http::fromString($url);
 }
開發者ID:Binumi,項目名稱:binumi-moodle,代碼行數:13,代碼來源:binumi_client.class.php

示例11: execute

 public function execute($request)
 {
     $this->forward404Unless($request->hasParameter('url'));
     try {
         $zendUri = Zend_Uri_Http::fromString($request->getParameter('url'));
     } catch (Exception $e) {
         return sfView::ERROR;
     }
     $this->url = $zendUri->getUri();
     $this->proxys = sfConfig::get('op_mobile_proxys');
 }
開發者ID:te-koyama,項目名稱:openpne,代碼行數:11,代碼來源:urlProxyAction.class.php

示例12: getWebsiteUri

 /**
  * Retrieves and parses the charity's Website URL.
  *
  * @return Zend_Uri_Http The parsed URL
  */
 public function getWebsiteUri()
 {
     if ($uri = $this->getModel()->getWebsite()) {
         try {
             return Zend_Uri_Http::fromString($uri);
         } catch (Lucky_Donations_Exception $e) {
             return '';
         }
     } else {
         return false;
     }
 }
開發者ID:eadsimone,項目名稱:moduleforben,代碼行數:17,代碼來源:Charity.php

示例13: normaliseBaseSignatureUrl

 public function normaliseBaseSignatureUrl($url)
 {
     $uri = Zend_Uri_Http::fromString($url);
     if ($uri->getScheme() == 'http' && $uri->getPort() == '80') {
         $uri->setPort('');
     } elseif ($uri->getScheme() == 'https' && $uri->getPort() == '443') {
         $uri->setPort('');
     }
     $uri->setQuery('');
     $uri->setFragment('');
     $uri->setHost(strtolower($uri->getHost()));
     return $uri->getUri(true);
 }
開發者ID:jacquesbagui,項目名稱:ofuz,代碼行數:13,代碼來源:Abstract.php

示例14: testSparqlWithDbPediaEndpoint

 /**
  * Test if the Erfurt_Store_Adapter_Sparql resolves the graph URI to the correct service.
  */
 public function testSparqlWithDbPediaEndpoint()
 {
     $options = array('serviceUrl' => 'http://dbpedia.org/sparql', 'graphs' => array('http://dbpedia.org'));
     $adapter = new Erfurt_Store_Adapter_Sparql($options);
     // Use HTTP Client test adapter
     $httpAdapter = new Erfurt_TestHelper_Http_ClientAdapter();
     $httpAdapter->setResponse(new Zend_Http_Response(200, array('Content-type' => 'application/sparql-results+xml'), file_get_contents($this->_dataDir . 'sparqlDBpediaLeipzig.srx')));
     $adapter->setHttpAdapter($httpAdapter);
     $sparql = 'SELECT ?p ?o FROM <http://dbpedia.org> WHERE {<http://dbpedia.org/resource/Leipzig> ?p ?o} LIMIT 10';
     $result = $adapter->sparqlQuery($sparql);
     $serviceUrl = Zend_Uri_Http::fromString('http://dbpedia.org/sparql');
     $requestUrl = $httpAdapter->getLastRequestUri();
     $this->assertTrue(is_array($result));
     $this->assertEquals($serviceUrl->getHost(), $requestUrl->getHost());
     $this->assertEquals($serviceUrl->getPath(), $requestUrl->getPath());
     $this->assertEquals(10, count($result));
 }
開發者ID:FTeichmann,項目名稱:Erfurt,代碼行數:20,代碼來源:SparqlIntegrationTest.php

示例15: routeStartup

 public function routeStartup(\Zend_Controller_Request_Abstract $request)
 {
     /** @var $request \Zend_Controller_Request_Http */
     if (!$request->isGet()) {
         return;
     }
     $host = 'http://' . $request->getHttpHost();
     $uri = \Zend_Uri_Http::fromString($host . $request->getRequestUri());
     $query = $uri->getQueryAsArray();
     if (!isset($query['_escaped_fragment_'])) {
         return;
     }
     $path = $uri->getPath() . ltrim($query['_escaped_fragment_'], '/');
     $uri->setPath($path);
     unset($query['_escaped_fragment_']);
     $uri->setQuery($query);
     $request->setRequestUri(str_replace($host, '', $uri->getUri()));
     $request->setPathInfo();
 }
開發者ID:hagith,項目名稱:pimcore-boilerplate,代碼行數:19,代碼來源:EscapedFragment.php


注:本文中的Zend_Uri_Http::fromString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。