WordPress.org

Making WordPress.org

Changeset 3395


Ignore:
Timestamp:
06/17/2016 07:39:38 AM (5 years ago)
Author:
obenland
Message:

Plugin Directory: Properly encode display names.

H/t ocean90.

See #1719.

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r3341 r3395  
    415415        }
    416416    }
     417
     418    /**
     419     * Properly encodes a string to UTF-8.
     420     *
     421     * @param string $string
     422     * @return string
     423     */
     424    public static function encode( $string ) {
     425        $string = mb_convert_encoding( $string, 'UTF-8', 'ASCII, JIS, UTF-8, Windows-1252, ISO-8859-1' );
     426
     427        return ent2ncr( htmlspecialchars_decode( htmlentities( $string, ENT_NOQUOTES, 'UTF-8' ), ENT_NOQUOTES ) );
     428    }
    417429}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-developers.php

    r3292 r3395  
    11<?php
    22namespace WordPressdotorg\Plugin_Directory\Shortcodes;
     3use WordPressdotorg\Plugin_Directory\Template;
    34use WordPressdotorg\Plugin_Directory\Tools;
    45
     
    2728            }
    2829
    29             $output .= '<li>' . get_avatar( $contributor->ID, 32 ) . utf8_encode( $contributor->display_name ) . '</li>';
     30            $output .= '<li>' . get_avatar( $contributor->ID, 32 ) . Template::encode( $contributor->display_name ) . '</li>';
    3031        }
    3132        $output .= '</ul>';
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r3356 r3395  
    3939        <?php the_title( '<h1 class="plugin-title">', '</h1>' ); ?>
    4040
    41         <span class="byline"><?php printf( esc_html_x( 'By %s', 'post author', 'wporg-plugins' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( utf8_encode( get_the_author() ) ) . '</a></span>' ); ?></span>
     41        <span class="byline"><?php printf( esc_html_x( 'By %s', 'post author', 'wporg-plugins' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( Template::encode( get_the_author() ) ) . '</a></span>' ); ?></span>
    4242    </header><!-- .entry-header -->
    4343
Note: See TracChangeset for help on using the changeset viewer.