Преглед изворни кода

Classes for Technorati removed

Frank Brückner пре 10 година
родитељ
комит
560876cdf9

+ 0 - 1035
library/Zend/Service/Technorati.php

@@ -1,1035 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/** @see Zend_Xml_Security */
-require_once 'Zend/Xml/Security.php';
-
-/**
- * Zend_Service_Technorati provides an easy, intuitive and object-oriented interface
- * for using the Technorati API.
- *
- * It provides access to all available Technorati API queries
- * and returns the original XML response as a friendly PHP object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati
-{
-    /** Base Technorati API URI */
-    const API_URI_BASE = 'http://api.technorati.com';
-
-    /** Query paths */
-    const API_PATH_COSMOS           = '/cosmos';
-    const API_PATH_SEARCH           = '/search';
-    const API_PATH_TAG              = '/tag';
-    const API_PATH_DAILYCOUNTS      = '/dailycounts';
-    const API_PATH_TOPTAGS          = '/toptags';
-    const API_PATH_BLOGINFO         = '/bloginfo';
-    const API_PATH_BLOGPOSTTAGS     = '/blogposttags';
-    const API_PATH_GETINFO          = '/getinfo';
-    const API_PATH_KEYINFO          = '/keyinfo';
-
-    /** Prevent magic numbers */
-    const PARAM_LIMIT_MIN_VALUE = 1;
-    const PARAM_LIMIT_MAX_VALUE = 100;
-    const PARAM_DAYS_MIN_VALUE  = 1;
-    const PARAM_DAYS_MAX_VALUE  = 180;
-    const PARAM_START_MIN_VALUE = 1;
-
-
-    /**
-     * Technorati API key
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_apiKey;
-
-    /**
-     * Zend_Rest_Client instance
-     *
-     * @var     Zend_Rest_Client
-     * @access  protected
-     */
-    protected $_restClient;
-
-
-    /**
-     * Constructs a new Zend_Service_Technorati instance
-     * and setup character encoding.
-     *
-     * @param  string $apiKey  Your Technorati API key
-     */
-    public function __construct($apiKey)
-    {
-        if (PHP_VERSION_ID < 50600) {
-            iconv_set_encoding('output_encoding', 'UTF-8');
-            iconv_set_encoding('input_encoding', 'UTF-8');
-            iconv_set_encoding('internal_encoding', 'UTF-8');
-        } else {
-            ini_set('output_encoding', 'UTF-8');
-            ini_set('input_encoding', 'UTF-8');
-            ini_set('default_charset', 'UTF-8');
-        }
-        $this->_apiKey = $apiKey;
-    }
-
-
-    /**
-     * Cosmos query lets you see what blogs are linking to a given URL.
-     *
-     * On the Technorati site, you can enter a URL in the searchbox and
-     * it will return a list of blogs linking to it.
-     * The API version allows more features and gives you a way
-     * to use the cosmos on your own site.
-     *
-     * Query options include:
-     *
-     * 'type'       => (link|weblog)
-     *      optional - A value of link returns the freshest links referencing your target URL.
-     *      A value of weblog returns the last set of unique weblogs referencing your target URL.
-     * 'limit'      => (int)
-     *      optional - adjust the size of your result from the default value of 20
-     *      to between 1 and 100 results.
-     * 'start'      => (int)
-     *      optional - adjust the range of your result set.
-     *      Set this number to larger than zero and you will receive
-     *      the portion of Technorati's total result set ranging from start to start+limit.
-     *      The default start value is 1.
-     * 'current'    => (true|false)
-     *      optional - the default setting of true
-     *      Technorati returns links that are currently on a weblog's homepage.
-     *      Set this parameter to false if you would like to receive all links
-     *      to the given URL regardless of their current placement on the source blog.
-     *      Internally the value is converted in (yes|no).
-     * 'claim'      => (true|false)
-     *      optional - the default setting of FALSE returns no user information
-     *      about each weblog included in the result set when available.
-     *      Set this parameter to FALSE to include Technorati member data
-     *      in the result set when a weblog in your result set
-     *      has been successfully claimed by a member of Technorati.
-     *      Internally the value is converted in (int).
-     * 'highlight'  => (true|false)
-     *      optional - the default setting of TRUE
-     *      highlights the citation of the given URL within the weblog excerpt.
-     *      Set this parameter to FALSE to apply no special markup to the blog excerpt.
-     *      Internally the value is converted in (int).
-     *
-     * @param   string $url     the URL you are searching for. Prefixes http:// and www. are optional.
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_CosmosResultSet
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/cosmos.html Technorati API: Cosmos Query reference
-     */
-    public function cosmos($url, $options = null)
-    {
-        static $defaultOptions = array( 'type'      => 'link',
-                                        'start'     => 1,
-                                        'limit'     => 20,
-                                        'current'   => 'yes',
-                                        'format'    => 'xml',
-                                        'claim'     => 0,
-                                        'highlight' => 1,
-                                        );
-
-        $options['url'] = $url;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateCosmos($options);
-        $response = $this->_makeRequest(self::API_PATH_COSMOS, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_CosmosResultSet
-         */
-        require_once 'Zend/Service/Technorati/CosmosResultSet.php';
-        return new Zend_Service_Technorati_CosmosResultSet($dom, $options);
-    }
-
-    /**
-     * Search lets you see what blogs contain a given search string.
-     *
-     * Query options include:
-     *
-     * 'language'   => (string)
-     *      optional - a ISO 639-1 two character language code
-     *      to retrieve results specific to that language.
-     *      This feature is currently beta and may not work for all languages.
-     * 'authority'  => (n|a1|a4|a7)
-     *      optional - filter results to those from blogs with at least
-     *      the Technorati Authority specified.
-     *      Technorati calculates a blog's authority by how many people link to it.
-     *      Filtering by authority is a good way to refine your search results.
-     *      There are four settings:
-     *      - n  => Any authority: All results.
-     *      - a1 => A little authority: Results from blogs with at least one link.
-     *      - a4 => Some authority: Results from blogs with a handful of links.
-     *      - a7 => A lot of authority: Results from blogs with hundreds of links.
-     * 'limit'      => (int)
-     *      optional - adjust the size of your result from the default value of 20
-     *      to between 1 and 100 results.
-     * 'start'      => (int)
-     *      optional - adjust the range of your result set.
-     *      Set this number to larger than zero and you will receive
-     *      the portion of Technorati's total result set ranging from start to start+limit.
-     *      The default start value is 1.
-     * 'claim'      => (true|false)
-     *      optional - the default setting of FALSE returns no user information
-     *      about each weblog included in the result set when available.
-     *      Set this parameter to FALSE to include Technorati member data
-     *      in the result set when a weblog in your result set
-     *      has been successfully claimed by a member of Technorati.
-     *      Internally the value is converted in (int).
-     *
-     * @param   string $query   the words you are searching for.
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_SearchResultSet
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/search.html Technorati API: Search Query reference
-     */
-    public function search($query, $options = null)
-    {
-        static $defaultOptions = array( 'start'     => 1,
-                                        'limit'     => 20,
-                                        'format'    => 'xml',
-                                        'claim'     => 0);
-
-        $options['query'] = $query;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateSearch($options);
-        $response = $this->_makeRequest(self::API_PATH_SEARCH, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_SearchResultSet
-         */
-        require_once 'Zend/Service/Technorati/SearchResultSet.php';
-        return new Zend_Service_Technorati_SearchResultSet($dom, $options);
-    }
-
-    /**
-     * Tag lets you see what posts are associated with a given tag.
-     *
-     * Query options include:
-     *
-     * 'limit'          => (int)
-     *      optional - adjust the size of your result from the default value of 20
-     *      to between 1 and 100 results.
-     * 'start'          => (int)
-     *      optional - adjust the range of your result set.
-     *      Set this number to larger than zero and you will receive
-     *      the portion of Technorati's total result set ranging from start to start+limit.
-     *      The default start value is 1.
-     * 'excerptsize'    => (int)
-     *      optional - number of word characters to include in the post excerpts.
-     *      By default 100 word characters are returned.
-     * 'topexcerptsize' => (int)
-     *      optional - number of word characters to include in the first post excerpt.
-     *      By default 150 word characters are returned.
-     *
-     * @param   string $tag     the tag term you are searching posts for.
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_TagResultSet
-     * @throws  Zend_Service_Technorati_Exception
-     *  @link    http://technorati.com/developers/api/tag.html Technorati API: Tag Query reference
-     */
-    public function tag($tag, $options = null)
-    {
-        static $defaultOptions = array( 'start'          => 1,
-                                        'limit'          => 20,
-                                        'format'         => 'xml',
-                                        'excerptsize'    => 100,
-                                        'topexcerptsize' => 150);
-
-        $options['tag'] = $tag;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateTag($options);
-        $response = $this->_makeRequest(self::API_PATH_TAG, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_TagResultSet
-         */
-        require_once 'Zend/Service/Technorati/TagResultSet.php';
-        return new Zend_Service_Technorati_TagResultSet($dom, $options);
-    }
-
-    /**
-     * TopTags provides daily counts of posts containing the queried keyword.
-     *
-     * Query options include:
-     *
-     * 'days'       => (int)
-     *      optional - Used to specify the number of days in the past
-     *      to request daily count data for.
-     *      Can be any integer between 1 and 180, default is 180
-     *
-     * @param   string $q       the keyword query
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_DailyCountsResultSet
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/dailycounts.html Technorati API: DailyCounts Query reference
-     */
-    public function dailyCounts($query, $options = null)
-    {
-        static $defaultOptions = array( 'days'      => 180,
-                                        'format'    => 'xml'
-                                        );
-
-        $options['q'] = $query;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateDailyCounts($options);
-        $response = $this->_makeRequest(self::API_PATH_DAILYCOUNTS, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_DailyCountsResultSet
-         */
-        require_once 'Zend/Service/Technorati/DailyCountsResultSet.php';
-        return new Zend_Service_Technorati_DailyCountsResultSet($dom);
-    }
-
-    /**
-     * TopTags provides information on top tags indexed by Technorati.
-     *
-     * Query options include:
-     *
-     * 'limit'      => (int)
-     *      optional - adjust the size of your result from the default value of 20
-     *      to between 1 and 100 results.
-     * 'start'      => (int)
-     *      optional - adjust the range of your result set.
-     *      Set this number to larger than zero and you will receive
-     *      the portion of Technorati's total result set ranging from start to start+limit.
-     *      The default start value is 1.
-     *
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_TagsResultSet
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/toptags.html Technorati API: TopTags Query reference
-     */
-    public function topTags($options = null)
-    {
-        static $defaultOptions = array( 'start'     => 1,
-                                        'limit'     => 20,
-                                        'format'    => 'xml'
-                                        );
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateTopTags($options);
-        $response = $this->_makeRequest(self::API_PATH_TOPTAGS, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_TagsResultSet
-         */
-        require_once 'Zend/Service/Technorati/TagsResultSet.php';
-        return new Zend_Service_Technorati_TagsResultSet($dom);
-    }
-
-    /**
-     * BlogInfo provides information on what blog, if any, is associated with a given URL.
-     *
-     * @param   string $url     the URL you are searching for. Prefixes http:// and www. are optional.
-     *                          The URL must be recognized by Technorati as a blog.
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_BlogInfoResult
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/bloginfo.html Technorati API: BlogInfo Query reference
-     */
-    public function blogInfo($url, $options = null)
-    {
-        static $defaultOptions = array( 'format'    => 'xml'
-                                        );
-
-        $options['url'] = $url;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateBlogInfo($options);
-        $response = $this->_makeRequest(self::API_PATH_BLOGINFO, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_BlogInfoResult
-         */
-        require_once 'Zend/Service/Technorati/BlogInfoResult.php';
-        return new Zend_Service_Technorati_BlogInfoResult($dom);
-    }
-
-    /**
-     * BlogPostTags provides information on the top tags used by a specific blog.
-     *
-     * Query options include:
-     *
-     * 'limit'      => (int)
-     *      optional - adjust the size of your result from the default value of 20
-     *      to between 1 and 100 results.
-     * 'start'      => (int)
-     *      optional - adjust the range of your result set.
-     *      Set this number to larger than zero and you will receive
-     *      the portion of Technorati's total result set ranging from start to start+limit.
-     *      The default start value is 1.
-     *      Note. This property is not documented.
-     *
-     * @param   string $url     the URL you are searching for. Prefixes http:// and www. are optional.
-     *                          The URL must be recognized by Technorati as a blog.
-     * @param   array $options  additional parameters to refine your query
-     * @return  Zend_Service_Technorati_TagsResultSet
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/blogposttags.html Technorati API: BlogPostTags Query reference
-     */
-    public function blogPostTags($url, $options = null)
-    {
-        static $defaultOptions = array( 'start'     => 1,
-                                        'limit'     => 20,
-                                        'format'    => 'xml'
-                                        );
-
-        $options['url'] = $url;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateBlogPostTags($options);
-        $response = $this->_makeRequest(self::API_PATH_BLOGPOSTTAGS, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_TagsResultSet
-         */
-        require_once 'Zend/Service/Technorati/TagsResultSet.php';
-        return new Zend_Service_Technorati_TagsResultSet($dom);
-    }
-
-    /**
-     * GetInfo query tells you things that Technorati knows about a member.
-     *
-     * The returned info is broken up into two sections:
-     * The first part describes some information that the user wants
-     * to allow people to know about him- or herself.
-     * The second part of the document is a listing of the weblogs
-     * that the user has successfully claimed and the information
-     * that Technorati knows about these weblogs.
-     *
-     * @param   string $username    the Technorati user name you are searching for
-     * @param   array $options      additional parameters to refine your query
-     * @return  Zend_Service_Technorati_GetInfoResult
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/getinfo.html Technorati API: GetInfo reference
-     */
-    public function getInfo($username, $options = null)
-    {
-        static $defaultOptions = array('format' => 'xml');
-
-        $options['username'] = $username;
-
-        $options = $this->_prepareOptions($options, $defaultOptions);
-        $this->_validateGetInfo($options);
-        $response = $this->_makeRequest(self::API_PATH_GETINFO, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_GetInfoResult
-         */
-        require_once 'Zend/Service/Technorati/GetInfoResult.php';
-        return new Zend_Service_Technorati_GetInfoResult($dom);
-    }
-
-    /**
-     * KeyInfo query provides information on daily usage of an API key.
-     * Key Info Queries do not count against a key's daily query limit.
-     *
-     * A day is defined as 00:00-23:59 Pacific time.
-     *
-     * @return  Zend_Service_Technorati_KeyInfoResult
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://developers.technorati.com/wiki/KeyInfo Technorati API: Key Info reference
-     */
-    public function keyInfo()
-    {
-        static $defaultOptions = array();
-
-        $options = $this->_prepareOptions(array(), $defaultOptions);
-        // you don't need to validate this request
-        // because key is the only mandatory element
-        // and it's already set in #_prepareOptions
-        $response = $this->_makeRequest(self::API_PATH_KEYINFO, $options);
-        $dom = $this->_convertResponseAndCheckContent($response);
-
-        /**
-         * @see Zend_Service_Technorati_KeyInfoResult
-         */
-        require_once 'Zend/Service/Technorati/KeyInfoResult.php';
-        return new Zend_Service_Technorati_KeyInfoResult($dom, $this->_apiKey);
-    }
-
-
-    /**
-     * Returns Technorati API key.
-     *
-     * @return string   Technorati API key
-     */
-    public function getApiKey()
-    {
-        return $this->_apiKey;
-    }
-
-    /**
-     * Returns a reference to the REST client object in use.
-     *
-     * If the reference hasn't being inizialized yet,
-     * then a new Zend_Rest_Client instance is created.
-     *
-     * @return Zend_Rest_Client
-     */
-    public function getRestClient()
-    {
-        if ($this->_restClient === null) {
-            /**
-             * @see Zend_Rest_Client
-             */
-            require_once 'Zend/Rest/Client.php';
-            $this->_restClient = new Zend_Rest_Client(self::API_URI_BASE);
-        }
-
-        return $this->_restClient;
-    }
-
-    /**
-     * Sets Technorati API key.
-     *
-     * Be aware that this function doesn't validate the key.
-     * The key is validated as soon as the first API request is sent.
-     * If the key is invalid, the API request method will throw
-     * a Zend_Service_Technorati_Exception exception with Invalid Key message.
-     *
-     * @param   string $key     Technorati API Key
-     * @return  void
-     * @link    http://technorati.com/developers/apikey.html How to get your Technorati API Key
-     */
-    public function setApiKey($key)
-    {
-        $this->_apiKey = $key;
-        return $this;
-    }
-
-
-    /**
-     * Validates Cosmos query options.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateCosmos(array $options)
-    {
-        static $validOptions = array('key', 'url',
-            'type', 'limit', 'start', 'current', 'claim', 'highlight', 'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate url (required)
-        $this->_validateOptionUrl($options);
-        // Validate limit (optional)
-        $this->_validateOptionLimit($options);
-        // Validate start (optional)
-        $this->_validateOptionStart($options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-        // Validate type (optional)
-        $this->_validateInArrayOption('type', $options, array('link', 'weblog'));
-        // Validate claim (optional)
-        $this->_validateOptionClaim($options);
-        // Validate highlight (optional)
-        $this->_validateIntegerOption('highlight', $options);
-        // Validate current (optional)
-        if (isset($options['current'])) {
-            $tmp = (int) $options['current'];
-            $options['current'] = $tmp ? 'yes' : 'no';
-        }
-
-    }
-
-    /**
-     * Validates Search query options.
-     *
-     * @param   array   $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateSearch(array $options)
-    {
-        static $validOptions = array('key', 'query',
-            'language', 'authority', 'limit', 'start', 'claim', 'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate query (required)
-        $this->_validateMandatoryOption('query', $options);
-        // Validate authority (optional)
-        $this->_validateInArrayOption('authority', $options, array('n', 'a1', 'a4', 'a7'));
-        // Validate limit (optional)
-        $this->_validateOptionLimit($options);
-        // Validate start (optional)
-        $this->_validateOptionStart($options);
-        // Validate claim (optional)
-        $this->_validateOptionClaim($options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-    }
-
-    /**
-     * Validates Tag query options.
-     *
-     * @param   array   $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateTag(array $options)
-    {
-        static $validOptions = array('key', 'tag',
-            'limit', 'start', 'excerptsize', 'topexcerptsize', 'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate query (required)
-        $this->_validateMandatoryOption('tag', $options);
-        // Validate limit (optional)
-        $this->_validateOptionLimit($options);
-        // Validate start (optional)
-        $this->_validateOptionStart($options);
-        // Validate excerptsize (optional)
-        $this->_validateIntegerOption('excerptsize', $options);
-        // Validate excerptsize (optional)
-        $this->_validateIntegerOption('topexcerptsize', $options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-    }
-
-
-    /**
-     * Validates DailyCounts query options.
-     *
-     * @param   array   $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateDailyCounts(array $options)
-    {
-        static $validOptions = array('key', 'q',
-            'days', 'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate q (required)
-        $this->_validateMandatoryOption('q', $options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-        // Validate days (optional)
-        if (isset($options['days'])) {
-            $options['days'] = (int) $options['days'];
-            if ($options['days'] < self::PARAM_DAYS_MIN_VALUE ||
-                $options['days'] > self::PARAM_DAYS_MAX_VALUE) {
-                /**
-                 * @see Zend_Service_Technorati_Exception
-                 */
-                require_once 'Zend/Service/Technorati/Exception.php';
-                throw new Zend_Service_Technorati_Exception(
-                            "Invalid value '" . $options['days'] . "' for 'days' option");
-            }
-        }
-    }
-
-    /**
-     * Validates GetInfo query options.
-     *
-     * @param   array   $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateGetInfo(array $options)
-    {
-        static $validOptions = array('key', 'username',
-            'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate username (required)
-        $this->_validateMandatoryOption('username', $options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-    }
-
-    /**
-     * Validates TopTags query options.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateTopTags(array $options)
-    {
-        static $validOptions = array('key',
-            'limit', 'start', 'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate limit (optional)
-        $this->_validateOptionLimit($options);
-        // Validate start (optional)
-        $this->_validateOptionStart($options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-    }
-
-    /**
-     * Validates BlogInfo query options.
-     *
-     * @param   array   $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateBlogInfo(array $options)
-    {
-        static $validOptions = array('key', 'url',
-            'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate url (required)
-        $this->_validateOptionUrl($options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-    }
-
-    /**
-     * Validates TopTags query options.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateBlogPostTags(array $options)
-    {
-        static $validOptions = array('key', 'url',
-            'limit', 'start', 'format');
-
-        // Validate keys in the $options array
-        $this->_compareOptions($options, $validOptions);
-        // Validate url (required)
-        $this->_validateOptionUrl($options);
-        // Validate limit (optional)
-        $this->_validateOptionLimit($options);
-        // Validate start (optional)
-        $this->_validateOptionStart($options);
-        // Validate format (optional)
-        $this->_validateOptionFormat($options);
-    }
-
-    /**
-     * Checks whether an option is in a given array.
-     *
-     * @param   string $name    option name
-     * @param   array $options
-     * @param   array $array    array of valid options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateInArrayOption($name, $options, array $array)
-    {
-        if (isset($options[$name]) && !in_array($options[$name], $array)) {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                        "Invalid value '{$options[$name]}' for '$name' option");
-        }
-    }
-
-    /**
-     * Checks whether mandatory $name option exists and it's valid.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _validateMandatoryOption($name, $options)
-    {
-        if (!isset($options[$name]) || !trim($options[$name])) {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                        "Empty value for '$name' option");
-        }
-    }
-
-    /**
-     * Checks whether $name option is a valid integer and casts it.
-     *
-     * @param   array $options
-     * @return  void
-     * @access  protected
-     */
-    protected function _validateIntegerOption($name, $options)
-    {
-        if (isset($options[$name])) {
-            $options[$name] = (int) $options[$name];
-        }
-    }
-
-    /**
-     * Makes and HTTP GET request to given $path with $options.
-     * HTTP Response is first validated, then returned.
-     *
-     * @param   string $path
-     * @param   array $options
-     * @return  Zend_Http_Response
-     * @throws  Zend_Service_Technorati_Exception on failure
-     * @access  protected
-     */
-    protected function _makeRequest($path, $options = array())
-    {
-        $restClient = $this->getRestClient();
-        $restClient->getHttpClient()->resetParameters();
-        $response = $restClient->restGet($path, $options);
-        self::_checkResponse($response);
-        return $response;
-    }
-
-    /**
-     * Checks whether 'claim' option value is valid.
-     *
-     * @param   array $options
-     * @return  void
-     * @access  protected
-     */
-    protected function _validateOptionClaim(array $options)
-    {
-        $this->_validateIntegerOption('claim', $options);
-    }
-
-    /**
-     * Checks whether 'format' option value is valid.
-     * Be aware that Zend_Service_Technorati supports only XML as format value.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception if 'format' value != XML
-     * @access  protected
-     */
-    protected function _validateOptionFormat(array $options)
-    {
-        if (isset($options['format']) && $options['format'] != 'xml') {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                        "Invalid value '" . $options['format'] . "' for 'format' option. " .
-                        "Zend_Service_Technorati supports only 'xml'");
-        }
-    }
-
-    /**
-     * Checks whether 'limit' option value is valid.
-     * Value must be an integer greater than PARAM_LIMIT_MIN_VALUE
-     * and lower than PARAM_LIMIT_MAX_VALUE.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception if 'limit' value is invalid
-     * @access  protected
-     */
-    protected function _validateOptionLimit(array $options)
-    {
-        if (!isset($options['limit'])) return;
-
-        $options['limit'] = (int) $options['limit'];
-        if ($options['limit'] < self::PARAM_LIMIT_MIN_VALUE ||
-            $options['limit'] > self::PARAM_LIMIT_MAX_VALUE) {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                        "Invalid value '" . $options['limit'] . "' for 'limit' option");
-        }
-    }
-
-    /**
-     * Checks whether 'start' option value is valid.
-     * Value must be an integer greater than 0.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception if 'start' value is invalid
-     * @access  protected
-     */
-    protected function _validateOptionStart(array $options)
-    {
-        if (!isset($options['start'])) return;
-
-        $options['start'] = (int) $options['start'];
-        if ($options['start'] < self::PARAM_START_MIN_VALUE) {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                        "Invalid value '" . $options['start'] . "' for 'start' option");
-        }
-    }
-
-    /**
-     * Checks whether 'url' option value exists and is valid.
-     * 'url' must be a valid HTTP(s) URL.
-     *
-     * @param   array $options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception if 'url' value is invalid
-     * @access  protected
-     * @todo    support for Zend_Uri_Http
-     */
-    protected function _validateOptionUrl(array $options)
-    {
-        $this->_validateMandatoryOption('url', $options);
-    }
-
-    /**
-     * Checks XML response content for errors.
-     *
-     * @param   DomDocument $dom    the XML response as a DOM document
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @link    http://technorati.com/developers/api/error.html Technorati API: Error response
-     * @access  protected
-     */
-    protected static function _checkErrors(DomDocument $dom)
-    {
-        $xpath = new DOMXPath($dom);
-
-        $result = $xpath->query("/tapi/document/result/error");
-        if ($result->length >= 1) {
-            $error = $result->item(0)->nodeValue;
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception($error);
-        }
-    }
-
-    /**
-     * Converts $response body to a DOM object and checks it.
-     *
-     * @param   Zend_Http_Response $response
-     * @return  DOMDocument
-     * @throws  Zend_Service_Technorati_Exception if response content contains an error message
-     * @access  protected
-     */
-    protected function _convertResponseAndCheckContent(Zend_Http_Response $response)
-    {
-        $dom = new DOMDocument();
-        $dom = Zend_Xml_Security::scan($response->getBody(), $dom);
-        self::_checkErrors($dom);
-        return $dom;
-    }
-
-    /**
-     * Checks ReST response for errors.
-     *
-     * @param   Zend_Http_Response $response    the ReST response
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected static function _checkResponse(Zend_Http_Response $response)
-    {
-        if ($response->isError()) {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(sprintf(
-                        'Invalid response status code (HTTP/%s %s %s)',
-                        $response->getVersion(), $response->getStatus(), $response->getMessage()));
-        }
-    }
-
-    /**
-     * Checks whether user given options are valid.
-     *
-     * @param   array $options        user options
-     * @param   array $validOptions   valid options
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception
-     * @access  protected
-     */
-    protected function _compareOptions(array $options, array $validOptions)
-    {
-        $difference = array_diff(array_keys($options), $validOptions);
-        if ($difference) {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                        "The following parameters are invalid: '" .
-                        implode("', '", $difference) . "'");
-        }
-    }
-
-    /**
-     * Prepares options for the request
-     *
-     * @param   array $options        user options
-     * @param   array $defaultOptions default options
-     * @return  array Merged array of user and default/required options.
-     * @access  protected
-     */
-    protected function _prepareOptions($options, array $defaultOptions)
-    {
-        $options = (array) $options; // force cast to convert null to array()
-        $options['key'] = $this->_apiKey;
-        $options = array_merge($defaultOptions, $options);
-        return $options;
-    }
-}

