diff options
-rw-r--r-- | src/wp-admin/includes/class-walker-nav-menu-checklist.php | 2 | ||||
-rw-r--r-- | src/wp-admin/includes/class-walker-nav-menu-edit.php | 2 | ||||
-rw-r--r-- | src/wp-admin/includes/class-wp-list-table.php | 1 | ||||
-rw-r--r-- | src/wp-admin/includes/class-wp-plugin-install-list-table.php | 1 | ||||
-rw-r--r-- | src/wp-admin/includes/class-wp-posts-list-table.php | 1 | ||||
-rw-r--r-- | src/wp-admin/includes/class-wp-upgrader.php | 1 | ||||
-rw-r--r-- | src/wp-includes/customize/class-wp-customize-custom-css-setting.php | 3 | ||||
-rw-r--r-- | src/wp-includes/post-template.php | 6 | ||||
-rw-r--r-- | src/wp-includes/script-loader.php | 6 | ||||
-rw-r--r-- | src/wp-includes/theme.json | 7 | ||||
-rw-r--r-- | tests/phpunit/tests/basic.php | 71 |
11 files changed, 87 insertions, 14 deletions
diff --git a/src/wp-admin/includes/class-walker-nav-menu-checklist.php b/src/wp-admin/includes/class-walker-nav-menu-checklist.php index 6fc5c41690..099d250076 100644 --- a/src/wp-admin/includes/class-walker-nav-menu-checklist.php +++ b/src/wp-admin/includes/class-walker-nav-menu-checklist.php @@ -117,7 +117,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="' . esc_attr( $menu_item->menu_item_parent ) . '" />'; $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="' . esc_attr( $menu_item->type ) . '" />'; $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="' . esc_attr( $menu_item->title ) . '" />'; - $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="' . esc_attr( $menu_item->url ) . '" />'; + $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="' . esc_url( $menu_item->url ) . '" />'; $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="' . esc_attr( $menu_item->target ) . '" />'; $output .= '<input type="hidden" class="menu-item-attr-title" name="menu-item[' . $possible_object_id . '][menu-item-attr-title]" value="' . esc_attr( $menu_item->attr_title ) . '" />'; $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="' . esc_attr( implode( ' ', $menu_item->classes ) ) . '" />'; diff --git a/src/wp-admin/includes/class-walker-nav-menu-edit.php b/src/wp-admin/includes/class-walker-nav-menu-edit.php index 026da47acc..66ea47bb1f 100644 --- a/src/wp-admin/includes/class-walker-nav-menu-edit.php +++ b/src/wp-admin/includes/class-walker-nav-menu-edit.php @@ -196,7 +196,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { <p class="field-url description description-wide"> <label for="edit-menu-item-url-<?php echo $item_id; ?>"> <?php _e( 'URL' ); ?><br /> - <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->url ); ?>" /> + <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_url( $menu_item->url ); ?>" /> </label> </p> <?php endif; ?> diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 4bad78b823..5a7fa0db8e 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -1540,7 +1540,6 @@ class WP_List_Table { * should be provided via get_sortable_columns(). * * @since 6.3.0 - * @access public */ public function print_table_description() { list( $columns, $hidden, $sortable ) = $this->get_column_info(); diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index f39ec60a24..df0260be81 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -36,7 +36,6 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { * installed plugins. * * @since 4.9.0 - * @access protected * * @return array */ diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 3d25b2f7ff..9be86455e2 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -496,7 +496,6 @@ class WP_Posts_List_Table extends WP_List_Table { * Displays a formats drop-down for filtering items. * * @since 5.2.0 - * @access protected * * @param string $post_type Post type slug. */ diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index 4064dfb644..d641d10386 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -403,7 +403,6 @@ class WP_Upgrader { * Flattens the results of WP_Filesystem_Base::dirlist() for iterating over. * * @since 4.9.0 - * @access protected * * @param array $nested_files Array of files as returned by WP_Filesystem_Base::dirlist(). * @param string $path Relative path to prepend to child nodes. Optional. diff --git a/src/wp-includes/customize/class-wp-customize-custom-css-setting.php b/src/wp-includes/customize/class-wp-customize-custom-css-setting.php index 0e6132f339..aab0e47530 100644 --- a/src/wp-includes/customize/class-wp-customize-custom-css-setting.php +++ b/src/wp-includes/customize/class-wp-customize-custom-css-setting.php @@ -197,9 +197,10 @@ final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting { ) ); - if ( $r instanceof WP_Error ) { + if ( is_wp_error( $r ) ) { return false; } + $post_id = $r->ID; // Cache post ID in theme mod for performance to avoid additional DB query. diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index d502cf4daa..edcc1e0f03 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -1771,7 +1771,7 @@ function prepend_attachment( $content ) { * @since 1.0.0 * * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post. - * @return string HTML content for password form for password protected post. + * @return string HTML content for password form for password-protected post. */ function get_the_password_form( $post = 0 ) { $post = get_post( $post ); @@ -1786,7 +1786,7 @@ function get_the_password_form( $post = 0 ) { if ( ! empty( $post->ID ) && wp_get_raw_referer() === get_permalink( $post->ID ) && isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) { /** * Filters the invalid password message shown on password-protected posts. - * The filter is only applied if the post is password protected. + * The filter is only applied if the post is password-protected. * * @since 6.8.0 * @@ -1807,7 +1807,7 @@ function get_the_password_form( $post = 0 ) { } $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form' . $class . '" method="post">' . $redirect_field . $invalid_password_html . ' - <p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p> + <p>' . __( 'This content is password-protected. To view it, please enter the password below.' ) . '</p> <p><label for="' . $field_id . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $field_id . '" type="password" spellcheck="false" required size="20"' . $aria . ' /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form> '; diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 51efa328bf..fa4a038754 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2900,7 +2900,7 @@ function wp_get_script_tag( $attributes ) { /** * Prints formatted `<script>` loader tag. * - * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. * Automatically injects type attribute if needed. * * @since 5.7.0 @@ -2914,7 +2914,7 @@ function wp_print_script_tag( $attributes ) { /** * Constructs an inline script tag. * - * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_inline_script_attributes'} filter. * Automatically injects type attribute if needed. * * @since 5.7.0 @@ -3003,7 +3003,7 @@ function wp_get_inline_script_tag( $data, $attributes = array() ) { /** * Prints an inline script tag. * - * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_script_attributes'} filter. + * It is possible to inject attributes in the `<script>` tag via the {@see 'wp_inline_script_attributes'} filter. * Automatically injects type attribute if needed. * * @since 5.7.0 diff --git a/src/wp-includes/theme.json b/src/wp-includes/theme.json index 32873854e4..641c379557 100644 --- a/src/wp-includes/theme.json +++ b/src/wp-includes/theme.json @@ -373,7 +373,12 @@ "background": "#32373c" }, "spacing": { - "padding": "calc(0.667em + 2px) calc(1.333em + 2px)" + "padding": { + "top": "calc(0.667em + 2px)", + "right": "calc(1.333em + 2px)", + "bottom": "calc(0.667em + 2px)", + "left": "calc(1.333em + 2px)" + } }, "typography": { "fontSize": "inherit", diff --git a/tests/phpunit/tests/basic.php b/tests/phpunit/tests/basic.php index 954751d99e..0f8c001600 100644 --- a/tests/phpunit/tests/basic.php +++ b/tests/phpunit/tests/basic.php @@ -8,6 +8,8 @@ class Tests_Basic extends WP_UnitTestCase { /** + * Test copyright year in license.txt. + * * @coversNothing */ public function test_license() { @@ -23,6 +25,8 @@ class Tests_Basic extends WP_UnitTestCase { } /** + * Test latest stable version is included in SECURITY.md. + * * @coversNothing */ public function test_security_md() { @@ -39,6 +43,8 @@ class Tests_Basic extends WP_UnitTestCase { } /** + * Test the version number in package.json is correct. + * * @coversNothing */ public function test_package_json() { @@ -57,6 +63,8 @@ class Tests_Basic extends WP_UnitTestCase { } /** + * Test engines.node is included in package.json. + * * @depends test_package_json * * @coversNothing @@ -65,4 +73,67 @@ class Tests_Basic extends WP_UnitTestCase { $this->assertArrayHasKey( 'engines', $package_json ); $this->assertArrayHasKey( 'node', $package_json['engines'] ); } + + /** + * Test the version numbers in package-lock.json are correct. + * + * In pull requests, the package-lock.json file is updated automatically + * to match the version in package.json. This test is intended to ensure + * the version numbers are correct in production branches. + * + * @coversNothing + * + * @dataProvider data_package_lock_json + */ + public function test_package_lock_json( $path ) { + $package_lock_json = file_get_contents( dirname( ABSPATH ) . '/package-lock.json' ); + $package_lock_json = json_decode( $package_lock_json, true ); + list( $version ) = explode( '-', $GLOBALS['wp_version'] ); + + // package-lock.json uses x.y.z, so fill cleaned $wp_version for .0 releases. + if ( 1 === substr_count( $version, '.' ) ) { + $version .= '.0'; + } + + $json_paths = explode( '.', $path ); + $package_lock_version = $package_lock_json; + foreach ( $json_paths as $json_path ) { + if ( ! isset( $package_lock_version[ $json_path ] ) ) { + $this->fail( "package-lock.json does not contain the path '$path'." ); + } + $package_lock_version = $package_lock_version[ $json_path ]; + } + + $this->assertSame( $version, $package_lock_version, "package-lock.json's $path needs to be updated to $version." ); + } + + /** + * Data provider for test_package_lock_json. + * + * @return array[] Data provider. + */ + public function data_package_lock_json() { + return array( + 'top level' => array( 'version' ), + 'package' => array( 'packages..version' ), + ); + } + + /** + * Test the version number in composer.json is correct. + * + * @coversNothing + */ + public function test_composer_json() { + $composer_json = file_get_contents( dirname( ABSPATH ) . '/composer.json' ); + $composer_json = json_decode( $composer_json, true ); + list( $version ) = explode( '-', $GLOBALS['wp_version'] ); + + // composer.json uses x.y.z, so fill cleaned $wp_version for .0 releases. + if ( 1 === substr_count( $version, '.' ) ) { + $version .= '.0'; + } + + $this->assertSame( $version, $composer_json['version'], "composer.json's version needs to be updated to $version." ); + } } |