X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=dwpost%2Fdwpost.php;h=25f7ac87484e56c3a3f87746bd9f11755314a1a0;hb=46ef0be93127ed04430ffa051592b9ca0ed12697;hp=c7bfd939fe57bbaee44f96c7b7a84da849f09ba3;hpb=7ab2c715a4001e9aebbc1db70b5fcac7e61f463f;p=friendica-addons.git diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index c7bfd939..25f7ac87 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -4,8 +4,9 @@ * Name: Dreamwidth Post Connector * Description: Post to dreamwidth * Version: 1.0 - * Author: Tony Baldwin + * Author: Tony Baldwin * Author: Michael Johnston + * Author: Cat Gray */ function dwpost_install() { @@ -65,8 +66,14 @@ function dwpost_settings(&$a,&$s) { /* Add some HTML to the existing form */ - $s .= '
'; - $s .= '

' . t('Dreamwidth Post Settings') . '

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

'. t("Dreamwidth Export").'

'; + $s .= '
'; + $s .= ''; } @@ -173,6 +180,7 @@ function dwpost_send(&$a,&$b) { $title = $b['title']; $post = bbcode($b['body']); $post = xmlify($post); + $tags = dwpost_get_tags($b['tag']); $date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s'); $year = intval(substr($date,0,4)); @@ -200,7 +208,7 @@ function dwpost_send(&$a,&$b) { props useragentFriendica -taglistfriendica +taglist$tags @@ -211,9 +219,15 @@ EOT; logger('dwpost: data: ' . $xml, LOGGER_DATA); if($dw_blog !== 'test') - $x = post_url($dw_blog,$xml); + $x = post_url($dw_blog,$xml,array("Content-Type: text/xml")); logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG); } } +function dwpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +}