dbFields = array(
'sidebarLabel'=>'Hit Counter',
'showRunningTotalValue'=>true,
'showDailyValue'=>true,
'showDailyUniqueValue'=>true,
'showWeeklyValue'=>true,
'showWeeklyUniqueValue'=>true,
'showMonthlyValue'=>true,
'showMonthlyUniqueValue'=>true
);
}
public function form()
{
global $L;
// Check if the plugin Simple Stats is activated
if (!pluginActivated('pluginSimpleStats')) {
// Show an alert about the dependency of the plugin
$html = '
';
// Hidden form buttons. Save and Cancel buttons.
$this->formButtons = false;
return $html;
}
// Show the description of the plugin in the settings
$html = '
';
$html .= $this->description();
$html .= '
';
// Label of the plugin to show in the sidebar
$html .= '
';
return $html;
}
public function siteSidebar()
{
global $L;
$formatStyle=NumberFormatter::TYPE_INT32;
$formatter= new NumberFormatter($locale, $formatStyle);
// Check if the plugin Simple Stats is activated
if (pluginActivated('pluginSimpleStats')) {
// Get the object of the plugin Simple Stats
global $plugins;
IF ( ($this->getValue('showRunningTotalValue') )
|| ($this->getValue('showDailyValue'))
|| ($this->getValue('showDailyUniqueValue'))
|| ($this->getValue('showWeeklyValue'))
|| ($this->getValue('showWeeklyUniqueValue'))
|| ($this->getValue('showMonthlyValue'))
|| ($this->getValue('showMonthlyUniqueValue')) )
{
$simpleStats = $plugins['all']['pluginSimpleStats'];
$html = '
';
$html .= '
'.$this->getValue('sidebarLabel').'
';
$html .= '
';
// Get all the needed values
if ($this->getValue('showRunningTotalValue') ) {
$runningTotals = json_decode(file_get_contents($simpleStats->workspace().'running-totals.json'),TRUE);
$runningTotal = $runningTotals['runningTotals']['pageCounter'];
$html .= '