1
0
Fork 0
mirror of https://github.com/WordPress/WordPress.git synced 2025-12-08 05:15:15 +08:00

Compare commits

...

9 commits

Author SHA1 Message Date
Weston Ruter
893f17b4b1 Docs: Improve docblocks and types for WP_Screen properties.
* Correctly hint that `WP_Screen::$_show_screen_options` is null before being instantiated.
* Correctly hint that `::get_option()`, `get_help_tab()` and `get_screen_reader_text()` can return null.
* Ensure `$this->columns` is an `int`, by casting `$this->get_option( 'layout_columns', 'default' )` from its numeric string.

Developed in https://github.com/WordPress/wordpress-develop/pull/8860

Props justlevine, peterwilsoncc, westonruter.
See #64238, #64224.

Built from https://develop.svn.wordpress.org/trunk@61300


git-svn-id: http://core.svn.wordpress.org/trunk@60612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-25 02:20:32 +00:00
Weston Ruter
76ee0ab4bc Docs: Update various class @var tags to indicate nullability.
This updates various `@var` tags on class properties to correctly indicate that the props may be `null` or unset:

* `WP_Dependencies::$all_queued_deps` is nullable by both `::enqueue()` and `::dequeue`. Also, the types of the keys and values are specified. 
* `WP_Duotone::$global_styles_presets` and `::$global_styles_block_names` start off unset and are only initialized by static classes.
* `WP_Query::init()` and `WP_Rewrite::init()` are public methods that `unset()`s many class props.
* `WP_Theme::cache_delete()` sets many props to `null`.

Developed in https://github.com/WordPress/wordpress-develop/pull/8953

Props justlevine, westonruter.
See #64238, #64224.

Built from https://develop.svn.wordpress.org/trunk@61299


git-svn-id: http://core.svn.wordpress.org/trunk@60611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-25 02:00:36 +00:00
Weston Ruter
ec15921c78 Docs: Update typing for wp_create_category().
* Ensure that `wp_create_category()` returns `int` as opposed to `numeric-string`.
* Rename `$cat_name` to `$category_name` to avoid abbreviating variables.
* Update docblock to remove erroneous `int` for `$category_name` param when only `string` is intended.
* Add missing tests for `wp_create_category()`.

Developed in https://github.com/WordPress/wordpress-develop/pull/8861

Props justlevine, westonruter.
See #64238, #64226.

Built from https://develop.svn.wordpress.org/trunk@61298


git-svn-id: http://core.svn.wordpress.org/trunk@60610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-25 01:34:30 +00:00
Sergey Biryukov
879ba497c2 Twenty Nineteen: Ensure that Pullquote block color is reflected on citation text.
Follow-up to [43808].

Props nidhidhandhukiya, sainathpoojary, kelvinballoo, ankit-k-gupta, pooja1210, karmatosed, sabernhardt, sandeepdahiya, SergeyBiryukov.
Fixes #58100.
Built from https://develop.svn.wordpress.org/trunk@61295


git-svn-id: http://core.svn.wordpress.org/trunk@60607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-24 22:46:34 +00:00
dmsnell
1f8967b293 Block Processor: Rename extract_block() method for clearer documentation.
In testing during the release candidacy for WordPress 6.9 it was found
that the `extract_block()` method may do more work than is expected
based off of its name.

This change renames the method to `extract_full_block_and_advance()` to
communicate that it does move the Block Processor forward and to hint at
the fact that it also encompasses all inner blocks during that advance.

Developed in https://github.com/WordPress/wordpress-develop/pull/10538
Discussed in https://core.trac.wordpress.org/ticket/61401

Follow-up to [60939].

Props dlh, dmsnell, jonsurrell, westonruter.

See #61401.

Built from https://develop.svn.wordpress.org/trunk@61294


git-svn-id: http://core.svn.wordpress.org/trunk@60606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-24 21:54:34 +00:00
John Blackbourn
73b24b0ff0 Media: Account for boolean false being returned by wp_getimagesize() when dealing with potentially invalid images in wp_read_image_metadata().
Prior to PHP 8.5 a boolean value was silently ignored when being passed to `list()`, but in PHP 8.5 and higher this now triggers a PHP warning. This change adds an appropriate guard condition.

Props swissspidy, adamsilverstein

Fixes #64295

Built from https://develop.svn.wordpress.org/trunk@61291


git-svn-id: http://core.svn.wordpress.org/trunk@60603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-24 19:10:28 +00:00
joedolson
5973aca182 Admin: Remove alt syntax from dashicons.css
Safari only introduced support for alternative text in generated CSS content in version 17.4, released in 2024. This meets the latest two version declared for core browser support. But because `dashicons.css` is commonly required on the front-end for plugins and themes, this support impacts front-end users, and the browser support guidelines for core should not apply in this context.

