One-time execution added
This commit is contained in:
parent
0a001acac9
commit
949bf9d26f
19
README.md
19
README.md
@ -1,8 +1,8 @@
|
|||||||
# Statify Blacklist #
|
# Statify Blacklist #
|
||||||
* Contributors: Stefan Kalscheuer
|
* Contributors: Stefan Kalscheuer
|
||||||
* Requires at least: 3.9
|
* Requires at least: 3.9
|
||||||
* Tested up to: 4.5
|
* Tested up to: 4.5.3
|
||||||
* Stable tag: 1.0.0
|
* Stable tag: 1.1.0
|
||||||
* License: GPLv3 or later
|
* License: GPLv3 or later
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
@ -15,9 +15,12 @@ This plugin adds customizable blacklist to Statify to allow blocking of referer
|
|||||||
####Referer Blacklist
|
####Referer Blacklist
|
||||||
Add a list of domains (for simplicity onl second-level, e.g. _example.com_ which blocks _everything.example.com_).
|
Add a list of domains (for simplicity onl second-level, e.g. _example.com_ which blocks _everything.example.com_).
|
||||||
|
|
||||||
|
#### CleanUp Database
|
||||||
|
Filters can be applied to data stored in database after modifying filter rules or for one-time clean-up.
|
||||||
|
|
||||||
|
|
||||||
### Compatibility ###
|
### Compatibility ###
|
||||||
This plugin requires Statify to be installed. The extension has been tested with Statify 1.4.3
|
This plugin requires Statify to be installed. The extension has been tested with Statify 1.4.2
|
||||||
The plugin is capable of handling multisite installations.
|
The plugin is capable of handling multisite installations.
|
||||||
|
|
||||||
### Credits ###
|
### Credits ###
|
||||||
@ -28,4 +31,12 @@ The plugin is capable of handling multisite installations.
|
|||||||
|
|
||||||
### Requirements ###
|
### Requirements ###
|
||||||
* PHP 5.2.4
|
* PHP 5.2.4
|
||||||
* WordPress 3.9
|
* WordPress 3.9
|
||||||
|
* Statify plugin installed and activated (tested with 1.4.2)
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
#### 1.1.0 / 15.08.2016
|
||||||
|
* One-time execution on database
|
||||||
|
|
||||||
|
#### 1.0.0 / 14.08.2016
|
||||||
|
* First release
|
@ -49,8 +49,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist
|
|||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function plugin_actions_links($links, $file)
|
public static function plugin_actions_links($links, $file) {
|
||||||
{
|
|
||||||
$base = self::$multisite ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
|
$base = self::$multisite ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
|
||||||
|
|
||||||
if( $file == STATIFYBLACKLIST_BASE && current_user_can('manage_options') ) {
|
if( $file == STATIFYBLACKLIST_BASE && current_user_can('manage_options') ) {
|
||||||
@ -61,4 +60,25 @@ class StatifyBlacklist_Admin extends StatifyBlacklist
|
|||||||
}
|
}
|
||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter database for cleanup.
|
||||||
|
*
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
public static function cleanup_database() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
/* Build filter regexp */
|
||||||
|
$refererRegexp = str_replace('.', '\.', implode('|', self::$_options['referer']));
|
||||||
|
if (!empty($refererRegexp)) {
|
||||||
|
/* Execute filter on database */
|
||||||
|
$wpdb->query(
|
||||||
|
$wpdb->prepare("DELETE FROM `$wpdb->statify` WHERE referrer REGEXP %s", $refererRegexp)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Optimize DB */
|
||||||
|
$wpdb->query("OPTIMIZE TABLE `$wpdb->statify`");
|
||||||
|
}
|
||||||
}
|
}
|
35
readme.txt
Normal file
35
readme.txt
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
=== Statify Blacklist ===
|
||||||
|
Contributors: Stefan Kalscheuer
|
||||||
|
Tags: stats, extension, blacklist, filter
|
||||||
|
Requires at least: 3.9
|
||||||
|
Tested up to: 4.5.3
|
||||||
|
Stable tag: trunk
|
||||||
|
License: GPLv3 or later
|
||||||
|
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
Extension for the Statify statistics plugin. Provides a customizable referer blacklist.
|
||||||
|
|
||||||
|
== Description ==
|
||||||
|
A blacklist extension for the famous [Statify](http://statify.de) Wordpress plugin.
|
||||||
|
|
||||||
|
This plugin adds customizable blacklist to Statify to allow blocking of referer spam or internal interactions.
|
||||||
|
|
||||||
|
== Requirements ==
|
||||||
|
* PHP 5.2.4
|
||||||
|
* WordPress 3.9
|
||||||
|
* Statify plugin (tested with 1.4.2)
|
||||||
|
|
||||||
|
== Installation ==
|
||||||
|
1. Upload the plugin files to the `/wp-content/plugins/statify-blacklist` directory, or install the plugin through the WordPress plugins screen directly.
|
||||||
|
1. Activate the plugin through the 'Plugins' screen in WordPress
|
||||||
|
1. Use the Settings->Plugin Name screen to configure the plugin
|
||||||
|
1. (Make your instructions match the desired user flow for activating and installing your plugin. Include any steps that might be needed for explanatory purposes)
|
||||||
|
|
||||||
|
|
||||||
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.1.0 / 15.08.2016 =
|
||||||
|
* One-time execution on database
|
||||||
|
|
||||||
|
= 1.0.0 / 14.08.2016 =
|
||||||
|
* First release
|
@ -6,9 +6,9 @@ Text Domain: statify-blacklist
|
|||||||
Domain Path: /lang
|
Domain Path: /lang
|
||||||
Author: stklcode
|
Author: stklcode
|
||||||
Author URI: https://stklcode.de
|
Author URI: https://stklcode.de
|
||||||
Plugin URI: https://wordpress.org/plugins/statifyRefererBlacklist
|
Plugin URI: https://wordpress.org/plugins/statify-blacklist
|
||||||
License: GPLv3 or later
|
License: GPLv3 or later
|
||||||
Version: 1.0.0
|
Version: 1.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Quit */
|
/* Quit */
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* Update plugin options */
|
/* Update plugin options */
|
||||||
if ( ! empty($_POST['statifyblacklist']) ) {
|
if ( !empty($_POST['statifyblacklist']) ) {
|
||||||
StatifyBlacklist::update_options(
|
if (!empty($_POST['cleanUp'])) {
|
||||||
array(
|
/* CleanUp DB */
|
||||||
'active_referer' => (int)@$_POST['statifyblacklist']['active_referer'],
|
StatifyBlacklist_Admin::cleanup_database();
|
||||||
'referer' => explode("\r\n", $_POST['statifyblacklist']['referer'])
|
} else {
|
||||||
)
|
StatifyBlacklist::update_options(
|
||||||
);
|
array(
|
||||||
|
'active_referer' => (int)@$_POST['statifyblacklist']['active_referer'],
|
||||||
|
'referer' => explode("\r\n", $_POST['statifyblacklist']['referer'])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -33,6 +38,13 @@ if ( ! empty($_POST['statifyblacklist']) ) {
|
|||||||
</ul>
|
</ul>
|
||||||
<?php wp_nonce_field('statify-blacklist-settings'); ?>
|
<?php wp_nonce_field('statify-blacklist-settings'); ?>
|
||||||
|
|
||||||
<p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php _e('Save Changes') ?>"></p>
|
<p class="submit">
|
||||||
|
<input class="button-primary" type="submit" name="submit" value="<?php _e('Save Changes') ?>">
|
||||||
|
<hr>
|
||||||
|
<input class="button-secondary" type="submit" name="cleanUp" value="<?php esc_html_e('CleanUp Database', 'statify-blacklist') ?>"
|
||||||
|
onclick="return confirm('Do you really want to apply filters to database? This cannot be undone.');">
|
||||||
|
<br>
|
||||||
|
<small>(<?php esc_html_e('Applies filter (even if disabled) to data stored in database. This cannot be undone!', 'statify-blacklist'); ?>)</small>
|
||||||
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user