Changeset 3265
- Timestamp:
- 05/29/2011 01:51:02 PM (14 years ago)
- Location:
- branches/plugin
- Files:
-
- 9 edited
-
bbp-includes/bbp-core-compatibility.php (modified) (13 diffs)
-
bbp-includes/bbp-core-hooks.php (modified) (2 diffs)
-
bbp-includes/bbp-core-shortcodes.php (modified) (1 diff)
-
bbp-includes/bbp-general-template.php (modified) (5 diffs)
-
bbp-includes/bbp-reply-functions.php (modified) (4 diffs)
-
bbp-includes/bbp-reply-template.php (modified) (3 diffs)
-
bbp-includes/bbp-topic-functions.php (modified) (4 diffs)
-
bbp-includes/bbp-topic-template.php (modified) (1 diff)
-
bbpress.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-compatibility.php
r3253 r3265 22 22 * Don't try anything you're about to witness here, at home. Ever. 23 23 */ 24 25 /** 26 * If not using a bbPress compatable theme, enqueue some basic styling and js 27 * 28 * @since bbPress (r3029) 29 * 30 * @global bbPress $bbp 31 * @uses bbp_set_theme_compat() Set the compatable theme to bbp-twentyten 32 * @uses current_theme_supports() Check bbPress theme support 33 * @uses wp_enqueue_style() Enqueue the bbp-twentyten default CSS 34 * @uses wp_enqueue_script() Enqueue the bbp-twentyten default topic JS 35 */ 36 function bbp_add_theme_compat() { 37 global $bbp; 38 39 // Check if current theme supports bbPress 40 if ( !current_theme_supports( 'bbpress' ) ) { 41 42 // Set the compat_theme global for help with loading template parts 43 bbp_set_theme_compat( $bbp->themes_dir . '/bbp-twentyten' ); 44 45 /** Default CSS ***************************************************/ 46 47 // Do not enqueue CSS in admin 48 if ( !is_admin() ) { 49 50 // Right to left 51 if ( is_rtl() ) { 52 wp_enqueue_style( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress-rtl.css' ); 53 54 // Left to right 55 } else { 56 wp_enqueue_style( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress.css' ); 57 } 58 } 59 } 60 } 24 61 25 62 /** … … 97 134 98 135 return apply_filters( 'bbp_get_theme_compat', $bbp->theme_compat ); 136 } 137 138 /** 139 * Gets true/false if page is currently inside theme compatibility 140 * 141 * @since bbPress (r3265) 142 * 143 * @global bbPress $bbp 144 * 145 * @return bool 146 */ 147 function bbp_in_theme_compat() { 148 global $bbp; 149 150 return $bbp->in_theme_compat; 151 } 152 153 /** 154 * Sets true/false if page is currently inside theme compatibility 155 * 156 * @since bbPress (r3265) 157 * 158 * @global bbPress $bbp 159 * 160 * @param bool $set 161 * 162 * @return bool 163 */ 164 function bbp_set_in_theme_compat( $set = true ) { 165 global $bbp; 166 167 $bbp->in_theme_compat = $set; 168 169 return (bool) $bbp->in_theme_compat; 99 170 } 100 171 … … 542 613 543 614 // Assume we are not in theme compat 544 $ in_theme_compat = false; $forum_id = 0;615 $forum_id = 0; 545 616 546 617 /** Users *************************************************************/ … … 549 620 550 621 // In Theme Compat 551 $in_theme_compat = true; 622 bbp_set_in_theme_compat(); 623 624 // Reset post 552 625 bbp_theme_compat_reset_post( array( 553 626 'post_title' => esc_attr( bbp_get_displayed_user_field( 'display_name' ) ) … … 560 633 561 634 // In Theme Compat 562 $in_theme_compat = true; 635 bbp_set_in_theme_compat(); 636 637 // Reset post 563 638 bbp_theme_compat_reset_post( array( 564 639 'ID' => 0, … … 577 652 578 653 // In Theme Compat 579 $in_theme_compat = true; 654 bbp_set_in_theme_compat(); 655 656 // Reset post 580 657 bbp_theme_compat_reset_post( array( 581 658 'ID' => 0, … … 592 669 593 670 // In Theme Compat 594 $in_theme_compat = true; 671 bbp_set_in_theme_compat(); 672 673 // Reset post 595 674 bbp_theme_compat_reset_post( array( 596 675 'ID' => bbp_get_topic_id(), … … 609 688 610 689 // In Theme Compat 611 $in_theme_compat = true; 690 bbp_set_in_theme_compat(); 691 692 // Reset post 612 693 bbp_theme_compat_reset_post( array( 613 694 'ID' => 0, … … 624 705 625 706 // In Theme Compat 626 $in_theme_compat = true; 707 bbp_set_in_theme_compat(); 708 709 // Reset post 627 710 bbp_theme_compat_reset_post( array( 628 711 'ID' => bbp_get_reply_id(), … … 640 723 641 724 // In Theme Compat 642 $in_theme_compat = true; 725 bbp_set_in_theme_compat(); 726 727 // Reset post 643 728 bbp_theme_compat_reset_post( array( 644 729 'ID' => 0, … … 657 742 658 743 // In Theme Compat 659 $in_theme_compat = true;744 bbp_set_in_theme_compat(); 660 745 661 746 // Stash the current term in a new var … … 676 761 // Single Forum 677 762 case bbp_get_forum_post_type() : 678 $forum_id = bbp_get_forum_id( get_the_ID());679 $ in_theme_compat = true;763 bbp_set_in_theme_compat(); 764 $forum_id = bbp_get_forum_id( get_the_ID() ); 680 765 break; 681 766 682 767 // Single Topic 683 768 case bbp_get_topic_post_type() : 684 $forum_id = bbp_get_topic_forum_id( get_the_ID());685 $ in_theme_compat = true;769 bbp_set_in_theme_compat(); 770 $forum_id = bbp_get_topic_forum_id( get_the_ID() ); 686 771 break; 687 772 688 773 // Single Reply 689 774 case bbp_get_reply_post_type() : 690 $forum_id = bbp_get_reply_forum_id( get_the_ID());691 $ in_theme_compat = true;775 bbp_set_in_theme_compat(); 776 $forum_id = bbp_get_reply_forum_id( get_the_ID() ); 692 777 break; 693 778 } … … 709 794 * the 'bbp_template_include' filter to override page.php. 710 795 */ 711 if ( true === $in_theme_compat) {796 if ( bbp_in_theme_compat() ) { 712 797 713 798 // Remove all filters from the_content -
branches/plugin/bbp-includes/bbp-core-hooks.php
r3243 r3265 35 35 add_action( 'init', 'bbp_init', 10 ); 36 36 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 12 ); 37 add_action( 'after_setup_theme', 'bbp_setup_theme_compat', 12 );38 37 39 38 /** … … 59 58 add_action( 'bbp_init', 'bbp_register_textdomain', 2 ); 60 59 add_action( 'bbp_init', 'bbp_setup_current_user', 4 ); 61 add_action( 'bbp_init', 'bbp_register_post_types', 6 ); 62 add_action( 'bbp_init', 'bbp_register_post_statuses', 8 ); 63 add_action( 'bbp_init', 'bbp_register_taxonomies', 10 ); 64 add_action( 'bbp_init', 'bbp_register_views', 12 ); 65 add_action( 'bbp_init', 'bbp_register_shortcodes', 14 ); 66 add_action( 'bbp_init', 'bbp_add_rewrite_tags', 16 ); 60 add_action( 'bbp_init', 'bbp_setup_theme_compat', 6 ); 61 add_action( 'bbp_init', 'bbp_register_post_types', 8 ); 62 add_action( 'bbp_init', 'bbp_register_post_statuses', 10 ); 63 add_action( 'bbp_init', 'bbp_register_taxonomies', 12 ); 64 add_action( 'bbp_init', 'bbp_register_views', 14 ); 65 add_action( 'bbp_init', 'bbp_register_shortcodes', 16 ); 66 add_action( 'bbp_init', 'bbp_add_rewrite_tags', 18 ); 67 67 add_action( 'bbp_init', 'bbp_ready', 999 ); 68 69 // Theme Compat 70 add_action( 'bbp_setup_theme_compat', 'bbp_add_theme_compat' ); 68 71 69 72 // Admin -
branches/plugin/bbp-includes/bbp-core-shortcodes.php
r3250 r3265 421 421 $this->_unset_globals(); 422 422 423 // Reset necessary forum_query attributes for topics loop to function 424 $bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type(); 425 $bbp->forum_query->in_the_loop = true; 426 $bbp->forum_query->post = get_post( $forum_id ); 427 428 // Reset necessary topic_query attributes for topics loop to function 429 $bbp->topic_query->query_vars['post_type'] = bbp_get_topic_post_type(); 430 $bbp->topic_query->in_the_loop = true; 431 $bbp->topic_query->post = get_post( $topic_id ); 423 // Reset the queries if not in theme compat 424 if ( !bbp_in_theme_compat() ) { 425 426 // Reset necessary forum_query attributes for topics loop to function 427 $bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type(); 428 $bbp->forum_query->in_the_loop = true; 429 $bbp->forum_query->post = get_post( $forum_id ); 430 431 // Reset necessary topic_query attributes for topics loop to function 432 $bbp->topic_query->query_vars['post_type'] = bbp_get_topic_post_type(); 433 $bbp->topic_query->in_the_loop = true; 434 $bbp->topic_query->post = get_post( $topic_id ); 435 } 432 436 433 437 // Start output buffer -
branches/plugin/bbp-includes/bbp-general-template.php
r3259 r3265 546 546 * and url 547 547 */ 548 function bbp_redirect_to_field( $url = '' ) { 549 // If no URL is passed, try to get the referer and then the request uri 550 if ( empty( $url ) && ( !$url = wp_get_referer() ) && ( !empty( $_SERVER['REQUEST_URI'] ) ) ) 551 $url = $_SERVER['REQUEST_URI']; 548 function bbp_redirect_to_field( $redirect_to = '' ) { 549 550 // Rejig the $redirect_to 551 if ( !isset( $_SERVER['REDIRECT_URL'] ) || ( !$redirect_to = home_url( $_SERVER['REDIRECT_URL'] ) ) ) 552 $redirect_to = wp_get_referer(); 553 554 // Make sure we are directing somewhere 555 if ( empty( $redirect_to ) ) 556 $redirect_to = home_url( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' ); 552 557 553 558 // Remove loggedout query arg if it's there 554 $url = (string) esc_attr( remove_query_arg( 'loggedout', $url ) ); 555 556 $referer_field = '<input type="hidden" name="redirect_to" value="' . $url . '" />'; 557 558 echo apply_filters( 'bbp_redirect_to_field', $referer_field, $url ); 559 $redirect_to = (string) esc_attr( remove_query_arg( 'loggedout', $redirect_to ) ); 560 $redirect_field = '<input type="hidden" name="redirect_to" value="' . $redirect_to . '" />'; 561 562 echo apply_filters( 'bbp_redirect_to_field', $redirect_field, $redirect_to ); 559 563 } 560 564 … … 920 924 ?> 921 925 922 <?php wp_nonce_field( 'bbp-new-reply' ); 926 <?php 927 928 wp_nonce_field( 'bbp-new-reply' ); 929 930 // Show redirect field if not viewing a specific topic 931 if ( !bbp_is_topic() ) : ?> 932 933 <input type="hidden" name="redirect_to" id="bbp_redirect_to" value="<?php the_permalink(); ?>" /> 934 935 <?php endif; 936 923 937 } 924 938 } … … 1259 1273 /** Current Text ******************************************************/ 1260 1274 1261 $pre_current_text = ( bbp_is_view() ) ? bbp_get_view_title() : get_the_title(); 1262 1275 // Forum archive 1276 if ( bbp_is_forum_archive() ) 1277 $pre_current_text = bbp_get_forum_archive_title(); 1278 1279 // Topic archive 1280 elseif ( bbp_is_topic_archive() ) 1281 $pre_current_text = bbp_get_topic_archive_title(); 1282 1283 // View 1284 elseif ( bbp_is_view() ) 1285 $pre_current_text = bbp_get_view_title(); 1286 1287 // Single Forum 1288 elseif ( bbp_is_forum() ) 1289 $pre_current_text = bbp_get_forum_title(); 1290 1291 // Single Topic 1292 elseif ( bbp_is_topic() ) 1293 $pre_current_text = bbp_get_topic_title(); 1294 1295 // Single Topic 1296 elseif ( bbp_is_reply() ) 1297 $pre_current_text = bbp_get_reply_title(); 1298 1299 // Single 1300 else 1301 $pre_current_text = get_the_title(); 1302 1263 1303 /** Parse Args ********************************************************/ 1264 1304 … … 1289 1329 1290 1330 // Get post ancestors 1291 if ( is_page() || is_single() )1331 if ( is_page() || is_single() || bbp_is_topic_edit() || bbp_is_reply_edit() ) 1292 1332 $ancestors = array_reverse( get_post_ancestors( get_the_ID() ) ); 1293 1333 1294 1334 // Do we want to include a link to home? 1295 if ( !empty( $include_home ) )1335 if ( !empty( $include_home ) || empty( $home_text ) ) 1296 1336 $breadcrumbs[] = '<a href="' . trailingslashit( home_url() ) . '" class="bbp-breadcrumb-home">' . $home_text . '</a>'; 1297 1337 1298 1338 // Do we want to include a link to the forum root? 1299 if ( !empty( $include_root ) )1339 if ( !empty( $include_root ) || empty( $root_text ) ) 1300 1340 $breadcrumbs[] = '<a href="' . trailingslashit( home_url( $bbp->root_slug ) ) . '" class="bbp-breadcrumb-root">' . $root_text . '</a>'; 1301 1341 … … 1337 1377 1338 1378 // Add current page to breadcrumb 1339 if ( !empty( $include_current ) )1379 if ( !empty( $include_current ) || empty( $pre_current_text ) ) 1340 1380 $breadcrumbs[] = '<span class="bbp-breadcrumb-current">' . $current_text . '</span>'; 1341 1381 -
branches/plugin/bbp-includes/bbp-reply-functions.php
r3255 r3265 134 134 * id, anonymous data and reply author 135 135 * @uses bbp_get_reply_url() To get the paginated url to the reply 136 * @uses wp_ redirect() To redirect to the reply url136 * @uses wp_safe_redirect() To redirect to the reply url 137 137 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error 138 138 * message … … 304 304 /** Redirect **************************************************/ 305 305 306 $reply_url = bbp_get_reply_url( $reply_id ); 307 308 if ( ( !empty( $_GET['view'] ) && ( 'all' === $_GET['view'] ) ) || ( $reply_data['post_status'] == $bbp->trash_status_id ) ) 306 // Redirect to 307 $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; 308 309 // View all? 310 $count_hidden = (bool) ( !empty( $_GET['view'] ) && ( 'all' == $_GET['view'] ) || ( $reply_data['post_status'] == $bbp->trash_status_id ) ); 311 312 // Get the reply URL 313 $reply_url = bbp_get_reply_url( $reply_id, $count_hidden, $redirect_to ); 314 315 // Add view all? 316 if ( !empty( $count_hidden ) ) 309 317 $reply_url = add_query_arg( array( 'view' => 'all' ), $reply_url ); 310 318 311 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url ); 319 // Allow to be filtered 320 $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $count_hidden, $redirect_to ); 312 321 313 322 /** Successful Save *******************************************/ 314 323 315 324 // Redirect back to new reply 316 wp_ redirect( $reply_url );325 wp_safe_redirect( $reply_url ); 317 326 318 327 // For good measure … … 355 364 * id, anonymous data, reply author and bool true (for edit) 356 365 * @uses bbp_get_reply_url() To get the paginated url to the reply 357 * @uses wp_ redirect() To redirect to the reply url366 * @uses wp_safe_redirect() To redirect to the reply url 358 367 * @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error 359 368 * message … … 525 534 do_action( 'bbp_edit_reply_post_extras', $reply_id ); 526 535 536 /** Redirect **************************************************/ 537 538 // Redirect to 539 $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; 540 541 // View all? 542 $count_hidden = (bool) ( !empty( $_GET['view'] ) && ( 'all' == $_GET['view'] ) ); 543 544 // Get the reply URL 545 $reply_url = bbp_get_reply_url( $reply_id, $count_hidden, $redirect_to ); 546 547 // Add view all? 548 if ( !empty( $count_hidden ) ) 549 $reply_url = add_query_arg( array( 'view' => 'all' ), $reply_url ); 550 551 // Allow to be filtered 552 $reply_url = apply_filters( 'bbp_edit_reply_redirect_to', $reply_url, $count_hidden, $redirect_to ); 553 527 554 /** Successful Edit *******************************************/ 528 555 529 556 // Redirect back to new reply 530 wp_ redirect( bbp_get_reply_url( $reply_id ));557 wp_safe_redirect( $reply_url ); 531 558 532 559 // For good measure -
branches/plugin/bbp-includes/bbp-reply-template.php
r3243 r3265 141 141 // If pretty permalinks are enabled, make our pagination pretty 142 142 if ( $wp_rewrite->using_permalinks() ) 143 $base = user_trailingslashit( trailingslashit( get_permalink( bbp_get_topic_id() ) ) . 'page/%#%/' ); 143 144 // Page or single 145 if ( is_page() || is_single() ) 146 $base = user_trailingslashit( trailingslashit( get_permalink() ) . 'page/%#%/' ); 147 148 // Topic 149 else 150 $base = user_trailingslashit( trailingslashit( get_permalink( bbp_get_topic_id() ) ) . 'page/%#%/' ); 151 144 152 else 145 153 $base = add_query_arg( 'paged', '%#%' ); … … 340 348 * automatically set to true. To override 341 349 * this, set $count_hidden = (int) -1 350 * @param $string $redirect_to Optional. Pass a redirect value for use with 351 * shortcodes and other fun things. 342 352 * @uses bbp_get_reply_id() To get the reply id 343 353 * @uses bbp_get_reply_topic_id() To get the reply topic id … … 352 362 * @return string Link to reply relative to paginated topic 353 363 */ 354 function bbp_get_reply_url( $reply_id = 0, $count_hidden = false ) {364 function bbp_get_reply_url( $reply_id = 0, $count_hidden = false, $redirect_to = '' ) { 355 365 global $bbp, $wp_rewrite; 356 366 357 367 // Set needed variables 358 $reply_id = bbp_get_reply_id ( $reply_id );359 $topic_id = bbp_get_reply_topic_id ( $reply_id );360 $topic_url = bbp_get_topic_permalink( $topic_id );361 $reply_position = bbp_get_reply_position ( $reply_id );368 $reply_id = bbp_get_reply_id ( $reply_id ); 369 $topic_id = bbp_get_reply_topic_id ( $reply_id ); 370 $topic_url = bbp_get_topic_permalink( $topic_id, $redirect_to ); 371 $reply_position = bbp_get_reply_position ( $reply_id ); 362 372 363 373 // Check if in query with pagination -
branches/plugin/bbp-includes/bbp-topic-functions.php
r3243 r3265 41 41 * @uses bbp_unstick_topic() To unstick the topic 42 42 * @uses bbp_get_topic_permalink() To get the topic permalink 43 * @uses wp_ redirect() To redirect to the topic link43 * @uses wp_safe_redirect() To redirect to the topic link 44 44 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error 45 45 * messages … … 240 240 /** Redirect **************************************************/ 241 241 242 $topic_url = bbp_get_topic_permalink( $topic_id ); 243 244 if ( $bbp->trash_status_id == $topic_data['post_status'] ) 242 // Redirect to 243 $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; 244 245 // View all? 246 $count_hidden = (bool) ( !empty( $_GET['view'] ) && ( 'all' == $_GET['view'] ) || ( $topic_data['post_status'] == $bbp->trash_status_id ) ); 247 248 // Get the topic URL 249 $topic_url = bbp_get_topic_permalink( $topic_id, $redirect_to ); 250 251 // Add view all? 252 if ( !empty( $count_hidden ) ) 245 253 $topic_url = add_query_arg( array( 'view' => 'all' ), $topic_url ); 246 254 247 $topic_url = apply_filters( 'bbp_new_topic_redirect_to', $topic_url ); 255 // Allow to be filtered 256 $topic_url = apply_filters( 'bbp_new_topic_redirect_to', $topic_url, $count_hidden, $redirect_to ); 248 257 249 258 /** Successful Save *******************************************/ 250 259 251 260 // Redirect back to new topic 252 wp_ redirect( $topic_url );261 wp_safe_redirect( $topic_url ); 253 262 254 263 // For good measure … … 294 303 * to another 295 304 * @uses bbp_get_topic_permalink() To get the topic permalink 296 * @uses wp_ redirect() To redirect to the topic link305 * @uses wp_safe_redirect() To redirect to the topic link 297 306 * @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error 298 307 * messages … … 504 513 do_action( 'bbp_edit_topic_post_extras', $topic_id ); 505 514 515 /** Redirect **************************************************/ 516 517 // Redirect to 518 $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; 519 520 // View all? 521 $count_hidden = (bool) ( !empty( $_GET['view'] ) && ( 'all' == $_GET['view'] ) ); 522 523 // Get the topic URL 524 $topic_url = bbp_get_topic_permalink( $topic_id, $redirect_to ); 525 526 // Add view all? 527 if ( !empty( $count_hidden ) ) 528 $topic_url = add_query_arg( array( 'view' => 'all' ), $topic_url ); 529 530 // Allow to be filtered 531 $topic_url = apply_filters( 'bbp_edit_topic_redirect_to', $topic_url, $count_hidden, $redirect_to ); 532 506 533 /** Successful Edit *******************************************/ 507 534 508 535 // Redirect back to new topic 509 wp_ redirect( bbp_get_topic_permalink( $topic_id ));536 wp_safe_redirect( $topic_url ); 510 537 511 538 // For good measure -
branches/plugin/bbp-includes/bbp-topic-template.php
r3254 r3265 422 422 * 423 423 * @param int $topic_id Optional. Topic id 424 * @param $string $redirect_to Optional. Pass a redirect value for use with 425 * shortcodes and other fun things. 424 426 * @uses bbp_get_topic_id() To get the topic id 425 427 * @uses get_permalink() To get the topic permalink 428 * @uses sanitize_url() To clean the redirect_to url 426 429 * @uses apply_filters() Calls 'bbp_get_topic_permalink' with the link 427 430 * and topic id 428 431 * @return string Permanent link to topic 429 432 */ 430 function bbp_get_topic_permalink( $topic_id = 0 ) {433 function bbp_get_topic_permalink( $topic_id = 0, $redirect_to = '' ) { 431 434 $topic_id = bbp_get_topic_id( $topic_id ); 432 435 433 return apply_filters( 'bbp_get_topic_permalink', get_permalink( $topic_id ), $topic_id ); 436 // Use the redirect address 437 if ( !empty( $redirect_to ) ) 438 $topic_permalink = sanitize_url( $redirect_to ); 439 440 // Use the topic permalink 441 else 442 $topic_permalink = get_permalink( $topic_id ); 443 444 return apply_filters( 'bbp_get_topic_permalink', $topic_permalink, $topic_id ); 434 445 } 435 446 -
branches/plugin/bbpress.php
r3249 r3265 240 240 var $tab_index; 241 241 242 /** Theme Compat **********************************************************/ 243 244 /** 245 * @var string Theme to use for theme compatibility 246 */ 247 var $theme_compat = ''; 248 249 /** 250 * @var bool If we are currently in theme compatibility 251 */ 252 var $in_theme_compat = false; 253 242 254 /** Functions *************************************************************/ 243 255 … … 425 437 // Generate rewrite rules 426 438 add_action( 'bbp_generate_rewrite_rules', array( $this, 'generate_rewrite_rules' ), 10 ); 427 428 // Check theme compatability429 add_action( 'bbp_setup_theme_compat', array( $this, 'theme_compat' ), 10 );430 439 } 431 440 … … 889 898 return $wp_rewrite; 890 899 } 891 892 /**893 * If not using a bbPress compatable theme, enqueue some basic styling and js894 *895 * @since bbPress (r3029)896 *897 * @global bbPress $bbp898 * @uses bbp_set_theme_compat() Set the compatable theme to bbp-twentyten899 * @uses current_theme_supports() Check bbPress theme support900 * @uses wp_enqueue_style() Enqueue the bbp-twentyten default CSS901 * @uses wp_enqueue_script() Enqueue the bbp-twentyten default topic JS902 */903 function theme_compat() {904 global $bbp;905 906 // Check if current theme supports bbPress907 if ( !current_theme_supports( 'bbpress' ) ) {908 909 // Set the compat_theme global for help with loading template parts910 bbp_set_theme_compat( $bbp->themes_dir . '/bbp-twentyten' );911 912 /** Default CSS ***************************************************/913 914 // Do not enqueue CSS in admin915 if ( !is_admin() ) {916 917 // Right to left918 if ( is_rtl() ) {919 wp_enqueue_style( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress-rtl.css' );920 921 // Left to right922 } else {923 wp_enqueue_style( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress.css' );924 }925 }926 }927 }928 900 } 929 901
Note: See TracChangeset
for help on using the changeset viewer.