X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=wppost%2Fwppost.php;h=8436fd3ae22141ef1d93a26036a225d6e06fe01d;hb=2ca92ed594ba3909fdcc063b2b63e27620841336;hp=e8b6fc6d5236235690b0a0ca0b9f6f16a5a13eb8;hpb=182951f4eee76fbf793285fc349d70ec78dfa915;p=friendica-addons.git diff --git a/wppost/wppost.php b/wppost/wppost.php index e8b6fc6d..8436fd3a 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -72,8 +72,13 @@ function wppost_settings(&$a,&$s) { /* Add some HTML to the existing form */ - $s .= '
'; - $s .= '

' . t('WordPress Post Settings') . '

'; + $s .= ''; + $s .= '

'. t('Wordpress Export').'

'; + $s .= '
'; + $s .= ''; } @@ -189,21 +194,33 @@ function wppost_send(&$a,&$b) { // If no bookmark is found then take the first line if ($wptitle == '') { - $title = html2plain(bbcode($b['body']), 0, true); + // Remove the share element before fetching the first line + $title = trim(preg_replace("/\[share.*?\](.*?)\[\/share\]/ism","\n$1\n",$b['body'])); + + $title = html2plain(bbcode($title, false, false), 0, true)."\n"; $pos = strpos($title, "\n"); - if (($pos == 0) or ($pos > 60)) - $pos = 60; + $trailer = ""; + if (($pos == 0) or ($pos > 100)) { + $pos = 100; + $trailer = "..."; + } - $wptitle = substr($title, 0, $pos); + $wptitle = substr($title, 0, $pos).$trailer; } } $title = '' . (($wptitle) ? $wptitle : t('Post from Friendica')) . ''; - $post = $title . bbcode($b['body']); + $post = bbcode($b['body'], false, false, 4); + + // If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it + $post = preg_replace('/(.*?)<\/a>/ism',"\n$1\n",$post); + $post = preg_replace('/(.*?)<\/a>/ism',"\n$1\n",$post); + + $post = $title.$post; $wp_backlink = intval(get_pconfig($b['uid'],'wppost','backlink')); if($wp_backlink && $b['plink']) - $post .= EOL . EOL . '' + $post .= EOL . EOL . '' . t('Read the original post and comment stream on Friendica') . '' . EOL . EOL; $post = xmlify($post);