web/lib/Zend/Service/Technorati.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    14  * to license@zend.com so we can send you a copy immediately.
    14  * to license@zend.com so we can send you a copy immediately.
    15  *
    15  *
    16  * @category   Zend
    16  * @category   Zend
    17  * @package    Zend_Service
    17  * @package    Zend_Service
    18  * @subpackage Technorati
    18  * @subpackage Technorati
    19  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  * @version    $Id: Technorati.php 24593 2012-01-05 20:35:02Z matthew $
    21  * @version    $Id$
    22  */
    22  */
    23 
    23 
       
    24 /** @see Zend_Xml_Security */
       
    25 require_once 'Zend/Xml/Security.php';
    24 
    26 
    25 /**
    27 /**
    26  * Zend_Service_Technorati provides an easy, intuitive and object-oriented interface
    28  * Zend_Service_Technorati provides an easy, intuitive and object-oriented interface
    27  * for using the Technorati API.
    29  * for using the Technorati API.
    28  *
    30  *
    30  * and returns the original XML response as a friendly PHP object.
    32  * and returns the original XML response as a friendly PHP object.
    31  *
    33  *
    32  * @category   Zend
    34  * @category   Zend
    33  * @package    Zend_Service
    35  * @package    Zend_Service
    34  * @subpackage Technorati
    36  * @subpackage Technorati
    35  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    37  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    36  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    38  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    37  */
    39  */
    38 class Zend_Service_Technorati
    40 class Zend_Service_Technorati
    39 {
    41 {
    40     /** Base Technorati API URI */
    42     /** Base Technorati API URI */
    82      *
    84      *
    83      * @param  string $apiKey  Your Technorati API key
    85      * @param  string $apiKey  Your Technorati API key
    84      */
    86      */
    85     public function __construct($apiKey)
    87     public function __construct($apiKey)
    86     {
    88     {
    87         iconv_set_encoding('output_encoding', 'UTF-8');
    89         if (PHP_VERSION_ID < 50600) {
    88         iconv_set_encoding('input_encoding', 'UTF-8');
    90             iconv_set_encoding('output_encoding', 'UTF-8');
    89         iconv_set_encoding('internal_encoding', 'UTF-8');
    91             iconv_set_encoding('input_encoding', 'UTF-8');
    90 
    92             iconv_set_encoding('internal_encoding', 'UTF-8');
       
    93         } else {
       
    94             ini_set('output_encoding', 'UTF-8');
       
    95             ini_set('input_encoding', 'UTF-8');
       
    96             ini_set('default_charset', 'UTF-8');
       
    97         }
    91         $this->_apiKey = $apiKey;
    98         $this->_apiKey = $apiKey;
    92     }
    99     }
    93 
   100 
    94 
   101 
    95     /**
   102     /**
   959      * @access  protected
   966      * @access  protected
   960      */
   967      */
   961     protected function _convertResponseAndCheckContent(Zend_Http_Response $response)
   968     protected function _convertResponseAndCheckContent(Zend_Http_Response $response)
   962     {
   969     {
   963         $dom = new DOMDocument();
   970         $dom = new DOMDocument();
   964         $dom->loadXML($response->getBody());
   971         $dom = Zend_Xml_Security::scan($response->getBody(), $dom);
   965         self::_checkErrors($dom);
   972         self::_checkErrors($dom);
   966         return $dom;
   973         return $dom;
   967     }
   974     }
   968 
   975 
   969     /**
   976     /**