Ticket #47398: 47398.6.diff
File 47398.6.diff, 11.4 KB (added by , 5 years ago) |
---|
-
src/wp-includes/canonical.php
19 19 * 20 20 * Prevents redirection for feeds, trackbacks, searches, and 21 21 * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+, 22 * page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST23 * requests.22 * page/post previews, WP admin, Trackbacks, robots.txt, favicon.ico, searches, 23 * or on POST requests. 24 24 * 25 25 * Will also attempt to find the correct link when a user enters a URL that does 26 26 * not exist based on exact WordPress query. Will instead try to parse the URL … … 56 56 } 57 57 } 58 58 59 if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || ( $is_IIS && ! iis7_supports_permalinks() ) ) {59 if ( is_trackback() || is_search() || is_admin() || is_preview() || is_robots() || is_favicon() || ( $is_IIS && ! iis7_supports_permalinks() ) ) { 60 60 return; 61 61 } 62 62 -
src/wp-includes/class-wp-query.php
391 391 public $is_robots = false; 392 392 393 393 /** 394 * Signifies whether the current query is for the favicon.ico file. 395 * 396 * @since 5.4.0 397 * @var bool 398 */ 399 public $is_favicon = false; 400 401 /** 394 402 * Signifies whether the current query is for the page_for_posts page. 395 403 * 396 404 * Basically, the homepage if the option isn't set for the static homepage. … … 478 486 $this->is_attachment = false; 479 487 $this->is_singular = false; 480 488 $this->is_robots = false; 489 $this->is_favicon = false; 481 490 $this->is_posts_page = false; 482 491 $this->is_post_type_archive = false; 483 492 } … … 744 753 745 754 if ( ! empty( $qv['robots'] ) ) { 746 755 $this->is_robots = true; 756 } elseif ( ! empty( $qv['favicon'] ) ) { 757 $this->is_favicon = true; 747 758 } 748 759 749 760 if ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) { … … 957 968 $this->is_comment_feed = true; 958 969 } 959 970 960 if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) ) { 971 if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed 972 || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) 973 || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots || $this->is_favicon ) ) { 961 974 $this->is_home = true; 962 975 } 963 976 … … 4007 4020 } 4008 4021 4009 4022 /** 4010 * Is the query for the robots file?4023 * Is the query for the robots.txt file? 4011 4024 * 4012 4025 * @since 3.1.0 4013 4026 * … … 4018 4031 } 4019 4032 4020 4033 /** 4034 * Is the query for the favicon.ico file? 4035 * 4036 * @since 5.4.0 4037 * 4038 * @return bool 4039 */ 4040 public function is_favicon() { 4041 return (bool) $this->is_favicon; 4042 } 4043 4044 /** 4021 4045 * Is the query for a search? 4022 4046 * 4023 4047 * @since 3.1.0 -
src/wp-includes/class-wp-rewrite.php
1259 1259 return $rewrite; 1260 1260 } 1261 1261 1262 // robots.txt - only if installed at the root1262 // robots.txt -- only if installed at the root 1263 1263 $home_path = parse_url( home_url() ); 1264 1264 $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array(); 1265 1265 1266 // favicon.ico -- only if installed at the root 1267 $favicon_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array(); 1268 1266 1269 // Old feed and service files. 1267 1270 $deprecated_files = array( 1268 1271 '.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old', … … 1419 1422 1420 1423 // Put them together. 1421 1424 if ( $this->use_verbose_page_rules ) { 1422 $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $ deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules );1425 $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules ); 1423 1426 } else { 1424 $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $ deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules );1427 $this->rules = array_merge( $this->extra_rules_top, $robots_rewrite, $favicon_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules ); 1425 1428 } 1426 1429 1427 1430 /** -
src/wp-includes/class-wp.php
14 14 * @since 2.0.0 15 15 * @var string[] 16 16 */ 17 public $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', ' taxonomy', 'term', 'cpage', 'post_type', 'embed' );17 public $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'favicon', 'taxonomy', 'term', 'cpage', 'post_type', 'embed' ); 18 18 19 19 /** 20 20 * Private query variables. … … 659 659 return; 660 660 } 661 661 662 // Never 404 for the admin, robots, or if we found posts.663 if ( is_admin() || is_robots() || $wp_query->posts ) {662 // Never 404 for the admin, robots, favicon, or if we found posts. 663 if ( is_admin() || is_robots() || is_favicon() || $wp_query->posts ) { 664 664 665 665 $success = true; 666 666 if ( is_singular() ) { -
src/wp-includes/default-filters.php
338 338 add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 ); 339 339 add_action( 'do_pings', 'do_all_pings', 10, 0 ); 340 340 add_action( 'do_robots', 'do_robots' ); 341 add_action( 'do_favicon', 'do_favicon' ); 341 342 add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 ); 342 343 add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' ); 343 344 add_action( 'admin_print_scripts', 'print_emoji_detection_script' ); -
src/wp-includes/functions.php
1637 1637 } 1638 1638 1639 1639 /** 1640 * Display the favicon.ico file content. 1641 * 1642 * @since 5.4.0 1643 */ 1644 function do_favicon() { 1645 /** 1646 * Fires when serving the favicon.ico file. 1647 * 1648 * @since 5.4.0 1649 */ 1650 do_action( 'do_faviconico' ); 1651 1652 wp_redirect( get_site_icon_url( 32, admin_url( 'images/w-logo-blue.png' ) ) ); 1653 exit; 1654 } 1655 1656 /** 1640 1657 * Determines whether WordPress is already installed. 1641 1658 * 1642 1659 * The cache will be checked first. If you have a cache plugin, which saves -
src/wp-includes/load.php
160 160 * Instead, send the headers for a zero-length favicon and bail. 161 161 * 162 162 * @since 3.0.0 163 * @deprecated 5.4.0 Deprecated in favor of do_favicon(). 163 164 */ 164 165 function wp_favicon_request() { 165 166 if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) { -
src/wp-includes/query.php
623 623 } 624 624 625 625 /** 626 * Is the query for the robots file?626 * Is the query for the robots.txt file? 627 627 * 628 628 * @since 2.1.0 629 629 * … … 643 643 } 644 644 645 645 /** 646 * Is the query for the favicon.ico file? 647 * 648 * @since 5.4.0 649 * 650 * @global WP_Query $wp_query WordPress Query object. 651 * 652 * @return bool 653 */ 654 function is_favicon() { 655 global $wp_query; 656 657 if ( ! isset( $wp_query ) ) { 658 _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); 659 return false; 660 } 661 662 return $wp_query->is_favicon(); 663 } 664 665 /** 646 666 * Determines whether the query is for a search. 647 667 * 648 668 * For more information on this and similar theme functions, check out -
src/wp-includes/template-loader.php
36 36 */ 37 37 do_action( 'do_robots' ); 38 38 return; 39 } elseif ( is_favicon() ) { 40 /** 41 * Fired when the template loader determines a favicon.ico request. 42 * 43 * @since 5.4.0 44 */ 45 do_action( 'do_favicon' ); 46 return; 39 47 } elseif ( is_feed() ) { 40 48 do_feed(); 41 49 return; -
src/wp-includes/version.php
20 20 * 21 21 * @global int $wp_db_version 22 22 */ 23 $wp_db_version = 4 5805;23 $wp_db_version = 47018; 24 24 25 25 /** 26 26 * Holds the TinyMCE version -
src/wp-settings.php
63 63 // Standardize $_SERVER variables across setups. 64 64 wp_fix_server_vars(); 65 65 66 // Check if we have received a request due to missing favicon.ico67 wp_favicon_request();68 69 66 // Check if we're in maintenance mode. 70 67 wp_maintenance(); 71 68 -
tests/phpunit/includes/abstract-testcase.php
962 962 'is_posts_page', 963 963 'is_preview', 964 964 'is_robots', 965 'is_favicon', 965 966 'is_search', 966 967 'is_single', 967 968 'is_singular', -
tests/phpunit/tests/query/vars.php
60 60 'subpost_id', 61 61 'preview', 62 62 'robots', 63 'favicon', 63 64 'taxonomy', 64 65 'term', 65 66 'cpage',