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


PHP Zend_Uri::factory方法代碼示例

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


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

示例1: getVideos

 public function getVideos($offset)
 {
     if (!$this->_videos) {
         $this->_videos = array();
         try {
             $this->_setYoutubeUrl($offset);
             $feed = Zend_Feed_Reader::import($this->getLink());
         } catch (Exception $e) {
             $feed = array();
         }
         foreach ($feed as $entry) {
             $params = Zend_Uri::factory($entry->getLink())->getQueryAsArray();
             $image = null;
             $link = null;
             if (!empty($params['v'])) {
                 $image = "http://img.youtube.com/vi/{$params['v']}/0.jpg";
                 $link = "http://www.youtube.com/embed/{$params['v']}";
             } else {
                 $link = $entry->getLink();
             }
             $video = new Core_Model_Default(array('video_id' => $params['v'], 'title' => $entry->getTitle(), 'description' => $entry->getContent(), 'link' => $link, 'image' => $image));
             $this->_videos[] = $video;
         }
     }
     return $this->_videos;
 }
開發者ID:bklein01,項目名稱:SiberianCMS,代碼行數:26,代碼來源:Youtube.php

示例2: testUrlEncodeAndDecode

 /**
  * @dataProvider dataForTestUrlEncodeAndDecode
  */
 public function testUrlEncodeAndDecode($str)
 {
     $encoded = Centurion_Inflector::urlEncode($str);
     $scheme = Zend_Uri::factory();
     $scheme->setQuery($encoded);
     $this->assertEquals($str, Centurion_Inflector::urlDecode($encoded));
 }
開發者ID:rom1git,項目名稱:Centurion,代碼行數:10,代碼來源:InflectorTest.php

示例3: isCurrentlySecure

 public function isCurrentlySecure()
 {
     $standardRule = !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS'];
     $offloaderHeader = trim((string) Mage::getConfig()->getNode(self::XML_PATH_OFFLOADER_HEADER, 'default'));
     if (!empty($offloaderHeader) && !empty($_SERVER[$offloaderHeader]) || $standardRule) {
         return true;
     }
     if (Mage::isInstalled()) {
         $secureBaseUrl = '';
         if (!$this->isAdmin()) {
             $secureBaseUrl = Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_SECURE_URL);
         } else {
             $secureBaseUrl = (string) Mage::getConfig()->getNode(Mage_Core_Model_Url::XML_PATH_SECURE_URL, 'default');
         }
         if (!$secureBaseUrl) {
             return false;
         }
         if (false !== strpos($secureBaseUrl, '{{base_url}}')) {
             $secureBaseUrl = Mage::getConfig()->substDistroServerVars('{{base_url}}');
         }
         $uri = Zend_Uri::factory($secureBaseUrl);
         $port = $uri->getPort();
         $isSecure = $uri->getScheme() == 'https' && isset($_SERVER['SERVER_PORT']) && $port == $_SERVER['SERVER_PORT'];
         return $isSecure;
     } else {
         $isSecure = isset($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT'];
         return $isSecure;
     }
 }
開發者ID:bogdy2p,項目名稱:apstufgnto,代碼行數:29,代碼來源:Store.php

示例4: invoke

 /** Returns a reference to the response content.
  *
  * @return static
  */
 public function invoke()
 {
     if (!$this->hasEncapsulatedObject()) {
         $this->setEncapsulatedObject(JsonApi_Response::factory(new JsonApi_Http_Response(Zend_Uri::factory($this->getBrowser()->getRequest()->getUri()), $this->getBrowser()->getResponse()->getStatusCode(), $this->getBrowser()->getResponse()->getContent())));
     }
     return $this;
 }
開發者ID:JWT-OSS,項目名稱:sfJwtJsonApiPlugin,代碼行數:11,代碼來源:JsonApiResponse.class.php

示例5: startByPhotoId

 public function startByPhotoId(\Sirprize\Flickr\Id $photoId)
 {
     if ($this->_started) {
         return $this;
     }
     $this->_started = true;
     require_once 'Zend/Uri.php';
     $uri = \Zend_Uri::factory('http://api.flickr.com/services/rest/');
     $args = array('api_key' => $this->_getService()->getApiKey(), 'format' => 'php_serial', 'method' => 'flickr.photos.getInfo', 'photo_id' => (string) $photoId);
     try {
         $this->_getRestClient()->getHttpClient()->resetParameters()->setUri($uri)->setParameterGet($args);
         $cacheId = $this->_getService()->makeCacheIdFromParts(array(__METHOD__, $photoId));
         $this->_responseHandler = $this->_getService()->getResponseHandlerInstance();
         $this->_getRestClient()->get($this->_responseHandler, 2, array(), $cacheId);
         if ($this->_responseHandler->isError()) {
             // service error
             $this->_onStartError($this->_getOnStartErrorMessage($this->_responseHandler->getMessage()));
             return $this;
         }
         $data = $this->_responseHandler->getPhp();
         $this->_description = $data['photo']['description']['_content'];
         $this->_onStartSuccess($this->_getOnStartSuccessMessage($photoId));
         $this->_loaded = true;
         return $this;
     } catch (Exception $e) {
         // connection error
         $this->_onStartError($this->_getOnStartErrorMessage($e->getMessage()));
         throw new \Sirprize\Flickr\Exception($exception->getMessage());
     }
 }
