| 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/src/Service/Admin/Devices/Views/ |
Upload File : |
<?php
namespace WP_Statistics\Service\Admin\Devices\Views;
use WP_STATISTICS\Menus;
use WP_Statistics\Service\Admin\ExportImport\ExportTypes;
use WP_Statistics\Utils\Request;
use WP_STATISTICS\Admin_Template;
use WP_Statistics\Abstracts\BaseTabView;
use WP_Statistics\Service\Admin\NoticeHandler\Notice;
use WP_Statistics\Service\Admin\Devices\DevicesDataProvider;
class TabsView extends BaseTabView
{
protected $dataProvider;
protected $defaultTab = 'overview';
protected $tabs = [
'overview',
'browsers',
'platforms',
'models',
'categories',
'resolutions',
'languages',
'timezones'
];
public function __construct()
{
parent::__construct();
$this->dataProvider = new DevicesDataProvider([
'per_page' => 10,
'page' => Admin_Template::getCurrentPaged()
]);
}
public function getOverviewData()
{
return $this->dataProvider->getOverviewData();
}
/**
* Returns data for "Browsers" tab.
*
* @return array
*/
public function getBrowsersData()
{
return $this->dataProvider->getBrowsersData();
}
/**
* Returns data for "Operating Systems" tab.
*
* @return array
*/
public function getPlatformsData()
{
return $this->dataProvider->getPlatformsData();
}
/**
* Returns data for "Device Models" tab.
*
* @return array
*/
public function getModelsData()
{
return $this->dataProvider->getModelsData();
}
/**
* Returns data for "Device Categories" tab.
*
* @return array
*/
public function getCategoriesData()
{
return $this->dataProvider->getCategoriesData();
}
/**
* Returns the current tab's template.
*/
public function render()
{
$currentTab = $this->getCurrentTab();
$data = $this->getTabData();
$args = [
'title' => esc_html__('Devices', 'wp-statistics'),
'pageName' => Menus::get_page_slug('devices'),
'paged' => Admin_Template::getCurrentPaged(),
'custom_get' => ['tab' => $currentTab],
'DateRang' => Admin_Template::DateRange(),
'hasDateRang' => true,
'data' => $data,
'viewMoreUrlArgs' => ['type' => 'single-' . rtrim($currentTab, 's'), 'from' => Request::get('from'), 'to' => Request::get('to')],
'tabs' => [
[
'id' => 'overview',
'link' => Menus::admin_url('devices', ['tab' => 'overview']),
'title' => esc_html__('Overview', 'wp-statistics'),
'class' => $this->isTab('overview') ? 'current' : '',
'export' => [ExportTypes::PDF_PAGE]
],
[
'id' => 'browsers',
'link' => Menus::admin_url('devices', ['tab' => 'browsers']),
'title' => esc_html__('Browsers', 'wp-statistics'),
'tooltip' => esc_html__('Displays the different web browsers used by your visitors.', 'wp-statistics'),
'class' => $this->isTab('browsers') ? 'current' : '',
'export' => [ExportTypes::CSV_TABLE, ExportTypes::PDF_PAGE]
],
[
'id' => 'platforms',
'link' => Menus::admin_url('devices', ['tab' => 'platforms']),
'title' => esc_html__('Operating Systems', 'wp-statistics'),
'tooltip' => esc_html__('Shows the operating systems your visitors are using.', 'wp-statistics'),
'class' => $this->isTab('platforms') ? 'current' : '',
'export' => [ExportTypes::CSV_TABLE, ExportTypes::PDF_PAGE]
],
[
'id' => 'models',
'link' => Menus::admin_url('devices', ['tab' => 'models']),
'title' => esc_html__('Device Models', 'wp-statistics'),
'tooltip' => esc_html__('Provides data on the specific models of devices used by your visitors.', 'wp-statistics'),
'class' => $this->isTab('models') ? 'current' : '',
'export' => [ExportTypes::CSV_TABLE, ExportTypes::PDF_PAGE]
],
[
'id' => 'categories',
'link' => Menus::admin_url('devices', ['tab' => 'categories']),
'title' => esc_html__('Device Categories', 'wp-statistics'),
'tooltip' => esc_html__('Displays visitor distribution across various device categories.', 'wp-statistics'),
'class' => $this->isTab('categories') ? 'current' : '',
'export' => [ExportTypes::CSV_TABLE, ExportTypes::PDF_PAGE]
]
],
];
if (isset($data['total']) && $data['total'] > 0) {
$args['total'] = $data['total'];
$args['pagination'] = Admin_Template::paginate_links([
'item_per_page' => 10,
'total' => $data['total'],
'echo' => false
]);
}
Admin_Template::get_template(['layout/header', 'layout/tabbed-page-header', "pages/devices/$currentTab", 'layout/postbox.hide', 'layout/footer'], $args);
}
}