Skip to content

Commit

Permalink
Add the file and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed May 10, 2024
1 parent d530c35 commit cb78c2a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
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

View workflow job for this annotation

GitHub Actions / PHP coding standards

Class file names should be based on the class name with "class-" prepended. Expected class-wp-rest-edit-site-export-controller-6-6.php, but found 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 {

Check failure on line 18 in lib/compat/wordpress-6.6/class-gutenberg-rest-edit-site-export-controller-6-6.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

The "WP_REST_Edit_Site_Export_Controller_6_6" class should be guarded against redeclaration.
/**
* 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;
}
}
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.6/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function gutenberg_add_class_list_to_public_post_types() {
add_action( 'rest_api_init', 'gutenberg_add_class_list_to_public_post_types' );

/**
* Registers the Global Styles Revisions REST API routes.
* Registers the Edit Site Export REST API routes.
*/
function gutenberg_register_edit_site_export_controller_endpoints() {
$edit_site_export_controller = new WP_REST_Edit_Site_Export_Controller_6_6();

Check failure on line 84 in lib/compat/wordpress-6.6/rest-api.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Tabs must be used to indent lines; spaces are not allowed
Expand Down
4 changes: 2 additions & 2 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function gutenberg_is_experiment_enabled( $name ) {
require_once __DIR__ . '/compat/wordpress-6.5/class-gutenberg-rest-global-styles-revisions-controller-6-5.php';
require_once __DIR__ . '/compat/wordpress-6.5/rest-api.php';

// WordPress 6.6 compat.
require_once __DIR__ . '/compat/wordpress-6.6/class-gutenberg-rest-edit-site-export-controller-6-6.php';
// WordPress 6.6 compat.
require_once __DIR__ . '/compat/wordpress-6.6/class-gutenberg-rest-edit-site-export-controller-6-6.php';

// Plugin specific code.
require_once __DIR__ . '/class-wp-rest-global-styles-controller-gutenberg.php';
Expand Down

0 comments on commit cb78c2a

Please sign in to comment.