+ 0 - 242
library/Zend/Service/Technorati/Author.php

@@ -1,242 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Utils
- */
-require_once 'Zend/Service/Technorati/Utils.php';
-
-
-/**
- * Represents a weblog Author object. It usually belongs to a Technorati account.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_Author
-{
-    /**
-     * Author first name
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_firstName;
-
-    /**
-     * Author last name
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_lastName;
-
-    /**
-     * Technorati account username
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_username;
-
-    /**
-     * Technorati account description
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_description;
-
-    /**
-     * Technorati account biography
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_bio;
-
-    /**
-     * Technorati account thumbnail picture URL, if any
-     *
-     * @var     null|Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_thumbnailPicture;
-
-
-    /**
-     * Constructs a new object from DOM Element.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $xpath = new DOMXPath($dom->ownerDocument);
-
-        $result = $xpath->query('./firstname/text()', $dom);
-        if ($result->length == 1) $this->setFirstName($result->item(0)->data);
-
-        $result = $xpath->query('./lastname/text()', $dom);
-        if ($result->length == 1) $this->setLastName($result->item(0)->data);
-
-        $result = $xpath->query('./username/text()', $dom);
-        if ($result->length == 1) $this->setUsername($result->item(0)->data);
-
-        $result = $xpath->query('./description/text()', $dom);
-        if ($result->length == 1) $this->setDescription($result->item(0)->data);
-
-        $result = $xpath->query('./bio/text()', $dom);
-        if ($result->length == 1) $this->setBio($result->item(0)->data);
-
-        $result = $xpath->query('./thumbnailpicture/text()', $dom);
-        if ($result->length == 1) $this->setThumbnailPicture($result->item(0)->data);
-    }
-
-
-    /**
-     * Returns Author first name.
-     *
-     * @return  string  Author first name
-     */
-    public function getFirstName() {
-        return $this->_firstName;
-    }
-
-    /**
-     * Returns Author last name.
-     *
-     * @return  string  Author last name
-     */
-    public function getLastName() {
-        return $this->_lastName;
-    }
-
-    /**
-     * Returns Technorati account username.
-     *
-     * @return  string  Technorati account username
-     */
-    public function getUsername() {
-        return $this->_username;
-    }
-
-    /**
-     * Returns Technorati account description.
-     *
-     * @return  string  Technorati account description
-     */
-    public function getDescription() {
-        return $this->_description;
-    }
-
-    /**
-     * Returns Technorati account biography.
-     *
-     * @return  string  Technorati account biography
-     */
-    public function getBio() {
-        return $this->_bio;
-    }
-
-    /**
-     * Returns Technorati account thumbnail picture.
-     *
-     * @return  null|Zend_Uri_Http  Technorati account thumbnail picture
-     */
-    public function getThumbnailPicture() {
-        return $this->_thumbnailPicture;
-    }
-
-
-    /**
-     * Sets author first name.
-     *
-     * @param   string $input   first Name input value
-     * @return  Zend_Service_Technorati_Author  $this instance
-     */
-    public function setFirstName($input) {
-        $this->_firstName = (string) $input;
-        return $this;
-    }
-
-    /**
-     * Sets author last name.
-     *
-     * @param   string $input   last Name input value
-     * @return  Zend_Service_Technorati_Author  $this instance
-     */
-    public function setLastName($input) {
-        $this->_lastName = (string) $input;
-        return $this;
-    }
-
-    /**
-     * Sets Technorati account username.
-     *
-     * @param   string $input   username input value
-     * @return  Zend_Service_Technorati_Author  $this instance
-     */
-    public function setUsername($input) {
-        $this->_username = (string) $input;
-        return $this;
-    }
-
-    /**
-     * Sets Technorati account biography.
-     *
-     * @param   string $input   biography input value
-     * @return  Zend_Service_Technorati_Author  $this instance
-     */
-    public function setBio($input) {
-        $this->_bio = (string) $input;
-        return $this;
-    }
-
-    /**
-     * Sets Technorati account description.
-     *
-     * @param   string $input   description input value
-     * @return  Zend_Service_Technorati_Author  $this instance
-     */
-    public function setDescription($input) {
-        $this->_description = (string) $input;
-        return $this;
-    }
-
-    /**
-     * Sets Technorati account thumbnail picture.
-     *
-     * @param   string|Zend_Uri_Http $input thumbnail picture URI
-     * @return  Zend_Service_Technorati_Author  $this instance
-     * @throws  Zend_Service_Technorati_Exception if $input is an invalid URI
-     *          (via Zend_Service_Technorati_Utils::normalizeUriHttp)
-     */
-    public function setThumbnailPicture($input) {
-        $this->_thumbnailPicture = Zend_Service_Technorati_Utils::normalizeUriHttp($input);
-        return $this;
-    }
-
-}

