Changeset 23158 for trunk/wp-includes/class-oembed.php
- Timestamp:
- 12/10/2012 10:23:03 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-oembed.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-oembed.php
r22351 r23158 217 217 */ 218 218 function _parse_xml( $response_body ) { 219 if ( function_exists('simplexml_load_string') ) { 220 $errors = libxml_use_internal_errors( 'true' ); 221 $data = simplexml_load_string( $response_body ); 222 libxml_use_internal_errors( $errors ); 223 if ( ! is_object( $data ) ) 224 return false; 225 226 $return = new stdClass; 227 foreach ( $data as $key => $value ) 228 $return->$key = (string) $value; 229 230 return $return; 231 } 232 return false; 219 if ( !function_exists('simplexml_load_string') ) { 220 return false; 221 } 222 223 $errors = libxml_use_internal_errors( true ); 224 $old_value = null; 225 if ( function_exists( 'libxml_disable_entity_loader' ) ) { 226 $old_value = libxml_disable_entity_loader( true ); 227 } 228 229 $dom = new DOMDocument; 230 $success = $dom->loadXML( $response_body ); 231 232 if ( ! is_null( $old_value ) ) { 233 libxml_disable_entity_loader( $old_value ); 234 } 235 libxml_use_internal_errors( $errors ); 236 237 if ( ! $success || isset( $dom->doctype ) ) { 238 return false; 239 } 240 241 $data = simplexml_import_dom( $dom ); 242 if ( ! is_object( $data ) ) 243 return false; 244 245 $return = new stdClass; 246 foreach ( $data as $key => $value ) 247 $return->$key = (string) $value; 248 return $return; 233 249 } 234 250
Note: See TracChangeset
for help on using the changeset viewer.