|
|
|
@ -104,6 +104,33 @@
|
|
|
|
|
isset($languages[$room_identifier])
|
|
|
|
|
? $languages[$room_identifier]
|
|
|
|
|
: "";
|
|
|
|
|
|
|
|
|
|
$this->extract_tags_from_description();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private const DESCRIPTION_TAGS_SPECIFICATION = '/(#[^#()@., ]+(?:,?\s*|\s+|$))+\s*$/';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Pre-processes SOGS data by treating description-trailing hashtags as room tags.
|
|
|
|
|
*/
|
|
|
|
|
function extract_tags_from_description() {
|
|
|
|
|
$matches = [];
|
|
|
|
|
if (!preg_match(CommunityRoom::DESCRIPTION_TAGS_SPECIFICATION, $this->description, $matches)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tag_specification = $matches[0];
|
|
|
|
|
$tags = preg_split("/,\s*|\s+/", $tag_specification);
|
|
|
|
|
if (!$tags) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove pound sign prefixes
|
|
|
|
|
$tags = array_map(function (string $tag) {
|
|
|
|
|
return substr($tag, 1);
|
|
|
|
|
}, $tags);
|
|
|
|
|
|
|
|
|
|
$this->add_tags($tags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|