private static function setupAdminVars() { $updateInt = wfConfig::get('actUpdateInterval', 2); if (!preg_match('/^\\d+$/', $updateInt)) { $updateInt = 2; } $updateInt *= 1000; wp_localize_script('wordfenceAdminjs', 'WordfenceAdminVars', array('ajaxURL' => admin_url('admin-ajax.php'), 'firstNonce' => wp_create_nonce('wp-ajax'), 'siteBaseURL' => wfUtils::getSiteBaseURL(), 'debugOn' => wfConfig::get('debugOn', 0), 'actUpdateInterval' => $updateInt, 'tourClosed' => wfConfig::get('tourClosed', 0), 'welcomeClosed' => wfConfig::get('welcomeClosed', 0), 'cacheType' => wfConfig::get('cacheType'), 'liveTrafficEnabled' => wfConfig::liveTrafficEnabled())); }
<td id="wfLiveStatus"></td> </tr> </table> </div> <div class="wordfenceWrap<?php if (!wfConfig::get('isPaid')) { echo " wordfence-community"; } ?> "> <?php $rightRail = new wfView('marketing/rightrail', array('additionalClasses' => 'wordfenceRightRailLiveTraffic')); echo $rightRail; ?> <?php if (!wfConfig::liveTrafficEnabled()) { ?> <div id="wordfenceLiveActivityDisabled"><p><strong>Live activity is disabled.</strong> <?php if (wfConfig::get('cacheType') == 'falcon') { ?> This is done to improve performance because you have Wordfence Falcon Engine enabled.<?php } ?> Login and firewall activity will still appear below.</p></div> <?php } ?> <div id="wf-live-traffic" class="wfTabsContainer"> <div id="wf-live-traffic-legend">
public function logHit() { if (!wfConfig::liveTrafficEnabled()) { return; } $headers = array(); foreach ($_SERVER as $h => $v) { if (preg_match('/^HTTP_(.+)$/', $h, $matches)) { $headers[$matches[1]] = $v; } } $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $this->getDB()->queryWrite("insert into " . $this->hitsTable . " (ctime, is404, isGoogle, IP, userID, newVisit, URL, referer, UA, jsRun) values (%f, %d, %d, %s, %s, %d, '%s', '%s', '%s', %d)", sprintf('%.6f', microtime(true)), is_404() ? 1 : 0, wfCrawl::isGoogleCrawler() ? 1 : 0, wfUtils::inet_pton(wfUtils::getIP()), $this->getCurrentUserID(), wordfence::$newVisit ? 1 : 0, wfUtils::getRequestedURL(), isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', $ua, (int) (isset($_COOKIE['wordfence_verifiedHuman']) && wp_verify_nonce($_COOKIE['wordfence_verifiedHuman'], 'wordfence_verifiedHuman' . $ua . wfUtils::getIP()))); return $this->getDB()->querySingle("select last_insert_id()"); }
/** * @return bool|int */ public function logHit() { $liveTrafficEnabled = wfConfig::liveTrafficEnabled(); $action = $this->currentRequest->action; $logHitOK = $this->logHitOK(); if (!$logHitOK) { return false; } if (!$liveTrafficEnabled && !$action) { return false; } if ($this->currentRequest !== null) { if ($this->currentRequest->save()) { return $this->currentRequest->getPrimaryKey(); } } return false; }