Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
38c1e569e6
|
|||
4290aed9ce
|
|||
13809aeaa3
|
|||
9903a6163d
|
|||
c88d716dfc
|
|||
714512ca15
|
|||
081a6abbb0
|
|||
6003a0d397
|
|||
6f4b1722bf
|
23
README.md
23
README.md
@ -4,11 +4,11 @@
|
||||
[](https://github.com/stklcode/statify-blacklist/blob/stable/LICENSE.md)
|
||||
|
||||
# Statify Filter #
|
||||
* Contributors: Stefan Kalscheuer
|
||||
* Contributors: stklcode
|
||||
* Requires at least: 4.7
|
||||
* Tested up to: 6.4
|
||||
* Tested up to: 6.5
|
||||
* Requires PHP: 5.5
|
||||
* Stable tag: 1.7.0
|
||||
* Stable tag: 1.7.2
|
||||
* License: GPLv2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@ -93,11 +93,26 @@ Same for IPv6 prefixes like _2001:db8:a0b:12f0::/64_.
|
||||
|
||||
## Upgrade Notice ##
|
||||
|
||||
### 1.7.2 ###
|
||||
This is a bugfix release to restore the manual cleanup function that was broken since 1.7.0.
|
||||
|
||||
### 1.7.1 ###
|
||||
This is a service release with minor corrections. Recommended for all users. Tested up to 6.5.
|
||||
|
||||
### 1.7.0 ###
|
||||
This is a service release with primarily internal rework. Tested up to 6.4 and PHP 8.3.
|
||||
|
||||
|
||||
## Changelog ##
|
||||
## Changelog
|
||||
|
||||
### 1.7.2 / 06.06.2024 ###
|
||||
* Restore manual database cleanup functionality
|
||||
|
||||
### 1.7.1 / 24.03.2024 ###
|
||||
* Fix HTML syntax for checkboxes on settings page
|
||||
* Simplify some internal control structures
|
||||
* Add plugin dependency to Statify
|
||||
* Declared compatibility with WordPress 6.5
|
||||
|
||||
### 1.7.0 / 11.03.2024 ###
|
||||
* Internal rework of plugin settings
|
||||
|
36
assets/blueprints/blueprint.json
Normal file
36
assets/blueprints/blueprint.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
|
||||
"landingPage": "/wp-admin/options-general.php?page=statify-blacklist",
|
||||
"features": {
|
||||
"networking": true
|
||||
},
|
||||
"steps": [
|
||||
{
|
||||
"step": "login",
|
||||
"username": "admin",
|
||||
"password": "password"
|
||||
},
|
||||
{
|
||||
"step": "installPlugin",
|
||||
"pluginZipFile": {
|
||||
"resource": "wordpress.org/plugins",
|
||||
"slug": "statify"
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": "activatePlugin",
|
||||
"pluginPath": "statify/statify.php"
|
||||
},
|
||||
{
|
||||
"step": "installPlugin",
|
||||
"pluginZipFile": {
|
||||
"resource": "wordpress.org/plugins",
|
||||
"slug": "statify-blacklist"
|
||||
}
|
||||
},
|
||||
{
|
||||
"step": "activatePlugin",
|
||||
"pluginPath": "statify-blacklis/statify-blacklist.php"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "stklcode/statify-blacklist",
|
||||
"version": "1.7.0",
|
||||
"version": "1.7.2",
|
||||
"description": "A filter extension for the famous Statify WordPress plugin",
|
||||
"keywords": [
|
||||
"wordpress",
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @since 1.7.0
|
||||
*/
|
||||
|
||||
// Quit if accessed directly..
|
||||
// Quit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
@ -170,6 +170,27 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php esc_html_e( 'Statify Filter', 'statify-blacklist' ); ?></h1>
|
||||
<?php
|
||||
if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === $_SERVER['REQUEST_METHOD'] && ! empty( $_POST['cleanup'] ) ) {
|
||||
// Database cleanup requested.
|
||||
if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), 'statify-blacklist-options' ) ) {
|
||||
// Nonce verification successful, proceed with cleanup.
|
||||
StatifyBlacklist_Admin::cleanup_database();
|
||||
?>
|
||||
<div class="notice notice-success is-dismissible">
|
||||
<p><?php esc_html_e( 'Database cleanup successful', 'statify-blacklist' ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
// Nonce verification failed.
|
||||
?>
|
||||
<div class="notice notice-error is-dismissible">
|
||||
<p><?php esc_html_e( 'Database cleanup request failed', 'statify-blacklist' ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="statify-settings" method="post" action="options.php">
|
||||
<?php
|
||||
@ -178,7 +199,8 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
submit_button();
|
||||
?>
|
||||
<hr>
|
||||
<input class="button-secondary" type="submit" name="cleanUp"
|
||||
<input class="button-secondary" type="submit" name="cleanup"
|
||||
formaction=""
|
||||
value="<?php esc_html_e( 'CleanUp Database', 'statify-blacklist' ); ?>"
|
||||
onclick="return confirm('<?php echo esc_js( __( 'Do you really want to apply filters to database? This cannot be undone.', 'statify-blacklist' ) ); ?>');">
|
||||
<p class="description">
|
||||
@ -208,7 +230,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'Activate live filter', 'statify-blacklist' ); ?></legend>
|
||||
<label for="statifyblacklist-referer-active">
|
||||
<input id="statifyblacklist-referer-active" name="statify-blacklist[referer][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['referer']['active'], 1 ); ?>">
|
||||
<input id="statifyblacklist-referer-active" name="statify-blacklist[referer][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['referer']['active'], 1 ); ?>>
|
||||
<?php esc_html_e( 'Activate', 'statify-blacklist' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
@ -228,7 +250,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'CronJob execution', 'statify-blacklist' ); ?></legend>
|
||||
<label for="statifyblacklist-referer-cron">
|
||||
<input id="statifyblacklist-referer-cron" name="statify-blacklist[referer][cron]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['referer']['cron'], 1 ); ?>">
|
||||
<input id="statifyblacklist-referer-cron" name="statify-blacklist[referer][cron]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['referer']['cron'], 1 ); ?>>
|
||||
<?php esc_html_e( 'Activate', 'statify-blacklist' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
@ -295,7 +317,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'Activate live filter', 'statify-blacklist' ); ?></legend>
|
||||
<label for="statifyblacklist-target-active">
|
||||
<input id="statifyblacklist-target-active" name="statify-blacklist[target][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['target']['active'], 1 ); ?>">
|
||||
<input id="statifyblacklist-target-active" name="statify-blacklist[target][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['target']['active'], 1 ); ?>>
|
||||
<?php esc_html_e( 'Activate', 'statify-blacklist' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
@ -315,7 +337,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'CronJob execution', 'statify-blacklist' ); ?></legend>
|
||||
<label for="statifyblacklist-target-cron">
|
||||
<input id="statifyblacklist-target-cron" name="statify-blacklist[target][cron]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['target']['cron'], 1 ); ?>">
|
||||
<input id="statifyblacklist-target-cron" name="statify-blacklist[target][cron]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['target']['cron'], 1 ); ?>>
|
||||
<?php esc_html_e( 'Activate', 'statify-blacklist' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
@ -377,7 +399,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'Activate live filter', 'statify-blacklist' ); ?></legend>
|
||||
<label for="statifyblacklist-ip-active">
|
||||
<input id="statifyblacklist-ip-active" name="statify-blacklist[ip][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['ip']['active'], 1 ); ?>">
|
||||
<input id="statifyblacklist-ip-active" name="statify-blacklist[ip][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['ip']['active'], 1 ); ?>>
|
||||
<?php esc_html_e( 'Activate', 'statify-blacklist' ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
@ -414,7 +436,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
public static function option_ua_active() {
|
||||
?>
|
||||
<label for="statifyblacklist-ua-active">
|
||||
<input id="statifyblacklist-ua-active" name="statify-blacklist[ua][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['ua']['active'], 1 ); ?>">
|
||||
<input id="statifyblacklist-ua-active" name="statify-blacklist[ua][active]" type="checkbox" value="1" <?php checked( StatifyBlacklist::$options['ua']['active'], 1 ); ?>>
|
||||
<?php esc_html_e( 'Activate', 'statify-blacklist' ); ?>
|
||||
</label>
|
||||
|
||||
@ -575,14 +597,13 @@ class StatifyBlacklist_Settings extends StatifyBlacklist {
|
||||
* @since 1.7.0
|
||||
*/
|
||||
private static function sanitize_target_options( &$options ) {
|
||||
$target_given = $options['blacklist'];
|
||||
$target_invalid = array();
|
||||
$target_given = $options['blacklist'];
|
||||
$target_sanitized = $target_given;
|
||||
if ( StatifyBlacklist::MODE_REGEX === $options['regexp'] || StatifyBlacklist::MODE_REGEX_CI === $options['regexp'] ) {
|
||||
$target_sanitized = $target_given;
|
||||
// Check regular expressions.
|
||||
$target_invalid = self::sanitize_regex( $target_given );
|
||||
} else {
|
||||
$target_sanitized = $target_given;
|
||||
$target_invalid = array();
|
||||
}
|
||||
$options['blacklist'] = $target_sanitized;
|
||||
|
||||
|
@ -89,9 +89,6 @@ class StatifyBlacklist_System extends StatifyBlacklist {
|
||||
|
||||
if ( function_exists( 'get_sites' ) ) {
|
||||
$sites = get_sites();
|
||||
} elseif ( function_exists( 'wp_get_sites' ) ) {
|
||||
// phpcs:ignore WordPress.WP.DeprecatedFunctions.wp_get_sitesFound -- Legacy support for WP < 4.6.
|
||||
$sites = wp_get_sites();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -189,7 +186,7 @@ class StatifyBlacklist_System extends StatifyBlacklist {
|
||||
);
|
||||
} elseif ( ! isset( $options['ua']['blacklist'] ) ) {
|
||||
$options['ua']['blacklist'] = array();
|
||||
} elseif ( isset( $options['ua'] ) ) {
|
||||
} else {
|
||||
// User agent strings got stored incorrectly in 1.6.0 - luckily the version was not updated, either.
|
||||
$options['ua']['blacklist'] = array_flip( $options['ua']['blacklist'] );
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "statify-blacklist",
|
||||
"version": "1.7.0",
|
||||
"version": "1.7.2",
|
||||
"description": "A filter extension for the famous Statify WordPress plugin",
|
||||
"author": "Stefan Kalscheuer",
|
||||
"license": "GPL-2.0+"
|
||||
|
@ -7,14 +7,17 @@
|
||||
* @license GPL-2.0+
|
||||
*
|
||||
* @wordpress-plugin
|
||||
* Plugin Name: Statify Filter
|
||||
* Plugin URI: https://wordpress.org/plugins/statify-blacklist/
|
||||
* Description: Extension for the Statify plugin to add customizable filters. (formerly "Statify Blacklist)
|
||||
* Version: 1.7.0
|
||||
* Author: Stefan Kalscheuer (@stklcode)
|
||||
* Author URI: https://www.stklcode.de
|
||||
* Text Domain: statify-blacklist
|
||||
* License: GPLv2 or later
|
||||
* Plugin Name: Statify Filter
|
||||
* Plugin URI: https://wordpress.org/plugins/statify-blacklist/
|
||||
* Description: Extension for the Statify plugin to add customizable filters. (formerly "Statify Blacklist)
|
||||
* Version: 1.7.2
|
||||
* Requires at least: 4.7
|
||||
* Requires PHP: 5.5
|
||||
* Requires Plugins: statify
|
||||
* Author: Stefan Kalscheuer (@stklcode)
|
||||
* Author URI: https://www.stklcode.de
|
||||
* Text Domain: statify-blacklist
|
||||
* License: GPLv2 or later
|
||||
*
|
||||
* Statify Filter is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
Reference in New Issue
Block a user