function wpv_admin_menu_import_export_hook() { if (isset($_POST['export']) && $_POST['export'] == __('Export', 'wpv-views') && isset($_POST['wpv-export-nonce']) && wp_verify_nonce($_POST['wpv-export-nonce'], 'wpv-export-nonce')) { wpv_admin_export_data(); die; } if (isset($_POST['import']) && $_POST['import'] == __('Import', 'wpv-views') && isset($_POST['wpv-import-nonce']) && wp_verify_nonce($_POST['wpv-import-nonce'], 'wpv-import-nonce')) { global $import_errors, $import_messages; $import_errors = wpv_admin_import_data(); if ($import_errors) { add_action('admin_notices', 'wpv_import_errors'); } if (sizeof($import_messages)) { add_action('admin_notices', 'wpv_import_messages'); global $wpv_theme_import, $wpv_theme_import_xml; if (isset($wpv_theme_import) && $wpv_theme_import != '') { include $wpv_theme_import; update_option('views-embedded-import', $timestamp); } } } }
/** * import_on_form_submit * * Executes an import workflow based on $_POSTed parameters and a nonce, taking care of other $_POSTed data * * @since 1.8.0 */ function import_on_form_submit() { if ( current_user_can( 'manage_options' ) && isset( $_POST['import'] ) && ( $_POST['import'] == __( 'Import', 'wpv-views' ) || $_POST['import'] == 'wpv-import' ) && isset( $_POST['wpv-import-nonce'] ) && wp_verify_nonce( $_POST['wpv-import-nonce'], 'wpv-import-nonce' ) ) { $args = array(); $posted_args = array( 'views-overwrite', 'views-delete', 'view-templates-overwrite', 'view-templates-delete', 'view-settings-overwrite' ); foreach ( $posted_args as $mod_arg ) { if ( isset( $_POST[$mod_arg] ) && $_POST[$mod_arg] != 'off' // Legacy ) { $args[$mod_arg] = 'on'; } } $this->import_errors = wpv_admin_import_data( $args ); if ( sizeof( $this->import_messages ) ) { $this->legacy_set_updated_timestamp(); } } }