+ 0 - 161
library/Zend/Service/Technorati/BlogInfoResult.php

@@ -1,161 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Utils
- */
-require_once 'Zend/Service/Technorati/Utils.php';
-
-
-/**
- * Represents a single Technorati BlogInfo query result object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_BlogInfoResult
-{
-    /**
-     * Technorati weblog url, if queried URL is a valid weblog.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_url;
-
-    /**
-     * Technorati weblog, if queried URL is a valid weblog.
-     *
-     * @var     Zend_Service_Technorati_Weblog
-     * @access  protected
-     */
-    protected $_weblog;
-
-    /**
-     * Number of unique blogs linking this blog
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_inboundBlogs;
-
-    /**
-     * Number of incoming links to this blog
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_inboundLinks;
-
-
-    /**
-     * Constructs a new object object from DOM Document.
-     *
-     * @param   DomDocument $dom the ReST fragment for this object
-     */
-    public function __construct(DomDocument $dom)
-    {
-        $xpath = new DOMXPath($dom);
-        /**
-         * @see Zend_Service_Technorati_Weblog
-         */
-        require_once 'Zend/Service/Technorati/Weblog.php';
-
-        $result = $xpath->query('//result/weblog');
-        if ($result->length == 1) {
-            $this->_weblog = new Zend_Service_Technorati_Weblog($result->item(0));
-        } else {
-            // follow the same behavior of blogPostTags
-            // and raise an Exception if the URL is not a valid weblog
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception(
-                "Your URL is not a recognized Technorati weblog");
-        }
-
-        $result = $xpath->query('//result/url/text()');
-        if ($result->length == 1) {
-            try {
-                // fetched URL often doens't include schema
-                // and this issue causes the following line to fail
-                $this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($result->item(0)->data);
-            } catch(Zend_Service_Technorati_Exception $e) {
-                if ($this->getWeblog() instanceof Zend_Service_Technorati_Weblog) {
-                    $this->_url = $this->getWeblog()->getUrl();
-                }
-            }
-        }
-
-        $result = $xpath->query('//result/inboundblogs/text()');
-        if ($result->length == 1) $this->_inboundBlogs = (int) $result->item(0)->data;
-
-        $result = $xpath->query('//result/inboundlinks/text()');
-        if ($result->length == 1) $this->_inboundLinks = (int) $result->item(0)->data;
-
-    }
-
-
-    /**
-     * Returns the weblog URL.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getUrl() {
-        return $this->_url;
-    }
-
-    /**
-     * Returns the weblog.
-     *
-     * @return  Zend_Service_Technorati_Weblog
-     */
-    public function getWeblog() {
-        return $this->_weblog;
-    }
-
-    /**
-     * Returns number of unique blogs linking this blog.
-     *
-     * @return  integer the number of inbound blogs
-     */
-    public function getInboundBlogs()
-    {
-        return (int) $this->_inboundBlogs;
-    }
-
-    /**
-     * Returns number of incoming links to this blog.
-     *
-     * @return  integer the number of inbound links
-     */
-    public function getInboundLinks()
-    {
-        return (int) $this->_inboundLinks;
-    }
-
-}

