Changeset 2789 for branches/plugin/bbp-includes/bbp-general-template.php
- Timestamp:
- 01/09/2011 10:06:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/plugin/bbp-includes/bbp-general-template.php ¶
r2782 r2789 297 297 298 298 if ( !empty( $wp_query->bbp_is_user_profile_edit ) && $wp_query->bbp_is_user_profile_edit == true ) 299 return true; 300 301 return false; 302 } 303 304 /** 305 * Check if current page is a view page 306 * 307 * @since bbPress (r2789) 308 * 309 * @uses WP_Query Checks if WP_Query::bbp_is_view is true 310 * @return bool Is it a view page? 311 */ 312 function bbp_is_view() { 313 global $wp_query; 314 315 if ( !empty( $wp_query->bbp_is_view ) && $wp_query->bbp_is_view == true ) 299 316 return true; 300 317 … … 597 614 /** END Form Functions ********************************************************/ 598 615 616 /** Start Views ***************************************************************/ 617 618 /** 619 * Output the view id 620 * 621 * @since bbPress (r2789) 622 * 623 * @param string $view Optional. View id 624 * @uses bbp_get_view_id() To get the view id 625 */ 626 function bbp_view_id( $view = '' ) { 627 echo bbp_get_view_id( $view ); 628 } 629 630 /** 631 * Get the view id 632 * 633 * If a view id is supplied, that is used. Otherwise the 'bbp_view' 634 * query var is checked for. 635 * 636 * @since bbPress (r2789) 637 * 638 * @param string $view Optional. View id. 639 * @uses sanitize_title() To sanitize the view id 640 * @uses get_query_var() To get the view id from query var 'bbp_view' 641 * @return bool|string ID on success, false on failure 642 */ 643 function bbp_get_view_id( $view = '' ) { 644 global $bbp; 645 646 $view = !empty( $view ) ? sanitize_title( $view ) : get_query_var( 'bbp_view' ); 647 648 if ( array_key_exists( $view, $bbp->views ) ) 649 return $view; 650 651 return false; 652 } 653 654 /** 655 * Output the view name aka title 656 * 657 * @since bbPress (r2789) 658 * 659 * @param string $view Optional. View id 660 * @uses bbp_get_view_title() To get the view title 661 */ 662 function bbp_view_title( $view = '' ) { 663 echo bbp_get_view_title( $view ); 664 } 665 666 /** 667 * Get the view name aka title 668 * 669 * If a view id is supplied, that is used. Otherwise the bbp_view 670 * query var is checked for. 671 * 672 * @since bbPress (r2789) 673 * 674 * @param string $view Optional. View id 675 * @uses bbp_get_view_id() To get the view id 676 * @return bool|string Title on success, false on failure 677 */ 678 function bbp_get_view_title( $view = '' ) { 679 global $bbp; 680 681 if ( !$view = bbp_get_view_id( $view ) ) 682 return false; 683 684 return $bbp->views[$view]['title']; 685 } 686 687 /** 688 * Output the view url 689 * 690 * @since bbPress (r2789) 691 * 692 * @param string $view Optional. View id 693 * @uses bbp_get_view_url() To get the view url 694 */ 695 function bbp_view_url( $view = false ) { 696 echo bbp_get_view_url( $view ); 697 } 698 /** 699 * Return the view url 700 * 701 * @since bbPress (r2789) 702 * 703 * @param string $view Optional. View id 704 * @uses sanitize_title() To sanitize the view id 705 * @uses home_url() To get blog home url 706 * @uses add_query_arg() To add custom args to the url 707 * @uses apply_filters() Calls 'bbp_get_view_url' with the view url, 708 * used view id 709 * @return string View url (or home url if the view was not found) 710 */ 711 function bbp_get_view_url( $view = false ) { 712 global $bbp, $wp_rewrite; 713 714 if ( !$view = bbp_get_view_id( $view ) ) 715 return home_url(); 716 717 if ( !empty( $wp_rewrite->permalink_structure ) ) { 718 $url = $wp_rewrite->front . $bbp->view_slug . '/' . $view; 719 $url = home_url( user_trailingslashit( $url ) ); 720 } else { 721 $url = add_query_arg( array( 'bbp_view' => $view ), home_url( '/' ) ); 722 } 723 724 return apply_filters( 'bbp_get_view_link', $url, $view ); 725 } 726 727 /** End Views *****************************************************************/ 728 599 729 /** Start General Functions ***************************************************/ 600 730 … … 712 842 return apply_filters( 'bbp_get_breadcrumb', $trail . get_the_title() ); 713 843 } 714 844 715 845 /** 716 846 * Output all of the allowed tags in HTML format with attributes. … … 721 851 * @since bbPress (r2780) 722 852 * 723 * @uses bbp_get_allowed_tags() 853 * @uses bbp_get_allowed_tags() 724 854 */ 725 855 function bbp_allowed_tags() {
Note: See TracChangeset
for help on using the changeset viewer.