Copy functions from include/tags to src

- Create Content\Widget\TagCloud
- Populate Worker\TagUpdate::execute
- Add Content\Widget::tagCloud
- Add Model\Term::insertFromItemId and Model\Term::insertFromItemUri
This commit is contained in:
Hypolite Petovan 2018-02-03 23:49:48 -05:00
commit 507bea0e9f
4 changed files with 352 additions and 5 deletions

View 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
{
@ -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']);
if (!$owner_id) {
return '';
}
return Widget\TagCloud::getHTML($a->profile['profile_uid'], $limit, $owner_id, 'wall');
}
return '';
}
}