aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-12-15 15:01:54 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-12-15 15:01:54 -0800
commit2924b9182e787d0266e433169b1db1c3fdd359a7 (patch)
treef0125fa6cd46a0147301af27d91031bfcdd45d55 /include/text.php
parentba463afbdcded70b88a48d76276d837a7e78ef0c (diff)
downloadvolse-hubzilla-2924b9182e787d0266e433169b1db1c3fdd359a7.tar.gz
volse-hubzilla-2924b9182e787d0266e433169b1db1c3fdd359a7.tar.bz2
volse-hubzilla-2924b9182e787d0266e433169b1db1c3fdd359a7.zip
revise the photo activity a bit so that we always have a valid activity body. Several network connectors can get empty posts or posts that don't contain any reference whatsoever to the actual photo. Since this can cause duplicate images on our own site, just provide the activity summary and any included body text to the activity by default. Provide a function to enhance this activity with an actual photo which can be applied on demand for any network connectors that desire it. Otherwise they'll just get a link to the photo in the activity statement - which is better than an empty post. Have applied this "add actual photo to the post" function to both Diaspora and RSS feeds. Also provide the album as the activity target.
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/text.php b/include/text.php
index 4777e7a61..29be4931d 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1416,20 +1416,14 @@ function format_event($jobject) {
function prepare_body(&$item,$attach = false) {
require_once('include/identity.php');
-// if($item['html']) {
-// $s = bb_observer($item['html']);
-// }
-// else {
- call_hooks('prepare_body_init', $item);
-// unobscure($item);
- $s = prepare_text($item['body'],$item['mimetype'], false);
-// }
+ call_hooks('prepare_body_init', $item);
$photo = '';
- $is_photo = (($item['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false);
+ $is_photo = ((($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) ? true : false);
if($is_photo) {
+
$object = json_decode($item['object'],true);
// if original photo width is <= 640px prepend it to item body
@@ -1444,6 +1438,8 @@ function prepare_body(&$item,$attach = false) {
}
}
+ $s = prepare_text($item['body'],$item['mimetype'], false);
+
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event($item['object']) : false);
$prep_arr = array(
@@ -1602,6 +1598,16 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
}
+function create_export_photo_body(&$item) {
+ if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) {
+ $j = json_decode($item['object'],true);
+ if($j) {
+ $item['body'] .= (($j['body']) ? $j['body'] : $j['bbcode']);
+ $item['sig'] = '';
+ }
+ }
+}
+
/**
* zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links
* These will typically be generated by a bbcode '[zrl]' tag. This is done inside prepare_text() rather than bbcode()