dbFields = array( 'label'=>'Hit Counter', 'showUniqueVisitors'=>false ); } public function form() { global $L; // Check if the plugin Visits Stats is activated if (!isPluginActive('pluginVisitsStats')) { $html = ''; // Hidden form buttons. Save and Cancel buttons. $this->formButtons = false; return $html; } $html = '
'; $html .= ''; $html .= ''; $html .= '
'.$L->get('This title is almost always used in the sidebar of the site').'
'; $html .= '
'; $html .= '
'; $html .= ''; $html .= ''; $html .= '
'; return $html; } public function siteSidebar() { // Init counter to 0 $counter = 0; // Check if the plugin Simple Stats is activated if (isPluginActive('pluginVisitsStats')) { // Get the object of the plugin Simple Stats global $plugins; $visitsStats = $plugins['all']['pluginVisitsStats']; $currentDate = Date::current('Y-m-d'); if ($this->getValue('showUniqueVisitors')) { // Get the unique visitors from today $counter = $visitsStats->uniqueVisitors($currentDate); } else { // Get the visits from today $counter = $visitsStats->visits($currentDate); } } $html = '
'; $html .= '

'.$this->getValue('label').'

'; $html .= '
'; $html .= '
'.$counter.'
'; $html .= '
'; $html .= '
'; return $html; } }