Location: PHPKode > scripts > WP SlimStat > wp-slimstat/admin/options/panel3.php
<?php
// Avoid direct access to this piece of code
if (!function_exists('add_action')) exit(0);

$options_on_this_page = array(
	'track_users' => array('description' => __('Track users','wp-slimstat-options'), 'type' => 'yesno', 'long_description' => __('Select YES if you want to track logged in users.','wp-slimstat-options')),
	'ignore_spammers' => array('description' => __('Ignore Spammers','wp-slimstat-options'), 'type' => 'yesno', 'long_description' => __("Enable this option if you don't want to track visits from users identified as spammers by a third-party tool (i.e. Akismet). Visits from people whose comments are later marked as spam by you, will also be removed from the database.",'wp-slimstat-options')),
	'anonymize_ip' => array('description' => __('Anonymize IP Addresses','wp-slimstat-options'), 'type' => 'yesno', 'long_description' => __("This option masks the last octet of your visitors' IP addresses to comply with European Privacy Laws.",'wp-slimstat-options')),
	'ignore_prefetch' => array('description' => __('Filter Prefetch','wp-slimstat-options'), 'type' => 'yesno', 'long_description' => __("Enable this filter if you want to prevent WP SlimStat from tracking pageviews generated by Firefox's <a href='https://developer.mozilla.org/en/Link_prefetching_FAQ' target='_blank'>Link Prefetching functionality</a>.",'wp-slimstat-options')),
	'ignore_ip' => array('description' => __('IP Addresses','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("List all the IP addresses you don't want to track, separated by commas. Each network <strong>must</strong> be defined using the <a href='http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing' target='_blank'>CIDR notation</a> (i.e. <em>192.168.0.0/24</em>). If the format is incorrect, WP SlimStat may not track pageviews properly.",'wp-slimstat-options')),
	'ignore_resources' => array('description' => __('Resources','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("List all the URLs you don't want to track, separated by commas. Don't include the domain name: <em>/about, ?p=1</em>, etc. Wildcards: <code>*</code> means 'any string, including the empty string', <code>!</code> means 'any character'. For example, <code>/abou*</code> will match /about and /abound, <code>/abo*t</code> will match /aboundant and /about, <code>/abo!t</code> will match /about and /abort. Strings are case-insensitive.",'wp-slimstat-options')),
	'ignore_countries' => array('description' => __('Countries','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("List all the Country codes (i.e.: <code>en-us, it, es</code>) that you don't want to track, separated by commas.",'wp-slimstat-options')),
	'ignore_browsers' => array('description' => __('User Agents','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("Enter a list of browsers (user agents) you don't want to track, separated by commas. You can specify the browser's version adding a slash after the name  (i.e. <em>Firefox/3.6</em>). Wildcards: <code>*</code> means 'any string, including the empty string', <code>!</code> means 'any character'. For example, <code>Chr*</code> will match Chrome and Chromium, <code>IE/!.0</code> will match IE/7.0 and IE/8.0. Strings are case-insensitive.",'wp-slimstat-options')),
	'ignore_referers' => array('description' => __('Referring Sites','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("Enter a list of referring URL's you don't want to track, separated by commas: <code>mysite.com, /ignore-me-please</code>, etc. Wildcards: <code>*</code> means 'any string, including the empty string', <code>!</code> means 'any character'. Strings are case-insensitive.",'wp-slimstat-options')),
	
	'ignore_users' => array('description' => __('Users','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("Enter a list of Wordpress users you don't want to track, separated by commas. Please be aware that spaces are <em>not</em> ignored and that usernames are case sensitive.",'wp-slimstat-options'), 'skip_update' => true),
	'ignore_referers' => array('description' => __('Users by Capability','wp-slimstat-options'), 'type' => 'textarea', 'long_description' => __("Users having at least one of the <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_new'>capabilities</a> listed here below will not be tracked. Capabilities are case-insensitive.",'wp-slimstat-options'), 'skip_update' => true)
);

// Some options need a special treatment
if (isset($_POST['options'])){
	if (!empty($_POST['options']['ignore_users'])){
		// Make sure all the users exist in the system 
		$user_array = wp_slimstat::string_to_array($_POST['options']['ignore_users']);
		$sql_user_list = "'".implode("','", $user_array)."'";
		if ($GLOBALS['wpdb']->get_var("SELECT COUNT(*) FROM {$GLOBALS['wpdb']->users} WHERE user_login IN ($sql_user_list)") == count($user_array)){
			if (!wp_slimstat_admin::update_option('ignore_users', $_POST['options']['ignore_users'], 'textarea')) wp_slimstat_admin::$faulty_fields[] = __('Ignore users','wp-slimstat-options');
		}
		else{
			wp_slimstat_admin::$faulty_fields[] = __('Ignore users (username not found)','wp-slimstat-options');
		}
	}
	else{
		wp_slimstat_admin::update_option('ignore_users', '', 'text');
	}

	if (!empty($_POST['options']['ignore_capabilities'])){
		// Make sure all the capabilities exist in the system 
		$capability_array = wp_slimstat::string_to_array($_POST['options']['ignore_capabilities']);
		$capability_not_found = false;
		foreach(wp_slimstat::string_to_array($_POST['options']['ignore_capabilities']) as $a_capability){
			if (isset($GLOBALS['wp_roles']->role_objects['administrator']->capabilities) && !array_key_exists($a_capability, $GLOBALS['wp_roles']->role_objects['administrator']->capabilities)){
				$capability_not_found = true;
				break;
			}
		}
		
		if (!$capability_not_found){		
			if (!wp_slimstat_admin::update_option('ignore_capabilities', $_POST['options']['ignore_capabilities'], 'text')) wp_slimstat_admin::$faulty_fields[] = __('Users by capability','wp-slimstat-options');
		}
		else{
			wp_slimstat_admin::$faulty_fields[] = __('Invalid capability. Please check <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_new">this page</a> for more information','wp-slimstat-options');
		}
	}
	else{
		wp_slimstat_admin::update_option('ignore_capabilities', '', 'text');
	}
}
Return current item: WP SlimStat