Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
11550f4
use wp_doing_ajax() instead of constant checking (#42)
stklcode Sep 10, 2025
61c3dc9
update minimum supported PHP version to 7.2 (#36)
stklcode Apr 26, 2024
05d2951
add type hints to method signatures
stklcode Apr 26, 2024
8c327cc
update minimum supported WordPress version to 5.1 (#43)
stklcode Sep 10, 2025
2fe5db4
use wp_doing_cron() instead of constant checking (#44)
stklcode Sep 10, 2025
89af04c
ci: update GitHub actions
stklcode Sep 10, 2025
3245621
introduce PHPStan static code analysis (#45)
stklcode Sep 10, 2025
62b9c5f
ci: bump sonarsource/sonarqube-scan-action from 5 to 6 (#46)
dependabot[bot] Sep 26, 2025
643b280
statify-blacklist
stklcode Nov 27, 2025
b841525
ci: update actions/checkout to v6
stklcode Nov 27, 2025
8a4f36e
ci: add PHP 8.5 to test matrix
stklcode Nov 27, 2025
f6a5a8e
declare compatibility with WordPress 6.9
stklcode Dec 21, 2025
24cd075
require PHP 7.4 or later (#47)
stklcode Dec 21, 2025
dd7d1aa
use null-coalescing operator where applicable
stklcode Dec 21, 2025
4e92146
docs: update PHP_CodeSniffer repository link (#48)
rodrigoprimo Mar 29, 2026
ab1b460
declare compatibility with WordPress 7.0
stklcode May 23, 2026
6d73a96
simplify multisite iteration in (un)install routine (#49)
stklcode May 23, 2026
fa5082a
fix parameter type of $case_sensitive in StatifyBlacklist::regex()
stklcode May 23, 2026
edb2b37
add section headers to options page
stklcode May 23, 2026
8da0f8d
pass an empty string instead of null to preg_match for sanitization
stklcode May 23, 2026
cb3e316
add some types to array parameters
stklcode May 24, 2026
d6d6c2b
prepare release 1.8.0
stklcode May 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
/package.json
/package-lock.json
/phpcs.xml
/phpstan.neon
/phpunit.xml
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ composer.lock export-ignore
CONTRIBUTING.md export-ignore
package.json export-ignore
phpcs.xml export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
25 changes: 21 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '5.6', '7.4', '8.0', '8.2', '8.4' ]
php: [ '7.4', '8.0', '8.2', '8.4', '8.5' ]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup PHP
Expand All @@ -25,7 +25,7 @@ jobs:
sed -i "s#<file name=\"${GITHUB_WORKSPACE}#<file name=\"/github/workspace#g" tests-clover.xml
- name: Analyze with SonarCloud
if: matrix.php == '8.2' && env.SONAR_TOKEN != ''
uses: sonarsource/sonarcloud-github-action@master
uses: sonarsource/sonarqube-scan-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand All @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -53,3 +53,20 @@ jobs:
run: composer install --no-interaction
- name: Code style checks for PHP
run: composer test-cs

phpstan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer
- name: Install PHP dependencies
run: composer install --no-interaction --prefer-dist --no-scripts
- name: PHPStan
run: composer phpstan
2 changes: 1 addition & 1 deletion .github/workflows/wordpress-plugin-asset-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Push to stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Clean README.md
run: tail -n +6 README.md > README.md.tmp && mv README.md.tmp README.md
- name: WordPress.org plugin asset/readme update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wordpress-plugin-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Package plugin
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wordpress-plugin-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Clean README.md
run: tail -n +6 README.md > README.md.tmp && mv README.md.tmp README.md
- name: WordPress Plugin Deploy
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The coverage is not yet perfect, but be invited to write tests for methods not y
This project, as part of the WordPress ecosystem adheres to the [WordPress Coding Standards](https://codex.wordpress.org/WordPress_Coding_Standards).
Please make sure that you are at least roughly familiar with those guidelines.

The code style is automatically checked for commits (including pull requests) using [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
The code style is automatically checked for commits (including pull requests) using [PHP CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer).
You can check your code against the configured ruleset yourself by running
`./vendor/bin/phpcs --standard=phpcs.xml your-edited-file.php` (assuming `composer install` has been executed) or the Robo task `robo test:cs` for a complete scan.

Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

# Statify Filter #
* Contributors: stklcode
* Requires at least: 4.7
* Tested up to: 6.8
* Requires PHP: 5.5
* Stable tag: 1.7.2
* Requires at least: 5.1
* Tested up to: 7.0
* Requires PHP: 7.4
* Stable tag: 1.8.0
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -55,8 +55,8 @@ The plugin is capable of handling multisite installations.
* Goto _Settings_ -> _Statify Filter_ to configure the plugin

### Requirements ###
* PHP 5.5 or above
* WordPress 4.7 or above
* PHP 7.4 or above
* WordPress 5.1 or above
* _Statify_ plugin installed and activated (1.5 or above)

## Frequently Asked Questions ##
Expand Down Expand Up @@ -92,9 +92,13 @@ Same for IPv6 prefixes like _2001:db8:a0b:12f0::/64_.

## Screenshots ##
1. Statify Filter settings page
2. Statify Filter settings page (continued)

## Upgrade Notice ##

### 1.8.0 ###
This release maintenance update that raises the minimum requirements to WordPress 5.1 and PHP 7.4.

### 1.7.2 ###
This is a bugfix release to restore the manual cleanup function that was broken since 1.7.0.

Expand All @@ -107,6 +111,12 @@ This is a service release with primarily internal rework. Tested up to 6.4 and P

## Changelog

### 1.8.0 / 24.05.2026 ###
* Minimum required WordPress version is 5.1
* Minimum required PHP version is 7.4
* Declared compatibility with WordPress 7.0
* Various internal code improvements

### 1.7.2 / 06.06.2024 ###
* Restore manual database cleanup functionality

Expand Down
Binary file modified assets/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 15 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stklcode/statify-blacklist",
"version": "1.7.2",
"version": "1.8.0",
"description": "A filter extension for the famous Statify WordPress plugin",
"keywords": [
"wordpress",
Expand All @@ -18,17 +18,19 @@
],
"type": "wordpress-plugin",
"require": {
"php": ">=5.5",
"composer/installers": "~v1.12|~v2.3"
"php": ">=7.4",
"composer/installers": "~v2.3"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^v1.0",
"phpunit/phpunit": "^5|^6|^7|^8|^9",
"phpunit/php-code-coverage": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^v1.2",
"phpunit/phpunit": "^8|^9",
"slowprog/composer-copy-file": "~0.3",
"squizlabs/php_codesniffer": "^3.12",
"squizlabs/php_codesniffer": "^3.13",
"szepeviktor/phpstan-wordpress": "^v2.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^3.1"
"wp-coding-standards/wpcs": "^3.3"
},
"scripts": {
"test-all": [
Expand All @@ -43,12 +45,16 @@
],
"fix-cs": [
"phpcbf --standard=phpcs.xml"
],
"phpstan": [
"phpstan analyse --memory-limit=1G"
]
},
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
}
}
37 changes: 17 additions & 20 deletions inc/class-statifyblacklist-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @since 1.5.0
*/
public static function init() {
public static function init(): void {
// Add actions.
add_action( 'wpmu_new_blog', array( 'StatifyBlacklist_System', 'install_site' ) );
add_action( 'delete_blog', array( 'StatifyBlacklist_System', 'uninstall_site' ) );
Expand All @@ -36,10 +36,7 @@
add_action( 'network_admin_menu', array( 'StatifyBlacklist_Admin', 'add_menu_page' ) );
add_filter(
'network_admin_plugin_action_links',
array(
'StatifyBlacklist_Admin',
'plugin_actions_links',
),
array( 'StatifyBlacklist_Admin', 'plugin_actions_links' ),
10,
2
);
Expand All @@ -55,7 +52,7 @@
*
* @since 1.0.0
*/
public static function add_menu_page() {
public static function add_menu_page(): void {
$title = __( 'Statify Filter', 'statify-blacklist' );
if ( self::$multisite ) {
add_options_page(
Expand All @@ -79,14 +76,14 @@
/**
* Add plugin meta links
*
* @param array $links Registered links.
* @param string $file The filename.
* @param string[] $links Registered links.
* @param string $file The filename.
*
* @return array Merged links.
* @return string[] Merged links.
*
* @since 1.0.0
*/
public static function plugin_meta_link( $links, $file ) {
public static function plugin_meta_link( array $links, string $file ): array {
if ( STATIFYBLACKLIST_BASE === $file ) {
$links[] = '<a href="https://github.com/stklcode/statify-blacklist">GitHub</a>';
}
Expand All @@ -97,14 +94,14 @@
/**
* Add plugin action links.
*
* @param array $links Registered links.
* @param string $file The filename.
* @param string[] $links Registered links.
* @param string $file The filename.
*
* @return array Merged links.
* @return string[] Merged links.
*
* @since 1.0.0
*/
public static function plugin_actions_links( $links, $file ) {
public static function plugin_actions_links( array $links, string $file ): array {
$base = self::$multisite ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );

if ( STATIFYBLACKLIST_BASE === $file && current_user_can( 'manage_options' ) ) {
Expand All @@ -124,13 +121,13 @@
*
* @global wpdb $wpdb WordPress database.
*/
public static function cleanup_database() {
public static function cleanup_database(): void {
// Check user permissions.
if ( ! current_user_can( 'manage_options' ) && ! ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
if ( ! current_user_can( 'manage_options' ) && ! wp_doing_cron() ) {
die( esc_html__( 'Are you sure you want to do this?', 'statify-blacklist' ) );
}

if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
if ( wp_doing_cron() ) {
$clean_ref = ( 1 === self::$options['referer']['cron'] );
$clean_trg = ( 1 === self::$options['target']['cron'] );
} else {
Expand Down Expand Up @@ -167,7 +164,7 @@
// Execute filter on database.
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- These statements produce warnings, rework in future release (TODO).
if ( ! empty( $referer_regexp ) ) {
$wpdb->query(

Check warning on line 167 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.NoCaching

Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().

Check warning on line 167 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.DirectQuery

Use of a direct database call is discouraged.

Check warning on line 167 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.NoCaching

Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().

Check warning on line 167 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.DirectQuery

Use of a direct database call is discouraged.
$wpdb->prepare(
"DELETE FROM `$wpdb->statify` WHERE "
. ( ( 1 === self::$options['referer']['regexp'] ) ? ' BINARY ' : '' )
Expand All @@ -177,7 +174,7 @@
);
}
if ( ! empty( $target_regexp ) ) {
$wpdb->query(

Check warning on line 177 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.NoCaching

Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().

Check warning on line 177 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.DirectQuery

Use of a direct database call is discouraged.

Check warning on line 177 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.NoCaching

Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().

Check warning on line 177 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.DirectQuery

Use of a direct database call is discouraged.
$wpdb->prepare(
"DELETE FROM `$wpdb->statify` WHERE "
. ( ( 1 === self::$options['target']['regexp'] ) ? ' BINARY ' : '' )
Expand All @@ -189,7 +186,7 @@
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared

// Optimize DB.
$wpdb->query( "OPTIMIZE TABLE `$wpdb->statify`" );

Check warning on line 189 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.NoCaching

Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().

Check warning on line 189 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.DirectQuery

Use of a direct database call is discouraged.

Check warning on line 189 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.NoCaching

Direct database call without caching detected. Consider using wp_cache_get() / wp_cache_set() or wp_cache_delete().

Check warning on line 189 in inc/class-statifyblacklist-admin.php

View workflow job for this annotation

GitHub Actions / check

WordPress.DB.DirectDatabaseQuery.DirectQuery

Use of a direct database call is discouraged.

// Delete transient statify data.
delete_transient( 'statify_data' );
Expand All @@ -200,13 +197,13 @@
/**
* Sanitize URLs and remove empty results.
*
* @param array $urls given array of URLs.
* @param string[] $urls given array of URLs.
*
* @return array sanitized array.
* @return string[] sanitized array.
*
* @since 1.1.1
*/
private static function sanitize_urls( $urls ) {
private static function sanitize_urls( array $urls ): array {
return array_flip(
array_filter(
array_map(
Expand Down
Loading
Loading