Ticket #47398: 47398.3.diff
File 47398.3.diff, 11.0 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.3.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 } … … 742 751 743 752 if ( ! empty( $qv['robots'] ) ) { 744 753 $this->is_robots = true; 754 } elseif ( ! empty( $qv['favicon'] ) ) { 755 $this->is_favicon = true; 745 756 } 746 757 747 758 if ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) { … … 955 966 $this->is_comment_feed = true; 956 967 } 957 968 958 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 ) ) { 969 if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed 970 || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) 971 || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots || $this->is_favicon ) ) { 959 972 $this->is_home = true; 960 973 } 961 974 … … 3998 4011 } 3999 4012 4000 4013 /** 4001 * Is the query for the robots file?4014 * Is the query for the robots.txt file? 4002 4015 * 4003 4016 * @since 3.1.0 4004 4017 * … … 4009 4022 } 4010 4023 4011 4024 /** 4025 * Is the query for the favicon.ico file? 4026 * 4027 * @since 5.2.0 4028 * 4029 * @return bool 4030 */ 4031 public function is_favicon() { 4032 return (bool) $this->is_favicon; 4033 } 4034 4035 /** 4012 4036 * Is the query for a search? 4013 4037 * 4014 4038 * @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', 'static', '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', 'static', '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. … … 662 662 return; 663 663 } 664 664 665 // Never 404 for the admin, robots, or if we found posts.666 if ( is_admin() || is_robots() || $wp_query->posts ) {665 // Never 404 for the admin, robots, favicon, or if we found posts. 666 if ( is_admin() || is_robots() || is_favicon() || $wp_query->posts ) { 667 667 668 668 $success = true; 669 669 if ( is_singular() ) { -
src/wp-includes/default-filters.php
339 339 add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 ); 340 340 add_action( 'do_pings', 'do_all_pings', 10, 1 ); 341 341 add_action( 'do_robots', 'do_robots' ); 342 add_action( 'do_favicon', 'do_favicon' ); 342 343 add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 ); 343 344 add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' ); 344 345 add_action( 'admin_print_scripts', 'print_emoji_detection_script' ); -
src/wp-includes/functions.php
1497 1497 } 1498 1498 1499 1499 /** 1500 * Display the favicon.ico file content. 1501 * 1502 * @since 5.3.0 1503 */ 1504 function do_favicon() { 1505 /** 1506 * Fires when serving the favicon.ico file. 1507 * 1508 * @since 5.3.0 1509 */ 1510 do_action( 'do_faviconico' ); 1511 1512 if ( has_site_icon() ) { 1513 $site_icon_id = get_option( 'site_icon' ); 1514 $site_icon = wp_get_attachment_image_src( $site_icon_id, array( 32, 32 ) ); 1515 $site_icon = $site_icon[0]; 1516 } else { 1517 $site_icon = ABSPATH . 'wp-admin/images/w-logo-blue.png'; 1518 } 1519 1520 $filetype = wp_check_filetype( $site_icon ); 1521 if ( $filetype['type'] ) { 1522 $mime_type = $filetype['type']; 1523 } else { 1524 $mime_type = 'image/x-icon'; 1525 } 1526 1527 header( "Content-Type: $mime_type" ); 1528 readfile( $site_icon ); 1529 exit; 1530 } 1531 1532 /** 1500 1533 * Determines whether WordPress is already installed. 1501 1534 * 1502 1535 * The cache will be checked first. If you have a cache plugin, which saves -
src/wp-includes/load.php
162 162 * Instead, send the headers for a zero-length favicon and bail. 163 163 * 164 164 * @since 3.0.0 165 * @deprecated 5.3.0 Deprecated in favor of do_favicon(). 165 166 */ 166 167 function wp_favicon_request() { 167 168 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.3.0 649 * 650 * @global WP_Query $wp_query Global WP_Query instance. 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.3.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 4719;23 $wp_db_version = 45458; 24 24 25 25 /** 26 26 * Holds the TinyMCE version -
src/wp-settings.php
67 67 // Standardize $_SERVER variables across setups. 68 68 wp_fix_server_vars(); 69 69 70 // Check if we have received a request due to missing favicon.ico71 wp_favicon_request();72 73 70 // Check if we're in maintenance mode. 74 71 wp_maintenance(); 75 72