]> git.mxchange.org Git - friendica-addons.git/blobdiff - statusnet/statusnet.php
update addons to support Smarty3
[friendica-addons.git] / statusnet / statusnet.php
index 9bbe4dcd19bae6846a0827578f151d3152b83983..d7af352eabc5b0e1246fb9673729203554ca3b02 100755 (executable)
@@ -435,6 +435,9 @@ function statusnet_shortenmsg($b, $max_char) {
        $recycle = html_entity_decode("◌ ", ENT_QUOTES, 'UTF-8');
        $body = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', "\n", $body);
 
+       // remove the share element
+       $body = preg_replace("/\[share(.*?)\](.*?)\[\/share\]/ism","\n\n$2\n\n",$body);
+
        // At first convert the text to html
        $html = bbcode($body, false, false);
 
@@ -620,7 +623,7 @@ function statusnet_post_hook(&$a,&$b) {
                        $image = $msgarr["image"];
                        if ($image != "") {
                                $imagedata = file_get_contents($image);
-                               $tempfile = tempnam("", "upload");
+                               $tempfile = tempnam(get_config("system","temppath"), "upload");
                                file_put_contents($tempfile, $imagedata);
                                $postdata = array("status"=>$msg, "media"=>"@".$tempfile);
                        } else
@@ -632,7 +635,7 @@ function statusnet_post_hook(&$a,&$b) {
                     //$result = $dent->post('statuses/update', array('status' => $msg));
                     $result = $dent->post('statuses/update', $postdata);
                     logger('statusnet_post send, result: ' . print_r($result, true).
-                           "\nmessage: ".$msg, LOGGER_DEBUG."\nOriginal post: ".print_r($b)."\nPost Data: ".print_r($postdata));
+                           "\nmessage: ".$msg, LOGGER_DEBUG."\nOriginal post: ".print_r($b, true)."\nPost Data: ".print_r($postdata, true));
                     if ($result->error) {
                         logger('Send to StatusNet failed: "' . $result->error . '"');
                     }
@@ -695,8 +698,15 @@ function statusnet_plugin_admin(&$a, &$o){
        );
 
        
-       $t = file_get_contents( dirname(__file__). "/admin.tpl" );
-       $o = replace_macros($t, array(
+       $t = get_markup_template( "admin.tpl", "addon/statusnet/" );
+       $includes = array(
+               '$field_input' => 'field_input.tpl',
+               '$field_checkbox' => 'field_checkbox.tpl',
+       );
+       $includes = set_template_includes($a->theme['template_engine'], $includes);
+
+       $o = replace_macros($t, $includes + array(
                '$submit' => t('Submit'),
                                                        
                '$sites' => $sitesform,