69 Commits

Author SHA1 Message Date
3b169b28a7
update settings version to 1.7 2023-09-17 15:19:10 +02:00
633da4086d
unique IP filter list 2023-09-17 14:58:33 +02:00
da6cde00cf
migrate settings to WP settings API 2023-09-17 14:58:25 +02:00
93b4dd744d
remove useless parenthesis around DOING_AUTOSAVE check 2023-08-14 18:47:55 +02:00
aaf054fb5b
minor code style tweaks 2023-04-01 15:14:40 +02:00
a533a494fa
remove deprecated FILTER_SANITIZE_STRING usage 2023-02-25 14:17:24 +01:00
8267e408f0
simply regex quantifiers and parse IPs to lowercase
Use ? instead of {0,1} and {3} instead of {3,3} where applicable.
Number groups [ß-9] are left as is for readability, i.e. prefer
[1-9][0-9] over [1-9]\d.

The whole expression is evaluated case-insensitive now, so we can omit
the "a-fA-F" and simply use "a-f".

Unit-tests extended accordingly.
2022-11-04 10:42:36 +01:00
BananaSquishee
6ffa650254
fix storage of user agent filter list (#28)
The user agent filer list is not flipped with the actual values as keys
like the lists for referrer and target. Hence the numeric keys are
compared against the actual user agent. We now flip the values in the
upgrade hook.
2021-05-28 11:11:30 +02:00
f424909515 reduce redundancies for recurring matching loops
Referer, target and user agent filter share most of their logic
for different matching methods. We introduce a common routine for
all of them to not repeat ourselves. Passing a value extractor by
reference allows lazy evaluation (filter might be disabled) and
overrides for different cases (i.e. domain extractor for exact match).
2020-10-26 19:23:32 +01:00
a6cc821089 implement user agent filter
A new live-only filter block for user agent strings is now available.
It features the known exact, keyword and regular expression modes.
2020-10-26 19:23:32 +01:00
06a7b1677a rename plugin to "Statify Filter"
The plugins purpose is to exclude or filter certain requests from
tracking by Statify. However the current name "Statify Blacklist" is not
actually inline with today's understanding of such terms. In WordPress
Core 5.5 the word "blacklist" among others has been replaced by more
precise wording where possible.

The term "filter" has been used in various places already and clearly
describes the behavior of this plugin. So we rename the plugin to
"Statify Filter" and rephrase front-end texts.

Plugin slug (permalink), textdomain and all public class and constant
names left untouched for now, to not introduce breaking changes at this
point. To be cleaned up with next major release.
2020-10-19 10:34:09 +02:00
e4fd34d036 do not rely on WP core translation and add textdomain for all texts 2020-09-03 20:49:01 +02:00
902e211552
postpone jump out on AJAX calls for Statify 1.7 compatibility (#22)
Statify 1.7 changed the JS tacking endpoint to WP AJAX, so we must not
skip the complete initialization on AJAX calls anymore. The routine now
breaks after adding the filter (if necessary).
2020-05-20 10:26:57 +02:00
aa9980106e update phpcs ignore statements; PHPdoc indentation 2020-05-10 12:13:39 +02:00
31c04d6b92 sanitize referer URI 2020-05-10 12:00:41 +02:00
ac73b2316d typo fixes 2020-05-10 11:35:18 +02:00
ebc44c722e use long array syntax
For some reason short syntax is discouraged in the latest WPCS ruleset.
To stay in line with WPCS we use long syntax now.
2020-01-07 19:30:38 +01:00
3f5990f1f3 update PHPCS ruleset and re-enable warnings 2019-10-06 18:07:42 +02:00
84cf79fd04 remove underscore prefix from options field 2019-10-06 17:52:08 +02:00
44ee7ee839 Check regular expressions and prevent saving invalid settings (#13) 2019-03-17 17:34:57 +01:00
1c69ba31bb Preprocessing of regular expression in separate funciton 2019-03-17 17:34:47 +01:00
39dcce3eeb Harmonize helper funcitons to snake_case 2019-03-17 17:25:43 +01:00
b7c3b51873 implement keyword filter for referer blacklist (closes #15)
In addition to the pre-existing normal and regular expression filters a
keyword mode is added. This filter matches if the referer string
contains a given keyword (case insensitive).
2019-03-12 19:37:48 +01:00
b691f2c618 adjust sanitization of settings and warning messages 2019-03-06 17:23:06 +01:00
74f2e0f9a7 Removed deprecated instance() and __construct() methods from base class 2018-10-27 18:42:46 +02:00
74826384a8 Moved admin initialization to admin class 2018-10-27 18:34:23 +02:00
59ff52cdef Merge if-clauses for cron job detection 2018-10-27 17:44:13 +02:00
bcd42bde2a Minor code style fixes 2018-10-20 10:12:38 +02:00
f34b761942 Removed load_plugin_textdomain and domain path header
Translation is handled via translate.wordpress.org and minimum required
version is greater than 4.6, so the local translation artifacts are
dropped.
2018-05-19 15:09:57 +02:00
74be5a2334 Merge branch 'hf12-regexSkip' into develop 2018-05-19 14:31:47 +02:00
92f8496926 Fix #12: do not skip filter chain on non-matching regex filter
Corrected the regular expression methods and unit-tested combined filters.
2018-05-19 14:22:15 +02:00
8c556ca509 Removed legacy code for WP prior to 4.6
Statify itself requires WP 4.7, so no reason to stick to legacy code
anymore.
2018-03-21 18:16:25 +01:00
5956059327 Cleaned up option handling for multisite
Multisite detection has been executed multiple times while the status is present in class variable after initialization.
2018-01-07 16:17:27 +01:00
c2ad908481 Fixed menu page for multisite activation 2018-01-07 16:16:01 +01:00
8b9ce4c570 Fixed issues with multisite installation (#11) 2018-01-07 14:14:48 +01:00
eb63299dfc Minor code styling.
* Added some equals-alignments and removed require_once paranthesis.
* Notice: _add_menu_page() has been renamed to add_menu_page()
2017-11-12 12:12:51 +01:00
f061b4c194 _add_menu_page in admin class made static
This method has been non-static for not reason which lead to reasonable warning. Simply declared static now, as there are no instance dependencies.
2017-11-12 12:12:51 +01:00
aa40945ebd Replaced superfluous instantiation of Object with static init() method 2017-08-20 11:22:39 +02:00
c7c0f9e346 Fix filter hook if referer is disabled (#9)
The filter was only appended, if the referer live filter is set active. Now the condition checks for any available blacklist.
2017-07-16 14:14:25 +02:00
089ed347fa Code style again
Altered variable names from camel to snake case, renamed class files from *.class.php to class-*.php, added some comments.
2017-07-16 12:34:49 +02:00
3206da2861 Fix cidr_match() for IPv6 with PHP 7.1
With PHP 7.1 implicit conversion of non-trimmed strings to integer raises an error. Input value fpr IPv6 subnets is now trimmed and a check for numeric value is added.
2017-07-15 17:50:55 +02:00
4890dbaeeb Corrections for WP Coding Standard
All PHP classes have been reworked to match the WP coding standard. This includes mostly code styling, but also the use of wp_ functions instead of PHP builtins.
2017-07-15 15:58:43 +02:00
d769c6789c Yoda conditions and strict comparison 2017-07-04 16:52:11 +02:00
5b1e490ace Comments and code style reworked
To adhere a little more to the WP Coding Standards, PHPdoc blocks and inline have been reworked. No code has been changed.
2017-07-04 14:56:56 +02:00
76cd908861 Preparations for 1.4.0 release 2017-06-10 14:44:03 +02:00
0bf0f3fb9b Change filter hook name to statify__skip_tracking (as of Statify 1.5.0) 2017-06-10 14:36:38 +02:00
7929dd66bd PHPdoc and ReadMe corrections 2017-06-05 18:13:36 +02:00
df59e43b29 Config array restructured 2017-06-05 12:03:11 +02:00
152a800a4a #8 Target filter implemented 2017-06-04 21:29:08 +02:00
4a0fee572b #7 implementation of IP blacklists 2017-06-04 11:42:21 +02:00