]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Term.php
Improved definition style
[friendica.git] / src / Model / Term.php
index fc3405e0b8e8d54b772e3de9c9046e7ec157c7bb..13639f770083cdf1a0522da26f6341270c964f57 100644 (file)
@@ -40,10 +40,7 @@ class Term
     const HASHTAG           = 1;
     const MENTION           = 2;
     const CATEGORY          = 3;
-    const PCATEGORY         = 4;
     const FILE              = 5;
-    const SAVEDSEARCH       = 6;
-    const CONVERSATION      = 7;
        /**
         * An implicit mention is a mention in a comment body that is redundant with the threading information.
         */
@@ -333,6 +330,10 @@ class Term
                                continue;
                        }
 
+                       if (empty($term)) {
+                               continue;
+                       }
+
                        if ($item['uid'] == 0) {
                                $global = true;
                                DBA::update('term', ['global' => true], ['otype' => self::OBJECT_TYPE_POST, 'guid' => $item['guid']]);
@@ -345,7 +346,7 @@ class Term
                                'oid'      => $item_id,
                                'otype'    => self::OBJECT_TYPE_POST,
                                'type'     => $type,
-                               'term'     => $term,
+                               'term'     => substr($term, 0, 255),
                                'url'      => $link,
                                'guid'     => $item['guid'],
                                'created'  => $item['created'],
@@ -463,13 +464,13 @@ class Term
                                                $item['body'] = str_replace($orig_tag, $tag['url'], $item['body']);
                                        }
 
-                                       $return['hashtags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank">' . htmlspecialchars($tag['term']) . '</a>';
-                                       $return['tags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank">' . htmlspecialchars($tag['term']) . '</a>';
+                                       $return['hashtags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank" rel="noopener noreferrer">' . htmlspecialchars($tag['term']) . '</a>';
+                                       $return['tags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank" rel="noopener noreferrer">' . htmlspecialchars($tag['term']) . '</a>';
                                        break;
                                case self::MENTION:
                                        $tag['url'] = Contact::magicLink($tag['url']);
-                                       $return['mentions'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank">' . htmlspecialchars($tag['term']) . '</a>';
-                                       $return['tags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank">' . htmlspecialchars($tag['term']) . '</a>';
+                                       $return['mentions'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank" rel="noopener noreferrer">' . htmlspecialchars($tag['term']) . '</a>';
+                                       $return['tags'][] = $prefix . '<a href="' . $tag['url'] . '" target="_blank" rel="noopener noreferrer">' . htmlspecialchars($tag['term']) . '</a>';
                                        break;
                                case self::IMPLICIT_MENTION:
                                        $return['implicit_mentions'][] = $prefix . $tag['term'];