]> git.mxchange.org Git - friendica.git/commitdiff
add rel=mentioned links for tagged persons
authorMike Macgirvin <mike@macgirvin.com>
Mon, 1 Nov 2010 04:57:30 +0000 (21:57 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Mon, 1 Nov 2010 04:57:30 +0000 (21:57 -0700)
boot.php
include/items.php
include/notifier.php
mod/item.php
view/atom_cmnt.tpl
view/atom_item.tpl

index 30e5a111e55a6b6d48624721cbf4b8a75d235498..2de398cfc4377f96fee95d06494f22049000c995 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1358,3 +1358,17 @@ function like_puller($a,$item,&$arr,$mode) {
        return;
 }}
 
+
+function get_mentions($item) {
+       $o = '';
+       if(! strlen($item['tag']))
+               return $o;
+
+       $arr = explode(',',$item['tag']);
+       foreach($arr as $x) {
+               $matches = null;
+               if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches))
+                       $o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
+       }
+       return $o;
+}
\ No newline at end of file
index d37f7708f99beacfeb1db6d8401e2bc7ea1b49c3..7f62f6decd8b93494bb3291149741395d44867ab 100644 (file)
@@ -187,6 +187,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
                else {
                        $verb = construct_verb($item);
                        $actobj = construct_activity($item);
+                       $mentioned = get_mentions($item);
 
                        if($item['parent'] == $item['id']) {
                                $atom .= replace_macros($item_template, array(
@@ -207,6 +208,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
                                        '$content'            => xmlify($item['body']),
                                        '$verb'               => xmlify($verb),
                                        '$actobj'             => $actobj,  // do not xmlify
+                                       '$mentioned'          => $mentioned,
                                        '$comment_allow'      => $allow
                                ));
                        }
@@ -224,6 +226,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
                                        '$alt'           => xmlify($a->get_baseurl() . '/display/' . $owner_nick . '/' . $item['id']),
                                        '$verb'          => xmlify($verb),
                                        '$actobj'        => $actobj, // do not xmlify
+                                       '$mentioned'     => $mentioned,
                                        '$parent_id'     => xmlify($item['parent-uri']),
                                        '$comment_allow' => $allow
                                ));
index 884493a79a2d9c91a893a668de1308333832d71f..1f6bfa36aa03006bce5fb01195e1de939cd89416 100644 (file)
 
                                $verb = construct_verb($item);
                                $actobj = construct_activity($item);
+                               $mentioned = get_mentions($item);
 
                                if($item['id'] == $item_id) {
                                        $slap = replace_macros($cmnt_template, array(
                                                '$type'               => 'html',
                                                '$verb'               => xmlify($verb),
                                                '$actobj'             => $actobj,
+                                               '$mentioned'          => $mentioned,
                                                '$alt'                => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
                                                '$content'            => xmlify(bbcode($item['body'])),
                                                '$parent_id'          => xmlify($item['parent-uri']),
                                                '$type'               => 'text',
                                                '$verb'               => xmlify($verb),
                                                '$actobj'             => $actobj,
+                                               '$mentioned'          => $mentioned,
                                                '$alt'                => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
                                                '$content'            => xmlify($item['body']),
                                                '$parent_id'          => xmlify($item['parent-uri']),
 
                                        $verb = construct_verb($item);
                                        $actobj = construct_activity($item);
+                                       $mentioned = get_mentions($item);
 
                                        if($item['parent'] == $item['id']) {
                                                $atom .= replace_macros($item_template, array(
                                                        '$type'               => 'text',
                                                        '$verb'               => xmlify($verb),
                                                        '$actobj'             => $actobj,
+                                                       '$mentioned'          => $mentioned,
                                                        '$content'            => xmlify($item['body']),
                                                        '$alt'                => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
                                                        '$comment_allow'      => (($item['last-child']) ? 1 : 0)
                                                        '$type'               => 'html',
                                                        '$verb'               => xmlify($verb),
                                                        '$actobj'             => $actobj,
+                                                       '$mentioned'          => $mentioned,
                                                        '$content'            => xmlify(bbcode($item['body'])),
                                                        '$alt'                => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
                                                        '$comment_allow'      => (($item['last-child']) ? 1 : 0)
                                                        '$type'          => 'text',
                                                        '$verb'          => xmlify($verb),
                                                        '$actobj'        => $actobj,
+                                                       '$mentioned'     => $mentioned,
                                                        '$parent_id'     => xmlify($item['parent-uri']),
                                                        '$comment_allow' => (($item['last-child']) ? 1 : 0)
                                                ));
                                                        '$type'          => 'html',
                                                        '$verb'          => xmlify($verb),
                                                        '$actobj'        => $actobj,
+                                                       '$mentioned'     => $mentioned,
                                                        '$parent_id'     => xmlify($item['parent-uri']),
                                                        '$comment_allow' => (($item['last-child']) ? 1 : 0)
                                                ));
index 67832204d6bf0930f569738af76f73a01e7dec30..703267992d9861435a31dcdb1d8a09ca0da373d0 100644 (file)
@@ -165,7 +165,7 @@ function item_post(&$a) {
                                        if(strlen($str_tags))
                                                $str_tags .= ',';
                                        $profile = str_replace(',','%2c',$profile);
-                                       $str_tags .= '[url=' . $profile . ']' . $newname        . '[/url]';
+                                       $str_tags .= '@[url=' . $profile . ']' . $newname       . '[/url]';
                                }
                        }
                }
index 6c1a15faa91fd67f9dbced69afed1df225d777d6..b70a6dc4eaa33a59ea77d199e53b5eca4223d1f3 100644 (file)
@@ -16,5 +16,6 @@
                <dfrn:comment-allow>$comment_allow</dfrn:comment-allow>
                <as:verb>$verb</as:verb>
                $actobj
+               $mentioned
        </entry>
 
index b26ba2e6948b5af0b2510b25c3208ea265104fc2..0d36b579d5c210f589fc8920f6a396f03171d8bb 100644 (file)
@@ -23,5 +23,6 @@
                <dfrn:comment-allow>$comment_allow</dfrn:comment-allow>
                <as:verb>$verb</as:verb>
                $actobj
+               $mentioned
 
        </entry>