Changeset 5829 for trunk/src/includes/common/template.php
- Timestamp:
- 07/14/2015 12:46:38 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/common/template.php (modified) (50 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/template.php
r5827 r5829 130 130 131 131 // Supplied ID is a forum 132 if ( ! empty( $post_id ) && ( bbp_get_forum_post_type() === get_post_type( $post_id ) ) ) {132 if ( ! empty( $post_id ) && ( bbp_get_forum_post_type() === get_post_type( $post_id ) ) ) { 133 133 $retval = true; 134 134 } … … 154 154 155 155 // In forum archive 156 if ( is_post_type_archive( bbp_get_forum_post_type() ) || bbp_is_query_name( 'bbp_forum_archive' ) || ! empty( $wp_query->bbp_show_topics_on_root ) ) {156 if ( is_post_type_archive( bbp_get_forum_post_type() ) || bbp_is_query_name( 'bbp_forum_archive' ) || ! empty( $wp_query->bbp_show_topics_on_root ) ) { 157 157 $retval = true; 158 158 } … … 206 206 207 207 // Check query 208 if ( ! empty( $wp_query->bbp_is_forum_edit ) && ( $wp_query->bbp_is_forum_edit === true ) ) {208 if ( ! empty( $wp_query->bbp_is_forum_edit ) && ( $wp_query->bbp_is_forum_edit === true ) ) { 209 209 $retval = true; 210 210 211 211 // Editing in admin 212 } elseif ( is_admin() && ( 'post.php' === $pagenow ) && ( get_post_type() === bbp_get_forum_post_type() ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) {212 } elseif ( is_admin() && ( 'post.php' === $pagenow ) && ( get_post_type() === bbp_get_forum_post_type() ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) { 213 213 $retval = true; 214 214 } … … 233 233 234 234 // Supplied ID is a topic 235 if ( ! empty( $post_id ) && ( bbp_get_topic_post_type() === get_post_type( $post_id ) ) ) {235 if ( ! empty( $post_id ) && ( bbp_get_topic_post_type() === get_post_type( $post_id ) ) ) { 236 236 $retval = true; 237 237 } … … 308 308 309 309 // Check query 310 if ( ! empty( $wp_query->bbp_is_topic_edit ) && ( $wp_query->bbp_is_topic_edit === true ) ) {310 if ( ! empty( $wp_query->bbp_is_topic_edit ) && ( $wp_query->bbp_is_topic_edit === true ) ) { 311 311 $retval = true; 312 312 313 313 // Editing in admin 314 } elseif ( is_admin() && ( 'post.php' === $pagenow ) && ( get_post_type() === bbp_get_topic_post_type() ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) {314 } elseif ( is_admin() && ( 'post.php' === $pagenow ) && ( get_post_type() === bbp_get_topic_post_type() ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) { 315 315 $retval = true; 316 316 } … … 333 333 334 334 // Check topic edit and GET params 335 if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'merge' === $_GET['action'] ) ) {335 if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'merge' === $_GET['action'] ) ) { 336 336 return true; 337 337 } … … 354 354 355 355 // Check topic edit and GET params 356 if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'split' === $_GET['action'] ) ) {356 if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'split' === $_GET['action'] ) ) { 357 357 $retval = true; 358 358 } … … 384 384 385 385 // Check tax and query vars 386 if ( is_tax( bbp_get_topic_tag_tax_id() ) || ! empty( bbpress()->topic_query->is_tax ) || get_query_var( 'bbp_topic_tag' ) ) {386 if ( is_tax( bbp_get_topic_tag_tax_id() ) || ! empty( bbpress()->topic_query->is_tax ) || get_query_var( 'bbp_topic_tag' ) ) { 387 387 $retval = true; 388 388 } … … 411 411 412 412 // Check query 413 if ( ! empty( $wp_query->bbp_is_topic_tag_edit ) && ( true === $wp_query->bbp_is_topic_tag_edit ) ) {413 if ( ! empty( $wp_query->bbp_is_topic_tag_edit ) && ( true === $wp_query->bbp_is_topic_tag_edit ) ) { 414 414 $retval = true; 415 415 416 416 // Editing in admin 417 } elseif ( is_admin() && ( 'edit-tags.php' === $pagenow ) && ( bbp_get_topic_tag_tax_id() === $taxnow ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) {417 } elseif ( is_admin() && ( 'edit-tags.php' === $pagenow ) && ( bbp_get_topic_tag_tax_id() === $taxnow ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) { 418 418 $retval = true; 419 419 } … … 468 468 469 469 // Supplied ID is a reply 470 if ( ! empty( $post_id ) && ( bbp_get_reply_post_type() === get_post_type( $post_id ) ) ) {470 if ( ! empty( $post_id ) && ( bbp_get_reply_post_type() === get_post_type( $post_id ) ) ) { 471 471 $retval = true; 472 472 } … … 490 490 491 491 // Check query 492 if ( ! empty( $wp_query->bbp_is_reply_edit ) && ( true === $wp_query->bbp_is_reply_edit ) ) {492 if ( ! empty( $wp_query->bbp_is_reply_edit ) && ( true === $wp_query->bbp_is_reply_edit ) ) { 493 493 $retval = true; 494 494 495 495 // Editing in admin 496 } elseif ( is_admin() && ( 'post.php' === $pagenow ) && ( get_post_type() === bbp_get_reply_post_type() ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) {496 } elseif ( is_admin() && ( 'post.php' === $pagenow ) && ( get_post_type() === bbp_get_reply_post_type() ) && ( ! empty( $_GET['action'] ) && ( 'edit' === $_GET['action'] ) ) ) { 497 497 $retval = true; 498 498 } … … 513 513 514 514 // Check reply edit and GET params 515 if ( bbp_is_reply_edit() && ! empty( $_GET['action'] ) && ( 'move' === $_GET['action'] ) ) {515 if ( bbp_is_reply_edit() && ! empty( $_GET['action'] ) && ( 'move' === $_GET['action'] ) ) { 516 516 $retval = true; 517 517 } … … 564 564 565 565 // Check query 566 if ( ! empty( $wp_query->bbp_is_single_user_favs ) && ( true === $wp_query->bbp_is_single_user_favs ) ) {566 if ( ! empty( $wp_query->bbp_is_single_user_favs ) && ( true === $wp_query->bbp_is_single_user_favs ) ) { 567 567 $retval = true; 568 568 } … … 585 585 586 586 // Check query 587 if ( ! empty( $wp_query->bbp_is_single_user_subs ) && ( true === $wp_query->bbp_is_single_user_subs ) ) {587 if ( ! empty( $wp_query->bbp_is_single_user_subs ) && ( true === $wp_query->bbp_is_single_user_subs ) ) { 588 588 $retval = true; 589 589 } … … 607 607 608 608 // Check query 609 if ( ! empty( $wp_query->bbp_is_single_user_topics ) && ( true === $wp_query->bbp_is_single_user_topics ) ) {609 if ( ! empty( $wp_query->bbp_is_single_user_topics ) && ( true === $wp_query->bbp_is_single_user_topics ) ) { 610 610 $retval = true; 611 611 } … … 629 629 630 630 // Check query 631 if ( ! empty( $wp_query->bbp_is_single_user_replies ) && ( true === $wp_query->bbp_is_single_user_replies ) ) {631 if ( ! empty( $wp_query->bbp_is_single_user_replies ) && ( true === $wp_query->bbp_is_single_user_replies ) ) { 632 632 $retval = true; 633 633 } … … 653 653 654 654 // Check query 655 if ( ! empty( $wp_query->bbp_is_single_user_home ) && ( true === $wp_query->bbp_is_single_user_home ) ) {655 if ( ! empty( $wp_query->bbp_is_single_user_home ) && ( true === $wp_query->bbp_is_single_user_home ) ) { 656 656 $retval = true; 657 657 } … … 697 697 698 698 // Check query 699 if ( ! empty( $wp_query->bbp_is_single_user ) && ( true === $wp_query->bbp_is_single_user ) ) {699 if ( ! empty( $wp_query->bbp_is_single_user ) && ( true === $wp_query->bbp_is_single_user ) ) { 700 700 $retval = true; 701 701 } … … 719 719 720 720 // Check query 721 if ( ! empty( $wp_query->bbp_is_single_user_edit ) && ( true === $wp_query->bbp_is_single_user_edit ) ) {721 if ( ! empty( $wp_query->bbp_is_single_user_edit ) && ( true === $wp_query->bbp_is_single_user_edit ) ) { 722 722 $retval = true; 723 723 } … … 741 741 742 742 // Check query 743 if ( ! empty( $wp_query->bbp_is_single_user_profile ) && ( true === $wp_query->bbp_is_single_user_profile ) ) {743 if ( ! empty( $wp_query->bbp_is_single_user_profile ) && ( true === $wp_query->bbp_is_single_user_profile ) ) { 744 744 $retval = true; 745 745 } … … 763 763 764 764 // Check query 765 if ( ! empty( $wp_query->bbp_is_single_user_topics ) && ( true === $wp_query->bbp_is_single_user_topics ) ) {765 if ( ! empty( $wp_query->bbp_is_single_user_topics ) && ( true === $wp_query->bbp_is_single_user_topics ) ) { 766 766 $retval = true; 767 767 } … … 785 785 786 786 // Check query 787 if ( ! empty( $wp_query->bbp_is_single_user_replies ) && ( true === $wp_query->bbp_is_single_user_replies ) ) {787 if ( ! empty( $wp_query->bbp_is_single_user_replies ) && ( true === $wp_query->bbp_is_single_user_replies ) ) { 788 788 $retval = true; 789 789 } … … 808 808 809 809 // Check query 810 if ( ! empty( $wp_query->bbp_is_view ) && ( true === $wp_query->bbp_is_view ) ) {810 if ( ! empty( $wp_query->bbp_is_view ) && ( true === $wp_query->bbp_is_view ) ) { 811 811 $retval = true; 812 812 } … … 841 841 842 842 // Check query 843 if ( ! empty( $wp_query->bbp_is_search ) && ( true === $wp_query->bbp_is_search ) ) {843 if ( ! empty( $wp_query->bbp_is_search ) && ( true === $wp_query->bbp_is_search ) ) { 844 844 $retval = true; 845 845 } … … 879 879 880 880 // Check query 881 if ( ! empty( $wp_query->bbp_search_terms ) ) {881 if ( ! empty( $wp_query->bbp_search_terms ) ) { 882 882 $retval = true; 883 883 } … … 889 889 890 890 // Check $_REQUEST 891 if ( empty( $retval ) && ! empty( $_REQUEST[ bbp_get_search_rewrite_id() ] ) ) {891 if ( empty( $retval ) && ! empty( $_REQUEST[ bbp_get_search_rewrite_id() ] ) ) { 892 892 $retval = true; 893 893 } … … 911 911 912 912 // Check query 913 if ( ! empty( $wp_query->bbp_is_edit ) && ( $wp_query->bbp_is_edit === true ) ) {913 if ( ! empty( $wp_query->bbp_is_edit ) && ( $wp_query->bbp_is_edit === true ) ) { 914 914 $retval = true; 915 915 } … … 1058 1058 1059 1059 // Add bbPress class if we are within a bbPress page 1060 if ( ! empty( $bbp_classes ) ) {1060 if ( ! empty( $bbp_classes ) ) { 1061 1061 $bbp_classes[] = 'bbpress'; 1062 1062 } … … 1467 1467 1468 1468 // Force array 1469 if ( ! empty( $r['exclude'] ) && !is_array( $r['exclude'] ) ) {1469 if ( ! empty( $r['exclude'] ) && !is_array( $r['exclude'] ) ) { 1470 1470 $r['exclude'] = explode( ',', $r['exclude'] ); 1471 1471 } … … 1499 1499 1500 1500 // Setup the tab index attribute 1501 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . intval( $r['tab'] ) . '"' : '';1501 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . intval( $r['tab'] ) . '"' : ''; 1502 1502 1503 1503 // Open the select tag … … 1506 1506 1507 1507 // Display a leading 'no-value' option, with or without custom text 1508 if ( ! empty( $r['show_none'] ) || !empty( $r['none_found'] ) ) {1508 if ( ! empty( $r['show_none'] ) || ! empty( $r['none_found'] ) ) { 1509 1509 1510 1510 // Open the 'no-value' option tag … … 1547 1547 1548 1548 // Items found so walk the tree 1549 if ( ! empty( $r['posts'] ) ) {1549 if ( ! empty( $r['posts'] ) ) { 1550 1550 $retval .= walk_page_dropdown_tree( $r['posts'], 0, $r ); 1551 1551 } … … 1817 1817 1818 1818 // Output something before the editor 1819 if ( ! empty( $r['before'] ) ) {1819 if ( ! empty( $r['before'] ) ) { 1820 1820 echo $r['before']; 1821 1821 } … … 1859 1859 1860 1860 // Setup the tab index attribute 1861 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . intval( $r['tab'] ) . '"' : ''; ?>1861 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . intval( $r['tab'] ) . '"' : ''; ?> 1862 1862 1863 1863 <textarea id="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" class="<?php echo esc_attr( $r['editor_class'] ); ?>" name="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" cols="60" rows="<?php echo esc_attr( $r['textarea_rows'] ); ?>" <?php echo $tab; ?>><?php echo $post_content; ?></textarea> … … 1866 1866 1867 1867 // Output something after the editor 1868 if ( ! empty( $r['after'] ) ) {1868 if ( ! empty( $r['after'] ) ) { 1869 1869 echo $r['after']; 1870 1870 } … … 1983 1983 $bbp = bbpress(); 1984 1984 1985 if ( ! empty( $view ) ) {1985 if ( ! empty( $view ) ) { 1986 1986 $view = sanitize_title( $view ); 1987 1987 } elseif ( ! empty( $bbp->current_view_id ) ) { … … 2203 2203 2204 2204 // Set home text to page title 2205 if ( ! empty( $front_id ) ) {2205 if ( ! empty( $front_id ) ) { 2206 2206 $pre_front_text = get_the_title( $front_id ); 2207 2207 … … 2217 2217 if ( empty( $args['root_text'] ) ) { 2218 2218 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 2219 if ( ! empty( $page ) ) {2219 if ( ! empty( $page ) ) { 2220 2220 $root_id = $page->ID; 2221 2221 } … … 2226 2226 2227 2227 // Root slug is also the front page 2228 if ( ! empty( $front_id ) && ( $front_id === $root_id ) ) {2228 if ( ! empty( $front_id ) && ( $front_id === $root_id ) ) { 2229 2229 $pre_include_root = false; 2230 2230 } … … 2236 2236 2237 2237 // Don't show root if viewing page in place of forum archive 2238 if ( ! empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id === get_the_ID() ) ) ) {2238 if ( ! empty( $root_id ) && ( ( is_single() || is_page() ) && ( $root_id === get_the_ID() ) ) ) { 2239 2239 $pre_include_root = false; 2240 2240 } … … 2271 2271 2272 2272 // Topic Tag (or theme compat topic tag) 2273 } elseif ( bbp_is_topic_tag() || ( get_query_var( 'bbp_topic_tag' ) && ! bbp_is_topic_tag_edit() ) ) {2273 } elseif ( bbp_is_topic_tag() || ( get_query_var( 'bbp_topic_tag' ) && ! bbp_is_topic_tag_edit() ) ) { 2274 2274 2275 2275 // Always include the tag name … … 2335 2335 2336 2336 // Do we want to include a link to home? 2337 if ( ! empty( $r['include_home'] ) || empty( $r['home_text'] ) ) {2337 if ( ! empty( $r['include_home'] ) || empty( $r['home_text'] ) ) { 2338 2338 $crumbs[] = '<a href="' . trailingslashit( home_url() ) . '" class="bbp-breadcrumb-home">' . $r['home_text'] . '</a>'; 2339 2339 } 2340 2340 2341 2341 // Do we want to include a link to the forum root? 2342 if ( ! empty( $r['include_root'] ) || empty( $r['root_text'] ) ) {2342 if ( ! empty( $r['include_root'] ) || empty( $r['root_text'] ) ) { 2343 2343 2344 2344 // Page exists at root slug path, so use its permalink 2345 2345 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 2346 if ( ! empty( $page ) ) {2346 if ( ! empty( $page ) ) { 2347 2347 $root_url = get_permalink( $page->ID ); 2348 2348 … … 2357 2357 2358 2358 // Ancestors exist 2359 if ( ! empty( $ancestors ) ) {2359 if ( ! empty( $ancestors ) ) { 2360 2360 2361 2361 // Loop through parents … … 2407 2407 2408 2408 // Add current page to breadcrumb 2409 if ( ! empty( $r['include_current'] ) || empty( $r['current_text'] ) ) {2409 if ( ! empty( $r['include_current'] ) || empty( $r['current_text'] ) ) { 2410 2410 $crumbs[] = $r['current_before'] . $r['current_text'] . $r['current_after']; 2411 2411 } … … 2421 2421 2422 2422 // Pad the separator 2423 if ( ! empty( $r['pad_sep'] ) ) {2423 if ( ! empty( $r['pad_sep'] ) ) { 2424 2424 if ( function_exists( 'mb_strlen' ) ) { 2425 2425 $sep = str_pad( $sep, mb_strlen( $sep ) + ( (int) $r['pad_sep'] * 2 ), ' ', STR_PAD_BOTH ); … … 2436 2436 2437 2437 // Build the trail 2438 $trail = ! empty( $crumbs ) ? ( $r['before'] . $r['crumb_before'] . implode( $sep . $r['crumb_after'] . $r['crumb_before'] , $crumbs ) . $r['crumb_after'] . $r['after'] ) : '';2438 $trail = ! empty( $crumbs ) ? ( $r['before'] . $r['crumb_before'] . implode( $sep . $r['crumb_after'] . $r['crumb_before'] , $crumbs ) . $r['crumb_after'] . $r['after'] ) : ''; 2439 2439 2440 2440 return apply_filters( 'bbp_get_breadcrumb', $trail, $crumbs, $r ); … … 2501 2501 2502 2502 // Bail if no notices or errors 2503 if ( ! bbp_has_errors() ) {2503 if ( ! bbp_has_errors() ) { 2504 2504 return; 2505 2505 } … … 2528 2528 2529 2529 // Display errors first... 2530 if ( ! empty( $errors ) ) : ?>2530 if ( ! empty( $errors ) ) : ?> 2531 2531 2532 2532 <div class="bbp-template-notice error" role="alert" tabindex="-1"> … … 2539 2539 2540 2540 // ...and messages last 2541 if ( ! empty( $messages ) ) : ?>2541 if ( ! empty( $messages ) ) : ?> 2542 2542 2543 2543 <div class="bbp-template-notice"> … … 2753 2753 $prefix = ''; 2754 2754 2755 if ( ! empty( $new_title ) ) {2755 if ( ! empty( $new_title ) ) { 2756 2756 $prefix = " $sep "; 2757 2757 }
Note: See TracChangeset
for help on using the changeset viewer.