Changeset 63712
- Timestamp:
- 09/17/2026 09:12:06 PM (8 weeks ago)
- Location:
- branches/5.0
- Files:
-
- 10 edited
-
. (modified) (1 prop)
-
src/wp-admin/custom-header.php (modified) (4 diffs)
-
src/wp-admin/includes/ajax-actions.php (modified) (2 diffs)
-
src/wp-admin/includes/plugin.php (modified) (1 diff)
-
src/wp-admin/includes/post.php (modified) (1 diff)
-
src/wp-admin/js/theme.js (modified) (2 diffs)
-
src/wp-includes/class-wp-xmlrpc-server.php (modified) (1 diff)
-
src/wp-includes/customize/class-wp-customize-header-image-setting.php (modified) (2 diffs)
-
src/wp-includes/formatting.php (modified) (1 diff)
-
src/wp-includes/theme.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0
- Property svn:mergeinfo changed
/trunk merged: 62658,63656-63657,63659-63660,63665,63669,63672
- Property svn:mergeinfo changed
-
branches/5.0/src/wp-admin/custom-header.php
r49396 r63712 498 498 $header_image_style .= 'height:' . $custom_header->height . 'px;'; 499 499 ?> 500 <div id="headimg" style="<?php echo $header_image_style; ?>">500 <div id="headimg" style="<?php echo esc_attr( $header_image_style ); ?>"> 501 501 <?php 502 502 if ( display_header_text() ) … … 1021 1021 'url' => $choice['url'], 1022 1022 'thumbnail_url' => $choice['url'], 1023 'height' => $choice['height'],1024 'width' => $choice['width'],1023 'height' => absint( $choice['height'] ), 1024 'width' => absint( $choice['width'] ), 1025 1025 ); 1026 1026 … … 1049 1049 } 1050 1050 1051 set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) ); 1051 $header_image_data['url'] = esc_url_raw( $header_image_data['url'] ); 1052 1053 if ( isset( $header_image_data['thumbnail_url'] ) ) { 1054 $header_image_data['thumbnail_url'] = esc_url_raw( $header_image_data['thumbnail_url'] ); 1055 } 1056 1057 set_theme_mod( 'header_image', $header_image_data['url'] ); 1052 1058 set_theme_mod( 'header_image_data', $header_image_data ); 1053 1059 } … … 1408 1414 1409 1415 foreach ( $header_images as &$header_image ) { 1410 $header_meta = get_post_meta( $header_image['attachment_id'] ); 1411 $header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : ''; 1412 $header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : ''; 1416 $header_image['timestamp'] = get_post_meta( $header_image['attachment_id'], $timestamp_key, true ); 1417 $header_image['alt_text'] = get_post_meta( $header_image['attachment_id'], $alt_text_key, true ); 1413 1418 } 1414 1419 -
branches/5.0/src/wp-admin/includes/ajax-actions.php
r56871 r63712 1637 1637 check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); 1638 1638 $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; 1639 if ( ! $post_id ) { 1640 // Bypass call to get_preview_post_link() for unspecified post ID. 1641 wp_die( '' ); 1642 } 1643 if ( ! current_user_can( 'edit_post', $post_id ) ) { 1644 wp_die( -1 ); 1645 } 1639 1646 wp_die( get_preview_post_link( $post_id ) ); 1640 1647 } … … 1648 1655 check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); 1649 1656 $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; 1657 if ( ! $post_id ) { 1658 // Bypass call to get_sample_permalink_html() for unspecified post ID. 1659 wp_die( '' ); 1660 } 1661 if ( ! current_user_can( 'edit_post', $post_id ) ) { 1662 wp_die( -1 ); 1663 } 1650 1664 $title = isset($_POST['new_title'])? $_POST['new_title'] : ''; 1651 1665 $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null; -
branches/5.0/src/wp-admin/includes/plugin.php
r43827 r63712 506 506 * 507 507 * @since 3.0.0 508 * 509 * @param string $plugin Path to the main plugin file from plugins directory. 508 * @since 7.1.1 The `$plugin` path is normalized with `plugin_basename()` and `trim()`, 509 * matching how `activate_plugin()` resolves it. 510 * 511 * @param string $plugin Path to the plugin file. Accepts a path relative to the plugins 512 * directory, or an absolute path, with or without surrounding whitespace. 510 513 * @return bool True if plugin is network only, false otherwise. 511 514 */ 512 515 function is_network_only_plugin( $plugin ) { 516 // Normalize the path the same way activate_plugin() does, so both agree on the file. 517 $plugin = plugin_basename( trim( $plugin ) ); 518 513 519 $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 514 520 if ( $plugin_data ) -
branches/5.0/src/wp-admin/includes/post.php
r54571 r63712 22 22 if ( empty($post_data) ) 23 23 $post_data = &$_POST; 24 25 /* 26 * A raw `ID` on the create path (no `post_ID`) is an attempt to overwrite an 27 * existing post while bypassing the per-post capability checks below, which only 28 * run on the update path. Reject it outright: legitimate post creation never 29 * carries an `ID`. 30 */ 31 if ( ! $update && ! empty( $post_data['ID'] ) ) { 32 if ( 'page' === $post_data['post_type'] ) { 33 return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) ); 34 } else { 35 return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) ); 36 } 37 } 24 38 25 39 if ( $update ) -
branches/5.0/src/wp-admin/js/theme.js
r42223 r63712 1911 1911 1912 1912 1913 /* 1914 * jQuery.escapeSelector() (added in jQuery 3.0) is not available on this 1915 * branch's vendored jQuery. Fall back to the native CSS.escape(), which is 1916 * what jQuery.escapeSelector() delegates to and which jQuery UI polyfills 1917 * it with. A browser with neither skips the preview route below rather 1918 * than building a selector from an unescaped slug. 1919 */ 1920 var escapeSelector = $.escapeSelector || ( window.CSS && window.CSS.escape && function( sel ) { 1921 return window.CSS.escape( sel + '' ); 1922 } ); 1923 1913 1924 themes.RunInstaller = { 1914 1925 … … 1973 1984 self.view.collection.trigger( 'update' ); 1974 1985 1975 // Open the theme preview. 1986 // Open the theme preview. The slug comes from the URL, so escape it. 1976 1987 self.view.collection.once( 'query:success', function() { 1977 $( 'div[data-slug="' + slug + '"]' ).trigger( 'click' ); 1988 if ( ! escapeSelector ) { 1989 return; 1990 } 1991 1992 $( 'div.theme[data-slug="' + escapeSelector( slug ) + '"]' ).trigger( 'click' ); 1978 1993 }); 1979 1994 -
branches/5.0/src/wp-includes/class-wp-xmlrpc-server.php
r49396 r63712 1377 1377 return new IXR_Error( 403, __( 'Invalid post type.' ) ); 1378 1378 1379 // Reject writes to internal-only builtin post types (e.g. customize_changeset) 1380 // whose intended write path is a dedicated helper, not a generic post API. 1381 $is_internal_only = ( 1382 empty( $post_type->public ) 1383 && empty( $post_type->show_in_rest ) 1384 && ! empty( $post_type->_builtin ) 1385 ); 1386 1387 /** 1388 * Filters whether a post type accepts writes via XML-RPC. 1389 * 1390 * Defaults to false for internal-only builtin post types (public=false, 1391 * show_in_rest=false, _builtin=true), such as customize_changeset, whose 1392 * writes are meant to flow through dedicated helpers. Return true to opt 1393 * a post type back in. 1394 * 1395 * @since 7.1.1 1396 * 1397 * @param bool $allowed Whether the post type accepts XML-RPC writes. 1398 * @param WP_Post_Type $post_type The post type object. 1399 */ 1400 $allowed = apply_filters( 'xmlrpc_allow_post_type_writes', ! $is_internal_only, $post_type ); 1401 1402 if ( ! $allowed ) { 1403 return new IXR_Error( 403, __( 'Sorry, this post type is not supported over XML-RPC.' ) ); 1404 } 1405 1379 1406 $update = ! empty( $post_data['ID'] ); 1380 1407 -
branches/5.0/src/wp-includes/customize/class-wp-customize-header-image-setting.php
r39411 r63712 16 16 * 17 17 * @see WP_Customize_Setting 18 * 19 * @phpstan-type Header_Image_Data array{ 20 * attachment_id?: int, 21 * url?: string, 22 * thumbnail_url?: string, 23 * timestamp?: int, 24 * width?: int, 25 * height?: int, 26 * alt_text?: string, 27 * attachment_parent?: int, 28 * } 18 29 */ 19 30 final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting { … … 49 60 $custom_image_header->set_header_image( $value ); 50 61 } 62 63 /** 64 * Sanitizes a header value. 65 * 66 * The value is expected to be one of the following: 67 * 68 * - An array of header image data, with the keys `attachment_id`, `url`, `thumbnail_url`, `timestamp`, `width`, 69 * `height`, `alt_text`, and `attachment_parent`, as supplied by {@see get_uploaded_header_images()}. Any other 70 * key is discarded. 71 * - An array with a `choice` key, being the legacy format in which any of the other accepted values is nested. 72 * - The string `remove-header`, `random-default-image`, or `random-uploaded-image`. 73 * - A string corresponding to one of the keys for the array returned by {@see get_uploaded_header_images()}, or 74 * one of the keys for the array passed into {@see register_default_headers()}. 75 * 76 * @since 7.1.1 77 * 78 * @see WP_Customize_Header_Image_Setting::update() 79 * @see Custom_Image_Header::set_header_image() 80 * 81 * @param mixed $value Value to sanitize. 82 * @return array|string|WP_Error|null Sanitized value, or `null`/`WP_Error` if invalid. The array holds 83 * the header image data, or that data nested under a `choice` key, 84 * before the `customize_sanitize_header_image_data` filter, which 85 * may return anything, is applied to it. 86 * 87 * @phpstan-return array<mixed, mixed>|string|WP_Error|null 88 */ 89 public function sanitize( $value ) { 90 /* 91 * The update() method unwraps the legacy `choice` format before handing the value off to 92 * Custom_Image_Header::set_header_image(), so the nested value is what must be sanitized. 93 */ 94 if ( is_array( $value ) && isset( $value['choice'] ) ) { 95 $choice = $this->sanitize_choice( $value['choice'] ); 96 if ( is_null( $choice ) || is_wp_error( $choice ) ) { 97 return $choice; 98 } 99 $value = array( 'choice' => $choice ); 100 } else { 101 $value = $this->sanitize_choice( $value ); 102 if ( is_null( $value ) || is_wp_error( $value ) ) { 103 return $value; 104 } 105 } 106 107 return parent::sanitize( $value ); 108 } 109 110 /** 111 * Sanitizes a header image choice. 112 * 113 * This is the value which is ultimately passed to {@see Custom_Image_Header::set_header_image()}, whether 114 * supplied at the top level of the setting value or nested under its legacy `choice` key. 115 * 116 * @since 7.1.1 117 * 118 * @param mixed $value Value to sanitize. 119 * @return array|string|WP_Error|null Sanitized value, or `null`/`WP_Error` if invalid. 120 * 121 * @phpstan-return Header_Image_Data|string|WP_Error|null 122 */ 123 private function sanitize_choice( $value ) { 124 // Custom_Image_Header::set_header_image() accepts an object in place of an array. 125 if ( is_object( $value ) ) { 126 $value = (array) $value; 127 } 128 129 if ( is_string( $value ) ) { 130 return sanitize_text_field( $value ); 131 } 132 133 if ( ! is_array( $value ) ) { 134 return null; 135 } 136 137 /* 138 * The sanitized value is assembled member by member rather than filtered down from the 139 * supplied one, so that nothing but the members below can end up in it. 140 */ 141 $sanitized = array(); 142 143 if ( isset( $value['attachment_id'] ) ) { 144 if ( ! is_scalar( $value['attachment_id'] ) ) { 145 return null; 146 } 147 $attachment_id = absint( $value['attachment_id'] ); 148 149 /* 150 * A supplied attachment must be an existing image, since its ID is written to postmeta and its 151 * data displayed. Note that an ID of zero must be skipped rather than looked up, as 152 * get_post_mime_type() falls back to the global post when passed an empty value. 153 */ 154 if ( $attachment_id > 0 ) { 155 $mime_type = get_post_mime_type( $attachment_id ); 156 if ( ! is_string( $mime_type ) || ! str_starts_with( $mime_type, 'image/' ) ) { 157 return null; 158 } 159 } 160 161 $sanitized['attachment_id'] = $attachment_id; 162 } 163 164 if ( isset( $value['url'] ) ) { 165 if ( ! is_string( $value['url'] ) ) { 166 return null; 167 } 168 $sanitized['url'] = esc_url_raw( $value['url'] ); 169 if ( '' === $sanitized['url'] ) { 170 return new WP_Error( 'invalid_url', __( 'Invalid URL.' ) ); 171 } 172 } 173 174 if ( isset( $value['thumbnail_url'] ) ) { 175 if ( ! is_string( $value['thumbnail_url'] ) ) { 176 return null; 177 } 178 $sanitized['thumbnail_url'] = esc_url_raw( $value['thumbnail_url'] ); 179 if ( '' === $sanitized['thumbnail_url'] ) { 180 return new WP_Error( 'invalid_url', __( 'Invalid URL.' ) ); 181 } 182 } 183 184 if ( isset( $value['timestamp'] ) ) { 185 if ( ! is_scalar( $value['timestamp'] ) ) { 186 return null; 187 } 188 $sanitized['timestamp'] = absint( $value['timestamp'] ); 189 } 190 191 if ( isset( $value['width'] ) ) { 192 if ( ! is_scalar( $value['width'] ) ) { 193 return null; 194 } 195 $sanitized['width'] = absint( $value['width'] ); 196 } 197 198 if ( isset( $value['height'] ) ) { 199 if ( ! is_scalar( $value['height'] ) ) { 200 return null; 201 } 202 $sanitized['height'] = absint( $value['height'] ); 203 } 204 205 if ( isset( $value['alt_text'] ) ) { 206 if ( ! is_string( $value['alt_text'] ) ) { 207 return null; 208 } 209 $sanitized['alt_text'] = sanitize_text_field( $value['alt_text'] ); 210 } 211 212 if ( isset( $value['attachment_parent'] ) ) { 213 if ( ! is_scalar( $value['attachment_parent'] ) ) { 214 return null; 215 } 216 $sanitized['attachment_parent'] = absint( $value['attachment_parent'] ); 217 } 218 219 return $sanitized; 220 } 51 221 } -
branches/5.0/src/wp-includes/formatting.php
r55791 r63712 550 550 551 551 // If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>. 552 $pee = preg_replace(' |<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);552 $pee = preg_replace('!<p><blockquote((?:[^>"\']|"[^"]*"|\'[^\']*\')*)>!i', "<blockquote$1><p>", $pee); 553 553 $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); 554 554 -
branches/5.0/src/wp-includes/theme.php
r43814 r63712 1231 1231 * 1232 1232 * @since 3.4.0 1233 * @since 7.1.1 The `width` and `height` are cast to non-negative integers. 1233 1234 * 1234 1235 * @global array $_wp_default_headers … … 1268 1269 'video' => get_theme_support( 'custom-header', 'video' ), 1269 1270 ); 1270 return (object) wp_parse_args( $data, $default ); 1271 1272 if ( ! is_array( $data ) && ! is_object( $data ) ) { 1273 $data = array(); 1274 } 1275 $header = (object) wp_parse_args( $data, $default ); 1276 $header->width = absint( $header->width ); 1277 $header->height = absint( $header->height ); 1278 return $header; 1271 1279 } 1272 1280
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)