Follow up to [60885].

Props codex-m, sabernhardt, wildworks, joedolson, desrosj, welcher.
Fixes #64266.
Built from https://develop.svn.wordpress.org/trunk@61290


git-svn-id: http://core.svn.wordpress.org/trunk@60602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-24 18:47:30 +00:00
desrosj
e37ff6fff6 Build/Test Tools: Introduce post-branching Grunt task.
In [59673], a Grunt subtask was introduced to convert workflow file references in GitHub Action workflows from local ones to remote ones that target the `trunk` branch.

The `workflow-references-local-to-remote` Grunt task should be run after creating a new numbered branch to take advantage of the work started in [58165].

This commit introduces a new target for the `clean` Grunt task: `workflows`. Running `grunt clean:workflows` will delete all workflow files that are not intended to exist outside of `trunk`.

Another Grunt task (`post-branching`) has also been added as a way to group all tasks taht should run within a newly created branch. For now, this contains `clean:workflows` and `replace:workflow-references-local-to-remote`. But more can be added in the future as more aspects of the branching process are automated.

Props johnbillion.
See #64227.
Built from https://develop.svn.wordpress.org/trunk@61286


git-svn-id: http://core.svn.wordpress.org/trunk@60598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-24 17:43:35 +00:00
wildworks
a05eec7fb1 Editor: Rename block visibility support key to visibility.
Renames the support key to `visibility` to avoid conflicting with the Block Visibility plugin's existing `blockVisibility` key.

Follow-up to [61014].

Props andrewserong, annezazu, cbravobernal, dlh, jorbin, joen, johnjamesjacoby, palak678, ramonopoly, talldanwp, tyxla, wildworks.
Fixes #64272.
Built from https://develop.svn.wordpress.org/trunk@61285


git-svn-id: http://core.svn.wordpress.org/trunk@60597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-24 08:07:33 +00:00
18 changed files with 429 additions and 396 deletions

View file

