Making WordPress.org

Changeset 5061


Ignore:
Timestamp:
03/03/2017 07:10:34 PM (10 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Use home_url() instead of hardcoded URLs in theme and plugin forums.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php

    r5059 r5061  
    8787                                        switch ( $r ) {
    8888                                                case 'rss' :
    89                                                         $url = sprintf( 'https://wordpress.org/support/%s/%s/feed/',
     89                                                        $url = sprintf( home_url( '/%s/%s/feed/' ),
    9090                                                                $this->compat(),
    9191                                                                        sanitize_key( $slug[0] ) );
    9292                                                        break;
    9393                                                case 'reviews' :
    94                                                         $url = sprintf( 'https://wordpress.org/support/%s/%s/reviews/',
     94                                                        $url = sprintf( home_url( '/%s/%s/reviews/' ),
    9595                                                                $this->compat(),
    9696                                                                sanitize_key( $slug[0] ) );
    9797                                                        break;
    9898                                                case 'reviews_rss' :
    99                                                         $url = sprintf( 'https://wordpress.org/support/%s/%s/reviews/feed/',
     99                                                        $url = sprintf( home_url( '/%s/%s/reviews/feed/' ),
    100100                                                                $this->compat(),
    101101                                                                sanitize_key( $slug[0] ) );
    … …  
    735735                        if ( $this->taxonomy() == $taxonomy ) {
    736736                                $paged = get_query_var( 'paged' ) > 1 ? 'page/' . absint( get_query_var( 'paged' ) ) . '/' : '';
    737                                 $termlink = sprintf( 'https://wordpress.org/support/%s/%s/%s', $this->compat(), $term->slug, $paged );
     737                                $termlink = sprintf( home_url( '/%s/%s/%s' ), $this->compat(), $term->slug, $paged );
    738738                        }
    739739                }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin-directory-compat.php

    r5059 r5061  
    9595                $plugin     = sprintf( '<a href="//wordpress.org/plugins/%s/">%s</a>', esc_attr( $this->slug() ), esc_html( $this->plugin->post_title ) );
    9696                $faq        = sprintf( '<a href="//wordpress.org/plugins/%s/faq/">%s</a>', esc_attr( $this->slug() ), __( 'Frequently Asked Questions', 'wporg-forums' ) );
    97                 $support    = sprintf( '<a href="//wordpress.org/support/plugin/%s/">%s</a>', esc_attr( $this->slug() ), __( 'Support Threads', 'wporg-forums' ) );
    98                 $active     = sprintf( '<a href="//wordpress.org/support/plugin/%s/active/">%s</a>', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) );
    99                 $unresolved = sprintf( '<a href="//wordpress.org/support/plugin/%s/unresolved/">%s</a>', esc_attr( $this->slug() ), __( 'Unresolved Topics', 'wporg-forums' ) );
    100                 $reviews    = sprintf( '<a href="//wordpress.org/support/plugin/%s/reviews/">%s</a>', esc_attr( $this->slug() ), __( 'Reviews', 'wporg-forums' ) );
     97                $support    = sprintf( '<a href="%s">%s</a>', home_url( '/plugin/' . esc_attr( $this->slug() ) . '/' ), __( 'Support Threads', 'wporg-forums' ) );
     98                $active     = sprintf( '<a href="%s">%s</a>', home_url( '/plugin/' . esc_attr( $this->slug() ) . '/active/' ), __( 'Active Topics', 'wporg-forums' ) );
     99                $unresolved = sprintf( '<a href="%s">%s</a>', home_url( '/plugin/' . esc_attr( $this->slug() ) . '/unresolved/' ), __( 'Unresolved Topics', 'wporg-forums' ) );
     100                $reviews    = sprintf( '<a href="%s">%s</a>', home_url( '/plugin/' . esc_attr( $this->slug() ) . '/reviews/' ), __( 'Reviews', 'wporg-forums' ) );
    101101                $create     = '';
    102102
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-ratings-compat.php

    r4936 r5061  
    116116                                        $notice = _x( 'This is your review of %1$s, you can <a href="%2$s">edit your review</a> at any time.', 'plugin', 'wporg-forums' );
    117117                                        $object_link = sprintf( '<a href="//wordpress.org/plugins/%s/">%s</a>', esc_attr( $this->slug ), esc_html( $this->object->post_title ) );
    118                                         $edit_url = sprintf( '//wordpress.org/support/plugin/%s/reviews/#new-post', esc_attr( $this->slug ) );
     118                                        $edit_url = sprintf( home_url( '/plugin/%s/reviews/#new-post' ), esc_attr( $this->slug ) );
    119119                                        break;
    120120                                case 'theme' :
    … …  
    122122                                        $notice = _x( 'This is your review of %1$s, you can <a href="%2$s">edit your review</a> at any time.', 'theme', 'wporg-forums' );
    123123                                        $object_link = sprintf( '<a href="//wordpress.org/themes/%s/">%s</a>', esc_attr( $this->slug ), esc_html( $this->object->post_title ) );
    124                                         $edit_url = sprintf( '//wordpress.org/support/theme/%s/reviews/#new-post', esc_attr( $this->slug ) );
     124                                        $edit_url = sprintf( home_url( '/theme/%s/reviews/#new-post' ), esc_attr( $this->slug ) );
    125125                                        break;
    126126                        }
    … …  
    201201                                ?>
    202202                                <div class="counter-container">
    203                                 <a href="<?php echo esc_url( sprintf( 'https://wordpress.org/support/%s/%s/reviews/?filter=%s', $this->compat, $this->slug, $rating ) ); ?>"
     203                                <a href="<?php echo esc_url( sprintf( home_url( '/%s/%s/reviews/?filter=%s' ), $this->compat, $this->slug, $rating ) ); ?>"
    204204                                        title="<?php echo esc_attr( $stars_title ); ?>">
    205205                                        <span class="counter-label" style="float:left;margin-right:5px;min-width:58px;"><?php echo esc_html( $stars_text ); ?></span>
    … …  
    242242                                        add_query_arg(
    243243                                                'redirect_to',
    244                                                 urlencode( esc_url_raw( sprintf( 'https://wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) ) ),
     244                                                urlencode( esc_url_raw( sprintf( home_url( '/%s/%s/reviews/' ), $this->compat, $this->slug ) ) ),
    245245                                                'https://login.wordpress.org/'
    246246                                        )
    … …  
    269269                                /* translators: %s: plugin/theme reviews URL */
    270270                                __( '<a href="%s">Click here</a> to see all reviews.', 'wporg-forums' ),
    271                                 esc_url( sprintf( '//wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) )
     271                                esc_url( sprintf( home_url( '/%s/%s/reviews/' ), $this->compat, $this->slug ) )
    272272                        );
    273273                        echo "</p>\n";
    … …  
    332332                                add_query_arg(
    333333                                        'redirect_to',
    334                                         urlencode( esc_url_raw( sprintf( 'https://wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) ) ),
     334                                        urlencode( esc_url_raw( sprintf( home_url( '/%s/%s/reviews/' ), $this->compat, $this->slug ) ) ),
    335335                                        'https://login.wordpress.org/'
    336336                                )
    … …  
    381381                <p><?php _e( 'When posting a review, follow these guidelines:', 'wporg-forums' ); ?></p>
    382382                <ul>
    383                         <li><?php printf( $report, esc_url( sprintf( 'https://wordpress.org/support/%s/%s/', $this->compat, $this->slug ) ) ); ?></li>
     383                        <li><?php printf( $report, esc_url( sprintf( home_url( '/%s/%s/' ), $this->compat, $this->slug ) ) ); ?></li>
    384384                        <li><?php echo esc_html( $rate ); ?></li>
    385385                        <li><?php esc_html_e( 'Please provide as much detail as you can to justify your rating and to help others.', 'wporg-forums' ); ?></li>
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-support-compat.php

    r4894 r5061  
    458458                }
    459459
    460                 $url = 'https://wordpress.org/support/' . $type . '/' . $obj->post_name . '/';
     460                $url = home_url( '/' . $type . '/' . $obj->post_name . '/' );
    461461                if ( $forum_id === Plugin::REVIEWS_FORUM_ID ) {
    462462                        $url .= 'reviews';
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php

    r5059 r5061  
    9090        public function do_topic_sidebar() {
    9191                $theme      = sprintf( '<a href="//wordpress.org/themes/%s/">%s</a>', esc_attr( $this->slug() ), esc_html( $this->theme->post_title ) );
    92                 $support    = sprintf( '<a href="//wordpress.org/support/theme/%s/">%s</a>', esc_attr( $this->slug() ), __( 'Support Threads', 'wporg-forums' ) );
    93                 $active     = sprintf( '<a href="//wordpress.org/support/theme/%s/active/">%s</a>', esc_attr( $this->slug() ), __( 'Active Topics', 'wporg-forums' ) );
    94                 $unresolved = sprintf( '<a href="//wordpress.org/support/theme/%s/unresolved/">%s</a>', esc_attr( $this->slug() ), __( 'Unresolved Topics', 'wporg-forums' ) );
    95                 $reviews    = sprintf( '<a href="//wordpress.org/support/theme/%s/reviews/">%s</a>', esc_attr( $this->slug() ), __( 'Reviews', 'wporg-forums' ) );
     92                $support    = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/' ), __( 'Support Threads', 'wporg-forums' ) );
     93                $active     = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/active/' ), __( 'Active Topics', 'wporg-forums' ) );
     94                $unresolved = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/unresolved/' ), __( 'Unresolved Topics', 'wporg-forums' ) );
     95                $reviews    = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/reviews/' ), __( 'Reviews', 'wporg-forums' ) );
    9696                $create     = '';
    9797
Note: See TracChangeset for help on using the changeset viewer.