Changeset 6537 for trunk/src/includes/admin/tools.php
- Timestamp:
- 06/13/2017 05:30:47 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/tools.php
r6496 r6537 28 28 29 29 <div class="card"> 30 <h3 class="title"><?php _e( 'Forums', 'bbpress' ) ?></h3>30 <h3 class="title"><?php esc_html_e( 'Forums', 'bbpress' ) ?></h3> 31 31 <p><?php esc_html_e( 'bbPress provides the following tools to help you manage your forums:', 'bbpress' ); ?></p> 32 32 … … 42 42 43 43 // 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'] ); 45 45 } 46 46 … … 67 67 'id' => '', 68 68 'type' => '', 69 'title' => '', 69 70 'description' => '', 70 71 'callback' => '', … … 79 80 80 81 // 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'] ) ) { 82 83 return; 83 84 } … … 86 87 bbpress()->admin->tools[ $r['id'] ] = array( 87 88 'type' => $r['type'], 89 'title' => $r['title'], 88 90 'description' => $r['description'], 89 91 'priority' => $r['priority'], … … 109 111 'id' => 'bbp-sync-topic-meta', 110 112 'type' => 'repair', 111 ' description' =>__( 'Recalculate parent topic for each reply', 'bbpress' ),113 'title' => esc_html__( 'Recalculate parent topic for each reply', 'bbpress' ), 112 114 'callback' => 'bbp_admin_repair_topic_meta', 113 115 'priority' => 5, … … 120 122 'id' => 'bbp-sync-forum-meta', 121 123 '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' ), 123 125 'callback' => 'bbp_admin_repair_forum_meta', 124 126 'priority' => 10, … … 131 133 'id' => 'bbp-sync-forum-visibility', 132 134 'type' => 'repair', 133 ' description' =>__( 'Recalculate private and hidden forums', 'bbpress' ),135 'title' => esc_html__( 'Recalculate private and hidden forums', 'bbpress' ), 134 136 'callback' => 'bbp_admin_repair_forum_visibility', 135 137 'priority' => 15, … … 142 144 'id' => 'bbp-sync-all-topics-forums', 143 145 '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' ), 145 147 'callback' => 'bbp_admin_repair_freshness', 146 148 'priority' => 20, … … 153 155 'id' => 'bbp-sync-all-topics-sticky', 154 156 'type' => 'repair', 155 ' description' =>__( 'Recalculate sticky relationship of each topic', 'bbpress' ),157 'title' => esc_html__( 'Recalculate sticky relationship of each topic', 'bbpress' ), 156 158 'callback' => 'bbp_admin_repair_sticky', 157 159 'priority' => 25, … … 164 166 'id' => 'bbp-sync-all-reply-positions', 165 167 'type' => 'repair', 166 ' description' => __( 'Recalculate the position of each reply', 'bbpress' ),168 'title' => esc_html__( 'Recalculate position of each reply in each topic', 'bbpress' ), 167 169 'callback' => 'bbp_admin_repair_reply_menu_order', 168 170 'priority' => 30, … … 171 173 ) ); 172 174 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 173 186 // Update closed topic counts 174 187 bbp_register_repair_tool( array( 175 188 'id' => 'bbp-sync-closed-topics', 176 189 'type' => 'repair', 177 ' description' => __( 'Repair closed topics', 'bbpress' ),190 'title' => esc_html__( 'Repair closed topic statuses', 'bbpress' ), 178 191 'callback' => 'bbp_admin_repair_closed_topics', 179 'priority' => 35,192 'priority' => 40, 180 193 'overhead' => 'medium', 181 194 'components' => array( bbp_get_topic_post_type() ) … … 186 199 'id' => 'bbp-forum-topics', 187 200 'type' => 'repair', 188 ' description' =>__( 'Recount topics in each forum', 'bbpress' ),201 'title' => esc_html__( 'Recount topics in each forum', 'bbpress' ), 189 202 'callback' => 'bbp_admin_repair_forum_topic_count', 190 'priority' => 4 0,203 'priority' => 45, 191 204 'overhead' => 'medium', 192 205 'components' => array( bbp_get_forum_post_type(), bbp_get_topic_post_type() ) … … 197 210 'id' => 'bbp-topic-tags', 198 211 'type' => 'repair', 199 ' description' =>__( 'Recount topics in each topic-tag', 'bbpress' ),212 'title' => esc_html__( 'Recount topics in each topic-tag', 'bbpress' ), 200 213 'callback' => 'bbp_admin_repair_topic_tag_count', 201 'priority' => 45,214 'priority' => 50, 202 215 'overhead' => 'medium', 203 216 'components' => array( bbp_get_topic_post_type(), bbp_get_topic_tag_tax_id() ) … … 208 221 'id' => 'bbp-forum-replies', 209 222 'type' => 'repair', 210 ' description' =>__( 'Recount replies in each forum', 'bbpress' ),223 'title' => esc_html__( 'Recount replies in each forum', 'bbpress' ), 211 224 'callback' => 'bbp_admin_repair_forum_reply_count', 212 'priority' => 5 0,225 'priority' => 55, 213 226 'overhead' => 'high', 214 227 'components' => array( bbp_get_forum_post_type(), bbp_get_reply_post_type() ) … … 219 232 'id' => 'bbp-topic-replies', 220 233 'type' => 'repair', 221 ' description' =>__( 'Recount replies in each topic', 'bbpress' ),234 'title' => esc_html__( 'Recount replies in each topic', 'bbpress' ), 222 235 'callback' => 'bbp_admin_repair_topic_reply_count', 223 'priority' => 55,236 'priority' => 60, 224 237 'overhead' => 'high', 225 238 'components' => array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ) 226 239 ) ); 227 240 228 // Count topic engagements229 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 239 241 // Count non-published replies to each topic 240 242 bbp_register_repair_tool( array( 241 243 'id' => 'bbp-topic-hidden-replies', 242 244 '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' ), 244 246 'callback' => 'bbp_admin_repair_topic_hidden_reply_count', 245 247 'priority' => 65, … … 252 254 'id' => 'bbp-user-topics', 253 255 'type' => 'repair', 254 ' description' =>__( 'Recount topics for each user', 'bbpress' ),256 'title' => esc_html__( 'Recount topics for each user', 'bbpress' ), 255 257 'callback' => 'bbp_admin_repair_user_topic_count', 256 258 'priority' => 70, … … 263 265 'id' => 'bbp-user-replies', 264 266 'type' => 'repair', 265 ' description' =>__( 'Recount replies for each user', 'bbpress' ),267 'title' => esc_html__( 'Recount replies for each user', 'bbpress' ), 266 268 'callback' => 'bbp_admin_repair_user_reply_count', 267 269 'priority' => 75, … … 274 276 'id' => 'bbp-user-favorites', 275 277 'type' => 'repair', 276 ' description' =>__( 'Remove unpublished topics from user favorites', 'bbpress' ),278 'title' => esc_html__( 'Remove unpublished topics from user favorites', 'bbpress' ), 277 279 'callback' => 'bbp_admin_repair_user_favorites', 278 280 'priority' => 80, … … 285 287 'id' => 'bbp-user-topic-subscriptions', 286 288 'type' => 'repair', 287 ' description' =>__( 'Remove unpublished topics from user subscriptions', 'bbpress' ),289 'title' => esc_html__( 'Remove unpublished topics from user subscriptions', 'bbpress' ), 288 290 'callback' => 'bbp_admin_repair_user_topic_subscriptions', 289 291 'priority' => 85, … … 296 298 'id' => 'bbp-user-forum-subscriptions', 297 299 'type' => 'repair', 298 ' description' =>__( 'Remove unpublished forums from user subscriptions', 'bbpress' ),300 'title' => esc_html__( 'Remove unpublished forums from user subscriptions', 'bbpress' ), 299 301 'callback' => 'bbp_admin_repair_user_forum_subscriptions', 300 302 'priority' => 90, … … 307 309 'id' => 'bbp-user-role-map', 308 310 'type' => 'repair', 309 ' description' => __( 'Remap existingusers to default forum roles', 'bbpress' ),311 'title' => esc_html__( 'Remap all users to default forum roles', 'bbpress' ), 310 312 'callback' => 'bbp_admin_repair_user_roles', 311 313 'priority' => 95, … … 314 316 ) ); 315 317 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 316 329 // Migrate favorites from user-meta to post-meta 317 330 bbp_register_repair_tool( array( 318 331 'id' => 'bbp-user-favorites-move', 319 332 'type' => 'upgrade', 320 ' description' => __( 'Upgrade userfavorites', 'bbpress' ),333 'title' => esc_html__( 'Upgrade user topic favorites', 'bbpress' ), 321 334 'callback' => 'bbp_admin_upgrade_user_favorites', 322 'priority' => 10 0,335 'priority' => 105, 323 336 'overhead' => 'high', 324 337 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_favorites_rewrite_id() ) … … 329 342 'id' => 'bbp-user-topic-subscriptions-move', 330 343 'type' => 'upgrade', 331 ' description' =>__( 'Upgrade user topic subscriptions', 'bbpress' ),344 'title' => esc_html__( 'Upgrade user topic subscriptions', 'bbpress' ), 332 345 'callback' => 'bbp_admin_upgrade_user_topic_subscriptions', 333 'priority' => 1 05,346 'priority' => 110, 334 347 'overhead' => 'high', 335 348 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_subscriptions_rewrite_id() ) … … 340 353 'id' => 'bbp-user-forum-subscriptions-move', 341 354 'type' => 'upgrade', 342 ' description' =>__( 'Upgrade user forum subscriptions', 'bbpress' ),355 'title' => esc_html__( 'Upgrade user forum subscriptions', 'bbpress' ), 343 356 'callback' => 'bbp_admin_upgrade_user_forum_subscriptions', 344 'priority' => 11 0,357 'priority' => 115, 345 358 'overhead' => 'high', 346 359 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_subscriptions_rewrite_id() ) 347 360 ) ); 348 361 349 // Migrate topic engagements to post-meta350 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 360 362 // Sync all BuddyPress group forum relationships 361 363 bbp_register_repair_tool( array( 362 364 'id' => 'bbp-group-forums', 363 365 'type' => 'upgrade', 364 ' description' =>__( 'Upgrade BuddyPress Group Forum relationships', 'bbpress' ),366 'title' => esc_html__( 'Upgrade BuddyPress Group Forum relationships', 'bbpress' ), 365 367 'callback' => 'bbp_admin_upgrade_group_forum_relationship', 366 368 'priority' => 120, … … 373 375 'id' => 'bbp-user-favorites-delete', 374 376 'type' => 'upgrade', 375 ' description' =>__( 'Remove favorites from user-meta', 'bbpress' ),377 'title' => esc_html__( 'Remove favorites from user-meta', 'bbpress' ), 376 378 'callback' => 'bbp_admin_upgrade_remove_favorites_from_usermeta', 377 379 'priority' => 125, … … 384 386 'id' => 'bbp-user-topic-subscriptions-delete', 385 387 'type' => 'upgrade', 386 ' description' =>__( 'Remove topic subscriptions from user-meta', 'bbpress' ),388 'title' => esc_html__( 'Remove topic subscriptions from user-meta', 'bbpress' ), 387 389 'callback' => 'bbp_admin_upgrade_remove_topic_subscriptions_from_usermeta', 388 390 'priority' => 130, … … 395 397 'id' => 'bbp-user-forum-subscriptions-delete', 396 398 'type' => 'upgrade', 397 ' description' =>__( 'Remove forum subscriptions from user-meta', 'bbpress' ),399 'title' => esc_html__( 'Remove forum subscriptions from user-meta', 'bbpress' ), 398 400 'callback' => 'bbp_admin_upgrade_remove_forum_subscriptions_from_usermeta', 399 401 'priority' => 135, … … 442 444 $is_current = (bool) ( $tab['name'] == $active_tab ); 443 445 $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' ) ); 445 447 $tabs_html .= '<a href="' . esc_url( $tab_url ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab['name'] ) . '</a>'; 446 448 } … … 458 460 */ 459 461 function bbp_get_tools_admin_pages() { 462 463 // Get tools URL one time & use in each tab 464 $tools_url = admin_url( 'tools.php' ); 460 465 461 466 // Filter & return … … 468 473 469 474 // 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 ) 471 476 ), 472 477 array( … … 477 482 478 483 // 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 ) 480 485 ), 481 486 array( … … 486 491 487 492 // 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 ) 489 494 ), 490 495 array( … … 495 500 496 501 // 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 ) 498 503 ) 499 504 ) );
Note: See TracChangeset
for help on using the changeset viewer.