Changeset 6717
- Timestamp:
- 02/04/2008 08:38:48 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r6705 r6717 109 109 $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets ); 110 110 111 $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets );111 $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets, 'array_version' => 3.5 ); 112 112 113 113 add_filter( 'dynamic_sidebar_params', 'wp_dashboard_dynamic_sidebar_params' ); -
trunk/wp-admin/includes/widgets.php
r6679 r6717 22 22 $already_shown = array(); 23 23 foreach ( $wp_registered_widgets as $name => $widget ) : 24 if ( in_array( $widget['callback'], $already_shown ) ) 24 if ( in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget 25 25 continue; 26 $already_shown[] = $widget['callback'];27 26 28 27 if ( $search_terms ) { … … 53 52 54 53 if ( !$sidebar || false !== strpos( $widget_control_template, '%i%' ) ) { 54 $already_shown[] = $widget['callback']; // it's a multi-widget. We only need to show it in the list once. 55 55 $action = 'add'; 56 56 $add_url = wp_nonce_url( add_query_arg( array( … … 67 67 'key' => array_search( $widget['id'], $sidebars_widgets[$sidebar] ), 68 68 ) ); 69 $widget_control_template = "<textarea>$widget_control_template</textarea>";69 $widget_control_template = '<textarea>' . htmlspecialchars( $widget_control_template ) . '</textarea>'; 70 70 } 71 71 -
trunk/wp-admin/widgets.php
r6556 r6717 53 53 /* Hack #1 54 54 * The widget_control is overloaded. It updates the widget's options AND echoes out the widget's HTML form. 55 * Since we want to update before sending out any headers, we have to catch i it with an output buffer55 * Since we want to update before sending out any headers, we have to catch it with an output buffer, 56 56 */ 57 57 ob_start(); 58 58 /* There can be multiple widgets of the same type, but the widget_control for that 59 * widget type needs only be called once .59 * widget type needs only be called once if it's a multi-widget. 60 60 */ 61 61 $already_done = array(); … … 65 65 continue; 66 66 67 if ( is_callable( $control['callback'] ) ) 67 if ( is_callable( $control['callback'] ) ) { 68 68 call_user_func_array( $control['callback'], $control['params'] ); 69 $control_output = ob_get_contents(); 70 if ( false !== strpos( $control_output, '%i%' ) ) // if it's a multi-widget, only call control function once. 71 $already_done[] = $control['callback']; 72 } 73 74 ob_clean(); 69 75 } 70 76 ob_end_clean(); … … 76 82 77 83 // Reset the key numbering and stare 78 $new_sidebar = array_values( $_POST['widget-id']);84 $new_sidebar = isset( $_POST['widget-id'] ) && is_array( $_POST['widget-id'] ) ? array_values( $_POST['widget-id'] ) : array(); 79 85 $sidebars_widgets[$_POST['sidebar']] = $new_sidebar; 80 86 wp_set_sidebars_widgets( $sidebars_widgets ); -
trunk/wp-includes/widgets.php
r6705 r6717 160 160 * height: never used 161 161 * width: width of fully expanded control form. Try hard to use the default width. 162 * id_base: for widgets which allow multiple instances (such as the text widget), an id_base must be provided.162 * id_base: for multi-widgets (widgets which allow multiple instances such as the text widget), an id_base must be provided. 163 163 * the widget id will ennd up looking like {$id_base}-{$unique_number} 164 164 */ … … 1390 1390 add_action('init', 'wp_widgets_init', 1); 1391 1391 1392 /* Pattern for widget which allows multiple instances (such as the text widget)1392 /* Pattern for multi-widget (allows multiple instances such as the text widget). 1393 1393 1394 1394 // Displays widget on blag
Note: See TracChangeset
for help on using the changeset viewer.