Permalink
Browse files

Remove AJAX from list tables. first pass. see #16262.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 94eb65b commit 37075f7f715d06e8416ccb9f473e471236127e71 nacin committed Jan 16, 2011
Showing with 60 additions and 79 deletions.
  1. +1 −1 wp-admin/edit-comments.php
  2. +1 −1 wp-admin/edit-tags.php
  3. +1 −1 wp-admin/edit.php
  4. +4 −2 wp-admin/includes/class-wp-comments-list-table.php
  5. +1 −0 wp-admin/includes/class-wp-links-list-table.php
  6. +18 −24 wp-admin/includes/class-wp-list-table.php
  7. +1 −0 wp-admin/includes/class-wp-media-list-table.php
  8. +1 −0 wp-admin/includes/class-wp-ms-sites-list-table.php
  9. +1 −0 wp-admin/includes/class-wp-ms-themes-list-table.php
  10. +1 −0 wp-admin/includes/class-wp-ms-users-list-table.php
  11. +1 −0 wp-admin/includes/class-wp-plugin-install-list-table.php
  12. +1 −0 wp-admin/includes/class-wp-plugins-list-table.php
  13. +1 −0 wp-admin/includes/class-wp-posts-list-table.php
  14. +1 −0 wp-admin/includes/class-wp-terms-list-table.php
  15. +2 −1 wp-admin/includes/class-wp-theme-install-list-table.php
  16. +2 −1 wp-admin/includes/class-wp-themes-list-table.php
  17. +1 −0 wp-admin/includes/class-wp-users-list-table.php
  18. +4 −23 wp-admin/includes/list-table.php
  19. +1 −1 wp-admin/includes/meta-boxes.php
  20. +2 −2 wp-admin/includes/template.php
  21. +2 −2 wp-admin/includes/update.php
  22. +1 −1 wp-admin/link-manager.php
  23. +1 −1 wp-admin/network/site-themes.php
  24. +1 −1 wp-admin/network/site-users.php
  25. +1 −1 wp-admin/network/sites.php
  26. +1 −1 wp-admin/network/themes.php
  27. +1 −1 wp-admin/network/users.php
  28. +1 −1 wp-admin/plugin-install.php
  29. +1 −1 wp-admin/plugins.php
  30. +1 −1 wp-admin/theme-install.php
  31. +1 −1 wp-admin/themes.php
  32. +1 −1 wp-admin/upload.php
  33. +1 −1 wp-admin/users.php
  34. +0 −8 wp-includes/script-loader.php
