]> git.mxchange.org Git - friendica-addons.git/blobdiff - fromgplus/fromgplus.php
Direct calls to the database are replace by class calls to the item class
[friendica-addons.git] / fromgplus / fromgplus.php
index 36791310dd438ea94e11f29ac7451fc62dbd17e1..b8d9511a52f48c7628dde6c8f33dec05f8b5d4f2 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Object\Image;
+use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 
 require_once 'mod/share.php';
@@ -325,13 +326,13 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                switch($attachment->objectType) {
                        case "video":
                                $pagedata["type"] = "video";
-                               $pagedata["url"] = Network::originalURL($attachment->url);
+                               $pagedata["url"] = Network::finalUrl($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
                                break;
 
                        case "article":
                                $pagedata["type"] = "link";
-                               $pagedata["url"] = Network::originalURL($attachment->url);
+                               $pagedata["url"] = Network::finalUrl($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
 
                                $images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
@@ -382,7 +383,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                                break;
 
                        case "photo-album":
-                               $pagedata["url"] = Network::originalURL($attachment->url);
+                               $pagedata["url"] = Network::finalUrl($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
                                $post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
 
@@ -403,7 +404,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
 
                        case "album":
                                $pagedata["type"] = "link";
-                               $pagedata["url"] = Network::originalURL($attachment->url);
+                               $pagedata["url"] = Network::finalUrl($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
 
                                $thumb = $attachment->thumbnails[0];
@@ -416,7 +417,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                                break;
 
                        case "audio":
-                               $pagedata["url"] = Network::originalURL($attachment->url);
+                               $pagedata["url"] = Network::finalUrl($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
                                $post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
                                break;
@@ -441,7 +442,7 @@ function fromgplus_fetch($a, $uid) {
        $account = PConfig::get($uid,'fromgplus','account');
        $key = Config::get('fromgplus','key');
 
-       $result = Network::fetchURL("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
+       $result = Network::fetchUrl("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
        //$result = file_get_contents("google.txt");
        //file_put_contents("google.txt", $result);
 
@@ -519,12 +520,12 @@ function fromgplus_fetch($a, $uid) {
                                                if (function_exists("share_header"))
                                                        $post .= share_header($item->object->actor->displayName, $item->object->actor->url,
                                                                                $item->object->actor->image->url, "",
-                                                                               datetime_convert('UTC','UTC',$item->object->published),$item->object->url);
+                                                                               DateTimeFormat::utc($item->object->published),$item->object->url);
                                                else
                                                        $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
                                                                        "' profile='".$item->object->actor->url.
                                                                        "' avatar='".$item->object->actor->image->url.
-                                                                       "' posted='".datetime_convert('UTC','UTC',$item->object->published).
+                                                                       "' posted='".DateTimeFormat::utc($item->object->published).
                                                                        "' link='".$item->object->url."']";
 
                                                $post .= fromgplus_html2bbcode($item->object->content);