try different function for stripping emoji
This commit is contained in:
@@ -5,9 +5,51 @@
|
|||||||
* Taken from https://www.drupal.org/node/2043439#comment-8213973
|
* Taken from https://www.drupal.org/node/2043439#comment-8213973
|
||||||
*/
|
*/
|
||||||
function _booking_remove_emoji($text){
|
function _booking_remove_emoji($text){
|
||||||
return preg_replace('/([0-9|#][\x{20E3}])|[\x{00ae}|\x{00a9}|\x{203C}|\x{2047}|\x{2048}|\x{2049}|\x{3030}|\x{303D}|\x{2139}|\x{2122}|\x{3297}|\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]?/u', '', $text);
|
//return preg_replace('/([0-9|#][\x{20E3}])|[\x{00ae}|\x{00a9}|\x{203C}|\x{2047}|\x{2048}|\x{2049}|\x{3030}|\x{303D}|\x{2139}|\x{2122}|\x{3297}|\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}][\x{FE00}-\x{FEFF}]?/u', '', $text);
|
||||||
|
//this if from https://stackoverflow.com/a/41831874/7638834
|
||||||
|
$clean_text = "";
|
||||||
|
|
||||||
|
// Match Emoticons
|
||||||
|
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
|
||||||
|
$clean_text = preg_replace($regexEmoticons, '', $text);
|
||||||
|
|
||||||
|
// Match Miscellaneous Symbols and Pictographs
|
||||||
|
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
|
||||||
|
$clean_text = preg_replace($regexSymbols, '', $clean_text);
|
||||||
|
|
||||||
|
// Match Transport And Map Symbols
|
||||||
|
$regexTransport = '/[\x{1F680}-\x{1F6FF}]/u';
|
||||||
|
$clean_text = preg_replace($regexTransport, '', $clean_text);
|
||||||
|
|
||||||
|
// Match Miscellaneous Symbols
|
||||||
|
$regexMisc = '/[\x{2600}-\x{26FF}]/u';
|
||||||
|
$clean_text = preg_replace($regexMisc, '', $clean_text);
|
||||||
|
|
||||||
|
// Match Dingbats
|
||||||
|
$regexDingbats = '/[\x{2700}-\x{27BF}]/u';
|
||||||
|
$clean_text = preg_replace($regexDingbats, '', $clean_text);
|
||||||
|
|
||||||
|
// Match Flags
|
||||||
|
$regexDingbats = '/[\x{1F1E6}-\x{1F1FF}]/u';
|
||||||
|
$clean_text = preg_replace($regexDingbats, '', $clean_text);
|
||||||
|
|
||||||
|
// Others
|
||||||
|
$regexDingbats = '/[\x{1F910}-\x{1F95E}]/u';
|
||||||
|
$clean_text = preg_replace($regexDingbats, '', $clean_text);
|
||||||
|
|
||||||
|
$regexDingbats = '/[\x{1F980}-\x{1F991}]/u';
|
||||||
|
$clean_text = preg_replace($regexDingbats, '', $clean_text);
|
||||||
|
|
||||||
|
$regexDingbats = '/[\x{1F9C0}]/u';
|
||||||
|
$clean_text = preg_replace($regexDingbats, '', $clean_text);
|
||||||
|
|
||||||
|
$regexDingbats = '/[\x{1F9F9}]/u';
|
||||||
|
$clean_text = preg_replace($regexDingbats, '', $clean_text);
|
||||||
|
|
||||||
|
return $clean_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to perform some validity checking of email addresses
|
* Helper function to perform some validity checking of email addresses
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user