+function fromgplus_parse_query($var)
+ {
+ /**
+ * Use this function to parse out the query array element from
+ * the output of parse_url().
+ */
+ $var = parse_url($var, PHP_URL_QUERY);
+ $var = html_entity_decode($var);
+ $var = explode('&', $var);
+ $arr = array();
+
+ foreach($var as $val) {
+ $x = explode('=', $val);
+ $arr[$x[0]] = $x[1];
+ }
+ unset($val, $x, $var);
+ return $arr;
+}
+
+function fromgplus_cleanupgoogleproxy($fullImage, $image) {
+ //$preview = "/w".$fullImage->width."-h".$fullImage->height."/";
+ //$preview2 = "/w".$fullImage->width."-h".$fullImage->height."-p/";
+ //$fullImage = str_replace(array($preview, $preview2), array("/", "/"), $fullImage->url);
+ $fullImage = $fullImage->url;
+
+ //$preview = "/w".$image->width."-h".$image->height."/";
+ //$preview2 = "/w".$image->width."-h".$image->height."-p/";
+ //$image = str_replace(array($preview, $preview2), array("/", "/"), $image->url);
+ $image = $image->url;
+
+ $cleaned = array();
+
+ $queryvar = fromgplus_parse_query($fullImage);
+ if ($queryvar['url'] != "")
+ $cleaned["full"] = urldecode($queryvar['url']);
+ else
+ $cleaned["full"] = $fullImage;
+ if (@exif_imagetype($cleaned["full"]) == 0)
+ $cleaned["full"] = "";
+
+ $queryvar = fromgplus_parse_query($image);
+ if ($queryvar['url'] != "")
+ $cleaned["preview"] = urldecode($queryvar['url']);
+ else
+ $cleaned["preview"] = $image;
+ if (@exif_imagetype($cleaned["preview"]) == 0)
+ $cleaned["preview"] = "";
+
+ if ($cleaned["full"] == "") {
+ $cleaned["full"] = $cleaned["preview"];
+ $cleaned["preview"] = "";
+ }
+
+ if ($cleaned["full"] != "")
+ $infoFull = get_photo_info($cleaned["full"]);
+ else
+ $infoFull = array("0" => 0, "1" => 0);
+
+ if ($cleaned["preview"] != "")
+ $infoPreview = get_photo_info($cleaned["preview"]);
+ else
+ $infoFull = array("0" => 0, "1" => 0);
+
+ if (($infoPreview[0] >= $infoFull[0]) AND ($infoPreview[1] >= $infoFull[1])) {
+ $temp = $cleaned["full"];
+ $cleaned["full"] = $cleaned["preview"];
+ $cleaned["preview"] = $temp;
+ }
+
+ if (($cleaned["full"] == $cleaned["preview"]) OR (($infoPreview[0] == $infoFull[0]) AND ($infoPreview[1] == $infoFull[1])))
+ $cleaned["preview"] = "";
+
+ if ($cleaned["full"] == "")
+ if (@exif_imagetype($fullImage) != 0)
+ $cleaned["full"] = $fullImage;
+
+ if ($cleaned["full"] == "")
+ if (@exif_imagetype($image) != 0)
+ $cleaned["full"] = $image;
+
+ // Could be changed in the future to a link to the album
+ $cleaned["page"] = $cleaned["full"];
+
+ return($cleaned);
+}
+
+function fromgplus_cleantext($text) {