]> git.mxchange.org Git - friendica.git/commitdiff
provide a test mode for facebook posts which goes through the motions but doesn't...
authorFriendika <info@friendika.com>
Thu, 28 Apr 2011 11:44:17 +0000 (04:44 -0700)
committerFriendika <info@friendika.com>
Thu, 28 Apr 2011 11:44:17 +0000 (04:44 -0700)
addon/facebook/facebook.php

index 26ec8c597a7447ece64e830d0613d55c227df414..c7821b2727f1f668712a5efdc1fb22db6ac48548 100644 (file)
@@ -444,7 +444,7 @@ function facebook_post_hook(&$a,&$b) {
 
                                $msg = preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/is",'$2 $1',$msg);
 
-                               $msg = preg_replace("/\[img\](.+?)\[\/img\]/is", t('Image: ') . '$1',$msg);
+                               $msg = preg_replace("/\[img\](.+?)\[\/img\]/is", t('Image: ') . '$1', $msg);
 
                                $msg = trim(strip_tags(bbcode($msg)));
                                $msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
@@ -504,7 +504,11 @@ function facebook_post_hook(&$a,&$b) {
                                logger('facebook: post to ' . $url);
                                logger('facebook: postvars: ' . print_r($postvars,true));
 
-                               $x = post_url($url, $postvars);
+                               // "test_mode" prevents anything from actually being posted.
+                               // Otherwise, let's do it. 
+
+                               if(! get_config('facebook','test_mode'))
+                                       $x = post_url($url, $postvars);
 
                                $retj = json_decode($x);
                                if($retj->id) {