return;
}
- $fields = ['name' => substr($name, 0, 64), 'type' => $type];
+ $fields = ['name' => substr($name, 0, 96), 'type' => $type];
if (!empty($url) && ($url != $name)) {
$fields['url'] = strtolower($url);
}
/**
- * Store tags from the body
- *
- * @param integer $uriid
- * @param string $body
+ * Store tags and mentions from the body
+ *
+ * @param integer $uriid URI-Id
+ * @param string $body Body of the post
+ * @param string $tags Accepted tags
*/
- public static function storeFromBody(int $uriid, string $body)
+ public static function storeFromBody(int $uriid, string $body, string $tags = '#@!')
{
- $tags = BBCode::getTags($body);
- if (empty($tags)) {
+ if (!preg_match_all("/([" . $tags . "])\[url\=(.*?)\](.*?)\[\/url\]/ism", $body, $result, PREG_SET_ORDER)) {
return;
}
- foreach ($tags as $tag) {
- if ((substr($tag, 0, 1) != self::TAG_CHARACTER[self::HASHTAG]) || (strlen($tag) <= 1)) {
- Logger::info('Skip tag', ['uriid' => $uriid, 'tag' => $tag]);
- continue;
- }
-
- self::storeByHash($uriid, '#', $tag);
+ foreach ($result as $tag) {
+ self::storeByHash($uriid, $tag[1], $tag[3], $tag[2]);
}
}
}
$item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]);
- Tag::storeFromBody($item['uri-id'], $item["body"]);
+ Tag::storeFromBody($item['uri-id'], $item["body"], '#');
// We store the data from "dfrn:diaspora_signature" in a different table, this is done in "Item::insert"
$dsprsig = XML::unescape(XML::getFirstNodeValue($xpath, "dfrn:diaspora_signature/text()", $entry));
$datarray["body"] = self::replacePeopleGuid($body, $person["url"]);
self::storeMentions($datarray['uri-id'], $text);
- Tag::storeFromBody($datarray['uri-id'], $datarray["body"]);
+ Tag::storeFromBody($datarray['uri-id'], $datarray["body"], '#');
self::fetchGuid($datarray);
$datarray["body"] = self::replacePeopleGuid($body, $contact["url"]);
self::storeMentions($datarray['uri-id'], $text);
- Tag::storeFromBody($datarray['uri-id'], $datarray["body"]);
+ Tag::storeFromBody($datarray['uri-id'], $datarray["body"], '#');
if ($provider_display_name != "") {
$datarray["app"] = $provider_display_name;
"fields" => [
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
"type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
- "name" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
+ "name" => ["type" => "varchar(96)", "not null" => "1", "default" => "", "comment" => ""],
"url" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""]
],
"indexes" => [