| @@ -32,15 +32,9 @@ | ||
| 32 | 32 | define( 'WP_IMPORTING', true ); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if ( ! class_exists( 'DOMDocument' ) ) { |
| 36 | - $error_message = sprintf( | |
| 37 | - /* translators: 1: Documentation link */ | |
| 38 | - __( 'In order to install XML, your server must have DOMDocument installed. Follow our documentation on %1$s to ensure DOMDocument is properly set up and XML support is enabled.', 'formidable' ), | |
| 39 | - '<a href="https://formidableforms.com/knowledgebase/import-forms-entries-and-views/#kb-your-server-does-not-have-xml-enabled" target="_blank">Importing Forms, Entries, and Views</a>' | |
| 40 | - ); | |
| 41 | - | |
| 42 | - return new WP_Error( 'SimpleXML_parse_error', $error_message, libxml_get_errors() ); | |
| 36 | + return new WP_Error( 'SimpleXML_parse_error', __( 'Your server does not have XML enabled', 'formidable' ), libxml_get_errors() ); | |
| 43 | 37 | } |
| 44 | 38 | |
| 45 | 39 | $xml_string = file_get_contents( $file ); |
| 46 | 40 | self::maybe_fix_xml( $xml_string ); |
| @@ -303,15 +297,9 @@ | ||
| 303 | 297 | } |
| 304 | 298 | |
| 305 | 299 | $edit_query = apply_filters( 'frm_match_xml_form', $edit_query, $form ); |
| 306 | 300 | |
| 307 | - $form = FrmForm::getAll( $edit_query, '', 1 ); | |
| 308 | - if ( is_object( $form ) && $form->status === 'trash' ) { | |
| 309 | - FrmForm::destroy( $form->id ); | |
| 310 | - return false; | |
| 311 | - } | |
| 312 | - | |
| 313 | - return $form; | |
| 301 | + return FrmForm::getAll( $edit_query, '', 1 ); | |
| 314 | 302 | } |
| 315 | 303 | |
| 316 | 304 | private static function update_form( $this_form, $form, &$imported ) { |
| 317 | 305 | $form_id = $this_form->id; |
| @@ -1290,29 +1278,8 @@ | ||
| 1290 | 1278 | */ |
| 1291 | 1279 | public static function parse_message( $result, &$message, &$errors ) { |
| 1292 | 1280 | if ( is_wp_error( $result ) ) { |
| 1293 | 1281 | $errors[] = $result->get_error_message(); |
| 1294 | - | |
| 1295 | - // Remove the SimpleXML_parse_error from the WP_Error object to avoid | |
| 1296 | - // displaying duplicate error messages from $result->get_error_message() | |
| 1297 | - $error_codes = $result->get_error_codes(); | |
| 1298 | - $error_details = array(); | |
| 1299 | - foreach ( $error_codes as $error_code ) { | |
| 1300 | - // Clone WP_Error data because WP_Error removes all error messages and data | |
| 1301 | - // associated with the specified error code when an item is removed. | |
| 1302 | - // Source: https://developer.wordpress.org/reference/classes/wp_error/remove/#source | |
| 1303 | - $error_details = $result->get_error_data( $error_code ); | |
| 1304 | - if ( $error_code === 'SimpleXML_parse_error' ) { | |
| 1305 | - $result->remove( $error_code ); | |
| 1306 | - break; | |
| 1307 | - } | |
| 1308 | - } | |
| 1309 | - | |
| 1310 | - if ( ! empty( $error_details ) ) { | |
| 1311 | - $errors[] = '<br />' . esc_html_x( 'Error details:', 'import xml message', 'formidable' ) . '<br />' . esc_html( print_r( $error_details, 1 ) ); | |
| 1312 | - } | |
| 1313 | - | |
| 1314 | - return; | |
| 1315 | 1282 | } elseif ( ! $result ) { |
| 1316 | 1283 | return; |
| 1317 | 1284 | } |
| 1318 | 1285 | |