Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5362cad581 | ||
|
|
d33ba73358 | ||
|
|
748a485085 | ||
|
|
4cb6ce1c75 | ||
|
|
5c3c218105 |
@@ -51,6 +51,46 @@ 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.4.14'
|
||||
);
|
||||
?>
|
||||
<?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.4.14' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'5.4.13'
|
||||
);
|
||||
?>
|
||||
<?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.4.13' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
@@ -527,3 +567,9 @@ __( 'Important! Your version of WordPress (%1$s) is no longer supported, you wil
|
||||
|
||||
/* 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/' );
|
||||
|
||||
@@ -2698,6 +2698,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 ) {
|
||||
@@ -3735,13 +3739,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 {
|
||||
|
||||
@@ -561,6 +561,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";
|
||||
|
||||
@@ -682,7 +682,20 @@ class WP_List_Table {
|
||||
$pending_comments_number
|
||||
);
|
||||
|
||||
// No comments at all.
|
||||
$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 ) {
|
||||
printf(
|
||||
'<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
|
||||
|
||||
@@ -1034,7 +1034,16 @@ 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>';
|
||||
|
||||
|
||||
@@ -65,4 +65,8 @@ class Requests_Hooks implements Requests_Hooker {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,6 +703,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).
|
||||
|
||||
@@ -227,6 +227,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
|
||||
*
|
||||
|
||||
@@ -271,6 +271,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 );
|
||||
@@ -280,6 +284,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.
|
||||
|
||||
@@ -154,6 +154,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.
|
||||
*
|
||||
|
||||
@@ -675,6 +675,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.
|
||||
*
|
||||
@@ -1667,4 +1689,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ function get_post_embed_html( $width, $height, $post = null ) {
|
||||
*/
|
||||
$output .= <<<JS
|
||||
/*! This file is auto-generated */
|
||||
!function(c,d){"use strict";var e=!1,n=!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(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),a=!!navigator.userAgent.match(/Trident.*rv:11\./),i=d.querySelectorAll("iframe.wp-embedded-content"),s=0;s<i.length;s++){if(!(e=i[s]).getAttribute("data-secret"))t=Math.random().toString(36).substr(2,10),e.src+="#?secret="+t,e.setAttribute("data-secret",t);if(r||a)(t=e.cloneNode(!0)).removeAttribute("security"),e.parentNode.replaceChild(t,e)}}}}(window,document);
|
||||
!function(d,l){"use strict";var e=!1,n=!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,i,a,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<(a=parseInt(t.value,10)))a=1e3;else if(~~a<200)a=200;r.height=a}if("link"===t.message)if(i=l.createElement("a"),a=l.createElement("a"),i.href=r.getAttribute("src"),a.href=t.value,o.test(a.protocol))if(a.host===i.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(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),i=!!navigator.userAgent.match(/Trident.*rv:11\./),a=l.querySelectorAll("iframe.wp-embedded-content"),s=0;s<a.length;s++){if(!(e=a[s]).getAttribute("data-secret"))t=Math.random().toString(36).substr(2,10),e.src+="#?secret="+t,e.setAttribute("data-secret",t);if(r||i)(t=e.cloneNode(!0)).removeAttribute("security"),e.parentNode.replaceChild(t,e)}}}}(window,document);
|
||||
JS;
|
||||
}
|
||||
$output .= "\n//--><!]]>";
|
||||
|
||||
@@ -2374,6 +2374,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. `&`)
|
||||
*
|
||||
|
||||
@@ -837,6 +837,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
@@ -44,6 +44,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++ ) {
|
||||
@@ -79,6 +80,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,n=!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(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),a=!!navigator.userAgent.match(/Trident.*rv:11\./),i=d.querySelectorAll("iframe.wp-embedded-content"),s=0;s<i.length;s++){if(!(e=i[s]).getAttribute("data-secret"))t=Math.random().toString(36).substr(2,10),e.src+="#?secret="+t,e.setAttribute("data-secret",t);if(r||a)(t=e.cloneNode(!0)).removeAttribute("security"),e.parentNode.replaceChild(t,e)}}}}(window,document);
|
||||
!function(d,l){"use strict";var e=!1,n=!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,i,a,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<(a=parseInt(t.value,10)))a=1e3;else if(~~a<200)a=200;r.height=a}if("link"===t.message)if(i=l.createElement("a"),a=l.createElement("a"),i.href=r.getAttribute("src"),a.href=t.value,o.test(a.protocol))if(a.host===i.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(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),i=!!navigator.userAgent.match(/Trident.*rv:11\./),a=l.querySelectorAll("iframe.wp-embedded-content"),s=0;s<a.length;s++){if(!(e=a[s]).getAttribute("data-secret"))t=Math.random().toString(36).substr(2,10),e.src+="#?secret="+t,e.setAttribute("data-secret",t);if(r||i)(t=e.cloneNode(!0)).removeAttribute("security"),e.parentNode.replaceChild(t,e)}}}}(window,document);
|
||||
@@ -144,7 +144,7 @@ function determine_locale() {
|
||||
}
|
||||
|
||||
if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
|
||||
$determined_locale = sanitize_text_field( $_GET['wp_lang'] );
|
||||
$determined_locale = sanitize_locale_name( wp_unslash( $_GET['wp_lang'] ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1930,7 +1930,8 @@ function gallery_shortcode( $attr ) {
|
||||
$attachments[ $val->ID ] = $_attachments[ $key ];
|
||||
}
|
||||
} elseif ( ! empty( $atts['exclude'] ) ) {
|
||||
$attachments = get_children(
|
||||
$post_parent_id = $id;
|
||||
$attachments = get_children(
|
||||
array(
|
||||
'post_parent' => $id,
|
||||
'exclude' => $atts['exclude'],
|
||||
@@ -1942,7 +1943,8 @@ function gallery_shortcode( $attr ) {
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$attachments = get_children(
|
||||
$post_parent_id = $id;
|
||||
$attachments = get_children(
|
||||
array(
|
||||
'post_parent' => $id,
|
||||
'post_status' => 'inherit',
|
||||
@@ -1954,6 +1956,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 '';
|
||||
}
|
||||
@@ -2272,6 +2285,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 '';
|
||||
}
|
||||
@@ -3825,7 +3847,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,
|
||||
|
||||
@@ -920,6 +920,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 nonce is invalid' ), array( 'status' => 403 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -246,24 +246,6 @@ class WP_REST_Server {
|
||||
$this->send_header( 'Access-Control-Expose-Headers', 'X-WP-Total, X-WP-TotalPages' );
|
||||
$this->send_header( 'Access-Control-Allow-Headers', 'Authorization, Content-Type' );
|
||||
|
||||
/**
|
||||
* Send nocache headers on authenticated requests.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
@@ -330,10 +312,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();
|
||||
@@ -392,6 +376,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;
|
||||
|
||||
@@ -302,6 +302,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'] . '*';
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -160,7 +160,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().
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4.12';
|
||||
$wp_version = '5.4.14';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user