PluginProbe
Gutenberg / 23.2.0
Gutenberg v23.2.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
gutenberg / lib / class-wp-rest-edit-site-export-controller-gutenberg.php
lib
block-supports 4 months ago compat 3 months ago experimental 3 months ago media 3 months ago README.md 10.0 KB 7 months ago block-editor-settings.php 5.4 KB 7 months ago block-template-utils.php 3.5 KB 1 year ago blocks.php 11.8 KB 7 months ago class-wp-duotone-gutenberg.php 37.6 KB 5 months ago class-wp-icons-registry-gutenberg.php 7.1 KB 4 months ago class-wp-rest-edit-site-export-controller-gutenberg.php 1.2 KB 2 years ago class-wp-rest-global-styles-controller-gutenberg.php 24.5 KB 7 months ago class-wp-rest-icons-controller-gutenberg.php 481 B 4 months ago class-wp-theme-json-data-gutenberg.php 1.7 KB 2 years ago class-wp-theme-json-gutenberg.php 196.1 KB 3 months ago class-wp-theme-json-resolver-gutenberg.php 34.7 KB 6 months ago class-wp-theme-json-schema-gutenberg.php 7.4 KB 7 months ago client-assets.php 16.4 KB 4 months ago demo.php 1.6 KB 1 year ago global-styles-and-settings.php 14.2 KB 7 months ago init.php 945 B 4 months ago interactivity-api.php 1.2 KB 7 months ago load.php 10.9 KB 3 months ago mathml-kses.php 6.3 KB 10 months ago overlay-patterns.php 12.2 KB 6 months ago remove-core-enqueue-scripts.php 779 B 5 months ago rest-api.php 1.6 KB 4 months ago script-loader.php 5.9 KB 5 months ago theme-i18n.json 1.8 KB 7 months ago theme.json 9.2 KB 5 months ago upgrade.php 2.6 KB 5 months ago

class-wp-rest-edit-site-export-controller-gutenberg.php in Gutenberg 23.2.0, at lib/class-wp-rest-edit-site-export-controller-gutenberg.php

47 lines 1.2 KB Raw Download Zip
1 <?php
2 /**
3 * Controller which provides REST endpoint for exporting current templates
4 * and template parts.
5 *
6 * This class extension exists so that theme exporting takes into account any updates/changes to
7 * WP_Theme_JSON_Gutenberg, WP_Theme_JSON_Resolver_Gutenberg or related classes.
8 *
9 * @package gutenberg
10 * @subpackage REST_API
11 * @since 5.9.0
12 */
13
14 if ( class_exists( 'WP_REST_Edit_Site_Export_Controller_Gutenberg' ) ) {
15 return;
16 }
17
18 class WP_REST_Edit_Site_Export_Controller_Gutenberg extends WP_REST_Edit_Site_Export_Controller {
19 /**
20 * Output a ZIP file with an export of the current templates
21 * and template parts from the site editor, and close the connection.
22 *
23 * @since 5.9.0
24 *
25 * @return WP_Error|void
26 */
27 public function export() {
28 // Generate the export file.
29 $filename = gutenberg_generate_block_templates_export_file();
30
31 if ( is_wp_error( $filename ) ) {
32 $filename->add_data( array( 'status' => 500 ) );
33
34 return $filename;
35 }
36
37 $theme_name = basename( get_stylesheet() );
38 header( 'Content-Type: application/zip' );
39 header( 'Content-Disposition: attachment; filename=' . $theme_name . '.zip' );
40 header( 'Content-Length: ' . filesize( $filename ) );
41 flush();
42 readfile( $filename );
43 unlink( $filename );
44 exit;
45 }
46 }
47