llms_deprecated_function( string $function, string $version, string $replacement = null )

Provide deprecation warnings


Description Description

Very similar to https://developer.wordpress.org/reference/functions/_deprecated_function/


Parameters Parameters

$function

(string) (Required) name of the deprecated class or function

$version

(string) (Required) version deprecation occurred

$replacement

(string) (Optional) function to use in it's place (optional)

Default value: null


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/llms.functions.core.php

function llms_deprecated_function( $function, $version, $replacement = null ) {

	// only warn if debug is enabled
	if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
		return;
	}

	if ( function_exists( '__' ) ) {

		if ( ! is_null( $replacement ) ) {
			$string = sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'lifterlms' ), $function, $version, $replacement );
		} else {
			$string = sprintf( __( '%1$s is <strong>deprecated</strong> since version %2$s!', 'lifterlms' ), $function, $version );
		}
	} else {

		if ( ! is_null( $replacement ) ) {
			$string = sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement );
		} else {
			$string = sprintf( '%1$s is <strong>deprecated</strong> since version %2$s!', $function, $version );
		}
	}

	// warn on screen
	if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
		echo '<br>' . $string . '<br>';
	}

	// log to the error logger
	if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
		llms_log( $string );
	}

}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: