excerpt in characters

I used this code in one of my last projects: function ng_get_excerpt( $count ){ $permalink = get_permalink( $post->ID ); $excerpt = get_the_content(); $excerpt = strip_tags( $excerpt ); $excerpt = mb_substr( $excerpt, 0, $count ); $excerpt = mb_substr( $excerpt, 0, strripos( $excerpt, ” ” ) ); $excerpt = rtrim( $excerpt, “,.;:- _!$&#” ); $excerpt = $excerpt … Read more

Strange characters – despite everything being UTF-8

This is typically caused when you are copying/pasting MS Word information into the WordPress content editor. WordPress uses something called “Smart Quotes”, via a function named wptexturize(). Ideal Solution The ideal solution would be to go back through your content, and replace all single/double quotes using the keyboard. However, if you’re working with massive copy/pastes, … Read more

If a hacker changed the blog_charset to UTF-7 does that make WordPress vulnerable to further attacks?

< and > are encoded as +ADw- and +AD4- in UTF-7. Now imagine the following: Someone sends +ADw-script+AD4-alert(+ACI-Hello+ACI-)+ADw-/script+AD4- as comment text. It will pass all sanitation unescaped. The database expects and treats all incoming data as UTF-8. Since all UTF-7 streams are valid UTF-8 too, this will never result in a SQL error, and mysql_real_escape … Read more