WordPress.org

Making WordPress.org


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

Plugin Directory: Properly encode display names.

H/t ocean90.

See #1719.

File:
1 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}
Note: See TracChangeset for help on using the changeset viewer.