Changeset 54555
- Timestamp:
- 10/17/2022 05:56:34 PM (22 months ago)
- Location:
- branches/5.6
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
- Property svn:mergeinfo changed
/trunk merged: 54521-54530,54541
- Property svn:mergeinfo changed
-
branches/5.6/src/wp-admin/includes/ajax-actions.php
r49193 r54555 2976 2976 // Filter query clauses to include filenames. 2977 2977 if ( isset( $query['s'] ) ) { 2978 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );2978 add_filter( '' ); 2979 2979 } 2980 2980 -
branches/5.6/src/wp-admin/includes/post.php
r49732 r54555 1270 1270 // Filter query clauses to include filenames. 1271 1271 if ( isset( $q['s'] ) ) { 1272 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );1272 add_filter( '' ); 1273 1273 } 1274 1274 -
branches/5.6/src/wp-includes/class-wp-date-query.php
r49108 r54555 150 150 } 151 151 152 if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] )) {153 $this->relation = 'OR';152 if ( isset( $date_query['relation'] ) ) { 153 $this->relation = ; 154 154 } else { 155 155 $this->relation = 'AND'; … … 219 219 $this->validate_date_values( $queries ); 220 220 } 221 222 223 221 224 222 225 foreach ( $queries as $key => $q ) { … … 1040 1043 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1041 1044 } 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1042 1061 } -
branches/5.6/src/wp-includes/class-wp-query.php
r49506 r54555 442 442 public $thumbnails_cached = false; 443 443 444 445 446 447 448 449 450 444 451 /** 445 452 * Cached list of search stopwords. … … 1392 1399 1393 1400 $like = $n . $wpdb->esc_like( $term ) . $n; 1394 $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 ); 1401 1402 if ( ! empty( $this->allow_query_attachment_by_filename ) ) { 1403 $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 ); 1404 } else { 1405 $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 ); 1406 } 1395 1407 $searchand = ' AND '; 1396 1408 } … … 1785 1797 $q = $this->fill_query_vars( $q ); 1786 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1787 1809 // Parse meta query. 1788 1810 $this->meta_query = new WP_Meta_Query(); … … 2216 2238 } 2217 2239 2218 if ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) ) {2240 if ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) ) { 2219 2241 $groupby = "{$wpdb->posts}.ID"; 2220 2242 } … … 2292 2314 } 2293 2315 $where .= $search . $whichauthor . $whichmimetype; 2316 2317 2318 2319 2294 2320 2295 2321 if ( ! empty( $this->meta_query->queries ) ) { -
branches/5.6/src/wp-includes/comment.php
r49215 r54555 2460 2460 } 2461 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2462 2471 // Escape data pulled from DB. 2463 2472 $comment = wp_slash( $comment ); … … 2469 2478 2470 2479 $commentarr = wp_filter_comment( $commentarr ); 2480 2481 2482 2483 2471 2484 2472 2485 // Now extract the merged array. -
branches/5.6/src/wp-includes/customize/class-wp-customize-header-image-control.php
r48834 r54555 131 131 132 132 <button type="button" class="choice thumbnail" 133 data-customize-image-value="{{ {data.header.url}}}"133 data-customize-image-value="{{}}" 134 134 data-customize-header-image-data="{{JSON.stringify(data.header)}}"> 135 135 <span class="screen-reader-text"><?php _e( 'Set image' ); ?></span> 136 <img src="{{ {data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" />136 <img src="{{}}" /> 137 137 </button> 138 138 … … 159 159 <# } else { #> 160 160 161 <img src="{{ {data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" />161 <img src="{{}}" /> 162 162 163 163 <# } #> -
branches/5.6/src/wp-includes/customize/class-wp-customize-site-icon-control.php
r47382 r54555 69 69 <img src="{{ data.attachment.sizes.full ? data.attachment.sizes.full.url : data.attachment.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/> 70 70 </div> 71 <span class="browser-title" aria-hidden="true"><# print( '<?php bloginfo( 'name'); ?>' ) #></span>71 <span class="browser-title" aria-hidden="true"><# print( '<?php ); ?>' ) #></span> 72 72 </div> 73 73 <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' ); ?>"/> -
branches/5.6/src/wp-includes/deprecated.php
r49597 r54555 4136 4136 return is_string( $value ) ? addslashes( $value ) : $value; 4137 4137 } 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 -
branches/5.6/src/wp-includes/functions.php
r51743 r54555 3288 3288 $html = __( 'The link you followed has expired.' ); 3289 3289 if ( wp_get_referer() ) { 3290 3291 3290 3292 $html .= '</p><p>'; 3291 3293 $html .= sprintf( 3292 3294 '<a href="%s">%s</a>', 3293 esc_url( remove_query_arg( 'updated', wp_get_referer() )),3295 esc_url( ), 3294 3296 __( 'Please try again.' ) 3295 3297 ); -
branches/5.6/src/wp-includes/media-template.php
r49820 r54555 1494 1494 <img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/> 1495 1495 </div> 1496 <span class="browser-title" aria-hidden="true"><# print( '<?php bloginfo( 'name'); ?>' ) #></span>1496 <span class="browser-title" aria-hidden="true"><# print( '<?php ); ?>' ) #></span> 1497 1497 </div> 1498 1498 -
branches/5.6/src/wp-includes/pluggable.php
r49193 r54555 318 318 $phpmailer->clearCustomHeaders(); 319 319 $phpmailer->clearReplyTos(); 320 321 320 322 321 323 // Set "From" name and email. -
branches/5.6/src/wp-includes/post.php
r52467 r54555 1988 1988 * @since 4.5.0 Added the ability to pass a post type name in addition to object. 1989 1989 * @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object. 1990 1990 1991 * 1991 1992 * @param string|WP_Post_Type $post_type Post type name or object. … … 1995 1996 if ( is_scalar( $post_type ) ) { 1996 1997 $post_type = get_post_type_object( $post_type ); 1998 1997 1999 if ( ! $post_type ) { 1998 2000 return false; … … 2000 2002 } 2001 2003 2002 return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); 2004 if ( ! is_object( $post_type ) ) { 2005 return false; 2006 } 2007 2008 $is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); 2009 2010 /** 2011 * Filters whether a post type is considered "viewable". 2012 * 2013 * The returned filtered value must be a boolean type to ensure 2014 * `is_post_type_viewable()` only returns a boolean. This strictness 2015 * is by design to maintain backwards-compatibility and guard against 2016 * potential type errors in PHP 8.1+. Non-boolean values (even falsey 2017 * and truthy values) will result in the function returning false. 2018 * 2019 * @since 5.9.0 2020 * 2021 * @param bool $is_viewable Whether the post type is "viewable" (strict type). 2022 * @param WP_Post_Type $post_type Post type object. 2023 */ 2024 return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type ); 2025 } 2026 2027 /** 2028 * Determines whether a post status is considered "viewable". 2029 * 2030 * For built-in post statuses such as publish and private, the 'public' value will be evaluated. 2031 * For all others, the 'publicly_queryable' value will be used. 2032 * 2033 * @since 5.7.0 2034 * @since 5.9.0 Added `is_post_status_viewable` hook to filter the result. 2035 * 2036 * @param string|stdClass $post_status Post status name or object. 2037 * @return bool Whether the post status should be considered viewable. 2038 */ 2039 function is_post_status_viewable( $post_status ) { 2040 if ( is_scalar( $post_status ) ) { 2041 $post_status = get_post_status_object( $post_status ); 2042 2043 if ( ! $post_status ) { 2044 return false; 2045 } 2046 } 2047 2048 if ( 2049 ! is_object( $post_status ) || 2050 $post_status->internal || 2051 $post_status->protected 2052 ) { 2053 return false; 2054 } 2055 2056 $is_viewable = $post_status->publicly_queryable || ( $post_status->_builtin && $post_status->public ); 2057 2058 /** 2059 * Filters whether a post status is considered "viewable". 2060 * 2061 * The returned filtered value must be a boolean type to ensure 2062 * `is_post_status_viewable()` only returns a boolean. This strictness 2063 * is by design to maintain backwards-compatibility and guard against 2064 * potential type errors in PHP 8.1+. Non-boolean values (even falsey 2065 * and truthy values) will result in the function returning false. 2066 * 2067 * @since 5.9.0 2068 * 2069 * @param bool $is_viewable Whether the post status is "viewable" (strict type). 2070 * @param stdClass $post_status Post status object. 2071 */ 2072 return true === apply_filters( 'is_post_status_viewable', $is_viewable, $post_status ); 2073 } 2074 2075 /** 2076 * Determines whether a post is publicly viewable. 2077 * 2078 * Posts are considered publicly viewable if both the post status and post type 2079 * are viewable. 2080 * 2081 * @since 5.7.0 2082 * 2083 * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 2084 * @return bool Whether the post is publicly viewable. 2085 */ 2086 function is_post_publicly_viewable( $post = null ) { 2087 $post = get_post( $post ); 2088 2089 if ( ! $post ) { 2090 return false; 2091 } 2092 2093 $post_type = get_post_type( $post ); 2094 $post_status = get_post_status( $post ); 2095 2096 return is_post_type_viewable( $post_type ) && is_post_status_viewable( $post_status ); 2003 2097 } 2004 2098 … … 7476 7570 7477 7571 /** 7478 * Filters the SQL clauses of an attachment query to include filenames.7479 *7480 * @since 4.7.07481 * @access private7482 *7483 * @global wpdb $wpdb WordPress database abstraction object.7484 *7485 * @param string[] $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY,7486 * DISTINCT, fields (SELECT), and LIMITS clauses.7487 * @return string[] The modified array of clauses.7488 */7489 function _filter_query_attachment_filenames( $clauses ) {7490 global $wpdb;7491 remove_filter( 'posts_clauses', __FUNCTION__ );7492 7493 // Add a LEFT JOIN of the postmeta table so we don't trample existing JOINs.7494 $clauses['join'] .= " LEFT JOIN {$wpdb->postmeta} AS sq1 ON ( {$wpdb->posts}.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )";7495 7496 $clauses['groupby'] = "{$wpdb->posts}.ID";7497 7498 $clauses['where'] = preg_replace(7499 "/\({$wpdb->posts}.post_content (NOT LIKE|LIKE) (\'[^']+\')\)/",7500 '$0 OR ( sq1.meta_value $1 $2 )',7501 $clauses['where']7502 );7503 7504 return $clauses;7505 }7506 7507 /**7508 7572 * Sets the last changed time for the 'posts' cache group. 7509 7573 * -
branches/5.6/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r49732 r54555 90 90 // Filter query clauses to include filenames. 91 91 if ( isset( $query_args['s'] ) ) { 92 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );92 add_filter( '' ); 93 93 } 94 94 -
branches/5.6/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
r50047 r54555 136 136 137 137 /** 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 138 167 * Checks if a request has access to read terms in the specified taxonomy. 139 168 * … … 156 185 array( 'status' => rest_authorization_required_code() ) 157 186 ); 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 158 211 } 159 212 -
branches/5.6/src/wp-includes/widgets.php
r49561 r54555 1523 1523 if ( is_wp_error( $rss ) ) { 1524 1524 if ( is_admin() || current_user_can( 'manage_options' ) ) { 1525 echo '<p><strong>' . __( 'RSS Error:' ) . '</strong> ' . $rss->get_error_message() . '</p>';1525 echo '<p><strong>' . __( 'RSS Error:' ) . '</strong> ' . ) . '</p>'; 1526 1526 } 1527 1527 return; … … 1646 1646 1647 1647 if ( ! empty( $args['error'] ) ) { 1648 echo '<p class="widget-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . $args['error']. '</p>';1648 echo '<p class="widget-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . . '</p>'; 1649 1649 } 1650 1650 -
branches/5.6/src/wp-mail.php
r47580 r54555 65 65 wp_die( __( 'There doesn’t seem to be any new mail.' ) ); 66 66 } 67 68 69 67 70 68 71 for ( $i = 1; $i <= $count; $i++ ) { … … 132 135 $author = sanitize_email( $author ); 133 136 if ( is_email( $author ) ) { 134 /* translators: %s: Post author email address. */135 echo '<p>' . sprintf( __( 'Author is %s' ), $author ) . '</p>';136 137 $userdata = get_user_by( 'email', $author ); 137 138 if ( ! empty( $userdata ) ) { -
branches/5.6/src/wp-trackback.php
r49108 r54555 13 13 wp( array( 'tb' => '1' ) ); 14 14 } 15 16 17 15 18 16 19 /** -
branches/5.6/tests/phpunit/tests/query/search.php
r48939 r54555 456 456 457 457 add_post_meta( $attachment, '_wp_attached_file', 'some-image1.png', true ); 458 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );458 add_filter( '' ); 459 459 460 460 // Pass post_type a string value. … … 486 486 487 487 add_post_meta( $attachment, '_wp_attached_file', 'some-image2.png', true ); 488 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );488 add_filter( '' ); 489 489 490 490 // Pass post_type an array value. … … 545 545 add_post_meta( $attachment, '_wp_attached_file', 'some-image4.png', true ); 546 546 add_post_meta( $attachment, '_test_meta_key', 'value', true ); 547 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );547 add_filter( '' ); 548 548 549 549 // Pass post_type a string value. … … 585 585 586 586 add_post_meta( $attachment, '_wp_attached_file', 'some-image5.png', true ); 587 add_filter( ' posts_clauses', '_filter_query_attachment_filenames' );587 add_filter( '' ); 588 588 589 589 // Pass post_type a string value. … … 610 610 * @ticket 22744 611 611 */ 612 public function test_filter_query_attachment_filenames_unhooks_itself() { 613 add_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); 614 615 apply_filters( 616 'posts_clauses', 617 array( 618 'where' => '', 619 'groupby' => '', 620 'join' => '', 621 'orderby' => '', 622 'distinct' => '', 623 'fields' => '', 624 'limit' => '', 625 ) 626 ); 627 628 $result = has_filter( 'posts_clauses', '_filter_query_attachment_filenames' ); 629 630 $this->assertFalse( $result ); 612 public function test_wp_query_removes_filter_wp_allow_query_attachment_by_filename() { 613 $attachment = self::factory()->post->create( 614 array( 615 'post_type' => 'attachment', 616 'post_status' => 'publish', 617 'post_title' => 'bar foo', 618 'post_content' => 'foo bar', 619 'post_excerpt' => 'This post has foo', 620 ) 621 ); 622 623 add_post_meta( $attachment, '_wp_attached_file', 'some-image1.png', true ); 624 add_filter( 'wp_allow_query_attachment_by_filename', '__return_true' ); 625 626 $q = new WP_Query( 627 array( 628 's' => 'image1', 629 'fields' => 'ids', 630 'post_type' => 'attachment', 631 'post_status' => 'inherit', 632 ) 633 ); 634 635 $this->assertSame( array( $attachment ), $q->posts ); 636 637 /* 638 * WP_Query should have removed the wp_allow_query_attachment_by_filename filter 639 * and thus not match the attachment created above 640 */ 641 $q->get_posts(); 642 $this->assertEmpty( $q->posts ); 631 643 } 632 644 -
branches/5.6/tests/phpunit/tests/rest-api/rest-comments-controller.php
r49603 r54555 2973 2973 'author_name' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2974 2974 'author_user_agent' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2975 2975 2976 ), 2976 2977 array( … … 2981 2982 'author_name' => 'div strong', 2982 2983 'author_user_agent' => 'div strong', 2984 2983 2985 ) 2984 2986 ); … … 2990 2992 'author_name' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2991 2993 'author_user_agent' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 2994 2992 2995 ), 2993 2996 array( … … 2998 3001 'author_name' => 'div strong', 2999 3002 'author_user_agent' => 'div strong', 3003 3000 3004 ) 3001 3005 ); … … 3012 3016 'author_name' => '\\\&\\\ & &invalid; < < &lt;', 3013 3017 'author_user_agent' => '\\\&\\\ & &invalid; < < &lt;', 3018 3014 3019 ), 3015 3020 array( … … 3020 3025 'author_name' => '\\\&\\\ & &invalid; < < &lt;', 3021 3026 'author_user_agent' => '\\\&\\\ & &invalid; < < &lt;', 3027 3022 3028 ) 3023 3029 ); … … 3033 3039 'author_name' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3034 3040 'author_user_agent' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3041 3035 3042 ), 3036 3043 array( … … 3041 3048 'author_name' => 'div strong', 3042 3049 'author_user_agent' => 'div strong', 3050 3043 3051 ) 3044 3052 );
Note: See TracChangeset
for help on using the changeset viewer.