summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2013-08-01 08:53:46 +0200
committerTheo Chatzimichos <tampakrap@gentoo.org>2013-08-01 08:53:46 +0200
commitc65f25a29edb6d47fa7d99a69c274f906b61adea (patch)
tree3f85de9f4159f72bb555310a6e4e5da75276a7ff /plugins/wordpress-importer/parsers.php
parentbump kde-graffiti (diff)
downloadblogs-gentoo-c65f25a29edb6d47fa7d99a69c274f906b61adea.tar.gz
blogs-gentoo-c65f25a29edb6d47fa7d99a69c274f906b61adea.tar.bz2
blogs-gentoo-c65f25a29edb6d47fa7d99a69c274f906b61adea.zip
Update jetpack, akismet and wordpress-importer
Diffstat (limited to 'plugins/wordpress-importer/parsers.php')
-rw-r--r--plugins/wordpress-importer/parsers.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/wordpress-importer/parsers.php b/plugins/wordpress-importer/parsers.php
index 7bd8ba43..f3cee6c4 100644
--- a/plugins/wordpress-importer/parsers.php
+++ b/plugins/wordpress-importer/parsers.php
@@ -57,7 +57,24 @@ class WXR_Parser_SimpleXML {
$authors = $posts = $categories = $tags = $terms = array();
$internal_errors = libxml_use_internal_errors(true);
- $xml = simplexml_load_file( $file );
+
+ $dom = new DOMDocument;
+ $old_value = null;
+ if ( function_exists( 'libxml_disable_entity_loader' ) ) {
+ $old_value = libxml_disable_entity_loader( true );
+ }
+ $success = $dom->loadXML( file_get_contents( $file ) );
+ if ( ! is_null( $old_value ) ) {
+ libxml_disable_entity_loader( $old_value );
+ }
+
+ if ( ! $success || isset( $dom->doctype ) ) {
+ return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );
+ }
+
+ $xml = simplexml_import_dom( $dom );
+ unset( $dom );
+
// halt if loading produces an error
if ( ! $xml )
return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this WXR file', 'wordpress-importer' ), libxml_get_errors() );