| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.3/wp-content/plugins/wp-statistics/includes/ |
Upload File : |
<?php
namespace WP_STATISTICS;
use WP_Statistics\Decorators\VisitorDecorator;
use WP_Statistics\Models\OnlineModel;
class UserOnline
{
/**
* Check Active User Online System
*
* @deprecated Online tracker is enabled by default since v14.16 and this function just toggles visibility of some UI elements.
* @return mixed
*/
public static function active()
{
/**
* Disable/Enable User Online
*
* @example add_filter('wp_statistics_active_user_online', function(){ if( is_page() ) { return false; } });
*/
return apply_filters('wp_statistics_active_user_online', true);
}
/**
* Check IP is online
*
* @deprecated This method is deprecated. Use OnlineModel::getOnlineVisitor instead.
* @param bool $user_ip
* @return bool
*/
public static function is_ip_online($user_ip = false)
{
$onlineModel = new OnlineModel();
$user_online = $onlineModel->getOnlineVisitors(['ip' => $user_ip]);
return (!$user_online ? false : $user_online);
}
/**
* Get User Online List By Custom Query
*
* @deprecated This method is deprecated. Use OnlineModel::getOnlineVisitorsData instead.
* @param array $arg
* @return array
* @throws \Exception
*/
public static function get($arg = array())
{
$onlineModel = new OnlineModel();
$result = $onlineModel->getOnlineVisitors($arg);
// Get List
$list = array();
foreach ($result as $items) {
/** @var VisitorDecorator $items */
$ip = esc_html($items->getRawIP());
$agent = esc_html($items->getBrowser()->getName());
$platform = esc_html($items->getOs()->getName());
$item = array(
'referred' => $items->getReferral()->getReferrer(),
'agent' => $agent,
'platform' => $platform,
'version' => $items->getBrowser()->getVersion(),
);
// Add User information
if ($items->getUser()) {
$item['user'] = array(
'ID' => $items->getUser()->getId(),
'user_email' => $items->getUser()->getEmail(),
'user_login' => $items->getUser()->getUsername(),
'name' => $items->getUser()->getDisplayName(),
);
}
// Page info
$item['page'] = $items->getLastPage();
// Push Browser
$item['browser'] = array(
'name' => $agent,
'logo' => $items->getBrowser()->getLogo(),
'link' => Menus::admin_url('visitors', array('agent' => $agent))
);
// Push IP
if (IP::IsHashIP($ip)) {
$item['ip'] = array('value' => substr($ip, 6, 10), 'link' => Menus::admin_url('visitors', array('ip' => urlencode($ip))));
} else {
$item['ip'] = array('value' => $ip, 'link' => Menus::admin_url('visitors', array('ip' => $ip)));
$item['map'] = Helper::geoIPTools($ip);
}
$item['country'] = array('location' => $items->getLocation()->getCountryCode(), 'flag' => $items->getLocation()->getCountryFlag(), 'name' => $items->getLocation()->getCountryName());
$item['city'] = $items->getLocation()->getCity();
$item['region'] = $items->getLocation()->getRegion();
$item['single_url'] = Menus::admin_url('visitors', ['type' => 'single-visitor', 'visitor_id' => $items->getId()]);
$item['online_for'] = $items->getOnlineTime();
$list[] = $item;
}
return $list;
}
}