use prepare_body in api calls to properly render content, add 'mode' to conversation templates so that themes can use the module context to suppress or show comments as desired
This commit is contained in:
parent
1c5d56eedc
commit
c6d6c01fb6
@ -88,6 +88,8 @@ class Item extends BaseObject {
|
|||||||
: false);
|
: false);
|
||||||
$shareable = ((($conv->get_profile_owner() == local_user()) && ($item['item_private'] != 1)) ? true : false);
|
$shareable = ((($conv->get_profile_owner() == local_user()) && ($item['item_private'] != 1)) ? true : false);
|
||||||
|
|
||||||
|
$mode = $conv->get_mode();
|
||||||
|
|
||||||
if(local_user() && $observer['xchan_hash'] === $item['author_xchan'])
|
if(local_user() && $observer['xchan_hash'] === $item['author_xchan'])
|
||||||
$edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
|
$edpost = array($a->get_baseurl($ssl_state)."/editpost/".$item['id'], t("Edit"));
|
||||||
else
|
else
|
||||||
@ -183,7 +185,7 @@ class Item extends BaseObject {
|
|||||||
|
|
||||||
$tmp_item = array(
|
$tmp_item = array(
|
||||||
'template' => $this->get_template(),
|
'template' => $this->get_template(),
|
||||||
|
'mode' => $mode,
|
||||||
'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
|
'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
|
||||||
'tags' => array(),
|
'tags' => array(),
|
||||||
'body' => $body,
|
'body' => $body,
|
||||||
|
@ -732,7 +732,7 @@ require_once('include/photos.php');
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$status_info = array(
|
$status_info = array(
|
||||||
'text' => html2plain(bbcode($lastwall['body']), 0),
|
'text' => html2plain(prepare_text($lastwall['body'],$lastwall['mimetype']), 0),
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
'created_at' => api_date($lastwall['created']),
|
'created_at' => api_date($lastwall['created']),
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
@ -804,7 +804,7 @@ require_once('include/photos.php');
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$user_info['status'] = array(
|
$user_info['status'] = array(
|
||||||
'text' => html2plain(bbcode($lastwall['body']), 0),
|
'text' => html2plain(prepare_text($lastwall['body'],$lastwall['mimetype']), 0),
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
'created_at' => api_date($lastwall['created']),
|
'created_at' => api_date($lastwall['created']),
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
@ -1374,14 +1374,14 @@ require_once('include/photos.php');
|
|||||||
if (x($_GET, 'getText')) {
|
if (x($_GET, 'getText')) {
|
||||||
$ret['title'] = $item['title'] ;
|
$ret['title'] = $item['title'] ;
|
||||||
if ($_GET["getText"] == "html") {
|
if ($_GET["getText"] == "html") {
|
||||||
$ret['text'] = bbcode($item['body']);
|
$ret['text'] = prepare_text($item['body'],$item['mimetype']);
|
||||||
}
|
}
|
||||||
elseif ($_GET["getText"] == "plain") {
|
elseif ($_GET["getText"] == "plain") {
|
||||||
$ret['text'] = html2plain(bbcode($item['body']), 0);
|
$ret['text'] = html2plain(prepare_text($item['body'],$item['mimetype']), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ret['text'] = $item['title']."\n".html2plain(bbcode($item['body']), 0);
|
$ret['text'] = $item['title']."\n".html2plain(prepare_text($item['body'],$item['mimetype']), 0);
|
||||||
}
|
}
|
||||||
if (isset($_GET["getUserObjects"]) && $_GET["getUserObjects"] == "false") {
|
if (isset($_GET["getUserObjects"]) && $_GET["getUserObjects"] == "false") {
|
||||||
unset($ret['sender']);
|
unset($ret['sender']);
|
||||||
@ -1427,7 +1427,7 @@ require_once('include/photos.php');
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for ostatus messages where the title is identically to the body
|
// Workaround for ostatus messages where the title is identically to the body
|
||||||
$statusbody = trim(html2plain(bbcode($item['body']), 0));
|
$statusbody = trim(html2plain(prepare_text($item['body'],$item['mimetype']), 0));
|
||||||
$statustitle = trim($item['title']);
|
$statustitle = trim($item['title']);
|
||||||
|
|
||||||
if (($statustitle != '') and (strpos($statusbody, $statustitle) !== false))
|
if (($statustitle != '') and (strpos($statusbody, $statustitle) !== false))
|
||||||
@ -1448,7 +1448,7 @@ require_once('include/photos.php');
|
|||||||
'geo' => '',
|
'geo' => '',
|
||||||
'favorited' => (($item['item_flags'] & ITEM_STARRED) ? true : false),
|
'favorited' => (($item['item_flags'] & ITEM_STARRED) ? true : false),
|
||||||
'user' => $status_user ,
|
'user' => $status_user ,
|
||||||
'statusnet_html' => trim(bbcode($item['body'])),
|
'statusnet_html' => trim(prepare_text($item['body']),$item['mimetype']),
|
||||||
'statusnet_conversation_id' => $item['parent'],
|
'statusnet_conversation_id' => $item['parent'],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -651,6 +651,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
|
|||||||
$tmp_item = array(
|
$tmp_item = array(
|
||||||
'template' => $tpl,
|
'template' => $tpl,
|
||||||
'toplevel' => 'toplevel_item',
|
'toplevel' => 'toplevel_item',
|
||||||
|
'mode' => $mode,
|
||||||
'id' => (($preview) ? 'P0' : $item['item_id']),
|
'id' => (($preview) ? 'P0' : $item['item_id']),
|
||||||
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
|
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
|
||||||
'profile_url' => $profile_link,
|
'profile_url' => $profile_link,
|
||||||
|
@ -1064,6 +1064,7 @@ function photos_content(&$a) {
|
|||||||
if($can_post || $a->data['perms']['post_comments']) {
|
if($can_post || $a->data['perms']['post_comments']) {
|
||||||
$comments .= replace_macros($cmnt_tpl,array(
|
$comments .= replace_macros($cmnt_tpl,array(
|
||||||
'$return_path' => '',
|
'$return_path' => '',
|
||||||
|
'$mode' => 'photos',
|
||||||
'$jsreload' => $return_url,
|
'$jsreload' => $return_url,
|
||||||
'$type' => 'wall-comment',
|
'$type' => 'wall-comment',
|
||||||
'$id' => $link_item['id'],
|
'$id' => $link_item['id'],
|
||||||
@ -1131,6 +1132,7 @@ function photos_content(&$a) {
|
|||||||
|
|
||||||
$comments .= replace_macros($template,array(
|
$comments .= replace_macros($template,array(
|
||||||
'$id' => $item['item_id'],
|
'$id' => $item['item_id'],
|
||||||
|
'$mode' => 'photos',
|
||||||
'$profile_url' => $profile_link,
|
'$profile_url' => $profile_link,
|
||||||
'$name' => $name_e,
|
'$name' => $name_e,
|
||||||
'$thumb' => $profile_avatar,
|
'$thumb' => $profile_avatar,
|
||||||
|
Reference in New Issue
Block a user