Skip to content

Commit

Permalink
remove unintended space around periods
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente Canales committed Jul 21, 2023
1 parent 742c7e7 commit 6e30a22
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions includes/class-create-block-theme-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function rest_get_readme_data( $request ) {
return new WP_REST_Response(
array(
'status' => 'SUCCESS',
'message' => __( 'Readme file data retrieved . ', 'create-block-theme' ),
'message' => __( 'Readme file data retrieved.', 'create-block-theme' ),
'data' => $readme_data,
)
);
Expand Down Expand Up @@ -169,7 +169,7 @@ function rest_clone_theme( $request ) {
}

if ( file_exists( $new_theme_path ) ) {
return new \WP_Error( 'theme_exists', __( 'Theme already exists . ', 'create-block-theme' ) );
return new \WP_Error( 'theme_exists', __( 'Theme already exists.', 'create-block-theme' ) );
}

wp_mkdir_p( $new_theme_path );
Expand All @@ -178,18 +178,18 @@ function rest_clone_theme( $request ) {
Theme_Utils::clone_theme_to_folder( $new_theme_path, $theme['slug'], $theme['name'] );
Theme_Utils::add_templates_to_folder( $new_theme_path, 'all', $theme['slug'] );

file_put_contents( $new_theme_path . DIRECTORY_SEPARATOR . 'theme . json', MY_Theme_JSON_Resolver::export_theme_data( 'all' ) );
file_put_contents( $new_theme_path . DIRECTORY_SEPARATOR . 'theme.json', MY_Theme_JSON_Resolver::export_theme_data( 'all' ) );

if ( $theme['subfolder'] ) {
switch_theme( $theme['subfolder'] . ' / ' . $theme_slug );
switch_theme( $theme['subfolder'] . '/' . $theme_slug );
} else {
switch_theme( $theme_slug );
}

return new WP_REST_Response(
array(
'status' => 'SUCCESS',
'message' => __( 'Cloned Theme Created . ', 'create-block-theme' ),
'message' => __( 'Cloned Theme Created.', 'create-block-theme' ),
)
);
}
Expand All @@ -215,18 +215,18 @@ function rest_create_blank_theme( $request ) {
$theme['text_domain'] = $theme_slug;

// Create theme directory.
$source = plugin_dir_path( __DIR__ ) . 'assets / boilerplate';
$source = plugin_dir_path( __DIR__ ) . 'assets/boilerplate';
$blank_theme_path = get_theme_root() . DIRECTORY_SEPARATOR . $theme['subfolder'] . DIRECTORY_SEPARATOR . $theme['slug'];

if ( file_exists( $blank_theme_path ) ) {
return new \WP_Error( 'theme_exists', __( 'Theme already exists . ', 'create-block-theme' ) );
return new \WP_Error( 'theme_exists', __( 'Theme already exists.', 'create-block-theme' ) );
}

wp_mkdir_p( $blank_theme_path );

// Add readme.txt.
file_put_contents(
$blank_theme_path . DIRECTORY_SEPARATOR . 'readme . txt',
$blank_theme_path . DIRECTORY_SEPARATOR . 'readme.txt',
Theme_Readme::build_readme_txt( $theme )
);

Expand All @@ -235,7 +235,7 @@ function rest_create_blank_theme( $request ) {

// Add style.css.
file_put_contents(
$blank_theme_path . DIRECTORY_SEPARATOR . 'style . css',
$blank_theme_path . DIRECTORY_SEPARATOR . 'style.css',
$css_contents
);

Expand All @@ -257,31 +257,31 @@ function rest_create_blank_theme( $request ) {
// Overwrite default screenshot if one is provided.
if ( $this->is_valid_screenshot( $screenshot ) ) {
file_put_contents(
$blank_theme_path . DIRECTORY_SEPARATOR . 'screenshot . png',
$blank_theme_path . DIRECTORY_SEPARATOR . 'screenshot.png',
file_get_contents( $screenshot['tmp_name'] )
);
}

if ( ! defined( 'IS_GUTENBERG_PLUGIN' ) ) {
global $wp_version;
$theme_json_version = 'wp / ' . substr( $wp_version, 0, 3 );
$theme_json_version = 'wp/' . substr( $wp_version, 0, 3 );
$schema = '"$schema": "https://schemas.wp.org/' . $theme_json_version . '/theme.json"';
$theme_json_path = $blank_theme_path . DIRECTORY_SEPARATOR . 'theme . json';
$theme_json_path = $blank_theme_path . DIRECTORY_SEPARATOR . 'theme.json';
$theme_json_string = file_get_contents( $theme_json_path );
$theme_json_string = str_replace( '"$schema": "https://schemas.wp.org/trunk/theme.json"', $schema, $theme_json_string );
file_put_contents( $theme_json_path, $theme_json_string );
}

if ( $theme['subfolder'] ) {
switch_theme( $theme['subfolder'] . ' / ' . $theme_slug );
switch_theme( $theme['subfolder'] . '/' . $theme_slug );
} else {
switch_theme( $theme_slug );
}

return new WP_REST_Response(
array(
'status' => 'SUCCESS',
'message' => __( 'Blank Theme Created . ', 'create-block-theme' ),
'message' => __( 'Blank Theme Created.', 'create-block-theme' ),
)
);
}
Expand Down Expand Up @@ -332,7 +332,7 @@ function rest_export_cloned_theme( $request ) {
$css_contents
);

// Add / replace screenshot.
// Add/replace screenshot.
if ( $this->is_valid_screenshot( $screenshot ) ) {
$zip->addFileToTheme(
$screenshot['tmp_name'],
Expand Down

0 comments on commit 6e30a22

Please sign in to comment.