]> git.mxchange.org Git - friendica-addons.git/blobdiff - tumblr/tumblr.php
Brought README up to date.
[friendica-addons.git] / tumblr / tumblr.php
old mode 100644 (file)
new mode 100755 (executable)
index 25a0287..3102184
@@ -2,6 +2,7 @@
 
 /**
  * Name: Tumblr Post Connector
+ * Description: Post to Tumblr
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  */
@@ -155,13 +156,27 @@ function tumblr_send(&$a,&$b) {
 
                require_once('include/bbcode.php');
 
+               $tag_arr = array();
+               $tags = '';
+               $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
+
+               if($x) {
+                       foreach($matches as $mtch) {
+                               $tag_arr[] = $mtch[2];
+                       }
+               }
+               if(count($tag_arr))
+                       $tags = implode(',',$tag_arr);          
+
+
                $params = array(
                        'email' => $tmbl_username,
                        'password' => $tmbl_password,
-                       'title' => (($b['title']) ? $b['title'] : t('Post from Friendica')),
+                       'title' => $b['title'],
                        'type' => 'regular',
                        'format' => 'html',
                        'generator' => 'Friendica',
+                       'tags' => $tags,
                        'body' => bbcode($b['body'])
                );