Make WordPress Core

Ticket #33440: 35470.patch

File 35470.patch, 3.6 KB (added by sebastian.pisula, 9 years ago)
  • wp-includes/class-wp-widget.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    168168         * @param array  $control_options
    169169         */
    170170        public function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array() ) {
    171                 _deprecated_constructor( 'WP_Widget', '4.3.0' );
     171                _deprecated_constructor( 'WP_Widget', '4.3.0', get_class( $this ) );
    172172                WP_Widget::__construct( $id_base, $name, $widget_options, $control_options );
    173173        }
    174174
  • wp-includes/functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    36283628 * This function is to be used in every PHP4 style constructor method that is deprecated.
    36293629 *
    36303630 * @since 4.3.0
     3631 * @since 4.5.0 Parent Class.
     3632 *
    36313633 * @access private
    36323634 *
    36333635 * @param string $class   The class containing the deprecated constructor.
    36343636 * @param string $version The version of WordPress that deprecated the function.
     3637 * @param string $parent_class The parent class.
    36353638 */
    3636 function _deprecated_constructor( $class, $version ) {
     3639function _deprecated_constructor( $class, $version, $parent_class = '' ) {
    36373640
    36383641        /**
    36393642         * Fires when a deprecated constructor is called.
    36403643         *
    36413644         * @since 4.3.0
     3645         * @since 4.5.0 Add param `$parent_class`
    36423646         *
    36433647         * @param string $class   The class containing the deprecated constructor.
    36443648         * @param string $version The version of WordPress that deprecated the function.
     3649         * @param string $parent_class The parent class.
    36453650         */
    3646         do_action( 'deprecated_constructor_run', $class, $version );
     3651        do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
    36473652
    36483653        /**
    36493654         * Filter whether to trigger an error for deprecated functions.
     
    36563661         */
    36573662        if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
    36583663                if ( function_exists( '__' ) ) {
    3659                         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>' ) );
    3660                 } else {
    3661                         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>' ) );
     3664                        if ( ! empty( $parent_class ) ) {
     3665                                trigger_error( sprintf( __( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
     3666                                                $class, $parent_class, $version, '<pre>__construct()</pre>' ) );
     3667                        } else {
     3668                                trigger_error( sprintf( __( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
     3669                                                $class, $version, '<pre>__construct()</pre>' ) );
     3670                        }
     3671                } else {
     3672                        if ( ! empty( $parent_class ) ) {
     3673                                trigger_error( sprintf( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
     3674                                                $class, $version, '<pre>__construct()</pre>' ) );
     3675                        } else {
     3676                                trigger_error( sprintf( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
     3677                                                $class, $parent_class, $version, '<pre>__construct()</pre>' ) );
     3678                        }
    36623679                }
    36633680        }
    36643681