Skip to content

Commit

Permalink
Fix phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Mar 10, 2024
1 parent 47cdbad commit 4739941
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/class-admin.php
Expand Up @@ -206,7 +206,9 @@ public function save_settings(): void
check_admin_referer('koko_analytics_save_settings');
$new_settings = $_POST['koko_analytics_settings'];
$settings = get_settings();
$settings['exclude_ip_addresses'] = array_filter(array_map('trim', explode(PHP_EOL, str_replace(',', PHP_EOL, strip_tags($new_settings['exclude_ip_addresses'])))), function($value) { return $value !== ''; });
$settings['exclude_ip_addresses'] = array_filter(array_map('trim', explode(PHP_EOL, str_replace(',', PHP_EOL, strip_tags($new_settings['exclude_ip_addresses'])))), function ($value) {
return $value !== '';
});
$settings['exclude_user_roles'] = $new_settings['exclude_user_roles'] ?? array();
$settings['prune_data_after_months'] = abs((int) $new_settings['prune_data_after_months']);
$settings['use_cookie'] = (int) $new_settings['use_cookie'];
Expand Down
8 changes: 5 additions & 3 deletions src/views/settings-page.php
Expand Up @@ -49,9 +49,11 @@

<div class="ka-margin-m">
<label for="ka-exclude-ip-addresses" class="ka-settings--label"><?php esc_html_e('Exclude pageviews from these IP addresses', 'koko-analytics'); ?></label>
<textarea id="ka-exclude-ip-addresses" name="koko_analytics_settings[exclude_ip_addresses]" class="widefat" rows="6"><?php foreach($settings['exclude_ip_addresses'] as $ip) {
echo esc_html($ip) . PHP_EOL;
} ?></textarea>
<?php
echo '<textarea id="ka-exclude-ip-addresses" name="koko_analytics_settings[exclude_ip_addresses]" class="widefat" rows="6">';
echo join(PHP_EOL, $settings['exclude_ip_addresses']);
echo '</textarea>';
?>
<p class="description">
<?php esc_html_e('Visits and pageviews from any of these IP addresses will be ignored.', 'koko-analytics'); ?>
<?php echo ' '; ?>
Expand Down

0 comments on commit 4739941

Please sign in to comment.