Skip to content
Open

misc #16

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions application/helpers/taglist.helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 2 additions & 4 deletions application/layouts/default.layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@

<div id="footer">
<p>
<span class="separator">Feedback: <a href="http://twitter.com/blogmarks">@blogmarks</a> on Twitter</span>
<span class="separator">Designed &amp; supported by <a href="http://www.upian.com/">Upian</a></span>
<span class="separator">Operated by <a href="http://hodierne.net/">Hodierne Ventures</a></span>
<span>&copy; 2004-24 the Blogmarks team (blgmrks04tbf)</span>
<span class="separator">Contact: contact at blogmarks.net</span>
<span class="separator">Operated by Hodierne Ventures UG</span>
</p>
</div> <!-- /#footer -->

Expand Down
12 changes: 6 additions & 6 deletions application/modules/my.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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(' &amp; ', $labels));
title(_('My Marks'), _('with tags') . ' ' . implode(' &amp; ', $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');
}

Expand All @@ -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));
Copy link

Copilot AI Oct 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation string includes formatting that should be separate. Should be title(_('My Marks with search') . ' ' . strong($query)); to match the pattern used elsewhere.

Suggested change
title(_('My Marks with search'), ' ' . strong($query));
title(_('My Marks with search') . ' ' . strong($query));

Copilot uses AI. Check for mistakes.
$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');
Expand Down
28 changes: 15 additions & 13 deletions application/modules/public.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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(' &amp; ', $labels));
title(_('Public Marks'), _('with tags') . ' ' . implode(' &amp; ', $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');
Expand All @@ -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(' &amp; ', $labels));
title(_('Public Marks'), _('from') . ' ' . strong($user) . ' ' . _('with tags') . ' ' . implode(' &amp; ', $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'); });
Copy link

Copilot AI Oct 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing underscore function call. Should be _('Tags from') instead of ('Tags from').

Suggested change
$sidebar->register([('Tags from') . ' ' . strong($user)], function() { partial('tags'); });
$sidebar->register([_('Tags from') . ' ' . strong($user)], function() { partial('tags'); });

Copilot uses AI. Check for mistakes.
return render('marks');
}

Expand All @@ -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');
}

Expand Down
2 changes: 2 additions & 0 deletions application/views/marks/form-modal.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
<label for="mark-form-tags"><?= _('Public Tags') ?></label>
<input id="mark-form-tags" name="tags" type="text" class="input-block-level" value="<?= arg($tags) ?>" autocapitalize="off">

<?php // if ($private_tags) : ?>
<label for="mark-form-private-tags"><?= _('Private Tags') ?></label>
<input id="mark-form-private-tags" name="private_tags" type="text" class="input-block-level" value="<?= arg($private_tags) ?>" autocapitalize="off">
<?php // endif ?>

<label><?= _('Visibiity') ?></label>
<label for="new-mark-visibility-public" class="radio inline">
Expand Down
3 changes: 1 addition & 2 deletions config/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ CREATE TABLE `bm_screenshots` (
`created` datetime NOT NULL,
`generated` datetime NOT NULL,
`url` varchar(255) NOT NULL,
`status` tinyint(1) NOT NULL,
`tentatives` tinyint(1) NOT NULL,
`status` tinyint(0) NOT NULL,
PRIMARY KEY (`id`),
KEY `status_link` (`link`,`status`),
KEY `status` (`status`),
Expand Down
Binary file modified locale/fr_FR.utf8/LC_MESSAGES/blogmarks.mo
Binary file not shown.
Loading