dbFields = array(
'label' => 'Hit Counter',
'showUniqueVisitors' => false
);
}
public function form()
{
global $L;
// Check if the plugin Visits Stats is activated
if (!pluginActivated('pluginVisitsStats')) {
$html = '
';
$html .= $L->get('This plugin depends on the following plugins.');
$html .= '
';
$html .= '
';
$this->formButtons = false;
return $html;
}
$html = '';
$html .= $this->description();
$html .= '
';
$html .= '';
$html .= '' . $L->get('Label') . ' ';
$html .= ' ';
$html .= '' . $L->get('This title is almost always used in the sidebar of the site') . ' ';
$html .= '
';
$html .= '';
$html .= '' . $L->get('Show unique visitors') . ' ';
$html .= '';
$html .= 'getValue('showUniqueVisitors') === true ? 'selected' : '') . '>' . $L->get('Enabled') . ' ';
$html .= 'getValue('showUniqueVisitors') === false ? 'selected' : '') . '>' . $L->get('Disabled') . ' ';
$html .= ' ';
$html .= '
';
return $html;
}
public function siteSidebar()
{
$counter = 0;
if (pluginActivated('pluginVisitsStats')) {
global $plugins;
$visitsStats = $plugins['all']['pluginVisitsStats'];
$currentDate = Date::current('Y-m-d');
if ($this->getValue('showUniqueVisitors')) {
$counter = $visitsStats->uniqueVisitors($currentDate);
} else {
$counter = $visitsStats->visits($currentDate);
}
}
$html = '';
$html .= '
' . $this->getValue('label') . ' ';
$html .= '
';
$html .= '
' . $counter . '
';
$html .= '
';
$html .= '
';
return $html;
}
}