@ -175,8 +175,10 @@ final class WP_Screen {
/**
* Stores the result of the public show_screen_options function.
*
* Set when calling {@see self::show_screen_options()} for the first time.
*
* @since 3.3.0
* @var bool
* @var ?bool
*/
private $_show_screen_options;

@ -545,7 +547,7 @@ final class WP_Screen {
* @param string $option Option name.
* @param string|false $key Optional. Specific array key for when the option is an array.
* Default false.
* @return string The option value if set, null otherwise.
* @return ?string The option value if set, null otherwise.
*/
public function get_option( $option, $key = false ) {
if ( ! isset( $this->_options[ $option ] ) ) {
@ -598,7 +600,7 @@ final class WP_Screen {
* @since 3.4.0
*
* @param string $id Help Tab ID.
* @return array Help tab arguments.
* @return ?array Help tab arguments, or null if no help tabs added.
*/
public function get_help_tab( $id ) {
if ( ! isset( $this->_help_tabs[ $id ] ) ) {
@ -733,7 +735,7 @@ final class WP_Screen {
* @since 4.4.0
*
* @param string $key Screen reader text array named key.
* @return string Screen reader text string.
* @return ?string Screen reader text string, or null if no text is associated with the key.
*/
public function get_screen_reader_text( $key ) {
if ( ! isset( $this->_screen_reader_content[ $key ] ) ) {
@ -949,8 +951,9 @@ final class WP_Screen {
if ( $this->get_option( 'layout_columns' ) ) {
$this->columns = (int) get_user_option( "screen_layout_$this->id" );

if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) {
$this->columns = $this->get_option( 'layout_columns', 'default' );
$layout_columns = (int) $this->get_option( 'layout_columns', 'default' );
if ( ! $this->columns && $layout_columns ) {
$this->columns = $layout_columns;
}
}
$GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat.

View file

@ -827,7 +827,13 @@ function wp_read_image_metadata( $file ) {
return false;
}

list( , , $image_type ) = wp_getimagesize( $file );
$image_size = wp_getimagesize( $file );

if ( false === $image_size ) {
return false;
}

list( , , $image_type ) = $image_size;

/*
* EXIF contains a bunch of data we'll probably never need formatted in ways

View file

@ -48,19 +48,19 @@ function get_category_to_edit( $id ) {
*
* @since 2.0.0
*
* @param int|string $cat_name Category name.
* @param int $category_parent Optional. ID of parent category.
* @return int|WP_Error
* @param string $category_name Category name.
* @param int $category_parent Optional. ID of parent category.
* @return int The ID of category term on success, or zero on failure.
*/
function wp_create_category( $cat_name, $category_parent = 0 ) {
$id = category_exists( $cat_name, $category_parent );
function wp_create_category( $category_name, $category_parent = 0 ) {
$id = category_exists( $category_name, $category_parent );
if ( $id ) {
return $id;
return (int) $id;
}

return wp_insert_category(
array(
'cat_name' => $cat_name,
'cat_name' => $category_name,
'category_parent' => $category_parent,
)
);

View file

@ -436,6 +436,10 @@
}
}

&.has-text-color cite {
color: inherit;
}

&.is-style-solid-color {
background-color: $color__link;
padding-left: 0;

View file

@ -1103,6 +1103,12 @@ figcaption,
color: #767676;
}

.wp-block-pullquote.has-text-color .wp-block-pullquote__citation,
.wp-block-pullquote.has-primary-background-color blockquote p,
.wp-block-pullquote.has-dark-gray-background-color blockquote p {
color: inherit;
}

.wp-block-pullquote.is-style-solid-color blockquote {
width: calc(100% - (2 * 1rem));
max-width: calc( 100% - (2 * 1rem));

View file

@ -515,6 +515,12 @@ figcaption,
color: $color__text-light;
}

&.has-text-color .wp-block-pullquote__citation,
&.has-primary-background-color blockquote p,
&.has-dark-gray-background-color blockquote p {
color: inherit;
}

&.is-style-solid-color {

blockquote {

View file

@ -5758,6 +5758,10 @@ body.page .main-navigation {
margin-top: 0;
}

.entry .entry-content .wp-block-pullquote.has-text-color cite {
color: inherit;
}

.entry .entry-content .wp-block-pullquote.is-style-solid-color {
background-color: #0073aa;
padding-right: 0;

View file

@ -5770,6 +5770,10 @@ body.page .main-navigation {
margin-top: 0;
}

.entry .entry-content .wp-block-pullquote.has-text-color cite {
color: inherit;
}

.entry .entry-content .wp-block-pullquote.is-style-solid-color {
background-color: #0073aa;
padding-left: 0;

View file

@ -19,7 +19,7 @@
function wp_render_block_visibility_support( $block_content, $block ) {
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );

if ( ! $block_type || ! block_has_support( $block_type, 'blockVisibility', true ) ) {
if ( ! $block_type || ! block_has_support( $block_type, 'visibility', true ) ) {
return $block_content;
}


View file

@ -194,7 +194,7 @@
* block, and re-serialize it into the original document. Its possible to do so
* while skipping over the parse of the rest of the document.
*
* {@see self::extract_block()} will scan forward from the current block opener
* {@see self::extract_full_block_and_advance()} will scan forward from the current block opener
* and build the parsed block structure until the current block is closed. It will
* include all inner HTML and inner blocks, and parse all of the inner blocks. It
* can be used to extract a block at any depth in the document, helpful for operating
@ -207,7 +207,7 @@
* }
*
* $gallery_at = $processor->get_span()->start;
* $gallery_block = $processor->extract_block();
* $gallery_block = $processor->extract_full_block_and_advance();
* $after_gallery = $processor->get_span()->start;
* return (
* substr( $post_content, 0, $gallery_at ) .
@ -1223,7 +1223,7 @@ class WP_Block_Processor {
* }
*
* $gallery_at = $processor->get_span()->start;
* $gallery = $processor->extract_block();
* $gallery = $processor->extract_full_block_and_advance();
* $ends_before = $processor->get_span();
* $ends_before = $ends_before->start ?? strlen( $post_content );
*
@ -1254,7 +1254,7 @@ class WP_Block_Processor {
* }
* }
*/
public function extract_block(): ?array {
public function extract_full_block_and_advance(): ?array {
if ( $this->is_html() ) {
$chunk = $this->get_html_content();

@ -1291,7 +1291,7 @@ class WP_Block_Processor {
* @todo Use iteration instead of recursion, or at least refactor to tail-call form.
*/
if ( $this->opens_block() ) {
$inner_block = $this->extract_block();
$inner_block = $this->extract_full_block_and_advance();
$block['innerBlocks'][] = $inner_block;
$block['innerContent'][] = null;
}

View file

@ -91,7 +91,7 @@ class WP_Dependencies {
*
* @since 5.4.0
*
* @var array
* @var ?array<string, true>
*/
private $all_queued_deps;


View file

@ -52,7 +52,7 @@ class WP_Duotone {
*
* @since 6.3.0
*
* @var array
* @var ?array
*/
private static $global_styles_block_names;

@ -76,7 +76,7 @@ class WP_Duotone {
*
* @since 6.3.0
*
* @var array
* @var ?array
*/
private static $global_styles_presets;


View file

@ -22,7 +22,7 @@ class WP_Query {
* Query vars set by the user.
*
* @since 1.5.0
* @var array
* @var ?array
*/
public $query;

@ -72,7 +72,7 @@ class WP_Query {
* The ID of the queried object.
*
* @since 1.5.0
* @var int
* @var ?int
*/
public $queried_object_id;

@ -80,7 +80,7 @@ class WP_Query {
* SQL for the database query.
*
* @since 2.0.1
* @var string
* @var ?string
*/
public $request;

@ -88,7 +88,7 @@ class WP_Query {
* Array of post objects or post IDs.
*
* @since 1.5.0
* @var WP_Post[]|int[]
* @var WP_Post[]|int[]|null
*/
public $posts;

@ -139,7 +139,7 @@ class WP_Query {
* The list of comments for current post.
*
* @since 2.2.0
* @var WP_Comment[]
* @var ?WP_Comment[]
*/
public $comments;

@ -163,7 +163,7 @@ class WP_Query {
* Current comment object.
*
* @since 2.2.0
* @var WP_Comment
* @var ?WP_Comment
*/
public $comment;

@ -466,7 +466,7 @@ class WP_Query {
* Cached list of search stopwords.
*
* @since 3.7.0
* @var array
* @var ?array
*/
private $stopwords;


View file

@ -52,7 +52,7 @@ class WP_Rewrite {
* Permalink structure for author archives.
*
* @since 1.5.0
* @var string
* @var ?string
*/
public $author_structure;

@ -60,7 +60,7 @@ class WP_Rewrite {
* Permalink structure for date archives.
*
* @since 1.5.0
* @var string
* @var ?string
*/
public $date_structure;

@ -68,7 +68,7 @@ class WP_Rewrite {
* Permalink structure for pages.
*
* @since 1.5.0
* @var string
* @var ?string
*/
public $page_structure;

@ -84,7 +84,7 @@ class WP_Rewrite {
* Permalink structure for searches.
*
* @since 1.5.0
* @var string
* @var ?string
*/
public $search_structure;

@ -124,7 +124,7 @@ class WP_Rewrite {
* Comments feed permalink structure.
*
* @since 1.5.0
* @var string
* @var ?string
*/
public $comment_feed_structure;

@ -132,7 +132,7 @@ class WP_Rewrite {
* Feed request permalink structure.
*
* @since 1.5.0
* @var string
* @var ?string
*/
public $feed_structure;


View file

@ -114,7 +114,7 @@ final class WP_Theme implements ArrayAccess {
* Header data from the theme's style.css file after being sanitized.
*
* @since 3.4.0
* @var array
* @var ?array
*/
private $headers_sanitized;

@ -122,7 +122,7 @@ final class WP_Theme implements ArrayAccess {
* Is this theme a block theme.
*
* @since 6.2.0
* @var bool
* @var ?bool
*/
private $block_theme;

@ -132,7 +132,7 @@ final class WP_Theme implements ArrayAccess {
* Cached due to sorting functions running over the translated name.
*
* @since 3.4.0
* @var string
* @var ?string
*/
private $name_translated;

@ -140,7 +140,7 @@ final class WP_Theme implements ArrayAccess {
* Errors encountered when initializing the theme.
*
* @since 3.4.0
* @var WP_Error
* @var ?WP_Error
*/
private $errors;

@ -162,7 +162,7 @@ final class WP_Theme implements ArrayAccess {
* Otherwise, 'template' is the same as 'stylesheet'.
*
* @since 3.4.0
* @var string
* @var ?string
*/
private $template;

@ -170,7 +170,7 @@ final class WP_Theme implements ArrayAccess {
* A reference to the parent theme, in the case of a child theme.
*
* @since 3.4.0
* @var WP_Theme
* @var ?WP_Theme
*/
private $parent;

@ -178,7 +178,7 @@ final class WP_Theme implements ArrayAccess {
* URL to the theme root, usually an absolute URL to wp-content/themes
*
* @since 3.4.0
* @var string
* @var ?string
*/
private $theme_root_uri;

@ -186,7 +186,7 @@ final class WP_Theme implements ArrayAccess {
* Flag for whether the theme's textdomain is loaded.
*
* @since 3.4.0
* @var bool
* @var ?bool
*/
private $textdomain_loaded;

@ -202,7 +202,7 @@ final class WP_Theme implements ArrayAccess {
* Block template folders.
*
* @since 6.4.0
* @var string[]
* @var ?string[]
*/
private $block_template_folders;


File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61284';
$wp_version = '7.0-alpha-61300';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.