⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 technorati.php

📁 Bug tracker, and reporter.
💻 PHP
📖 第 1 页 / 共 3 页
字号:
         * @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 (is_null($this->_restClient)) {            /**             * @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);    }    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -