X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ftagcloudsection.php;h=ca72a27e521b38f161eedfffbca8759e23f34317;hb=ebc8e2a0e7dde135aef73be7b3d96dff155fe091;hp=1a7f721b2fa191de93c7371e7ca2fce1f876030a;hpb=baaf55e9d6e6acdf1d2ee0a4099bb8824520ebb4;p=quix0rs-gnu-social.git diff --git a/lib/tagcloudsection.php b/lib/tagcloudsection.php index 1a7f721b2f..ca72a27e52 100644 --- a/lib/tagcloudsection.php +++ b/lib/tagcloudsection.php @@ -1,6 +1,6 @@ . * * @category Widget - * @package Laconica - * @author Evan Prodromou - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -define('TAGS_PER_SECTION', 20); +define('TAGS_PER_SECTION', 10); /** * Base class for sections @@ -40,20 +40,20 @@ define('TAGS_PER_SECTION', 20); * group, or site. * * @category Widget - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ - class TagCloudSection extends Section { function showContent() { $tags = $this->getTags(); - if (!$tags) { - $this->out->element('p', null, _('None')); + if (!$tags instanceof Notice_tag) { + // TRANS: Content displayed in a tag cloud section if there are no tags. + $this->out->element('p', null, _m('NOTAGS','None')); return false; } @@ -63,12 +63,15 @@ class TagCloudSection extends Section $sum = 0; while ($tags->fetch() && ++$cnt <= TAGS_PER_SECTION) { - $tw[$tags->tag] = $tags->weight; - $sum += $tags->weight; + if ($tags->isCurrentProfileInScope()) { + $tw[$tags->tag] = $tags->weight; + $sum += $tags->weight; + } } if ($cnt == 0) { - $this->out->element('p', null, _('(None)')); + // TRANS: Content displayed in a tag cloud section if there are no tags. + $this->out->element('p', null, _m('NOTAGS','None')); return false; } @@ -76,7 +79,7 @@ class TagCloudSection extends Section $this->out->elementStart('ul', 'tags xoxo tag-cloud'); foreach ($tw as $tag => $weight) { - $this->showTag($tag, $weight, $weight/$sum); + $this->showTag($tag, $weight, ($sum == 0) ? 0 : $weight/$sum); } $this->out->elementEnd('ul'); @@ -114,6 +117,15 @@ class TagCloudSection extends Section function tagUrl($tag) { - return common_local_url('tag', array('tag' => $tag)); + if ('showstream' === $this->out->trimmed('action')) { + return common_local_url('showstream', array('nickname' => $this->out->profile->nickname, 'tag' => $tag)); + } else { + return common_local_url('tag', array('tag' => $tag)); + } + } + + function divId() + { + return 'tagcloud'; } }