]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Widget.php
Merge branch 'issue-4816' of github.com:annando/friendica into issue-4816
[friendica.git] / src / Content / Widget.php
index e019de9638b3916a4eee8e1edb7824e301039524..058a7a1fb51c47e82bc2e00e1e299bd03829427c 100644 (file)
@@ -12,12 +12,13 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
+use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
-
 use dba;
 
 require_once 'boot.php';
+require_once 'include/dba.php';
 
 class Widget
 {
@@ -50,7 +51,7 @@ class Widget
                        if ($x || is_site_admin()) {
                                $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
                                        . L10n::tt('%d invitation available', '%d invitations available', $x)
-                                       . '</div>' . $inv;
+                                       . '</div>';
                        }
                }
 
@@ -312,4 +313,31 @@ class Widget
                        '$items' => $r)
                );
        }
+
+       /**
+        * Insert a tag cloud widget for the present profile.
+        *
+        * @brief Insert a tag cloud widget for the present profile.
+        * @param int     $limit Max number of displayed tags.
+        * @return string HTML formatted output.
+        */
+       public static function tagCloud($limit = 50)
+       {
+               $a = get_app();
+
+               if (!$a->profile['profile_uid'] || !$a->profile['url']) {
+                       return '';
+               }
+
+               if (Feature::isEnabled($a->profile['profile_uid'], 'tagadelic')) {
+                       $owner_id = Contact::getIdForURL($a->profile['url'], 0, true);
+
+                       if (!$owner_id) {
+                               return '';
+                       }
+                       return Widget\TagCloud::getHTML($a->profile['profile_uid'], $limit, $owner_id, 'wall');
+               }
+
+               return '';
+       }
 }