- $replaced = false;
- $r = null;
-
- //is it a person tag?
- if (Tag::isType($tag, Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION)) {
- $tag_type = substr($tag, 0, 1);
- //is it already replaced?
- if (strpos($tag, '[url=')) {
- //append tag to str_tags
- if (!stristr($str_tags, $tag)) {
- if (strlen($str_tags)) {
- $str_tags .= ',';
- }
- $str_tags .= $tag;
- }
-
- // Checking for the alias that is used for OStatus
- $pattern = "/[@!]\[url\=(.*?)\](.*?)\[\/url\]/ism";
- if (preg_match($pattern, $tag, $matches)) {
- $data = Contact::getDetailsByURL($matches[1]);
-
- if ($data["alias"] != "") {
- $newtag = '@[url=' . $data["alias"] . ']' . $data["nick"] . '[/url]';
-
- if (!stripos($str_tags, '[url=' . $data["alias"] . ']')) {
- if (strlen($str_tags)) {
- $str_tags .= ',';
- }
-
- $str_tags .= $newtag;
- }
- }
- }
-
- return $replaced;
- }
+ // locate item to be deleted
+ $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', 'parent'];
+ $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]);