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.1 2.6.3.2 2.7.0.5 2.7.1.1 2.7.2 2.7.2.1 2.7.3 2.7.3.1 2.7.3.2 2.7.4.1 2.7.4.2 2.7.4.3 2.7.4.4 2.7.4.5 2.8.0.4 2.8.0.5 2.8.0.7 2.8.1.1 2.8.1.2 2.8.1.3 2.8.2.2 2.8.3.1 2.8.3.2 2.8.3.4 2.8.3.5 2.8.3.6 2.8.3.7 2.8.3.9 2.8.4.1 2.8.4.2 2.8.4.3 2.8.4.4 2.8.5.3
beaver-builder-lite-version / includes / export.php
beaver-builder-lite-version / includes Last commit date
updater 9 years ago vendor 9 years ago admin-posts.php 9 years ago admin-settings-cache.php 9 years ago admin-settings-editing.php 9 years ago admin-settings-js-config.php 9 years ago admin-settings-modules.php 9 years ago admin-settings-post-types.php 9 years ago admin-settings-uninstall.php 9 years ago admin-settings-upgrade.php 9 years ago admin-settings-welcome.php 9 years ago admin-settings.php 9 years ago column-css.php 9 years ago column-group.php 9 years ago column-settings.php 9 years ago column.php 9 years ago compatibility.php 9 years ago export-filters.php 9 years ago export.php 9 years ago field-button.php 9 years ago field-code.php 9 years ago field-color.php 9 years ago field-editor.php 9 years ago field-font.php 9 years ago field-form.php 9 years ago field-icon.php 9 years ago field-layout.php 9 years ago field-link.php 9 years ago field-multiple-audios.php 9 years ago field-multiple-photos.php 9 years ago field-photo-sizes.php 9 years ago field-photo.php 9 years ago field-post-type.php 9 years ago field-select.php 9 years ago field-suggest.php 9 years ago field-text.php 9 years ago field-textarea.php 9 years ago field-time.php 9 years ago field-timezone.php 9 years ago field-video.php 9 years ago field.php 9 years ago global-settings.php 9 years ago icon-selector.php 9 years ago jquery.php 9 years ago layout-js-config.php 9 years ago layout-settings.php 9 years ago loop-settings.php 9 years ago module-settings.php 9 years ago module.php 9 years ago row-css.php 9 years ago row-js.php 9 years ago row-settings.php 9 years ago row-video.php 9 years ago row.php 9 years ago service-settings.php 9 years ago settings.php 9 years ago strings.php 9 years ago template-selector.php 9 years ago ui-bar.php 9 years ago ui-fields.php 9 years ago ui-js-config.php 9 years ago ui-js-templates.php 9 years ago ui-panel-module-templates.php 9 years ago ui-panel-row-templates.php 9 years ago ui-panel.php 9 years ago updater-config.php 9 years ago
export.php
439 lines
1 <?php
2 /**
3 * Modified version of the WordPress Export Administration API
4 * that lets us export single posts and selected groups of posts.
5 *
6 * @package WordPress
7 * @subpackage Administration
8 */
9
10 /**
11 * Generates the WXR export file for download.
12 *
13 * @since 2.1.0
14 *
15 * @global wpdb $wpdb
16 * @global WP_Post $post
17 *
18 * @param array $post_ids
19 */
20 function fl_export_wp( $post_ids = array() ) {
21 global $wpdb, $post;
22
23 if ( empty( $post_ids ) ) {
24 return;
25 }
26
27 $sitename = sanitize_key( get_bloginfo( 'name' ) );
28 if ( ! empty( $sitename ) ) {
29 $sitename .= '.';
30 }
31 $date = date( 'Y-m-d' );
32 $wp_filename = $sitename . 'wordpress.' . $date . '.xml';
33 /**
34 * Filter the export filename.
35 *
36 * @since 4.4.0
37 *
38 * @param string $wp_filename The name of the file for download.
39 * @param string $sitename The site name.
40 * @param string $date Today's date, formatted.
41 */
42 $filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date );
43
44 header( 'Content-Description: File Transfer' );
45 header( 'Content-Disposition: attachment; filename=' . $filename );
46 header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
47
48 /**
49 * Wrap given string in XML CDATA tag.
50 *
51 * @since 2.1.0
52 *
53 * @param string $str String to wrap in XML CDATA tag.
54 * @return string
55 */
56 function wxr_cdata( $str ) {
57 if ( ! seems_utf8( $str ) ) {
58 $str = utf8_encode( $str );
59 }
60 // $str = ent2ncr(esc_html($str));
61 $str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
62
63 return $str;
64 }
65
66 /**
67 * Return the URL of the site
68 *
69 * @since 2.5.0
70 *
71 * @return string Site URL.
72 */
73 function wxr_site_url() {
74 // Multisite: the base URL.
75 if ( is_multisite() )
76 return network_home_url();
77 // WordPress (single site): the blog URL.
78 else
79 return get_bloginfo_rss( 'url' );
80 }
81
82 /**
83 * Output a cat_name XML tag from a given category object
84 *
85 * @since 2.1.0
86 *
87 * @param object $category Category Object
88 */
89 function wxr_cat_name( $category ) {
90 if ( empty( $category->name ) )
91 return;
92
93 echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>';
94 }
95
96 /**
97 * Output a category_description XML tag from a given category object
98 *
99 * @since 2.1.0
100 *
101 * @param object $category Category Object
102 */
103 function wxr_category_description( $category ) {
104 if ( empty( $category->description ) )
105 return;
106
107 echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';
108 }
109
110 /**
111 * Output a tag_name XML tag from a given tag object
112 *
113 * @since 2.3.0
114 *
115 * @param object $tag Tag Object
116 */
117 function wxr_tag_name( $tag ) {
118 if ( empty( $tag->name ) )
119 return;
120
121 echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>';
122 }
123
124 /**
125 * Output a tag_description XML tag from a given tag object
126 *
127 * @since 2.3.0
128 *
129 * @param object $tag Tag Object
130 */
131 function wxr_tag_description( $tag ) {
132 if ( empty( $tag->description ) )
133 return;
134
135 echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';
136 }
137
138 /**
139 * Output a term_name XML tag from a given term object
140 *
141 * @since 2.9.0
142 *
143 * @param object $term Term Object
144 */
145 function wxr_term_name( $term ) {
146 if ( empty( $term->name ) )
147 return;
148
149 echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';
150 }
151
152 /**
153 * Output a term_description XML tag from a given term object
154 *
155 * @since 2.9.0
156 *
157 * @param object $term Term Object
158 */
159 function wxr_term_description( $term ) {
160 if ( empty( $term->description ) )
161 return;
162
163 echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
164 }
165
166 /**
167 * Output list of authors with posts
168 *
169 * @since 3.1.0
170 *
171 * @global wpdb $wpdb WordPress database abstraction object.
172 *
173 * @param array $post_ids Array of post IDs to filter the query by. Optional.
174 */
175 function wxr_authors_list( array $post_ids = null ) {
176 global $wpdb;
177
178 if ( !empty( $post_ids ) ) {
179 $post_ids = array_map( 'absint', $post_ids );
180 $and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
181 } else {
182 $and = '';
183 }
184
185 $authors = array();
186 $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
187 foreach ( (array) $results as $result )
188 $authors[] = get_userdata( $result->post_author );
189
190 $authors = array_filter( $authors );
191
192 foreach ( $authors as $author ) {
193 echo "\t<wp:author>";
194 echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>';
195 echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>';
196 echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>';
197 echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
198 echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>';
199 echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>';
200 echo "</wp:author>\n";
201 }
202 }
203
204 /**
205 * Ouput all navigation menu terms
206 *
207 * @since 3.1.0
208 */
209 function wxr_nav_menu_terms() {
210 $nav_menus = wp_get_nav_menus();
211 if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
212 return;
213
214 foreach ( $nav_menus as $menu ) {
215 echo "\t<wp:term>";
216 echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>';
217 echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
218 echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
219 wxr_term_name( $menu );
220 echo "</wp:term>\n";
221 }
222 }
223
224 /**
225 * Output list of taxonomy terms, in XML tag format, associated with a post
226 *
227 * @since 2.3.0
228 */
229 function wxr_post_taxonomy() {
230 $post = get_post();
231
232 $taxonomies = get_object_taxonomies( $post->post_type );
233 if ( empty( $taxonomies ) )
234 return;
235 $terms = wp_get_object_terms( $post->ID, $taxonomies );
236
237 foreach ( (array) $terms as $term ) {
238 echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
239 }
240 }
241
242 /**
243 *
244 * @param bool $return_me
245 * @param string $meta_key
246 * @return bool
247 */
248 function wxr_filter_postmeta( $return_me, $meta_key ) {
249 if ( '_edit_lock' == $meta_key )
250 $return_me = true;
251 return $return_me;
252 }
253 add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
254
255 echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n";
256
257 ?>
258 <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
259 <!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
260 <!-- You may use this file to transfer that content from one site to another. -->
261 <!-- This file is not intended to serve as a complete backup of your site. -->
262
263 <!-- To import this information into a WordPress site follow these steps: -->
264 <!-- 1. Log in to that site as an administrator. -->
265 <!-- 2. Go to Tools: Import in the WordPress admin panel. -->
266 <!-- 3. Install the "WordPress" importer from the list. -->
267 <!-- 4. Activate & Run Importer. -->
268 <!-- 5. Upload this file using the form provided on that page. -->
269 <!-- 6. You will first be asked to map the authors in this export file to users -->
270 <!-- on the site. For each author, you may choose to map to an -->
271 <!-- existing user on the site or to create a new user. -->
272 <!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
273 <!-- contained in this file into your site. -->
274
275 <?php the_generator( 'export' ); ?>
276 <rss version="2.0"
277 xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
278 xmlns:content="http://purl.org/rss/1.0/modules/content/"
279 xmlns:wfw="http://wellformedweb.org/CommentAPI/"
280 xmlns:dc="http://purl.org/dc/elements/1.1/"
281 xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
282 >
283
284 <channel>
285 <title><?php bloginfo_rss( 'name' ); ?></title>
286 <link><?php bloginfo_rss( 'url' ); ?></link>
287 <description><?php bloginfo_rss( 'description' ); ?></description>
288 <pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
289 <language><?php bloginfo_rss( 'language' ); ?></language>
290 <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
291 <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
292 <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
293
294 <?php wxr_authors_list( $post_ids ); ?>
295
296 <?php
297 /** This action is documented in wp-includes/feed-rss2.php */
298 do_action( 'rss2_head' );
299 ?>
300
301 <?php if ( $post_ids ) {
302 /**
303 * @global WP_Query $wp_query
304 */
305 global $wp_query;
306
307 // Fake being in the loop.
308 $wp_query->in_the_loop = true;
309
310 // Fetch 20 posts at a time rather than loading the entire table into memory.
311 while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
312 $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
313 $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
314
315 // Begin Loop.
316 foreach ( $posts as $post ) {
317 setup_postdata( $post );
318 $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
319 ?>
320 <item>
321 <title><?php
322 /** This filter is documented in wp-includes/feed.php */
323 echo apply_filters( 'the_title_rss', $post->post_title );
324 ?></title>
325 <link><?php the_permalink_rss() ?></link>
326 <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
327 <dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator>
328 <guid isPermaLink="false"><?php the_guid(); ?></guid>
329 <description></description>
330 <content:encoded><?php
331 /**
332 * Filter the post content used for WXR exports.
333 *
334 * @since 2.5.0
335 *
336 * @param string $post_content Content of the current post.
337 */
338 echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
339 ?></content:encoded>
340 <excerpt:encoded><?php
341 /**
342 * Filter the post excerpt used for WXR exports.
343 *
344 * @since 2.6.0
345 *
346 * @param string $post_excerpt Excerpt for the current post.
347 */
348 echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
349 ?></excerpt:encoded>
350 <wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id>
351 <wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date>
352 <wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt>
353 <wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status>
354 <wp:ping_status><?php echo wxr_cdata( $post->ping_status ); ?></wp:ping_status>
355 <wp:post_name><?php echo wxr_cdata( $post->post_name ); ?></wp:post_name>
356 <wp:status><?php echo wxr_cdata( $post->post_status ); ?></wp:status>
357 <wp:post_parent><?php echo intval( $post->post_parent ); ?></wp:post_parent>
358 <wp:menu_order><?php echo intval( $post->menu_order ); ?></wp:menu_order>
359 <wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type>
360 <wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password>
361 <wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky>
362 <?php if ( $post->post_type == 'attachment' ) : ?>
363 <wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url>
364 <?php endif; ?>
365 <?php wxr_post_taxonomy(); ?>
366 <?php $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
367 foreach ( $postmeta as $meta ) :
368 /**
369 * Filter whether to selectively skip post meta used for WXR exports.
370 *
371 * Returning a truthy value to the filter will skip the current meta
372 * object from being exported.
373 *
374 * @since 3.3.0
375 *
376 * @param bool $skip Whether to skip the current post meta. Default false.
377 * @param string $meta_key Current meta key.
378 * @param object $meta Current meta object.
379 */
380 if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) )
381 continue;
382 ?>
383 <wp:postmeta>
384 <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
385 <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
386 </wp:postmeta>
387 <?php endforeach;
388
389 $_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
390 $comments = array_map( 'get_comment', $_comments );
391 foreach ( $comments as $c ) : ?>
392 <wp:comment>
393 <wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id>
394 <wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
395 <wp:comment_author_email><?php echo wxr_cdata( $c->comment_author_email ); ?></wp:comment_author_email>
396 <wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url>
397 <wp:comment_author_IP><?php echo wxr_cdata( $c->comment_author_IP ); ?></wp:comment_author_IP>
398 <wp:comment_date><?php echo wxr_cdata( $c->comment_date ); ?></wp:comment_date>
399 <wp:comment_date_gmt><?php echo wxr_cdata( $c->comment_date_gmt ); ?></wp:comment_date_gmt>
400 <wp:comment_content><?php echo wxr_cdata( $c->comment_content ) ?></wp:comment_content>
401 <wp:comment_approved><?php echo wxr_cdata( $c->comment_approved ); ?></wp:comment_approved>
402 <wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type>
403 <wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent>
404 <wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id>
405 <?php $c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
406 foreach ( $c_meta as $meta ) :
407 /**
408 * Filter whether to selectively skip comment meta used for WXR exports.
409 *
410 * Returning a truthy value to the filter will skip the current meta
411 * object from being exported.
412 *
413 * @since 4.0.0
414 *
415 * @param bool $skip Whether to skip the current comment meta. Default false.
416 * @param string $meta_key Current meta key.
417 * @param object $meta Current meta object.
418 */
419 if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
420 continue;
421 }
422 ?>
423 <wp:commentmeta>
424 <wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
425 <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
426 </wp:commentmeta>
427 <?php endforeach; ?>
428 </wp:comment>
429 <?php endforeach; ?>
430 </item>
431 <?php
432 }
433 }
434 } ?>
435 </channel>
436 </rss>
437 <?php
438 }
439