13 * obtain it through the world-wide-web, please send an email |
13 * obtain it through the world-wide-web, please send an email |
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_Feed |
17 * @package Zend_Feed |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: Feed.php 20096 2010-01-06 02:05:09Z bkarwin $ |
20 * @version $Id: Feed.php 25160 2012-12-18 15:17:16Z matthew $ |
21 */ |
21 */ |
22 |
22 |
23 |
23 |
24 /** |
24 /** |
25 * Feed utility class |
25 * Feed utility class |
189 * @return Zend_Feed_Abstract |
189 * @return Zend_Feed_Abstract |
190 */ |
190 */ |
191 public static function importString($string) |
191 public static function importString($string) |
192 { |
192 { |
193 // Load the feed as an XML DOMDocument object |
193 // Load the feed as an XML DOMDocument object |
194 $libxml_errflag = libxml_use_internal_errors(true); |
194 $libxml_errflag = libxml_use_internal_errors(true); |
|
195 $libxml_entity_loader = libxml_disable_entity_loader(true); |
195 $doc = new DOMDocument; |
196 $doc = new DOMDocument; |
196 if (trim($string) == '') { |
197 if (trim($string) == '') { |
197 require_once 'Zend/Feed/Exception.php'; |
198 require_once 'Zend/Feed/Exception.php'; |
198 throw new Zend_Feed_Exception('Document/string being imported' |
199 throw new Zend_Feed_Exception('Document/string being imported' |
199 . ' is an Empty string or comes from an empty HTTP response'); |
200 . ' is an Empty string or comes from an empty HTTP response'); |
200 } |
201 } |
201 $status = $doc->loadXML($string); |
202 $status = $doc->loadXML($string); |
|
203 libxml_disable_entity_loader($libxml_entity_loader); |
202 libxml_use_internal_errors($libxml_errflag); |
204 libxml_use_internal_errors($libxml_errflag); |
203 |
|
204 |
205 |
205 if (!$status) { |
206 if (!$status) { |
206 // prevent the class to generate an undefined variable notice (ZF-2590) |
207 // prevent the class to generate an undefined variable notice (ZF-2590) |
207 // Build error message |
208 // Build error message |
208 $error = libxml_get_last_error(); |
209 $error = libxml_get_last_error(); |