Skip to:
Content

bbPress.org

Changeset 6537


Ignore:
Timestamp:
06/13/2017 05:30:47 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Tools: Improvements to repair, upgrade, and converter tools.

  • Use escaped gettext equivalent functions where appropriate
  • Rename description to title so that more descriptive descriptions can be used per-tool in a future version
  • Register all scripts, and properly enqueue them only a needed
  • Reorder & re-title some tools to better match each other
Location:
trunk/src/includes/admin
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/admin.php

    r6514 r6537  
    579579        $version = bbp_get_version();
    580580
     581        // Register the JS
     582        wp_register_script( 'bbp-admin-common-js',  $this->js_url . 'common'    . $suffix . '.js', array( 'jquery', 'suggest'              ), $version );
     583        wp_register_script( 'bbp-admin-topics-js',  $this->js_url . 'topics'    . $suffix . '.js', array( 'jquery'                         ), $version );
     584        wp_register_script( 'bbp-admin-replies-js', $this->js_url . 'replies'   . $suffix . '.js', array( 'jquery', 'suggest'              ), $version );
     585        wp_register_script( 'bbp-converter',        $this->js_url . 'converter' . $suffix . '.js', array( 'jquery', 'postbox', 'dashboard' ), $version );
     586
    581587        // Post type checker (only topics and replies)
    582588        if ( 'post' === get_current_screen()->base ) {
    583             switch( get_current_screen()->post_type ) {
     589
     590            switch ( get_current_screen()->post_type ) {
    584591                case bbp_get_reply_post_type() :
    585592                case bbp_get_topic_post_type() :
    586593
    587594                    // Enqueue the common JS
    588                     wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'common' . $suffix . '.js', array( 'jquery', 'suggest' ), $version );
     595                    wp_enqueue_script( 'bbp-admin-common-js' );
    589596
    590597                    // Topics admin
    591598                    if ( bbp_get_topic_post_type() === get_current_screen()->post_type ) {
    592                         wp_enqueue_script( 'bbp-admin-topics-js', $this->js_url . 'topics' . $suffix . '.js', array( 'jquery' ), $version );
     599                        wp_enqueue_script( 'bbp-admin-topics-js' );
    593600
    594601                    // Replies admin
    595602                    } elseif ( bbp_get_reply_post_type() === get_current_screen()->post_type ) {
    596                         wp_enqueue_script( 'bbp-admin-replies-js', $this->js_url . 'replies' . $suffix . '.js', array( 'jquery', 'suggest' ), $version );
     603                        wp_enqueue_script( 'bbp-admin-replies-js' );
    597604                    }
    598605
     
    613620        $suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    614621
    615         // Enqueue admin CSS with dashicons dependency
    616         wp_enqueue_style( 'bbp-admin-css', $this->css_url . 'admin' . $suffix . '.css', array( 'dashicons' ), bbp_get_version() );
     622        // Register admin CSS with dashicons dependency
     623        wp_register_style( 'bbp-admin-css', $this->css_url . 'admin' . $suffix . '.css', array( 'dashicons' ), bbp_get_version() );
     624
     625        // Enqueue
     626        wp_enqueue_style( 'bbp-admin-css' );
    617627    }
    618628
     
    787797
    788798            <h2 class="nav-tab-wrapper">
    789                 <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>">
     799                <a class="nav-tab nav-tab-active" href="<?php echo esc_url( add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php' ) ) ); ?>">
    790800                    <?php esc_html_e( 'What&#8217;s New', 'bbpress' ); ?>
    791                 </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>">
     801                </a><a class="nav-tab" href="<?php echo esc_url( add_query_arg( array( 'page' => 'bbp-credits' ), admin_url( 'index.php' ) ) ); ?>">
    792802                    <?php esc_html_e( 'Credits', 'bbpress' ); ?>
    793803                </a>
     
    838848
    839849            <div class="return-to-dashboard">
    840                 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ) ); ?>"><?php esc_html_e( 'Go to Forum Settings', 'bbpress' ); ?></a>
     850                <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bbpress' ), admin_url( 'options-general.php' ) ) ); ?>"><?php esc_html_e( 'Go to Forum Settings', 'bbpress' ); ?></a>
    841851            </div>
    842852
     
    849859     * Output the credits screen
    850860     *
    851      * Hardcoding this in here is pretty janky. It's fine for 2.2, but we'll
     861     * Hardcoding this in here is pretty janky. It's fine for now, but we'll
    852862     * want to leverage api.wordpress.org eventually.
    853863     *
     
    864874
    865875            <h2 class="nav-tab-wrapper">
    866                 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
     876                <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bbp-about' ), admin_url( 'index.php' ) ) ); ?>" class="nav-tab">
    867877                    <?php esc_html_e( 'What&#8217;s New', 'bbpress' ); ?>
    868                 </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbp-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
     878                </a><a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bbp-credits' ), admin_url( 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
    869879                    <?php esc_html_e( 'Credits', 'bbpress' ); ?>
    870880                </a>
     
    885895                <li class="wp-person" id="wp-person-jmdodd">
    886896                    <a href="https://profiles.wordpress.org/jmdodd" class="web"><img src="http://0.gravatar.com/avatar/6a7c997edea340616bcc6d0fe03f65dd?s=120" class="gravatar" alt="" />Jennifer M. Dodd</a>
    887                     <span class="title"><?php esc_html_e( 'Feature Developer', 'bbpress' ); ?></span>
     897                    <span class="title"><?php esc_html_e( 'Feature Virtuoso', 'bbpress' ); ?></span>
    888898                </li>
    889899                <li class="wp-person" id="wp-person-netweb">
    890900                    <a href="https://profiles.wordpress.org/netweb" class="web"><img src="http://0.gravatar.com/avatar/97e1620b501da675315ba7cfb740e80f?s=120" class="gravatar" alt="" />Stephen Edgar</a>
    891                     <span class="title"><?php esc_html_e( 'Converter Specialist', 'bbpress' ); ?></span>
     901                    <span class="title"><?php esc_html_e( 'Tool Maven', 'bbpress' ); ?></span>
    892902                </li>
    893903            </ul>
     
    917927            </ul>
    918928
    919             <h3 class="wp-people-group"><?php esc_html_e( 'Core Contributors to bbPress 2.6', 'bbpress' ); ?></h3>
     929            <h3 class="wp-people-group"><?php esc_html_e( 'Contributors to bbPress 2.6', 'bbpress' ); ?></h3>
    920930            <p class="wp-credits-list">
    921931                <a href="https://profiles.wordpress.org/alex-ye">alex-ye</a>,
     
    981991
    982992            <div class="return-to-dashboard">
    983                 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'bbpress' ), 'options-general.php' ) ) ); ?>"><?php esc_html_e( 'Go to Forum Settings', 'bbpress' ); ?></a>
     993                <a href="<?php echo esc_url( add_query_arg( array( 'page' => 'bbpress' ), admin_url( 'options-general.php' ) ) ); ?>"><?php esc_html_e( 'Go to Forum Settings', 'bbpress' ); ?></a>
    984994            </div>
    985995
  • trunk/src/includes/admin/assets/css/admin.css

    r6514 r6537  
    370370    background-color: #fafafa;
    371371}
     372
     373/* Tools */
     374
     375td.bbp-tool-title strong {
     376    display: block;
     377}
  • trunk/src/includes/admin/classes/class-bbp-converter.php

    r6514 r6537  
    8383    public function admin_head() {
    8484
    85         // Variables
    86         $bbp        = bbpress();
    87         $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    88         $repair_url = add_query_arg( array(
    89             'page' => 'bbp-repair'
    90         ), admin_url() );
    91 
    9285        // Enqueue scripts
    93         wp_enqueue_script( 'postbox'   );
    94         wp_enqueue_script( 'dashboard' );
    95         wp_enqueue_script( 'bbp-converter', $bbp->admin->js_url . 'converter' . $suffix . '.js', array( 'jquery', 'postbox' ), $bbp->version );
     86        wp_enqueue_script( 'bbp-converter' );
    9687
    9788        // Localize JS
     
    119110
    120111                // Import
    121                 'import_success'      => sprintf( esc_html__( 'Repair any missing information: %s', 'bbpress' ), '<a href="' . esc_url( $repair_url ) . '">' . esc_html__( 'Continue', 'bbpress' ) . '</a>' ),
    122112                'import_complete'     => esc_html__( 'Import Finished',            'bbpress' ),
    123113                'import_stopped_user' => esc_html__( 'Import Stopped (by User)',   'bbpress' ),
  • trunk/src/includes/admin/tools.php

    r6496 r6537  
    2828
    2929    <div class="card">
    30         <h3 class="title"><?php _e( 'Forums', 'bbpress' ) ?></h3>
     30        <h3 class="title"><?php esc_html_e( 'Forums', 'bbpress' ) ?></h3>
    3131        <p><?php esc_html_e( 'bbPress provides the following tools to help you manage your forums:', 'bbpress' ); ?></p>
    3232
     
    4242
    4343            // Add link to array
    44             $links[] = sprintf( '<a href="%s">%s</a>', get_admin_url( '', add_query_arg( array( 'page' => $tool['page'] ), 'tools.php' ) ), $tool['name'] );
     44            $links[] = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( array( 'page' => $tool['page'] ), admin_url( 'tools.php' ) ) ), $tool['name'] );
    4545        }
    4646
     
    6767        'id'          => '',
    6868        'type'        => '',
     69        'title'       => '',
    6970        'description' => '',
    7071        'callback'    => '',
     
    7980
    8081    // Bail if missing required values
    81     if ( empty( $r['id'] ) || empty( $r['priority'] ) || empty( $r['description'] ) || empty( $r['callback'] ) ) {
     82    if ( empty( $r['id'] ) || empty( $r['priority'] ) || empty( $r['title'] ) || empty( $r['callback'] ) ) {
    8283        return;
    8384    }
     
    8687    bbpress()->admin->tools[ $r['id'] ] = array(
    8788        'type'        => $r['type'],
     89        'title'       => $r['title'],
    8890        'description' => $r['description'],
    8991        'priority'    => $r['priority'],
     
    109111        'id'          => 'bbp-sync-topic-meta',
    110112        'type'        => 'repair',
    111         'description' => __( 'Recalculate parent topic for each reply', 'bbpress' ),
     113        'title'       => esc_html__( 'Recalculate parent topic for each reply', 'bbpress' ),
    112114        'callback'    => 'bbp_admin_repair_topic_meta',
    113115        'priority'    => 5,
     
    120122        'id'          => 'bbp-sync-forum-meta',
    121123        'type'        => 'repair',
    122         'description' => __( 'Recalculate parent forum for each topic and reply', 'bbpress' ),
     124        'title'       => esc_html__( 'Recalculate parent forum for each topic and reply', 'bbpress' ),
    123125        'callback'    => 'bbp_admin_repair_forum_meta',
    124126        'priority'    => 10,
     
    131133        'id'          => 'bbp-sync-forum-visibility',
    132134        'type'        => 'repair',
    133         'description' => __( 'Recalculate private and hidden forums', 'bbpress' ),
     135        'title'       => esc_html__( 'Recalculate private and hidden forums', 'bbpress' ),
    134136        'callback'    => 'bbp_admin_repair_forum_visibility',
    135137        'priority'    => 15,
     
    142144        'id'          => 'bbp-sync-all-topics-forums',
    143145        'type'        => 'repair',
    144         'description' => __( 'Recalculate last activity in each topic and forum', 'bbpress' ),
     146        'title'       => esc_html__( 'Recalculate last activity in each topic and forum', 'bbpress' ),
    145147        'callback'    => 'bbp_admin_repair_freshness',
    146148        'priority'    => 20,
     
    153155        'id'          => 'bbp-sync-all-topics-sticky',
    154156        'type'        => 'repair',
    155         'description' => __( 'Recalculate sticky relationship of each topic', 'bbpress' ),
     157        'title'       => esc_html__( 'Recalculate sticky relationship of each topic', 'bbpress' ),
    156158        'callback'    => 'bbp_admin_repair_sticky',
    157159        'priority'    => 25,
     
    164166        'id'          => 'bbp-sync-all-reply-positions',
    165167        'type'        => 'repair',
    166         'description' => __( 'Recalculate the position of each reply', 'bbpress' ),
     168        'title'       => esc_html__( 'Recalculate position of each reply in each topic', 'bbpress' ),
    167169        'callback'    => 'bbp_admin_repair_reply_menu_order',
    168170        'priority'    => 30,
     
    171173    ) );
    172174
     175    // Sync all topic engagements for all users
     176    bbp_register_repair_tool( array(
     177        'id'          => 'bbp-topic-engagements',
     178        'type'        => 'repair',
     179        'title'       => esc_html__( 'Recalculate engagements in each topic for each user', 'bbpress' ),
     180        'callback'    => 'bbp_admin_repair_topic_voice_count',
     181        'priority'    => 35,
     182        'overhead'    => 'high',
     183        'components'  => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() )
     184    ) );
     185
    173186    // Update closed topic counts
    174187    bbp_register_repair_tool( array(
    175188        'id'          => 'bbp-sync-closed-topics',
    176189        'type'        => 'repair',
    177         'description' => __( 'Repair closed topics', 'bbpress' ),
     190        'title'       => esc_html__( 'Repair closed topic statuses', 'bbpress' ),
    178191        'callback'    => 'bbp_admin_repair_closed_topics',
    179         'priority'    => 35,
     192        'priority'    => 40,
    180193        'overhead'    => 'medium',
    181194        'components'  => array( bbp_get_topic_post_type() )
     
    186199        'id'          => 'bbp-forum-topics',
    187200        'type'        => 'repair',
    188         'description' => __( 'Recount topics in each forum', 'bbpress' ),
     201        'title'       => esc_html__( 'Recount topics in each forum', 'bbpress' ),
    189202        'callback'    => 'bbp_admin_repair_forum_topic_count',
    190         'priority'    => 40,
     203        'priority'    => 45,
    191204        'overhead'    => 'medium',
    192205        'components'  => array( bbp_get_forum_post_type(), bbp_get_topic_post_type() )
     
    197210        'id'          => 'bbp-topic-tags',
    198211        'type'        => 'repair',
    199         'description' => __( 'Recount topics in each topic-tag', 'bbpress' ),
     212        'title'       => esc_html__( 'Recount topics in each topic-tag', 'bbpress' ),
    200213        'callback'    => 'bbp_admin_repair_topic_tag_count',
    201         'priority'    => 45,
     214        'priority'    => 50,
    202215        'overhead'    => 'medium',
    203216        'components'  => array( bbp_get_topic_post_type(), bbp_get_topic_tag_tax_id() )
     
    208221        'id'          => 'bbp-forum-replies',
    209222        'type'        => 'repair',
    210         'description' => __( 'Recount replies in each forum', 'bbpress' ),
     223        'title'       => esc_html__( 'Recount replies in each forum', 'bbpress' ),
    211224        'callback'    => 'bbp_admin_repair_forum_reply_count',
    212         'priority'    => 50,
     225        'priority'    => 55,
    213226        'overhead'    => 'high',
    214227        'components'  => array( bbp_get_forum_post_type(), bbp_get_reply_post_type() )
     
    219232        'id'          => 'bbp-topic-replies',
    220233        'type'        => 'repair',
    221         'description' => __( 'Recount replies in each topic', 'bbpress' ),
     234        'title'       => esc_html__( 'Recount replies in each topic', 'bbpress' ),
    222235        'callback'    => 'bbp_admin_repair_topic_reply_count',
    223         'priority'    => 55,
     236        'priority'    => 60,
    224237        'overhead'    => 'high',
    225238        'components'  => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() )
    226239    ) );
    227240
    228     // Count topic engagements
    229     bbp_register_repair_tool( array(
    230         'id'          => 'bbp-topic-engagements',
    231         'type'        => 'repair',
    232         'description' => __( 'Recount engagements in each topic', 'bbpress' ),
    233         'callback'    => 'bbp_admin_repair_topic_voice_count',
    234         'priority'    => 60,
    235         'overhead'    => 'high',
    236         'components'  => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() )
    237     ) );
    238 
    239241    // Count non-published replies to each topic
    240242    bbp_register_repair_tool( array(
    241243        'id'          => 'bbp-topic-hidden-replies',
    242244        'type'        => 'repair',
    243         'description' => __( 'Recount pending, spammed, and trashed replies in each topic', 'bbpress' ),
     245        'title'       => esc_html__( 'Recount pending, spammed, and trashed replies in each topic', 'bbpress' ),
    244246        'callback'    => 'bbp_admin_repair_topic_hidden_reply_count',
    245247        'priority'    => 65,
     
    252254        'id'          => 'bbp-user-topics',
    253255        'type'        => 'repair',
    254         'description' => __( 'Recount topics for each user', 'bbpress' ),
     256        'title'       => esc_html__( 'Recount topics for each user', 'bbpress' ),
    255257        'callback'    => 'bbp_admin_repair_user_topic_count',
    256258        'priority'    => 70,
     
    263265        'id'          => 'bbp-user-replies',
    264266        'type'        => 'repair',
    265         'description' => __( 'Recount replies for each user', 'bbpress' ),
     267        'title'       => esc_html__( 'Recount replies for each user', 'bbpress' ),
    266268        'callback'    => 'bbp_admin_repair_user_reply_count',
    267269        'priority'    => 75,
     
    274276        'id'          => 'bbp-user-favorites',
    275277        'type'        => 'repair',
    276         'description' => __( 'Remove unpublished topics from user favorites', 'bbpress' ),
     278        'title'       => esc_html__( 'Remove unpublished topics from user favorites', 'bbpress' ),
    277279        'callback'    => 'bbp_admin_repair_user_favorites',
    278280        'priority'    => 80,
     
    285287        'id'          => 'bbp-user-topic-subscriptions',
    286288        'type'        => 'repair',
    287         'description' => __( 'Remove unpublished topics from user subscriptions', 'bbpress' ),
     289        'title'       => esc_html__( 'Remove unpublished topics from user subscriptions', 'bbpress' ),
    288290        'callback'    => 'bbp_admin_repair_user_topic_subscriptions',
    289291        'priority'    => 85,
     
    296298        'id'          => 'bbp-user-forum-subscriptions',
    297299        'type'        => 'repair',
    298         'description' => __( 'Remove unpublished forums from user subscriptions', 'bbpress' ),
     300        'title'       => esc_html__( 'Remove unpublished forums from user subscriptions', 'bbpress' ),
    299301        'callback'    => 'bbp_admin_repair_user_forum_subscriptions',
    300302        'priority'    => 90,
     
    307309        'id'          => 'bbp-user-role-map',
    308310        'type'        => 'repair',
    309         'description' => __( 'Remap existing users to default forum roles', 'bbpress' ),
     311        'title'       => esc_html__( 'Remap all users to default forum roles', 'bbpress' ),
    310312        'callback'    => 'bbp_admin_repair_user_roles',
    311313        'priority'    => 95,
     
    314316    ) );
    315317
     318    // Migrate topic engagements to post-meta
     319    bbp_register_repair_tool( array(
     320        'id'          => 'bbp-user-topic-engagements-move',
     321        'type'        => 'upgrade',
     322        'title'       => esc_html__( 'Upgrade user topic engagements', 'bbpress' ),
     323        'callback'    => 'bbp_admin_upgrade_user_engagements',
     324        'priority'    => 100,
     325        'overhead'    => 'high',
     326        'components'  => array( bbp_get_user_rewrite_id(), bbp_get_user_engagements_rewrite_id() )
     327    ) );
     328
    316329    // Migrate favorites from user-meta to post-meta
    317330    bbp_register_repair_tool( array(
    318331        'id'          => 'bbp-user-favorites-move',
    319332        'type'        => 'upgrade',
    320         'description' => __( 'Upgrade user favorites', 'bbpress' ),
     333        'title'       => esc_html__( 'Upgrade user topic favorites', 'bbpress' ),
    321334        'callback'    => 'bbp_admin_upgrade_user_favorites',
    322         'priority'    => 100,
     335        'priority'    => 105,
    323336        'overhead'    => 'high',
    324337        'components'  => array( bbp_get_user_rewrite_id(), bbp_get_user_favorites_rewrite_id() )
     
    329342        'id'          => 'bbp-user-topic-subscriptions-move',
    330343        'type'        => 'upgrade',
    331         'description' => __( 'Upgrade user topic subscriptions', 'bbpress' ),
     344        'title'       => esc_html__( 'Upgrade user topic subscriptions', 'bbpress' ),
    332345        'callback'    => 'bbp_admin_upgrade_user_topic_subscriptions',
    333         'priority'    => 105,
     346        'priority'    => 110,
    334347        'overhead'    => 'high',
    335348        'components'  => array( bbp_get_user_rewrite_id(), bbp_get_user_subscriptions_rewrite_id() )
     
    340353        'id'          => 'bbp-user-forum-subscriptions-move',
    341354        'type'        => 'upgrade',
    342         'description' => __( 'Upgrade user forum subscriptions', 'bbpress' ),
     355        'title'       => esc_html__( 'Upgrade user forum subscriptions', 'bbpress' ),
    343356        'callback'    => 'bbp_admin_upgrade_user_forum_subscriptions',
    344         'priority'    => 110,
     357        'priority'    => 115,
    345358        'overhead'    => 'high',
    346359        'components'  => array( bbp_get_user_rewrite_id(), bbp_get_user_subscriptions_rewrite_id() )
    347360    ) );
    348361
    349     // Migrate topic engagements to post-meta
    350     bbp_register_repair_tool( array(
    351         'id'          => 'bbp-user-topic-engagements-move',
    352         'type'        => 'upgrade',
    353         'description' => __( 'Upgrade topic engagements', 'bbpress' ),
    354         'callback'    => 'bbp_admin_upgrade_user_engagements',
    355         'priority'    => 115,
    356         'overhead'    => 'medium',
    357         'components'  => array( bbp_get_user_rewrite_id(), bbp_get_user_engagements_rewrite_id() )
    358     ) );
    359 
    360362    // Sync all BuddyPress group forum relationships
    361363    bbp_register_repair_tool( array(
    362364        'id'          => 'bbp-group-forums',
    363365        'type'        => 'upgrade',
    364         'description' => __( 'Upgrade BuddyPress Group Forum relationships', 'bbpress' ),
     366        'title'       => esc_html__( 'Upgrade BuddyPress Group Forum relationships', 'bbpress' ),
    365367        'callback'    => 'bbp_admin_upgrade_group_forum_relationship',
    366368        'priority'    => 120,
     
    373375        'id'          => 'bbp-user-favorites-delete',
    374376        'type'        => 'upgrade',
    375         'description' => __( 'Remove favorites from user-meta', 'bbpress' ),
     377        'title'       => esc_html__( 'Remove favorites from user-meta', 'bbpress' ),
    376378        'callback'    => 'bbp_admin_upgrade_remove_favorites_from_usermeta',
    377379        'priority'    => 125,
     
    384386        'id'          => 'bbp-user-topic-subscriptions-delete',
    385387        'type'        => 'upgrade',
    386         'description' => __( 'Remove topic subscriptions from user-meta', 'bbpress' ),
     388        'title'       => esc_html__( 'Remove topic subscriptions from user-meta', 'bbpress' ),
    387389        'callback'    => 'bbp_admin_upgrade_remove_topic_subscriptions_from_usermeta',
    388390        'priority'    => 130,
     
    395397        'id'          => 'bbp-user-forum-subscriptions-delete',
    396398        'type'        => 'upgrade',
    397         'description' => __( 'Remove forum subscriptions from user-meta', 'bbpress' ),
     399        'title'       => esc_html__( 'Remove forum subscriptions from user-meta', 'bbpress' ),
    398400        'callback'    => 'bbp_admin_upgrade_remove_forum_subscriptions_from_usermeta',
    399401        'priority'    => 135,
     
    442444            $is_current = (bool) ( $tab['name'] == $active_tab );
    443445            $tab_class  = $is_current ? $active_class : $idle_class;
    444             $tab_url    = get_admin_url( '', add_query_arg( array( 'page' => $tab['page'] ), 'tools.php' ) );
     446            $tab_url    = add_query_arg( array( 'page' => $tab['page'] ), admin_url( 'tools.php' ) );
    445447            $tabs_html .= '<a href="' . esc_url( $tab_url ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab['name'] ) . '</a>';
    446448        }
     
    458460 */
    459461function bbp_get_tools_admin_pages() {
     462
     463    // Get tools URL one time & use in each tab
     464    $tools_url = admin_url( 'tools.php' );
    460465
    461466    // Filter & return
     
    468473
    469474            // Deprecated 2.6.0
    470             'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-repair'    ), 'tools.php' ) )
     475            'href' => add_query_arg( array( 'page' => 'bbp-repair' ), $tools_url )
    471476        ),
    472477        array(
     
    477482
    478483            // Deprecated 2.6.0
    479             'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-upgrade' ), 'tools.php' ) )
     484            'href' => add_query_arg( array( 'page' => 'bbp-upgrade' ), $tools_url )
    480485        ),
    481486        array(
     
    486491
    487492            // Deprecated 2.6.0
    488             'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-converter' ), 'tools.php' ) )
     493            'href' => add_query_arg( array( 'page' => 'bbp-converter' ), $tools_url )
    489494        ),
    490495        array(
     
    495500
    496501            // Deprecated 2.6.0
    497             'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-reset'     ), 'tools.php' ) )
     502            'href' => add_query_arg( array( 'page' => 'bbp-reset' ), $tools_url )
    498503        )
    499504    ) );
  • trunk/src/includes/admin/tools/common.php

    r6438 r6537  
    3030     */
    3131    function bbp_get_admin_repair_tool_run_url( $component = array() ) {
    32         $tools  = admin_url( 'tools.php' );
    33         $page   = ( 'repair' === $component['type'] ) ? 'bbp-repair' : 'bbp-upgrade';
    34         $args   = array( 'page' => $page, 'action' => 'run', 'checked' => array( $component['id'] ) );
    35         $url    = add_query_arg( $args, $tools );
    36         $nonced = wp_nonce_url( $url, 'bbpress-do-counts' );
     32
     33        // Page
     34        $page = ( 'repair' === $component['type'] )
     35            ? 'bbp-repair'
     36            : 'bbp-upgrade';
     37
     38        // Arguments
     39        $args = array(
     40            'page'    => $page,
     41            'action'  => 'run',
     42            'checked' => array( $component['id']
     43        ) );
     44
     45        // Url
     46        $nonced = wp_nonce_url( add_query_arg( $args, admin_url( 'tools.php' ) ), 'bbpress-do-counts' );
    3747
    3848        // Filter & return
     
    176186
    177187    // Filter & return
    178     return apply_filters( 'bbp_get_admin_repair_tools', $tools, $type );
     188    return (array) apply_filters( 'bbp_get_admin_repair_tools', $tools, $type );
    179189}
    180190
     
    201211
    202212    // Filter & return
    203     return apply_filters( 'bbp_get_admin_repair_tool_registered_components', $retval );
     213    return (array) apply_filters( 'bbp_get_admin_repair_tool_registered_components', $retval );
    204214}
    205215
     
    364374        // Search
    365375        if ( ! empty( $search ) ) {
    366             if ( ! strstr( strtolower( $tool['description'] ), strtolower( $search ) ) ) {
     376            if ( ! strstr( strtolower( $tool['title'] ), strtolower( $search ) ) ) {
    367377                continue;
    368378            }
     
    373383            'id'          => sanitize_key( $id ),
    374384            'type'        => $tool['type'],
     385            'title'       => $tool['title'],
    375386            'description' => $tool['description'],
    376387            'callback'    => $tool['callback'],
     
    412423
    413424    // Filter & return
    414     return apply_filters( 'bbp_get_admin_repair_tool_components', $links, $item );
     425    return (array) apply_filters( 'bbp_get_admin_repair_tool_components', $links, $item );
    415426}
    416427
     
    460471
    461472    // Loop through tools and count overheads
    462     foreach ( $tools as $id => $tool ) {
     473    foreach ( $tools as $tool ) {
    463474
    464475        // Get the overhead level
     
    480491    // Default ticker
    481492    $i = 0;
     493
     494    // Sort
     495    ksort( $overheads );
    482496
    483497    // Loop through overheads and build filter
     
    493507
    494508        // Figure out separator and active class
    495         $current  = ! empty( $_GET['overhead'] ) && ( sanitize_key( $_GET['overhead'] ) === $key ) ? 'current' : '';
     509        $current  = ! empty( $_GET['overhead'] ) && ( sanitize_key( $_GET['overhead'] ) === $key )
     510            ? 'current'
     511            : '';
    496512
    497513        // Counts to show
     
    537553
    538554    // Filter & return
    539     return apply_filters( 'bbp_get_admin_repair_tool_overhead', $links, $item );
    540 }
     555    return (array) apply_filters( 'bbp_get_admin_repair_tool_overhead', $links, $item );
     556}
  • trunk/src/includes/admin/tools/repair.php

    r6523 r6537  
    8989                                </th>
    9090                                <td class="bbp-tool-title column-primary column-description" data-colname="<?php esc_html_e( 'Description', 'bbpress' ); ?>">
    91                                     <strong><?php echo esc_html( $item['description'] ); ?></strong>
    92                                     <div class="row-actions hide-if-no-js">
     91                                    <strong><?php echo esc_html( $item['title'] ); ?></strong><?php
     92
     93                                        // Optional description
     94                                        if ( ! empty( $item['description'] ) ) :
     95                                            echo esc_html( $item['description'] );
     96                                        endif;
     97
     98                                    ?><div class="row-actions hide-if-no-js">
    9399                                        <span class="run">
    94                                             <a href="<?php bbp_admin_repair_tool_run_url( $item ); ?>" aria-label="<?php printf( esc_html__( 'Run %s', 'bbpress' ), $item['description'] ); ?>" id="<?php echo esc_attr( $item['id'] ); ?>" ><?php esc_html_e( 'Run', 'bbpress' ); ?></a>
     100                                            <a href="<?php bbp_admin_repair_tool_run_url( $item ); ?>" aria-label="<?php printf( esc_html__( 'Run %s', 'bbpress' ), $item['title'] ); ?>" id="<?php echo esc_attr( $item['id'] ); ?>" ><?php esc_html_e( 'Run', 'bbpress' ); ?></a>
    95101                                        </span>
    96102                                    </div>
  • trunk/src/includes/admin/tools/upgrade.php

    r6534 r6537  
    8686                                </th>
    8787                                <td class="bbp-tool-title column-primary column-description" data-colname="<?php esc_html_e( 'Description', 'bbpress' ); ?>">
    88                                     <strong><?php echo esc_html( $item['description'] ); ?></strong>
    89                                     <div class="row-actions hide-if-no-js">
     88                                    <strong><?php echo esc_html( $item['title'] ); ?></strong><?php
     89
     90                                        // Optional description
     91                                        if ( ! empty( $item['description'] ) ) :
     92                                            esc_html( $item['description'] );
     93                                        endif;
     94
     95                                    ?><div class="row-actions hide-if-no-js">
    9096                                        <span class="run">
    91                                             <a href="<?php bbp_admin_repair_tool_run_url( $item ); ?>" aria-label="<?php printf( esc_html__( 'Run %s', 'bbpress' ), $item['description'] ); ?>" id="<?php echo esc_attr( $item['id'] ); ?>" ><?php esc_html_e( 'Run', 'bbpress' ); ?></a>
     97                                            <a href="<?php bbp_admin_repair_tool_run_url( $item ); ?>" aria-label="<?php printf( esc_html__( 'Run %s', 'bbpress' ), $item['title'] ); ?>" id="<?php echo esc_attr( $item['id'] ); ?>" ><?php esc_html_e( 'Run', 'bbpress' ); ?></a>
    9298                                        </span>
    9399                                    </div>
Note: See TracChangeset for help on using the changeset viewer.