PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
wp-data-access / WPDataAccess / Utilities / WPDA_Export_Xml.php

WPDA_Export_Xml.php in WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards 5.5.84, at WPDataAccess/Utilities/WPDA_Export_Xml.php

62 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Suppress "error - 0 - No summary was found for this file" on phpdoc generation
5 *
6 * @package WPDataAccess\Utilities
7 */
8
9 namespace WPDataAccess\Utilities {
10
11 use WPDataAccess\WPDA;
12
13 /**
14 * Class WPDA_Export_Xml
15 *
16 * @author Peter Schulz
17 * @since 2.0.13
18 */
19 class WPDA_Export_Xml extends WPDA_Export_Formatted {
20
21 /**
22 * File header for XML export
23 *
24 * @since 2.0.13
25 */
26 protected function header() {
27 WPDA::sent_header( 'text/xml; charset=utf-8', null, "{$this->table_names}.xml" );
28
29 echo '<?xml version="1.0" ?>';
30 echo "<resultset statement=\"{$this->statement}>\""; // phpcs:ignore WordPress.Security.EscapeOutput
31 echo ' time="' . esc_attr( gmdate( 'Y-m-d\TH:i:s\Z' ) ) . '"';
32 echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
33 }
34
35 /**
36 * Process one row to be export in XML format
37 *
38 * @param array $row
39 *
40 * @since 2.0.13
41 */
42 protected function row( $row ) {
43 echo '<row>';
44 foreach ( $row as $column_name => $column_value ) {
45 echo '<field name="' . esc_attr( $column_name ) . '">' . esc_html( $column_value ) . '</field>';
46 }
47 echo '</row>';
48 }
49
50 /**
51 * File footer for XML export
52 *
53 * @since 2.0.13
54 */
55 protected function footer() {
56 echo '</resultset>';
57 }
58
59 }
60
61 }
62