+ 0 - 152
library/Zend/Service/Technorati/CosmosResult.php

@@ -1,152 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Result
- */
-require_once 'Zend/Service/Technorati/Result.php';
-
-
-/**
- * Represents a single Technorati Cosmos query result object.
- * It is never returned as a standalone object,
- * but it always belongs to a valid Zend_Service_Technorati_CosmosResultSet object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_CosmosResult extends Zend_Service_Technorati_Result
-{
-    /**
-     * Technorati weblog object that links queried URL.
-     *
-     * @var     Zend_Service_Technorati_Weblog
-     * @access  protected
-     */
-    protected $_weblog;
-
-    /**
-     * The nearest permalink tracked for queried URL.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_nearestPermalink;
-
-    /**
-     * The excerpt of the blog/page linking queried URL.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_excerpt;
-
-    /**
-     * The the datetime the link was created.
-     *
-     * @var     Zend_Date
-     * @access  protected
-     */
-    protected $_linkCreated;
-
-    /**
-     * The URL of the specific link target page
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_linkUrl;
-
-
-    /**
-     * Constructs a new object object from DOM Element.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $this->_fields = array( '_nearestPermalink' => 'nearestpermalink',
-                                '_excerpt'          => 'excerpt',
-                                '_linkCreated'      => 'linkcreated',
-                                '_linkUrl'          => 'linkurl');
-        parent::__construct($dom);
-
-        // weblog object field
-        $this->_parseWeblog();
-
-        // filter fields
-        $this->_nearestPermalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_nearestPermalink);
-        $this->_linkUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_linkUrl);
-        $this->_linkCreated = Zend_Service_Technorati_Utils::normalizeDate($this->_linkCreated);
-    }
-
-    /**
-     * Returns the weblog object that links queried URL.
-     *
-     * @return  Zend_Service_Technorati_Weblog
-     */
-    public function getWeblog() {
-        return $this->_weblog;
-    }
-
-    /**
-     * Returns the nearest permalink tracked for queried URL.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getNearestPermalink() {
-        return $this->_nearestPermalink;
-    }
-
-    /**
-     * Returns the excerpt of the blog/page linking queried URL.
-     *
-     * @return  string
-     */
-    public function getExcerpt() {
-        return $this->_excerpt;
-    }
-
-    /**
-     * Returns the datetime the link was created.
-     *
-     * @return  Zend_Date
-     */
-    public function getLinkCreated() {
-        return $this->_linkCreated;
-    }
-
-    /**
-     * If queried URL is a valid blog,
-     * returns the URL of the specific link target page.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getLinkUrl() {
-        return $this->_linkUrl;
-    }
-
-}

+ 0 - 176
library/Zend/Service/Technorati/CosmosResultSet.php

@@ -1,176 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_ResultSet
- */
-require_once 'Zend/Service/Technorati/ResultSet.php';
-
-
-/**
- * Represents a Technorati Cosmos query result set.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_CosmosResultSet extends Zend_Service_Technorati_ResultSet
-{
-    /**
-     * Technorati weblog url, if queried URL is a valid weblog.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_url;
-
-    /**
-     * Technorati weblog, if queried URL is a valid weblog.
-     *
-     * @var     Zend_Service_Technorati_Weblog
-     * @access  protected
-     */
-    protected $_weblog;
-
-    /**
-     * Number of unique blogs linking this blog
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_inboundBlogs;
-
-    /**
-     * Number of incoming links to this blog
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_inboundLinks;
-
-    /**
-     * Parses the search response and retrieve the results for iteration.
-     *
-     * @param   DomDocument $dom    the ReST fragment for this object
-     * @param   array $options      query options as associative array
-     */
-    public function __construct(DomDocument $dom, $options = array())
-    {
-        parent::__construct($dom, $options);
-
-        $result = $this->_xpath->query('/tapi/document/result/inboundlinks/text()');
-        if ($result->length == 1) $this->_inboundLinks = (int) $result->item(0)->data;
-
-        $result = $this->_xpath->query('/tapi/document/result/inboundblogs/text()');
-        if ($result->length == 1) $this->_inboundBlogs = (int) $result->item(0)->data;
-
-        $result = $this->_xpath->query('/tapi/document/result/weblog');
-        if ($result->length == 1) {
-            /**
-             * @see Zend_Service_Technorati_Weblog
-             */
-            require_once 'Zend/Service/Technorati/Weblog.php';
-            $this->_weblog = new Zend_Service_Technorati_Weblog($result->item(0));
-        }
-
-        $result = $this->_xpath->query('/tapi/document/result/url/text()');
-        if ($result->length == 1) {
-            try {
-                // fetched URL often doens't include schema
-                // and this issue causes the following line to fail
-                $this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($result->item(0)->data);
-            } catch(Zend_Service_Technorati_Exception $e) {
-                if ($this->getWeblog() instanceof Zend_Service_Technorati_Weblog) {
-                    $this->_url = $this->getWeblog()->getUrl();
-                }
-            }
-        }
-
-        $this->_totalResultsReturned  = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
-
-        // total number of results depends on query type
-        // for now check only getInboundLinks() and getInboundBlogs() value
-        if ((int) $this->getInboundLinks() > 0) {
-            $this->_totalResultsAvailable = $this->getInboundLinks();
-        } elseif ((int) $this->getInboundBlogs() > 0) {
-            $this->_totalResultsAvailable = $this->getInboundBlogs();
-        } else {
-            $this->_totalResultsAvailable = 0;
-        }
-    }
-
-
-    /**
-     * Returns the weblog URL.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getUrl() {
-        return $this->_url;
-    }
-
-    /**
-     * Returns the weblog.
-     *
-     * @return  Zend_Service_Technorati_Weblog
-     */
-    public function getWeblog() {
-        return $this->_weblog;
-    }
-
-    /**
-     * Returns number of unique blogs linking this blog.
-     *
-     * @return  integer the number of inbound blogs
-     */
-    public function getInboundBlogs()
-    {
-        return $this->_inboundBlogs;
-    }
-
-    /**
-     * Returns number of incoming links to this blog.
-     *
-     * @return  integer the number of inbound links
-     */
-    public function getInboundLinks()
-    {
-        return $this->_inboundLinks;
-    }
-
-    /**
-     * Implements Zend_Service_Technorati_ResultSet::current().
-     *
-     * @return Zend_Service_Technorati_CosmosResult current result
-     */
-    public function current()
-    {
-        /**
-         * @see Zend_Service_Technorati_CosmosResult
-         */
-        require_once 'Zend/Service/Technorati/CosmosResult.php';
-        return new Zend_Service_Technorati_CosmosResult($this->_results->item($this->_currentIndex));
-    }
-}

