Sync plugins from current page

Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
2019-09-11 19:08:46 +02:00
parent 85d41e4216
commit 8515ff9587
1847 changed files with 505469 additions and 0 deletions

View File

@@ -0,0 +1,163 @@
<table class="form-table">
<tbody>
<tr valign="top">
<td scope="row" align="center">
<img src="<?php echo plugins_url( 'wp-statistics/assets/images/logo-250.png' ); ?>"></td>
</tr>
<tr valign="top">
<td scope="row" align="center">
<h2><?php echo sprintf( __( 'WP Statistics V%s', 'wp-statistics' ), WP_Statistics::$reg['version'] ); ?></h2>
</td>
</tr>
<tr valign="top">
<td scope="row" align="center">
<?php echo sprintf(
__( 'This product includes GeoLite2 data created by %s.', 'wp-statistics' ),
'<a href="http://www.maxmind.com" target=_blank>MaxMind</a>'
); ?>
</td>
</tr>
<tr valign="top">
<td scope="row" align="center">
<hr/>
</td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><h2><?php _e( 'Donate', 'wp-statistics' ); ?></h2></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php echo sprintf(
__(
'Feel like showing us how much you enjoy WP Statistics? Drop by our %sdonation%s page and show us some love!',
'wp-statistics'
),
'<a href="http://wp-statistics.com/donate" target="_blank">',
'</a>'
); ?></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><h2><?php _e( 'Visit Us Online', 'wp-statistics' ); ?></h2></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php echo sprintf(
__(
'Come visit our great new %swebsite%s and keep up to date on the latest news about WP Statistics.',
'wp-statistics'
),
'<a href="http://wp-statistics.com" target="_blank">',
'</a>'
); ?></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><h2><?php _e( 'Rate and Review at WordPress.org', 'wp-statistics' ); ?></h2></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php printf(
__(
'Thanks for installing WP Statistics, we encourage you to submit a %srating and review%s over at WordPress.org. Your feedback is greatly appreciated!',
'wp-statistics'
),
'<a href="https://wordpress.org/support/plugin/wp-statistics/reviews/?rate=5#new-post" target="_blank">',
'</a>'
); ?>
</td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><h2><?php _e( 'Translations', 'wp-statistics' ); ?></h2></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php echo sprintf(
__(
'WP Statistics supports internationalization. Please visit %sWP Statistics translations page%s to help translation.',
'wp-statistics'
),
'<a href="https://wp-statistics.com/translations/" target="_blank">',
'</a>'
); ?></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><h2><?php _e( 'Support', 'wp-statistics' ); ?></h2></td>
</tr>
<tr valign="top">
<td scope="row" colspan="2">
<p><?php _e(
"We're sorry you're having problem with WP Statistics and we're happy to help out. Here are a few things to do before contacting us:",
'wp-statistics'
); ?></p>
<ul style="list-style-type: disc; list-style-position: inside; padding-left: 25px;">
<li><?php echo sprintf(
__( 'Have you read the %sFAQs%s?', 'wp-statistics' ),
'<a title="' .
__( 'FAQs', 'wp-statistics' ) .
'" href="http://wp-statistics.com/category/faq/" target="_blank">',
'</a>'
); ?></li>
<li><?php echo sprintf(
__( 'Have you read the %sdocumentation%s?', 'wp-statistics' ),
'<a title="' .
__( 'Documentation', 'wp-statistics' ) .
'" href="http://wp-statistics.com/category/documentation/">',
'</a>'
); ?></li>
<li><?php echo sprintf(
__( 'Have you search the %ssupport forum%s for a similar issue?', 'wp-statistics' ),
'<a href="http://wordpress.org/support/plugin/wp-statistics" target="_blank">',
'</a>'
); ?></li>
<li><?php _e(
'Have you search the Internet for any error messages you are receiving?',
'wp-statistics'
); ?></li>
<li><?php _e( 'Make sure you have access to your PHP error logs.', 'wp-statistics' ); ?></li>
</ul>
<p><?php _e( 'And a few things to double-check:', 'wp-statistics' ); ?></p>
<ul style="list-style-type: disc; list-style-position: inside; padding-left: 25px;">
<li><?php _e( 'How\'s your memory_limit in php.ini?', 'wp-statistics' ); ?></li>
<li><?php _e(
'Have you tried disabling any other plugins you may have installed?',
'wp-statistics'
); ?></li>
<li><?php _e( 'Have you tried using the default WordPress theme?', 'wp-statistics' ); ?></li>
<li><?php _e( 'Have you double checked the plugin settings?', 'wp-statistics' ); ?></li>
<li><?php _e( 'Do you have all the required PHP extensions installed?', 'wp-statistics' ); ?></li>
<li><?php echo __(
'Are you getting a blank or incomplete page displayed in your browser?',
'wp-statistics'
) .
' ' .
__(
'Did you view the source for the page and check for any fatal errors?',
'wp-statistics'
); ?></li>
<li><?php _e( 'Have you checked your PHP and web server error logs?', 'wp-statistics' ); ?></li>
</ul>
<p><?php _e( 'Still not having any luck?', 'wp-statistics' ); ?><?php echo sprintf(
__(
'Then please open a new thread on the %sWordPress.org support forum%s and we\'ll respond as soon as possible.',
'wp-statistics'
),
'<a href="http://wordpress.org/support/plugin/wp-statistics" target="_blank">',
'</a>'
); ?></p>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,94 @@
<?php
//Get List Roles Wordpress
global $wp_roles;
$role_list = $wp_roles->get_names();
//Save Option Access
if ( $wps_nonce_valid ) {
$wps_option_list = array_merge( $wps_option_list, array( 'wps_read_capability', 'wps_manage_capability' ) );
foreach ( $wps_option_list as $option ) {
$new_option = str_replace( "wps_", "", $option );
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Access Levels', 'wp-statistics' ); ?></h3></th>
</tr>
<?php
//Get List Of Capability
foreach ( $wp_roles->roles as $role ) {
$cap_list = $role['capabilities'];
foreach ( $cap_list as $key => $cap ) {
//remove level_ from List
if ( substr( $key, 0, 6 ) != 'level_' ) {
$all_caps[ $key ] = 1;
}
}
}
ksort( $all_caps );
$read_cap = $WP_Statistics->get_option( 'read_capability', 'manage_options' );
$option_list = '';
foreach ( $all_caps as $key => $cap ) {
if ( $key == $read_cap ) {
$selected = " SELECTED";
} else {
$selected = "";
}
$option_list .= "<option value='{$key}'{$selected}>{$key}</option>";
}
?>
<tr valign="top">
<th scope="row">
<label for="wps_read_capability"><?php _e( 'Required user level to view WP Statistics:', 'wp-statistics' ) ?></label>
</th>
<td>
<select dir="ltr" id="wps_read_capability" name="wps_read_capability"><?php echo $option_list; ?></select>
</td>
</tr>
<?php
$manage_cap = $WP_Statistics->get_option( 'manage_capability', 'manage_options' );
foreach ( $all_caps as $key => $cap ) {
if ( $key == $manage_cap ) {
$selected = " SELECTED";
} else {
$selected = "";
}
$option_list .= "<option value='{$key}'{$selected}>{$key}</option>";
}
?>
<tr valign="top">
<th scope="row">
<label for="wps_manage_capability"><?php _e( 'Required user level to manage WP Statistics:', 'wp-statistics' ) ?></label>
</th>
<td>
<select dir="ltr" id="wps_manage_capability" name="wps_manage_capability"><?php echo $option_list; ?></select>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2">
<p class="description"><?php echo sprintf( __( 'See the %sWordPress Roles and Capabilities page%s for details on capability levels.', 'wp-statistics' ), '<a target=_blank href="http://codex.wordpress.org/Roles_and_Capabilities">', '</a>' ); ?></p>
<p class="description"><?php echo __( 'Hint: manage_network = Super Admin Network, manage_options = Administrator, edit_others_posts = Editor, publish_posts = Author, edit_posts = Contributor, read = Everyone.', 'wp-statistics' ); ?></p>
<p class="description"><?php echo __( 'Each of the above cascades the rights upwards in the default WordPress configuration. So for example selecting publish_posts grants the right to Authors, Editors, Admins and Super Admins.', 'wp-statistics' ); ?></p>
<p class="description"><?php echo sprintf( __( 'If you need a more robust solution to delegate access you might want to look at %s in the WordPress plugin directory.', 'wp-statistics' ), '<a href="http://wordpress.org/plugins/capability-manager-enhanced/" target=_blank>Capability Manager Enhanced</a>' ); ?></p>
</th>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,466 @@
<?php
global $wp_roles;
$role_list = $wp_roles->get_names();
if ( $wps_nonce_valid ) {
foreach ( $role_list as $role ) {
$role_post = 'wps_exclude_' . str_replace( " ", "_", strtolower( $role ) );
if ( array_key_exists( $role_post, $_POST ) ) {
$value = $_POST[ $role_post ];
} else {
$value = '';
}
$new_option = str_replace( "wps_", "", $role_post );
$WP_Statistics->store_option( $new_option, $value );
}
if ( array_key_exists( 'wps_create_honeypot', $_POST ) ) {
$my_post = array(
'post_type' => 'page',
'post_title' => __( 'WP Statistics Honey Pot Page', 'wp-statistics' ) .
' [' .
$WP_Statistics->Current_Date() .
']',
'post_content' => __( 'This is the Honey Pot for WP Statistics to use, do not delete.', 'wp-statistics' ),
'post_status' => 'publish',
'post_author' => 1,
);
$_POST['wps_honeypot_postid'] = wp_insert_post( $my_post );
}
$wps_option_list = array_merge(
$wps_option_list,
array(
'wps_record_exclusions',
'wps_robotlist',
'wps_exclude_ip',
'wps_exclude_loginpage',
'wps_exclude_adminpage',
'wps_force_robot_update',
'wps_excluded_countries',
'wps_included_countries',
'wps_excluded_hosts',
'wps_robot_threshold',
'wps_use_honeypot',
'wps_honeypot_postid',
'wps_exclude_feeds',
'wps_excluded_urls',
'wps_exclude_404s',
'wps_corrupt_browser_info',
'wps_exclude_ajax',
)
);
foreach ( $wps_option_list as $option ) {
$new_option = str_replace( "wps_", "", $option );
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Exclusions', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row"><label for="wps-exclusions"><?php _e( 'Record exclusions:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="wps-exclusions" type="checkbox" value="1"
name="wps_record_exclusions" <?php echo $WP_Statistics->get_option( 'record_exclusions' ) == true
? "checked='checked'" : ''; ?>><label for="wps-exclusions"><?php _e(
'Enable',
'wp-statistics'
); ?></label>
<p class="description"><?php echo __(
'This will record all the excluded hits in a separate table with the reasons why it was excluded but no other information.',
'wp-statistics'
) . ' ' . __(
'This will generate a lot of data but is useful if you want to see the total number of hits your site gets, not just actual user visits.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Exclude User Roles', 'wp-statistics' ); ?></h3></th>
</tr>
<?php
$role_option_list = '';
foreach ( $role_list as $role ) {
$store_name = 'exclude_' . str_replace( " ", "_", strtolower( $role ) );
$option_name = 'wps_' . $store_name;
$role_option_list .= $option_name . ',';
$translated_role_name = translate_user_role( $role );
?>
<tr valign="top">
<th scope="row"><label for="<?php echo $option_name; ?>"><?php echo $translated_role_name; ?>:</label>
</th>
<td>
<input id="<?php echo $option_name; ?>" type="checkbox" value="1"
name="<?php echo $option_name; ?>" <?php echo $WP_Statistics->get_option( $store_name ) == true
? "checked='checked'" : ''; ?>><label for="<?php echo $option_name; ?>"><?php _e(
'Exclude',
'wp-statistics'
); ?></label>
<p class="description"><?php echo sprintf(
__( 'Exclude %s role from data collection.', 'wp-statistics' ),
$translated_role_name
); ?></p>
</td>
</tr>
<?php } ?>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'IP/Robot Exclusions', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Robot list:', 'wp-statistics' ); ?></th>
<td>
<textarea name="wps_robotlist" class="code" dir="ltr" rows="10" cols="60" id="wps_robotlist"><?php
$robotlist = $WP_Statistics->get_option( 'robotlist' );
if ( ! isset( $wps_robotarray ) ) {
include( WP_Statistics::$reg['plugin-dir'] . 'includes/robotslist.php' );
}
if ( $robotlist == '' ) {
$robotlist = implode( "\n", $wps_robotarray );
update_option( 'wps_robotlist', $robotlist );
}
echo htmlentities( $robotlist, ENT_QUOTES ); ?></textarea>
<p class="description"><?php echo __(
'A list of words (one per line) to match against to detect robots. Entries must be at least 4 characters long or they will be ignored.',
'wp-statistics'
); ?></p>
<a onclick="var wps_robotlist = getElementById('wps_robotlist'); wps_robotlist.value = '<?php echo implode(
'\n',
$wps_robotarray
); ?>';" class="button"><?php _e( 'Reset to Default', 'wp-statistics' ); ?></a>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="force_robot_update"><?php _e( 'Force robot list update after upgrades:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="force_robot_update" type="checkbox" value="1"
name="wps_force_robot_update" <?php echo $WP_Statistics->get_option( 'force_robot_update' ) == true
? "checked='checked'" : ''; ?>><label for="force_robot_update"><?php _e(
'Enable',
'wp-statistics'
); ?></label>
<p class="description"><?php echo sprintf(
__(
'Force the robot list to be reset to the default after an update to WP Statistics takes place. Note if this option is enabled any custom robots you have added to the list will be lost.',
'wp-statistics'
),
$role
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="wps_robot_threshold"><?php _e( 'Robot visit threshold:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="wps_robot_threshold" type="text" size="5" name="wps_robot_threshold"
value="<?php echo $WP_Statistics->get_option( 'robot_threshold' ); ?>">
<p class="description"><?php echo __(
'Treat visitors with more than this number of visits per day as robots. 0 = disabled.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded IP address list:', 'wp-statistics' ); ?></th>
<td>
<textarea id="wps_exclude_ip" name="wps_exclude_ip" rows="5" cols="60" class="code"
dir="ltr"><?php echo htmlentities(
$WP_Statistics->get_option( 'exclude_ip' ),
ENT_QUOTES
); ?></textarea>
<p class="description"><?php echo __(
'A list of IP addresses and subnet masks (one per line) to exclude from statistics collection.',
'wp-statistics'
); ?></p>
<p class="description"><?php echo __(
'For IPv4 addresses, both 192.168.0.0/24 and 192.168.0.0/255.255.255.0 formats are accepted. To specify an IP address only, use a subnet value of 32 or 255.255.255.255.',
'wp-statistics'
); ?></p>
<p class="description"><?php echo __(
'For IPv6 addresses use the fc00::/7 format.',
'wp-statistics'
); ?></p>
<a onclick="var wps_exclude_ip = getElementById('wps_exclude_ip'); if( wps_exclude_ip != null ) { wps_exclude_ip.value = jQuery.trim( wps_exclude_ip.value + '\n10.0.0.0/8' ); }"
class="button"><?php _e( 'Add 10.0.0.0', 'wp-statistics' ); ?></a>
<a onclick="var wps_exclude_ip = getElementById('wps_exclude_ip'); if( wps_exclude_ip != null ) { wps_exclude_ip.value = jQuery.trim( wps_exclude_ip.value + '\n172.16.0.0/12' ); }"
class="button"><?php _e( 'Add 172.16.0.0', 'wp-statistics' ); ?></a>
<a onclick="var wps_exclude_ip = getElementById('wps_exclude_ip'); if( wps_exclude_ip != null ) { wps_exclude_ip.value = jQuery.trim( wps_exclude_ip.value + '\n192.168.0.0/16' ); }"
class="button"><?php _e( 'Add 192.168.0.0', 'wp-statistics' ); ?></a>
<a onclick="var wps_exclude_ip = getElementById('wps_exclude_ip'); if( wps_exclude_ip != null ) { wps_exclude_ip.value = jQuery.trim( wps_exclude_ip.value + '\nfc00::/7' ); }"
class="button"><?php _e( 'Add fc00::/7', 'wp-statistics' ); ?></a>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Use Honey Pot:', 'wp-statistics' ); ?></th>
<td>
<input id="use_honeypot" type="checkbox" value="1"
name="wps_use_honeypot" <?php echo $WP_Statistics->get_option( 'use_honeypot' ) == true
? "checked='checked'" : ''; ?>><label for="wps_use_honeypot"><?php _e(
'Enable',
'wp-statistics'
); ?></label>
<p class="description"><?php echo __(
'Use a Honey Pot page to identify robots.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="honeypot_postid"><?php _e( 'Honey Pot post ID', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="honeypot_postid" type="text"
value="<?php echo htmlentities( $WP_Statistics->get_option( 'honeypot_postid' ), ENT_QUOTES ); ?>"
size="5" name="wps_honeypot_postid">
<p class="description"><?php echo __(
'The post ID to use for the Honey Pot page.',
'wp-statistics'
); ?></p>
<input id="wps_create_honeypot" type="checkbox" value="1" name="wps_create_honeypot"><label
for="wps_create_honeypot"><?php _e( 'Create a new Honey Pot page', 'wp-statistics' ); ?></label>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="corrupt_browser_info"><?php _e( 'Treat corrupt browser info as a bot:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="corrupt_browser_info" type="checkbox" value="1"
name="wps_corrupt_browser_info" <?php echo $WP_Statistics->get_option( 'corrupt_browser_info' ) ==
true ? "checked='checked'" : ''; ?>><label
for="wps_corrupt_browser_info"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php echo __(
'Treat any visitor with corrupt browser info (missing IP address or empty user agent string) as a robot.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'GeoIP Exclusions', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded countries list:', 'wp-statistics' ); ?></th>
<td>
<textarea id="wps_excluded_countries" name="wps_excluded_countries" rows="5" cols="10" class="code"
dir="ltr"><?php echo htmlentities(
$WP_Statistics->get_option( 'excluded_countries' ),
ENT_QUOTES
); ?></textarea>
<p class="description"><?php echo __(
'A list of country codes (one per line, two letters each) to exclude from statistics collection.',
'wp-statistics'
) . ' ' . __(
'Use "000" (three zeros) to exclude unknown countries.',
'wp-statistics'
).' '.sprintf(__( '(%1$sISO 3166 Country Codes%2$s)', 'wp-statistics' ), '<a href="' . esc_url( 'https://dev.maxmind.com/geoip/legacy/codes/iso3166/' ) . '" target="_blank">','</a>' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Included countries list:', 'wp-statistics' ); ?></th>
<td>
<textarea id="wps_included_countries" name="wps_included_countries" rows="5" cols="10" class="code"
dir="ltr"><?php echo htmlentities(
$WP_Statistics->get_option( 'included_countries' ),
ENT_QUOTES
); ?></textarea>
<p class="description"><?php echo __(
'A list of country codes (one per line, two letters each) to include in statistics collection, if this list is not empty, only visitors from the included countries will be recorded',
'wp-statistics'
) . ' ' . __(
'Use "000" (three zeros) to exclude unknown countries.',
'wp-statistics'
).' '.sprintf(__( '(%1$sISO 3166 Country Codes%2$s)', 'wp-statistics' ), '<a href="' . esc_url( 'https://dev.maxmind.com/geoip/legacy/codes/iso3166/' ) . '" target="_blank">','</a>' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Host Exclusions', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded hosts list:', 'wp-statistics' ); ?></th>
<td>
<textarea id="wps_excluded_hosts" name="wps_excluded_hosts" rows="5" cols="80" class="code"
dir="ltr"><?php echo htmlentities(
$WP_Statistics->get_option( 'excluded_hosts' ),
ENT_QUOTES
); ?></textarea>
<p class="description"><?php echo __(
'A list of fully qualified host names (ie. server.example.com, one per line) to exclude from statistics collection.',
'wp-statistics'
); ?></p>
<br>
<p class="description"><?php echo __(
'Note: this option will NOT perform a reverse DNS lookup on each page load but instead cache the IP address for the provided hostnames for one hour. If you are excluding dynamically assigned hosts you may find some degree of overlap when the host changes it\'s IP address and when the cache is updated resulting in some hits recorded.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Site URL Exclusions', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded login page:', 'wp-statistics' ); ?></th>
<td>
<input id="wps-exclude-loginpage" type="checkbox" value="1"
name="wps_exclude_loginpage" <?php echo $WP_Statistics->get_option( 'exclude_loginpage' ) == true
? "checked='checked'" : ''; ?>><label for="wps-exclude-loginpage"><?php _e(
'Exclude',
'wp-statistics'
); ?></label>
<p class="description"><?php _e(
'Exclude the login page for registering as a hit.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded Admin page:', 'wp-statistics' ); ?></th>
<td>
<input id="wps-exclude-adminpage" type="checkbox" value="1"
name="wps_exclude_adminpage" <?php echo $WP_Statistics->get_option( 'exclude_adminpage' ) == true
? "checked='checked'" : ''; ?>><label for="wps-exclude-adminpage"><?php _e(
'Exclude',
'wp-statistics'
); ?></label>
<p class="description"><?php _e(
'Exclude any call to the WordPress Admin pages.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded RSS feeds:', 'wp-statistics' ); ?></th>
<td>
<input id="wps-exclude-feeds" type="checkbox" value="1"
name="wps_exclude_feeds" <?php echo $WP_Statistics->get_option( 'exclude_feeds' ) == true
? "checked='checked'" : ''; ?>><label for="wps-exclude-feeds"><?php _e(
'Exclude',
'wp-statistics'
); ?></label>
<p class="description"><?php _e(
'Exclude the RSS feeds for registering as a hit.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded 404 pages:', 'wp-statistics' ); ?></th>
<td>
<input id="wps-exclude-404s" type="checkbox" value="1"
name="wps_exclude_404s" <?php echo $WP_Statistics->get_option( 'exclude_404s' ) == true
? "checked='checked'" : ''; ?>><label for="wps-exclude-404s"><?php _e(
'Exclude',
'wp-statistics'
); ?></label>
<p class="description"><?php _e(
'Exclude any URL that returns a "404 - Not Found" message.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded AJAX calls:', 'wp-statistics' ); ?></th>
<td>
<input id="wps-exclude-ajax" type="checkbox" value="1"
name="wps_exclude_ajax" <?php echo $WP_Statistics->get_option( 'exclude_ajax' ) == true
? "checked='checked'" : ''; ?>><label for="wps-exclude-ajax"><?php _e(
'Exclude',
'wp-statistics'
); ?></label>
<p class="description"><?php _e(
'Exclude any call to the WordPress AJAX system.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e( 'Excluded URLs list:', 'wp-statistics' ); ?></th>
<td>
<textarea id="wps_excluded_urls" name="wps_excluded_urls" rows="5" cols="80" class="code"
dir="ltr"><?php echo htmlentities(
$WP_Statistics->get_option( 'excluded_urls' ),
ENT_QUOTES
); ?></textarea>
<p class="description"><?php echo __(
'A list of local urls (ie. /wordpress/about, one per line) to exclude from statistics collection.',
'wp-statistics'
); ?></p>
<br>
<p class="description"><?php echo __(
'Note: this option will NOT handle URL parameters (anything after the ?), only to the script name. Entries less than two characters will be ignored.',
'wp-statistics'
); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,315 @@
<?php
if ( $wps_nonce_valid ) {
$wps_option_list = array(
'wps_geoip',
'wps_update_geoip',
'wps_schedule_geoip',
'wps_geoip_city',
'wps_auto_pop',
'wps_private_country_code',
'wps_referrerspam',
'wps_schedule_referrerspam'
);
// For country codes we always use upper case, otherwise default to 000 which is 'unknown'.
if ( array_key_exists( 'wps_private_country_code', $_POST ) ) {
$_POST['wps_private_country_code'] = trim( strtoupper( $_POST['wps_private_country_code'] ) );
} else {
$_POST['wps_private_country_code'] = '000';
}
if ( $_POST['wps_private_country_code'] == '' ) {
$_POST['wps_private_country_code'] = '000';
}
foreach ( $wps_option_list as $option ) {
$new_option = str_replace( "wps_", "", $option );
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'GeoIP settings', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row" colspan="2">
<?php echo sprintf(
__( 'IP location services are provided by data created by %s.', 'wp-statistics' ),
'<a href="http://www.maxmind.com" target=_blank>MaxMind</a>'
); ?>
</th>
</tr>
<?php
if ( wp_statistics_geoip_supported() ) {
?>
<tr valign="top">
<th scope="row">
<label for="geoip-enable"><?php _e( 'GeoIP collection:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="geoip-enable" type="checkbox" name="wps_geoip" <?php echo( $WP_Statistics->get_option( 'geoip' ) === 'on' ? "checked='checked'" : '' ); ?>>
<label for="geoip-enable">
<?php _e( 'Enable', 'wp-statistics' ); ?>
<form action="" method="post" style="display: inline;">
<input type="hidden" name="geoip_name" value="country">
<?php submit_button( __( "Update Database", 'wp-statistics' ), "secondary", "update_geoip", false ); ?>
</form>
</label>
<p class="description"><?php _e(
'For getting more information and location (country) from visitor, enable this feature.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="geoip-city"><?php _e( 'GeoIP City:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="geoip-city" type="checkbox" name="wps_geoip_city" <?php echo( $WP_Statistics->get_option( 'geoip_city' ) == 'on' ? "checked='checked'" : '' ); ?>>
<label for="geoip-city">
<?php _e( 'Enable', 'wp-statistics' ); ?>
<form action="" method="post" style="display: inline;">
<input type="hidden" name="geoip_name" value="city">
<?php submit_button( __( "Update Database", 'wp-statistics' ), "secondary", "update_geoip", false ); ?>
</form>
</label>
<p class="description"><?php _e(
'See Visitor\'s City Name',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="geoip-schedule"><?php _e( 'Schedule monthly update of GeoIP DB:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="geoip-schedule" type="checkbox" name="wps_schedule_geoip" <?php echo $WP_Statistics->get_option( 'schedule_geoip' ) == true ? "checked='checked'" : ''; ?>>
<label for="geoip-schedule"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<?php
if ( $WP_Statistics->get_option( 'schedule_geoip' ) ) {
echo '<p class="description">' . __( 'Next update will be', 'wp-statistics' ) . ': <code>';
$last_update = $WP_Statistics->get_option( 'last_geoip_dl' );
$this_month = strtotime( __( 'First Tuesday of this month', 'wp-statistics' ) );
if ( $last_update > $this_month ) {
$next_update = strtotime( __( 'First Tuesday of next month', 'wp-statistics' ) ) +
( 86400 * 2 );
} else {
$next_update = $this_month + ( 86400 * 2 );
}
$next_schedule = wp_next_scheduled( 'wp_statistics_geoip_hook' );
if ( $next_schedule ) {
echo $WP_Statistics->Local_Date( get_option( 'date_format' ), $next_update ) .
' @ ' .
$WP_Statistics->Local_Date( get_option( 'time_format' ), $next_schedule );
} else {
echo $WP_Statistics->Local_Date( get_option( 'date_format' ), $next_update ) .
' @ ' .
$WP_Statistics->Local_Date( get_option( 'time_format' ), time() );
}
echo '</code></p>';
}
?>
<p class="description"><?php _e(
'Download of the GeoIP database will be scheduled for 2 days after the first Tuesday of the month.',
'wp-statistics'
); ?></p>
<p class="description"><?php _e(
'This option will also download the database if the local filesize is less than 1k (which usually means the stub that comes with the plugin is still in place).',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="geoip-schedule"><?php _e(
'Populate missing GeoIP after update of GeoIP DB:',
'wp-statistics'
); ?></label>
</th>
<td>
<input id="geoip-auto-pop" type="checkbox" name="wps_auto_pop" <?php echo $WP_Statistics->get_option( 'auto_pop' ) == true
? "checked='checked'" : ''; ?>>
<label for="geoip-auto-pop"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Update any missing GeoIP data after downloading a new database.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="geoip-schedule"><?php _e( 'Country code for private IP addresses:', 'wp-statistics' ); ?></label>
</th>
<td>
<input type="text" size="3" id="geoip-private-country-code" name="wps_private_country_code" value="<?php echo htmlentities(
$WP_Statistics->get_option( 'private_country_code', '000' ),
ENT_QUOTES
); ?>">
<p class="description"><?php echo __(
'The international standard two letter country code (ie. US = United States, CA = Canada, etc.) for private (non-routable) IP addresses (ie. 10.0.0.1, 192.158.1.1, 127.0.0.1, etc.).',
'wp-statistics'
) . ' ' . __(
'Use "000" (three zeros) to use "Unknown" as the country code.',
'wp-statistics'
); ?></p>
</td>
</tr>
<?php
} else {
?>
<tr valign="top">
<th scope="row" colspan="2">
<?php
echo __( 'GeoIP collection is disabled due to the following reasons:', 'wp-statistics' ) . '<br><br>';
if ( ! function_exists( 'curl_init' ) ) {
echo '<br>&nbsp;&nbsp;&nbsp;&nbsp;* ';
_e(
'GeoIP collection requires the cURL PHP extension and it is not loaded on your version of PHP!',
'wp-statistics'
);
echo '<br>';
}
if ( ! function_exists( 'bcadd' ) ) {
echo '<br>&nbsp;&nbsp;&nbsp;&nbsp;* ';
_e(
'GeoIP collection requires the BC Math PHP extension and it is not loaded on your version of PHP!',
'wp-statistics'
);
echo '<br>';
}
if ( ini_get( 'safe_mode' ) ) {
echo '<br>&nbsp;&nbsp;&nbsp;&nbsp;* ';
_e(
'PHP safe mode detected! GeoIP collection is not supported with PHP\'s safe mode enabled!',
'wp-statistics'
);
echo '<br>';
}
?>
</th>
</tr>
<?php
} ?>
<tr valign="top">
<th scope="row" colspan="2">
<h3><?php _e( 'Matomo Referrer Spam Blacklist settings', 'wp-statistics' ); ?></h3>
</th>
</tr>
<tr valign="top">
<th scope="row" colspan="2">
<?php echo sprintf(
__( 'Referrer spam blacklist is provided by Matomo, available from %s.', 'wp-statistics' ),
'<a href="https://github.com/matomo-org/referrer-spam-blacklist" target=_blank>https://github.com/matomo-org/referrer-spam-blacklist</a>'
); ?>
</th>
</tr>
<tr valign="top">
<th scope="row">
<label for="referrerspam-enable"><?php _e( 'Matomo Referrer Spam Blacklist usage:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="referrerspam-enable" type="checkbox" name="wps_referrerspam" <?php echo $WP_Statistics->get_option( 'referrerspam' ) == true ? "checked='checked'" : ''; ?>>
<label for="referrerspam-enable"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'The Matomo Referrer Spam Blacklist database will be downloaded and used to detect referrer spam.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top" class="referrerspam_field"<?php if ( ! $WP_Statistics->get_option( 'referrerspam' ) ) { echo ' style="display:none;"'; } ?>>
<th scope="row">
<label for="geoip-update"><?php _e( 'Update Matomo Referrer Spam Blacklist Info:', 'wp-statistics' ); ?></label>
</th>
<td>
<a href = "<?php echo WP_Statistics_Admin_Pages::admin_url( 'settings', array( 'tab' => 'externals-settings', 'update-referrerspam' => 'yes' ) ) ?>" class="button"><?php _e( 'Update', 'wp-staitsitcs' ); ?></a>
<p class="description"><?php _e( 'Click button to download the update.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top" class="referrerspam_field"<?php if ( ! $WP_Statistics->get_option( 'referrerspam' ) ) { echo ' style="display:none;"'; } ?>>
<th scope="row">
<label for="referrerspam-schedule"><?php _e( 'Schedule weekly update of Matomo Referrer Spam Blacklist DB:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="referrerspam-schedule" type="checkbox" name="wps_schedule_referrerspam" <?php echo $WP_Statistics->get_option(
'schedule_referrerspam'
) == true ? "checked='checked'" : ''; ?>>
<label for="referrerspam-schedule"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<?php
if ( $WP_Statistics->get_option( 'schedule_referrerspam' ) ) {
echo '<p class="description">' . __( 'Next update will be', 'wp-statistics' ) . ': <code>';
$last_update = $WP_Statistics->get_option( 'schedule_referrerspam' );
if ( $last_update == 0 ) {
$last_update = time();
}
$next_update = $last_update + ( 86400 * 7 );
$next_schedule = wp_next_scheduled( 'wp_statistics_referrerspam_hook' );
if ( $next_schedule ) {
echo date( get_option( 'date_format' ), $next_schedule ) .
' @ ' .
date( get_option( 'time_format' ), $next_schedule );
} else {
echo date( get_option( 'date_format' ), $next_update ) .
' @ ' .
date( get_option( 'time_format' ), time() );
}
echo '</code></p>';
}
?>
<p class="description"><?php _e(
'Download of the Matomo Referrer Spam Blacklist database will be scheduled for once a week.',
'wp-statistics'
); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,450 @@
<?php
$selist = wp_statistics_searchengine_list( true );
$permalink = get_option( 'permalink_structure' );
$disable_strip_uri_parameters = false;
if ( $permalink == '' || strpos( $permalink, '?' ) !== false ) {
$disable_strip_uri_parameters = true;
}
if ( $wps_nonce_valid ) {
foreach ( $selist as $se ) {
$se_post = 'wps_disable_se_' . $se['tag'];
if ( array_key_exists( $se_post, $_POST ) ) {
$value = $_POST[ $se_post ];
} else {
$value = '';
}
$new_option = str_replace( "wps_", "", $se_post );
$WP_Statistics->store_option( $new_option, $value );
}
$wps_option_list = array(
'wps_useronline',
'wps_visits',
'wps_visitors',
'wps_visitors_log',
'wps_pages',
'wps_track_all_pages',
'wps_use_cache_plugin',
'wps_disable_column',
'wps_hit_post_metabox',
'wps_show_hits',
'wps_display_hits_position',
'wps_check_online',
'wps_menu_bar',
'wps_coefficient',
'wps_chart_totals',
'wps_hide_notices',
'wps_all_online',
'wps_strip_uri_parameters',
'wps_addsearchwords',
);
// We need to check the permalink format for the strip_uri_parameters option, if the permalink is the default or contains uri parameters, we can't strip them.
if ( $disable_strip_uri_parameters ) {
$_POST['wps_strip_uri_parameters'] = '';
}
foreach ( $wps_option_list as $option ) {
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$new_option = str_replace( "wps_", "", $option );
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<script type="text/javascript">
function ToggleShowHitsOptions() {
jQuery('[id^="wps_show_hits_option"]').fadeToggle();
}
</script>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Online Users', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="useronline"><?php _e( 'Online User:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="useronline" type="checkbox" value="1" name="wps_useronline" <?php echo $WP_Statistics->get_option( 'useronline' ) == true
? "checked='checked'" : ''; ?>>
<label for="useronline"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="check_online"><?php _e( 'Check for online users every:', 'wp-statistics' ); ?></label>
</th>
<td>
<input type="text" class="small-text code" id="check_online" name="wps_check_online" value="<?php echo htmlentities( $WP_Statistics->get_option( 'check_online' ), ENT_QUOTES ); ?>"/>
<?php _e( 'Seconds', 'wp-statistics' ); ?>
<p class="description"><?php echo sprintf(
__( 'Time for the check accurate online user in the site. Now: %s Seconds', 'wp-statistics' ),
$WP_Statistics->get_option( 'check_online' )
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="allonline"><?php _e( 'Record all user:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="allonline" type="checkbox" value="1" name="wps_all_online" <?php echo $WP_Statistics->get_option( 'all_online' ) == true
? "checked='checked'" : ''; ?>>
<label for="allonline"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Ignores the exclusion settings and records all users that are online (including self referrals and robots). Should only be used for troubleshooting.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Visits', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="visits"><?php _e( 'Visits:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="visits" type="checkbox" value="1" name="wps_visits" <?php echo $WP_Statistics->get_option( 'visits' ) == true ? "checked='checked'" : ''; ?>>
<label for="visits"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Visitors', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top" id="visitors_tr">
<th scope="row">
<label for="visitors"><?php _e( 'Visitors:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="visitors" type="checkbox" value="1" name="wps_visitors" <?php echo $WP_Statistics->get_option( 'visitors' ) == true ? "checked='checked'" : ''; ?>>
<label for="visitors"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top" id="visitors_log_tr" <?php echo( $WP_Statistics->get_option( 'visitors' ) == false ? 'style="display:none;"' : '' ) ?>>
<th scope="row">
<label for="visitors_log"><?php _e( 'Visitors logs:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="visitors_log" type="checkbox" value="1" name="wps_visitors_log" <?php echo $WP_Statistics->get_option( 'visitors_log' ) == true ? "checked='checked'" : ''; ?>>
<label for="visitors_log"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'If enabled, you will receive a report of each user\'s visit to the pages', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="coefficient"><?php _e( 'Coefficient per visitor:', 'wp-statistics' ); ?></label>
</th>
<td>
<input type="text" class="small-text code" id="coefficient" name="wps_coefficient" value="<?php echo htmlentities( $WP_Statistics->get_option( 'coefficient' ), ENT_QUOTES ); ?>"/>
<p class="description"><?php echo sprintf(
__( 'For each visit to account for several hits. Currently %s.', 'wp-statistics' ),
$WP_Statistics->get_option( 'coefficient' )
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Pages and Posts', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="pages"><?php _e( 'Pages:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="pages" type="checkbox" value="1" name="wps_pages" <?php echo $WP_Statistics->get_option( 'pages' ) == true ? "checked='checked'" : ''; ?>>
<label for="pages"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="all_pages"><?php _e( 'Track all pages:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="all_pages" type="checkbox" value="1" name="wps_track_all_pages" <?php echo $WP_Statistics->get_option( 'track_all_pages' ) == true ? "checked='checked'" : ''; ?>>
<label for="all_pages"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
<p class="description"><?php echo sprintf( __( 'Track All Wordpress Page Contains Category, Post Tags, Author, Custom Taxonomy and ...', 'wp-statistics' ), admin_url( 'options-permalink.php' ) ); ?></p>
</td>
</tr>
<?php
if ( ! $disable_strip_uri_parameters ) {
?>
<tr valign="top">
<th scope="row">
<label for="strip_uri_parameters"><?php _e( 'Strip parameters from URI:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="strip_uri_parameters" type="checkbox" value="1" name="wps_strip_uri_parameters" <?php echo $WP_Statistics->get_option( 'strip_uri_parameters' ) == true ? "checked='checked'" : ''; ?>>
<label for="strip_uri_parameters"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'This will remove anything after the ? in a URL.', 'wp-statistics' ); ?></p>
</td>
</tr>
<?php
}
?>
<tr valign="top">
<th scope="row">
<label for="disable_column"><?php _e( 'Hits column', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="disable_column" type="checkbox" value="1" name="wps_disable_column" <?php echo $WP_Statistics->get_option( 'disable_column' ) == true
? "checked='checked'" : ''; ?>>
<label for="disable_column"><?php _e( 'Disable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="hit_post_metabox"><?php _e( 'Hit metabox chart:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="hit_post_metabox" type="checkbox" value="1" name="wps_hit_post_metabox" <?php echo $WP_Statistics->get_option( 'hit_post_metabox' ) == true ? "checked='checked'" : ''; ?>>
<label for="hit_post_metabox"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Show hits meta box chart in the edit of all post types page.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="show_hits"><?php _e( 'Hits in single page:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="show_hits" type="checkbox" value="1" name="wps_show_hits" <?php echo $WP_Statistics->get_option( 'show_hits' ) == true
? "checked='checked'" : ''; ?> onClick='ToggleShowHitsOptions();'>
<label for="show_hits"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable show hits in content', 'wp-statistics' ); ?></p>
</td>
</tr>
<?php if ( $WP_Statistics->get_option( 'show_hits' ) ) {
$hidden = "";
} else {
$hidden = " style='display: none;'";
} ?>
<tr valign="top"<?php echo $hidden; ?> id='wps_show_hits_option'>
<td scope="row" style="vertical-align: top;">
<label for="display_hits_position"><?php _e( 'Display position:', 'wp-statistics' ); ?></label>
</td>
<td>
<select name="wps_display_hits_position" id="display_hits_position">
<option value="0" <?php selected( $WP_Statistics->get_option( 'display_hits_position' ), '0' ); ?>><?php _e(
'Please select',
'wp-statistics'
); ?></option>
<option value="before_content" <?php selected( $WP_Statistics->get_option( 'display_hits_position' ), 'before_content' ); ?>><?php _e(
'Before Content',
'wp-statistics'
); ?></option>
<option value="after_content" <?php selected( $WP_Statistics->get_option( 'display_hits_position' ), 'after_content' ); ?>><?php _e(
'After Content',
'wp-statistics'
); ?></option>
</select>
<p class="description"><?php _e(
'Choose the position to show Hits.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Cache Plugin', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="all_pages"><?php _e( 'Use Cache Plugin:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="use_cache_plugin" type="checkbox" value="1" name="wps_use_cache_plugin" <?php echo $WP_Statistics->get_option( 'use_cache_plugin' ) == true
? "checked='checked'" : ''; ?>>
<label for="use_cache_plugin"><?php _e( 'Yes', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'If you use WordPress Cache Plugins, enable this option.', 'wp-statistics' ); ?></p>
<p class="description"><?php echo sprintf( __( 'To register WP-Statistics REST API endpoint ( %s ) , go to the <a href="%s">Permalink page</a> and update the permalink with press Save Changes.', 'wp-statistics' ), WP_Statistics_Rest::route, admin_url( 'options-permalink.php' ) ); ?></p>
<p class="description"><?php echo __( 'Don\'t forget to clear your enabled plugin cache.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Miscellaneous', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="menu-bar"><?php _e( 'Show stats in menu bar:', 'wp-statistics' ); ?></label>
</th>
<td>
<select name="wps_menu_bar" id="menu-bar">
<option value="0" <?php selected( $WP_Statistics->get_option( 'menu_bar' ), '0' ); ?>><?php _e(
'No',
'wp-statistics'
); ?></option>
<option value="1" <?php selected( $WP_Statistics->get_option( 'menu_bar' ), '1' ); ?>><?php _e(
'Yes',
'wp-statistics'
); ?></option>
</select>
<p class="description"><?php _e( 'Show stats in admin menu bar', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="hide_notices"><?php _e( 'Hide admin notices about non active features:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="hide_notices" type="checkbox" value="1" name="wps_hide_notices" <?php echo $WP_Statistics->get_option( 'hide_notices' ) == true
? "checked='checked'" : ''; ?>>
<label for="hide_notices"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'By default WP Statistics displays an alert if any of the core features are disabled on every admin page, this option will disable these notices.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Search Engines', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="addsearchwords"><?php _e( 'Add page title to empty search words:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="addsearchwords" type="checkbox" value="1" name="wps_addsearchwords" <?php echo $WP_Statistics->get_option( 'addsearchwords' ) == true
? "checked='checked'" : ''; ?>>
<label for="addsearchwords"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'If a search engine is identified as the referrer but it does not include the search query this option will substitute the page title in quotes preceded by "~:" as the search query to help identify what the user may have been searching for.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2">
<p class="description"><?php _e(
'Disabling all search engines is not allowed, doing so will result in all search engines being active.',
'wp-statistics'
); ?></p>
</th>
</tr>
<?php
$se_option_list = '';
foreach ( $selist as $se ) {
$option_name = 'wps_disable_se_' . $se['tag'];
$store_name = 'disable_se_' . $se['tag'];
$se_option_list .= $option_name . ',';
?>
<tr valign="top">
<th scope="row">
<label for="<?php echo $option_name; ?>"><?php _e( $se['name'], 'wp-statistics' ); ?>:</label>
</th>
<td>
<input id="<?php echo $option_name; ?>" type="checkbox" value="1" name="<?php echo $option_name; ?>" <?php echo $WP_Statistics->get_option( $store_name ) == true
? "checked='checked'" : ''; ?>><label for="<?php echo $option_name; ?>"><?php _e(
'Disable',
'wp-statistics'
); ?></label>
<p class="description"><?php echo sprintf(
__( 'Disable %s from data collection and reporting.', 'wp-statistics' ),
$se['name']
); ?></p>
</td>
</tr>
<?php } ?>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Charts', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="chart-totals"><?php _e( 'Include totals:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="chart-totals" type="checkbox" value="1" name="wps_chart_totals" <?php echo $WP_Statistics->get_option( 'chart_totals' ) == true
? "checked='checked'" : ''; ?>>
<label for="chart-totals"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Add a total line to charts with multiple values, like the search engine referrals',
'wp-statistics'
); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,139 @@
<?php
if ( $wps_nonce_valid ) {
$wps_option_list = array(
'wps_schedule_dbmaint',
'wps_schedule_dbmaint_days',
'wps_schedule_dbmaint_visitor',
'wps_schedule_dbmaint_visitor_hits',
);
foreach ( $wps_option_list as $option ) {
$new_option = str_replace( "wps_", "", $option );
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<script type="text/javascript">
function DBMaintWarning() {
var checkbox = jQuery('#wps_schedule_dbmaint');
if (checkbox.attr('checked') == 'checked') {
if (!confirm('<?php _e( 'This will permanently delete data from the database each day, are you sure you want to enable this option?', 'wp-statistics' ); ?>'))
checkbox.attr('checked', false);
}
}
</script>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Purge Old Data Daily', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="wps_schedule_dbmaint"><?php _e( 'Enabled:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="wps_schedule_dbmaint" type="checkbox"
name="wps_schedule_dbmaint" <?php echo $WP_Statistics->get_option( 'schedule_dbmaint' ) == true
? "checked='checked'" : ''; ?> onclick='DBMaintWarning();'>
<label for="wps_schedule_dbmaint"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'A WP Cron job will be run daily to purge any data older than a set number of days.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wps_schedule_dbmaint_days"><?php _e( 'Purge data older than:', 'wp-statistics' ); ?></label>
</th>
<td>
<input type="text" class="small-text code" id="wps_schedule_dbmaint_days"
name="wps_schedule_dbmaint_days" value="<?php echo htmlentities(
$WP_Statistics->get_option( 'schedule_dbmaint_days', "365" ),
ENT_QUOTES
); ?>"/>
<?php _e( 'Days', 'wp-statistics' ); ?>
<p class="description"><?php echo __(
'The number of days to keep statistics for.',
'wp-statistics'
) . ' ' . __(
'Minimum value is 30 days.',
'wp-statistics'
) . ' ' . __(
'Invalid values will disable the daily maintenance.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Purge High Hit Count Visitors Daily', 'wp-statistics' ); ?></h3>
</th>
</tr>
<tr valign="top">
<th scope="row">
<label for="wps_schedule_dbmaint_visitor"><?php _e( 'Enabled:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="wps_schedule_dbmaint_visitor" type="checkbox"
name="wps_schedule_dbmaint_visitor" <?php echo $WP_Statistics->get_option(
'schedule_dbmaint_visitor'
) == true ? "checked='checked'" : ''; ?> onclick='DBMaintWarning();'>
<label for="wps_schedule_dbmaint_visitor"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'A WP Cron job will be run daily to purge any users statistics data where the user has more than the defined number of hits in a day (aka they are probably a bot).',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wps_schedule_dbmaint_visitor_hits"><?php _e(
'Purge visitors with more than:',
'wp-statistics'
); ?></label>
</th>
<td>
<input type="text" class="small-text code" id="wps_schedule_dbmaint_visitor_hits"
name="wps_schedule_dbmaint_visitor_hits" value="<?php echo htmlentities(
$WP_Statistics->get_option( 'schedule_dbmaint_visitor_hits', '50' ),
ENT_QUOTES
); ?>"/>
<?php _e( 'Hits', 'wp-statistics' ); ?>
<p class="description"><?php echo __(
'The number of hits required to delete the visitor.',
'wp-statistics'
) . ' ' . __(
'Minimum value is 10 hits.',
'wp-statistics'
) . ' ' . __(
'Invalid values will disable the daily maintenance.',
'wp-statistics'
); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,293 @@
<?php
$selist = wp_statistics_searchengine_list( true );
if ( $wps_nonce_valid ) {
// We need to handle a change in the report schedule manually, so check to see it has been set.
if ( array_key_exists( 'wps_time_report', $_POST ) ) {
// If the report has been changed, we need to update the schedule.
if ( $WP_Statistics->get_option( 'time_report' ) != $_POST['wps_time_report'] ) {
// Remove the old schedule if it exists.
if ( wp_next_scheduled( 'report_hook' ) ) {
wp_unschedule_event( wp_next_scheduled( 'report_hook' ), 'report_hook' );
}
// Setup the new schedule, we could just let this fall through and let the code in schedule.php deal with it
// but that would require an extra page load to start the schedule so do it here instead.
wp_schedule_event( time(), $_POST['wps_time_report'], 'report_hook' );
}
}
$wps_option_list = array(
"wps_stats_report",
"wps_time_report",
"wps_send_report",
"wps_content_report",
"wps_email_list",
"wps_geoip_report",
"wps_prune_report",
"wps_upgrade_report",
"wps_admin_notices",
);
foreach ( $wps_option_list as $option ) {
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
// WordPress escapes form data no matter what the setting of magic quotes is in PHP (http://www.theblog.ca/wordpress-addslashes-magic-quotes).
$value = stripslashes( $value );
$new_option = str_replace( "wps_", "", $option );
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<script type="text/javascript">
function ToggleStatOptions() {
jQuery('[id^="wps_stats_report_option"]').fadeToggle();
}
</script>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Common Report Options', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row" style="vertical-align: top;">
<label for="email-report"><?php _e( 'E-mail addresses:', 'wp-statistics' ); ?></label>
</td>
<td>
<input dir="ltr" type="text" id="email_list" name="wps_email_list" size="30" value="<?php if ( $WP_Statistics->get_option( 'email_list' ) == '' ) {
$WP_Statistics->store_option( 'email_list', get_bloginfo( 'admin_email' ) );
}
echo htmlentities( $WP_Statistics->get_option( 'email_list' ), ENT_QUOTES ); ?>"/>
<p class="description"><?php _e(
'A comma separated list of e-mail addresses to send reports to.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Update Reports', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row">
<label for="geoip-report"><?php _e( 'GeoIP:', 'wp-statistics' ); ?></label>
</td>
<td>
<input id="geoip-report" type="checkbox" value="1" name="wps_geoip_report" <?php echo $WP_Statistics->get_option( 'geoip_report' ) == true
? "checked='checked'" : ''; ?>>
<label for="geoip-report"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Send a report whenever the GeoIP database is updated.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<td scope="row">
<label for="prune-report"><?php _e( 'Pruning:', 'wp-statistics' ); ?></label>
</td>
<td>
<input id="prune-report" type="checkbox" value="1" name="wps_prune_report" <?php echo $WP_Statistics->get_option( 'prune_report' ) == true
? "checked='checked'" : ''; ?>>
<label for="prune-report"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Send a report whenever the pruning of database is run.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<td scope="row">
<label for="upgrade-report"><?php _e( 'Upgrade:', 'wp-statistics' ); ?></label>
</td>
<td>
<input id="upgrade-report" type="checkbox" value="1" name="wps_upgrade_report" <?php echo $WP_Statistics->get_option( 'upgrade_report' ) == true
? "checked='checked'" : ''; ?>>
<label for="upgrade-report"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Send a report whenever the plugin is upgraded.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Statistical reporting', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row">
<label for="stats-report"><?php _e( 'Statistical reporting:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="stats-report" type="checkbox" value="1" name="wps_stats_report" <?php echo $WP_Statistics->get_option( 'stats_report' ) == true
? "checked='checked'" : ''; ?> onClick='ToggleStatOptions();'>
<label for="stats-report"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Enable or disable this feature', 'wp-statistics' ); ?></p>
</td>
</tr>
<?php if ( $WP_Statistics->get_option( 'stats_report' ) ) {
$hidden = "";
} else {
$hidden = " style='display: none;'";
} ?>
<tr valign="top"<?php echo $hidden; ?> id='wps_stats_report_option'>
<td scope="row" style="vertical-align: top;">
<label for="time-report"><?php _e( 'Schedule:', 'wp-statistics' ); ?></label>
</td>
<td>
<select name="wps_time_report" id="time-report">
<option value="0" <?php selected( $WP_Statistics->get_option( 'time_report' ), '0' ); ?>><?php _e(
'Please select',
'wp-statistics'
); ?></option>
<?php
function wp_statistics_schedule_sort( $a, $b ) {
if ( $a['interval'] == $b['interval'] ) {
return 0;
}
return ( $a['interval'] < $b['interval'] ) ? - 1 : 1;
}
//Get List Of Schedules Wordpress
$schedules = wp_get_schedules();
uasort( $schedules, 'wp_statistics_schedule_sort' );
$schedules_item = array();
foreach ( $schedules as $key => $value ) {
if ( ! in_array( $value, $schedules_item ) ) {
echo '<option value="' . $key . '" ' . selected( $WP_Statistics->get_option( 'time_report' ), $key ) . '>' . $value['display'] . '</option>';
$schedules_item[] = $value;
}
}
?>
</select>
<p class="description"><?php _e( 'Select how often to receive statistical report.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top"<?php echo $hidden; ?> id='wps_stats_report_option'>
<td scope="row" style="vertical-align: top;">
<label for="send-report"><?php _e( 'Send reports via:', 'wp-statistics' ); ?></label>
</td>
<td>
<select name="wps_send_report" id="send-report">
<option value="0" <?php selected( $WP_Statistics->get_option( 'send_report' ), '0' ); ?>><?php _e(
'Please select',
'wp-statistics'
); ?></option>
<option value="mail" <?php selected( $WP_Statistics->get_option( 'send_report' ), 'mail' ); ?>><?php _e(
'Email',
'wp-statistics'
); ?></option>
<?php if ( is_plugin_active( 'wp-sms/wp-sms.php' ) || is_plugin_active( 'wp-sms-pro/wp-sms.php' ) ) { ?>
<option value="sms" <?php selected(
$WP_Statistics->get_option( 'send_report' ),
'sms'
); ?>><?php _e( 'SMS', 'wp-statistics' ); ?></option>
<?php } ?>
</select>
<p class="description"><?php _e(
'Select delivery method for statistical report.',
'wp-statistics'
); ?></p>
<?php if ( ! is_plugin_active( 'wp-sms/wp-sms.php' ) ) { ?>
<p class="description note"><?php echo sprintf(
__( 'Note: To send SMS text messages please install the %s plugin.', 'wp-statistics' ),
'<a href="http://wordpress.org/extend/plugins/wp-sms/" target="_blank">' .
__( 'WordPress SMS', 'wp-statistics' ) .
'</a>'
); ?></p>
<?php } ?>
</td>
</tr>
<tr valign="top"<?php echo $hidden; ?> id='wps_stats_report_option'>
<td scope="row" style="vertical-align: top;">
<label for="content-report"><?php _e( 'Message body:', 'wp-statistics' ); ?></label>
</td>
<td>
<?php wp_editor(
$WP_Statistics->get_option( 'content_report' ),
'content-report',
array(
'media_buttons' => false,
'textarea_name' => 'wps_content_report',
'textarea_rows' => 5,
)
); ?>
<p class="description"><?php _e( 'Enter the contents of the report.', 'wp-statistics' ); ?></p>
<p class="description data">
<?php _e(
'Any shortcode supported by your installation of WordPress, include all shortcodes for WP Statistics (see the documentation for a list of codes available) are supported in the body of the message. Here are some examples:',
'wp-statistics'
); ?>
<br><br> &nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Online User', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=usersonline]</code><br>
&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Today\'s Visitors', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=visitors time=today]</code><br>
&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Today\'s Visits', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=visits time=today]</code><br>
&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Yesterday\'s Visitors', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=visitors time=yesterday]</code><br>
&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Yesterday\'s Visits', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=visits time=yesterday]</code><br>
&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Total Visitors', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=visitors time=total]</code><br>
&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Total Visits', 'wp-statistics' ); ?>: <code>[wpstatistics
stat=visits time=total]</code><br>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Admin Notices', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row">
<label for="admin-notices"><?php _e( 'All Notices:', 'wp-statistics' ); ?></label>
</td>
<td>
<input id="admin-notices" type="checkbox" value="1" name="wps_admin_notices" <?php echo $WP_Statistics->get_option( 'admin_notices' ) == true ? "checked='checked'" : ''; ?>>
<label for="admin-notices"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Show all notices and suggestion from WP-Statistics in the admin.', 'wp-statistics' ); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' ); ?>

View File

@@ -0,0 +1,106 @@
<?php
if ( $wps_nonce_valid ) {
$wps_option_list = array( 'wps_disable_map', 'wps_disable_dashboard', 'wps_disable_editor' );
foreach ( $wps_option_list as $option ) {
$new_option = str_replace( 'wps_', '', $option );
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$WP_Statistics->store_option( $new_option, $value );
}
}
// Only display the global options if the user is an administrator.
if ( $wps_admin ) {
?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Dashboard', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php _e(
'The following items are global to all users.',
'wp-statistics'
); ?></td>
</tr>
<tr valign="top">
<th scope="row">
<label for="disable-map"><?php _e( 'Disable dashboard widgets:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="disable-dashboard" type="checkbox" value="1"
name="wps_disable_dashboard" <?php echo $WP_Statistics->get_option( 'disable_dashboard' ) == true
? "checked='checked'" : ''; ?>>
<label for="disable-dashboard"><?php _e( 'Disable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Disable the dashboard widgets.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Page/Post Editor', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php _e(
'The following items are global to all users.',
'wp-statistics'
); ?></td>
</tr>
<tr valign="top">
<th scope="row">
<label for="disable-map"><?php _e( 'Disable post/page editor widget:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="disable-editor" type="checkbox" value="1"
name="wps_disable_editor" <?php echo $WP_Statistics->get_option( 'disable_editor' ) == true
? "checked='checked'" : ''; ?>>
<label for="disable-editor"><?php _e( 'Disable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Disable the page/post editor widget.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Map', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php _e(
'The following items are global to all users.',
'wp-statistics'
); ?></td>
</tr>
<tr valign="top">
<th scope="row">
<label for="disable-map"><?php _e( 'Disable map:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="disable-map" type="checkbox" value="1"
name="wps_disable_map" <?php echo $WP_Statistics->get_option( 'disable_map' ) == true
? "checked='checked'" : ''; ?>>
<label for="disable-map"><?php _e( 'Disable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Disable the map display', 'wp-statistics' ); ?></p>
</td>
</tr>
</tbody>
</table>
<?php
}
submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,89 @@
<?php
if ( $wps_nonce_valid ) {
$wps_option_list = array(
'wps_anonymize_ips',
'wps_hash_ips',
'wps_store_ua',
'wps_all_online',
);
// If the IP hash's are enabled, disable storing the complete user agent.
if ( array_key_exists( 'wps_hash_ips', $_POST ) ) {
$_POST['wps_store_ua'] = '';
}
foreach ( $wps_option_list as $option ) {
if ( array_key_exists( $option, $_POST ) ) {
$value = $_POST[ $option ];
} else {
$value = '';
}
$new_option = str_replace( "wps_", "", $option );
$WP_Statistics->store_option( $new_option, $value );
}
}
?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'Privacy and Data Protection', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<td scope="row" colspan="2"><?php echo sprintf( __( 'If you want to delete visitor data, please <a href="%s">click here</a>.', 'wp-statistics' ), WP_Statistics_Admin_Pages::admin_url( 'optimization', array( 'tab' => 'purging' ) ) ); ?></td>
</tr>
<tr valign="top">
<th scope="row">
<label for="anonymize_ips"><?php _e( 'Anonymize IP Addresses:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="anonymize_ips" type="checkbox" value="1" name="wps_anonymize_ips" <?php echo $WP_Statistics->get_option( 'anonymize_ips' ) == true
? "checked='checked'" : ''; ?>>
<label for="anonymize_ips"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php echo __( 'This option anonymizes the user IP address for GDPR compliance. For example, 888.888.888.888 > 888.888.888.000.', 'wp-statistics' ); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="hash_ips"><?php _e( 'Hash IP Addresses:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="hash_ips" type="checkbox" value="1" name="wps_hash_ips" <?php echo $WP_Statistics->get_option( 'hash_ips' ) == true
? "checked='checked'" : ''; ?>>
<label for="hash_ips"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php echo __(
'This feature will not store IP addresses in the database but instead used a unique hash.',
'wp-statistics'
) . ' ' . __(
'The "Store entire user agent string" setting will be disabled if this is selected.',
'wp-statistics'
) . ' ' . __(
'You will not be able to recover the IP addresses in the future to recover location information if this is enabled.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="store_ua"><?php _e( 'Store entire user agent string:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="store_ua" type="checkbox" value="1" name="wps_store_ua" <?php echo $WP_Statistics->get_option( 'store_ua' ) == true
? "checked='checked'" : ''; ?>>
<label for="store_ua"><?php _e( 'Enable', 'wp-statistics' ); ?></label>
<p class="description"><?php _e( 'Only enabled for debugging. (If the IP hash\'s are enabled, This option disabling automatically.)', 'wp-statistics' ); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,129 @@
<?php
if ( $wps_nonce_valid ) {
if ( array_key_exists( 'wps_remove_plugin', $_POST ) ) {
if ( is_super_admin() ) {
update_option( 'wp_statistics_removal', 'true' );
// We need to reload the page after we reset the options but it's too late to do it through a HTTP redirect so do a
// JavaScript redirect instead.
echo '<script type="text/javascript">window.location.href="' . admin_url() . 'plugins.php";</script>';
}
}
if ( array_key_exists( 'wps_reset_plugin', $_POST ) ) {
if ( is_super_admin() ) {
GLOBAL $wpdb, $WP_Statistics;
$default_options = $WP_Statistics->Default_Options();
$excluded_defaults = array( 'force_robot_update', 'robot_list' );
// Handle multi site implementations
if ( is_multisite() ) {
// Loop through each of the sites.
$sites = $WP_Statistics->get_wp_sites_list();
foreach ( $sites as $blog_id ) {
switch_to_blog( $blog_id );
// Delete the wp_statistics option.
update_option( 'wp_statistics', array() );
// Delete the user options.
$wpdb->query( "DELETE FROM {$wpdb->prefix}usermeta WHERE meta_key LIKE 'wp_statistics%'" );
$WP_Statistics->load_options();
// Set some intelligent defaults.
foreach ( $default_options as $key => $value ) {
if ( ! in_array( $key, $excluded_defaults ) && false === $WP_Statistics->get_option( $key ) ) {
$WP_Statistics->store_option( $key, $value );
}
}
$WP_Statistics->save_options();
}
restore_current_blog();
} else {
// Delete the wp_statistics option.
update_option( 'wp_statistics', array() );
// Delete the user options.
$wpdb->query( "DELETE FROM {$wpdb->prefix}usermeta WHERE meta_key LIKE 'wp_statistics%'" );
$WP_Statistics->load_options();
// Set some intelligent defaults.
foreach ( $default_options as $key => $value ) {
if ( ! in_array( $key, $excluded_defaults ) && false === $WP_Statistics->get_option( $key ) ) {
$WP_Statistics->store_option( $key, $value );
}
}
$WP_Statistics->save_options();
}
// We need to reload the page after we reset the options but it's too late to do it through a HTTP redirect so do a
// JavaScript redirect instead.
echo '<script type="text/javascript">window.location.href="' . WP_Statistics_Admin_Pages::admin_url( 'settings' ) . '";</script>';
}
}
}
?>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2"><h3><?php _e( 'WP Statisitcs Removal', 'wp-statistics' ); ?></h3></th>
</tr>
<tr valign="top">
<th scope="row" colspan="2">
<?php _e(
'Uninstalling WP Statistics will not remove the data and settings, you can use this option to remove the WP Statistics data from your install before uninstalling the plugin.',
'wp-statistics'
); ?>
<br>
<br>
<?php _e(
'Once you submit this form the settings will be deleted during the page load, however WP Statistics will still show up in your Admin menu until another page load is executed.',
'wp-statistics'
); ?>
</th>
</tr>
<tr valign="top">
<th scope="row">
<label for="reset-plugin"><?php _e( 'Reset options:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="reset-plugin" type="checkbox" name="wps_reset_plugin">
<label for="reset-plugin"><?php _e( 'Reset', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Reset the plugin options to the defaults. This will remove all user and global settings but will keep all other data. This action cannot be undone. Note: For multisite installs this will reset all sites to the defaults.',
'wp-statistics'
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="remove-plugin"><?php _e( 'Remove data and settings:', 'wp-statistics' ); ?></label>
</th>
<td>
<input id="remove-plugin" type="checkbox" name="wps_remove_plugin">
<label for="remove-plugin"><?php _e( 'Remove', 'wp-statistics' ); ?></label>
<p class="description"><?php _e(
'Remove data and settings, this action cannot be undone.',
'wp-statistics'
); ?></p>
</td>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' ); ?>

View File

@@ -0,0 +1,168 @@
<?php
// Save Option
if ( $wps_nonce_valid and $wps_admin ) {
$value = 'REMOTE_ADDR';
if ( isset( $_POST['ip_method'] ) and ! empty( $_POST['ip_method'] ) ) {
// Check Custom Header
if ( $_POST['ip_method'] == "CUSTOM_HEADER" ) {
if ( trim( $_POST['user_custom_header_ip_method'] ) != "" ) {
$value = $_POST['user_custom_header_ip_method'];
}
} else {
$value = $_POST['ip_method'];
}
}
$WP_Statistics->update_option( 'ip_method', $value );
}
// Get IP Method
$ip_method = WP_Statistics::getIPMethod();
// Add TickBox
add_thickbox();
?>
<!-- Show Help $_SERVER -->
<style>
#TB_window {
direction: ltr;
}
</style>
<div id="list-of-php-server" style="display:none;">
<table style="direction: ltr;">
<tr>
<td width="330" style="color: #3238fb; border-bottom: 1px solid #bcbeff;padding-top:10px;padding-bottom:10px;">
<b><?php _e( '$_SERVER', 'wp-statistics' ); ?></b></td>
<td style="color: #3238fb; border-bottom: 1px solid #bcbeff;padding-top:10px;padding-bottom:10px;"> <?php _e( 'Value', 'wp-statistics' ); ?></td>
</tr>
<?php
foreach ( $_SERVER as $key => $value ) {
?>
<tr>
<td width="330" style="padding-top:10px;padding-bottom:10px;">
<b><?php echo $key; ?></b></td>
<td style="padding-top:10px;padding-bottom:10px;"> <?php echo ( $value == "" ? "-" : substr( str_replace( array( "\n", "\r" ), '', trim( $value ) ), 0, 200 ) ) . ( strlen( $value ) > 200 ? '..' : '' ); ?></td>
</tr>
<?php
}
?>
</table>
</div>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" colspan="2" style="padding-bottom: 10px; font-weight: normal;line-height: 25px;">
<?php _e( 'Your real IP detected with ipify.org service:', 'wp-statistics' ); ?>
</th>
</tr>
<tr valign="top">
<th scope="row" colspan="2">
<code id="user_real_ip" style="padding: 15px;font-size: 30px;font-weight: 200; letter-spacing: 2px;font-family: 'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;">
<script type="application/javascript">
jQuery(document).ready(function () {
jQuery.ajax({
url: "https://api.ipify.org?format=json",
dataType: 'json',
error: function (jqXHR) {
if (jqXHR.status == 0) {
jQuery("code#user_real_ip").html("<?php _e( 'Please check your internet connection and try again.', 'wp-statistics' ); ?>");
}
},
success: function (json) {
jQuery("code#user_real_ip").html(json['ip']);
}
});
});
</script>
</code></th>
</tr>
<tr>
<td colspan="3">
<p><?php _e( 'The items below return the IP address that is different on each server. Is the best way that you choose.', 'wp-statistics' ); ?></p>
</td>
</tr>
<?php
foreach ( WP_Statistics::list_of_server_ip_variable() as $method ) {
?>
<tr valign="top">
<th scope="row" colspan="2" style="padding-top: 8px;padding-bottom: 8px;">
<table>
<tr>
<td style="width: 10px; padding: 0px;">
<input type="radio" name="ip_method" style="vertical-align: -3px;" value="<?php echo $method; ?>"<?php if ( $ip_method == $method ) {
echo " checked=\"checked\"";
} ?>>
</td>
<td style="width: 250px;"> <?php printf( __( 'Use %1$s', 'wp-statistics' ), $method ); ?></td>
<td><code><?php
if ( isset( $_SERVER[ $method ] ) and ! empty( $_SERVER[ $method ] ) ) {
echo $_SERVER[ $method ];
} else {
_e( 'No available data.', 'wp-statistics' );
} ?>
</code>
<?php
if ( isset( $_SERVER[ $method ] ) and ! empty( $_SERVER[ $method ] ) and $WP_Statistics->check_sanitize_ip( $_SERVER[ $method ] ) === false ) {
echo ' &nbsp;&nbsp;<a href="https://wp-statistics.com/sanitize-user-ip/" style="color: #d04f4f;" target="_blank" title="' . __( 'Your value required to sanitize user IP', 'wp-statistics' ) . '"><span class="dashicons dashicons-warning"></span></a>';
}
?>
</td>
</tr>
</table>
</th>
</tr>
<?php
}
?>
<!-- Custom Header -->
<tr valign="top">
<th scope="row" colspan="2" style="padding-top: 0px;padding-bottom: 0px;">
<table>
<tr>
<td style="width: 10px; padding: 0px;">
<input type="radio" name="ip_method" style="vertical-align: -3px;" value="CUSTOM_HEADER" <?php if ( ! in_array( $ip_method, WP_Statistics::list_of_server_ip_variable() ) ) {
echo " checked=\"checked\"";
} ?>>
</td>
<td style="width: 250px;"> <?php echo __( 'Use Custom Header', 'wp-statistics' ); ?></td>
<td style="padding-left: 0px;">
<input type="text" name="user_custom_header_ip_method" autocomplete="off" style="padding: 5px; width: 250px;height: 35px;" value="<?php if ( ! in_array( $ip_method, WP_Statistics::list_of_server_ip_variable() ) ) {
echo $ip_method;
} ?>">
<p class="description">
<?php if ( ! in_array( $ip_method, WP_Statistics::list_of_server_ip_variable() ) ) {
echo '<code>';
if ( isset( $_SERVER[ $ip_method ] ) and ! empty( $_SERVER[ $ip_method ] ) ) {
echo $_SERVER[ $ip_method ];
} else {
_e( 'No available data.', 'wp-statistics' );
}
}
echo '</code>';
if ( ! in_array( $ip_method, WP_Statistics::list_of_server_ip_variable() ) and isset( $_SERVER[ $ip_method ] ) and ! empty( $_SERVER[ $ip_method ] ) and $WP_Statistics->check_sanitize_ip( $_SERVER[ $ip_method ] ) === false ) {
echo ' &nbsp;&nbsp;<a href="https://wp-statistics.com/sanitize-user-ip/" style="color: #d04f4f;" target="_blank" title="' . __( 'Your value required to sanitize user IP', 'wp-statistics' ) . '"><span class="dashicons dashicons-warning"></span></a>';
}
?></p>
<p class="description"><?php _e( 'If your server use the custom key in <code>$_SERVER</code> for getting IP. e.g. <code>HTTP_CF_CONNECTING_IP</code> in CloudFlare.', 'wp-statistics' ); ?></p>
<p class="description">
<a href="#TB_inline?&width=850&height=600&inlineId=list-of-php-server" class="thickbox"><?php _e( 'Show all <code>$_SERVER</code> in your server.', 'wp-statistics' ); ?></a>
</p>
</td>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<?php submit_button( __( 'Update', 'wp-statistics' ), 'primary', 'submit' );

View File

@@ -0,0 +1,96 @@
<?php
//Check Form Security nonce
$wps_nonce_valid = false;
if ( array_key_exists( 'wp-statistics-nonce', $_POST ) ) {
if ( wp_verify_nonce( $_POST['wp-statistics-nonce'], 'update-options' ) ) {
$wps_nonce_valid = true;
}
}
//Check User Access To Save Setting
$wps_admin = false;
if ( current_user_can( wp_statistics_validate_capability( $WP_Statistics->get_option( 'manage_capability', 'manage_options' ) ) ) ) {
$wps_admin = true;
}
if ( $wps_admin === false ) {
$wps_admin = 0;
}
?>
<div class="wrap wps-wrap wp-statistics-settings">
<?php WP_Statistics_Admin_Pages::show_page_title( __( 'Settings', 'wp-statistics' ) ); ?>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div class="wp-list-table widefat widefat">
<form id="wp-statistics-settings-form" method="post">
<?php wp_nonce_field( 'update-options', 'wp-statistics-nonce' ); ?>
<div class="wp-statistics-container">
<ul class="tabs">
<?php if ( $wps_admin ) { ?>
<li class="tab-link current" data-tab="general-settings"><?php _e( 'General', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="visitor-ip-settings"><?php _e( 'Visitor IP', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="privacy-settings"><?php _e( 'Privacy', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="notifications-settings"><?php _e( 'Notifications', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="overview-display-settings"><?php _e( 'Dashboard', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="access-settings"><?php _e( 'Access Levels', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="exclusions-settings"><?php _e( 'Exclusions', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="externals-settings"><?php _e( 'Externals', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="maintenance-settings"><?php _e( 'Maintenance', 'wp-statistics' ); ?></li>
<li class="tab-link" data-tab="removal-settings"><?php _e( 'Removal', 'wp-statistics' ); ?></li>
<?php } ?>
<li class="tab-link" data-tab="about"><?php _e( 'About', 'wp-statistics' ); ?></li>
</ul>
<?php if ( $wps_admin ) { ?>
<div id="general-settings" class="tab-content current">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-general.php' ); ?>
</div>
<div id="visitor-ip-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-visitor-ip.php' ); ?>
</div>
<div id="privacy-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-privacy.php' ); ?>
</div>
<div id="notifications-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-notifications.php' ); ?>
</div>
<div id="overview-display-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-overview-display.php' ); ?>
</div>
<div id="access-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-access-level.php' ); ?>
</div>
<div id="exclusions-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-exclusions.php' ); ?>
</div>
<div id="externals-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-externals.php' ); ?>
</div>
<div id="maintenance-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-maintenance.php' ); ?>
</div>
<div id="removal-settings" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-removal.php' ); ?>
</div>
<?php } ?>
<div id="about" class="tab-content">
<?php include( WP_Statistics::$reg['plugin-dir'] . 'includes/settings/tabs/wps-about.php' ); ?>
</div>
</div><!-- container -->
</form>
</div>
<?php include WP_Statistics::$reg['plugin-dir'] . 'includes/templates/postbox.php'; ?>
</div>
</div>
</div>
<?php
if ( $wps_nonce_valid ) {
if ( $wps_admin ) {
$WP_Statistics->save_options();
}
$WP_Statistics->save_user_options();
}