| @@ -2,10 +2,8 @@ | ||
| 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 | |
| 8 | 6 | */ |
| 9 | 7 | |
| 10 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 9 | die( 'You are not allowed to call this page directly.' ); |
| @@ -15,10 +13,9 @@ | ||
| 15 | 13 | return; |
| 16 | 14 | } |
| 17 | 15 | |
| 18 | 16 | global $wp_query; |
| 19 | -// Fake being in the loop. | |
| 20 | -$wp_query->in_the_loop = true; | |
| 17 | +$wp_query->in_the_loop = true; // Fake being in the loop. | |
| 21 | 18 | |
| 22 | 19 | // fetch 20 posts at a time rather than loading the entire table into memory |
| 23 | 20 | while ( $next_posts = array_splice( $item_ids, 0, 20 ) ) { |
| 24 | 21 | $posts = FrmDb::get_results( $wpdb->posts, array( 'ID' => $next_posts ) ); |
| @@ -48,9 +45,9 @@ | ||
| 48 | 45 | <post_password><?php echo FrmXMLHelper::cdata( $post->post_password ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></post_password> |
| 49 | 46 | <is_sticky><?php echo esc_html( $is_sticky ); ?></is_sticky> |
| 50 | 47 | <?php if ( 'attachment' === $post->post_type ) : ?> |
| 51 | 48 | <attachment_url><?php echo esc_url( wp_get_attachment_url( $post->ID ) ); ?></attachment_url> |
| 52 | - <?php | |
| 49 | +<?php | |
| 53 | 50 | endif; |
| 54 | 51 | |
| 55 | 52 | $postmeta = FrmDb::get_results( $wpdb->postmeta, array( 'post_id' => $post->ID ) ); |
| 56 | 53 | foreach ( $postmeta as $meta ) : |
| @@ -77,24 +74,22 @@ | ||
| 77 | 74 | } |
| 78 | 75 | |
| 79 | 76 | if ( 'frm_display' === $post->post_type && is_callable( 'FrmViewsLayout::get_layouts_for_view' ) ) { |
| 80 | 77 | $layouts = FrmViewsLayout::get_layouts_for_view( $post->ID ); |
| 81 | - if ( is_array( $layouts ) ) { | |
| 82 | - foreach ( $layouts as $layout ) { | |
| 83 | - ?> | |
| 78 | + foreach ( $layouts as $layout ) { | |
| 79 | + ?> | |
| 84 | 80 | <layout> |
| 85 | 81 | <type><?php echo esc_html( $layout->type ); ?></type> |
| 86 | 82 | <data><?php echo FrmXMLHelper::cdata( $layout->data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></data> |
| 87 | 83 | </layout> |
| 88 | 84 | <?php |
| 89 | - } | |
| 90 | 85 | } |
| 91 | 86 | } |
| 92 | 87 | ?> |
| 93 | 88 | </view> |
| 94 | 89 | <?php |
| 95 | - }//end foreach | |
| 96 | -}//end while | |
| 90 | + } | |
| 91 | +} | |
| 97 | 92 | |
| 98 | 93 | if ( empty( $taxonomies ) ) { |
| 99 | 94 | return; |
| 100 | 95 | } |
| @@ -103,22 +98,17 @@ | ||
| 103 | 98 | if ( empty( $frm_inc_tax ) ) { |
| 104 | 99 | $frm_inc_tax = array(); |
| 105 | 100 | } |
| 106 | 101 | |
| 107 | -$parent_slugs = FrmXMLController::get_parent_terms_slugs( $terms ); | |
| 108 | - | |
| 109 | 102 | foreach ( (array) $terms as $term ) { |
| 110 | 103 | if ( in_array( $term->term_id, $frm_inc_tax, true ) ) { |
| 111 | - continue; | |
| 104 | + return; | |
| 112 | 105 | } |
| 113 | 106 | |
| 114 | 107 | $frm_inc_tax[] = $term->term_id; |
| 115 | - $label = 'category' === $term->taxonomy || 'tag' === $term->taxonomy ? $term->taxonomy : 'term'; | |
| 108 | + $label = ( 'category' === $term->taxonomy || 'tag' === $term->taxonomy ) ? $term->taxonomy : 'term'; | |
| 116 | 109 | ?> |
| 117 | 110 | <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 | - } | |
| 121 | 111 | if ( ! empty( $term->name ) ) { |
| 122 | 112 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 123 | 113 | } |
| 124 | 114 | if ( ! empty( $term->description ) ) { |
| @@ -125,5 +115,5 @@ | ||
| 125 | 115 | echo '<term_description>' . FrmXMLHelper::cdata( $term->description ) . '</term_description>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 126 | 116 | } |
| 127 | 117 | echo '<term_slug>' . esc_html( $term->slug ) . '</term_slug>'; |
| 128 | 118 | echo '</term>'; |
| 129 | -}//end foreach | |
| 119 | +} | |