Make WordPress Core

Ticket #40089: 40089.diff

File 40089.diff, 2.2 KB (added by NomNom99, 7 years ago)

Fix coding standards

  • src/wp-includes/taxonomy.php

     
    38473847function get_term_link( $term, $taxonomy = '' ) {
    38483848        global $wp_rewrite;
    38493849
    3850         if ( !is_object($term) ) {
     3850        if ( ! is_object( $term ) ) {
    38513851                if ( is_int( $term ) ) {
    38523852                        $term = get_term( $term, $taxonomy );
    38533853                } else {
     
    38553855                }
    38563856        }
    38573857
    3858         if ( !is_object($term) )
     3858        if ( ! is_object( $term ) )
    38593859                $term = new WP_Error('invalid_term', __('Empty Term'));
    38603860
    38613861        if ( is_wp_error( $term ) )
     
    38633863
    38643864        $taxonomy = $term->taxonomy;
    38653865
    3866         $termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
     3866        $termlink = $wp_rewrite->get_extra_permastruct( $taxonomy );
    38673867
    38683868        $slug = $term->slug;
    3869         $t = get_taxonomy($taxonomy);
     3869        $t = get_taxonomy( $taxonomy );
    38703870
    3871         if ( empty($termlink) ) {
     3871        if ( empty( $termlink ) ) {
    38723872                if ( 'category' == $taxonomy )
    38733873                        $termlink = '?cat=' . $term->term_id;
    38743874                elseif ( $t->query_var )
     
    38753875                        $termlink = "?$t->query_var=$slug";
    38763876                else
    38773877                        $termlink = "?taxonomy=$taxonomy&term=$slug";
    3878                 $termlink = home_url($termlink);
     3878                $termlink = home_url( $termlink );
    38793879        } else {
    38803880                if ( $t->rewrite['hierarchical'] ) {
    38813881                        $hierarchical_slugs = array();
    38823882                        $ancestors = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' );
    3883                         foreach ( (array)$ancestors as $ancestor ) {
    3884                                 $ancestor_term = get_term($ancestor, $taxonomy);
     3883                        foreach ( ( array )$ancestors as $ancestor ) {
     3884                                $ancestor_term = get_term( $ancestor, $taxonomy );
    38853885                                $hierarchical_slugs[] = $ancestor_term->slug;
    38863886                        }
    3887                         $hierarchical_slugs = array_reverse($hierarchical_slugs);
     3887                        $hierarchical_slugs = array_reverse( $hierarchical_slugs );
    38883888                        $hierarchical_slugs[] = $slug;
    3889                         $termlink = str_replace("%$taxonomy%", implode('/', $hierarchical_slugs), $termlink);
     3889                        $termlink = str_replace( "%$taxonomy%", implode( '/', $hierarchical_slugs ), $termlink );
    38903890                } else {
    3891                         $termlink = str_replace("%$taxonomy%", $slug, $termlink);
     3891                        $termlink = str_replace( "%$taxonomy%", $slug, $termlink );
    38923892                }
    38933893                $termlink = home_url( user_trailingslashit($termlink, 'category') );
    38943894        }