Permalink
Browse files

Remove index-extra.php. Move dashboard widget XHR callbacks to ajax-a…

…ctions.php. fixes #20242.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent ae6bf5b commit 1db1017721f617579a3188770f9ca2bd4f321394 nacin committed Mar 15, 2012
View
@@ -34,7 +34,10 @@
do_action( 'admin_init' );
-$core_actions_get = array( 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache', 'autocomplete-user' );
+$core_actions_get = array(
+ 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache',
+ 'autocomplete-user', 'dashboard-widgets',
+);
$core_actions_post = array(
'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link',
@@ -186,6 +186,26 @@ function wp_ajax_autocomplete_user() {
wp_die( json_encode( $return ) );
}
+function wp_ajax_dashboard_widgets() {
+ require ABSPATH . 'wp-admin/includes/dashboard.php';
+
+ switch ( $_GET['widget'] ) {
+ case 'dashboard_incoming_links' :
+ wp_dashboard_incoming_links();
+ break;
+ case 'dashboard_primary' :
+ wp_dashboard_primary();
+ break;
+ case 'dashboard_secondary' :
+ wp_dashboard_secondary();
+ break;
+ case 'dashboard_plugins' :
+ wp_dashboard_plugins();
+ break;
+ }
+ wp_die();
+}
+
/*
* Ajax helper.
*/
@@ -327,6 +327,9 @@
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif',
// 3.4
'wp-admin/images/logo-login.png',
+'wp-admin/index-extra.php',
+'wp-admin/network/index-extra.php',
+'wp-admin/user/index-extra.php',
);
/**
View
@@ -1,38 +0,0 @@
-<?php
-/**
- * Handle default dashboard widgets options AJAX.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-define('DOING_AJAX', true);
-
-/** Load WordPress Bootstrap */
-require_once( './admin.php' );
-
-/** Load WordPress Administration Dashboard API */
-require(ABSPATH . 'wp-admin/includes/dashboard.php' );
-
-@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
-send_nosniff_header();
-
-switch ( $_GET['jax'] ) {
-
-case 'dashboard_incoming_links' :
- wp_dashboard_incoming_links();
- break;
-
-case 'dashboard_primary' :
- wp_dashboard_primary();
- break;
-
-case 'dashboard_secondary' :
- wp_dashboard_secondary();
- break;
-
-case 'dashboard_plugins' :
- wp_dashboard_plugins();
- break;
-
-}
@@ -41,7 +41,7 @@ jQuery(document).ready( function($) {
if ( e.length ) {
p = e.parent();
setTimeout( function(){
- p.load( ajaxurl.replace( '/admin-ajax.php', '' ) + '/index-extra.php?jax=' + id, '', function() {
+ p.load( ajaxurl + '?action=dashboard-widgets&widget=' + id, '', function() {
p.hide().slideDown('normal', function(){
$(this).css('display', '');
});
@@ -1,13 +0,0 @@
-<?php
-/**
- * Handle default network dashboard widgets options AJAX.
- *
- * @package WordPress
- * @subpackage Multisite
- * @since 3.1.0
- */
-
-/** Load WordPress Administration Bootstrap */
-require_once( './admin.php' );
-
-require( '../index-extra.php' );
@@ -1,12 +0,0 @@
-<?php
-/**
- * Handle default dashboard widgets options AJAX.
- *
- * @package WordPress
- * @subpackage Administration
- * @since 3.1.0
- */
-
-require_once( './admin.php' );
-
-require( '../index-extra.php' );

0 comments on commit 1db1017

Please sign in to comment.