]> git.mxchange.org Git - friendica-addons.git/blobdiff - tumblr/tumblr.php
Merge remote branch 'upstream/master'
[friendica-addons.git] / tumblr / tumblr.php
index 42518c050085045b182b8cc9992d83d48d215137..03a67949b3ec299f439c95166a13b0d235317f7a 100755 (executable)
@@ -32,7 +32,7 @@ function tumblr_jot_nets(&$a,&$b) {
     if(intval($tmbl_post) == 1) {
         $tmbl_defpost = get_pconfig(local_user(),'tumblr','post_by_default');
         $selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : '');
-        $b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . 'value="1" /> '
+        $b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> '
             . t('Post to Tumblr') . '</div>';
     }
 }
@@ -170,12 +170,13 @@ function tumblr_send(&$a,&$b) {
 
                $link = "";
                $video = false;
+               $title = trim($b['title']);
 
                // Checking for a bookmark
                if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches)) {
                        $link = $matches[1];
-                       if ($b['title'] == '')
-                               $b['title'] = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8');
+                       if ($title == '')
+                               $title = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8');
 
                        $body = $b['body'];
                        // splitting the text in two parts:
@@ -201,15 +202,20 @@ function tumblr_send(&$a,&$b) {
                if (($link != '') and $video) {
                        $params['type'] = "video";
                        $params['embed'] = $link;
-                       $params['caption'] = bbcode($body);
+                       if ($title != '')
+                               $params['caption'] = '<h1><a href="'.$link.'">'.$title.
+                                                       "</a></h1><p>".bbcode($body)."</p>";
+                       else
+                               $params['caption'] = bbcode($body);
                } else if (($link != '') and !$video) {
                        $params['type'] = "link";
-                       $params['name'] = $b['title'];
+                       $params['name'] = $title;
                        $params['url'] = $link;
-                       $params['description'] = bbcode($body);
+                       //$params['description'] = bbcode($body);
+                       $params['description'] = bbcode($b["body"]);
                } else {
                        $params['type'] = "regular";
-                       $params['title'] = $b['title'];
+                       $params['title'] = $title;
                        $params['body'] = bbcode($b['body']);
                }