While working on project an interesting problem arose, needing to pass an additional parameter to a WordPress filter. Normally filters only allow for a set number of parameters, but the particular filter needed an additional parameter that could be passed when calling the filter.
The problem was being able to run a WP_Query for a set number of days passed. This is normally accomplished with a simple filter that is applied to posts_where. The problem is the number of days would be variable, since it was being set via a widget option. To get around this using OOP and create a new class that stores the variable and that will be passed when calling the filter. While the example below is a specific solution to the problem above it can be adapted for pretty well any filter that needs another parameter that can be set when calling the filter.