Changeset 6896
- Timestamp:
- 01/29/2019 03:36:23 AM (6 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/classes/class-bbp-admin.php
r6819 r6896 210 210 } 211 211 212 // Database upgrade skipped? 213 $skipped = get_option( '_bbp_db_upgrade_skipped', 0 ); 214 215 // Database upgrade skipped! 216 if ( ! empty( $skipped ) && ( $skipped < 260 ) && current_user_can( 'bbp_tools_upgrade_page' ) ) { 212 // Get page 213 $page = ! empty( $_GET['page'] ) 214 ? sanitize_key( $_GET['page'] ) 215 : false; 216 217 // Pending database upgrades! 218 if ( ( 'bbp-upgrade' !== $page ) && bbp_get_pending_upgrades() && current_user_can( 'bbp_tools_upgrade_page' ) ) { 217 219 218 220 // Link to upgrade page 219 221 $upgrade_url = add_query_arg( array( 'page' => 'bbp-upgrade' ), admin_url( 'tools.php' ) ); 220 $dismiss_url = wp_nonce_url( add_query_arg( array( 'bbp-hide-notice' => 'bbp-skip-upgrade ' ) ), 'bbp-hide-notice' );221 $upgrade_link = '<a href="' . esc_url( $upgrade_url ) . '">' . esc_html__( ' Go Upgrade', 'bbpress' ) . '</a>';222 $dismiss_link = '<a href="' . esc_url( $dismiss_url ) . '">' . esc_html__( 'Hide For ever', 'bbpress' ) . '</a>';222 $dismiss_url = wp_nonce_url( add_query_arg( array( 'bbp-hide-notice' => 'bbp-skip-upgrades' ) ), 'bbp-hide-notice' ); 223 $upgrade_link = '<a href="' . esc_url( $upgrade_url ) . '">' . esc_html__( 'Learn More', 'bbpress' ) . '</a>'; 224 $dismiss_link = '<a href="' . esc_url( $dismiss_url ) . '">' . esc_html__( 'Hide For Now', 'bbpress' ) . '</a>'; 223 225 $bbp_dashicon = '<span class="bbpress-logo-icon"></span>'; 224 226 $message = $bbp_dashicon . sprintf( 225 esc_html__( 'bbPress requires a manual database upgrade. %s or %s ', 'bbpress' ),227 esc_html__( 'bbPress requires a manual database upgrade. %s or %s.', 'bbpress' ), 226 228 $upgrade_link, 227 229 $dismiss_link … … 240 242 public function hide_notices() { 241 243 244 // Hiding a notice? 245 $hiding_notice = ! empty( $_GET['bbp-hide-notice'] ) 246 ? sanitize_key( $_GET['bbp-hide-notice'] ) 247 : false; 248 242 249 // Bail if not hiding a notice 243 if ( empty( $ _GET['bbp-hide-notice']) ) {250 if ( empty( $hiding_notice ) ) { 244 251 return; 245 252 } … … 254 261 255 262 // Maybe delete notices 256 switch ( $ _GET['bbp-hide-notice']) {263 switch ( $hiding_notice ) { 257 264 258 265 // Skipped upgrade notice 259 case 'bbp-skip-upgrade ' :260 delete_option( '_bbp_db_upgrade_skipped');266 case 'bbp-skip-upgrades' : 267 bbp_clear_pending_upgrades(); 261 268 break; 262 269 } … … 363 370 */ 364 371 private function esc_notice( $message = '' ) { 372 373 // Get allowed HTML 365 374 $tags = wp_kses_allowed_html(); 375 376 // Allow spans with classes in notices 377 $tags['span'] = array( 378 'class' => 1 379 ); 380 381 // Parse the message and remove unsafe tags 366 382 $text = wp_kses( $message, $tags ); 367 383 384 // Return the message text 368 385 return $text; 369 386 } … … 899 916 list( $display_version ) = explode( '-', bbp_get_version() ); ?> 900 917 901 <h1><?php printf( esc_html__( 'Welcome to bbPress %s', 'bbpress' ), $display_version ); ?></h1> 918 <h1 class="wp-heading-inline"><?php printf( esc_html__( 'Welcome to bbPress %s', 'bbpress' ), $display_version ); ?></h1> 919 <hr class="wp-header-end"> 902 920 <div class="about-text"><?php printf( esc_html__( 'bbPress is fun to use, contains no artificial colors or preservatives, and is absolutely wonderful in every environment. Your community is going to love using it.', 'bbpress' ), $display_version ); ?></div> 903 921 … … 1137 1155 1138 1156 <div class="wrap"> 1139 <h1><?php esc_html_e( 'Update Forum', 'bbpress' ); ?></h1> 1157 <h1 class="wp-heading-inline"><?php esc_html_e( 'Update Forum', 'bbpress' ); ?></h1> 1158 <hr class="wp-header-end"> 1140 1159 1141 1160 <?php … … 1180 1199 1181 1200 <div class="wrap"> 1182 <h1><?php esc_html_e( 'Update Forums', 'bbpress' ); ?></h1> 1201 <h1 class="wp-heading-inline"><?php esc_html_e( 'Update Forums', 'bbpress' ); ?></h1> 1202 <hr class="wp-header-end"> 1183 1203 1184 1204 <?php -
trunk/src/includes/admin/settings.php
r6869 r6896 1495 1495 1496 1496 <div class="wrap"> 1497 <h1 ><?php esc_html_e( 'Forums Settings', 'bbpress' ) ?></h1>1497 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forums Settings', 'bbpress' ) ?></h1> 1498 1498 <hr class="wp-header-end"> 1499 1499 … … 1774 1774 1775 1775 <div class="wrap"> 1776 <h1 ><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1>1776 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 1777 1777 <hr class="wp-header-end"> 1778 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( esc_html__( 'Import Forums', 'bbpress' )); ?></h2>1778 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( 'bbp-converter' ); ?></h2> 1779 1779 1780 1780 <div class="bbp-converter-wrap"> -
trunk/src/includes/admin/tools.php
r6892 r6896 478 478 479 479 // Setup tab HTML 480 $is_current = (bool) ( $tab[' name']== $active_tab );480 $is_current = (bool) ( $tab['page'] === $active_tab ); 481 481 $tab_class = $is_current ? $active_class : $idle_class; 482 482 $tab_url = add_query_arg( array( 'page' => $tab['page'] ), admin_url( 'tools.php' ) ); -
trunk/src/includes/admin/tools/repair.php
r6891 r6896 26 26 27 27 <div class="wrap"> 28 <h1><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 29 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( esc_html__( 'Repair Forums', 'bbpress' ) ); ?></h2> 28 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 29 <hr class="wp-header-end"> 30 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( 'bbp-repair' ); ?></h2> 30 31 31 32 <p><?php esc_html_e( 'bbPress keeps track of relationships between forums, topics, replies, topic-tags, favorites, subscriptions, and users. Occasionally these relationships become out of sync, most often after an import or migration. Use the tools below to manually recalculate these relationships.', 'bbpress' ); ?></p> -
trunk/src/includes/admin/tools/reset.php
r6759 r6896 21 21 22 22 <div class="wrap"> 23 <h1><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 24 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( esc_html__( 'Reset Forums', 'bbpress' ) ); ?></h2> 23 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 24 <hr class="wp-header-end"> 25 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( 'bbp-reset' ); ?></h2> 25 26 <p><?php esc_html_e( 'Revert your forums back to a brand new installation, as if bbPress were never installed. This process cannot be undone.', 'bbpress' ); ?></p> 26 27 -
trunk/src/includes/admin/tools/upgrade.php
r6895 r6896 23 23 24 24 <div class="wrap"> 25 <h1><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 26 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( esc_html__( 'Upgrade Forums', 'bbpress' ) ); ?></h2> 25 <h1 class="wp-heading-inline"><?php esc_html_e( 'Forum Tools', 'bbpress' ); ?></h1> 26 <hr class="wp-header-end"> 27 <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( 'bbp-upgrade' ); ?></h2> 27 28 28 29 <p><?php esc_html_e( 'As bbPress improves, occasionally database upgrades are required but some forums are too large to upgrade automatically. Use the tools below to manually run upgrade routines.', 'bbpress' ); ?></p> -
trunk/src/includes/core/options.php
r6877 r6896 33 33 34 34 '_bbp_db_version' => 0, // Database version 35 '_bbp_db_ upgrade_skipped' => 0, // Database upgrade skipped35 '_bbp_db_pending_upgrades' => array(), // Database upgrades pending 36 36 37 37 /** Flags *************************************************************/ -
trunk/src/includes/core/update.php
r6876 r6896 352 352 bbp_admin_upgrade_user_forum_subscriptions(); 353 353 } else { 354 update_option( '_bbp_db_upgrade_skipped', $raw_db_version ); 354 bbp_add_pending_upgrade( 'bbp-user-favorites-move' ); 355 bbp_add_pending_upgrade( 'bbp-user-topic-subscriptions-move' ); 356 bbp_add_pending_upgrade( 'bbp-user-forum-subscriptions-move' ); 355 357 356 358 // Set strategy to pre-2.6 on large network … … 370 372 bbp_admin_upgrade_user_engagements(); 371 373 } else { 372 update_option( '_bbp_db_upgrade_skipped', $raw_db_version);374 bbp_add_pending_upgrade( 'bbp-user-topic-engagements-move' ); 373 375 374 376 // Set strategy to pre-2.6 on large network … … 491 493 wp_get_current_user(); 492 494 } 495 496 /** Pending Upgrades **********************************************************/ 497 498 /** 499 * Return the number of pending upgrades 500 * 501 * @since 2.6.0 bbPress (r6895) 502 * 503 * @return int 504 */ 505 function bbp_get_pending_upgrade_count() { 506 return count( (array) bbp_get_pending_upgrades() ); 507 } 508 509 /** 510 * Return an array of pending upgrades 511 * 512 * @since 2.6.0 bbPress (r6895) 513 * 514 * @return array 515 */ 516 function bbp_get_pending_upgrades() { 517 return (array) get_option( '_bbp_db_pending_upgrades', array() ); 518 } 519 520 /** 521 * Add an upgrade ID to pending upgrades array 522 * 523 * @since 2.6.0 bbPress (r6895) 524 * 525 * @param string $upgrade_id 526 */ 527 function bbp_add_pending_upgrade( $upgrade_id = '' ) { 528 529 // Get the pending upgrades option 530 $pending = bbp_get_pending_upgrades(); 531 532 // Maybe add upgrade ID to end of pending array 533 if ( ! isset( $pending[ $upgrade_id ] ) ) { 534 array_push( $pending, $upgrade_id ); 535 } 536 537 // Update and return 538 return update_option( '_bbp_db_pending_upgrades', $pending ); 539 } 540 541 /** 542 * Add an upgrade ID to pending upgrades array 543 * 544 * @since 2.6.0 bbPress (r6895) 545 * 546 * @param string $upgrade_id 547 */ 548 function bbp_remove_pending_upgrade( $upgrade_id = '' ) { 549 550 // Get the pending upgrades option 551 $pending = bbp_get_pending_upgrades(); 552 553 // Maybe remove upgrade ID from pending array 554 if ( isset( $pending[ $upgrade_id ] ) ) { 555 unset( $pending[ $upgrade_id ] ); 556 } 557 558 // Update and return 559 return update_option( '_bbp_db_pending_upgrades', $pending ); 560 } 561 562 /** 563 * Delete all pending upgrades 564 * 565 * @since 2.6.0 bbPress (r6895) 566 */ 567 function bbp_clear_pending_upgrades() { 568 return delete_option( '_bbp_db_pending_upgrades' ); 569 }
Note: See TracChangeset
for help on using the changeset viewer.