Changeset 47219 for trunk/src/wp-includes/link-template.php
- Timestamp:
- 02/09/2020 04:52:28 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/link-template.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r47122 r47219 143 143 } 144 144 145 if ( $post->post_type == 'page') {145 if ( 'page' === $post->post_type ) { 146 146 return get_page_link( $post, $leavename, $sample ); 147 } elseif ( $post->post_type == 'attachment') {147 } elseif ( 'attachment' === $post->post_type ) { 148 148 return get_attachment_link( $post, $leavename ); 149 149 } elseif ( in_array( $post->post_type, get_post_types( array( '_builtin' => false ) ) ) ) { … … 333 333 $post = get_post( $post ); 334 334 335 if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' )) {335 if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { 336 336 $link = home_url( '/' ); 337 337 } else { … … 423 423 424 424 if ( $wp_rewrite->using_permalinks() && $parent ) { 425 if ( 'page' == $parent->post_type ) {425 if ( 'page' === $parent->post_type ) { 426 426 $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front. 427 427 } else { … … 683 683 684 684 if ( '' != get_option( 'permalink_structure' ) ) { 685 if ( 'page' == get_option( 'show_on_front' ) && $post_id == get_option( 'page_on_front' )) {685 if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post_id ) { 686 686 $url = _get_page_link( $post_id ); 687 687 } else { … … 691 691 if ( $unattached ) { 692 692 $url = home_url( '/feed/' ); 693 if ( $feed !== get_default_feed()) {693 if ( get_default_feed() !== $feed ) { 694 694 $url .= "$feed/"; 695 695 } … … 697 697 } else { 698 698 $url = trailingslashit( $url ) . 'feed'; 699 if ( $feed != get_default_feed()) {699 if ( get_default_feed() != $feed ) { 700 700 $url .= "/$feed"; 701 701 } … … 711 711 home_url( '/' ) 712 712 ); 713 } elseif ( 'page' == $post->post_type ) {713 } elseif ( 'page' === $post->post_type ) { 714 714 $url = add_query_arg( 715 715 array( … … 799 799 } else { 800 800 $link = get_author_posts_url( $author_id ); 801 if ( $feed == get_default_feed()) {801 if ( get_default_feed() == $feed ) { 802 802 $feed_link = 'feed'; 803 803 } else { … … 878 878 } else { 879 879 $link = get_term_link( $term_id, $term->taxonomy ); 880 if ( $feed == get_default_feed()) {880 if ( get_default_feed() == $feed ) { 881 881 $feed_link = 'feed'; 882 882 } else { … … 1223 1223 $page_for_posts = get_option( 'page_for_posts' ); 1224 1224 1225 if ( 'page' == $show_on_front && $page_for_posts ) {1225 if ( 'page' === $show_on_front && $page_for_posts ) { 1226 1226 $link = get_permalink( $page_for_posts ); 1227 1227 } else { … … 3635 3635 if ( ! $scheme ) { 3636 3636 $scheme = is_ssl() ? 'https' : 'http'; 3637 } elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc') {3637 } elseif ( 'admin' === $scheme || 'login' === $scheme || 'login_post' === $scheme || 'rpc' === $scheme ) { 3638 3638 $scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http'; 3639 } elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative') {3639 } elseif ( 'http' !== $scheme && 'https' !== $scheme && 'relative' !== $scheme ) { 3640 3640 $scheme = is_ssl() ? 'https' : 'http'; 3641 3641 } … … 3648 3648 if ( 'relative' == $scheme ) { 3649 3649 $url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) ); 3650 if ( $url !== '' && $url[0] === '/') {3650 if ( '' !== $url && '/' === $url[0] ) { 3651 3651 $url = '/' . ltrim( $url, "/ \t\n\r\0\x0B" ); 3652 3652 } … … 3780 3780 3781 3781 // If a canonical is being generated for the current page, make sure it has pagination if needed. 3782 if ( $post->ID === get_queried_object_id()) {3782 if ( get_queried_object_id() === $post->ID ) { 3783 3783 $page = get_query_var( 'page', 0 ); 3784 3784 if ( $page >= 2 ) { … … 3888 3888 $post_type = get_post_type_object( $post->post_type ); 3889 3889 3890 if ( 'page' === $post->post_type && $post->ID == get_option( 'page_on_front' ) && 'page'== get_option( 'show_on_front' ) ) {3890 if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) { 3891 3891 $shortlink = home_url( '/' ); 3892 3892 } elseif ( $post_type->public ) {
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)