@@ -11,7 +11,7 @@
if ( !current_user_can('edit_posts') )
wp_die(__('Cheatin’ uh?'));
-$wp_list_table = get_list_table('WP_Comments_List_Table');
+$wp_list_table = _get_list_table('WP_Comments_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$doaction = $wp_list_table->current_action();
View
@@ -12,7 +12,7 @@
if ( !current_user_can( $tax->cap->manage_terms ) )
wp_die( __( 'Cheatin’ uh?' ) );
-$wp_list_table = get_list_table('WP_Terms_List_Table');
+$wp_list_table = _get_list_table('WP_Terms_List_Table');
$title = $tax->labels->name;
View
@@ -23,7 +23,7 @@
if ( !current_user_can($post_type_object->cap->edit_posts) )
wp_die(__('Cheatin’ uh?'));
-$wp_list_table = get_list_table('WP_Posts_List_Table');
+$wp_list_table = _get_list_table('WP_Posts_List_Table');
$pagenum = $wp_list_table->get_pagenum();
// Back-compat for viewing comments of an entry
@@ -13,6 +13,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Comments_List_Table extends WP_List_Table {
@@ -266,7 +267,7 @@ function get_sortable_columns() {
function display() {
extract( $this->_args );
- wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+ // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
$this->display_tablenav( 'top' );
@@ -509,6 +510,7 @@ function column_default( $comment, $column_name ) {
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*
* @see WP_Comments_Table
*/
@@ -536,7 +538,7 @@ function get_table_classes() {
function display( $output_empty = false ) {
extract( $this->_args );
- wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+ // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
?>
<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
<tbody id="the-comment-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Links_List_Table extends WP_List_Table {
@@ -13,6 +13,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_List_Table {
@@ -92,10 +93,10 @@ function WP_List_Table( $args = array() ) {
$this->_args = $args;
- if ( $args['ajax'] ) {
- wp_enqueue_script( 'list-table' );
- add_action( 'admin_footer', array( &$this, '_js_vars' ) );
- }
+ // if ( $args['ajax'] ) {
+ // wp_enqueue_script( 'list-table' );
+ // add_action( 'admin_footer', array( &$this, '_js_vars' ) );
+ // }
}
/**
@@ -199,9 +200,8 @@ function search_box( $text, $input_id ) {
<p class="search-box">
<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
<input type="text" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
- <?php submit_button( $text, 'button', 'submit', false, array('id' => 'search-submit') ); ?>
+ <?php submit_button( $text, 'button', false, false, array('id' => 'search-submit') ); ?>
</p>
-<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
<?php
}
@@ -467,12 +467,7 @@ function get_items_per_page( $option, $default = 20 ) {
* @since 3.1.0
* @access protected
*/
- function pagination() {
- if ( $this->_pagination ) {
- echo $this->_pagination;
- return;
- }
-
+ function pagination( $which ) {
if ( empty( $this->_pagination_args ) )
return;
@@ -506,12 +501,16 @@ function pagination() {
'&lsaquo;'
);
- $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='%s' value='%s' size='%d' />",
- esc_attr__( 'Current page' ),
- esc_attr( 'paged' ),
- number_format_i18n( $current ),
- strlen( $total_pages )
- );
+ if ( 'bottom' == $which )
+ $html_current_page = $current;
+ else
+ $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='%s' value='%s' size='%d' />",
+ esc_attr__( 'Current page' ),
+ esc_attr( 'paged' ),
+ $current,
+ strlen( $total_pages )
+ );
+
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
@@ -633,6 +632,7 @@ function print_column_headers( $with_id = true ) {
list( $columns, $hidden, $sortable ) = $this->get_column_info();
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+ $current_url = remove_query_arg( 'paged', $current_url );
if ( isset( $_GET['orderby'] ) )
$current_orderby = $_GET['orderby'];
@@ -692,8 +692,6 @@ function print_column_headers( $with_id = true ) {
function display() {
extract( $this->_args );
- wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
-
$this->display_tablenav( 'top' );
?>
@@ -748,11 +746,7 @@ function display_tablenav( $which ) {
<?php
$this->extra_tablenav( $which );
$this->pagination( $which );
-
-if ( 'bottom' == $which ) {
?>
-<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
-<?php } ?>
<br class="clear" />
</div>
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Media_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_MS_Sites_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_MS_Themes_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_MS_Users_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Plugin_Install_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Plugins_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Posts_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Terms_List_Table extends WP_List_Table {
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Theme_Install_List_Table extends WP_List_Table {
@@ -127,7 +128,7 @@ function get_columns() {
function display() {
- wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+ // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
?>
<div class="tablenav top">
<div class="alignleft actions">
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Themes_List_Table extends WP_List_Table {
@@ -101,7 +102,7 @@ function tablenav( $which = 'top' ) {
}
function display() {
- wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+ // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
?>
<?php $this->tablenav( 'top' ); ?>
@@ -5,6 +5,7 @@
* @package WordPress
* @subpackage List_Table
* @since 3.1.0
+ * @access private
*/
class WP_Users_List_Table extends WP_List_Table {
@@ -10,32 +10,13 @@
/**
* Fetch an instance of a WP_List_Table class.
*
+ * @access private
* @since 3.1.0
*
- * @param string $class The type of the list table, which is the class name except for core list tables.
+ * @param string $class The type of the list table, which is the class name.
* @return object|bool Object on success, false if the class does not exist.
*/
-function get_list_table( $class ) {
- $class = apply_filters( "get_list_table_$class", $class );
-
- require_list_table( $class );
-
- if ( class_exists( $class ) )
- return new $class;
- return false;
-}
-
-/**
- * Include the proper file for a core list table.
- *
- * Useful for extending a core class that would not otherwise be required.
- *
- * @since 3.1.0
- *
- * @param string $table The core table to include.
- * @return bool True on success, false on failure.
- */
-function require_list_table( $class ) {
+function _get_list_table( $class ) {
$core_classes = array(
//Site Admin
'WP_Posts_List_Table' => 'posts',
@@ -57,7 +38,7 @@ function require_list_table( $class ) {
if ( isset( $core_classes[ $class ] ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $core_classes[ $class ] . '-list-table.php' );
- return true;
+ return new $class;
}
return false;
@@ -484,7 +484,7 @@ function post_comment_meta_box($post) {
wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
- $wp_list_table = get_list_table('WP_Post_Comments_List_Table');
+ $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
$wp_list_table->display( true );
?>
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p>
@@ -332,9 +332,9 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
}
if ( $mode == 'single' ) {
- $wp_list_table = get_list_table('WP_Post_Comments_List_Table');
+ $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
} else {
- $wp_list_table = get_list_table('WP_Comments_List_Table');
+ $wp_list_table = _get_list_table('WP_Comments_List_Table');
}
?>
@@ -194,7 +194,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
- $wp_list_table = get_list_table('WP_Plugins_List_Table');
+ $wp_list_table = _get_list_table('WP_Plugins_List_Table');
if ( is_network_admin() || !is_multisite() ) {
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
@@ -270,7 +270,7 @@ function wp_theme_update_row( $theme_key, $theme ) {
$details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400");
- $wp_list_table = get_list_table('WP_MS_Themes_List_Table');
+ $wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
if ( ! current_user_can('update_themes') )
@@ -11,7 +11,7 @@
if ( ! current_user_can( 'manage_links' ) )
wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
-$wp_list_table = get_list_table('WP_Links_List_Table');
+$wp_list_table = _get_list_table('WP_Links_List_Table');
// Handle bulk deletes
$doaction = $wp_list_table->current_action();
@@ -32,7 +32,7 @@
'<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
);
-$wp_list_table = get_list_table('WP_MS_Themes_List_Table');
+$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
$action = $wp_list_table->current_action();
@@ -16,7 +16,7 @@
if ( ! current_user_can('manage_sites') )
wp_die(__('You do not have sufficient permissions to edit this site.'));
-$wp_list_table = get_list_table('WP_Users_List_Table');
+$wp_list_table = _get_list_table('WP_Users_List_Table');
$wp_list_table->prepare_items();
$action = $wp_list_table->current_action();
@@ -16,7 +16,7 @@
if ( ! current_user_can( 'manage_sites' ) )
wp_die( __( 'You do not have permission to access this page.' ) );
-$wp_list_table = get_list_table('WP_MS_Sites_List_Table');
+$wp_list_table = _get_list_table('WP_MS_Sites_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$title = __( 'Sites' );
Oops, something went wrong.

0 comments on commit 37075f7

Please sign in to comment.