当前位置: 首页>>代码示例>>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;未经允许,请勿转载。