-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
lib/compat/wordpress-6.6/class-gutenberg-rest-edit-site-export-controller-6-6.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
Check failure on line 1 in lib/compat/wordpress-6.6/class-gutenberg-rest-edit-site-export-controller-6-6.php
|
||
/** | ||
* REST API: WP_REST_Edit_Site_Export_Controller class | ||
* | ||
* @package WordPress | ||
* @subpackage REST_API | ||
*/ | ||
|
||
/** | ||
* Controller which provides REST endpoint for exporting current templates | ||
* and template parts. | ||
* | ||
* @since 5.9.0 | ||
* | ||
* @see WP_REST_Controller | ||
*/ | ||
|
||
class WP_REST_Edit_Site_Export_Controller_6_6 extends WP_REST_Edit_Site_Export_Controller { | ||
/** | ||
* Output a ZIP file with an export of the current templates | ||
* and template parts from the site editor, and close the connection. | ||
* | ||
* @since 5.9.0 | ||
* | ||
* @return WP_Error|void | ||
*/ | ||
public function export() { | ||
// Generate the export file. | ||
$filename = gutenberg_generate_block_templates_export_file(); | ||
|
||
if ( is_wp_error( $filename ) ) { | ||
$filename->add_data( array( 'status' => 500 ) ); | ||
|
||
return $filename; | ||
} | ||
|
||
$theme_name = basename( get_stylesheet() ); | ||
header( 'Content-Type: application/zip' ); | ||
header( 'Content-Disposition: attachment; filename=' . $theme_name . '.zip' ); | ||
header( 'Content-Length: ' . filesize( $filename ) ); | ||
flush(); | ||
readfile( $filename ); | ||
unlink( $filename ); | ||
exit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters