Make WordPress Core

Ticket #29389: 29389.patch

File 29389.patch, 3.0 KB (added by SergeyBiryukov, 12 years ago)
  • src/wp-admin/options-general.php

     
    332332                                        </p>
    333333                                        <?php
    334334                                }
    335                                 _deprecated_argument( 'define()', '4.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
     335                                _deprecated_constant( 'WPLANG', '4.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
    336336                        }
    337337                        ?>
    338338                </td>
  • src/wp-includes/functions.php

     
    33283328}
    33293329
    33303330/**
     3331 * Mark a constant as deprecated and inform when it has been used.
     3332 *
     3333 * There is a hook deprecated_constant_used that will be called that can be used
     3334 * to get the backtrace up to what file and function used the deprecated
     3335 * constant.
     3336 *
     3337 * The current behavior is to trigger a user error if WP_DEBUG is true.
     3338 *
     3339 * This function is to be used whenever a deprecated constant is used.
     3340 *
     3341 * @since 4.0.0
     3342 * @access private
     3343 *
     3344 * @param string $constant The constant that was used.
     3345 * @param string $version  The version of WordPress that deprecated the constant.
     3346 * @param string $message  Optional. A message regarding the change. Default null.
     3347 */
     3348function _deprecated_constant( $constant, $version, $message = null ) {
     3349
     3350        /**
     3351         * Fires when a deprecated constant is used.
     3352         *
     3353         * @since 4.0.0
     3354         *
     3355         * @param string $constant The constant that was called.
     3356         * @param string $message  A message regarding the change.
     3357         * @param string $version  The version of WordPress that deprecated the constant used.
     3358         */
     3359        do_action( 'deprecated_constant_used', $constant, $message, $version );
     3360
     3361        /**
     3362         * Filter whether to trigger an error for deprecated constants.
     3363         *
     3364         * @since 4.0.0
     3365         *
     3366         * @param bool $trigger Whether to trigger the error for deprecated constants. Default true.
     3367         */
     3368        if ( WP_DEBUG && apply_filters( 'deprecated_constant_trigger_error', true ) ) {
     3369                if ( function_exists( '__' ) ) {
     3370                        if ( ! is_null( $message ) )
     3371                                trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! %3$s'), $constant, $version, $message ) );
     3372                        else
     3373                                trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $constant, $version ) );
     3374                } else {
     3375                        if ( ! is_null( $message ) )
     3376                                trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! %3$s', $constant, $version, $message ) );
     3377                        else
     3378                                trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $constant, $version ) );
     3379                }
     3380        }
     3381}
     3382
     3383/**
    33313384 * Mark something as being incorrectly called.
    33323385 *
    33333386 * There is a hook doing_it_wrong_run that will be called that can be used