]> git.mxchange.org Git - friendica-addons.git/commitdiff
sn commented out some regex for various reasons
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 16 Feb 2012 06:57:41 +0000 (07:57 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 16 Feb 2012 06:57:41 +0000 (07:57 +0100)
statusnet/statusnet.php

index 1975277af38dbe476367530f2da812ade4e36358..1bbe6427d43ede21044732807ae732a6859f395f 100755 (executable)
@@ -1,6 +1,7 @@
 <?php
 /**
  * Name: StatusNet Connector
+ * Description: Relay public postings to a connected StatusNet account
  * Version: 1.0.3
  * Author: Tobias Diekershoff <https://diekershoff.homeunix.net/friendika/profile/tobias>
  */
@@ -393,15 +394,18 @@ function statusnet_post_hook(&$a,&$b) {
                $dent = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret);
                $max_char = $dent->get_maxlength(); // max. length for a dent
                 // if [url=bla][img]blub.png[/img][/url] get blub.png
-                $tmp = preg_replace( '/\[url\=(\w+.*?)\]\[img\](\w+.*?)\[\/img\]\[\/url\]/i', '$2', $tmp);
+//                $tmp = preg_replace( '/\[url\=(\w+.*?)\]\[img\](\w+.*?)\[\/img\]\[\/url\]/i', '$2', $b['body']);
                 // preserve links to images, videos and audios
-                $tmp = preg_replace( '/\[\\/?img(\\s+.*?\]|\])/i', '', $b['body']);
+                $tmp = preg_replace( '/\[\\/?img(\\s+.*?\]|\])/i', '', $tmp);
                 $tmp = preg_replace( '/\[\\/?video(\\s+.*?\]|\])/i', '', $tmp);
                 $tmp = preg_replace( '/\[\\/?youtube(\\s+.*?\]|\])/i', '', $tmp);
                 $tmp = preg_replace( '/\[\\/?vimeo(\\s+.*?\]|\])/i', '', $tmp);
                 $tmp = preg_replace( '/\[\\/?audio(\\s+.*?\]|\])/i', '', $tmp);
                 // if a #tag is linked, don't send the [url] over to SN
-                $tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
+                // this is commented out by default as it means backlinks
+                // to friendica, if you don't like this feel free to
+                // uncomment the following line
+//                $tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
                 // preserve links to webpages
                 $tmp = preg_replace( '/\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
                 // TODO apply the shortener to the URLs in the releyed dent