| @@ -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 |
| @@ -52,9 +52,8 @@ | ||
| 52 | 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,9 +77,8 @@ | ||
| 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 | 81 | if ( is_array( $layouts ) ) { |
| 85 | 82 | foreach ( $layouts as $layout ) { |
| 86 | 83 | ?> |
| 87 | 84 | <layout> |
| @@ -102,10 +99,9 @@ | ||
| 102 | 99 | return; |
| 103 | 100 | } |
| 104 | 101 | |
| 105 | 102 | global $frm_inc_tax; |
| 106 | - | |
| 107 | -if ( ! $frm_inc_tax ) { | |
| 103 | +if ( empty( $frm_inc_tax ) ) { | |
| 108 | 104 | $frm_inc_tax = array(); |
| 109 | 105 | } |
| 110 | 106 | |
| 111 | 107 | $parent_slugs = FrmXMLController::get_parent_terms_slugs( $terms ); |
| @@ -115,18 +111,17 @@ | ||
| 115 | 111 | continue; |
| 116 | 112 | } |
| 117 | 113 | |
| 118 | 114 | $frm_inc_tax[] = $term->term_id; |
| 115 | + $label = 'category' === $term->taxonomy || 'tag' === $term->taxonomy ? $term->taxonomy : 'term'; | |
| 119 | 116 | ?> |
| 120 | 117 | <term><term_id><?php echo esc_html( $term->term_id ); ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
| 121 | 118 | if ( ! empty( $parent_slugs[ $term->parent ] ) ) { |
| 122 | 119 | echo '<term_parent>' . esc_html( $parent_slugs[ $term->parent ] ) . '</term_parent>'; |
| 123 | 120 | } |
| 124 | - | |
| 125 | 121 | if ( ! empty( $term->name ) ) { |
| 126 | 122 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 127 | 123 | } |
| 128 | - | |
| 129 | 124 | if ( ! empty( $term->description ) ) { |
| 130 | 125 | echo '<term_description>' . FrmXMLHelper::cdata( $term->description ) . '</term_description>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 131 | 126 | } |
| 132 | 127 | echo '<term_slug>' . esc_html( $term->slug ) . '</term_slug>'; |