Make WordPress Core

Ticket #35021: 35021.patch

File 35021.patch, 2.0 KB (added by nicholas_io, 9 years ago)
  • wp-admin/includes/dashboard.php

     
    143143        $screen = get_current_screen();
    144144        global $wp_dashboard_control_callbacks;
    145145
     146        $private_callback_args = array( '__widget_basename' => $widget_name );
     147
     148        if ( is_null( $callback_args ) ) {
     149                $callback_args = $private_callback_args;
     150        } else if ( is_array( $callback_args ) ) {
     151                $callback_args = array_merge( $callback_args, $private_callback_args );
     152        }
     153
    146154        if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
    147155                $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
    148156                if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
  • wp-admin/includes/template.php

     
    10271027                                        $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
    10281028                                        echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
    10291029                                        if ( 'dashboard_browser_nag' != $box['id'] ) {
     1030                                                $widget_title =  $box[ 'title' ];
     1031
     1032                                                if ( is_array( $box[ 'args' ] ) && isset( $box[ 'args' ][ '__widget_basename' ] ) ) {
     1033                                                        $widget_title = esc_html( $box[ 'args' ][ '__widget_basename' ] );
     1034                                                        //do not pass this parameter to the user callback function
     1035                                                        unset( $box[ 'args' ][ '__widget_basename' ] );
     1036                                                }
     1037
    10301038                                                echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
    1031                                                 echo '<span class="screen-reader-text">' . sprintf( __( 'Toggle panel: %s' ), $box['title'] ) . '</span>';
     1039                                                echo '<span class="screen-reader-text">' . sprintf( __( 'Toggle panel: %s' ), $widget_title ) . '</span>';
    10321040                                                echo '<span class="toggle-indicator" aria-hidden="true"></span>';
    10331041                                                echo '</button>';
    10341042                                        }