diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index 349acfa..dc21fc6 100644
|
|
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ |
146 | 146 | $screen = get_current_screen(); |
147 | 147 | global $wp_dashboard_control_callbacks; |
148 | 148 | |
| 149 | $private_callback_args = array( '__widget_basename' => $widget_name ); |
| 150 | |
| 151 | if ( is_null( $callback_args ) ) { |
| 152 | $callback_args = $private_callback_args; |
| 153 | } else if ( is_array( $callback_args ) ) { |
| 154 | $callback_args = array_merge( $callback_args, $private_callback_args ); |
| 155 | } |
| 156 | |
149 | 157 | if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { |
150 | 158 | $wp_dashboard_control_callbacks[$widget_id] = $control_callback; |
151 | 159 | if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { |
diff --git src/wp-admin/includes/screen.php src/wp-admin/includes/screen.php
index a72a807..6313c7f 100644
|
|
function meta_box_prefs( $screen ) { |
117 | 117 | // Submit box cannot be hidden |
118 | 118 | if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) |
119 | 119 | continue; |
120 | | $box_id = $box['id']; |
121 | | echo '<label for="' . $box_id . '-hide">'; |
122 | | echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />'; |
123 | | echo "{$box['title']}</label>\n"; |
| 120 | |
| 121 | $widget_title = $box['title']; |
| 122 | |
| 123 | if ( isset( $box['args']['__widget_basename'] ) ) { |
| 124 | $widget_title = $box['args']['__widget_basename']; |
| 125 | } |
| 126 | |
| 127 | printf( |
| 128 | '<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>', |
| 129 | esc_attr( $box['id'] ), |
| 130 | checked( in_array( $box['id'], $hidden ), false, false ), |
| 131 | $widget_title |
| 132 | ); |
124 | 133 | } |
125 | 134 | } |
126 | 135 | } |
diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
index bc103fa..b38ee68 100644
|
|
function do_meta_boxes( $screen, $context, $object ) { |
1027 | 1027 | $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : ''; |
1028 | 1028 | echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n"; |
1029 | 1029 | 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 | |
1030 | 1038 | 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>'; |
1032 | 1040 | echo '<span class="toggle-indicator" aria-hidden="true"></span>'; |
1033 | 1041 | echo '</button>'; |
1034 | 1042 | } |