Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Engagement_Handler::do_deprecated_filter( mixed $args, array $init_args, string $type, string $deprecated, string $replacement )
Handles deprecated filters which have additional parameters from now deprecated classes.
Description Description
If there are no callbacks attached to the deprecated hook the original $args is returned and no warnings will be emitted.
This instantiates an initialized instance of the deprecated class and passes it with the original filtered argument through apply_filters_deprecated
. This results in several deprecation warnings being emitted but ensures that these filters can continue to work in a backwards compatible manner.
This method is a public method but it is intentionally marked as private to denote its temporary lifespan. It will be removed alongside the deprecated filters it calls as it will no longer be necessary when the deprecated hooks are fully removed. As such, this method is considered private for the purposes of semantic versioning and will removed in the next major release without being officially deprecated.
Parameters Parameters
- $args
-
(mixed) (Required) The filtered argument (not an array of arguments).
- $init_args
-
(array) (Required) An array of arguments used to initialize the old object.
- (int) WP_Post ID of the template post, either an
llms_certificate
orllms_achievement
. - '1'
(int) WP_User ID of the user. - '2'
(int|string) WP_Post ID of the related post or an empty string during user registration.
- (int) WP_Post ID of the template post, either an
- $type
-
(string) (Required) The engagement type, either "achievement" or "certificate".
- $deprecated
-
(string) (Required) The deprecated filter to call.
- $replacement
-
(string) (Required) The replacement hook.
Return Return
(mixed)
Source Source
File: includes/class-llms-engagement-handler.php
public static function do_deprecated_filter( $args, $init_args, $type, $deprecated, $replacement ) { if ( has_filter( $deprecated ) ) { $old_class = sprintf( 'LLMS_%s_User', strtoupper( $type ) ); /** * Retains deprecated functionality where an instance of LLMS_Certificate_User is passed as a parameter to the filter. * * Since there's no good way to recreate that functionality we'll handle it in this manner * until `LLMS_Certificate_User` is removed. */ $old_obj = new $old_class(); $old_obj->init( ...$init_args ); $args = apply_filters_deprecated( $deprecated, array( $args, $old_obj ), '6.0.0', $replacement ); } return $args; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Introduced. |