diff --git a/composer.json b/composer.json index 2972c5ad..1e63394d 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "squizlabs/php_codesniffer": "^3.5", "phpcompatibility/phpcompatibility-wp": "^2.1.3", - "wp-coding-standards/wpcs": "^2.2", + "wp-coding-standards/wpcs": "^3.4.1", "sirbrillig/phpcs-variable-analysis": "^2.8", "spatie/phpunit-watcher": "^1.23", "yoast/phpunit-polyfills": "^1.1", diff --git a/composer.lock b/composer.lock index 314cb2e3..2b0f5f3b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6211bed84f4e47c48ae516f63e6b867b", + "content-hash": "f09dcbd16b771d0abe13d8b1477d0c8d", "packages": [ { "name": "composer/installers", @@ -1065,6 +1065,181 @@ ], "time": "2024-04-24T21:37:59+00:00" }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "39467533fdb742446d68c1d10ac33d625ee0311c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/39467533fdb742446d68c1d10ac33d625ee0311c", + "reference": "39467533fdb742446d68c1d10ac33d625ee0311c", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.2.3", + "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.2.0", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-07-27T11:13:17+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "5f35d9408c54d7b529501f3c688b6eae562aea1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/5f35d9408c54d7b529501f3c688b6eae562aea1f", + "reference": "5f35d9408c54d7b529501f3c688b6eae562aea1f", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.2.0", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "phpcs4", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-07-27T10:28:41+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.32", @@ -2810,16 +2985,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.13.5", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4", + "reference": "0ca86845ce43291e8f5692c7356fccf3bcf02bf4", "shasum": "" }, "require": { @@ -2836,11 +3011,6 @@ "bin/phpcs" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -2884,9 +3054,13 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2025-11-04T16:30:35+00:00" }, { "name": "symfony/console", @@ -3949,30 +4123,38 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.4.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "ec2ff942335f33683a5957a85d138753876a05cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/ec2ff942335f33683a5957a85d138753876a05cf", + "reference": "ec2ff942335f33683a5957a85d138753876a05cf", "shasum": "" }, "require": { - "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", + "php": ">=7.2", + "phpcsstandards/phpcsextra": "^1.5.1", + "phpcsstandards/phpcsutils": "^1.2.3", + "squizlabs/php_codesniffer": "^3.13.5" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", - "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -3989,6 +4171,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -3996,7 +4179,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2026-07-27T11:53:23+00:00" }, { "name": "yoast/phpunit-polyfills", @@ -4121,13 +4310,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.9.0" } diff --git a/create-block-theme.php b/create-block-theme.php index 6d604aef..d634625e 100644 --- a/create-block-theme.php +++ b/create-block-theme.php @@ -41,6 +41,5 @@ function cbt_run_create_block_theme() { $plugin = new CBT_Plugin(); $plugin->run(); - } cbt_run_create_block_theme(); diff --git a/includes/class-create-block-theme-admin-landing.php b/includes/class-create-block-theme-admin-landing.php index 6e467762..97673402 100644 --- a/includes/class-create-block-theme-admin-landing.php +++ b/includes/class-create-block-theme-admin-landing.php @@ -13,7 +13,7 @@ public function __construct() { add_action( 'admin_menu', array( $this, 'create_admin_menu' ) ); } - function create_admin_menu() { + public function create_admin_menu() { if ( ! wp_is_block_theme() ) { return; } @@ -31,7 +31,6 @@ function create_admin_menu() { $landing_page_title = _x( 'Create Block Theme', 'UI String', 'create-block-theme' ); $landing_page_menu_title = $landing_page_title; add_theme_page( $landing_page_title, $landing_page_menu_title, 'edit_themes', $landing_page_slug, array( 'CBT_Admin_Landing', 'admin_menu_page' ) ); - } public static function admin_menu_page() { diff --git a/includes/class-create-block-theme-api.php b/includes/class-create-block-theme-api.php index b906e778..f2f6bff9 100644 --- a/includes/class-create-block-theme-api.php +++ b/includes/class-create-block-theme-api.php @@ -159,7 +159,7 @@ public function register_rest_routes() { * @param WP_Theme $theme The theme object. * @return WP_REST_Response Modified response object. */ - function add_additional_data_to_theme_response( $response, $theme ) { + public function add_additional_data_to_theme_response( $response, $theme ) { if ( ! $theme || ! $response ) { return $response; } @@ -195,7 +195,7 @@ function add_additional_data_to_theme_response( $response, $theme ) { return $response; } - function rest_clone_theme( $request ) { + public function rest_clone_theme( $request ) { $response = CBT_Theme_Create::clone_current_theme( $this->sanitize_theme_data( $request->get_params() ) ); @@ -213,7 +213,7 @@ function rest_clone_theme( $request ) { ); } - function rest_create_child_theme( $request ) { + public function rest_create_child_theme( $request ) { $theme = $this->sanitize_theme_data( $request->get_params() ); $theme['is_child_theme'] = true; @@ -236,7 +236,7 @@ function rest_create_child_theme( $request ) { ); } - function rest_create_variation( $request ) { + public function rest_create_variation( $request ) { $options = $request->get_params(); $save_fonts = isset( $options['saveFonts'] ) && true === $options['saveFonts']; @@ -261,7 +261,7 @@ function rest_create_variation( $request ) { ); } - function rest_create_blank_theme( $request ) { + public function rest_create_blank_theme( $request ) { $theme = $this->sanitize_theme_data( $request->get_params() ); //TODO: Handle screenshots @@ -286,7 +286,7 @@ function rest_create_blank_theme( $request ) { /** * Export the theme as a ZIP file. */ - function rest_export_theme() { + public function rest_export_theme() { if ( ! class_exists( 'ZipArchive' ) ) { return new WP_Error( 'missing_zip_package', @@ -330,7 +330,7 @@ function rest_export_theme() { /** * Update the theme metadata and relocate the theme. */ - function rest_update_theme( $request ) { + public function rest_update_theme( $request ) { $theme = $this->sanitize_theme_data( $request->get_params() ); // Update the metadata of the theme in the style.css file @@ -361,7 +361,7 @@ function rest_update_theme( $request ) { /** * Save the user changes to the theme and clear user changes. */ - function rest_save_theme( $request ) { + public function rest_save_theme( $request ) { $options = $request->get_params(); @@ -417,7 +417,7 @@ function rest_save_theme( $request ) { * `removedShadowDefaults`. Only keys present in the payload are written; * missing keys leave the existing theme.json untouched. */ - function rest_save_theme_settings( $request ) { + public function rest_save_theme_settings( $request ) { // `get_json_params()` returns null (or a scalar) for empty or // non-object request bodies. The service signature requires an array, // so guard here and return a 400 rather than letting the type hint @@ -451,7 +451,7 @@ function rest_save_theme_settings( $request ) { * It includes the font families from the theme.json data (theme.json file + global styles) and the theme style variations. * The font families with font faces containing src urls relative to the theme folder are converted to absolute urls. */ - function rest_get_font_families() { + public function rest_get_font_families() { $font_families = CBT_Theme_Fonts::get_all_fonts(); return new WP_REST_Response( @@ -466,7 +466,7 @@ function rest_get_font_families() { /** * Reset the theme to the default state. */ - function rest_reset_theme( $request ) { + public function rest_reset_theme( $request ) { $options = $request->get_params(); if ( isset( $options['resetStyles'] ) && true === $options['resetStyles'] ) { diff --git a/includes/class-create-block-theme-editor-tools.php b/includes/class-create-block-theme-editor-tools.php index 77e7ec64..ddc9596e 100644 --- a/includes/class-create-block-theme-editor-tools.php +++ b/includes/class-create-block-theme-editor-tools.php @@ -13,7 +13,7 @@ public function __construct() { add_action( 'enqueue_block_editor_assets', array( $this, 'create_block_theme_sidebar_enqueue' ) ); } - function create_block_theme_sidebar_enqueue() { + public function create_block_theme_sidebar_enqueue() { global $pagenow; if ( 'site-editor.php' !== $pagenow || ! wp_is_block_theme() ) { @@ -29,17 +29,17 @@ function create_block_theme_sidebar_enqueue() { return; } - $asset_file = include plugin_dir_path( dirname( __FILE__ ) ) . 'build/plugin-sidebar.asset.php'; + $asset_file = include plugin_dir_path( __DIR__ ) . 'build/plugin-sidebar.asset.php'; wp_register_script( 'create-block-theme-slot-fill', - plugins_url( 'build/plugin-sidebar.js', dirname( __FILE__ ) ), + plugins_url( 'build/plugin-sidebar.js', __DIR__ ), $asset_file['dependencies'], $asset_file['version'] ); wp_enqueue_style( 'create-block-theme-styles', - plugins_url( 'build/plugin-sidebar.css', dirname( __FILE__ ) ), + plugins_url( 'build/plugin-sidebar.css', __DIR__ ), array(), $asset_file['version'] ); diff --git a/includes/class-create-block-theme-loader.php b/includes/class-create-block-theme-loader.php index dcf0ce42..1da9bba3 100644 --- a/includes/class-create-block-theme-loader.php +++ b/includes/class-create-block-theme-loader.php @@ -32,7 +32,6 @@ public function __construct() { $this->actions = array(); $this->filters = array(); - } /** @@ -88,7 +87,6 @@ private function add( $hooks, $hook, $component, $callback, $priority, $accepted ); return $hooks; - } /** @@ -105,7 +103,5 @@ public function run() { foreach ( $this->actions as $hook ) { add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); } - } - } diff --git a/includes/class-create-block-theme.php b/includes/class-create-block-theme.php index c56386af..79270b01 100644 --- a/includes/class-create-block-theme.php +++ b/includes/class-create-block-theme.php @@ -20,7 +20,6 @@ public function __construct() { $this->load_dependencies(); $this->define_admin_hooks(); - } /** @@ -35,17 +34,16 @@ private function load_dependencies() { * The class responsible for orchestrating the actions and filters of the * core plugin. */ - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-create-block-theme-loader.php'; + require_once plugin_dir_path( __DIR__ ) . 'includes/class-create-block-theme-loader.php'; /** * The class responsible for defining all actions that occur in the admin area. */ - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-create-block-theme-api.php'; - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-create-block-theme-editor-tools.php'; - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-create-block-theme-admin-landing.php'; + require_once plugin_dir_path( __DIR__ ) . 'includes/class-create-block-theme-api.php'; + require_once plugin_dir_path( __DIR__ ) . 'includes/class-create-block-theme-editor-tools.php'; + require_once plugin_dir_path( __DIR__ ) . 'includes/class-create-block-theme-admin-landing.php'; $this->loader = new CBT_Plugin_Loader(); - } /** diff --git a/includes/create-theme/cbt-zip-archive.php b/includes/create-theme/cbt-zip-archive.php index 504581ad..1acfa3e2 100644 --- a/includes/create-theme/cbt-zip-archive.php +++ b/includes/create-theme/cbt-zip-archive.php @@ -7,28 +7,27 @@ class CBT_Zip_Archive extends ZipArchive { private string $theme_folder; - function __construct( $theme_slug ) { + public function __construct( $theme_slug ) { // If the original theme is in a subfolder the theme slug will be the last part of the path $complete_slug = explode( DIRECTORY_SEPARATOR, $theme_slug ); $folder = end( $complete_slug ); $this->theme_folder = $folder; } - function addFromStringToTheme( $name, $content ) { + public function addFromStringToTheme( $name, $content ) { $name = $this->theme_folder . '/' . $name; return parent::addFromString( $name, $content ); } - function addFileToTheme( $filepath, $entryname ) { + public function addFileToTheme( $filepath, $entryname ) { $entryname = $this->theme_folder . '/' . $entryname; return parent::addFile( $filepath, $entryname ); } - function addThemeDir( $dirname ) { + public function addThemeDir( $dirname ) { $dirname = $this->theme_folder . '/' . $dirname; return parent::addEmptyDir( $dirname ); } - } } diff --git a/includes/create-theme/theme-fonts.php b/includes/create-theme/theme-fonts.php index 1a476b0f..4d44f70b 100644 --- a/includes/create-theme/theme-fonts.php +++ b/includes/create-theme/theme-fonts.php @@ -18,7 +18,7 @@ class CBT_Theme_Fonts { * @return array|string */ private static function make_theme_font_src_absolute( $src ) { - $make_absolute = function( $url ) { + $make_absolute = function ( $url ) { if ( str_starts_with( $url, 'file:./' ) ) { return str_replace( 'file:./', get_stylesheet_directory_uri() . '/', $url ); } @@ -376,7 +376,7 @@ private static function remove_deactivated_font_assets( $font_families_to_not_re $theme_font_asset_location = get_stylesheet_directory() . '/assets/fonts/'; $font_families_to_remove = array_filter( $theme_font_families, - function( $theme_font_family ) use ( $font_families_to_not_remove ) { + function ( $theme_font_family ) use ( $font_families_to_not_remove ) { return ! in_array( $theme_font_family['slug'], array_column( $font_families_to_not_remove, 'slug' ), true ); } ); @@ -422,7 +422,7 @@ public static function remove_deactivated_fonts_from_theme() { if ( ! is_null( $theme_font_families ) ) { $theme_json['settings']['typography']['fontFamilies'] = array_filter( $theme_font_families, - function( $theme_font_family ) use ( $font_families_to_not_remove ) { + function ( $theme_font_family ) use ( $font_families_to_not_remove ) { return in_array( $theme_font_family['slug'], array_column( $font_families_to_not_remove, 'slug' ), true ); } ); diff --git a/includes/create-theme/theme-locale.php b/includes/create-theme/theme-locale.php index 91375ca8..151f62d1 100644 --- a/includes/create-theme/theme-locale.php +++ b/includes/create-theme/theme-locale.php @@ -167,7 +167,7 @@ private static function escape_text_content( $string ) { $php_tag .= "echo sprintf( esc_html__( '$text', '$text_domain' ), " . implode( ', ', array_map( - function( $token ) { + function ( $token ) { return "'$token'"; }, $tokens @@ -341,7 +341,7 @@ public static function escape_text_content_of_blocks( $blocks ) { } return preg_replace_callback( $pattern, - function( $matches ) { + function ( $matches ) { // If the pattern is for attribute like alt="". if ( str_ends_with( $matches[1], '="' ) ) { return $matches[1] . self::escape_attribute( $matches[2] ) . $matches[3]; @@ -365,7 +365,7 @@ function( $matches ) { ) { $block['innerContent'] = is_array( $block['innerContent'] ) ? array_map( - function( $content ) use ( $replace_content_callback, $pattern ) { + function ( $content ) use ( $replace_content_callback, $pattern ) { return $replace_content_callback( $content, $pattern ); }, $block['innerContent'] diff --git a/includes/create-theme/theme-media.php b/includes/create-theme/theme-media.php index 0f7ead6c..e9bbcab7 100644 --- a/includes/create-theme/theme-media.php +++ b/includes/create-theme/theme-media.php @@ -1,6 +1,6 @@ $exported_templates, 'parts' => $exported_parts, ); - } /** @@ -60,7 +59,7 @@ public static function get_theme_templates( $export_type, $templates_to_export = * @param string $path The path to the templates folder. * @return object|bool The template if it should be included, or false if it should be excluded. */ - static function should_include_template( $template, $export_type, $path ) { + public static function should_include_template( $template, $export_type, $path ) { if ( 'theme' === $template->source && 'user' === $export_type ) { return false; } diff --git a/includes/create-theme/theme-token-processor.php b/includes/create-theme/theme-token-processor.php index 7b4643fd..a773bdb8 100644 --- a/includes/create-theme/theme-token-processor.php +++ b/includes/create-theme/theme-token-processor.php @@ -32,7 +32,7 @@ public function process_tokens() { $has_self_closer = $this->p->has_self_closing_flag(); if ( '#tag' === $token_type ) { - $this->increment++; + ++$this->increment; $this->text .= '%' . $this->increment . '$s'; $token_label = $this->increment . '.'; diff --git a/includes/create-theme/theme-zip.php b/includes/create-theme/theme-zip.php index 460584bf..04bc2c1c 100644 --- a/includes/create-theme/theme-zip.php +++ b/includes/create-theme/theme-zip.php @@ -1,9 +1,9 @@ . - + + + + + 0 + @@ -68,7 +73,7 @@ /node_modules/* - + * diff --git a/tests/CbtThemeReadme/base.php b/tests/CbtThemeReadme/base.php index 1acd9e97..7785dde1 100644 --- a/tests/CbtThemeReadme/base.php +++ b/tests/CbtThemeReadme/base.php @@ -74,5 +74,4 @@ public function tear_down() { public function remove_newlines( $string ) { return str_replace( array( "\r\n", "\n" ), '', $string ); } - } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8b26d298..e1a71fb2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,7 +26,7 @@ * Manually load the plugin being tested. */ function _manually_load_plugin() { - require dirname( dirname( __FILE__ ) ) . '/create-block-theme.php'; + require dirname( __DIR__, 1 ) . '/create-block-theme.php'; } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); diff --git a/tests/test-theme-fonts.php b/tests/test-theme-fonts.php index ee3f564a..7f5ba116 100644 --- a/tests/test-theme-fonts.php +++ b/tests/test-theme-fonts.php @@ -55,7 +55,6 @@ public function test_copy_activated_fonts_to_theme() { $this->assertTrue( file_exists( get_stylesheet_directory() . '/assets/fonts/open-sans/open-sans-400-normal.ttf' ) ); $this->uninstall_theme( $test_theme_slug ); - } public function test_remove_deactivated_fonts_from_theme() { @@ -262,7 +261,6 @@ public function test_get_all_fonts_from_theme_and_variation() { $this->assertStringNotContainsString( 'file:.', $fonts[1]['fontFace'][0]['src'] ); $this->uninstall_theme( $test_theme_slug ); - } public function test_non_array_font_src() { @@ -870,4 +868,3 @@ public function test_copy_font_assets_to_theme_preserves_existing_file_src() { $this->uninstall_theme( $test_theme_slug ); } } - diff --git a/tests/test-theme-media.php b/tests/test-theme-media.php index d308b1f4..c552407a 100644 --- a/tests/test-theme-media.php +++ b/tests/test-theme-media.php @@ -17,7 +17,6 @@ public function test_make_images_block_local() { $this->assertStringNotContainsString( 'http://example.com/image.jpg', $new_template->content ); $this->assertStringContainsString( 'get_template_directory_uri', $new_template->content ); $this->assertStringContainsString( '/assets/images', $new_template->content ); - } public function test_make_cover_block_local() { @@ -57,7 +56,6 @@ public function test_template_with_media_correctly_prepared() { // The pattern is correctly encoded $this->assertStringContainsString( 'pattern ); - } public function test_make_group_block_local() { @@ -78,7 +76,6 @@ public function test_make_group_block_local() { // The pattern is correctly encoded $this->assertStringContainsString( '{"backgroundImage":{"url":"/assets/images/image.jpg"', $new_template->pattern ); - } public function test_is_allowed_media_url_accepts_image_extension() { diff --git a/tests/test-theme-templates.php b/tests/test-theme-templates.php index 1ff0b55f..8bd64c45 100644 --- a/tests/test-theme-templates.php +++ b/tests/test-theme-templates.php @@ -387,5 +387,4 @@ public function test_localize_cover_repeated_background_inline_style() { $new_template = CBT_Theme_Media::make_template_images_local( $template ); $this->assertStringContainsString( '/assets/images/pattern.webp', $new_template->content ); } - } diff --git a/tests/test-theme-utils.php b/tests/test-theme-utils.php index d94953bb..05ab7e7f 100644 --- a/tests/test-theme-utils.php +++ b/tests/test-theme-utils.php @@ -18,7 +18,6 @@ public function test_replace_namespace_in_pattern() { $updated_pattern_string = CBT_Theme_Utils::replace_namespace( $pattern_string, 'old-slug', 'new-slug', 'Old Name', 'New Name' ); $this->assertStringContainsString( 'Slug: new-slug/index', $updated_pattern_string ); $this->assertStringNotContainsString( 'old-slug', $updated_pattern_string ); - } public function test_replace_namespace_in_code() {