Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcb0013f36 | ||
|
|
9596df5b2a | ||
|
|
f6363c808b | ||
|
|
3260e33888 | ||
|
|
076394db0a | ||
|
|
49a67fb33a | ||
|
|
ac5688a26a | ||
|
|
cd612932d6 | ||
|
|
33a77cca49 | ||
|
|
04e120a593 | ||
|
|
b2191ff30c | ||
|
|
34ecc74ff9 | ||
|
|
a5129f833b | ||
|
|
b683ac27c5 | ||
|
|
864d544852 | ||
|
|
461062cab7 | ||
|
|
0a6525bc80 | ||
|
|
657e931145 | ||
|
|
6437203f09 | ||
|
|
ea97d7797b | ||
|
|
8cd8ef6c75 | ||
|
|
f1520bb093 |
@@ -42,6 +42,111 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
|
||||
<div class="about__section changelog">
|
||||
<div class="column">
|
||||
<h2><?php _e( 'Maintenance and Security Releases' ); ?></h2>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number. */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'5.9.8'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '5.9.8' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: WordPress version number, 2: Plural number of bugs. More than one security issue. */
|
||||
_n(
|
||||
'<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.',
|
||||
'<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.',
|
||||
1
|
||||
),
|
||||
'5.9.7',
|
||||
'1'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '5.9.7' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number. */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'5.9.6'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '5.9.6' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number. */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'5.9.5'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '5.9.5' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number. */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'5.9.4'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: HelpHub URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' ),
|
||||
sprintf(
|
||||
/* translators: %s: WordPress version. */
|
||||
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
|
||||
sanitize_title( '5.9.4' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
@@ -429,3 +534,15 @@ _n_noop(
|
||||
|
||||
/* translators: %s: Documentation URL. */
|
||||
__( 'For more information, see <a href="%s">the release notes</a>.' );
|
||||
|
||||
/* translators: 1: WordPress version number, 2: Link to update WordPress */
|
||||
__( 'Important! Your version of WordPress (%1$s) is no longer supported, you will not receive any security updates for your website. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.' );
|
||||
|
||||
/* translators: 1: WordPress version number, 2: Link to update WordPress */
|
||||
__( 'Important! Your version of WordPress (%1$s) will stop receiving security updates in the near future. To keep your site secure, please <a href="%2$s">update to the latest version of WordPress</a>.' );
|
||||
|
||||
/* translators: %s: The major version of WordPress for this branch. */
|
||||
__( 'This is the final release of WordPress %s' );
|
||||
|
||||
/* translators: The localized WordPress download URL. */
|
||||
__( 'https://wordpress.org/download/' );
|
||||
|
||||
@@ -2732,6 +2732,10 @@ function wp_ajax_set_attachment_thumbnail() {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( false === check_ajax_referer( 'set-attachment-thumbnail', '_ajax_nonce', false ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
$post_ids = array();
|
||||
// For each URL, try to find its corresponding post ID.
|
||||
foreach ( $_POST['urls'] as $url ) {
|
||||
@@ -2984,7 +2988,7 @@ function wp_ajax_query_attachments() {
|
||||
|
||||
// Filter query clauses to include filenames.
|
||||
if ( isset( $query['s'] ) ) {
|
||||
add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
|
||||
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3808,13 +3812,29 @@ function wp_ajax_parse_media_shortcode() {
|
||||
|
||||
$shortcode = wp_unslash( $_POST['shortcode'] );
|
||||
|
||||
// Only process previews for media related shortcodes:
|
||||
$found_shortcodes = get_shortcode_tags_in_content( $shortcode );
|
||||
$media_shortcodes = array(
|
||||
'audio',
|
||||
'embed',
|
||||
'playlist',
|
||||
'video',
|
||||
'gallery',
|
||||
);
|
||||
|
||||
$other_shortcodes = array_diff( $found_shortcodes, $media_shortcodes );
|
||||
|
||||
if ( ! empty( $other_shortcodes ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST['post_ID'] ) ) {
|
||||
$post = get_post( (int) $_POST['post_ID'] );
|
||||
}
|
||||
|
||||
// The embed shortcode requires a post.
|
||||
if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
|
||||
if ( 'embed' === $shortcode ) {
|
||||
if ( in_array( 'embed', $found_shortcodes, true ) ) {
|
||||
wp_send_json_error();
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -640,6 +640,19 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
|
||||
$this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
|
||||
|
||||
$edit_post_cap = $post ? 'edit_post' : 'edit_posts';
|
||||
if (
|
||||
current_user_can( $edit_post_cap, $comment->comment_post_ID ) ||
|
||||
(
|
||||
empty( $post->post_password ) &&
|
||||
current_user_can( 'read_post', $comment->comment_post_ID )
|
||||
)
|
||||
) {
|
||||
// The user has access to the post
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
|
||||
$this->single_row_columns( $comment );
|
||||
echo "</tr>\n";
|
||||
|
||||
@@ -739,6 +739,20 @@ class WP_List_Table {
|
||||
$pending_comments_number
|
||||
);
|
||||
|
||||
$post_object = get_post( $post_id );
|
||||
$edit_post_cap = $post_object ? 'edit_post' : 'edit_posts';
|
||||
if (
|
||||
current_user_can( $edit_post_cap, $post_id ) ||
|
||||
(
|
||||
empty( $post_object->post_password ) &&
|
||||
current_user_can( 'read_post', $post_id )
|
||||
)
|
||||
) {
|
||||
// The user has access to the post and thus can see comments
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! $approved_comments && ! $pending_comments ) {
|
||||
// No comments at all.
|
||||
printf(
|
||||
|
||||
@@ -1085,7 +1085,17 @@ function wp_dashboard_recent_comments( $total_items = 5 ) {
|
||||
|
||||
echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
|
||||
foreach ( $comments as $comment ) {
|
||||
_wp_dashboard_recent_comments_row( $comment );
|
||||
|
||||
$comment_post = get_post( $comment->comment_post_ID );
|
||||
if (
|
||||
current_user_can( 'edit_post', $comment->comment_post_ID ) ||
|
||||
(
|
||||
empty( $comment_post->post_password ) &&
|
||||
current_user_can( 'read_post', $comment->comment_post_ID )
|
||||
)
|
||||
) {
|
||||
_wp_dashboard_recent_comments_row( $comment );
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
|
||||
|
||||
@@ -1302,7 +1302,7 @@ function wp_edit_attachments_query_vars( $q = false ) {
|
||||
|
||||
// Filter query clauses to include filenames.
|
||||
if ( isset( $q['s'] ) ) {
|
||||
add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
|
||||
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
|
||||
}
|
||||
|
||||
return $q;
|
||||
|
||||
@@ -599,6 +599,8 @@ Please click the following link to activate your user account:
|
||||
* Checks if the Authorize Application Password request is valid.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @since 6.2.0 Allow insecure HTTP connections for the local environment.
|
||||
* @since 6.3.2 Validates the success and reject URLs to prevent javascript pseudo protocol being executed.
|
||||
*
|
||||
* @param array $request {
|
||||
* The array of request data. All arguments are optional and may be empty.
|
||||
@@ -614,24 +616,22 @@ Please click the following link to activate your user account:
|
||||
function wp_is_authorize_application_password_request_valid( $request, $user ) {
|
||||
$error = new WP_Error();
|
||||
|
||||
if ( ! empty( $request['success_url'] ) ) {
|
||||
$scheme = wp_parse_url( $request['success_url'], PHP_URL_SCHEME );
|
||||
|
||||
if ( 'http' === $scheme ) {
|
||||
if ( isset( $request['success_url'] ) ) {
|
||||
$validated_success_url = wp_is_authorize_application_redirect_url_valid( $request['success_url'] );
|
||||
if ( is_wp_error( $validated_success_url ) ) {
|
||||
$error->add(
|
||||
'invalid_redirect_scheme',
|
||||
__( 'The success URL must be served over a secure connection.' )
|
||||
$validated_success_url->get_error_code(),
|
||||
$validated_success_url->get_error_message()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $request['reject_url'] ) ) {
|
||||
$scheme = wp_parse_url( $request['reject_url'], PHP_URL_SCHEME );
|
||||
|
||||
if ( 'http' === $scheme ) {
|
||||
if ( isset( $request['reject_url'] ) ) {
|
||||
$validated_reject_url = wp_is_authorize_application_redirect_url_valid( $request['reject_url'] );
|
||||
if ( is_wp_error( $validated_reject_url ) ) {
|
||||
$error->add(
|
||||
'invalid_redirect_scheme',
|
||||
__( 'The rejection URL must be served over a secure connection.' )
|
||||
$validated_reject_url->get_error_code(),
|
||||
$validated_reject_url->get_error_message()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -660,3 +660,59 @@ function wp_is_authorize_application_password_request_valid( $request, $user ) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the redirect URL protocol scheme. The protocol can be anything except http and javascript.
|
||||
*
|
||||
* @since 6.3.2
|
||||
*
|
||||
* @param string $url - The redirect URL to be validated.
|
||||
*
|
||||
* @return true|WP_Error True if the redirect URL is valid, a WP_Error object otherwise.
|
||||
*/
|
||||
function wp_is_authorize_application_redirect_url_valid( $url ) {
|
||||
$bad_protocols = array( 'javascript', 'data' );
|
||||
if ( empty( $url ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Based on https://www.rfc-editor.org/rfc/rfc2396#section-3.1
|
||||
$valid_scheme_regex = '/^[a-zA-Z][a-zA-Z0-9+.-]*:/';
|
||||
if ( ! preg_match( $valid_scheme_regex, $url ) ) {
|
||||
return new WP_Error(
|
||||
'invalid_redirect_url_format',
|
||||
__( 'Invalid URL format.' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the list of invalid protocols used in applications redirect URLs.
|
||||
*
|
||||
* @since 6.3.2
|
||||
*
|
||||
* @param string[] $bad_protocols Array of invalid protocols.
|
||||
* @param string $url The redirect URL to be validated.
|
||||
*/
|
||||
$invalid_protocols = array_map( 'strtolower', apply_filters( 'wp_authorize_application_redirect_url_invalid_protocols', $bad_protocols, $url ) );
|
||||
|
||||
$scheme = wp_parse_url( $url, PHP_URL_SCHEME );
|
||||
$host = wp_parse_url( $url, PHP_URL_HOST );
|
||||
$is_local = 'local' === wp_get_environment_type();
|
||||
|
||||
// validates if the proper URI format is applied to the $url
|
||||
if ( empty( $host ) || empty( $scheme ) || in_array( strtolower( $scheme ), $invalid_protocols, true ) ) {
|
||||
return new WP_Error(
|
||||
'invalid_redirect_url_format',
|
||||
__( 'Invalid URL format.' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'http' === $scheme && ! $is_local ) {
|
||||
return new WP_Error(
|
||||
'invalid_redirect_scheme',
|
||||
__( 'The URL must be served over a secure connection.' )
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ if ( ! empty( $invalid ) ) {
|
||||
/* translators: 1: Plugin file, 2: Error message. */
|
||||
__( 'The plugin %1$s has been deactivated due to an error: %2$s' ),
|
||||
'<code>' . esc_html( $plugin_file ) . '</code>',
|
||||
$error->get_error_message()
|
||||
esc_html( $error->get_error_message() )
|
||||
);
|
||||
echo '</p></div>';
|
||||
}
|
||||
@@ -676,7 +676,7 @@ elseif ( isset( $_GET['deleted'] ) ) :
|
||||
printf(
|
||||
/* translators: %s: Error message. */
|
||||
__( 'Plugin could not be deleted due to an error: %s' ),
|
||||
$delete_result->get_error_message()
|
||||
esc_html( $delete_result->get_error_message() )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
@@ -65,4 +65,8 @@ class Requests_Hooks implements Requests_Hooker {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,6 +705,20 @@ class Requests_IRI {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
$class_props = get_class_vars( __CLASS__ );
|
||||
$string_props = array( 'scheme', 'iuserinfo', 'ihost', 'port', 'ipath', 'iquery', 'ifragment' );
|
||||
$array_props = array( 'normalization' );
|
||||
foreach ( $class_props as $prop => $default_value ) {
|
||||
if ( in_array( $prop, $string_props, true ) && ! is_string( $this->$prop ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
} elseif ( in_array( $prop, $array_props, true ) && ! is_array( $this->$prop ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
$this->$prop = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the entire IRI. Returns true on success, false on failure (if there
|
||||
* are any invalid characters).
|
||||
|
||||
@@ -229,6 +229,10 @@ class Requests_Session {
|
||||
return Requests::request_multiple($requests, $options);
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a request's data with the default data
|
||||
*
|
||||
|
||||
@@ -237,12 +237,12 @@ function get_the_block_template_html() {
|
||||
|
||||
$content = $wp_embed->run_shortcode( $_wp_current_template_content );
|
||||
$content = $wp_embed->autoembed( $content );
|
||||
$content = shortcode_unautop( $content );
|
||||
$content = do_shortcode( $content );
|
||||
$content = do_blocks( $content );
|
||||
$content = wptexturize( $content );
|
||||
$content = convert_smilies( $content );
|
||||
$content = shortcode_unautop( $content );
|
||||
$content = wp_filter_content_tags( $content );
|
||||
$content = do_shortcode( $content );
|
||||
$content = str_replace( ']]>', ']]>', $content );
|
||||
|
||||
// Wrap block template in .wp-site-blocks to allow for specific descendant styles
|
||||
|
||||
@@ -628,6 +628,10 @@ function serialize_blocks( $blocks ) {
|
||||
function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols = array() ) {
|
||||
$result = '';
|
||||
|
||||
if ( false !== strpos( $text, '<!--' ) && false !== strpos( $text, '--->' ) ) {
|
||||
$text = preg_replace_callback( '%<!--(.*?)--->%', '_filter_block_content_callback', $text );
|
||||
}
|
||||
|
||||
$blocks = parse_blocks( $text );
|
||||
foreach ( $blocks as $block ) {
|
||||
$block = filter_block_kses( $block, $allowed_html, $allowed_protocols );
|
||||
@@ -637,6 +641,19 @@ function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback used for regular expression replacement in filter_block_content().
|
||||
*
|
||||
* @private
|
||||
* @since 6.2.1
|
||||
*
|
||||
* @param array $matches Array of preg_replace_callback matches.
|
||||
* @return string Replacement string.
|
||||
*/
|
||||
function _filter_block_content_callback( $matches ) {
|
||||
return '<!--' . rtrim( $matches[1], '-' ) . '-->';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters and sanitizes a parsed block to remove non-allowable HTML from block
|
||||
* attribute values.
|
||||
|
||||
@@ -46,7 +46,7 @@ function render_block_core_legacy_widget( $attributes ) {
|
||||
|
||||
if ( isset( $attributes['instance']['encoded'], $attributes['instance']['hash'] ) ) {
|
||||
$serialized_instance = base64_decode( $attributes['instance']['encoded'] );
|
||||
if ( wp_hash( $serialized_instance ) !== $attributes['instance']['hash'] ) {
|
||||
if ( ! hash_equals( wp_hash( $serialized_instance ), (string) $attributes['instance']['hash'] ) ) {
|
||||
return '';
|
||||
}
|
||||
$instance = unserialize( $serialized_instance );
|
||||
|
||||
@@ -549,13 +549,13 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
||||
</div>
|
||||
</div>
|
||||
</div>',
|
||||
$modal_unique_id,
|
||||
esc_attr( $modal_unique_id ),
|
||||
$inner_blocks_html,
|
||||
__( 'Open menu' ), // Open button label.
|
||||
__( 'Close menu' ), // Close button label.
|
||||
implode( ' ', $responsive_container_classes ),
|
||||
implode( ' ', $open_button_classes ),
|
||||
$colors['overlay_inline_styles'],
|
||||
esc_attr( implode( ' ', $responsive_container_classes ) ),
|
||||
esc_attr( implode( ' ', $open_button_classes ) ),
|
||||
esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ),
|
||||
__( 'Menu' )
|
||||
);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
|
||||
if ( ! empty( $attributes['scale'] ) ) {
|
||||
$image_styles .= "object-fit:{$attributes['scale']};";
|
||||
}
|
||||
$featured_image = str_replace( 'src=', "style='$image_styles' src=", $featured_image );
|
||||
$featured_image = str_replace( '<img ', '<img style="' . esc_attr( safecss_filter_attr( $image_styles ) ) . '" ', $featured_image );
|
||||
}
|
||||
|
||||
return "<figure $wrapper_attributes>$featured_image</figure>";
|
||||
|
||||
@@ -16,7 +16,7 @@ function render_block_core_rss( $attributes ) {
|
||||
$rss = fetch_feed( $attributes['feedURL'] );
|
||||
|
||||
if ( is_wp_error( $rss ) ) {
|
||||
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</div></div>';
|
||||
return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
|
||||
}
|
||||
|
||||
if ( ! $rss->get_item_quantity() ) {
|
||||
@@ -44,8 +44,8 @@ function render_block_core_rss( $attributes ) {
|
||||
if ( $date ) {
|
||||
$date = sprintf(
|
||||
'<time datetime="%1$s" class="wp-block-rss__item-publish-date">%2$s</time> ',
|
||||
date_i18n( get_option( 'c' ), $date ),
|
||||
date_i18n( get_option( 'date_format' ), $date )
|
||||
esc_attr( date_i18n( get_option( 'c' ), $date ) ),
|
||||
esc_attr( date_i18n( get_option( 'date_format' ), $date ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,12 +276,12 @@ function styles_for_block_core_search( $attributes ) {
|
||||
// Add color styles.
|
||||
$has_text_color = ! empty( $attributes['style']['color']['text'] );
|
||||
if ( $has_text_color ) {
|
||||
$button_styles[] = sprintf( 'color: %s;', esc_attr( $attributes['style']['color']['text'] ) );
|
||||
$button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
|
||||
}
|
||||
|
||||
$has_background_color = ! empty( $attributes['style']['color']['background'] );
|
||||
if ( $has_background_color ) {
|
||||
$button_styles[] = sprintf( 'background-color: %s;', esc_attr( $attributes['style']['color']['background'] ) );
|
||||
$button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
|
||||
}
|
||||
|
||||
$has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
|
||||
@@ -290,9 +290,9 @@ function styles_for_block_core_search( $attributes ) {
|
||||
}
|
||||
|
||||
return array(
|
||||
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
|
||||
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
|
||||
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
|
||||
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '',
|
||||
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '',
|
||||
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,14 +128,14 @@ function render_block_core_template_part( $attributes ) {
|
||||
}
|
||||
|
||||
// Run through the actions that are typically taken on the_content.
|
||||
$content = shortcode_unautop( $content );
|
||||
$content = do_shortcode( $content );
|
||||
$seen_ids[ $template_part_id ] = true;
|
||||
$content = do_blocks( $content );
|
||||
unset( $seen_ids[ $template_part_id ] );
|
||||
$content = wptexturize( $content );
|
||||
$content = convert_smilies( $content );
|
||||
$content = shortcode_unautop( $content );
|
||||
$content = wp_filter_content_tags( $content );
|
||||
$content = do_shortcode( $content );
|
||||
|
||||
// Handle embeds for block template parts.
|
||||
global $wp_embed;
|
||||
|
||||
@@ -28,7 +28,7 @@ function render_block_core_widget_group( $attributes, $content, $block ) {
|
||||
$html = '';
|
||||
|
||||
if ( ! empty( $attributes['title'] ) ) {
|
||||
$html .= $before_title . $attributes['title'] . $after_title;
|
||||
$html .= $before_title . esc_html( $attributes['title'] ) . $after_title;
|
||||
}
|
||||
|
||||
$html .= '<div class="wp-widget-group__inner-blocks">';
|
||||
|
||||
@@ -307,7 +307,7 @@ function get_bookmarks( $args = '' ) {
|
||||
$query .= " $exclusions $inclusions $search";
|
||||
$query .= " ORDER BY $orderby $order";
|
||||
if ( -1 != $parsed_args['limit'] ) {
|
||||
$query .= ' LIMIT ' . $parsed_args['limit'];
|
||||
$query .= ' LIMIT ' . absint( $parsed_args['limit'] );
|
||||
}
|
||||
|
||||
$results = $wpdb->get_results( $query );
|
||||
|
||||
@@ -156,6 +156,21 @@ final class WP_Block_Patterns_Registry {
|
||||
return isset( $this->registered_patterns[ $pattern_name ] );
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
if ( ! $this->registered_patterns ) {
|
||||
return;
|
||||
}
|
||||
if ( ! is_array( $this->registered_patterns ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
foreach ( $this->registered_patterns as $value ) {
|
||||
if ( ! is_array( $value ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
}
|
||||
$this->registered_patterns_outside_init = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to retrieve the main instance of the class.
|
||||
*
|
||||
|
||||
@@ -167,6 +167,20 @@ final class WP_Block_Type_Registry {
|
||||
return isset( $this->registered_block_types[ $name ] );
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
if ( ! $this->registered_block_types ) {
|
||||
return;
|
||||
}
|
||||
if ( ! is_array( $this->registered_block_types ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
foreach ( $this->registered_block_types as $value ) {
|
||||
if ( ! $value instanceof WP_Block_Type ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to retrieve the main instance of the class.
|
||||
*
|
||||
|
||||
@@ -149,8 +149,8 @@ class WP_Date_Query {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] ) ) {
|
||||
$this->relation = 'OR';
|
||||
if ( isset( $date_query['relation'] ) ) {
|
||||
$this->relation = $this->sanitize_relation( $date_query['relation'] );
|
||||
} else {
|
||||
$this->relation = 'AND';
|
||||
}
|
||||
@@ -219,6 +219,9 @@ class WP_Date_Query {
|
||||
$this->validate_date_values( $queries );
|
||||
}
|
||||
|
||||
// Sanitize the relation parameter.
|
||||
$queries['relation'] = $this->sanitize_relation( $queries['relation'] );
|
||||
|
||||
foreach ( $queries as $key => $q ) {
|
||||
if ( ! is_array( $q ) || in_array( $key, $this->time_keys, true ) ) {
|
||||
// This is a first-order query. Trust the values and sanitize when building SQL.
|
||||
@@ -1040,4 +1043,20 @@ class WP_Date_Query {
|
||||
|
||||
return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a 'relation' operator.
|
||||
*
|
||||
* @since 6.0.3
|
||||
*
|
||||
* @param string $relation Raw relation key from the query argument.
|
||||
* @return string Sanitized relation ('AND' or 'OR').
|
||||
*/
|
||||
public function sanitize_relation( $relation ) {
|
||||
if ( 'OR' === strtoupper( $relation ) ) {
|
||||
return 'OR';
|
||||
} else {
|
||||
return 'AND';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +444,13 @@ class WP_Query {
|
||||
*/
|
||||
public $thumbnails_cached = false;
|
||||
|
||||
/**
|
||||
* Controls whether an attachment query should include filenames or not.
|
||||
*
|
||||
* @since 6.0.3
|
||||
* @var bool
|
||||
*/
|
||||
protected $allow_query_attachment_by_filename = false;
|
||||
/**
|
||||
* Cached list of search stopwords.
|
||||
*
|
||||
@@ -1414,7 +1421,12 @@ class WP_Query {
|
||||
}
|
||||
|
||||
$like = $n . $wpdb->esc_like( $term ) . $n;
|
||||
$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like );
|
||||
|
||||
if ( ! empty( $this->allow_query_attachment_by_filename ) ) {
|
||||
$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s) $andor_op (sq1.meta_value $like_op %s))", $like, $like, $like, $like );
|
||||
} else {
|
||||
$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like );
|
||||
}
|
||||
$searchand = ' AND ';
|
||||
}
|
||||
|
||||
@@ -1809,6 +1821,16 @@ class WP_Query {
|
||||
// Fill again in case 'pre_get_posts' unset some vars.
|
||||
$q = $this->fill_query_vars( $q );
|
||||
|
||||
/**
|
||||
* Filters whether an attachment query should include filenames or not.
|
||||
*
|
||||
* @since 6.0.3
|
||||
*
|
||||
* @param bool $allow_query_attachment_by_filename Whether or not to include filenames.
|
||||
*/
|
||||
$this->allow_query_attachment_by_filename = apply_filters( 'wp_allow_query_attachment_by_filename', false );
|
||||
remove_all_filters( 'wp_allow_query_attachment_by_filename' );
|
||||
|
||||
// Parse meta query.
|
||||
$this->meta_query = new WP_Meta_Query();
|
||||
$this->meta_query->parse_query_vars( $q );
|
||||
@@ -2240,7 +2262,7 @@ class WP_Query {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) ) {
|
||||
if ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) || ! empty( $this->allow_query_attachment_by_filename ) ) {
|
||||
$groupby = "{$wpdb->posts}.ID";
|
||||
}
|
||||
|
||||
@@ -2317,6 +2339,10 @@ class WP_Query {
|
||||
}
|
||||
$where .= $search . $whichauthor . $whichmimetype;
|
||||
|
||||
if ( ! empty( $this->allow_query_attachment_by_filename ) ) {
|
||||
$join .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
|
||||
}
|
||||
|
||||
if ( ! empty( $this->meta_query->queries ) ) {
|
||||
$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );
|
||||
$join .= $clauses['join'];
|
||||
|
||||
@@ -704,6 +704,28 @@ final class WP_Theme implements ArrayAccess {
|
||||
return isset( $this->parent ) ? $this->parent : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform reinitialization tasks.
|
||||
*
|
||||
* Prevents a callback from being injected during unserialization of an object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __wakeup() {
|
||||
if ( $this->parent && ! $this->parent instanceof self ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
if ( $this->headers && ! is_array( $this->headers ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
foreach ( $this->headers as $value ) {
|
||||
if ( ! is_string( $value ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
}
|
||||
$this->headers_sanitized = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds theme data to cache.
|
||||
*
|
||||
@@ -1763,4 +1785,16 @@ final class WP_Theme implements ArrayAccess {
|
||||
private static function _name_sort_i18n( $a, $b ) {
|
||||
return strnatcasecmp( $a->name_translated, $b->name_translated );
|
||||
}
|
||||
|
||||
private static function _check_headers_property_has_correct_type( $headers ) {
|
||||
if ( ! is_array( $headers ) ) {
|
||||
return false;
|
||||
}
|
||||
foreach ( $headers as $key => $value ) {
|
||||
if ( ! is_string( $key ) || ! is_string( $value ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2486,6 +2486,15 @@ function wp_update_comment( $commentarr, $wp_error = false ) {
|
||||
}
|
||||
}
|
||||
|
||||
$filter_comment = false;
|
||||
if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
|
||||
$filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
|
||||
}
|
||||
|
||||
if ( $filter_comment ) {
|
||||
add_filter( 'pre_comment_content', 'wp_filter_kses' );
|
||||
}
|
||||
|
||||
// Escape data pulled from DB.
|
||||
$comment = wp_slash( $comment );
|
||||
|
||||
@@ -2496,6 +2505,10 @@ function wp_update_comment( $commentarr, $wp_error = false ) {
|
||||
|
||||
$commentarr = wp_filter_comment( $commentarr );
|
||||
|
||||
if ( $filter_comment ) {
|
||||
remove_filter( 'pre_comment_content', 'wp_filter_kses' );
|
||||
}
|
||||
|
||||
// Now extract the merged array.
|
||||
$data = wp_unslash( $commentarr );
|
||||
|
||||
|
||||
@@ -130,10 +130,10 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
|
||||
<# } else { #>
|
||||
|
||||
<button type="button" class="choice thumbnail"
|
||||
data-customize-image-value="{{{data.header.url}}}"
|
||||
data-customize-image-value="{{data.header.url}}"
|
||||
data-customize-header-image-data="{{JSON.stringify(data.header)}}">
|
||||
<span class="screen-reader-text"><?php _e( 'Set image' ); ?></span>
|
||||
<img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" />
|
||||
<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />
|
||||
</button>
|
||||
|
||||
<# if ( data.type === 'uploaded' ) { #>
|
||||
@@ -158,7 +158,7 @@ class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
|
||||
|
||||
<# } else { #>
|
||||
|
||||
<img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" />
|
||||
<img src="{{data.header.thumbnail_url}}" alt="{{data.header.alt_text || data.header.description}}" />
|
||||
|
||||
<# } #>
|
||||
<# } else { #>
|
||||
|
||||
@@ -68,7 +68,7 @@ class WP_Customize_Site_Icon_Control extends WP_Customize_Cropped_Image_Control
|
||||
<div class="favicon">
|
||||
<img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>" />
|
||||
</div>
|
||||
<span class="browser-title" aria-hidden="true"><# print( '<?php bloginfo( 'name' ); ?>' ) #></span>
|
||||
<span class="browser-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></span>
|
||||
</div>
|
||||
<img class="app-icon-preview" src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>" />
|
||||
</div>
|
||||
|
||||
@@ -4225,3 +4225,21 @@ function wp_render_duotone_filter_preset( $preset ) {
|
||||
_deprecated_function( __FUNCTION__, '5.9.1', 'wp_get_duotone_filter_property()' );
|
||||
return wp_get_duotone_filter_property( $preset );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the SQL clauses of an attachment query to include filenames.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @deprecated 6.0.3
|
||||
* @access private
|
||||
*
|
||||
* @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
|
||||
* DISTINCT, fields (SELECT), and LIMITS clauses.
|
||||
* @return array The unmodified clauses.
|
||||
*/
|
||||
function _filter_query_attachment_filenames( $clauses ) {
|
||||
_deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )');
|
||||
remove_filter( 'posts_clauses', __FUNCTION__ );
|
||||
return $clauses;
|
||||
}
|
||||
|
||||
|
||||
@@ -2408,6 +2408,29 @@ function sanitize_html_class( $class, $fallback = '' ) {
|
||||
return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips out all characters not allowed in a locale name.
|
||||
*
|
||||
* @since 6.2.1
|
||||
*
|
||||
* @param string $locale_name The locale name to be sanitized.
|
||||
* @return string The sanitized value.
|
||||
*/
|
||||
function sanitize_locale_name( $locale_name ) {
|
||||
// Limit to A-Z, a-z, 0-9, '_', '-'.
|
||||
$sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $locale_name );
|
||||
|
||||
/**
|
||||
* Filters a sanitized locale name string.
|
||||
*
|
||||
* @since 6.2.1
|
||||
*
|
||||
* @param string $sanitized The sanitized locale name.
|
||||
* @param string $locale_name The locale name before sanitization.
|
||||
*/
|
||||
return apply_filters( 'sanitize_locale_name', $sanitized, $locale_name );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts lone & characters into `&` (a.k.a. `&`)
|
||||
*
|
||||
|
||||
@@ -3528,10 +3528,12 @@ function wp_nonce_ays( $action ) {
|
||||
} else {
|
||||
$html = __( 'The link you followed has expired.' );
|
||||
if ( wp_get_referer() ) {
|
||||
$wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
|
||||
$wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) );
|
||||
$html .= '</p><p>';
|
||||
$html .= sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( remove_query_arg( 'updated', wp_get_referer() ) ),
|
||||
esc_url( $wp_http_referer ),
|
||||
__( 'Please try again.' )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -824,6 +824,7 @@ VideoDetails = MediaDetails.extend(/** @lends wp.media.view.MediaFrame.VideoDeta
|
||||
|
||||
wp.ajax.send( 'set-attachment-thumbnail', {
|
||||
data : {
|
||||
_ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail,
|
||||
urls: urls,
|
||||
thumbnail_id: attachment.get( 'id' )
|
||||
}
|
||||
|
||||
2
wp-includes/js/media-audiovideo.min.js
vendored
2
wp-includes/js/media-audiovideo.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -49,6 +49,7 @@
|
||||
|
||||
var iframes = document.querySelectorAll( 'iframe[data-secret="' + data.secret + '"]' ),
|
||||
blockquotes = document.querySelectorAll( 'blockquote[data-secret="' + data.secret + '"]' ),
|
||||
allowedProtocols = new RegExp( '^https?:$', 'i' ),
|
||||
i, source, height, sourceURL, targetURL;
|
||||
|
||||
for ( i = 0; i < blockquotes.length; i++ ) {
|
||||
@@ -84,6 +85,11 @@
|
||||
sourceURL.href = source.getAttribute( 'src' );
|
||||
targetURL.href = data.value;
|
||||
|
||||
/* Only follow link if the protocol is in the allow list. */
|
||||
if ( ! allowedProtocols.test( targetURL.protocol ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Only continue if link hostname matches iframe's hostname. */
|
||||
if ( targetURL.host === sourceURL.host ) {
|
||||
if ( document.activeElement === source ) {
|
||||
|
||||
2
wp-includes/js/wp-embed.min.js
vendored
2
wp-includes/js/wp-embed.min.js
vendored
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(c,d){"use strict";var e=!1,o=!1;if(d.querySelector)if(c.addEventListener)e=!0;if(c.wp=c.wp||{},!c.wp.receiveEmbedMessage)if(c.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){for(var r,a,i,s=d.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=d.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=0;o<n.length;o++)n[o].style.display="none";for(o=0;o<s.length;o++)if(r=s[o],e.source===r.contentWindow){if(r.removeAttribute("style"),"height"===t.message){if(1e3<(i=parseInt(t.value,10)))i=1e3;else if(~~i<200)i=200;r.height=i}if("link"===t.message)if(a=d.createElement("a"),i=d.createElement("a"),a.href=r.getAttribute("src"),i.href=t.value,i.host===a.host)if(d.activeElement===r)c.top.location.href=t.value}}},e)c.addEventListener("message",c.wp.receiveEmbedMessage,!1),d.addEventListener("DOMContentLoaded",t,!1),c.addEventListener("load",t,!1);function t(){if(!o){o=!0;for(var e,t,r,a=-1!==navigator.appVersion.indexOf("MSIE 10"),i=!!navigator.userAgent.match(/Trident.*rv:11\./),s=d.querySelectorAll("iframe.wp-embedded-content"),n=0;n<s.length;n++){if(!(r=(t=s[n]).getAttribute("data-secret")))r=Math.random().toString(36).substr(2,10),t.src+="#?secret="+r,t.setAttribute("data-secret",r);if(a||i)(e=t.cloneNode(!0)).removeAttribute("security"),t.parentNode.replaceChild(e,t);t.contentWindow.postMessage({message:"ready",secret:r},"*")}}}}(window,document);
|
||||
!function(d,l){"use strict";var e=!1,o=!1;if(l.querySelector)if(d.addEventListener)e=!0;if(d.wp=d.wp||{},!d.wp.receiveEmbedMessage)if(d.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){for(var r,a,i,s=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),n=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),o=new RegExp("^https?:$","i"),c=0;c<n.length;c++)n[c].style.display="none";for(c=0;c<s.length;c++)if(r=s[c],e.source===r.contentWindow){if(r.removeAttribute("style"),"height"===t.message){if(1e3<(i=parseInt(t.value,10)))i=1e3;else if(~~i<200)i=200;r.height=i}if("link"===t.message)if(a=l.createElement("a"),i=l.createElement("a"),a.href=r.getAttribute("src"),i.href=t.value,o.test(i.protocol))if(i.host===a.host)if(l.activeElement===r)d.top.location.href=t.value}}},e)d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",t,!1),d.addEventListener("load",t,!1);function t(){if(!o){o=!0;for(var e,t,r,a=-1!==navigator.appVersion.indexOf("MSIE 10"),i=!!navigator.userAgent.match(/Trident.*rv:11\./),s=l.querySelectorAll("iframe.wp-embedded-content"),n=0;n<s.length;n++){if(!(r=(t=s[n]).getAttribute("data-secret")))r=Math.random().toString(36).substr(2,10),t.src+="#?secret="+r,t.setAttribute("data-secret",r);if(a||i)(e=t.cloneNode(!0)).removeAttribute("security"),t.parentNode.replaceChild(e,t);t.contentWindow.postMessage({message:"ready",secret:r},"*")}}}}(window,document);
|
||||
@@ -2415,6 +2415,7 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
|
||||
'direction',
|
||||
'float',
|
||||
'list-style-type',
|
||||
'object-fit',
|
||||
'object-position',
|
||||
'overflow',
|
||||
'vertical-align',
|
||||
|
||||
@@ -147,9 +147,9 @@ function determine_locale() {
|
||||
$wp_lang = '';
|
||||
|
||||
if ( ! empty( $_GET['wp_lang'] ) ) {
|
||||
$wp_lang = sanitize_text_field( $_GET['wp_lang'] );
|
||||
$wp_lang = sanitize_locale_name( wp_unslash( $_GET['wp_lang'] ) );
|
||||
} elseif ( ! empty( $_COOKIE['wp_lang'] ) ) {
|
||||
$wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] );
|
||||
$wp_lang = sanitize_locale_name( wp_unslash( $_COOKIE['wp_lang'] ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
|
||||
|
||||
@@ -1493,7 +1493,7 @@ function wp_print_media_templates() {
|
||||
<div class="favicon">
|
||||
<img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>" />
|
||||
</div>
|
||||
<span class="browser-title" aria-hidden="true"><# print( '<?php bloginfo( 'name' ); ?>' ) #></span>
|
||||
<span class="browser-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></span>
|
||||
</div>
|
||||
|
||||
<strong aria-hidden="true"><?php _e( 'As an app icon' ); ?></strong>
|
||||
|
||||
@@ -2354,6 +2354,7 @@ function gallery_shortcode( $attr ) {
|
||||
$attachments[ $val->ID ] = $_attachments[ $key ];
|
||||
}
|
||||
} elseif ( ! empty( $atts['exclude'] ) ) {
|
||||
$post_parent_id = $id;
|
||||
$attachments = get_children(
|
||||
array(
|
||||
'post_parent' => $id,
|
||||
@@ -2366,6 +2367,7 @@ function gallery_shortcode( $attr ) {
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$post_parent_id = $id;
|
||||
$attachments = get_children(
|
||||
array(
|
||||
'post_parent' => $id,
|
||||
@@ -2378,6 +2380,17 @@ function gallery_shortcode( $attr ) {
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $post_parent_id ) ) {
|
||||
$post_parent = get_post( $post_parent_id );
|
||||
|
||||
// terminate the shortcode execution if user cannot read the post or password-protected
|
||||
if (
|
||||
( ! is_post_publicly_viewable( $post_parent->ID ) && ! current_user_can( 'read_post', $post_parent->ID ) )
|
||||
|| post_password_required( $post_parent ) ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $attachments ) ) {
|
||||
return '';
|
||||
}
|
||||
@@ -2704,6 +2717,15 @@ function wp_playlist_shortcode( $attr ) {
|
||||
$attachments = get_children( $args );
|
||||
}
|
||||
|
||||
if ( ! empty( $args['post_parent'] ) ) {
|
||||
$post_parent = get_post( $id );
|
||||
|
||||
// terminate the shortcode execution if user cannot read the post or password-protected
|
||||
if ( ! current_user_can( 'read_post', $post_parent->ID ) || post_password_required( $post_parent ) ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $attachments ) ) {
|
||||
return '';
|
||||
}
|
||||
@@ -4388,7 +4410,8 @@ function wp_enqueue_media( $args = array() ) {
|
||||
/** This filter is documented in wp-admin/includes/media.php */
|
||||
'captions' => ! apply_filters( 'disable_captions', '' ),
|
||||
'nonce' => array(
|
||||
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
||||
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
||||
'setAttachmentThumbnail' => wp_create_nonce( 'set-attachment-thumbnail' ),
|
||||
),
|
||||
'post' => array(
|
||||
'id' => 0,
|
||||
|
||||
@@ -91,7 +91,6 @@ if ( ! function_exists( 'get_user_by' ) ) :
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @since 4.4.0 Added 'ID' as an alias of 'id' for the `$field` parameter.
|
||||
* @since 5.8.0 Returns the global `$current_user` if it's the user being fetched.
|
||||
*
|
||||
* @global WP_User $current_user The current user object which holds the user data.
|
||||
*
|
||||
@@ -100,18 +99,12 @@ if ( ! function_exists( 'get_user_by' ) ) :
|
||||
* @return WP_User|false WP_User object on success, false on failure.
|
||||
*/
|
||||
function get_user_by( $field, $value ) {
|
||||
global $current_user;
|
||||
|
||||
$userdata = WP_User::get_data_by( $field, $value );
|
||||
|
||||
if ( ! $userdata ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $current_user instanceof WP_User && $current_user->ID === (int) $userdata->ID ) {
|
||||
return $current_user;
|
||||
}
|
||||
|
||||
$user = new WP_User;
|
||||
$user->init( $userdata );
|
||||
|
||||
@@ -361,6 +354,8 @@ if ( ! function_exists( 'wp_mail' ) ) :
|
||||
$phpmailer->clearAttachments();
|
||||
$phpmailer->clearCustomHeaders();
|
||||
$phpmailer->clearReplyTos();
|
||||
$phpmailer->Body = '';
|
||||
$phpmailer->AltBody = '';
|
||||
|
||||
// Set "From" name and email.
|
||||
|
||||
|
||||
@@ -1088,9 +1088,10 @@ function post_custom( $key = '' ) {
|
||||
*
|
||||
* @since 1.2.0
|
||||
*
|
||||
* @internal This will probably change at some point...
|
||||
* @deprecated 6.0.2 Use get_post_meta() to retrieve post meta and render manually.
|
||||
*/
|
||||
function the_meta() {
|
||||
_deprecated_function( __FUNCTION__, '6.0.2', 'get_post_meta()' );
|
||||
$keys = get_post_custom_keys();
|
||||
if ( $keys ) {
|
||||
$li_html = '';
|
||||
@@ -1106,8 +1107,8 @@ function the_meta() {
|
||||
$html = sprintf(
|
||||
"<li><span class='post-meta-key'>%s</span> %s</li>\n",
|
||||
/* translators: %s: Post custom field name. */
|
||||
sprintf( _x( '%s:', 'Post custom field name' ), $key ),
|
||||
$value
|
||||
esc_html( sprintf( _x( '%s:', 'Post custom field name' ), $key ) ),
|
||||
esc_html( $value )
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -7926,36 +7926,6 @@ function wp_add_trashed_suffix_to_post_name_for_post( $post ) {
|
||||
return $post_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the SQL clauses of an attachment query to include filenames.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access private
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
|
||||
* DISTINCT, fields (SELECT), and LIMITS clauses.
|
||||
* @return string[] The modified array of clauses.
|
||||
*/
|
||||
function _filter_query_attachment_filenames( $clauses ) {
|
||||
global $wpdb;
|
||||
remove_filter( 'posts_clauses', __FUNCTION__ );
|
||||
|
||||
// Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.
|
||||
$clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";
|
||||
|
||||
$clauses['groupby'] = "{$wpdb->posts}.ID";
|
||||
|
||||
$clauses['where'] = preg_replace(
|
||||
"/\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\'[^']+\')\)/",
|
||||
'$0 OR ( sq1.meta_value $1 $2 )',
|
||||
$clauses['where']
|
||||
);
|
||||
|
||||
return $clauses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last changed time for the 'posts' cache group.
|
||||
*
|
||||
|
||||
@@ -1044,6 +1044,7 @@ function rest_cookie_check_errors( $result ) {
|
||||
$result = wp_verify_nonce( $nonce, 'wp_rest' );
|
||||
|
||||
if ( ! $result ) {
|
||||
add_filter( 'rest_send_nocache_headers', '__return_true', 20 );
|
||||
return new WP_Error( 'rest_cookie_invalid_nonce', __( 'Cookie check failed' ), array( 'status' => 403 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -330,24 +330,6 @@ class WP_REST_Server {
|
||||
|
||||
$this->send_header( 'Access-Control-Allow-Headers', implode( ', ', $allow_headers ) );
|
||||
|
||||
/**
|
||||
* Filters whether to send nocache headers on a REST API request.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param bool $rest_send_nocache_headers Whether to send no-cache headers.
|
||||
*/
|
||||
$send_no_cache_headers = apply_filters( 'rest_send_nocache_headers', is_user_logged_in() );
|
||||
if ( $send_no_cache_headers ) {
|
||||
foreach ( wp_get_nocache_headers() as $header => $header_value ) {
|
||||
if ( empty( $header_value ) ) {
|
||||
$this->remove_header( $header );
|
||||
} else {
|
||||
$this->send_header( $header, $header_value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters whether the REST API is enabled.
|
||||
*
|
||||
@@ -402,10 +384,12 @@ class WP_REST_Server {
|
||||
* $_GET['_method']. If that is not set, we check for the HTTP_X_HTTP_METHOD_OVERRIDE
|
||||
* header.
|
||||
*/
|
||||
$method_overridden = false;
|
||||
if ( isset( $_GET['_method'] ) ) {
|
||||
$request->set_method( $_GET['_method'] );
|
||||
} elseif ( isset( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ) {
|
||||
$request->set_method( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] );
|
||||
$method_overridden = true;
|
||||
}
|
||||
|
||||
$result = $this->check_authentication();
|
||||
@@ -464,6 +448,28 @@ class WP_REST_Server {
|
||||
*/
|
||||
$served = apply_filters( 'rest_pre_serve_request', false, $result, $request, $this );
|
||||
|
||||
/**
|
||||
* Filters whether to send nocache headers on a REST API request.
|
||||
*
|
||||
* @since 4.4.0
|
||||
* @since 6.x.x Moved the block to catch the filter added on rest_cookie_check_errors() from rest-api.php
|
||||
*
|
||||
* @param bool $rest_send_nocache_headers Whether to send no-cache headers.
|
||||
*/
|
||||
$send_no_cache_headers = apply_filters( 'rest_send_nocache_headers', is_user_logged_in() );
|
||||
|
||||
// send no cache headers if the $send_no_cache_headers is true
|
||||
// OR if the HTTP_X_HTTP_METHOD_OVERRIDE is used but resulted a 4xx response code.
|
||||
if ( $send_no_cache_headers || ( true === $method_overridden && strpos( $code, '4' ) === 0 ) ) {
|
||||
foreach ( wp_get_nocache_headers() as $header => $header_value ) {
|
||||
if ( empty( $header_value ) ) {
|
||||
$this->remove_header( $header );
|
||||
} else {
|
||||
$this->send_header( $header, $header_value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $served ) {
|
||||
if ( 'HEAD' === $request->get_method() ) {
|
||||
return null;
|
||||
|
||||
@@ -97,7 +97,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
|
||||
// Filter query clauses to include filenames.
|
||||
if ( isset( $query_args['s'] ) ) {
|
||||
add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
|
||||
add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' );
|
||||
}
|
||||
|
||||
return $query_args;
|
||||
|
||||
@@ -213,7 +213,7 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller {
|
||||
'title' => sanitize_text_field( $raw_pattern->title->rendered ),
|
||||
'content' => wp_kses_post( $raw_pattern->pattern_content ),
|
||||
'categories' => array_map( 'sanitize_title', $raw_pattern->category_slugs ),
|
||||
'keywords' => array_map( 'sanitize_title', $raw_pattern->keyword_slugs ),
|
||||
'keywords' => array_map( 'sanitize_text_field', explode( ',', $raw_pattern->meta->wpop_keywords ) ),
|
||||
'description' => sanitize_text_field( $raw_pattern->meta->wpop_description ),
|
||||
'viewport_width' => absint( $raw_pattern->meta->wpop_viewport_width ),
|
||||
);
|
||||
@@ -281,7 +281,7 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller {
|
||||
),
|
||||
|
||||
'keywords' => array(
|
||||
'description' => __( "The pattern's keyword slugs." ),
|
||||
'description' => __( "The pattern's keywords." ),
|
||||
'type' => 'array',
|
||||
'uniqueItems' => true,
|
||||
'items' => array( 'type' => 'string' ),
|
||||
|
||||
@@ -144,6 +144,35 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the terms for a post can be read.
|
||||
*
|
||||
* @since 6.0.3
|
||||
*
|
||||
* @param WP_Post $post Post object.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return bool Whether the terms for the post can be read.
|
||||
*/
|
||||
public function check_read_terms_permission_for_post( $post, $request ) {
|
||||
// If the requested post isn't associated with this taxonomy, deny access.
|
||||
if ( ! is_object_in_taxonomy( $post->post_type, $this->taxonomy ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Grant access if the post is publicly viewable.
|
||||
if ( is_post_publicly_viewable( $post ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise grant access if the post is readable by the logged in user.
|
||||
if ( current_user_can( 'read_post', $post->ID ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, deny access.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a request has access to read terms in the specified taxonomy.
|
||||
*
|
||||
@@ -167,6 +196,30 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $request['post'] ) ) {
|
||||
$post = get_post( $request['post'] );
|
||||
|
||||
if ( ! $post ) {
|
||||
return new WP_Error(
|
||||
'rest_post_invalid_id',
|
||||
__( 'Invalid post ID.' ),
|
||||
array(
|
||||
'status' => 400,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! $this->check_read_terms_permission_for_post( $post, $request ) ) {
|
||||
return new WP_Error(
|
||||
'rest_forbidden_context',
|
||||
__( 'Sorry, you are not allowed to view terms for this post.' ),
|
||||
array(
|
||||
'status' => rest_authorization_required_code(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -318,6 +318,9 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
}
|
||||
|
||||
if ( ! empty( $prepared_args['search'] ) ) {
|
||||
if ( ! current_user_can( 'list_users' ) ) {
|
||||
$prepared_args['search_columns'] = array( 'ID', 'user_login', 'user_nicename', 'display_name' );
|
||||
}
|
||||
$prepared_args['search'] = '*' . $prepared_args['search'] . '*';
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -170,7 +170,45 @@ function has_shortcode( $content, $tag ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Search content for shortcodes and filter shortcodes through their hooks.
|
||||
* Returns a list of registered shortcode names found in the given content.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* get_shortcode_tags_in_content( '[audio src="file.mp3"][/audio] [foo] [gallery ids="1,2,3"]' );
|
||||
* // array( 'audio', 'gallery' )
|
||||
*
|
||||
* @since 6.3.2
|
||||
*
|
||||
* @param string $content The content to check.
|
||||
* @return string[] An array of registered shortcode names found in the content.
|
||||
*/
|
||||
function get_shortcode_tags_in_content( $content ) {
|
||||
if ( false === strpos( $content, '[' ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER );
|
||||
if ( empty( $matches ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$tags = array();
|
||||
foreach ( $matches as $shortcode ) {
|
||||
$tags[] = $shortcode[2];
|
||||
|
||||
if ( ! empty( $shortcode[5] ) ) {
|
||||
$deep_tags = get_shortcode_tags_in_content( $shortcode[5] );
|
||||
if ( ! empty( $deep_tags ) ) {
|
||||
$tags = array_merge( $tags, $deep_tags );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches content for shortcodes and filter shortcodes through their hooks.
|
||||
*
|
||||
* This function is an alias for do_shortcode().
|
||||
*
|
||||
|
||||
@@ -1710,15 +1710,10 @@ function update_user_caches( $user ) {
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.4.0 'clean_user_cache' action was added.
|
||||
* @since 5.8.0 Refreshes the global user instance if cleaning the user cache for the current user.
|
||||
*
|
||||
* @global WP_User $current_user The current user object which holds the user data.
|
||||
*
|
||||
* @param WP_User|int $user User object or ID to be cleaned from the cache
|
||||
*/
|
||||
function clean_user_cache( $user ) {
|
||||
global $current_user;
|
||||
|
||||
if ( is_numeric( $user ) ) {
|
||||
$user = new WP_User( $user );
|
||||
}
|
||||
@@ -1741,13 +1736,6 @@ function clean_user_cache( $user ) {
|
||||
* @param WP_User $user User object.
|
||||
*/
|
||||
do_action( 'clean_user_cache', $user->ID, $user );
|
||||
|
||||
// Refresh the global user instance if the cleaning current user.
|
||||
if ( get_current_user_id() === (int) $user->ID ) {
|
||||
$user_id = (int) $user->ID;
|
||||
$current_user = null;
|
||||
wp_set_current_user( $user_id, '' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9.3';
|
||||
$wp_version = '5.9.8';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
@@ -1578,7 +1578,7 @@ function wp_widget_rss_output( $rss, $args = array() ) {
|
||||
|
||||
if ( is_wp_error( $rss ) ) {
|
||||
if ( is_admin() || current_user_can( 'manage_options' ) ) {
|
||||
echo '<p><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</p>';
|
||||
echo '<p><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</p>';
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1701,7 +1701,7 @@ function wp_widget_rss_form( $args, $inputs = null ) {
|
||||
$args['show_date'] = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date'];
|
||||
|
||||
if ( ! empty( $args['error'] ) ) {
|
||||
echo '<p class="widget-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $args['error'] . '</p>';
|
||||
echo '<p class="widget-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $args['error'] ) . '</p>';
|
||||
}
|
||||
|
||||
$esc_number = esc_attr( $args['number'] );
|
||||
|
||||
@@ -65,6 +65,9 @@ if ( 0 === $count ) {
|
||||
wp_die( __( 'There doesn’t seem to be any new mail.' ) );
|
||||
}
|
||||
|
||||
// Always run as an unauthenticated user.
|
||||
wp_set_current_user( 0 );
|
||||
|
||||
for ( $i = 1; $i <= $count; $i++ ) {
|
||||
|
||||
$message = $pop3->get( $i );
|
||||
@@ -134,8 +137,6 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
||||
}
|
||||
$author = sanitize_email( $author );
|
||||
if ( is_email( $author ) ) {
|
||||
/* translators: %s: Post author email address. */
|
||||
echo '<p>' . sprintf( __( 'Author is %s' ), $author ) . '</p>';
|
||||
$userdata = get_user_by( 'email', $author );
|
||||
if ( ! empty( $userdata ) ) {
|
||||
$post_author = $userdata->ID;
|
||||
|
||||
@@ -13,6 +13,9 @@ if ( empty( $wp ) ) {
|
||||
wp( array( 'tb' => '1' ) );
|
||||
}
|
||||
|
||||
// Always run as an unauthenticated user.
|
||||
wp_set_current_user( 0 );
|
||||
|
||||
/**
|
||||
* Response to a trackback.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user