This commit is contained in:
friendica 2012-07-11 04:29:47 -07:00
parent 31c218e785
commit 6105211e73
2 changed files with 66 additions and 30 deletions

View File

@ -124,9 +124,9 @@ function notification($params) {
$preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $params['source_name'], $sitename); $preamble = sprintf( t('%1$s posted to your profile wall at %2$s') , $params['source_name'], $sitename);
$epreamble = sprintf( t('%1$s posted to [url=%2s]your wall[/url]') , $epreamble = sprintf( t('%1$s posted to [url=%2$s]your wall[/url]') ,
'[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]',
$itemlink); $params['link']);
$sitelink = t('Please visit %s to view and/or reply to the conversation.'); $sitelink = t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf( $sitelink, $siteurl ); $tsitelink = sprintf( $sitelink, $siteurl );

View File

@ -141,6 +141,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
// We will provide an empty feed if that is the case. // We will provide an empty feed if that is the case.
$items = $r; $items = $r;
$items = fetch_post_tags($items);
$feed_template = get_markup_template(($dfrn_id) ? 'atom_feed_dfrn.tpl' : 'atom_feed.tpl'); $feed_template = get_markup_template(($dfrn_id) ? 'atom_feed_dfrn.tpl' : 'atom_feed.tpl');
@ -639,18 +640,32 @@ function get_atom_elements($feed,$item) {
$cats = $item->get_categories(); $cats = $item->get_categories();
if($cats) { if($cats) {
$tag_arr = array(); $terms = array();
foreach($cats as $cat) { foreach($cats as $cat) {
$term = $cat->get_term(); $term = $cat->get_term();
if(! $term) if(! $term)
$term = $cat->get_label(); $term = $cat->get_label();
$scheme = $cat->get_scheme(); $scheme = $cat->get_scheme();
if($scheme && $term && stristr($scheme,'X-DFRN:')) $termurl = '';
$tag_arr[] = substr($scheme,7,1) . '[url=' . unxmlify(substr($scheme,9)) . ']' . unxmlify($term) . '[/url]'; if($scheme && $term && stristr($scheme,'X-DFRN:')) {
elseif($term) $termtype = ((substr($scheme,7,1) === '#') ? TERM_HASHTAG : TERM_MENTION);
$tag_arr[] = notags(trim($term)); $termurl = unxmlify(substr($scheme,9));
} }
$res['tag'] = implode(',', $tag_arr); else {
$termtype = TERM_UNKNOWN;
}
$termterm = notags(trim(unxmlify($term)));
if($termterm) {
$terms = array(
'otype' => TERM_OBJ_POST,
'type' => $termtype,
'url' => $termurl,
'term' => $termterm,
);
}
}
$res['term'] = implode(',', $tag_arr);
} }
$attach = $item->get_enclosures(); $attach = $item->get_enclosures();
@ -947,6 +962,14 @@ function item_store($arr,$force_parent = false) {
return 0; return 0;
} }
// pull out all the taxonomy stuff for separate storage
$terms = null;
if($arr['term']) {
$terms = $arr['term'];
unset($arr['term']);
}
dbesc_array($arr); dbesc_array($arr);
logger('item_store: ' . print_r($arr,true), LOGGER_DATA); logger('item_store: ' . print_r($arr,true), LOGGER_DATA);
@ -1011,6 +1034,23 @@ function item_store($arr,$force_parent = false) {
$arr['deny_gid'] = $deny_gid; $arr['deny_gid'] = $deny_gid;
$arr['private'] = $private; $arr['private'] = $private;
$arr['deleted'] = $parent_deleted; $arr['deleted'] = $parent_deleted;
if(($terms) && (is_array($terms))) {
foreach($terms as $t) {
q("insert into term (uid,oid,otype,type,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']),
intval($current_post),
intval($t['otype']),
intval($t['type']),
dbesc($t['term']),
dbesc($t['url'])
);
}
$arr['term'] = $terms;
}
call_hooks('post_remote_end',$arr); call_hooks('post_remote_end',$arr);
// update the commented timestamp on the parent // update the commented timestamp on the parent
@ -1031,6 +1071,7 @@ function item_store($arr,$force_parent = false) {
} }
/** /**
* If this is now the last-child, force all _other_ children of this parent to *not* be last-child * If this is now the last-child, force all _other_ children of this parent to *not* be last-child
*/ */
@ -3313,21 +3354,16 @@ function enumerate_permissions($obj) {
} }
function item_getfeedtags($item) { function item_getfeedtags($item) {
$terms = get_terms_oftype($item['term'],array(TERM_HASHTAG,TERM_MENTION));
$ret = array(); $ret = array();
$matches = false;
$cnt = preg_match_all('|\#\[url\=(.*?)\](.*?)\[\/url\]|',$item['tag'],$matches); if(count($terms)) {
if($cnt) { foreach($terms as $term) {
for($x = 0; $x < $cnt; $x ++) { if($term['type'] == TERM_HASHTAG)
if($matches[1][$x]) $ret[] = array('#',$term['url'],$term['term']);
$ret[] = array('#',$matches[1][$x], $matches[2][$x]); else
} $ret[] = array('@',$term['url'],$term['term']);
}
$matches = false;
$cnt = preg_match_all('|\@\[url\=(.*?)\](.*?)\[\/url\]|',$item['tag'],$matches);
if($cnt) {
for($x = 0; $x < $cnt; $x ++) {
if($matches[1][$x])
$ret[] = array('@',$matches[1][$x], $matches[2][$x]);
} }
} }
return $ret; return $ret;