Grouped backports to the 4.8 branch.

- Posts, Post Types: Escape output within `the_meta()`.
- General: Ensure bookmark query limits are numeric.
- Plugins: Escape output in error messages.

Merges [53958-53960] to the 4.8 branch.
Props tykoted, martinkrcho, xknown, dd32, peterwilsoncc, paulkevan, timothyblynjacobs.

Built from https://develop.svn.wordpress.org/branches/4.8@53975


git-svn-id: http://core.svn.wordpress.org/branches/4.8@53534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-08-30 15:45:23 +00:00
parent 12bfb972db
commit 7a558af3c8
3 changed files with 6 additions and 6 deletions

View File

@ -437,7 +437,7 @@ if ( ! empty( $invalid ) ) {
/* translators: 1: plugin file 2: error message */ /* translators: 1: plugin file 2: error message */
__( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ), __( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ),
'<code>' . esc_html( $plugin_file ) . '</code>', '<code>' . esc_html( $plugin_file ) . '</code>',
$error->get_error_message() ); esc_html( $error->get_error_message() ) );
echo '</p></div>'; echo '</p></div>';
} }
} }
@ -472,7 +472,7 @@ if ( ! empty( $invalid ) ) {
delete_transient( 'plugins_delete_result_' . $user_ID ); delete_transient( 'plugins_delete_result_' . $user_ID );
if ( is_wp_error($delete_result) ) : ?> 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 : ?> <?php else : ?>
<div id="message" class="updated notice is-dismissible"> <div id="message" class="updated notice is-dismissible">
<p> <p>

View File

@ -282,7 +282,7 @@ function get_bookmarks( $args = '' ) {
$query .= " $exclusions $inclusions $search"; $query .= " $exclusions $inclusions $search";
$query .= " ORDER BY $orderby $order"; $query .= " ORDER BY $orderby $order";
if ( $r['limit'] != -1 ) { if ( $r['limit'] != -1 ) {
$query .= ' LIMIT ' . $r['limit']; $query .= ' LIMIT ' . absint( $r['limit'] );
} }
$results = $wpdb->get_results( $query ); $results = $wpdb->get_results( $query );

View File

@ -995,10 +995,10 @@ function post_custom( $key = '' ) {
* *
* @since 1.2.0 * @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() { function the_meta() {
_deprecated_function( __FUNCTION__, '6.0.2', 'get_post_meta()' );
if ( $keys = get_post_custom_keys() ) { if ( $keys = get_post_custom_keys() ) {
echo "<ul class='post-meta'>\n"; echo "<ul class='post-meta'>\n";
foreach ( (array) $keys as $key ) { foreach ( (array) $keys as $key ) {
@ -1017,7 +1017,7 @@ function the_meta() {
* @param string $key Meta key. * @param string $key Meta key.
* @param string $value Meta value. * @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"; echo "</ul>\n";
} }