this is turning into a wretched mess. It's going to get worse before it gets better, but I'm trying to do this incrementally so I don't break the whole shebang for a few days. It will get better once all the bbcode translation is done in a single place (cross fingers), and we can just sign the post once when we submit it and be done with it. If Diaspora ever implements editing of existing posts we'll have to go back and do the whole wretched mess over again.
This commit is contained in:
@@ -2278,20 +2278,29 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) {
|
||||
$body = str_replace("\n\n\n", "\n\n", $body);
|
||||
} while ($oldbody != $body);
|
||||
|
||||
if($item['diaspora_meta']) {
|
||||
$j = json_decode($item['diaspora_meta'],true);
|
||||
if($j && $j['body']) {
|
||||
$body = xmlify($j['body']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$body = xmlify(html_entity_decode(bb2diaspora($body)));
|
||||
|
||||
// convert to markdown
|
||||
$body = xmlify(html_entity_decode(bb2diaspora($body)));
|
||||
|
||||
// Adding the title
|
||||
if(strlen($title))
|
||||
$body = "## ".html_entity_decode($title)."\n\n".$body;
|
||||
// convert to markdown
|
||||
|
||||
if($item['attach']) {
|
||||
$cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER);
|
||||
if(cnt) {
|
||||
$body .= "\n" . t('Attachments:') . "\n";
|
||||
foreach($matches as $mtch) {
|
||||
$body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n";
|
||||
// Adding the title
|
||||
if(strlen($title))
|
||||
$body = "## ".html_entity_decode($title)."\n\n".$body;
|
||||
|
||||
if($item['attach']) {
|
||||
$cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER);
|
||||
if(cnt) {
|
||||
$body .= "\n" . t('Attachments:') . "\n";
|
||||
foreach($matches as $mtch) {
|
||||
$body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user