mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +00:00
Merge pull request #9691 from MrPetovan/bug/8896-unicode-tag-trimming
Add support for Unicode in Model\Tag::store
This commit is contained in:
commit
3ed4f427bf
1 changed files with 2 additions and 2 deletions
|
@ -70,8 +70,8 @@ class Tag
|
||||||
public static function store(int $uriid, int $type, string $name, string $url = '', $probing = true)
|
public static function store(int $uriid, int $type, string $name, string $url = '', $probing = true)
|
||||||
{
|
{
|
||||||
if ($type == self::HASHTAG) {
|
if ($type == self::HASHTAG) {
|
||||||
// Remove some common "garbarge" from tags
|
// Trim Unicode non-word characters
|
||||||
$name = trim($name, "\x00..\x20\xFF#!@,;.:'/?!^°$%".'"');
|
$name = preg_replace('/(^\W+)|(\W+$)/us', '', $name);
|
||||||
|
|
||||||
$tags = explode(self::TAG_CHARACTER[self::HASHTAG], $name);
|
$tags = explode(self::TAG_CHARACTER[self::HASHTAG], $name);
|
||||||
if (count($tags) > 1) {
|
if (count($tags) > 1) {
|
||||||
|
|
Loading…
Reference in a new issue