diff --git a/application/helpers/taglist.helper.php b/application/helpers/taglist.helper.php
index 67ce520..237b73b 100644
--- a/application/helpers/taglist.helper.php
+++ b/application/helpers/taglist.helper.php
@@ -25,18 +25,21 @@ function compute($tags = [])
if (count($tags) < 1) {
return $tags;
}
+
$min_percent = 70;
$max_percent = 130;
- foreach ($tags as $tag) {
- $min = empty($min) || $min > $tag->count ? $tag->count : $min;
- $max = empty($max) || $max < $tag->count ? $tag->count : $max;
- }
+
+ $min = min(array_column($tags, 'count'));
+ $max = max(array_column($tags, 'count'));
+
$diff = $max != $min ? $max - $min : 1;
$multiplier = ($max_percent - $min_percent) / $diff;
$offset = $min_percent - $min * $multiplier;
+
foreach ($tags as $tag) {
$tag->_size = round($tag->count * $multiplier + $offset);
}
+
return $this->sort_tags($tags);
}
diff --git a/application/layouts/default.layout.php b/application/layouts/default.layout.php
index d92e4c9..fff8fee 100644
--- a/application/layouts/default.layout.php
+++ b/application/layouts/default.layout.php
@@ -38,10 +38,8 @@
diff --git a/application/modules/my.module.php b/application/modules/my.module.php
index 7c1eaba..aced690 100644
--- a/application/modules/my.module.php
+++ b/application/modules/my.module.php
@@ -16,7 +16,7 @@
if (url_is('/my/marks')) {
$container->marks( model('marks')->private_from_user->__use($user, $params) );
$container->tags( model('tags')->private_from_user->__use($user) );
- $sidebar->register(['My', 'Tags'], function() { partial('tags'); });
+ $sidebar->register([_('My Tags')], function() { partial('tags'); });
return render('marks');
}
@@ -32,11 +32,11 @@
else {
$tags = array_map(function($slug) { return table('tags')->get_one('label', urldecode($slug)); }, $tags);
$labels = array_map(function($tag) { return strong($tag); }, $tags);
- title(_('My Marks'), 'with tags ' . implode(' & ', $labels));
+ title(_('My Marks'), _('with tags') . ' ' . implode(' & ', $labels));
$container->marks( model('marks')->private_from_user_with_tags->__use($user, $tags, $params) );
}
$container->tags( model('tags')->private_from_user_related_with->__use($user, $tag) );
- $sidebar->register(['My', 'Tags related with ' . strong($tag)], function() { partial('tags'); });
+ $sidebar->register([_('My Tags related with') . ' ' . strong($tag)], function() { partial('tags'); });
return render('marks');
}
@@ -47,16 +47,16 @@
elseif ($matches = url_match('/my/marks/search/*')) {
$query = set_param('query', urldecode($matches[1]));
- title(_('My Marks'), 'with search ' . strong($query));
+ title(_('My Marks with search'), ' ' . strong($query));
$container->marks( model('marks')->private_from_user_search->__use($user, $query, $params) );
$container->tags( model('tags')->private_search_from_user->__use($user, ['query' => $query]) );
- $sidebar->register(['My', 'Tags with search ' . strong($query)], function() { partial('tags'); });
+ $sidebar->register([_('My Tags with search') . ' ' . strong($query)], function() { partial('tags'); });
return render('marks');
}
elseif (url_is('/my/tags/autoupdate')) {
$query = get_param('query', '');
- side_title('My', 'Tags with search ' . strong($query));
+ side_title(_('My Tags with search') . ' ' . strong($query));
$params = ['limit' => get_int('limit', 50), 'query' => $query];
$container->tags( model('tags')->private_search_from_user($user, $params) );
return partial('tags');
diff --git a/application/modules/public.module.php b/application/modules/public.module.php
index a08a656..ee9b164 100644
--- a/application/modules/public.module.php
+++ b/application/modules/public.module.php
@@ -10,10 +10,10 @@
$container->marks(
model('marks')->latests->__use($params)
);
- $sidebar->register(['Public', 'Tags'], function() {
+ $sidebar->register([_('Public Tags')], function() {
partial('tags', ['tags' => model('tags')->latests]);
});
- $sidebar->register(['Active', 'Users'], function() {
+ $sidebar->register([_('Active Users')], function() {
partial('users', ['users' => helper('related')->active_users]);
});
return render('marks');
@@ -24,23 +24,23 @@
$tag = $target->tag($tags[0]);
# Single Tag
if (count($tags) == 1) {
- title(_('Public Marks'), 'with tag ' . strong($tag));
+ title(_('Public Marks'), _('with tag') . ' ' . strong($tag));
$container->marks( model('marks')->with_tag->__use($tag, $params) );
}
# Multiple Tags
else {
$tags = array_map(function($slug) { return table('tags')->get_one('label', urldecode($slug)); }, $tags);
$labels = array_map(function($tag) { return strong($tag); }, $tags);
- title(_('Public Marks'), 'with tags ' . implode(' & ', $labels));
+ title(_('Public Marks'), _('with tags') . ' ' . implode(' & ', $labels));
$container->marks( model('marks')->with_tags->__use($tags, $params) );
}
$container->tags(
model('tags')->related_with->__use($tag)
);
- $sidebar->register(['Tags', 'related with ' . strong($tag)], function() {
+ $sidebar->register([_('Tags related with') . ' ' . strong($tag)], function() {
partial('tags');
});
- $sidebar->register(['Active', 'Users with tag ' . strong($tag)], function() {
+ $sidebar->register([_('Users related with') . ' ' . strong($tag)], function() {
partial('users', ['users' => helper('related')->active_users]);
});
return render('marks');
@@ -52,27 +52,29 @@
$tag = $target->tag($tags[0]);
# Single Tag
if (count($tags) == 1) {
- title(_('Public Marks'), 'from ' . strong($user) . ' with tag ' . strong($tag));
+ title(_('Public Marks'), _('from') . ' ' . strong($user) . ' ' . _('with tag') . ' ' . strong($tag));
$container->marks( model('marks')->from_user_with_tag->__use($user, $tag, $params) );
}
# Multiple Tags
else {
$tags = array_map(function($slug) { return table('tags')->get_one('label', urldecode($slug)); }, $tags);
$labels = array_map(function($tag) { return strong($tag); }, $tags);
- title(_('Public Marks'), 'from ' . strong($user) . 'with tags ' . implode(' & ', $labels));
+ title(_('Public Marks'), _('from') . ' ' . strong($user) . ' ' . _('with tags') . ' ' . implode(' & ', $labels));
$container->marks( model('marks')->from_user_with_tags->__use($user, $tags, $params) );
}
$container->tags( model('tags')->from_user_related_with->__use($user, $tag) );
- $sidebar->register(['Tags', 'from ' . strong($user) . ' related with ' . strong($tag)], function() { partial('tags'); });
+ $sidebar->register([
+ _('Tags from') . ' ' . strong($user) . ' ' . _('related with') . ' ' . strong($tag)
+ ], function() { partial('tags'); });
return render('marks');
}
elseif ($matches = url_match('/user/*/marks')) {
$user = $target->user($matches[1]);
- title(_('Public Marks'), 'from ' . strong($user));
+ title(_('Public Marks'), _('from') . ' ' . strong($user));
$container->tags( model('tags')->from_user->__use($user) );
$container->marks( model('marks')->from_user->__use($user, $params) );
- $sidebar->register(['Tags', 'from ' . strong($user)], function() { partial('tags'); });
+ $sidebar->register([('Tags from') . ' ' . strong($user)], function() { partial('tags'); });
return render('marks');
}
@@ -83,10 +85,10 @@
elseif ($matches = url_match('/marks/search/*')) {
$query = set_param('query', urldecode($matches[1]));
- title(_('Public Marks'), 'with search ' . strong($query));
+ title(_('Public Marks'), _('with search') . ' ' . strong($query));
$container->marks( model('marks')->public_search->__use($query, $params) );
$container->tags( model('tags')->public_search->__use(['query' => $query]) );
- $sidebar->register(['Public', 'Tags with search ' . strong($query)], function() { partial('tags'); });
+ $sidebar->register([_('Public Tags with search') . ' ' . strong($query)], function() { partial('tags'); });
return render('marks');
}
diff --git a/application/views/marks/form-modal.view.php b/application/views/marks/form-modal.view.php
index feb6f10..a711a72 100644
--- a/application/views/marks/form-modal.view.php
+++ b/application/views/marks/form-modal.view.php
@@ -27,8 +27,10 @@
+
+