Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. // Filter the content as it could contain word special characters...
  2.     $content = $row['post_content'];
  3.     // First clean it all up...
  4.     $content = htmlspecialchars($content);
  5.     $content = htmlentities($content);
  6.     // Secondly, replace UTF-8 characters.
  7.     $content = str_replace(
  8.     array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"),
  9.     array("'", "'", '"', '"', '-', '--', '...'),
  10.     $content);
  11.     // Next, replace their Windows-1252 equivalents.
  12.     $content = str_replace(
  13.     array(chr(145), chr(146), chr(147), chr(148), chr(149), chr(150), chr(151), chr(133)),
  14.     array("'", "'", '"', '"', '•', '-', '--', '...'),
  15.     $content);
  16.     $content = iconv("UTF-8", "UTF-8//IGNORE", $content);
Add Comment
Please, Sign In to add comment