Skip to content

Commit

Permalink
Update Util.php
Browse files Browse the repository at this point in the history
  • Loading branch information
thenbsp committed Apr 23, 2016
1 parent 8501dc7 commit c339f16
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Bridge/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,18 @@ public static function getRandomString($length = 10)
*/
public static function filterNickname($nickname)
{
$nickname = preg_replace('/[\x{1F600}-\x{1F64F}]/u', '', $nickname);
$nickname = preg_replace('/[\x{1F300}-\x{1F5FF}]/u', '', $nickname);
$nickname = preg_replace('/[\x{1F680}-\x{1F6FF}]/u', '', $nickname);
$nickname = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $nickname);
$nickname = preg_replace('/[\x{2700}-\x{27BF}]/u', '', $nickname);
$pattern = array(
'/\xEE[\x80-\xBF][\x80-\xBF]/',
'/\xEF[\x81-\x83][\x80-\xBF]/',
'/[\x{1F600}-\x{1F64F}]/u',
'/[\x{1F300}-\x{1F5FF}]/u',
'/[\x{1F680}-\x{1F6FF}]/u',
'/[\x{2600}-\x{26FF}]/u',
'/[\x{2700}-\x{27BF}]/u',
'/[\x{20E3}]/u'
);

$nickname = preg_replace($pattern, '', $nickname);

return trim($nickname);
}
Expand Down

0 comments on commit c339f16

Please sign in to comment.