Make WordPress Core

Ticket #35656: 35656.0.diff

File 35656.0.diff, 1.7 KB (added by westonruter, 8 years ago)

Add _doing_it_wrong()

  • src/wp-includes/widgets.php

    diff --git src/wp-includes/widgets.php src/wp-includes/widgets.php
    index b24b465..3807708 100644
    function wp_register_widget_control( $id, $name, $control_callback, $options = a 
    479479                return;
    480480        }
    481481
     482        if ( ! is_array( $control_callback ) || ! isset( $control_callback[0] ) || ! ( $control_callback[0] instanceof WP_Widget ) ) {
     483                _doing_it_wrong( __FUNCTION__, sprintf( __( 'Old style single widgets are deprecated. Refactor %s() into a new WP_Widget subclass.' ), $control_callback ), '4.5.0' );
     484        }
     485
    482486        if ( in_array($control_callback, $_wp_deprecated_widgets_callbacks, true) && !is_callable($control_callback) ) {
    483487                unset( $wp_registered_widgets[ $id ] );
    484488                return;
    function _register_widget_update_callback( $id_base, $update_callback, $options 
    533537                return;
    534538        }
    535539
     540        if ( ! is_array( $update_callback ) || ! isset( $update_callback[0] ) || ! ( $update_callback[0] instanceof WP_Widget ) ) {
     541                _doing_it_wrong( __FUNCTION__, sprintf( __( 'Old style single widgets are deprecated. Refactor %s() into a new WP_Widget subclass.' ), $update_callback ), '4.5.0' );
     542        }
     543
    536544        $widget = array(
    537545                'callback' => $update_callback,
    538546                'params' => array_slice(func_get_args(), 3)
    function _register_widget_form_callback($id, $name, $form_callback, $options = a 
    565573                return;
    566574        }
    567575
     576        if ( ! is_array( $form_callback ) || ! isset( $form_callback[0] ) || ! ( $form_callback[0] instanceof WP_Widget ) ) {
     577                _doing_it_wrong( __FUNCTION__, sprintf( __( 'Old style single widgets are deprecated. Refactor %s() into a new WP_Widget subclass.' ), $form_callback ), '4.5.0' );
     578        }
     579
    568580        if ( isset($wp_registered_widget_controls[$id]) && !did_action( 'widgets_init' ) )
    569581                return;
    570582