開發者ID:sirprize,項目名稱:flickr,代碼行數:30,代碼來源:Info.php

示例6: _getCallbackUri

 protected function _getCallbackUri()
 {
     $uri = Zend_Uri::factory('http');
     $uri->setHost($_SERVER['HTTP_HOST']);
     $uri->setPath($this->_helper->getHelper('Url')->simple('callback', 'twitter', 'admin'));
     return rtrim($uri->getUri(), '/');
 }
開發者ID:padraic,項目名稱:ZFPlanet,代碼行數:7,代碼來源:TwitterController.php

示例7: normalizeUriHttp

    /**
     * Parses, validates and returns a valid Zend_Uri object
     * from given $input.
     *
     * @param   string|Zend_Uri_Http $input
     * @return  null|Zend_Uri_Http
     * @throws  Zend_Service_Technorati_Exception
     * @static
     */
    public static function normalizeUriHttp($input)
    {
        // allow null as value
        if ($input === null) {
            return null;
        }

        if ($input instanceof Zend_Uri_Http) {
            $uri = $input;
        } else {
            try {
                $uri = Zend_Uri::factory((string) $input);
            }
            // wrap exception under Zend_Service_Technorati_Exception object
            catch (Exception $e) {
                throw new Zend_Service_Technorati_Exception($e->getMessage(), 0, $e);
            }
        }

        // allow inly Zend_Uri_Http objects or child classes
        if (!($uri instanceof Zend_Uri_Http)) {
            throw new Zend_Service_Technorati_Exception(
                "Invalid URL $uri, only HTTP(S) protocols can be used");
        }

        return $uri;
    }
開發者ID:niallmccrudden,項目名稱:zf2,代碼行數:36,代碼來源:Utils.php

示例8: normalizeUriHttp

 /**
  * Parses, validates and returns a valid Zend_Uri object
  * from given $input.
  *
  * @param   string|Zend_Uri_Http $input
  * @return  null|Zend_Uri_Http
  * @throws  Zend_Service_Technorati_Exception
  * @static
  */
 public static function normalizeUriHttp($input)
 {
     // allow null as value
     if ($input === null) {
         return null;
     }
     /**
      * @see Zend_Uri
      */
     require_once 'Zend/Uri.php';
     if ($input instanceof Zend_Uri_Http) {
         $uri = $input;
     } else {
         try {
             $uri = Zend_Uri::factory((string) $input);
         } catch (Exception $e) {
             /**
              * @see Zend_Service_Technorati_Exception
              */
             require_once 'Zend/Service/Technorati/Exception.php';
             throw new Zend_Service_Technorati_Exception($e->getMessage(), 0, $e);
         }
     }
     // allow inly Zend_Uri_Http objects or child classes
     if (!$uri instanceof Zend_Uri_Http) {
         /**
          * @see Zend_Service_Technorati_Exception
          */
         require_once 'Zend/Service/Technorati/Exception.php';
         throw new Zend_Service_Technorati_Exception("Invalid URL {$uri}, only HTTP(S) protocols can be used");
     }
     return $uri;
 }
開發者ID:fredcido,項目名稱:cenbrap,代碼行數:42,代碼來源:Utils.php

