Skip to:
Content

bbPress.org

Changeset 5930


Ignore:
Timestamp:
08/25/2015 03:07:14 PM (6 years ago)
Author:
johnjamesjacoby
Message:

Topics: sanity check $_REQUEST and introduce list-table methods for reply table-navigation.

This changeset fixes a potential debug notice introduced in r5886, and removes unused functionality inherited from WP_List_Table.

Fixes #2842. See #2587.

Location:
trunk/src/includes/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/list-tables/topic-replies.php

    r5909 r5930  
    230230        ) );
    231231    }
     232
     233    /**
     234     * Message to be displayed when there are no items
     235     *
     236     * @since bbPress (r5930)
     237     */
     238    public function no_items() {
     239        esc_html_e( 'No replies to this topic.', 'bbpress' );
     240    }
     241
     242    /**
     243     * Display the list table
     244     *
     245     * This custom method is necessary because the one in `WP_List_Table` comes
     246     * with a nonce and check that we do not need.
     247     *
     248     * @since bbPress (r5930)
     249     */
     250    public function display() {
     251
     252        // Top
     253        $this->display_tablenav( 'top' ); ?>
     254
     255        <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
     256            <thead>
     257                <tr>
     258                    <?php $this->print_column_headers(); ?>
     259                </tr>
     260            </thead>
     261
     262            <tbody id="the-list" data-wp-lists='list:<?php echo $this->_args['singular']; ?>'>
     263                <?php $this->display_rows_or_placeholder(); ?>
     264            </tbody>
     265
     266            <tfoot>
     267                <tr>
     268                    <?php $this->print_column_headers( false ); ?>
     269                </tr>
     270            </tfoot>
     271        </table>
     272
     273        <?php
     274
     275        // Bottom
     276        $this->display_tablenav( 'bottom' );
     277    }
     278
     279    /**
     280     * Generate the table navigation above or below the table
     281     *
     282     * This custom method is necessary because the one in `WP_List_Table` comes
     283     * with a nonce and check that we do not need.
     284     *
     285     * @since bbPress (r5930)
     286     *
     287     * @param string $which
     288     */
     289    protected function display_tablenav( $which = '' ) {
     290        ?>
     291
     292        <div class="tablenav <?php echo esc_attr( $which ); ?>">
     293            <?php
     294                $this->extra_tablenav( $which );
     295                $this->pagination( $which );
     296            ?>
     297            <br class="clear" />
     298        </div>
     299
     300        <?php
     301    }
    232302}
    233303endif;
  • trunk/src/includes/admin/metaboxes.php

    r5886 r5930  
    569569    }
    570570
     571    // Look for pagination value
     572    $page = isset( $_REQUEST['page'] )
     573        ? (int) $_REQUEST['page']
     574        : 0;
     575
    571576    // Load up the list table
    572577    $replies_list_table = new BBP_Topic_Replies_List_Table();
     
    574579
    575580    <form id="bbp-topic-replies" method="get">
    576         <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
     581        <input type="hidden" name="page" value="<?php echo esc_attr( $page ); ?>" />
    577582
    578583        <?php $replies_list_table->display(); ?>
Note: See TracChangeset for help on using the changeset viewer.