+ 0 - 93
library/Zend/Service/Technorati/DailyCountsResult.php

@@ -1,93 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Result
- */
-require_once 'Zend/Service/Technorati/Result.php';
-
-
-/**
- * Represents a single Technorati DailyCounts query result object.
- * It is never returned as a standalone object,
- * but it always belongs to a valid Zend_Service_Technorati_DailyCountsResultSet object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_DailyCountsResult extends Zend_Service_Technorati_Result
-{
-    /**
-     * Date of count.
-     *
-     * @var     Zend_Date
-     * @access  protected
-     */
-    protected $_date;
-
-    /**
-     * Number of posts containing query on given date.
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_count;
-
-
-    /**
-     * Constructs a new object object from DOM Document.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $this->_fields = array( '_date'   => 'date',
-                                '_count'  => 'count');
-        parent::__construct($dom);
-
-        // filter fields
-        $this->_date  = new Zend_Date(strtotime($this->_date));
-        $this->_count = (int) $this->_count;
-    }
-
-    /**
-     * Returns the date of count.
-     *
-     * @return  Zend_Date
-     */
-    public function getDate() {
-        return $this->_date;
-    }
-
-    /**
-     * Returns the number of posts containing query on given date.
-     *
-     * @return  int
-     */
-    public function getCount() {
-        return $this->_count;
-    }
-}

+ 0 - 125
library/Zend/Service/Technorati/DailyCountsResultSet.php

@@ -1,125 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Date
- */
-require_once 'Zend/Date.php';
-
-/**
- * @see Zend_Service_Technorati_ResultSet
- */
-require_once 'Zend/Service/Technorati/ResultSet.php';
-
-/**
- * @see Zend_Service_Technorati_Utils
- */
-require_once 'Zend/Service/Technorati/Utils.php';
-
-
-/**
- * Represents a Technorati Tag query result set.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_DailyCountsResultSet extends Zend_Service_Technorati_ResultSet
-{
-    /**
-     * Technorati search URL for given query.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_searchUrl;
-
-    /**
-     * Number of days for which counts provided.
-     *
-     * @var     Zend_Service_Technorati_Weblog
-     * @access  protected
-     */
-    protected $_days;
-
-    /**
-     * Parses the search response and retrieve the results for iteration.
-     *
-     * @param   DomDocument $dom    the ReST fragment for this object
-     * @param   array $options      query options as associative array
-     */
-    public function __construct(DomDocument $dom, $options = array())
-    {
-        parent::__construct($dom, $options);
-
-        // default locale prevent Zend_Date to fail
-        // when script is executed via shell
-        // Zend_Locale::setDefault('en');
-
-        $result = $this->_xpath->query('/tapi/document/result/days/text()');
-        if ($result->length == 1) $this->_days = (int) $result->item(0)->data;
-
-        $result = $this->_xpath->query('/tapi/document/result/searchurl/text()');
-        if ($result->length == 1) {
-            $this->_searchUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($result->item(0)->data);
-        }
-
-        $this->_totalResultsReturned  = (int) $this->_xpath->evaluate("count(/tapi/document/items/item)");
-        $this->_totalResultsAvailable = (int) $this->getDays();
-    }
-
-
-    /**
-     * Returns the search URL for given query.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getSearchUrl() {
-        return $this->_searchUrl;
-    }
-
-    /**
-     * Returns the number of days for which counts provided.
-     *
-     * @return  int
-     */
-    public function getDays() {
-        return $this->_days;
-    }
-
-    /**
-     * Implements Zend_Service_Technorati_ResultSet::current().
-     *
-     * @return Zend_Service_Technorati_DailyCountsResult current result
-     */
-    public function current()
-    {
-        /**
-         * @see Zend_Service_Technorati_DailyCountsResult
-         */
-        require_once 'Zend/Service/Technorati/DailyCountsResult.php';
-        return new Zend_Service_Technorati_DailyCountsResult($this->_results->item($this->_currentIndex));
-    }
-}

+ 0 - 39
library/Zend/Service/Technorati/Exception.php

@@ -1,39 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Exception
- */
-require_once 'Zend/Service/Exception.php';
-
-
-/**
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_Exception extends Zend_Service_Exception
-{
-}

+ 0 - 103
library/Zend/Service/Technorati/GetInfoResult.php

@@ -1,103 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * Represents a single Technorati GetInfo query result object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_GetInfoResult
-{
-    /**
-     * Technorati author
-     *
-     * @var     Zend_Service_Technorati_Author
-     * @access  protected
-     */
-    protected $_author;
-
-    /**
-     * A list of weblogs claimed by this author
-     *
-     * @var     array
-     * @access  protected
-     */
-    protected $_weblogs = array();
-
-
-    /**
-     * Constructs a new object object from DOM Document.
-     *
-     * @param   DomDocument $dom the ReST fragment for this object
-     */
-    public function __construct(DomDocument $dom)
-    {
-        $xpath = new DOMXPath($dom);
-
-        /**
-         * @see Zend_Service_Technorati_Author
-         */
-        require_once 'Zend/Service/Technorati/Author.php';
-
-        $result = $xpath->query('//result');
-        if ($result->length == 1) {
-            $this->_author = new Zend_Service_Technorati_Author($result->item(0));
-        }
-
-        /**
-         * @see Zend_Service_Technorati_Weblog
-         */
-        require_once 'Zend/Service/Technorati/Weblog.php';
-
-        $result = $xpath->query('//item/weblog');
-        if ($result->length >= 1) {
-            foreach ($result as $weblog) {
-                $this->_weblogs[] = new Zend_Service_Technorati_Weblog($weblog);
-            }
-        }
-    }
-
-
-    /**
-     * Returns the author associated with queried username.
-     *
-     * @return  Zend_Service_Technorati_Author
-     */
-    public function getAuthor() {
-        return $this->_author;
-    }
-
-    /**
-     * Returns the collection of weblogs authored by queried username.
-     *
-     * @return  array of Zend_Service_Technorati_Weblog
-     */
-    public function getWeblogs() {
-        return $this->_weblogs;
-    }
-
-}

+ 0 - 118
library/Zend/Service/Technorati/KeyInfoResult.php

@@ -1,118 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * Represents a single Technorati KeyInfo query result object.
- * It provides information about your Technorati API Key daily usage.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_KeyInfoResult
-{
-    /**
-     * Technorati API key
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_apiKey;
-
-    /**
-     * Number of queries used today
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_apiQueries;
-
-    /**
-     * Total number of available queries per day
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_maxQueries;
-
-
-    /**
-     * Constructs a new object from DOM Element.
-     * Parses given Key element from $dom and sets API key string.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     * @param   string $apiKey  the API Key string
-     */
-    public function __construct(DomDocument $dom, $apiKey = null)
-    {
-        // $this->_dom   = $dom;
-        // $this->_xpath = new DOMXPath($dom);
-        $xpath = new DOMXPath($dom);
-
-        $this->_apiQueries   = (int) $xpath->query('/tapi/document/result/apiqueries/text()')->item(0)->data;
-        $this->_maxQueries   = (int) $xpath->query('/tapi/document/result/maxqueries/text()')->item(0)->data;
-        $this->setApiKey($apiKey);
-    }
-
-
-    /**
-     * Returns API Key string.
-     *
-     * @return  string  API Key string
-     */
-    public function getApiKey() {
-        return $this->_apiKey;
-    }
-
-    /**
-     * Returns the number of queries sent today.
-     *
-     * @return  int     number of queries sent today
-     */
-    public function getApiQueries() {
-        return $this->_apiQueries;
-    }
-
-    /**
-     * Returns Key's daily query limit.
-     *
-     * @return  int     maximum number of available queries per day
-     */
-    public function getMaxQueries() {
-        return $this->_maxQueries;
-    }
-
-
-    /**
-     * Sets API Key string.
-     *
-     * @param   string $apiKey  the API Key
-     * @return  Zend_Service_Technorati_KeyInfoResult $this instance
-     */
-    public function setApiKey($apiKey) {
-        $this->_apiKey = $apiKey;
-        return $this;
-    }
-}

+ 0 - 121
library/Zend/Service/Technorati/Result.php

@@ -1,121 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * Represents a single Technorati Search query result object.
- * It is never returned as a standalone object,
- * but it always belongs to a valid Zend_Service_Technorati_SearchResultSet object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @abstract
- */
-abstract class Zend_Service_Technorati_Result
-{
-    /**
-     * An associative array of 'fieldName' => 'xmlfieldtag'
-     *
-     * @var     array
-     * @access  protected
-     */
-    protected $_fields;
-
-    /**
-     * The ReST fragment for this result object
-     *
-     * @var     DomElement
-     * @access  protected
-     */
-    protected $_dom;
-
-    /**
-     * Object for $this->_dom
-     *
-     * @var     DOMXpath
-     * @access  protected
-     */
-    protected $_xpath;
-
-
-    /**
-     * Constructs a new object from DOM Element.
-     * Properties are automatically fetched from XML
-     * according to array of $_fields to be read.
-     *
-     * @param   DomElement $result  the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $this->_xpath = new DOMXPath($dom->ownerDocument);
-        $this->_dom = $dom;
-
-        // default fields for all search results
-        $fields = array();
-
-        // merge with child's object fields
-        $this->_fields = array_merge($this->_fields, $fields);
-
-        // add results to appropriate fields
-        foreach($this->_fields as $phpName => $xmlName) {
-            $query = "./$xmlName/text()";
-            $node = $this->_xpath->query($query, $this->_dom);
-            if ($node->length == 1) {
-                $this->{$phpName} = (string) $node->item(0)->data;
-            }
-        }
-    }
-
-    /**
-     * Parses weblog node and sets weblog object.
-     *
-     * @return  void
-     */
-    protected function _parseWeblog()
-    {
-        // weblog object field
-        $result = $this->_xpath->query('./weblog', $this->_dom);
-        if ($result->length == 1) {
-            /**
-             * @see Zend_Service_Technorati_Weblog
-             */
-            require_once 'Zend/Service/Technorati/Weblog.php';
-            $this->_weblog = new Zend_Service_Technorati_Weblog($result->item(0));
-        } else {
-            $this->_weblog = null;
-        }
-    }
-
-    /**
-     * Returns the document fragment for this object as XML string.
-     *
-     * @return string   the document fragment for this object
-     *                  converted into XML format
-     */
-    public function getXml()
-    {
-        return $this->_dom->ownerDocument->saveXML($this->_dom);
-    }
-}

