Changeset 47018
- Timestamp:
- 12/28/2019 09:18:03 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r45739 r47018 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 … … 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 } -
trunk/src/wp-includes/class-wp-query.php
r46661 r47018 390 390 */ 391 391 public $is_robots = false; 392 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; 392 400 393 401 /** … … 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; … … 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 … … 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 } … … 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 … … 4016 4029 public function is_robots() { 4017 4030 return (bool) $this->is_robots; 4031 } 4032 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; 4018 4042 } 4019 4043 -
trunk/src/wp-includes/class-wp-rewrite.php
r46685 r47018 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 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(); 1265 1268 1266 1269 // Old feed and service files. … … 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 -
trunk/src/wp-includes/class-wp.php
r46685 r47018 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 /** … … 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; -
trunk/src/wp-includes/default-filters.php
r46896 r47018 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' ); -
trunk/src/wp-includes/functions.php
r47002 r47018 1635 1635 */ 1636 1636 echo apply_filters( 'robots_txt', $output, $public ); 1637 } 1638 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; 1637 1654 } 1638 1655 -
trunk/src/wp-includes/load.php
r46760 r47018 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() { -
trunk/src/wp-includes/query.php
r46660 r47018 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 … … 641 641 642 642 return $wp_query->is_robots(); 643 } 644 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(); 643 663 } 644 664 -
trunk/src/wp-includes/template-loader.php
r45590 r47018 36 36 */ 37 37 do_action( 'do_robots' ); 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' ); 38 46 return; 39 47 } elseif ( is_feed() ) { -
trunk/src/wp-includes/version.php
r46582 r47018 21 21 * @global int $wp_db_version 22 22 */ 23 $wp_db_version = 4 5805;23 $wp_db_version = 47018; 24 24 25 25 /** -
trunk/src/wp-settings.php
r46543 r47018 63 63 // Standardize $_SERVER variables across setups. 64 64 wp_fix_server_vars(); 65 66 // Check if we have received a request due to missing favicon.ico67 wp_favicon_request();68 65 69 66 // Check if we're in maintenance mode. -
trunk/tests/phpunit/includes/abstract-testcase.php
r47001 r47018 963 963 'is_preview', 964 964 'is_robots', 965 'is_favicon', 965 966 'is_search', 966 967 'is_single', -
trunk/tests/phpunit/tests/query/vars.php
r46586 r47018 61 61 'preview', 62 62 'robots', 63 'favicon', 63 64 'taxonomy', 64 65 'term',
Note: See TracChangeset
for help on using the changeset viewer.