| 3419 | * Marks a constructor as deprecated and informs when it has been used. |
| 3420 | * |
| 3421 | * Similar to _deprecated_function(), but with different strings. Used to |
| 3422 | * remove PHP4 style constructors. |
| 3423 | * |
| 3424 | * The current behavior is to trigger a user error if WP_DEBUG is true. |
| 3425 | * |
| 3426 | * This function is to be used in every PHP4 style constructor method that is deprecated. |
| 3427 | * |
| 3428 | * @since 4.3.0 |
| 3429 | * |
| 3430 | * @access private |
| 3431 | * |
| 3432 | * @param string $class The class containing the deprecated constructor. |
| 3433 | * @param string $version The version of WordPress that deprecated the function. |
| 3434 | */ |
| 3435 | function _deprecated_constructor( $class, $version ) { |
| 3436 | |
| 3437 | /** |
| 3438 | * Fires when a deprecated constructor is called. |
| 3439 | * |
| 3440 | * @since 4.3.0 |
| 3441 | * |
| 3442 | * @param string $class The class containing the deprecated constructor. |
| 3443 | * @param string $version The version of WordPress that deprecated the function. |
| 3444 | */ |
| 3445 | do_action( 'deprecated_constructor_run', $class, $version ); |
| 3446 | |
| 3447 | /** |
| 3448 | * Filter whether to trigger an error for deprecated functions. |
| 3449 | * |
| 3450 | * @since 4.3.0 |
| 3451 | * |
| 3452 | * @param bool $trigger Whether to trigger the error for deprecated functions. Default true. |
| 3453 | */ |
| 3454 | if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) { |
| 3455 | if ( function_exists( '__' ) ) { |
| 3456 | trigger_error( sprintf( __( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), $class, $version, '<pre>__construct()</pre>' ) ); |
| 3457 | } else { |
| 3458 | trigger_error( sprintf( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $class, $version, '<pre>__construct()</pre>' ) ); |
| 3459 | } |
| 3460 | } |
| 3461 | |
| 3462 | } |
| 3463 | |
| 3464 | /** |