+ 0 - 289
library/Zend/Service/Technorati/ResultSet.php

@@ -1,289 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Result
- */
-require_once 'Zend/Service/Technorati/Result.php';
-
-
-/**
- * This is the most essential result set.
- * The scope of this class is to be extended by a query-specific child result set class,
- * and it should never be used to initialize a standalone object.
- *
- * Each of the specific result sets represents a collection of query-specific
- * Zend_Service_Technorati_Result objects.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @abstract
- */
-abstract class Zend_Service_Technorati_ResultSet implements SeekableIterator
-{
-    /**
-     * The total number of results available
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_totalResultsAvailable;
-
-    /**
-     * The number of results in this result set
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_totalResultsReturned;
-
-    /**
-     * The offset in the total result set of this search set
-     *
-     * @var     int
-     */
-    //TODO public $firstResultPosition;
-
-
-    /**
-     * A DomNodeList of results
-     *
-     * @var     DomNodeList
-     * @access  protected
-     */
-    protected $_results;
-
-    /**
-     * Technorati API response document
-     *
-     * @var     DomDocument
-     * @access  protected
-     */
-    protected $_dom;
-
-    /**
-     * Object for $this->_dom
-     *
-     * @var     DOMXpath
-     * @access  protected
-     */
-    protected $_xpath;
-
-    /**
-     * XML string representation for $this->_dom
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_xml;
-
-    /**
-     * Current Item
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_currentIndex = 0;
-
-
-    /**
-     * Parses the search response and retrieves the results for iteration.
-     *
-     * @param   DomDocument $dom    the ReST fragment for this object
-     * @param   array $options      query options as associative array
-     */
-    public function __construct(DomDocument $dom, $options = array())
-    {
-        $this->_init($dom, $options);
-
-        // Technorati loves to make developer's life really hard
-        // I must read query options in order to normalize a single way
-        // to display start and limit.
-        // The value is printed out in XML using many different tag names,
-        // too hard to get it from XML
-
-        // Additionally, the following tags should be always available
-        // according to API documentation but... this is not the truth!
-        // - querytime
-        // - limit
-        // - start (sometimes rankingstart)
-
-        // query tag is only available for some requests, the same for url.
-        // For now ignore them.
-
-        //$start = isset($options['start']) ? $options['start'] : 1;
-        //$limit = isset($options['limit']) ? $options['limit'] : 20;
-        //$this->_firstResultPosition = $start;
-    }
-
-    /**
-     * Initializes this object from a DomDocument response.
-     *
-     * Because __construct and __wakeup shares some common executions,
-     * it's useful to group them in a single initialization method.
-     * This method is called once each time a new instance is created
-     * or a serialized object is unserialized.
-     *
-     * @param   DomDocument $dom the ReST fragment for this object
-     * @param   array $options   query options as associative array
-     *      * @return  void
-     */
-    protected function _init(DomDocument $dom, $options = array())
-    {
-        $this->_dom     = $dom;
-        $this->_xpath   = new DOMXPath($dom);
-
-        $this->_results = $this->_xpath->query("//item");
-    }
-
-    /**
-     * Number of results returned.
-     *
-     * @return  int     total number of results returned
-     */
-    public function totalResults()
-    {
-        return (int) $this->_totalResultsReturned;
-    }
-
-
-    /**
-     * Number of available results.
-     *
-     * @return  int     total number of available results
-     */
-    public function totalResultsAvailable()
-    {
-        return (int) $this->_totalResultsAvailable;
-    }
-
-    /**
-     * Implements SeekableIterator::current().
-     *
-     * @return  void
-     * @throws  Zend_Service_Exception
-     * @abstract
-     */
-    // abstract public function current();
-
-    /**
-     * Implements SeekableIterator::key().
-     *
-     * @return  int
-     */
-    public function key()
-    {
-        return $this->_currentIndex;
-    }
-
-    /**
-     * Implements SeekableIterator::next().
-     *
-     * @return  void
-     */
-    public function next()
-    {
-        $this->_currentIndex += 1;
-    }
-
-    /**
-     * Implements SeekableIterator::rewind().
-     *
-     * @return  bool
-     */
-    public function rewind()
-    {
-        $this->_currentIndex = 0;
-        return true;
-    }
-
-    /**
-     * Implement SeekableIterator::seek().
-     *
-     * @param   int $index
-     * @return  void
-     * @throws  OutOfBoundsException
-     */
-    public function seek($index)
-    {
-        $indexInt = (int) $index;
-        if ($indexInt >= 0 && $indexInt < $this->_results->length) {
-            $this->_currentIndex = $indexInt;
-        } else {
-            throw new OutOfBoundsException("Illegal index '$index'");
-        }
-    }
-
-    /**
-     * Implement SeekableIterator::valid().
-     *
-     * @return boolean
-     */
-    public function valid()
-    {
-        return null !== $this->_results && $this->_currentIndex < $this->_results->length;
-    }
-
-    /**
-     * Returns the response document as XML string.
-     *
-     * @return string   the response document converted into XML format
-     */
-    public function getXml()
-    {
-        return $this->_dom->saveXML();
-    }
-
-    /**
-     * Overwrites standard __sleep method to make this object serializable.
-     *
-     * DomDocument and DOMXpath objects cannot be serialized.
-     * This method converts them back to an XML string.
-     *
-     * @return void
-     */
-    public function __sleep() {
-        $this->_xml     = $this->getXml();
-        $vars = array_keys(get_object_vars($this));
-        return array_diff($vars, array('_dom', '_xpath'));
-    }
-
-    /**
-     * Overwrites standard __wakeup method to make this object unserializable.
-     *
-     * Restores object status before serialization.
-     * Converts XML string into a DomDocument object and creates a valid
-     * DOMXpath instance for given DocDocument.
-     *
-     * @return void
-     */
-    public function __wakeup() {
-        $dom = new DOMDocument();
-        $dom->loadXml($this->_xml);
-        $this->_init($dom);
-        $this->_xml = null; // reset XML content
-    }
-}

+ 0 - 150
library/Zend/Service/Technorati/SearchResult.php

@@ -1,150 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Result
- */
-require_once 'Zend/Service/Technorati/Result.php';
-
-
-/**
- * Represents a single Technorati Search query result object.
- * It is never returned as a standalone object,
- * but it always belongs to a valid Zend_Service_Technorati_SearchResultSet object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_SearchResult extends Zend_Service_Technorati_Result
-{
-    /**
-     * Technorati weblog object corresponding to queried keyword.
-     *
-     * @var     Zend_Service_Technorati_Weblog
-     * @access  protected
-     */
-    protected $_weblog;
-
-    /**
-     * The title of the entry.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_title;
-
-    /**
-     * The blurb from entry with search term highlighted.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_excerpt;
-
-    /**
-     * The datetime the entry was created.
-     *
-     * @var     Zend_Date
-     * @access  protected
-     */
-    protected $_created;
-
-    /**
-     * The permalink of the blog entry.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_permalink;
-
-
-    /**
-     * Constructs a new object object from DOM Element.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $this->_fields = array( '_permalink'    => 'permalink',
-                                '_excerpt'      => 'excerpt',
-                                '_created'      => 'created',
-                                '_title'        => 'title');
-        parent::__construct($dom);
-
-        // weblog object field
-        $this->_parseWeblog();
-
-        // filter fields
-        $this->_permalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_permalink);
-        $this->_created = Zend_Service_Technorati_Utils::normalizeDate($this->_created);
-    }
-
-    /**
-     * Returns the weblog object that links queried URL.
-     *
-     * @return  Zend_Service_Technorati_Weblog
-     */
-    public function getWeblog() {
-        return $this->_weblog;
-    }
-
-    /**
-     * Returns the title of the entry.
-     *
-     * @return  string
-     */
-    public function getTitle() {
-        return $this->_title;
-    }
-
-    /**
-     * Returns the blurb from entry with search term highlighted.
-     *
-     * @return  string
-     */
-    public function getExcerpt() {
-        return $this->_excerpt;
-    }
-
-    /**
-     * Returns the datetime the entry was created.
-     *
-     * @return  Zend_Date
-     */
-    public function getCreated() {
-        return $this->_created;
-    }
-
-    /**
-     * Returns the permalink of the blog entry.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getPermalink() {
-        return $this->_permalink;
-    }
-
-}

+ 0 - 79
library/Zend/Service/Technorati/SearchResultSet.php

@@ -1,79 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_ResultSet
- */
-require_once 'Zend/Service/Technorati/ResultSet.php';
-
-
-/**
- * Represents a Technorati Search query result set.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_SearchResultSet extends Zend_Service_Technorati_ResultSet
-{
-    /**
-     * Number of query results.
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_queryCount;
-
-    /**
-     * Parses the search response and retrieve the results for iteration.
-     *
-     * @param   DomDocument $dom    the ReST fragment for this object
-     * @param   array $options      query options as associative array
-     */
-    public function __construct(DomDocument $dom, $options = array())
-    {
-        parent::__construct($dom, $options);
-
-        $result = $this->_xpath->query('/tapi/document/result/querycount/text()');
-        if ($result->length == 1) $this->_queryCount = (int) $result->item(0)->data;
-
-        $this->_totalResultsReturned  = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
-        $this->_totalResultsAvailable = (int) $this->_queryCount;
-    }
-
-    /**
-     * Implements Zend_Service_Technorati_ResultSet::current().
-     *
-     * @return Zend_Service_Technorati_SearchResult current result
-     */
-    public function current()
-    {
-        /**
-         * @see Zend_Service_Technorati_SearchResult
-         */
-        require_once 'Zend/Service/Technorati/SearchResult.php';
-        return new Zend_Service_Technorati_SearchResult($this->_results->item($this->_currentIndex));
-    }
-}

