1
1
Fork 0

add rel=mentioned links for tagged persons

This commit is contained in:
Mike Macgirvin 2010-10-31 21:57:30 -07:00
parent b376f21533
commit 4f4d6bace6
6 changed files with 28 additions and 1 deletions

View file

@ -1358,3 +1358,17 @@ function like_puller($a,$item,&$arr,$mode) {
return; 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;
}

View file

@ -187,6 +187,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
else { else {
$verb = construct_verb($item); $verb = construct_verb($item);
$actobj = construct_activity($item); $actobj = construct_activity($item);
$mentioned = get_mentions($item);
if($item['parent'] == $item['id']) { if($item['parent'] == $item['id']) {
$atom .= replace_macros($item_template, array( $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']), '$content' => xmlify($item['body']),
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, // do not xmlify '$actobj' => $actobj, // do not xmlify
'$mentioned' => $mentioned,
'$comment_allow' => $allow '$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']), '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner_nick . '/' . $item['id']),
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, // do not xmlify '$actobj' => $actobj, // do not xmlify
'$mentioned' => $mentioned,
'$parent_id' => xmlify($item['parent-uri']), '$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => $allow '$comment_allow' => $allow
)); ));

View file

@ -213,6 +213,7 @@
$verb = construct_verb($item); $verb = construct_verb($item);
$actobj = construct_activity($item); $actobj = construct_activity($item);
$mentioned = get_mentions($item);
if($item['id'] == $item_id) { if($item['id'] == $item_id) {
$slap = replace_macros($cmnt_template, array( $slap = replace_macros($cmnt_template, array(
@ -231,6 +232,7 @@
'$type' => 'html', '$type' => 'html',
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, '$actobj' => $actobj,
'$mentioned' => $mentioned,
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']), '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
'$content' => xmlify(bbcode($item['body'])), '$content' => xmlify(bbcode($item['body'])),
'$parent_id' => xmlify($item['parent-uri']), '$parent_id' => xmlify($item['parent-uri']),
@ -253,6 +255,7 @@
'$type' => 'text', '$type' => 'text',
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, '$actobj' => $actobj,
'$mentioned' => $mentioned,
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']), '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
'$content' => xmlify($item['body']), '$content' => xmlify($item['body']),
'$parent_id' => xmlify($item['parent-uri']), '$parent_id' => xmlify($item['parent-uri']),
@ -283,6 +286,7 @@
$verb = construct_verb($item); $verb = construct_verb($item);
$actobj = construct_activity($item); $actobj = construct_activity($item);
$mentioned = get_mentions($item);
if($item['parent'] == $item['id']) { if($item['parent'] == $item['id']) {
$atom .= replace_macros($item_template, array( $atom .= replace_macros($item_template, array(
@ -301,6 +305,7 @@
'$type' => 'text', '$type' => 'text',
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, '$actobj' => $actobj,
'$mentioned' => $mentioned,
'$content' => xmlify($item['body']), '$content' => xmlify($item['body']),
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']), '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
'$comment_allow' => (($item['last-child']) ? 1 : 0) '$comment_allow' => (($item['last-child']) ? 1 : 0)
@ -321,6 +326,7 @@
'$type' => 'html', '$type' => 'html',
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, '$actobj' => $actobj,
'$mentioned' => $mentioned,
'$content' => xmlify(bbcode($item['body'])), '$content' => xmlify(bbcode($item['body'])),
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']), '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
'$comment_allow' => (($item['last-child']) ? 1 : 0) '$comment_allow' => (($item['last-child']) ? 1 : 0)
@ -343,6 +349,7 @@
'$type' => 'text', '$type' => 'text',
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, '$actobj' => $actobj,
'$mentioned' => $mentioned,
'$parent_id' => xmlify($item['parent-uri']), '$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => (($item['last-child']) ? 1 : 0) '$comment_allow' => (($item['last-child']) ? 1 : 0)
)); ));
@ -361,6 +368,7 @@
'$type' => 'html', '$type' => 'html',
'$verb' => xmlify($verb), '$verb' => xmlify($verb),
'$actobj' => $actobj, '$actobj' => $actobj,
'$mentioned' => $mentioned,
'$parent_id' => xmlify($item['parent-uri']), '$parent_id' => xmlify($item['parent-uri']),
'$comment_allow' => (($item['last-child']) ? 1 : 0) '$comment_allow' => (($item['last-child']) ? 1 : 0)
)); ));

View file

@ -165,7 +165,7 @@ function item_post(&$a) {
if(strlen($str_tags)) if(strlen($str_tags))
$str_tags .= ','; $str_tags .= ',';
$profile = str_replace(',','%2c',$profile); $profile = str_replace(',','%2c',$profile);
$str_tags .= '[url=' . $profile . ']' . $newname . '[/url]'; $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]';
} }
} }
} }

View file

@ -16,5 +16,6 @@
<dfrn:comment-allow>$comment_allow</dfrn:comment-allow> <dfrn:comment-allow>$comment_allow</dfrn:comment-allow>
<as:verb>$verb</as:verb> <as:verb>$verb</as:verb>
$actobj $actobj
$mentioned
</entry> </entry>

View file

@ -23,5 +23,6 @@
<dfrn:comment-allow>$comment_allow</dfrn:comment-allow> <dfrn:comment-allow>$comment_allow</dfrn:comment-allow>
<as:verb>$verb</as:verb> <as:verb>$verb</as:verb>
$actobj $actobj
$mentioned
</entry> </entry>