symbols in gallery/image name cause weird issues (urls)
Using Jamroom
Think we've got this fixed for the next jrCore version.
If you just cant wait, its /modules/jrCore/lib/util.php
This is the new version of the function:
function jrCore_strip_emoji($string, $replace = true){
if (is_string($string) && !jrCore_get_flag('jrCore_strip_emoji')) {
jrCore_set_flag('jrCore_strip_emoji', 1);
$pattern = '/([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{1FFFF}][\x{FE00}-\x{FEFF}]?/u';
if (preg_match_all($pattern, $string, $_match)) {
$_rp = array();
foreach ($_match[0] as $e) {
if (strlen($e) > 1) {
$_rp[$e] = $e;
}
}
if (count($_rp) > 0) {
if ($replace) {
$tbl = jrCore_db_table_name('jrCore', 'emoji');
$req = "SELECT * FROM {$tbl} WHERE emoji_value IN('" . implode("','", $_rp) . "')";
$_rt = jrCore_db_query($req, 'emoji_value', false, 'emoji_id', false, null, false);
foreach ($_rp as $k => $e) {
if (!$_rt || !isset($_rt[$k])) {
$req = "INSERT INTO {$tbl} (emoji_value) VALUES ('{$e}')";
$eid = jrCore_db_query($req, 'INSERT_ID', false, null, false, null, false);
$_rt[$k] = $eid;
}
else {
$eid = $_rt[$k];
}
if ($eid && $eid > 0) {
$string = str_replace($e, "!!emoji!!{$eid}!!emoji!!", $string);
}
}
}
else {
foreach ($_rp as $k => $e) {
$string = str_replace($e, '', $string);
}
}
}
}
jrCore_delete_flag('jrCore_strip_emoji');
return jrCore_strip_non_utf8($string);
}
return $string;
}