PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.1
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.1
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
ablocks / includes / admin / export.php

export.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.9.1, at includes/admin/export.php

62 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ABlocks\admin;
4
5 class Export {
6
7 public static function init() {
8 $self = new self();
9 add_action( 'rss2_head', [ $self, 'add_options_to_rss' ] );
10 add_action( 'export_filters', [ $self, 'add_patterns_radio' ] );
11 }
12
13 /**
14 * Add options to WXR.
15 *
16 * @return void
17 */
18 public function add_options_to_rss() {
19 global $pagenow;
20 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Don't need nonce verification here, we're just checking if content's value.
21 if ( 'export.php' !== $pagenow || ! isset( $_GET['content'] ) || 'all' !== sanitize_text_field( wp_unslash( $_GET['content'] ) ) ) {
22 return;
23 }
24
25 $options = array(
26 'show_on_front' => get_option( 'show_on_front', 'posts' ),
27 'page_on_front' => get_option( 'page_on_front', 0 ),
28 'page_for_posts' => get_option( 'page_for_posts', 0 ),
29 );
30
31 $custom_data_xml = '<ablocks_options>';
32 foreach ( $options as $key => $value ) {
33 $custom_data_xml .= sprintf(
34 '<%1$s>%2$s</%1$s>',
35 esc_xml( $key ),
36 esc_xml( $value )
37 );
38 }
39 $custom_data_xml .= '</ablocks_options>';
40
41 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Want to put valid xml in RSS head.
42 echo $custom_data_xml;
43 }
44
45 /**
46 * Display "Patterns" radio in export page.
47 *
48 * @return void
49 */
50 public function add_patterns_radio() {
51 ?>
52 <p>
53 <label>
54 <input type="radio" name="content" value="wp_block" />
55 <?php esc_html_e( 'Patterns', 'ablocks' ); ?>
56 </label>
57 </p>
58 <?php
59 }
60
61 }
62