Changeset 13799 for trunk/src/bp-members/bp-members-template.php
- Timestamp:
- 04/23/2024 09:39:11 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-template.php
r13647 r13799 19 19 */ 20 20 function bp_profile_slug() { 21 echo bp_get_profile_slug();21 echo esc_url( bp_get_profile_slug() ); 22 22 } 23 23 /** … … 46 46 */ 47 47 function bp_members_slug() { 48 echo bp_get_members_slug();48 echo esc_url( bp_get_members_slug() ); 49 49 } 50 50 /** … … 73 73 */ 74 74 function bp_members_root_slug() { 75 echo bp_get_members_root_slug();75 echo esc_url( bp_get_members_root_slug() ); 76 76 } 77 77 /** … … 216 216 */ 217 217 function bp_signup_slug() { 218 echo bp_get_signup_slug();218 echo esc_url( bp_get_signup_slug() ); 219 219 } 220 220 /** … … 249 249 */ 250 250 function bp_activate_slug() { 251 echo bp_get_activate_slug();251 echo esc_url( bp_get_activate_slug() ); 252 252 } 253 253 /** … … 282 282 */ 283 283 function bp_members_invitations_slug() { 284 echo bp_get_members_invitations_slug();284 echo esc_url( bp_get_members_invitations_slug() ); 285 285 } 286 286 /** … … 490 490 */ 491 491 function bp_members_pagination_count() { 492 echo bp_get_members_pagination_count();492 echo esc_html( bp_get_members_pagination_count() ); 493 493 } 494 494 /** … … 559 559 */ 560 560 function bp_members_pagination_links() { 561 // Escaping is done in WordPress's `paginate_links()` function. 562 // phpcs:ignore WordPress.Security.EscapeOutput 561 563 echo bp_get_members_pagination_links(); 562 564 } … … 589 591 */ 590 592 function bp_member_user_id() { 591 echo bp_get_member_user_id();593 echo intval( bp_get_member_user_id() ); 592 594 } 593 595 /** … … 625 627 */ 626 628 function bp_member_class( $classes = array() ) { 629 // phpcs:ignore WordPress.Security.EscapeOutput 627 630 echo bp_get_member_class( $classes ); 628 631 } … … 673 676 if ( $member_types = bp_get_member_type( $members_template->member->id, false ) ) { 674 677 foreach ( $member_types as $member_type ) { 675 $classes[] = sprintf( 'member-type-%s', esc_attr( $member_type ));678 $classes[] = sprintf( 'member-type-%s', $member_type ); 676 679 } 677 680 } … … 682 685 * @since 1.7.0 683 686 * 684 * @param string$classes Classes to be added to the HTML element.685 */ 686 $classes = a pply_filters( 'bp_get_member_class', $classes);687 * @param array $classes Classes to be added to the HTML element. 688 */ 689 $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_member_class', $classes ) ); 687 690 $classes = array_merge( $classes, array() ); 688 691 $retval = 'class="' . join( ' ', $classes ) . '"'; … … 697 700 */ 698 701 function bp_member_user_nicename() { 699 echo bp_get_member_user_nicename();702 echo esc_html( bp_get_member_user_nicename() ); 700 703 } 701 704 /** … … 727 730 */ 728 731 function bp_member_user_login() { 729 echo bp_get_member_user_login();732 echo esc_html( bp_get_member_user_login() ); 730 733 } 731 734 /** … … 757 760 */ 758 761 function bp_member_user_email() { 759 echo bp_get_member_user_email();762 echo esc_html( bp_get_member_user_email() ); 760 763 } 761 764 /** … … 811 814 */ 812 815 function bp_member_avatar( $args = '' ) { 816 // phpcs:disable WordPress.Security.EscapeOutput 813 817 814 818 /** … … 822 826 */ 823 827 echo apply_filters( 'bp_member_avatar', bp_get_member_avatar( $args ), $args ); 828 // phpcs:enable 824 829 } 825 830 /** … … 950 955 */ 951 956 function bp_member_name() { 957 // phpcs:disable WordPress.Security.EscapeOutput 952 958 953 959 /** … … 959 965 */ 960 966 echo apply_filters( 'bp_member_name', bp_get_member_name() ); 967 // phpcs:enable 961 968 } 962 969 /** … … 1017 1024 */ 1018 1025 function bp_member_last_active( $args = array() ) { 1019 echo bp_get_member_last_active( $args);1026 echo esc_html( bp_get_member_last_active( $args ) ); 1020 1027 } 1021 1028 /** … … 1091 1098 */ 1092 1099 function bp_member_latest_update( $args = '' ) { 1100 // phpcs:ignore WordPress.Security.EscapeOutput 1093 1101 echo bp_get_member_latest_update( $args ); 1094 1102 } … … 1207 1215 */ 1208 1216 function bp_member_profile_data( $args = '' ) { 1217 // phpcs:ignore WordPress.Security.EscapeOutput 1209 1218 echo bp_get_member_profile_data( $args ); 1210 1219 } … … 1315 1324 */ 1316 1325 function bp_member_registered( $args = array() ) { 1317 echo bp_get_member_registered( $args);1326 echo esc_html( bp_get_member_registered( $args ) ); 1318 1327 } 1319 1328 /** … … 1369 1378 */ 1370 1379 function bp_member_random_profile_data() { 1371 if ( bp_is_active( 'xprofile' ) ) { ?> 1372 <?php $random_data = xprofile_get_random_profile_data( bp_get_member_user_id(), true ); ?> 1380 if ( bp_is_active( 'xprofile' ) ) { 1381 $random_data = xprofile_get_random_profile_data( bp_get_member_user_id(), true ); 1382 // phpcs:disable WordPress.Security.EscapeOutput 1383 ?> 1373 1384 <strong><?php echo wp_filter_kses( $random_data[0]->name ) ?></strong> 1374 1385 <?php echo wp_filter_kses( $random_data[0]->value ) ?> 1375 <?php } 1386 <?php 1387 // phpcs:enable 1388 } 1376 1389 } 1377 1390 … … 1414 1427 $search_form_html = '<form action="" method="get" id="search-members-form"> 1415 1428 <label for="members_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="members_search" placeholder="'. esc_attr( $search_value ) .'" /></label> 1416 <input type="submit" id="members_search_submit" name="members_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />1429 <input type="submit" id="members_search_submit" name="members_search_submit" value="' . esc_html__( 'Search', 'buddypress' ) . '" /> 1417 1430 </form>'; 1418 1431 1419 /** 1420 * Filters the Members component search form. 1421 * 1422 * @since 1.9.0 1423 * 1424 * @param string $search_form_html HTML markup for the member search form. 1425 */ 1426 echo apply_filters( 'bp_directory_members_search_form', $search_form_html ); 1432 // phpcs:ignore WordPress.Security.EscapeOutput 1433 echo apply_filters( 1434 /** 1435 * Filters the Members component search form. 1436 * 1437 * @since 1.9.0 1438 * 1439 * @param string $search_form_html HTML markup for the member search form. 1440 */ 1441 'bp_directory_members_search_form', 1442 $search_form_html 1443 ); 1427 1444 } 1428 1445 … … 1433 1450 */ 1434 1451 function bp_total_site_member_count() { 1435 echo bp_get_total_site_member_count();1452 echo esc_html( bp_get_total_site_member_count() ); 1436 1453 } 1437 1454 /** … … 1502 1519 } 1503 1520 1504 // Echo out the final list item.1505 echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item->css_id, array( '<li id="li-nav-' . $nav_item->css_id . '" ' . $selected . '><a id="my-' . $nav_item->css_id . '" href="' . $nav_item->link . '">' . $nav_item->name. '</a></li>', &$nav_item ) );1521 // phpcs:ignore WordPress.Security.EscapeOutput 1522 echo apply_filters_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item->css_id, array( '<li id="li-nav-' . esc_attr( $nav_item->css_id ) . '" ' . $selected . '><a id="my-' . esc_attr( $nav_item->css_id ) . '" href="' . esc_url( $nav_item->link ) . '">' . esc_html( $nav_item->name ) . '</a></li>', &$nav_item ) ); 1506 1523 } 1507 1524 1508 1525 // Always add a log out list item to the end of the navigation. 1509 $logout_link = '<li><a id="wp-logout" href="' . wp_logout_url( bp_get_root_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>'; 1510 1526 $logout_link = '<li><a id="wp-logout" href="' . esc_url( wp_logout_url( bp_get_root_url() ) ) . '">' . esc_html__( 'Log Out', 'buddypress' ) . '</a></li>'; 1527 1528 // phpcs:ignore WordPress.Security.EscapeOutput 1511 1529 echo apply_filters( 'bp_logout_nav_link', $logout_link ); 1512 1530 } … … 1630 1648 } 1631 1649 1632 /** 1633 * Filters the navigation markup for the displayed user. 1634 * 1635 * This is a dynamic filter that is dependent on the navigation tab component being rendered. 1636 * 1637 * @since 1.1.0 1638 * 1639 * @param string $value Markup for the tab list item including link. 1640 * @param array $user_nav_item Array holding parts used to construct tab list item. 1641 * Passed by reference. 1642 */ 1643 echo apply_filters_ref_array( 'bp_get_displayed_user_nav_' . $user_nav_item->css_id, array( '<li id="' . $user_nav_item->css_id . '-personal-li" ' . $selected . '><a id="user-' . $user_nav_item->css_id . '" href="' . $link . '">' . $user_nav_item->name . '</a></li>', &$user_nav_item ) ); 1650 // phpcs:ignore WordPress.Security.EscapeOutput 1651 echo apply_filters_ref_array( 1652 /** 1653 * Filters the navigation markup for the displayed user. 1654 * 1655 * This is a dynamic filter that is dependent on the navigation tab component being rendered. 1656 * 1657 * @since 1.1.0 1658 * 1659 * @param string $value Markup for the tab list item including link. 1660 * @param array $user_nav_item Array holding parts used to construct tab list item. 1661 * Passed by reference. 1662 */ 1663 'bp_get_displayed_user_nav_' . $user_nav_item->css_id, 1664 array( 1665 '<li id="' . esc_attr( $user_nav_item->css_id ) . '-personal-li" ' . $selected . '><a id="user-' . esc_attr( $user_nav_item->css_id ) . '" href="' . esc_url( $link ) . '">' . wp_kses( $user_nav_item->name, array( 'span' => array( 'class' => true ) ) ) . '</a></li>', 1666 &$user_nav_item 1667 ) 1668 ); 1644 1669 } 1645 1670 } … … 1671 1696 */ 1672 1697 function bp_loggedin_user_avatar( $args = '' ) { 1698 // phpcs:ignore WordPress.Security.EscapeOutput 1673 1699 echo bp_get_loggedin_user_avatar( $args ); 1674 1700 } … … 1730 1756 */ 1731 1757 function bp_displayed_user_avatar( $args = '' ) { 1758 // phpcs:ignore WordPress.Security.EscapeOutput 1732 1759 echo bp_get_displayed_user_avatar( $args ); 1733 1760 } … … 1785 1812 */ 1786 1813 function bp_displayed_user_email() { 1787 echo bp_get_displayed_user_email();1814 echo esc_html( bp_get_displayed_user_email() ); 1788 1815 } 1789 1816 /** … … 1824 1851 */ 1825 1852 function bp_last_activity( $user_id = 0 ) { 1826 echo bp_get_last_activity( $user_id);1853 echo esc_html( bp_get_last_activity( $user_id ) ); 1827 1854 } 1828 1855 /** … … 1861 1888 */ 1862 1889 function bp_user_firstname() { 1863 echo bp_get_user_firstname();1890 echo esc_html( bp_get_user_firstname() ); 1864 1891 } 1865 1892 /** … … 1993 2020 * @param string $url Generated link for the displayed user's profile. 1994 2021 */ 1995 return apply_filters( 'bp_displayed_user_domain', $url );2022 return apply_filters( 'bp_displayed_user_domain', $url ); 1996 2023 } 1997 2024 … … 2089 2116 */ 2090 2117 function bp_displayed_user_fullname() { 2091 echo bp_get_displayed_user_fullname();2118 echo esc_html( bp_get_displayed_user_fullname() ); 2092 2119 } 2093 2120 /** … … 2116 2143 * @since 1.0.0 2117 2144 */ 2118 function bp_user_fullname() { echo bp_get_displayed_user_fullname(); }2145 function bp_user_fullname() { echo esc_html( bp_get_displayed_user_fullname() ); } 2119 2146 2120 2147 … … 2125 2152 */ 2126 2153 function bp_loggedin_user_fullname() { 2127 echo bp_get_loggedin_user_fullname();2154 echo esc_html( bp_get_loggedin_user_fullname() ); 2128 2155 } 2129 2156 /** … … 2153 2180 */ 2154 2181 function bp_displayed_user_username() { 2155 echo bp_get_displayed_user_username();2182 echo esc_html( bp_get_displayed_user_username() ); 2156 2183 } 2157 2184 /** … … 2187 2214 */ 2188 2215 function bp_loggedin_user_username() { 2189 echo bp_get_loggedin_user_username();2216 echo esc_html( bp_get_loggedin_user_username() ); 2190 2217 } 2191 2218 /** … … 2221 2248 */ 2222 2249 function bp_current_member_type_message() { 2223 echo bp_get_current_member_type_message();2250 echo wp_kses( bp_get_current_member_type_message(), array( 'strong' => true ) ); 2224 2251 } 2225 2252 /** … … 2254 2281 */ 2255 2282 function bp_member_type_directory_link( $member_type = '' ) { 2283 // phpcs:ignore WordPress.Security.EscapeOutput 2256 2284 echo bp_get_member_type_directory_link( $member_type ); 2257 2285 } … … 2302 2330 */ 2303 2331 function bp_member_type_list( $user_id = 0, $r = array() ) { 2332 // phpcs:ignore WordPress.Security.EscapeOutput 2304 2333 echo bp_get_member_type_list( $user_id, $r ); 2305 2334 } … … 2577 2606 */ 2578 2607 function bp_signup_username_value() { 2579 echo bp_get_signup_username_value();2608 echo esc_html( bp_get_signup_username_value() ); 2580 2609 } 2581 2610 /** … … 2609 2638 */ 2610 2639 function bp_signup_email_value() { 2611 echo bp_get_signup_email_value();2640 echo esc_html( bp_get_signup_email_value() ); 2612 2641 } 2613 2642 /** … … 2647 2676 */ 2648 2677 function bp_signup_with_blog_value() { 2649 echo bp_get_signup_with_blog_value();2678 echo intval( bp_get_signup_with_blog_value() ); 2650 2679 } 2651 2680 /** … … 2677 2706 */ 2678 2707 function bp_signup_blog_url_value() { 2679 echo bp_get_signup_blog_url_value();2708 echo esc_url( bp_get_signup_blog_url_value() ); 2680 2709 } 2681 2710 /** … … 2709 2738 */ 2710 2739 function bp_signup_subdomain_base() { 2711 echo bp_signup_get_subdomain_base();2740 echo esc_url( bp_signup_get_subdomain_base() ); 2712 2741 } 2713 2742 /** … … 2745 2774 */ 2746 2775 function bp_signup_blog_title_value() { 2747 echo bp_get_signup_blog_title_value();2776 echo esc_html( bp_get_signup_blog_title_value() ); 2748 2777 } 2749 2778 /** … … 2777 2806 */ 2778 2807 function bp_signup_blog_privacy_value() { 2779 echo bp_get_signup_blog_privacy_value();2808 echo esc_html( bp_get_signup_blog_privacy_value() ); 2780 2809 } 2781 2810 /** … … 2809 2838 */ 2810 2839 function bp_signup_avatar_dir_value() { 2811 echo bp_get_signup_avatar_dir_value();2840 echo esc_html( bp_get_signup_avatar_dir_value() ); 2812 2841 } 2813 2842 /** … … 2822 2851 2823 2852 // Check if signup_avatar_dir is passed. 2824 if ( ! empty( $_POST['signup_avatar_dir'] ) )2853 if ( ! empty( $_POST['signup_avatar_dir'] ) ) { 2825 2854 $signup_avatar_dir = $_POST['signup_avatar_dir']; 2826 2855 2827 // If not, check if global is set.2828 elseif ( !empty( $bp->signup->avatar_dir ) )2856 // If not, check if global is set. 2857 } elseif ( ! empty( $bp->signup->avatar_dir ) ) { 2829 2858 $signup_avatar_dir = $bp->signup->avatar_dir; 2830 2859 2831 // If not, set false.2832 else2860 // If not, set false. 2861 } else { 2833 2862 $signup_avatar_dir = false; 2863 } 2834 2864 2835 2865 /** … … 2872 2902 */ 2873 2903 function bp_current_signup_step() { 2874 echo bp_get_current_signup_step();2904 echo esc_html( bp_get_current_signup_step() ); 2875 2905 } 2876 2906 /** … … 2895 2925 */ 2896 2926 function bp_signup_avatar( $args = '' ) { 2927 // phpcs:ignore WordPress.Security.EscapeOutput 2897 2928 echo bp_get_signup_avatar( $args ); 2898 2929 } … … 2924 2955 ); 2925 2956 2926 extract( $r, EXTR_SKIP );2927 2928 2957 $signup_avatar_dir = bp_get_signup_avatar_dir_value(); 2929 2958 … … 2935 2964 'avatar_dir' => 'avatars/signups', 2936 2965 'type' => 'full', 2937 'width' => $ size,2938 'height' => $ size,2939 'alt' => $ alt,2940 'class' => $ class,2966 'width' => $r['size'], 2967 'height' => $r['size'], 2968 'alt' => $r['alt'], 2969 'class' => $r['class'], 2941 2970 ) ); 2942 2971 … … 2962 2991 $gravatar_url = apply_filters( 'bp_gravatar_url', '//www.gravatar.com/avatar/' ); 2963 2992 $md5_lcase_email = md5( strtolower( bp_get_signup_email_value() ) ); 2964 $gravatar_img = '<img src="' . $gravatar_url . $md5_lcase_email . '?d=' . $default_grav . '&s=' . $ size . '" width="' . $size . '" height="' . $size . '" alt="' . $alt . '" class="' . $class. '" />';2993 $gravatar_img = '<img src="' . $gravatar_url . $md5_lcase_email . '?d=' . $default_grav . '&s=' . $r['size'] . '" width="' . esc_attr( $r['size'] ) . '" height="' . esc_attr( $r['size'] ) . '" alt="' . esc_attr( $r['alt'] ) . '" class="' . esc_attr( $r['class'] ) . '" />'; 2965 2994 } 2966 2995 … … 2984 3013 */ 2985 3014 function bp_signup_allowed() { 3015 // phpcs:ignore WordPress.Security.EscapeOutput 2986 3016 echo bp_get_signup_allowed(); 2987 3017 } … … 3081 3111 */ 3082 3112 function bp_members_activity_feed() { 3083 if ( !bp_is_active( 'activity' ) || !bp_is_user() ) 3084 return; ?> 3085 3086 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_displayed_user_fullname() ?> | <?php _e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" /> 3087 3088 <?php 3113 if ( ! bp_is_active( 'activity' ) || ! bp_is_user() ) { 3114 return; 3115 } 3116 // phpcs:disable WordPress.Security.EscapeOutput 3117 ?> 3118 <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ) ?> | <?php bp_displayed_user_fullname() ?> | <?php esc_attr_e( 'Activity RSS Feed', 'buddypress' ) ?>" href="<?php bp_member_activity_feed_link() ?>" /> 3119 <?php 3120 // phpcs:enable 3089 3121 } 3090 3122 add_action( 'bp_head', 'bp_members_activity_feed' ); … … 3170 3202 */ 3171 3203 function bp_avatar_delete_link() { 3172 echo bp_get_avatar_delete_link();3204 echo esc_url( bp_get_avatar_delete_link() ); 3173 3205 } 3174 3206 /** … … 3312 3344 */ 3313 3345 function bp_members_invitations_pagination_count() { 3314 echo bp_get_members_invitations_pagination_count();3346 echo esc_html( bp_get_members_invitations_pagination_count() ); 3315 3347 } 3316 3348 /** … … 3352 3384 */ 3353 3385 function bp_members_invitations_pagination_links() { 3386 // phpcs:ignore WordPress.Security.EscapeOutput 3354 3387 echo bp_get_members_invitations_pagination_links(); 3355 3388 } … … 3388 3421 } 3389 3422 3390 /** 3391 * Use this filter to sanitize the output. 3392 * 3393 * @since 8.0.0 3394 * 3395 * @param int|string $value The value for the requested property. 3396 * @param string $property The name of the requested property. 3397 * @param string $context The context of display. 3398 */ 3399 echo apply_filters( 'bp_the_members_invitation_property', bp_get_the_members_invitation_property( $property ), $property, $context ); 3423 // phpcs:ignore WordPress.Security.EscapeOutput 3424 echo apply_filters( 3425 /** 3426 * Use this filter to sanitize the output. 3427 * 3428 * @since 8.0.0 3429 * 3430 * @param int|string $value The value for the requested property. 3431 * @param string $property The name of the requested property. 3432 * @param string $context The context of display. 3433 */ 3434 'bp_the_members_invitation_property', 3435 bp_get_the_members_invitation_property( $property ), 3436 $property, 3437 $context 3438 ); 3400 3439 } 3401 3440 /** … … 3452 3491 */ 3453 3492 function bp_the_members_invitation_action_links( $args = '' ) { 3493 // phpcs:ignore WordPress.Security.EscapeOutput 3454 3494 echo bp_get_the_members_invitation_action_links( $args ); 3455 3495 } … … 3508 3548 */ 3509 3549 function bp_the_members_invitations_resend_link( $user_id = 0 ) { 3550 // phpcs:ignore WordPress.Security.EscapeOutput 3510 3551 echo bp_get_the_members_invitation_delete_link( $user_id ); 3511 3552 } … … 3527 3568 } 3528 3569 3529 $retval = sprintf( '<a href="%1$s" class="resend secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_members_invitations_resend_url( $user_id ) ), __( 'Resend', 'buddypress' ) );3570 $retval = sprintf( '<a href="%1$s" class="resend secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_members_invitations_resend_url( $user_id ) ), esc_html__( 'Resend', 'buddypress' ) ); 3530 3571 3531 3572 /** … … 3599 3640 */ 3600 3641 function bp_the_members_invitations_delete_link( $user_id = 0 ) { 3642 // phpcs:ignore WordPress.Security.EscapeOutput 3601 3643 echo bp_get_the_members_invitation_delete_link( $user_id ); 3602 3644 } … … 3696 3738 */ 3697 3739 function bp_members_invitations_list_invites_permalink( $user_id = 0 ) { 3698 echo bp_get_members_invitations_list_invites_permalink( $user_id);3740 echo esc_url( bp_get_members_invitations_list_invites_permalink( $user_id ) ); 3699 3741 } 3700 3742 /** … … 3734 3776 */ 3735 3777 function bp_members_invitations_send_invites_permalink( $user_id = 0 ) { 3736 echo bp_get_members_invitations_send_invites_permalink( $user_id);3778 echo esc_url( bp_get_members_invitations_send_invites_permalink( $user_id ) ); 3737 3779 } 3738 3780 /**
Note: See TracChangeset
for help on using the changeset viewer.