PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.20
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.20
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/views/xml/posts_xml.php +19 -9 6.56.20 View file →
@@ -2,8 +2,10 @@
2 2 /**
3 3 * Generate the XML for export for posts and form actions.
4 4 *
5 5 * @phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect
6 + *
7 + * @package Formidable
6 8 */
7 9
8 10 if ( ! defined( 'ABSPATH' ) ) {
9 11 die( 'You are not allowed to call this page directly.' );
@@ -13,9 +15,10 @@
13 15 return;
14 16 }
15 17
16 18 global $wp_query;
17 -$wp_query->in_the_loop = true; // Fake being in the loop.
19 +// Fake being in the loop.
20 +$wp_query->in_the_loop = true;
18 21
19 22 // fetch 20 posts at a time rather than loading the entire table into memory
20 23 while ( $next_posts = array_splice( $item_ids, 0, 20 ) ) {
21 24 $posts = FrmDb::get_results( $wpdb->posts, array( 'ID' => $next_posts ) );
@@ -45,9 +48,9 @@
45 48 <post_password><?php echo FrmXMLHelper::cdata( $post->post_password ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></post_password>
46 49 <is_sticky><?php echo esc_html( $is_sticky ); ?></is_sticky>
47 50 <?php if ( 'attachment' === $post->post_type ) : ?>
48 51 <attachment_url><?php echo esc_url( wp_get_attachment_url( $post->ID ) ); ?></attachment_url>
49 -<?php
52 + <?php
50 53 endif;
51 54
52 55 $postmeta = FrmDb::get_results( $wpdb->postmeta, array( 'post_id' => $post->ID ) );
53 56 foreach ( $postmeta as $meta ) :
@@ -74,22 +77,24 @@
74 77 }
75 78
76 79 if ( 'frm_display' === $post->post_type && is_callable( 'FrmViewsLayout::get_layouts_for_view' ) ) {
77 80 $layouts = FrmViewsLayout::get_layouts_for_view( $post->ID );
78 - foreach ( $layouts as $layout ) {
79 - ?>
81 + if ( is_array( $layouts ) ) {
82 + foreach ( $layouts as $layout ) {
83 + ?>
80 84 <layout>
81 85 <type><?php echo esc_html( $layout->type ); ?></type>
82 86 <data><?php echo FrmXMLHelper::cdata( $layout->data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></data>
83 87 </layout>
84 88 <?php
89 + }
85 90 }
86 91 }
87 92 ?>
88 93 </view>
89 94 <?php
90 - }
91 -}
95 + }//end foreach
96 +}//end while
92 97
93 98 if ( empty( $taxonomies ) ) {
94 99 return;
95 100 }
@@ -98,17 +103,22 @@
98 103 if ( empty( $frm_inc_tax ) ) {
99 104 $frm_inc_tax = array();
100 105 }
101 106
107 +$parent_slugs = FrmXMLController::get_parent_terms_slugs( $terms );
108 +
102 109 foreach ( (array) $terms as $term ) {
103 110 if ( in_array( $term->term_id, $frm_inc_tax, true ) ) {
104 - return;
111 + continue;
105 112 }
106 113
107 114 $frm_inc_tax[] = $term->term_id;
108 - $label = ( 'category' === $term->taxonomy || 'tag' === $term->taxonomy ) ? $term->taxonomy : 'term';
115 + $label = 'category' === $term->taxonomy || 'tag' === $term->taxonomy ? $term->taxonomy : 'term';
109 116 ?>
110 117 <term><term_id><?php echo esc_html( $term->term_id ); ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php
118 + if ( ! empty( $parent_slugs[ $term->parent ] ) ) {
119 + echo '<term_parent>' . esc_html( $parent_slugs[ $term->parent ] ) . '</term_parent>';
120 + }
111 121 if ( ! empty( $term->name ) ) {
112 122 echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
113 123 }
114 124 if ( ! empty( $term->description ) ) {
@@ -115,5 +125,5 @@
115 125 echo '<term_description>' . FrmXMLHelper::cdata( $term->description ) . '</term_description>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
116 126 }
117 127 echo '<term_slug>' . esc_html( $term->slug ) . '</term_slug>';
118 128 echo '</term>';
119 -}
129 +}//end foreach