content: make experimental mod/content.php work again
This commit is contained in:
parent
871fa4c777
commit
9e5a4b2050
|
@ -319,6 +319,15 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
|
|
||||||
$previewing = (($preview) ? ' preview ' : '');
|
$previewing = (($preview) ? ' preview ' : '');
|
||||||
|
|
||||||
|
$edited = false;
|
||||||
|
if (strcmp($item['created'], $item['edited'])<>0) {
|
||||||
|
$edited = array(
|
||||||
|
'label' => t('This entry was edited'),
|
||||||
|
'date' => datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r'),
|
||||||
|
'relative' => relative_date($item['edited'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if($mode === 'network') {
|
if($mode === 'network') {
|
||||||
$profile_owner = local_user();
|
$profile_owner = local_user();
|
||||||
$page_writeable = true;
|
$page_writeable = true;
|
||||||
|
@ -349,7 +358,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
else
|
else
|
||||||
$return_url = $_SESSION['return_url'] = $a->query_string;
|
$return_url = $_SESSION['return_url'] = $a->query_string;
|
||||||
|
|
||||||
load_contact_links(local_user());
|
//load_contact_links(local_user());
|
||||||
|
|
||||||
$cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
|
$cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview);
|
||||||
call_hooks('conversation_start',$cb);
|
call_hooks('conversation_start',$cb);
|
||||||
|
@ -361,8 +370,10 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
$wallwall = 'wallwall_item.tpl';
|
$wallwall = 'wallwall_item.tpl';
|
||||||
$hide_comments_tpl = get_markup_template('hide_comments.tpl');
|
$hide_comments_tpl = get_markup_template('hide_comments.tpl');
|
||||||
|
|
||||||
$alike = array();
|
$conv_responses = array(
|
||||||
$dlike = array();
|
'like' => array('title' => t('Likes','title')), 'dislike' => array('title' => t('Dislikes','title')),
|
||||||
|
'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// array with html for each thread (parent+comments)
|
// array with html for each thread (parent+comments)
|
||||||
|
@ -389,7 +400,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
$sparkle = '';
|
$sparkle = '';
|
||||||
|
|
||||||
if($mode === 'search' || $mode === 'community') {
|
if($mode === 'search' || $mode === 'community') {
|
||||||
if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
|
if(((activity_match($item['verb'],ACTIVITY_LIKE))
|
||||||
|
|| (activity_match($item['verb'],ACTIVITY_DISLIKE))
|
||||||
|
|| activity_match($item['verb'],ACTIVITY_ATTEND)
|
||||||
|
|| activity_match($item['verb'],ACTIVITY_ATTENDNO)
|
||||||
|
|| activity_match($item['verb'],ACTIVITY_ATTENDMAYBE))
|
||||||
&& ($item['id'] != $item['parent']))
|
&& ($item['id'] != $item['parent']))
|
||||||
continue;
|
continue;
|
||||||
$nickname = $item['nickname'];
|
$nickname = $item['nickname'];
|
||||||
|
@ -531,12 +546,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
$comments[$item['parent']] = 0; // avoid notices later on
|
$comments[$item['parent']] = 0; // avoid notices later on
|
||||||
}
|
}
|
||||||
|
|
||||||
// map all the like/dislike activities for each parent item
|
// map all the like/dislike/attendance activities for each parent item
|
||||||
// Store these in the $alike and $dlike arrays
|
// Store these in the $alike and $dlike arrays
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
like_puller($a,$item,$alike,'like');
|
builtin_activity_puller($item, $conv_responses);
|
||||||
like_puller($a,$item,$dlike,'dislike');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments_collapsed = false;
|
$comments_collapsed = false;
|
||||||
|
@ -558,7 +572,10 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
// We've already parsed out like/dislike for special treatment. We can ignore them now
|
// We've already parsed out like/dislike for special treatment. We can ignore them now
|
||||||
|
|
||||||
if(((activity_match($item['verb'],ACTIVITY_LIKE))
|
if(((activity_match($item['verb'],ACTIVITY_LIKE))
|
||||||
|| (activity_match($item['verb'],ACTIVITY_DISLIKE)))
|
|| (activity_match($item['verb'],ACTIVITY_DISLIKE)
|
||||||
|
|| activity_match($item['verb'],ACTIVITY_ATTEND)
|
||||||
|
|| activity_match($item['verb'],ACTIVITY_ATTENDNO)
|
||||||
|
|| activity_match($item['verb'],ACTIVITY_ATTENDMAYBE)))
|
||||||
&& ($item['id'] != $item['parent']))
|
&& ($item['id'] != $item['parent']))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -762,6 +779,28 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
'tagger' => t("add tag"),
|
'tagger' => t("add tag"),
|
||||||
'classtagger' => "",
|
'classtagger' => "",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$r = q("SELECT `ignored` FROM `thread` WHERE `uid` = %d AND `iid` = %d LIMIT 1",
|
||||||
|
intval($item['uid']),
|
||||||
|
intval($item['id'])
|
||||||
|
);
|
||||||
|
if (count($r)) {
|
||||||
|
$ignore = array(
|
||||||
|
'do' => t("ignore thread"),
|
||||||
|
'undo' => t("unignore thread"),
|
||||||
|
'toggle' => t("toggle ignore status"),
|
||||||
|
'classdo' => (($r[0]['ignored']) ? "hidden" : ""),
|
||||||
|
'classundo' => (($r[0]['ignored']) ? "" : "hidden"),
|
||||||
|
'ignored' => t('ignored'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$tagger = '';
|
||||||
|
if(feature_enabled($profile_owner,'commtag')) {
|
||||||
|
$tagger = array(
|
||||||
|
'add' => t("add tag"),
|
||||||
|
'class' => "",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$filer = t("save to folder");
|
$filer = t("save to folder");
|
||||||
}
|
}
|
||||||
|
@ -795,8 +834,23 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
else
|
else
|
||||||
$profile_avatar = $item['author-avatar'];
|
$profile_avatar = $item['author-avatar'];
|
||||||
|
|
||||||
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
|
$like = ((x($conv_responses['like'],$item['uri'])) ? format_like($conv_responses['like'][$item['uri']],$conv_responses['like'][$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||||
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
$dislike = ((x($conv_responses['dislike'],$item['uri'])) ? format_like($conv_responses['dislike'][$item['uri']],$conv_responses['dislike'][$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||||
|
|
||||||
|
// process action responses - e.g. like/dislike/attend/agree/whatever
|
||||||
|
$response_verbs = array('like');
|
||||||
|
if(feature_enabled($profile_owner,'dislike'))
|
||||||
|
$response_verbs[] = 'dislike';
|
||||||
|
if($item['object-type'] === ACTIVITY_OBJ_EVENT) {
|
||||||
|
$response_verbs[] = 'attendyes';
|
||||||
|
$response_verbs[] = 'attendno';
|
||||||
|
$response_verbs[] = 'attendmaybe';
|
||||||
|
if($page_writeable) {
|
||||||
|
$isevent = true;
|
||||||
|
$attend = array( t('I will attend'), t('I will not attend'), t('I might attend'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$responses = get_responses($conv_responses,$response_verbs,'',$item);
|
||||||
|
|
||||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||||
call_hooks('render_location',$locate);
|
call_hooks('render_location',$locate);
|
||||||
|
@ -853,6 +907,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
'body' => $body_e,
|
'body' => $body_e,
|
||||||
'text' => $text_e,
|
'text' => $text_e,
|
||||||
'id' => $item['item_id'],
|
'id' => $item['item_id'],
|
||||||
|
'isevent' => $isevent,
|
||||||
|
'attend' => $attend,
|
||||||
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
|
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
|
||||||
'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
|
'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
|
||||||
'to' => t('to'),
|
'to' => t('to'),
|
||||||
|
@ -865,7 +921,10 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
'osparkle' => $osparkle,
|
'osparkle' => $osparkle,
|
||||||
'sparkle' => $sparkle,
|
'sparkle' => $sparkle,
|
||||||
'title' => $title_e,
|
'title' => $title_e,
|
||||||
|
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
|
||||||
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
|
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
|
||||||
|
'app' => $item['app'],
|
||||||
|
'created' => relative_date($item['created']),
|
||||||
'lock' => $lock,
|
'lock' => $lock,
|
||||||
'location' => $location_e,
|
'location' => $location_e,
|
||||||
'indent' => $indent,
|
'indent' => $indent,
|
||||||
|
@ -877,14 +936,21 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
|
||||||
'edpost' => $edpost,
|
'edpost' => $edpost,
|
||||||
'isstarred' => $isstarred,
|
'isstarred' => $isstarred,
|
||||||
'star' => $star,
|
'star' => $star,
|
||||||
'filer' => $filer,
|
'ignore' => ((feature_enabled($profile_owner,'ignore_posts')) ? $ignore : ''),
|
||||||
|
'tagger' => $tagger,
|
||||||
|
'filer' => ((feature_enabled($profile_owner,'filing')) ? $filer : ''),
|
||||||
'drop' => $drop,
|
'drop' => $drop,
|
||||||
'vote' => $likebuttons,
|
'vote' => $likebuttons,
|
||||||
|
'responses' => $responses,
|
||||||
'like' => $like,
|
'like' => $like,
|
||||||
'dislike' => $dislike,
|
'dislike' => $dislike,
|
||||||
|
'switchcomment' => t('Comment'),
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
'previewing' => $previewing,
|
'previewing' => $previewing,
|
||||||
'wait' => t('Please wait'),
|
'wait' => t('Please wait'),
|
||||||
|
'edited' => $edited,
|
||||||
|
'network' => $item["item_network"],
|
||||||
|
'network_name' => network_to_name($item['network'], $profile_link),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue