X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftags.php;h=8d8fb765595ddd9f90f84325c94500db2abd0bc2;hb=5afedb28d4387eef580f7a6602016cc676d8d9e1;hp=fb3315441c1336807e40f4e58fb6b22a1f7930e6;hpb=59ae5633ec9080845a02de99665293655bd8b726;p=friendica.git diff --git a/include/tags.php b/include/tags.php index fb3315441c..8d8fb76559 100644 --- a/include/tags.php +++ b/include/tags.php @@ -1,9 +1,12 @@ $uid), + array("limit" => 1) + ); + $url = System::removedBaseUrl($contact['url']); + foreach ($r as $rr) { $tag['level'] = $rr[2]; - $tag['url'] = urlencode($rr[0]); + $tag['url'] = $url."?tag=".urlencode($rr[0]); $tag['name'] = $rr[0]; $tags[] = $tag; @@ -208,6 +242,12 @@ function wtagblock($uid, $count = 0,$owner = 0, $flags = 0, $type = TERM_HASHTAG return $o; } +/** + * @brief Calculate weighting of tags according to the frequency of use. + * + * @param array $arr Array of tags/terms with tag/term name and total count of use. + * @return array Alphabetical sorted array of used tags/terms of an user. + */ function tag_calc($arr) { $tags = array(); $min = 1e9; @@ -237,24 +277,35 @@ function tag_calc($arr) { return $tags; } -function tags_sort($a,$b) { +/** + * @brief Compare function to sort tags/terms alphabetically. + * + * @param type $a + * @param type $b + * + * @return int + */ +function tags_sort($a, $b) { if (strtolower($a[0]) == strtolower($b[0])) { return 0; } - return((strtolower($a[0]) < strtolower($b[0])) ? -1 : 1); + return ((strtolower($a[0]) < strtolower($b[0])) ? -1 : 1); } - -function tagcloud_wall_widget($arr = array()) { +/** + * @brief Insert a tag cloud widget for the present profile. + * + * @param int $limit Max number of displayed tags. + * @return string HTML formattat output. + */ +function tagcloud_wall_widget($limit = 50) { $a = get_app(); if(!$a->profile['profile_uid'] || !$a->profile['url']) { return ""; } - $limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50); - - if(feature_enabled($a->profile['profile_uid'], 'tagadelic')) { + if(Feature::isEnabled($a->profile['profile_uid'], 'tagadelic')) { $owner_id = Contact::getIdForURL($a->profile['url']); if(!$owner_id) {