示例9: parseKey

 public function parseKey()
 {
     if ($this->_parsedKey === null) {
         $keyVersion = null;
         $pool = null;
         $version = null;
         $key = $this->getKey();
         /**
          * MagentoConnect key version
          */
         // http://connect20.magentocommerce.com/community/Interface_Frontend_Default_Modern
         if (strstr($key, 'connect20') !== false) {
             $keyVersion = self::KEY_V2;
         } elseif (strstr($key, 'magento-') !== false) {
             $keyVersion = self::KEY_V1;
         } else {
             throw new Exception('Key version can not be determined.');
         }
         /**
          * Extension pool
          */
         switch ($keyVersion) {
             case self::KEY_V2:
                 $uri = Zend_Uri::factory($key);
                 $path = $uri->getPath();
                 $pathAsArray = explode('/', $path);
                 if (array_key_exists(1, $pathAsArray)) {
                     $pool = $pathAsArray[1];
                 }
                 break;
             case self::KEY_V1:
                 $pathAsArray = explode('/', $key);
                 $pool = reset($pathAsArray);
                 $pool = strstr($pool, '-');
                 $pool = substr($pool, 1);
                 break;
         }
         if (empty($pool)) {
             throw new Exception('Extension pool can not be determined.');
         }
         /**
          * Extension version and name
          */
         $extension = end($pathAsArray);
         if (strstr($extension, '-') !== false) {
             $version = substr(strstr($extension, '-'), 1);
         }
         if (strstr($extension, '-', true) !== false) {
             $name = strstr($extension, '-', true);
         } else {
             $name = $extension;
         }
         if (empty($name)) {
             throw new Exception('Extension name can not be determined.');
         }
         $this->_parsedKey = array('key' => array('value' => $key, 'version' => $keyVersion), 'extension' => array('name' => $name, 'pool' => $pool, 'version' => $version));
     }
     return $this->_parsedKey;
 }
開發者ID:vicmiletsky,項目名稱:magento-connect-download,代碼行數:59,代碼來源:Narno_Mage_Extension.php

示例10: getFeedUrl

 /**
  * Get Feed URL
  * @return string
  * @throws Zend_Uri_Exception
  */
 public function getFeedUrl()
 {
     $version = Mage::getConfig()->getModuleConfig('PayEx_MasterPass')->version->asArray();
     $params = array('site_url' => Mage::getStoreConfig('web/unsecure/base_url'), 'installed_version' => $version, 'mage_ver' => Mage::getVersion(), 'edition' => Mage::getEdition());
     $uri = Zend_Uri::factory(self::URL_NEWS);
     $uri->addReplaceQueryParameters($params);
     return $uri->getUri();
 }
開發者ID:AndreKlang,項目名稱:Payex-Modules-Test,代碼行數:13,代碼來源:Feed.php

示例11: __construct

 /**
  * Initializes the image
  *
  * @param  DOMNode $dom
  * @param  string  $namespace
  * @return void
  */
 public function __construct(DOMNode $dom, $namespace)
 {
     $xpath = new DOMXPath($dom->ownerDocument);
     $xpath->registerNamespace('yh', $namespace);
     $this->Url = Zend_Uri::factory($xpath->query('./yh:Url/text()', $dom)->item(0)->data);
     $this->Height = (int) $xpath->query('./yh:Height/text()', $dom)->item(0)->data;
     $this->Width = (int) $xpath->query('./yh:Width/text()', $dom)->item(0)->data;
 }
開發者ID:renatosoares,項目名稱:blog-zend1,代碼行數:15,代碼來源:Image.php

示例12: setUri

 /**
  * @param string $uri
  * @return $this
  */
 public function setUri($uri)
 {
     if (!Zend_Uri::factory($uri)) {
         Mage::throwException('Invalid API uri.');
     }
     $this->_apiUri = $uri;
     return $this;
 }
開發者ID:xiaoguizhidao,項目名稱:ortodon,代碼行數:12,代碼來源:Ru.php

示例13: __construct

 /**
  * Constructor
  * 
  * @param $uri Zend_Uri_Http|string URI for the web service
  */
 public function __construct($uri)
 {
     if ($uri instanceof Zend_Uri_Http) {
         $this->_uri = $uri;
     } else {
         $this->_uri = Zend_Uri::factory($uri);
     }
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:13,代碼來源:Client.php

示例14: getWebAuthUrl

 public function getWebAuthUrl($permissions)
 {
     require_once 'Zend/Uri.php';
     $uri = \Zend_Uri::factory('http://flickr.com/services/auth/');
     $args = array('api_key' => $this->getApiKey(), 'perms' => $permissions);
     $uri->setQuery($this->signArgs($args));
     return $uri;
 }
開發者ID:sirprize,項目名稱:flickr,代碼行數:8,代碼來源:Service.php

示例15: __construct

 /**
  * Assigns values to properties relevant to Image
  *
  * @param  DOMElement $dom
  * @return void
  */
 public function __construct(DOMElement $dom)
 {
     $xpath = new DOMXPath($dom->ownerDocument);
     $xpath->registerNamespace('az', 'http://webservices.amazon.com/AWSECommerceService/2005-10-05');
     $this->Url = Zend_Uri::factory($xpath->query('./az:URL/text()', $dom)->item(0)->data);
     $this->Height = (int) $xpath->query('./az:Height/text()', $dom)->item(0)->data;
     $this->Width = (int) $xpath->query('./az:Width/text()', $dom)->item(0)->data;
 }
開發者ID:crlang44,項目名稱:frapi,代碼行數:14,代碼來源:Image.php


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