+ 0 - 171
library/Zend/Service/Technorati/TagResult.php

@@ -1,171 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Result
- */
-require_once 'Zend/Service/Technorati/Result.php';
-
-
-/**
- * Represents a single Technorati Tag query result object.
- * It is never returned as a standalone object,
- * but it always belongs to a valid Zend_Service_Technorati_TagResultSet object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_TagResult extends Zend_Service_Technorati_Result
-{
-    /**
-     * Technorati weblog object corresponding to queried keyword.
-     *
-     * @var     Zend_Service_Technorati_Weblog
-     * @access  protected
-     */
-    protected $_weblog;
-
-    /**
-     * The title of the entry.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_title;
-
-    /**
-     * The blurb from entry with search term highlighted.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_excerpt;
-
-    /**
-     * The datetime the entry was created.
-     *
-     * @var     Zend_Date
-     * @access  protected
-     */
-    protected $_created;
-
-    /**
-     * The datetime the entry was updated.
-     * Called 'postupdate' in original XML response,
-     * it has been renamed to provide more coherence.
-     *
-     * @var     Zend_Date
-     * @access  protected
-     */
-    protected $_updated;
-
-    /**
-     * The permalink of the blog entry.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_permalink;
-
-
-    /**
-     * Constructs a new object object from DOM Element.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $this->_fields = array( '_permalink'    => 'permalink',
-                                '_excerpt'      => 'excerpt',
-                                '_created'      => 'created',
-                                '_updated'      => 'postupdate',
-                                '_title'        => 'title');
-        parent::__construct($dom);
-
-        // weblog object field
-        $this->_parseWeblog();
-
-        // filter fields
-        $this->_permalink = Zend_Service_Technorati_Utils::normalizeUriHttp($this->_permalink);
-        $this->_created = Zend_Service_Technorati_Utils::normalizeDate($this->_created);
-        $this->_updated = Zend_Service_Technorati_Utils::normalizeDate($this->_updated);
-    }
-
-    /**
-     * Returns the weblog object that links queried URL.
-     *
-     * @return  Zend_Service_Technorati_Weblog
-     */
-    public function getWeblog() {
-        return $this->_weblog;
-    }
-
-    /**
-     * Returns the title of the entry.
-     *
-     * @return  string
-     */
-    public function getTitle() {
-        return $this->_title;
-    }
-
-    /**
-     * Returns the blurb from entry with search term highlighted.
-     *
-     * @return  string
-     */
-    public function getExcerpt() {
-        return $this->_excerpt;
-    }
-
-    /**
-     * Returns the datetime the entry was created.
-     *
-     * @return  Zend_Date
-     */
-    public function getCreated() {
-        return $this->_created;
-    }
-
-    /**
-     * Returns the datetime the entry was updated.
-     *
-     * @return  Zend_Date
-     */
-    public function getUpdated() {
-        return $this->_updated;
-    }
-
-    /**
-     * Returns the permalink of the blog entry.
-     *
-     * @return  Zend_Uri_Http
-     */
-    public function getPermalink() {
-        return $this->_permalink;
-    }
-
-}

+ 0 - 110
library/Zend/Service/Technorati/TagResultSet.php

@@ -1,110 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_ResultSet
- */
-require_once 'Zend/Service/Technorati/ResultSet.php';
-
-
-/**
- * Represents a Technorati Tag query result set.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_TagResultSet extends Zend_Service_Technorati_ResultSet
-{
-    /**
-     * Number of posts that match the tag.
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_postsMatched;
-
-    /**
-     * Number of blogs that match the tag.
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_blogsMatched;
-
-    /**
-     * Parses the search response and retrieve the results for iteration.
-     *
-     * @param   DomDocument $dom    the ReST fragment for this object
-     * @param   array $options      query options as associative array
-     */
-    public function __construct(DomDocument $dom, $options = array())
-    {
-        parent::__construct($dom, $options);
-
-        $result = $this->_xpath->query('/tapi/document/result/postsmatched/text()');
-        if ($result->length == 1) $this->_postsMatched = (int) $result->item(0)->data;
-
-        $result = $this->_xpath->query('/tapi/document/result/blogsmatched/text()');
-        if ($result->length == 1) $this->_blogsMatched = (int) $result->item(0)->data;
-
-        $this->_totalResultsReturned  = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
-        /** @todo Validate the following assertion */
-        $this->_totalResultsAvailable = (int) $this->getPostsMatched();
-    }
-
-
-    /**
-     * Returns the number of posts that match the tag.
-     *
-     * @return  int
-     */
-    public function getPostsMatched() {
-        return $this->_postsMatched;
-    }
-
-    /**
-     * Returns the number of blogs that match the tag.
-     *
-     * @return  int
-     */
-    public function getBlogsMatched() {
-        return $this->_blogsMatched;
-    }
-
-    /**
-     * Implements Zend_Service_Technorati_ResultSet::current().
-     *
-     * @return Zend_Service_Technorati_TagResult current result
-     */
-    public function current()
-    {
-        /**
-         * @see Zend_Service_Technorati_TagResult
-         */
-        require_once 'Zend/Service/Technorati/TagResult.php';
-        return new Zend_Service_Technorati_TagResult($this->_results->item($this->_currentIndex));
-    }
-}

+ 0 - 93
library/Zend/Service/Technorati/TagsResult.php

@@ -1,93 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Result
- */
-require_once 'Zend/Service/Technorati/Result.php';
-
-
-/**
- * Represents a single Technorati TopTags or BlogPostTags query result object.
- * It is never returned as a standalone object,
- * but it always belongs to a valid Zend_Service_Technorati_TagsResultSet object.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_TagsResult extends Zend_Service_Technorati_Result
-{
-    /**
-     * Name of the tag.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_tag;
-
-    /**
-     * Number of posts containing this tag.
-     *
-     * @var     int
-     * @access  protected
-     */
-    protected $_posts;
-
-
-    /**
-     * Constructs a new object object from DOM Document.
-     *
-     * @param   DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $this->_fields = array( '_tag'   => 'tag',
-                                '_posts' => 'posts');
-        parent::__construct($dom);
-
-        // filter fields
-        $this->_tag   = (string) $this->_tag;
-        $this->_posts = (int) $this->_posts;
-    }
-
-    /**
-     * Returns the tag name.
-     *
-     * @return  string
-     */
-    public function getTag() {
-        return $this->_tag;
-    }
-
-    /**
-     * Returns the number of posts.
-     *
-     * @return  int
-     */
-    public function getPosts() {
-        return $this->_posts;
-    }
-}

+ 0 - 67
library/Zend/Service/Technorati/TagsResultSet.php

@@ -1,67 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_ResultSet
- */
-require_once 'Zend/Service/Technorati/ResultSet.php';
-
-
-/**
- * Represents a Technorati TopTags or BlogPostTags queries result set.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_TagsResultSet extends Zend_Service_Technorati_ResultSet
-{
-    /**
-     * Constructs a new object object from DOM Document.
-     *
-     * @param   DomDocument $dom the ReST fragment for this object
-     */
-    public function __construct(DomDocument $dom, $options = array())
-    {
-        parent::__construct($dom, $options);
-
-        $this->_totalResultsReturned  = (int) $this->_xpath->evaluate("count(/tapi/document/item)");
-        $this->_totalResultsAvailable = (int) $this->_totalResultsReturned;
-    }
-
-    /**
-     * Implements Zend_Service_Technorati_ResultSet::current().
-     *
-     * @return Zend_Service_Technorati_TagsResult current result
-     */
-    public function current()
-    {
-        /**
-         * @see Zend_Service_Technorati_TagsResult
-         */
-        require_once 'Zend/Service/Technorati/TagsResult.php';
-        return new Zend_Service_Technorati_TagsResult($this->_results->item($this->_currentIndex));
-    }
-}

+ 0 - 136
library/Zend/Service/Technorati/Utils.php

@@ -1,136 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * Collection of utilities for various Zend_Service_Technorati classes.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_Utils
-{
-    /**
-     * 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);
-            }
-            // wrap exception under Zend_Service_Technorati_Exception object
-            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;
-    }
-    /**
-     * Parses, validates and returns a valid Zend_Date object
-     * from given $input.
-     *
-     * $input can be either a string, an integer or a Zend_Date object.
-     * If $input is string or int, it will be provided to Zend_Date as it is.
-     * If $input is a Zend_Date object, the object instance will be returned.
-     *
-     * @param   mixed|Zend_Date $input
-     * @return  null|Zend_Date
-     * @throws  Zend_Service_Technorati_Exception
-     * @static
-     */
-    public static function normalizeDate($input)
-    {
-        /**
-         * @see Zend_Date
-         */
-        require_once 'Zend/Date.php';
-        /**
-         * @see Zend_Locale
-         */
-        require_once 'Zend/Locale.php';
-
-        // allow null as value and return valid Zend_Date objects
-        if (($input === null) || ($input instanceof Zend_Date)) {
-            return $input;
-        }
-
-        // due to a BC break as of ZF 1.5 it's not safe to use Zend_Date::isDate() here
-        // see ZF-2524, ZF-2334
-        if (@strtotime($input) !== FALSE) {
-            return new Zend_Date($input);
-        } else {
-            /**
-             * @see Zend_Service_Technorati_Exception
-             */
-            require_once 'Zend/Service/Technorati/Exception.php';
-            throw new Zend_Service_Technorati_Exception("'$input' is not a valid Date/Time");
-        }
-    }
-
-    /**
-     * @todo public static function xpathQueryAndSet() {}
-     */
-
-    /**
-     * @todo public static function xpathQueryAndSetIf() {}
-     */
-
-    /**
-     * @todo public static function xpathQueryAndSetUnless() {}
-     */
-}

+ 0 - 486
library/Zend/Service/Technorati/Weblog.php

