Making WordPress.org

Changeset 2202


Ignore:
Timestamp:
12/17/2015 11:17:16 PM (9 years ago)
Author:
ocean90
Message:

Credits API: Don't remove accents from display names, encode them instead.

Fixes #1478.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/credits/wp-credits.php

    r2195 r2202  
    168168                continue;
    169169            if ( $user->display_name && $user->display_name != $user->user_nicename && false === strpos( $user->display_name , '?') )
    170                 $translators[ $user->user_nicename ] = remove_accents( $user->display_name );
     170                $translators[ $user->user_nicename ] = $this->_encode( $user->display_name );
    171171            else
    172172                $translators[ $user->user_nicename ] = $user->user_nicename;
     
    191191                continue;
    192192            if ( $user->display_name && $user->display_name != $user->user_nicename && false === strpos( $user->display_name , '?') )
    193                 $validators[ $user->user_nicename ] = array( remove_accents( $user->display_name ), md5( $user->user_email ), $user->user_nicename );
     193                $validators[ $user->user_nicename ] = array( $this->_encode( $user->display_name ), md5( $user->user_email ), $user->user_nicename );
    194194            else
    195195                $validators[ $user->user_nicename ] = array( $user->user_nicename, md5( $user->user_email ), $user->user_nicename );
     
    328328        foreach ( $user_data as $user ) {
    329329            if ( $user->display_name && $user->display_name != $user->user_nicename && false === strpos( $user->display_name , '?') )
    330                 $props[ $user->user_nicename ] = remove_accents( $user->display_name );
     330                $props[ $user->user_nicename ] = $this->_encode( $user->display_name );
    331331            else
    332332                $props[ $user->user_nicename ] = $user->user_nicename;
     
    338338
    339339        return $props;
     340    }
     341
     342    private function _encode( $raw ) {
     343        $raw = mb_convert_encoding( $raw, 'UTF-8', 'ASCII, JIS, UTF-8, Windows-1252, ISO-8859-1' );
     344        return ent2ncr( htmlspecialchars_decode( htmlentities( $raw, ENT_NOQUOTES, 'UTF-8' ), ENT_NOQUOTES ) );
    340345    }
    341346
Note: See TracChangeset for help on using the changeset viewer.