options-group-live-traffic.php
5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
if (!defined('WORDFENCE_VERSION')) { exit; }
/**
* Presents the Live Traffic Options group.
*
* Expects $stateKey.
*
* @var string $stateKey The key under which the collapse state is stored.
* @var bool $collapseable If defined, specifies whether or not this grouping can be collapsed. Defaults to true.
* @var bool $showControls If defined, specifies whether or not the save/cancel/restore controls are shown. Defaults to false.
* @var bool $hideShowMenuItem If defined, specifies whether or not the show menu item option is shown. Defaults to false.
*/
if (!isset($collapseable)) {
$collapseable = true;
}
if (!isset($showControls)) {
$showControls = false;
}
if (!isset($hideShowMenuItem)) {
$hideShowMenuItem = false;
}
?>
<div id="wf-live-traffic-options" class="wf-row">
<div class="wf-col-xs-12">
<div class="wf-block<?php if (!$collapseable) { echo ' wf-always-active'; } else { echo (wfPersistenceController::shared()->isActive($stateKey) ? ' wf-active' : ''); } ?>" data-persistence-key="<?php echo esc_attr($stateKey); ?>">
<div class="wf-block-header">
<div class="wf-block-header-content">
<div class="wf-block-title">
<strong><?php esc_html_e('Live Traffic Options', 'wordfence'); ?></strong>
</div>
<?php if ($collapseable): ?><div class="wf-block-header-action"><div class="wf-block-header-action-disclosure" role="checkbox" aria-checked="<?php echo (wfPersistenceController::shared()->isActive($stateKey) ? 'true' : 'false'); ?>" tabindex="0"></div></div><?php endif; ?>
</div>
</div>
<div class="wf-block-content wf-clearfix">
<?php if ($showControls): ?>
<p>
<?php echo wp_kses(__('These options let you choose which traffic to log and to ignore certain types of visitors, based on their level of access, usernames, IP address, or browser type. If you run a high-traffic website where it is not feasible to see your visitors in real-time, simply change the <strong>Traffic logging mode</strong> to "Security Only."', 'wordfence'), array('strong'=>array())); ?>
</p>
<div class="wf-row">
<div class="wf-col-xs-12">
<?php
echo wfView::create('options/block-controls', array(
'suppressLogo' => true,
'restoreDefaultsSection' => wfConfig::OPTIONS_TYPE_LIVE_TRAFFIC,
'restoreDefaultsMessage' => __('Are you sure you want to restore the default Live Traffic settings? This will undo any custom changes you have made to the options on this page.', 'wordfence'),
))->render();
?>
</div>
</div>
<?php endif; ?>
<ul class="wf-block-list">
<li>
<?php
echo wfView::create('options/option-switch', array(
'optionName' => 'liveTrafficEnabled',
'value' => wfConfig::get('liveTrafficEnabled') ? '1': '0',
'title' => __('Traffic logging mode', 'wordfence'),
'states' => array(
array('value' => '0', 'label' => __('Security Only', 'wordfence')),
array('value' => '1', 'label' => __('All Traffic', 'wordfence')),
),
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_TOOLS_LIVE_TRAFFIC_OPTION_ENABLE),
'alignment' => 'wf-right',
))->render();
?>
</li>
<li>
<?php
echo wfView::create('options/option-toggled', array(
'optionName' => 'liveTraf_ignorePublishers',
'enabledValue' => 1,
'disabledValue' => 0,
'value' => wfConfig::get('liveTraf_ignorePublishers') ? 1 : 0,
'title' => __("Don't log signed-in users with publishing access", 'wordfence'),
))->render();
?>
</li>
<li>
<?php
echo wfView::create('options/option-text', array(
'textOptionName' => 'liveTraf_ignoreUsers',
'textValue' => wfConfig::get('liveTraf_ignoreUsers'),
'title' => __('List of comma separated usernames to ignore', 'wordfence'),
))->render();
?>
</li>
<li>
<?php
echo wfView::create('options/option-text', array(
'textOptionName' => 'liveTraf_ignoreIPs',
'textValue' => wfConfig::get('liveTraf_ignoreIPs'),
'title' => __('List of comma separated IP addresses to ignore', 'wordfence'),
))->render();
?>
</li>
<li>
<?php
echo wfView::create('options/option-text', array(
'textOptionName' => 'liveTraf_ignoreUA',
'textValue' => wfConfig::get('liveTraf_ignoreUA'),
'title' => __('Browser user-agent to ignore', 'wordfence'),
))->render();
?>
</li>
<li>
<?php
echo wfView::create('options/option-text', array(
'textOptionName' => 'liveTraf_maxRows',
'textValue' => wfConfig::get('liveTraf_maxRows'),
'title' => __('Amount of Live Traffic data to store (number of rows)', 'wordfence'),
))->render();
?>
</li>
<li>
<?php
echo wfView::create('options/option-text', array(
'textOptionName' => 'liveTraf_maxAge',
'textValue' => wfConfig::get('liveTraf_maxAge'),
'title' => __('Maximum days to keep Live Traffic data (1-30 days)', 'wordfence'),
))->render();
?>
</li>
<?php if (!$hideShowMenuItem): ?>
<li>
<?php
echo wfView::create('options/option-toggled', array(
'optionName' => 'displayTopLevelLiveTraffic',
'enabledValue' => 1,
'disabledValue' => 0,
'value' => wfConfig::get('displayTopLevelLiveTraffic') ? 1 : 0,
'title' => __('Display Live Traffic menu option', 'wordfence'),
))->render();
?>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
</div>