]> git.mxchange.org Git - friendica-addons.git/blobdiff - fromgplus/fromgplus.php
PL translation blackout THX waldis
[friendica-addons.git] / fromgplus / fromgplus.php
index fcee3260491f5cf8ca83bb01b5d96398ba00d9c4..ac433526a020b033b68188c5471225f6b4058a4d 100644 (file)
@@ -81,14 +81,14 @@ class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
 
 function fromgplus_addon_settings_post(&$a,&$b) {
 
-       if(! local_user())
+       if (!local_user())
                return;
 
-       if($_POST['fromgplus-submit']) {
+       if (!empty($_POST['fromgplus-submit'])) {
                PConfig::set(local_user(),'fromgplus','account',trim($_POST['fromgplus-account']));
-               $enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0);
+               $enable = (x($_POST,'fromgplus-enable') ? intval($_POST['fromgplus-enable']) : 0);
                PConfig::set(local_user(),'fromgplus','enable', $enable);
-               $keywords = ((x($_POST, 'fromgplus-keywords')) ? intval($_POST['fromgplus-keywords']) : 0);
+               $keywords = (x($_POST, 'fromgplus-keywords') ? intval($_POST['fromgplus-keywords']) : 0);
                PConfig::set(local_user(),'fromgplus', 'keywords', $keywords);
 
                if (!$enable)
@@ -169,7 +169,6 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
        $_SESSION['uid'] = $uid;
 
        unset($_REQUEST);
-       $_REQUEST['type'] = 'wall';
        $_REQUEST['api_source'] = true;
 
        $_REQUEST['profile_uid'] = $uid;
@@ -230,7 +229,9 @@ function fromgplus_parse_query($var)
 
        foreach($var as $val) {
                $x          = explode('=', $val);
-               $arr[$x[0]] = $x[1];
+               if (count($x) > 1) {
+                       $arr[$x[0]] = $x[1];
+               }
        }
        unset($val, $x, $var);
        return $arr;
@@ -250,7 +251,7 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
                $cleaned = [];
 
        $queryvar = fromgplus_parse_query($fullImage);
-       if ($queryvar['url'] != "")
+       if (!empty($queryvar['url']))
                $cleaned["full"] = urldecode($queryvar['url']);
        else
                $cleaned["full"] = $fullImage;
@@ -258,24 +259,24 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
                $cleaned["full"] = "";
 
        $queryvar = fromgplus_parse_query($image);
-       if ($queryvar['url'] != "")
+       if (!empty($queryvar['url']))
                        $cleaned["preview"] = urldecode($queryvar['url']);
        else
                $cleaned["preview"] = $image;
        if (@exif_imagetype($cleaned["preview"]) == 0)
                $cleaned["preview"] = "";
 
-       if ($cleaned["full"] == "") {
+       if (empty($cleaned["full"])) {
                $cleaned["full"] = $cleaned["preview"];
                $cleaned["preview"] = "";
        }
 
-       if ($cleaned["full"] != "")
+       if (!empty($cleaned["full"]))
                $infoFull = Image::getInfoFromURL($cleaned["full"]);
        else
                $infoFull = ["0" => 0, "1" => 0];
 
-       if ($cleaned["preview"] != "")
+       if (!empty($cleaned["preview"]))
                $infoPreview = Image::getInfoFromURL($cleaned["preview"]);
        else
                $infoFull = ["0" => 0, "1" => 0];
@@ -340,10 +341,13 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                                if ($images["full"] != "")
                                        $pagedata["images"][0]["src"] = $images["full"];
 
-                               $quote = trim(fromgplus_html2bbcode($attachment->content));
+                               if (!empty($attachment->content)) {
+                                       $quote = trim(fromgplus_html2bbcode($attachment->content));
+                               }
 
-                               if ($quote != "")
+                               if (!empty($quote)) {
                                        $pagedata["text"] = $quote;
+                               }
 
                                // Add Keywords to page link
                                $data = parseurl_getsiteinfo_cached($pagedata["url"], true);
@@ -364,11 +368,11 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                                        }
                                }
 
-                               if ($images["preview"] != "") {
+                               if (!empty($images["preview"])) {
                                        $post .= "\n[url=".$images["page"]."][img]".$images["preview"]."[/img][/url]\n";
                                        $pagedata["images"][0]["src"] = $images["preview"];
                                        $pagedata["url"] = $images["page"];
-                               } elseif ($images["full"] != "") {
+                               } elseif (!empty($images["full"])) {
                                        $post .= "\n[img]".$images["full"]."[/img]\n";
                                        $pagedata["images"][0]["src"] = $images["full"];