From: Cat Gray Date: Thu, 8 Mar 2012 19:57:57 +0000 (+0200) Subject: Added tags support to LJ and DW connectors. (Friendica tags are converted to LJ/DW... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f68ba9b87d4b6b60dc3ee52787a1baaaec345110;p=friendica-addons.git Added tags support to LJ and DW connectors. (Friendica tags are converted to LJ/DW tags.) --- diff --git a/dwpost.tgz b/dwpost.tgz new file mode 100644 index 00000000..7841e419 Binary files /dev/null and b/dwpost.tgz differ diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index c7bfd939..5f8dcc73 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -6,6 +6,7 @@ * Version: 1.0 * Author: Tony Baldwin * Author: Michael Johnston + * Author: Cat Gray */ function dwpost_install() { @@ -173,6 +174,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 +202,7 @@ function dwpost_send(&$a,&$b) { props useragentFriendica -taglistfriendica +taglist$tags @@ -217,3 +219,9 @@ EOT; } } +function dwpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +} diff --git a/ljpost.tgz b/ljpost.tgz index 0132a752..60c223f4 100644 Binary files a/ljpost.tgz and b/ljpost.tgz differ diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 16863f67..e1bd2d63 100755 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -6,6 +6,7 @@ * Version: 1.0 * Author: Tony Baldwin * Author: Michael Johnston + * Author: Cat Gray */ function ljpost_install() { @@ -179,6 +180,7 @@ function ljpost_send(&$a,&$b) { $title = xmlify($b['title']); $post = bbcode($b['body']); $post = xmlify($post); + $tags = ljpost_get_tags($b['tag']); $date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s'); $year = intval(substr($date,0,4)); @@ -213,6 +215,10 @@ function ljpost_send(&$a,&$b) { useragent Friendica + + taglist + $tags + @@ -232,3 +238,9 @@ EOT; } } +function ljpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +}