wp core update 6.6

This commit is contained in:
Tony Volpe
2024-07-17 03:05:30 +00:00
parent 8f93917880
commit 4950d23a30
912 changed files with 103325 additions and 124480 deletions

View File

@@ -51,6 +51,56 @@ class WP_HTML_Open_Elements {
*/
private $has_p_in_button_scope = false;
/**
* A function that will be called when an item is popped off the stack of open elements.
*
* The function will be called with the popped item as its argument.
*
* @since 6.6.0
*
* @var Closure
*/
private $pop_handler = null;
/**
* A function that will be called when an item is pushed onto the stack of open elements.
*
* The function will be called with the pushed item as its argument.
*
* @since 6.6.0
*
* @var Closure
*/
private $push_handler = null;
/**
* Sets a pop handler that will be called when an item is popped off the stack of
* open elements.
*
* The function will be called with the pushed item as its argument.
*
* @since 6.6.0
*
* @param Closure $handler The handler function.
*/
public function set_pop_handler( Closure $handler ) {
$this->pop_handler = $handler;
}
/**
* Sets a push handler that will be called when an item is pushed onto the stack of
* open elements.
*
* The function will be called with the pushed item as its argument.
*
* @since 6.6.0
*
* @param Closure $handler The handler function.
*/
public function set_push_handler( Closure $handler ) {
$this->push_handler = $handler;
}
/**
* Reports if a specific node is in the stack of open elements.
*
@@ -258,11 +308,15 @@ class WP_HTML_Open_Elements {
*/
public function pop() {
$item = array_pop( $this->stack );
if ( null === $item ) {
return false;
}
if ( 'context-node' === $item->bookmark_name ) {
$this->stack[] = $item;
return false;
}
$this->after_element_pop( $item );
return true;
}
@@ -279,6 +333,10 @@ class WP_HTML_Open_Elements {
*/
public function pop_until( $tag_name ) {
foreach ( $this->walk_up() as $item ) {
if ( 'context-node' === $item->bookmark_name ) {
return true;
}
$this->pop();
if (
@@ -319,6 +377,10 @@ class WP_HTML_Open_Elements {
* @return bool Whether the node was found and removed from the stack of open elements.
*/
public function remove_node( $token ) {
if ( 'context-node' === $token->bookmark_name ) {
return false;
}
foreach ( $this->walk_up() as $position_from_end => $item ) {
if ( $token->bookmark_name !== $item->bookmark_name ) {
continue;
@@ -429,6 +491,10 @@ class WP_HTML_Open_Elements {
$this->has_p_in_button_scope = true;
break;
}
if ( null !== $this->push_handler ) {
( $this->push_handler )( $item );
}
}
/**
@@ -458,5 +524,18 @@ class WP_HTML_Open_Elements {
$this->has_p_in_button_scope = $this->has_element_in_button_scope( 'P' );
break;
}
if ( null !== $this->pop_handler ) {
( $this->pop_handler )( $item );
}
}
/**
* Wakeup magic method.
*
* @since 6.6.0
*/
public function __wakeup() {
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
}
}