From f68bbffb640e7e2100bf089f1d0a29d174609af5 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 9 Jul 2014 20:44:12 +0200 Subject: [PATCH] Adding preview value to "prepare_body" hook. (Will be used in addons for network related previews) --- include/conversation.php | 5 +++-- include/text.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index ddb01ec9b8..95792640e3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -620,7 +620,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $likebuttons = false; $shareable = false; - $body = prepare_body($item,true); + $body = prepare_body($item,true, $preview); list($categories, $folders) = get_cats_and_terms($item); @@ -685,7 +685,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { 'like' => '', 'dislike' => '', 'comment' => '', - 'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), + //'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))), + 'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/'.$item['guid'], 'title'=> t('View in context'))), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1, diff --git a/include/text.php b/include/text.php index 2490bf402b..4d6aa8697a 100644 --- a/include/text.php +++ b/include/text.php @@ -1293,7 +1293,7 @@ if(! function_exists('prepare_body')) { * @hook prepare_body ('item'=>item array, 'html'=>body string) after first bbcode to html * @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author) */ -function prepare_body(&$item,$attach = false) { +function prepare_body(&$item,$attach = false, $preview = false) { $a = get_app(); call_hooks('prepare_body_init', $item); @@ -1353,7 +1353,7 @@ function prepare_body(&$item,$attach = false) { } - $prep_arr = array('item' => $item, 'html' => $s); + $prep_arr = array('item' => $item, 'html' => $s, 'preview' => $preview); call_hooks('prepare_body', $prep_arr); $s = $prep_arr['html'];