Changeset 3488 for trunk/bp-core/bp-core-templatetags.php
- Timestamp:
- 11/27/2010 10:21:26 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-templatetags.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-templatetags.php
r3479 r3488 1518 1518 /* Template is_() functions to determine the current page */ 1519 1519 1520 /** 1521 * Checks if the site's front page is set to the specified BuddyPress component page in wp-admin's Settings > Reading screen. 1522 * 1523 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() 1524 * @global $current_blog WordPress global containing information and settings for the current blog being viewed. 1525 * @param string $component Optional; name of the component to check for. If not specified, uses $bp->current_component. 1526 * @return bool True if the specified component is set to be the site's front page. 1527 * @since 1.3 1528 */ 1529 function bp_is_component_front_page( $component='' ) { 1530 global $bp, $current_blog; 1531 1532 if ( !$component && !empty( $bp->current_component ) ) 1533 $component = $bp->current_component; 1534 1535 if ( is_main_site() ) 1536 $path = bp_core_get_site_path(); 1537 else 1538 $path = $current_blog->path; 1539 1540 if ( 'page' != get_option( 'show_on_front' ) || !$component || empty( $bp->pages->{$component} ) || $_SERVER['REQUEST_URI'] != $path ) 1541 return false; 1542 1543 return apply_filters( 'bp_is_component_front_page', ( $bp->pages->{$component}->id == get_option( 'page_on_front' ) ), $component ); 1544 } 1545 1520 1546 function bp_is_blog_page() { 1521 1547 global $bp, $is_member_page, $wp_query; … … 1542 1568 function bp_is_home() { return bp_is_my_profile(); } 1543 1569 1570 /** 1571 * Is the user on the front page of the site? 1572 * 1573 * @deprecated 1.3 1574 * @deprecated Use is_front_page() 1575 * @return bool 1576 */ 1544 1577 function bp_is_front_page() { 1545 if ( 'posts' == get_option('show_on_front') && is_home() ) 1546 return true; 1547 else if ( bp_is_activity_front_page() ) 1548 return true; 1549 else 1550 return is_front_page(); 1551 } 1552 1578 _deprecated_function( __FUNCTION__, '1.3', "is_front_page()" ); 1579 return is_front_page(); 1580 } 1581 1582 /** 1583 * Is the front page of the site set to the Activity component? 1584 * 1585 * @deprecated 1.3 1586 * @deprecated Use bp_is_component_front_page( 'activity' ) 1587 * @return bool 1588 */ 1553 1589 function bp_is_activity_front_page() { 1554 global $current_blog; 1555 1556 if ( is_main_site() ) 1557 $path = bp_core_get_site_path(); 1558 else 1559 $path = $current_blog->path; 1560 1561 return ( 'page' == get_option('show_on_front') && 'activity' == get_option('page_on_front') && $_SERVER['REQUEST_URI'] == $path ); 1590 _deprecated_function( __FUNCTION__, '1.3', "bp_is_component_front_page( 'activity' )" ); 1591 return bp_is_component_front_page( 'activity' ); 1562 1592 } 1563 1593 … … 1980 2010 $bp_classes = array(); 1981 2011 1982 if ( bp_is_front_page() )2012 if ( is_front_page() ) 1983 2013 $bp_classes[] = 'home-page'; 1984 2014 … … 1989 2019 $bp_classes[] = 'profile'; 1990 2020 1991 if ( bp_is_activity_component() && !bp_is_blog_page() || ( bp_is_activity_front_page() && bp_is_front_page() ))2021 if ( bp_is_activity_component() && !bp_is_blog_page() ) 1992 2022 $bp_classes[] = 'activity'; 1993 2023 1994 if ( bp_is_blogs_component() && !bp_is_blog_page() )2024 if ( bp_is_blogs_component() && !bp_is_blog_page() ) 1995 2025 $bp_classes[] = 'blogs'; 1996 2026 … … 1998 2028 $bp_classes[] = 'messages'; 1999 2029 2000 if ( bp_is_friends_component() && !bp_is_blog_page() )2030 if ( bp_is_friends_component() && !bp_is_blog_page() ) 2001 2031 $bp_classes[] = 'friends'; 2002 2032 2003 if ( bp_is_groups_component() && !bp_is_blog_page() )2033 if ( bp_is_groups_component() && !bp_is_blog_page() ) 2004 2034 $bp_classes[] = 'groups'; 2005 2035
Note: See TracChangeset
for help on using the changeset viewer.