option to hide post counters (home)
This commit is contained in:
parent
8f70075c45
commit
4e6ca4d184
2 changed files with 16 additions and 9 deletions
|
@ -26,6 +26,8 @@ class Home extends Extension
|
|||
public function onSetupBuilding(SetupBuildingEvent $event)
|
||||
{
|
||||
$counters = [];
|
||||
$counters["None"] = "none";
|
||||
$counters["Text-only"] = "text-only";
|
||||
foreach (glob("ext/home/counters/*") as $counter_dirname) {
|
||||
$name = str_replace("ext/home/counters/", "", $counter_dirname);
|
||||
$counters[ucfirst($name)] = $name;
|
||||
|
@ -50,15 +52,20 @@ class Home extends Extension
|
|||
}
|
||||
$counter_dir = $config->get_string('home_counter', 'default');
|
||||
|
||||
$total = Image::count_images();
|
||||
$strtotal = "$total";
|
||||
$num_comma = number_format($total);
|
||||
|
||||
$num_comma = "";
|
||||
$counter_text = "";
|
||||
$length = strlen($strtotal);
|
||||
for ($n=0; $n<$length; $n++) {
|
||||
$cur = $strtotal[$n];
|
||||
$counter_text .= "<img alt='$cur' src='$base_href/ext/home/counters/$counter_dir/$cur.gif' />";
|
||||
if ($counter_dir != 'none') {
|
||||
$total = Image::count_images();
|
||||
$num_comma = number_format($total);
|
||||
|
||||
if ($counter_dir != 'text-only') {
|
||||
$strtotal = "$total";
|
||||
$length = strlen($strtotal);
|
||||
for ($n=0; $n<$length; $n++) {
|
||||
$cur = $strtotal[$n];
|
||||
$counter_text .= "<img alt='$cur' src='$base_href/ext/home/counters/$counter_dir/$cur.gif' />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get the homelinks and process them
|
||||
|
|
|
@ -53,7 +53,7 @@ EOD
|
|||
$counter_html
|
||||
<div class='space' id='foot'>
|
||||
<small><small>
|
||||
$contact_link Serving $num_comma posts –
|
||||
$contact_link" . (empty($num_comma) ? "" : " Serving $num_comma posts –") . "
|
||||
Running <a href='https://code.shishnet.org/shimmie2/'>Shimmie2</a>
|
||||
</small></small>
|
||||
</div>
|
||||
|
|
Reference in a new issue