Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0013720261 | ||
|
|
66e18dcb6e | ||
|
|
9fd0b00c91 | ||
|
|
70a0960dff | ||
|
|
7cd8649bbe | ||
|
|
9c48bd85e4 | ||
|
|
92a93cd9be | ||
|
|
65b7a0e48b | ||
|
|
61be176e5a | ||
|
|
7a558af3c8 |
@@ -45,6 +45,86 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
|
||||
<div class="changelog point-releases">
|
||||
<h3><?php _e( 'Maintenance and Security Releases' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'4.8.23'
|
||||
);
|
||||
?>
|
||||
<?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( '4.8.23' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'4.8.22'
|
||||
);
|
||||
?>
|
||||
<?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( '4.8.22' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'4.8.21'
|
||||
);
|
||||
?>
|
||||
<?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( '4.8.21' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: WordPress version number */
|
||||
__( '<strong>Version %s</strong> addressed some security issues.' ),
|
||||
'4.8.20'
|
||||
);
|
||||
?>
|
||||
<?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( '4.8.20' )
|
||||
)
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
@@ -515,3 +595,15 @@ _n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed
|
||||
|
||||
/* translators: %s: Codex 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/' );
|
||||
|
||||
@@ -2254,6 +2254,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 ) {
|
||||
@@ -2466,7 +2470,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' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3108,13 +3112,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 {
|
||||
|
||||
@@ -499,6 +499,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";
|
||||
|
||||
@@ -654,7 +654,20 @@ class WP_List_Table {
|
||||
$approved_phrase = sprintf( _n( '%s approved comment', '%s approved comments', $approved_comments ), $approved_comments_number );
|
||||
$pending_phrase = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $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>',
|
||||
__( 'No comments' )
|
||||
|
||||
@@ -919,8 +919,18 @@ function wp_dashboard_recent_comments( $total_items = 5 ) {
|
||||
echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
|
||||
|
||||
echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
|
||||
foreach ( $comments as $comment )
|
||||
_wp_dashboard_recent_comments_row( $comment );
|
||||
foreach ( $comments as $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>';
|
||||
|
||||
if ( current_user_can( 'edit_posts' ) ) {
|
||||
|
||||
@@ -1169,7 +1169,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;
|
||||
|
||||
@@ -437,7 +437,7 @@ if ( ! empty( $invalid ) ) {
|
||||
/* translators: 1: plugin file 2: error message */
|
||||
__( 'The plugin %1$s has been <strong>deactivated</strong> 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>';
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ if ( ! empty( $invalid ) ) {
|
||||
delete_transient( 'plugins_delete_result_' . $user_ID );
|
||||
|
||||
if ( is_wp_error($delete_result) ) : ?>
|
||||
<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
|
||||
<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), esc_html( $delete_result->get_error_message() ) ); ?></p></div>
|
||||
<?php else : ?>
|
||||
<div id="message" class="updated notice is-dismissible">
|
||||
<p>
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -282,7 +282,7 @@ function get_bookmarks( $args = '' ) {
|
||||
$query .= " $exclusions $inclusions $search";
|
||||
$query .= " ORDER BY $orderby $order";
|
||||
if ( $r['limit'] != -1 ) {
|
||||
$query .= ' LIMIT ' . $r['limit'];
|
||||
$query .= ' LIMIT ' . absint( $r['limit'] );
|
||||
}
|
||||
|
||||
$results = $wpdb->get_results( $query );
|
||||
|
||||
@@ -486,6 +486,13 @@ class WP_Query {
|
||||
|
||||
private $compat_methods = array( 'init_query_flags', 'parse_tax_query' );
|
||||
|
||||
/**
|
||||
* Controls whether an attachment query should include filenames or not.
|
||||
*
|
||||
* @since 6.0.3
|
||||
* @var bool
|
||||
*/
|
||||
protected $allow_query_attachment_by_filename = false;
|
||||
/**
|
||||
* Resets query flags to false.
|
||||
*
|
||||
@@ -1346,7 +1353,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 ';
|
||||
}
|
||||
|
||||
@@ -1683,6 +1695,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 );
|
||||
@@ -2087,7 +2109,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";
|
||||
}
|
||||
|
||||
@@ -2136,6 +2158,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'];
|
||||
|
||||
@@ -546,6 +546,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.
|
||||
*
|
||||
@@ -1514,4 +1536,16 @@ final class WP_Theme implements ArrayAccess {
|
||||
// Don't mark up; Do translate.
|
||||
return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2146,6 +2146,15 @@ function wp_update_comment($commentarr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
@@ -2156,6 +2165,10 @@ function wp_update_comment($commentarr) {
|
||||
|
||||
$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 );
|
||||
|
||||
|
||||
@@ -103,10 +103,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' ) { #>
|
||||
|
||||
@@ -69,7 +69,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"><?php bloginfo( 'name' ); ?></span>
|
||||
<span class="browser-title" aria-hidden="true"><?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>
|
||||
|
||||
@@ -151,8 +151,8 @@ class WP_Date_Query {
|
||||
* 'comment_date', 'comment_date_gmt'.
|
||||
*/
|
||||
public function __construct( $date_query, $default_column = 'post_date' ) {
|
||||
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';
|
||||
}
|
||||
@@ -232,6 +232,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.
|
||||
@@ -1017,4 +1020,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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3878,3 +3878,21 @@ function _sort_nav_menu_items( $a, $b ) {
|
||||
else
|
||||
return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ function get_post_embed_html( $width, $height, $post = null ) {
|
||||
* and edit wp-embed.js directly.
|
||||
*/
|
||||
$output .=<<<JS
|
||||
!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.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.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(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),a=!!navigator.userAgent.match(/Trident.*rv:11\./),i=l.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);
|
||||
JS;
|
||||
}
|
||||
$output .= "\n//--><!]]>";
|
||||
|
||||
@@ -2369,7 +2369,7 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
} else {
|
||||
if ( $type !== $real_mime ) {
|
||||
/*
|
||||
* Everything else including image/* and application/*:
|
||||
* Everything else including image/* and application/*:
|
||||
* If the real content type doesn't match the file extension, assume it's dangerous.
|
||||
*/
|
||||
$type = $ext = false;
|
||||
@@ -2378,7 +2378,7 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
||||
}
|
||||
}
|
||||
|
||||
// The mime type must be allowed
|
||||
// The mime type must be allowed
|
||||
if ( $type ) {
|
||||
$allowed = get_allowed_mime_types();
|
||||
|
||||
@@ -2650,9 +2650,12 @@ function wp_nonce_ays( $action ) {
|
||||
} else {
|
||||
$html = __( 'Are you sure you want to do this?' );
|
||||
if ( wp_get_referer() ) {
|
||||
$html .= '</p><p>';
|
||||
$html .= sprintf( '<a href="%s">%s</a>',
|
||||
esc_url( remove_query_arg( 'updated', 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( $wp_http_referer ),
|
||||
__( 'Please try again.' )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,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++ ) {
|
||||
@@ -72,6 +73,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 +1 @@
|
||||
!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.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.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(!n){n=!0;for(var e,t,r=-1!==navigator.appVersion.indexOf("MSIE 10"),a=!!navigator.userAgent.match(/Trident.*rv:11\./),i=l.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);
|
||||
@@ -1252,7 +1252,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"><?php bloginfo( 'name' ); ?></span>
|
||||
<span class="browser-title" aria-hidden="true"><?php echo esc_js( get_bloginfo( 'name' ) ); ?></span>
|
||||
</div>
|
||||
|
||||
<strong aria-hidden="true"><?php _e( 'As an app icon' ); ?></strong>
|
||||
|
||||
@@ -1689,11 +1689,24 @@ function gallery_shortcode( $attr ) {
|
||||
$attachments[$val->ID] = $_attachments[$key];
|
||||
}
|
||||
} elseif ( ! empty( $atts['exclude'] ) ) {
|
||||
$post_parent_id = $id;
|
||||
$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
|
||||
} else {
|
||||
$post_parent_id = $id;
|
||||
$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
|
||||
}
|
||||
|
||||
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 '';
|
||||
}
|
||||
@@ -1993,6 +2006,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 '';
|
||||
}
|
||||
@@ -3435,8 +3457,9 @@ 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' ),
|
||||
'wpRestApi' => wp_create_nonce( 'wp_rest' ),
|
||||
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
|
||||
'wpRestApi' => wp_create_nonce( 'wp_rest' ),
|
||||
'setAttachmentThumbnail' => wp_create_nonce( 'set-attachment-thumbnail' ),
|
||||
),
|
||||
'post' => array(
|
||||
'id' => 0,
|
||||
|
||||
@@ -312,6 +312,8 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
|
||||
$phpmailer->clearAttachments();
|
||||
$phpmailer->clearCustomHeaders();
|
||||
$phpmailer->clearReplyTos();
|
||||
$phpmailer->Body = '';
|
||||
$phpmailer->AltBody = '';
|
||||
|
||||
// From email and name
|
||||
// If we don't have a name from the input headers
|
||||
|
||||
@@ -995,10 +995,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()' );
|
||||
if ( $keys = get_post_custom_keys() ) {
|
||||
echo "<ul class='post-meta'>\n";
|
||||
foreach ( (array) $keys as $key ) {
|
||||
@@ -1017,7 +1017,7 @@ function the_meta() {
|
||||
* @param string $key Meta key.
|
||||
* @param string $value Meta value.
|
||||
*/
|
||||
echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
|
||||
echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>" . esc_html( $key ) . ":</span>" . esc_html( $value ) . "</li>\n", $key, $value );
|
||||
}
|
||||
echo "</ul>\n";
|
||||
}
|
||||
|
||||
@@ -1631,7 +1631,99 @@ function is_post_type_viewable( $post_type ) {
|
||||
}
|
||||
}
|
||||
|
||||
return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
|
||||
if ( ! is_object( $post_type ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
|
||||
|
||||
/**
|
||||
* Filters whether a post type is considered "viewable".
|
||||
*
|
||||
* The returned filtered value must be a boolean type to ensure
|
||||
* `is_post_type_viewable()` only returns a boolean. This strictness
|
||||
* is by design to maintain backwards-compatibility and guard against
|
||||
* potential type errors in PHP 8.1+. Non-boolean values (even falsey
|
||||
* and truthy values) will result in the function returning false.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param bool $is_viewable Whether the post type is "viewable" (strict type).
|
||||
* @param WP_Post_Type $post_type Post type object.
|
||||
*/
|
||||
return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a post status is considered "viewable".
|
||||
*
|
||||
* For built-in post statuses such as publish and private, the 'public' value will be evaluated.
|
||||
* For all others, the 'publicly_queryable' value will be used.
|
||||
*
|
||||
* @since 5.7.0
|
||||
* @since 5.9.0 Added `is_post_status_viewable` hook to filter the result.
|
||||
*
|
||||
* @param string|stdClass $post_status Post status name or object.
|
||||
* @return bool Whether the post status should be considered viewable.
|
||||
*/
|
||||
function is_post_status_viewable( $post_status ) {
|
||||
if ( is_scalar( $post_status ) ) {
|
||||
$post_status = get_post_status_object( $post_status );
|
||||
|
||||
if ( ! $post_status ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
! is_object( $post_status ) ||
|
||||
$post_status->internal ||
|
||||
$post_status->protected
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public );
|
||||
|
||||
/**
|
||||
* Filters whether a post status is considered "viewable".
|
||||
*
|
||||
* The returned filtered value must be a boolean type to ensure
|
||||
* `is_post_status_viewable()` only returns a boolean. This strictness
|
||||
* is by design to maintain backwards-compatibility and guard against
|
||||
* potential type errors in PHP 8.1+. Non-boolean values (even falsey
|
||||
* and truthy values) will result in the function returning false.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param bool $is_viewable Whether the post status is "viewable" (strict type).
|
||||
* @param stdClass $post_status Post status object.
|
||||
*/
|
||||
return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a post is publicly viewable.
|
||||
*
|
||||
* Posts are considered publicly viewable if both the post status and post type
|
||||
* are viewable.
|
||||
*
|
||||
* @since 5.7.0
|
||||
*
|
||||
* @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
|
||||
* @return bool Whether the post is publicly viewable.
|
||||
*/
|
||||
function is_post_publicly_viewable( $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$post_type = get_post_type( $post );
|
||||
$post_status = get_post_status( $post );
|
||||
|
||||
return is_post_type_viewable( $post_type ) && is_post_status_viewable( $post_status );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6241,32 +6333,3 @@ function wp_add_trashed_suffix_to_post_name_for_post( $post ) {
|
||||
clean_post_cache( $post->ID );
|
||||
return $post_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the SQL clauses of an attachment query to include filenames.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access private
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,
|
||||
* DISTINCT, fields (SELECT), and LIMITS clauses.
|
||||
* @return array The modified 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;
|
||||
}
|
||||
|
||||
@@ -748,6 +748,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 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -242,24 +242,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.
|
||||
*
|
||||
@@ -317,10 +299,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();
|
||||
@@ -379,6 +363,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;
|
||||
|
||||
@@ -49,7 +49,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;
|
||||
|
||||
@@ -132,6 +132,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.
|
||||
*
|
||||
@@ -143,12 +172,43 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
$tax_obj = get_taxonomy( $this->taxonomy );
|
||||
|
||||
if ( ! $tax_obj || ! $this->check_is_taxonomy_allowed( $this->taxonomy ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'edit' === $request['context'] && ! current_user_can( $tax_obj->cap->edit_terms ) ) {
|
||||
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ), array( 'status' => rest_authorization_required_code() ) );
|
||||
return new WP_Error(
|
||||
'rest_forbidden_context',
|
||||
__( 'Sorry, you are not allowed to edit terms in this taxonomy.' ),
|
||||
array( 'status' => rest_authorization_required_code() )
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -260,6 +260,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'] . '*';
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -185,7 +185,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.
|
||||
*
|
||||
* If there are no shortcode tags defined, then the content will be returned
|
||||
* without any filtering. This might cause issues when plugins are disabled but
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8.19';
|
||||
$wp_version = '4.8.23';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
@@ -1233,7 +1233,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;
|
||||
}
|
||||
|
||||
@@ -1342,7 +1342,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'] );
|
||||
|
||||
@@ -60,6 +60,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);
|
||||
@@ -124,8 +127,6 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
||||
$author = trim($line);
|
||||
$author = sanitize_email($author);
|
||||
if ( is_email($author) ) {
|
||||
/* translators: 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