@@ -1,486 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-
-/**
- * @see Zend_Service_Technorati_Author
- */
-require_once 'Zend/Service/Technorati/Author.php';
-
-/**
- * @see Zend_Service_Technorati_Utils
- */
-require_once 'Zend/Service/Technorati/Utils.php';
-
-
-/**
- * Represents a Weblog object successful recognized by Technorati.
- *
- * @category   Zend
- * @package    Zend_Service
- * @subpackage Technorati
- * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Service_Technorati_Weblog
-{
-    /**
-     * Blog name as written in the feed.
-     *
-     * @var     string
-     * @access  protected
-     */
-    protected $_name;
-
-    /**
-     * Base blog URL.
-     *
-     * @var     Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_url;
-
-    /**
-     * RSS feed URL, if any.
-     *
-     * @var     null|Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_rssUrl;
-
-    /**
-     * Atom feed URL, if any.
-     *
-     * @var     null|Zend_Uri_Http
-     * @access  protected
-     */
-    protected $_atomUrl;
-
-    /**
-     * Number of unique blogs linking this blog.
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_inboundBlogs;
-
-    /**
-     * Number of incoming links to this blog.
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_inboundLinks;
-
-    /**
-     * Last blog update UNIX timestamp.
-     *
-     * @var     null|Zend_Date
-     * @access  protected
-     */
-    protected $_lastUpdate;
-
-    /**
-     * Technorati rank value for this weblog.
-     *
-     * Note. This property has no official documentation.
-     *
-     * @var     integer
-     * @access  protected
-     */
-    protected $_rank;
-
-    /**
-     * Blog latitude coordinate.
-     *
-     * Note. This property has no official documentation.
-     *
-     * @var     float
-     * @access  protected
-     */
-    protected $_lat;
-
-    /**
-     * Blog longitude coordinate.
-     *
-     * Note. This property has no official documentation.
-     *
-     * @var     float
-     * @access  protected
-     */
-    protected $_lon;
-
-    /**
-     * Whether the author who claimed this weblog has a photo.
-     *
-     * Note. This property has no official documentation.
-     *
-     * @var     bool
-     * @access  protected
-     * @see     Zend_Service_Technorati_Author::$thumbnailPicture
-     */
-    protected $_hasPhoto = false;
-
-    /**
-     * An array of Zend_Service_Technorati_Author who claimed this blog
-     *
-     * @var     array
-     * @access  protected
-     */
-    protected $_authors = array();
-
-
-    /**
-     * Constructs a new object from DOM Element.
-     *
-     * @param  DomElement $dom the ReST fragment for this object
-     */
-    public function __construct(DomElement $dom)
-    {
-        $xpath = new DOMXPath($dom->ownerDocument);
-
-        $result = $xpath->query('./name/text()', $dom);
-        if ($result->length == 1) $this->setName($result->item(0)->data);
-
-        $result = $xpath->query('./url/text()', $dom);
-        if ($result->length == 1) $this->setUrl($result->item(0)->data);
-
-        $result = $xpath->query('./inboundblogs/text()', $dom);
-        if ($result->length == 1) $this->setInboundBlogs($result->item(0)->data);
-
-        $result = $xpath->query('./inboundlinks/text()', $dom);
-        if ($result->length == 1) $this->setInboundLinks($result->item(0)->data);
-
-        $result = $xpath->query('./lastupdate/text()', $dom);
-        if ($result->length == 1) $this->setLastUpdate($result->item(0)->data);
-
-        /* The following elements need more attention */
-
-        $result = $xpath->query('./rssurl/text()', $dom);
-        if ($result->length == 1) $this->setRssUrl($result->item(0)->data);
-
-        $result = $xpath->query('./atomurl/text()', $dom);
-        if ($result->length == 1) $this->setAtomUrl($result->item(0)->data);
-
-        $result = $xpath->query('./author', $dom);
-        if ($result->length >= 1) {
-            foreach ($result as $author) {
-                $this->_authors[] = new Zend_Service_Technorati_Author($author);
-            }
-        }
-
-        /**
-         * The following are optional elements
-         *
-         * I can't find any official documentation about the following properties
-         * however they are included in response DTD and/or test responses.
-         */
-
-        $result = $xpath->query('./rank/text()', $dom);
-        if ($result->length == 1) $this->setRank($result->item(0)->data);
-
-        $result = $xpath->query('./lat/text()', $dom);
-        if ($result->length == 1) $this->setLat($result->item(0)->data);
-
-        $result = $xpath->query('./lon/text()', $dom);
-        if ($result->length == 1) $this->setLon($result->item(0)->data);
-
-        $result = $xpath->query('./hasphoto/text()', $dom);
-        if ($result->length == 1) $this->setHasPhoto($result->item(0)->data);
-    }
-
-
-    /**
-     * Returns weblog name.
-     *
-     * @return  string  Weblog name
-     */
-    public function getName()
-    {
-        return $this->_name;
-    }
-
-    /**
-     * Returns weblog URL.
-     *
-     * @return  null|Zend_Uri_Http object representing weblog base URL
-     */
-    public function getUrl()
-    {
-        return $this->_url;
-    }
-
-    /**
-     * Returns number of unique blogs linking this blog.
-     *
-     * @return  integer the number of inbound blogs
-     */
-    public function getInboundBlogs()
-    {
-        return $this->_inboundBlogs;
-    }
-
-    /**
-     * Returns number of incoming links to this blog.
-     *
-     * @return  integer the number of inbound links
-     */
-    public function getInboundLinks()
-    {
-        return $this->_inboundLinks;
-    }
-
-    /**
-     * Returns weblog Rss URL.
-     *
-     * @return  null|Zend_Uri_Http object representing the URL
-     *          of the RSS feed for given blog
-     */
-    public function getRssUrl()
-    {
-        return $this->_rssUrl;
-    }
-
-    /**
-     * Returns weblog Atom URL.
-     *
-     * @return  null|Zend_Uri_Http object representing the URL
-     *          of the Atom feed for given blog
-     */
-    public function getAtomUrl()
-    {
-        return $this->_atomUrl;
-    }
-
-    /**
-     * Returns UNIX timestamp of the last weblog update.
-     *
-     * @return  integer UNIX timestamp of the last weblog update
-     */
-    public function getLastUpdate()
-    {
-        return $this->_lastUpdate;
-    }
-
-    /**
-     * Returns weblog rank value.
-     *
-     * Note. This property is not documented.
-     *
-     * @return  integer weblog rank value
-     */
-    public function getRank()
-    {
-        return $this->_rank;
-    }
-
-    /**
-     * Returns weblog latitude coordinate.
-     *
-     * Note. This property is not documented.
-     *
-     * @return  float   weblog latitude coordinate
-     */
-    public function getLat() {
-        return $this->_lat;
-    }
-
-    /**
-     * Returns weblog longitude coordinate.
-     *
-     * Note. This property is not documented.
-     *
-     * @return  float   weblog longitude coordinate
-     */
-    public function getLon()
-    {
-        return $this->_lon;
-    }
-
-    /**
-     * Returns whether the author who claimed this weblog has a photo.
-     *
-     * Note. This property is not documented.
-     *
-     * @return  bool    TRUE if the author who claimed this weblog has a photo,
-     *                  FALSE otherwise.
-     */
-    public function hasPhoto()
-    {
-        return (bool) $this->_hasPhoto;
-    }
-
-    /**
-     * Returns the array of weblog authors.
-     *
-     * @return  array of Zend_Service_Technorati_Author authors
-     */
-    public function getAuthors()
-    {
-        return (array) $this->_authors;
-    }
-
-
-    /**
-     * Sets weblog name.
-     *
-     * @param   string $name
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setName($name)
-    {
-        $this->_name = (string) $name;
-        return $this;
-    }
-
-    /**
-     * Sets weblog URL.
-     *
-     * @param   string|Zend_Uri_Http $url
-     * @return  void
-     * @throws  Zend_Service_Technorati_Exception if $input is an invalid URI
-     *          (via Zend_Service_Technorati_Utils::normalizeUriHttp)
-     */
-    public function setUrl($url)
-    {
-        $this->_url = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
-        return $this;
-    }
-
-    /**
-     * Sets number of inbound blogs.
-     *
-     * @param   integer $number
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setInboundBlogs($number)
-    {
-        $this->_inboundBlogs = (int) $number;
-        return $this;
-    }
-
-    /**
-     * Sets number of Iinbound links.
-     *
-     * @param   integer $number
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setInboundLinks($number)
-    {
-        $this->_inboundLinks = (int) $number;
-        return $this;
-    }
-
-    /**
-     * Sets weblog Rss URL.
-     *
-     * @param   string|Zend_Uri_Http $url
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     * @throws  Zend_Service_Technorati_Exception if $input is an invalid URI
-     *          (via Zend_Service_Technorati_Utils::normalizeUriHttp)
-     */
-    public function setRssUrl($url)
-    {
-        $this->_rssUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
-        return $this;
-    }
-
-    /**
-     * Sets weblog Atom URL.
-     *
-     * @param   string|Zend_Uri_Http $url
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     * @throws  Zend_Service_Technorati_Exception if $input is an invalid URI
-     *          (via Zend_Service_Technorati_Utils::normalizeUriHttp)
-     */
-    public function setAtomUrl($url)
-    {
-        $this->_atomUrl = Zend_Service_Technorati_Utils::normalizeUriHttp($url);
-        return $this;
-    }
-
-    /**
-     * Sets weblog Last Update timestamp.
-     *
-     * $datetime can be any value supported by
-     * Zend_Service_Technorati_Utils::normalizeDate().
-     *
-     * @param   mixed $datetime A string representing the last update date time
-     *                          in a valid date time format
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     * @throws  Zend_Service_Technorati_Exception
-     */
-    public function setLastUpdate($datetime)
-    {
-        $this->_lastUpdate = Zend_Service_Technorati_Utils::normalizeDate($datetime);
-        return $this;
-    }
-
-    /**
-     * Sets weblog Rank.
-     *
-     * @param   integer $rank
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setRank($rank)
-    {
-        $this->_rank = (int) $rank;
-        return $this;
-    }
-
-    /**
-     * Sets weblog latitude coordinate.
-     *
-     * @param   float $coordinate
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setLat($coordinate)
-    {
-        $this->_lat = (float) $coordinate;
-        return $this;
-    }
-
-    /**
-     * Sets weblog longitude coordinate.
-     *
-     * @param   float $coordinate
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setLon($coordinate)
-    {
-        $this->_lon = (float) $coordinate;
-        return $this;
-    }
-
-    /**
-     * Sets hasPhoto property.
-     *
-     * @param   bool $hasPhoto
-     * @return  Zend_Service_Technorati_Weblog $this instance
-     */
-    public function setHasPhoto($hasPhoto)
-    {
-        $this->_hasPhoto = (bool) $hasPhoto;
-        return $this;
-    }
-
-}