/** * date */ static function dayOfWeek() { //date_default_timezone_set(ExtraWatchDate::getTimezone()); return ExtraWatchDate::date("N", ExtraWatchDate::getUserTimestamp()); //OK //return ExtraWatchDate::date("w", $this->getUTCTimestamp()); }
function renderTable($bots = FALSE, $inactive, $ipFilter = FALSE, $renderAsEmail = FALSE, $renderedFromHistory = FALSE) { $output = ""; $rows = $this->getJoinedURIRows($bots, $inactive, $ipFilter); $agentNotPublishedMessage = $this->extraWatch->env->getAgentNotPublishedMsg($this->extraWatch->database); $downloadLog = $this->extraWatch->downloads->getDownloadLogIpTimestampPath(); $countryCodeToCountryNameArray = $this->extraWatch->helper->countryCodeToCountryNameList(); if ($bots == FALSE && $agentNotPublishedMessage != FALSE && sizeof($rows) == 0 && $inactive == 0) { $output .= "<tr><td colspan='10'><span style='color:red; font-weight: bold;'>" . $agentNotPublishedMessage . "</span></td></tr> "; return $output; } else { } if (!$rows) { $noDataHTML = ""; if (!$bots && _EW_CLOUD_MODE && $inactive == FALSE && !$renderedFromHistory) { $noDataHTML = "<table><tr><td>"; $noDataHTML .= "<h2 style='color: #e74c3c; font-weight: bold;'>1. Select the HTML code below and copy it to a clipboard </h2>"; $noDataHTML .= "<i>(Click on text area below, Ctrl+A, Ctrl+C)</i><br/><br/>"; $noDataHTML .= "<textarea cols='90' rows='8'>"; $noDataHTML .= htmlentities($this->extraWatch->helper->renderHTMLCodeSnippet(_EW_PROJECT_ID)); $noDataHTML .= "</textarea><br/><br/>"; $noDataHTML .= "<h2 style='color: #e74c3c; font-weight: bold;'>2. Open editor of your website's front-end</h2><br/>"; $noDataHTML .= "This step may be different for every CMS. <br/>You need to find where's your website frontend saved as HTML and the modify that file. <br/><b>Or ask your webmaster do to it for you!</b>"; $noDataHTML .= "<h2 style='color: #e74c3c; font-weight: bold;'>3. Find the </body> tag</h2>"; $noDataHTML .= "This is a footer of my website ©MyWebsite.com<br/><b></body></b><br/></html>"; $noDataHTML .= "<h2 style='color: #e74c3c; font-weight: bold;'>4. Paste this code before the </body> tag</h2>"; $noDataHTML .= "This is a footer of my website ©MyWebsite.com<br/><i>{code from clipboard}</i><br/><b></body></b><br/></html>"; $noDataHTML .= "</td><td valign='top'>"; $noDataHTML .= "<h2 style='color: #e74c3c; font-weight: bold;'>.. Or Watch the video with instructions:</h2><br/><br/>"; $noDataHTML .= "<iframe width=\"640\" height=\"360\" src=\"//www.youtube.com/embed/tvHNg-X4d8o\" frameborder=\"0\" allowfullscreen></iframe>"; $noDataHTML .= "</td></tr></table>"; } else { if ($inactive == FALSE) { $noDataHTML .= _EW_NO_DATA; } } $output .= "<tr><td colspan='5'>" . $noDataHTML . "</td></tr>"; return $output; } /** if visits are empty */ //$output = ""; $i = 0xff; $decrement = -1; $lastIp = ""; //to be able to hide flags / address for same IP in next rows $lastReferer = ""; $lastColor = ""; $rowNumber = 0; $dateToday = $this->extraWatch->date->jwDateToday(); $uri2HeatmapClicksAssoc = $this->heatmap->heatmapForDayAsAsoc($dateToday); $maxClicksOfDay = $this->heatmap->getMaxClicksForDay($dateToday); if (!$renderAsEmail) { $liveSiteWithSuffix = $this->extraWatch->config->getLiveSiteWithSuffix(); } else { $liveSiteWithSuffix = $this->extraWatch->config->getDomainFromLiveSite(_EW_PROJECT_ID) . $this->extraWatch->config->getLiveSiteWithSuffix(); } if (@$rows) { foreach ($rows as $row) { $rowNumber++; /* reset the values from previous iteration */ $country = "none"; $countryName = ""; $countryUpper = ""; $color = ""; $inactiveClass = ""; $inactiveImageClass = ""; if ($row->inactive) { $inactiveClass = "class='extraWatchInactiveVisit'"; $inactiveImageClass = "class='extraWatchInactiveImage'"; } $flag = "<img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/flags/{$country}.png' title='{$countryName}' alt='{$countryName}' {$inactiveImageClass}/>"; if ($this->extraWatch->block->getBlockedIp($row->ip)) { //TODO optimize whole block $ipString = "<s>" . ExtraWatchHelper::htmlspecialchars($row->ip) . "</s>"; } else { $ipString = ExtraWatchHelper::htmlspecialchars($row->ip); } //TODO optimize whole block if ($i < 0xcc || $i <= 0x0) { $decrement = $decrement * -1; } $i = $i + $decrement; $color = sprintf("%x", $i) . sprintf("%x", $i) . sprintf("%x", $i); if ($bots == TRUE) { $color = "ffffff"; } $country = $row->country; if (!$country) { $country = $this->extraWatch->helper->countryByIp($row->ip); $this->extraWatch->visit->updateCountryForIP($country, $row->ip); } if (@$country) { $countryName = @$countryCodeToCountryNameArray[$country]; $this->extraWatch->helper->countryCodeToCountryName($country); //TODO optimize $flag = "<img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/flags/{$country}.png' title='{$countryName}' alt='{$countryName}' {$inactiveImageClass}/>"; $countryUpper = strtoupper($country); } $userAgent = ExtraWatchHelper::htmlspecialchars($row->browser); $browser = ""; $os = ""; $browserIcon = ""; $osIcon = ""; if (@$userAgent) { $browser = $this->extraWatch->referer->identifyBrowser(@$userAgent); if (@$browser) { $browserIcon = $liveSiteWithSuffix . "components/com_extrawatch/img/icons/" . strtolower($browser) . ".gif"; } if (@$browserIcon) { $browser = "<img src='{$browserIcon}' alt='{$userAgent}' title='{$userAgent}' {$inactiveImageClass}/>"; } $os = json_decode(@$this->extraWatch->referer->identifyOSAsJSON(@$userAgent)); if (@$os->name) { $osIcon = $liveSiteWithSuffix . "components/com_extrawatch/img/icons/" . strtolower($os->icon); } if (@$osIcon) { $os = sprintf("<img src='%s' alt='%s' title='%s' {$inactiveImageClass}/>", $osIcon, $userAgent, $userAgent); } } //$output .= $rowNumber; if ($bots == TRUE && $osIcon) { continue; } // bot icon fix if ($bots == TRUE) { $osIcon = $liveSiteWithSuffix . "components/com_extrawatch/img/icons/blank.gif"; $browserIcon = $liveSiteWithSuffix . "components/com_extrawatch/img/icons/blank.gif"; $browser = sprintf("<img src='%s' alt='%s' title='%s' {$inactiveImageClass}/>", ExtraWatchHelper::htmlspecialchars($browserIcon), ExtraWatchHelper::htmlspecialchars($userAgent), ExtraWatchHelper::htmlspecialchars($userAgent)); $os = sprintf("<img src='%s' alt='%s' title='%s' {$inactiveImageClass}/>", ExtraWatchHelper::htmlspecialchars($osIcon), ExtraWatchHelper::htmlspecialchars($userAgent), ExtraWatchHelper::htmlspecialchars($userAgent)); } $username = ""; if (@$row->username) { if (@get_class($this->extraWatch->env) == "ExtraWatchJoomlaEnv") { $username = "******" . $this->extraWatch->config->getAdministratorIndex() . "?option=com_users&task=view&filter_search={$row->username}' style='color: black; text-decoration:none;'><i>" . @ExtraWatchHelper::htmlspecialchars($row->username) . "</i></a>"; } else { $username = "******" . @ExtraWatchHelper::htmlspecialchars($row->username) . "</i></span>"; } } $ipString = sprintf("<a id='%s' href='javascript:extrawatch_blockIpToggle(\"%s\");extrawatch_sendVisitsReq();' style='color:black;' {$inactiveClass}>%s</a>", ExtraWatchHelper::htmlspecialchars($row->ip), ExtraWatchHelper::htmlspecialchars($row->ip), $ipString); $mapsIcon = "<img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/icons/map_icon.gif' border='0' " . $this->extraWatch->helper->getTooltipOnEvent() . "=\"ajax_showTooltip('" . $this->extraWatch->config->getLiveSite() . $this->extraWatch->env->getEnvironmentSuffix() . $this->extraWatch->env->renderBackendAjaxLink($this->extraWatch->config, 'ajax', 'tooltip') . "&ip={$row->ip}&env=" . $this->extraWatch->config->getEnvironment() . "&projectId=" . _EW_PROJECT_ID . "',this);return FALSE\"/>"; $timeOfVisit = $this->extraWatch->helper->secondsToHumanFormat(@$row->timeDiff); $timeOfVisit = str_replace(" ", " ", $timeOfVisit); $displayCountryFlag = FALSE; if ($lastIp != $row->ip) { $lastTimestamp = $row->timestamp; $displayCountryFlag = TRUE; $lastIp = $row->ip; $rowNumber = 1; } else { $flag = ""; // do not display flag, ip if the IP is same sa previous $ipString = ""; } if (!$displayCountryFlag) { $username = ""; $browser = ""; $os = ""; $mapsIcon = ""; $timeOfVisit = ""; } if ($lastReferer != $row->referer) { $output .= $this->renderRefererRow($lastReferer, $color); $lastReferer = $row->referer; $lastColor = $color; } $dateOfVisit = ExtraWatchDate::date("d.m.Y", $row->timestamp); if (@$this->lastDate != $dateOfVisit) { $output .= "<tr><td ></td><td ></td><td ></td><td ><td ></td></td><td ></td><td ></td><td ></td><td colspan='8' colspan='3'><h3>{$dateOfVisit}</h3></td></tr>"; $this->lastDate = $dateOfVisit; } $output .= "<tr><td valign='top' align='left' ></td> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td valign='top' align='left' >" . @$mapsIcon . "</td><td valign='top' align='left' >"; if (!$countryUpper) { $output .= "<a href='" . $this->extraWatch->config->renderLink("goals", "insert&country=" . @$countryUpper) . "' style='color: #999999;' title='" . _EW_VISITS_ADD_GOAL_COUNTRY . "'>" . @$countryUpper . "</a>"; } $onlineString = ""; if ($row->inactive == 0 && $ipString) { $onlineString = "<img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/icons/online.png' valign='top' border='0'/>"; } $output .= "</td><td valign='top' align='left' >" . @$flag . "</td> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td valign='top' align='left' ><span {$inactiveClass}>{$ipString}</span>"; $output .= "{$username}</td> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td valign='top' align='left' >{$onlineString}</td> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td valign='top' align='left' >" . @$browser . "</td> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td valign='top' align='left' >" . @$os . "</td> \t \t \t \t\t \t \t \t \t \t\t \t \t\t \t \t\t\t \t \t\t \t \t \t\t \t \t \t \t \t \t\t \t\t \t\t\t\t \t\t\t \t\t \t\t \t \t\t \t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td valign='top' align='left' width='80%'>"; $day = $this->extraWatch->date->jwDateFromTimestamp($row->timestamp); $downloadsForIp = $this->extraWatch->downloads->getDownloadLogForIPBetweenTimestampsFromRef($downloadLog, $rowNumber, $row->ip, $lastTimestamp, $row->timestamp); //TODO optimize $timestampHumanReadable = ExtraWatchDate::date("H:i:s", $row->timestamp); $downloadIcon = "<img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/icons/downloads.png' {$inactiveImageClass} />"; if (@$downloadsForIp) { foreach ($downloadsForIp as $download) { $downloadTimestampHumanReadable = ExtraWatchDate::date("H:i:s", $download['timestamp']); $output .= "<div {$inactiveClass}>" . $downloadTimestampHumanReadable . " {$downloadIcon} " . $download['dname'] . "</div><br/>"; } } $goalsForIp = $this->extraWatch->goal->getGoalsForVisitIdBetweenTimestamps($row->visitId, $lastTimestamp, $row->timestamp); //TODO optimize if (@$goalsForIp) { foreach ($goalsForIp as $goalForIp) { $goalTimestampHumanReadable = ExtraWatchDate::date("H:i:s", $goalForIp->timestamp); $goalLink = "<a href='" . $this->extraWatch->config->renderLink("goals", "edit&goalId=" . (int) $goalForIp->goalId . "") . "' target='_blank'>" . $goalForIp->name . "</a>"; $output .= "<div style='background-color: #FFF9E1;' {$inactiveClass}>" . $goalTimestampHumanReadable . sprintf(_EW_VISITS_GOAL_REACHED, $goalLink) . "</div><br/>"; } } $lastTimestamp = $row->timestamp; $trucateCharLimit = $this->extraWatch->config->getConfigValue('EXTRAWATCH_TRUNCATE_VISITS'); $uriTruncated = $this->extraWatch->helper->truncate(urldecode($row->uri), $trucateCharLimit); $titleOriginal = $row->title; $row->title = $this->extraWatch->helper->truncate($row->title, $trucateCharLimit); $row->title = $this->extraWatch->helper->removeRepetitiveTitle($row->title); $uri2titleId = $this->extraWatch->visit->getUri2TitleId($row->uri, $titleOriginal); //TODO optimize $output .= "<div id='id{$row->id}' style='text-decoration: none;' {$inactiveClass} onmouseout=\"toggleElementVisibility('goal_" . $row->id . "',0);\" onmouseover=\"toggleDiv('" . $row->id . "','" . $row->ip . "',1, " . (int) $uri2titleId . ", {$day});\" >"; if (@_EW_CLOUD_MODE) { $projectSite = $this->extraWatch->config->getDomainFromLiveSite(_EW_PROJECT_ID); if (!ExtraWatchHelper::startsWith($projectSite, "http://")) { //add http prefix $projectSite = "http://" . $projectSite; } } if (!$row->title) { $row->title = $uriTruncated; } $output .= "{$timestampHumanReadable} <a href='" . @$projectSite . $row->uri . "' target='_blank' {$inactiveClass} title='{$uriTruncated}'>{$row->title}</a>"; /* $userHeatmapClicks = $this->heatmap->getHeatmapClickNums($row->ip, $row->uri, ExtraWatchDate::jwDateFromTimestamp($timestampHumanReadable));//TODO optimize if (@$userHeatmapClicks > 0) { if (@$maxClicksOfDay) { $ratio = $userHeatmapClicks / $maxClicksOfDay; } else { $ratio = 1; } $userClicksColor = ExtraWatchHelper::rgbFromRatio($ratio); $output .= $this->heatmapHTML->renderHeatmapLink($row->uri, (int) $uri2titleId, $day, " <img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/icons/click.png' title='" . _EW_HEATMAP_CLICK_OPEN . "'/> <span style='color: " . $userClicksColor . "' title='" . _EW_HEATMAP_CLICK_OPEN . "' $inactiveClass>$userHeatmapClicks</span>", $row->ip); } */ $clicks = @$uri2HeatmapClicksAssoc[$row->uri]; if (@$clicks) { if (@$maxClicksOfDay) { $ratio = $clicks / $maxClicksOfDay; $color = ExtraWatchHelper::rgbFromRatio($ratio); } $heatmapLinkOutput = $this->heatmapHTML->renderHeatmapLink($row->uri, (int) $uri2titleId, $day, "<span style='color: " . $color . "' title='" . _EW_HEATMAP_CLICK_OPEN . "'>{$clicks}</span>"); } $paramData = $this->extraWatch->visit->areParamDataForUri($row->id); //TODO optimize if ($paramData) { $output .= "<img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/icons/submit.png' />"; } if (!$renderAsEmail) { /* ad as goal link */ $output .= "<div id='goal_" . $row->id . "' style='display: none; margin: 0px; padding: 2px; left: 40%;' class='uriDetailDiv'>" . _EW_STATS_LOADING; $output .= "</div>"; } if ($timeOfVisit) { } $output .= "<td>{$heatmapLinkOutput}</td>"; $output .= "<td>"; if (@$timeOfVisit) { $output .= "<td valign='top'><img src='" . $liveSiteWithSuffix . "components/com_extrawatch/img/icons/clock.png' title='" . _EW_LIVE_STATS_SESSION_TIME . "'/></td><td valign='top' style='color: grey'>"; $output .= $timeOfVisit; } $output .= "</td>"; $output .= "</div>"; //TODO handle post data if ($paramData) { $postImage = "<div id='idp{$row->id}' onmouseout=\"toggleDiv('post_" . $row->id . "',0, " . (int) $uri2titleId . ", {$day});\" onmouseover=\"toggleDiv('post_" . $row->id . "',1, " . (int) $uri2titleId . ", {$day});\">"; } else { $postImage = ""; } $output .= $postImage; /* show only last URI, not all by user */ if ($this->extraWatch->config->getCheckboxValue('EXTRAWATCH_ONLY_LAST_URI')) { break; } $output .= "</td>"; $output .= "</tr>"; } } $output .= @$this->renderRefererRow($lastReferer, $lastColor); unset($uri2HeatmapClicksAssoc); unset($downloadLog); unset($countryCodeToCountryNameArray); return $output; }
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU General Public License v3 * @copyright (C) 2015 by CodeGravity.com - All rights reserved! * @website http://www.codegravity.com */ defined('_JEXEC') or die('Restricted access'); ?> <a name="ewDateControl"></a> <br/> <table width='100%'> <tr> <td align='left'><?php echo "<a href='" . $this->extraWatch->config->renderLink($task, "&day={$prev}#ewDateControl") . "' id='{$prev}'><" . ExtraWatchDate::date("d.m.Y", $prev * 3600 * 24) . "<img src='" . $this->extraWatch->config->getLiveSiteWithSuffix() . "components/com_extrawatch/img/icons/calendar.gif' border='0' align='center' /></a>"; ?> </td> <td class='ewCentered'><?php if ($day != $today) { echo "<a href='" . $this->extraWatch->config->renderLink($task, "&day={$today}#ewDateControl") . "' id='{$today}'>" . _EW_STATS_TODAY . "</a>"; } ?> </td> <td align='right'><?php if ($next <= $today) { echo "<a href='" . $this->extraWatch->config->renderLink($task, "&day={$next}#ewDateControl") . "' id='{$next}'><img src='" . $this->extraWatch->config->getLiveSiteWithSuffix() . "components/com_extrawatch/img/icons/calendar.gif' border='0' align='center' />" . ExtraWatchDate::date("d.m.Y", $next * 3600 * 24) . "></a>"; } ?> </td> </tr> </table>
function renderWeekTrendData($group, $name, $date) { $NUMBER_OF_BARS = 20; $resultsArray = array(); $max = 0; $maxDate = 0; // first day has to be monday $lineArray[] = "{\"period\": \"" . date("Y", ($date - 20) * 3600 * 24) . " W" . date("W", ($date - 20) * 3600 * 24) . "\", \"value\":" . (int) 0 . "}"; $dayOfWeek = ExtraWatchDate::date("N", $date * 24 * 3600) - 1; for ($i = $date - $NUMBER_OF_BARS * 7 - $dayOfWeek + 7; $i <= $date - $dayOfWeek; $i += 7) { $value = $this->extraWatch->stat->getSumOfTwoDays($i + 7, $i, $group, $name); if ($max < $value) { $max = $value; $maxDate = $i; } $lineArray[] = "{\"period\": \"" . date("Y", $i * 3600 * 24) . " W" . date("W", $i * 3600 * 24) . "\", \"value\":" . (int) $value . "}"; } return implode(",", $lineArray); }
function renderFrontendStats($extraWatch) { $cssURL = $this->extraWatch->config->getLiveSiteWithSuffix() . "components/com_extrawatch/css/extrawatch.css"; $output = $this->extraWatch->env->addStyleSheet($cssURL); $outputFirst = ""; $outputSecond = ""; if (@$this->extraWatch->config->getConfigValue('EXTRAWATCH_FRONTEND_COUNTRIES')) { $cachedItem = $this->extraWatch->cache->getCachedItem("CACHE_FRONTEND_COUNTRIES"); $cachedItem = $this->extraWatch->config->replaceHttpByHttps($cachedItem); if (@$cachedItem) { $outputFirst .= stripslashes($cachedItem); } else { $numberOfCountries = @$this->extraWatch->config->getConfigValue('EXTRAWATCH_FRONTEND_COUNTRIES_NUM'); if (!$numberOfCountries) { $numberOfCountries = 5; } $ctryOutput = "<table class='extrawatch'>"; $ctryOutputFetched = $this->renderIntValuesByNameForFrontend("country", FALSE, TRUE, 0, $numberOfCountries, TRUE); $ctryOutput .= $ctryOutputFetched; $ctryOutput .= "</table>"; if ($ctryOutputFetched) { $this->extraWatch->cache->storeCachedItem("CACHE_FRONTEND_COUNTRIES", $ctryOutput); } $outputFirst .= $ctryOutput; } } if (@$this->extraWatch->config->getConfigValue('EXTRAWATCH_FRONTEND_VISITORS')) { $cachedItem = $this->extraWatch->cache->getCachedItem("CACHE_FRONTEND_VISITORS"); $cachedItem = $this->extraWatch->config->replaceHttpByHttps($cachedItem); if (@$cachedItem) { $outputSecond .= stripslashes($cachedItem); } else { $todayDate = $this->extraWatch->date->jwDateToday(); $yesterdayDate = $todayDate - 1; $dow = $this->extraWatch->date->dayOfWeek(); $dom = $this->extraWatch->date->dayOfMonth(); $numOfDaysActualMonth = ExtraWatchDate::date("t", ExtraWatchDate::getUTCTimestamp()); $numOfDaysPrevMonth = ExtraWatchDate::date("t", ExtraWatchDate::getUTCTimestamp() - $numOfDaysActualMonth * 24 * 3600); $dayInCurrentMonth = ExtraWatchDate::date("d", ExtraWatchDate::getUTCTimestamp()); $lastMonthsDate = $todayDate - $dayInCurrentMonth; $timePeriodArray = array('TODAY', 'YESTERDAY', 'THIS_WEEK', 'LAST_WEEK', 'THIS_MONTH', 'LAST_MONTH', 'TOTAL'); $visOutput = ""; $visOutput .= "<table class='extrawatch'>"; foreach ($timePeriodArray as $key) { if (!@$this->extraWatch->config->getConfigValue('EXTRAWATCH_FRONTEND_VISITORS_' . $key)) { continue; // isn't enabled } switch ($key) { case 'TODAY': $value = $this->extraWatch->stat->getCountByKeyAndDate(EW_DB_KEY_UNIQUE, $todayDate); break; case 'YESTERDAY': $value = $this->extraWatch->stat->getCountByKeyAndDate(EW_DB_KEY_UNIQUE, $yesterdayDate); break; case 'THIS_WEEK': $value = $this->extraWatch->stat->getCountByKeyBetweenDates(EW_DB_KEY_UNIQUE, $todayDate - $dow, $todayDate); break; case 'LAST_WEEK': $value = $this->extraWatch->stat->getCountByKeyBetweenDates(EW_DB_KEY_UNIQUE, $todayDate - $dow - 7, $todayDate - $dow); break; case 'THIS_MONTH': $value = $this->extraWatch->stat->getCountByKeyBetweenDates(EW_DB_KEY_UNIQUE, $todayDate - $dom, $todayDate); break; case 'LAST_MONTH': $value = $this->extraWatch->stat->getCountByKeyBetweenDates(EW_DB_KEY_UNIQUE, $lastMonthsDate - $numOfDaysPrevMonth, $lastMonthsDate); break; case 'TOTAL': $totalFromSettings = $this->extraWatch->config->getConfigValue('EXTRAWATCH_FRONTEND_VISITORS_TOTAL_INITIAL'); $totalReal = $this->extraWatch->stat->getTotalCountByKey(EW_DB_KEY_UNIQUE); if (@$totalFromSettings) { /** use total from settings, but still append the real value as a comment */ $value = $totalFromSettings + $totalReal . "<!-- {$totalReal} -->"; } else { $value = $totalReal; } break; } if (isset($value)) { $visOutput .= "<tr><td style='text-align: left' class='extrawatch'>" . @constant("_EW_FRONTEND_" . $key) . ": </td><td style='text-align: left'> " . @$value . "</td></tr>"; } } $visOutput .= "</table>"; if (@$value) { $this->extraWatch->cache->storeCachedItem("CACHE_FRONTEND_VISITORS", $visOutput); } $outputSecond .= $visOutput; } } // to be able to swap order of Countries/Visitors if (@$this->extraWatch->config->getConfigValue('EXTRAWATCH_FRONTEND_COUNTRIES_FIRST')) { $output .= "" . $outputFirst . "<br/>" . $outputSecond . ""; } else { $output .= "" . $outputSecond . "<br/>" . $outputFirst . ""; } return $output; }