| @@ -18,9 +18,9 @@ | ||
| 18 | 18 | global $wp_query; |
| 19 | 19 | // Fake being in the loop. |
| 20 | 20 | $wp_query->in_the_loop = true; |
| 21 | 21 | |
| 22 | -// Fetch 20 posts at a time rather than loading the entire table into memory | |
| 22 | +// fetch 20 posts at a time rather than loading the entire table into memory | |
| 23 | 23 | while ( $next_posts = array_splice( $item_ids, 0, 20 ) ) { |
| 24 | 24 | $posts = FrmDb::get_results( $wpdb->posts, array( 'ID' => $next_posts ) ); |
| 25 | 25 | |
| 26 | 26 | // Begin Loop |
| @@ -48,13 +48,12 @@ | ||
| 48 | 48 | <post_password><?php echo FrmXMLHelper::cdata( $post->post_password ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></post_password> |
| 49 | 49 | <is_sticky><?php echo esc_html( $is_sticky ); ?></is_sticky> |
| 50 | 50 | <?php if ( 'attachment' === $post->post_type ) : ?> |
| 51 | 51 | <attachment_url><?php echo esc_url( wp_get_attachment_url( $post->ID ) ); ?></attachment_url> |
| 52 | - <?php | |
| 52 | +<?php | |
| 53 | 53 | endif; |
| 54 | 54 | |
| 55 | 55 | $postmeta = FrmDb::get_results( $wpdb->postmeta, array( 'post_id' => $post->ID ) ); |
| 56 | - | |
| 57 | 56 | foreach ( $postmeta as $meta ) : |
| 58 | 57 | if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { |
| 59 | 58 | continue; |
| 60 | 59 | } |
| @@ -66,10 +65,9 @@ | ||
| 66 | 65 | <?php |
| 67 | 66 | endforeach; |
| 68 | 67 | |
| 69 | 68 | $taxonomies = get_object_taxonomies( $post->post_type ); |
| 70 | - | |
| 71 | - if ( $taxonomies ) { | |
| 69 | + if ( ! empty( $taxonomies ) ) { | |
| 72 | 70 | $terms = wp_get_object_terms( $post->ID, $taxonomies ); |
| 73 | 71 | |
| 74 | 72 | foreach ( (array) $terms as $term ) { |
| 75 | 73 | ?> |
| @@ -79,18 +77,15 @@ | ||
| 79 | 77 | } |
| 80 | 78 | |
| 81 | 79 | if ( 'frm_display' === $post->post_type && is_callable( 'FrmViewsLayout::get_layouts_for_view' ) ) { |
| 82 | 80 | $layouts = FrmViewsLayout::get_layouts_for_view( $post->ID ); |
| 83 | - | |
| 84 | - if ( is_array( $layouts ) ) { | |
| 85 | - foreach ( $layouts as $layout ) { | |
| 86 | - ?> | |
| 81 | + foreach ( $layouts as $layout ) { | |
| 82 | + ?> | |
| 87 | 83 | <layout> |
| 88 | 84 | <type><?php echo esc_html( $layout->type ); ?></type> |
| 89 | 85 | <data><?php echo FrmXMLHelper::cdata( $layout->data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></data> |
| 90 | 86 | </layout> |
| 91 | 87 | <?php |
| 92 | - } | |
| 93 | 88 | } |
| 94 | 89 | } |
| 95 | 90 | ?> |
| 96 | 91 | </view> |
| @@ -102,33 +97,26 @@ | ||
| 102 | 97 | return; |
| 103 | 98 | } |
| 104 | 99 | |
| 105 | 100 | global $frm_inc_tax; |
| 106 | - | |
| 107 | -if ( ! $frm_inc_tax ) { | |
| 101 | +if ( empty( $frm_inc_tax ) ) { | |
| 108 | 102 | $frm_inc_tax = array(); |
| 109 | 103 | } |
| 110 | 104 | |
| 111 | -$parent_slugs = FrmXMLController::get_parent_terms_slugs( $terms ); | |
| 112 | - | |
| 113 | 105 | foreach ( (array) $terms as $term ) { |
| 114 | 106 | if ( in_array( $term->term_id, $frm_inc_tax, true ) ) { |
| 115 | - continue; | |
| 107 | + return; | |
| 116 | 108 | } |
| 117 | 109 | |
| 118 | 110 | $frm_inc_tax[] = $term->term_id; |
| 111 | + $label = ( 'category' === $term->taxonomy || 'tag' === $term->taxonomy ) ? $term->taxonomy : 'term'; | |
| 119 | 112 | ?> |
| 120 | 113 | <term><term_id><?php echo esc_html( $term->term_id ); ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
| 121 | - if ( ! empty( $parent_slugs[ $term->parent ] ) ) { | |
| 122 | - echo '<term_parent>' . esc_html( $parent_slugs[ $term->parent ] ) . '</term_parent>'; | |
| 123 | - } | |
| 124 | - | |
| 125 | 114 | if ( ! empty( $term->name ) ) { |
| 126 | 115 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 127 | 116 | } |
| 128 | - | |
| 129 | 117 | if ( ! empty( $term->description ) ) { |
| 130 | 118 | echo '<term_description>' . FrmXMLHelper::cdata( $term->description ) . '</term_description>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 131 | 119 | } |
| 132 | 120 | echo '<term_slug>' . esc_html( $term->slug ) . '</term_slug>'; |
| 133 | 121 | echo '</term>'; |
| 134 | -}//end foreach | |
| 122 | +} | |