Changeset 13802
- Timestamp:
- 04/24/2024 08:33:36 PM (15 months ago)
- Location:
- trunk/src/bp-blogs
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-template.php
r13580 r13802 18 18 */ 19 19 function bp_blogs_slug() { 20 echo bp_get_blogs_slug();20 echo esc_url( bp_get_blogs_slug() ); 21 21 } 22 22 /** … … 46 46 */ 47 47 function bp_blogs_root_slug() { 48 echo bp_get_blogs_root_slug();48 echo esc_url( bp_get_blogs_root_slug() ); 49 49 } 50 50 /** … … 251 251 */ 252 252 function bp_blogs_pagination_count() { 253 echo bp_get_blogs_pagination_count();253 echo esc_html( bp_get_blogs_pagination_count() ); 254 254 } 255 255 … … 295 295 */ 296 296 function bp_blogs_pagination_links() { 297 // Escaping is done in WordPress's `paginate_links()` function. 298 // phpcs:ignore WordPress.Security.EscapeOutput 297 299 echo bp_get_blogs_pagination_links(); 298 300 } … … 325 327 */ 326 328 function bp_blog_avatar( $args = '' ) { 329 // phpcs:ignore WordPress.Security.EscapeOutput 327 330 echo bp_get_blog_avatar( $args ); 328 331 } … … 488 491 489 492 function bp_blog_permalink() { 490 echo bp_get_blog_permalink();493 echo esc_url( bp_get_blog_permalink() ); 491 494 } 492 495 function bp_get_blog_permalink() { … … 519 522 */ 520 523 function bp_blog_name() { 521 echo bp_get_blog_name();524 echo esc_html( bp_get_blog_name() ); 522 525 } 523 526 /** … … 545 548 */ 546 549 function bp_blog_id() { 547 echo bp_get_blog_id();550 echo intval( bp_get_blog_id() ); 548 551 } 549 552 /** … … 579 582 * @param string $value Description of the current blog in the loop. 580 583 */ 581 echo apply_filters( 'bp_blog_description', bp_get_blog_description() );584 echo esc_html( apply_filters( 'bp_blog_description', bp_get_blog_description() ) ); 582 585 } 583 586 /** … … 607 610 */ 608 611 function bp_blog_class( $classes = array() ) { 612 // phpcs:ignore WordPress.Security.EscapeOutput 609 613 echo bp_get_blog_class( $classes ); 610 614 } … … 639 643 * @param array $classes Array of classes to be applied to row. 640 644 */ 641 $classes = a pply_filters( 'bp_get_blog_class', $classes);645 $classes = array_map( 'sanitize_html_class', apply_filters( 'bp_get_blog_class', $classes ) ); 642 646 $classes = array_merge( $classes, array() ); 643 647 $retval = 'class="' . join( ' ', $classes ) . '"'; … … 652 656 */ 653 657 function bp_blog_last_active( $args = array() ) { 654 echo bp_get_blog_last_active( $args);658 echo esc_html( bp_get_blog_last_active( $args ) ); 655 659 } 656 660 /** … … 712 716 */ 713 717 function bp_blog_latest_post( $args = array() ) { 714 echo bp_get_blog_latest_post( $args ); 718 echo wp_kses( 719 bp_get_blog_latest_post( $args ), 720 array( 721 'a' => array( 722 'href' => true, 723 ), 724 ) 725 ); 715 726 } 716 727 /** … … 779 790 */ 780 791 function bp_blog_latest_post_title() { 781 echo bp_get_blog_latest_post_title();792 echo esc_html( bp_get_blog_latest_post_title() ); 782 793 } 783 794 /** … … 852 863 */ 853 864 function bp_blog_latest_post_content() { 854 echo bp_get_blog_latest_post_content();865 echo wp_kses_post( bp_get_blog_latest_post_content() ); 855 866 } 856 867 /** … … 868 879 $retval = ''; 869 880 870 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) ) 881 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->post_content ) ) { 871 882 $retval = $blogs_template->blog->latest_post->post_content; 883 } 872 884 873 885 /** … … 891 903 */ 892 904 function bp_blog_latest_post_featured_image( $size = 'thumbnail' ) { 893 echo bp_get_blog_latest_post_featured_image( $size);905 echo esc_url( bp_get_blog_latest_post_featured_image( $size ) ); 894 906 } 895 907 /** … … 909 921 $retval = ''; 910 922 911 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[$size] ) ) 923 if ( ! empty( $blogs_template->blog->latest_post ) && ! empty( $blogs_template->blog->latest_post->images[$size] ) ) { 912 924 $retval = $blogs_template->blog->latest_post->images[$size]; 925 } 913 926 914 927 /** … … 955 968 */ 956 969 function bp_blog_hidden_fields() { 957 if ( isset( $_REQUEST['s'] ) ) 970 if ( isset( $_REQUEST['s'] ) ) { 958 971 echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />'; 959 960 if ( isset( $_REQUEST['letter'] ) ) 972 } 973 974 if ( isset( $_REQUEST['letter'] ) ) { 961 975 echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />'; 962 963 if ( isset( $_REQUEST['blogs_search'] ) ) 976 } 977 978 if ( isset( $_REQUEST['blogs_search'] ) ) { 964 979 echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['blogs_search'] ) . '" name="search_terms" />'; 980 } 965 981 } 966 982 … … 969 985 */ 970 986 function bp_total_blog_count() { 971 echo bp_get_total_blog_count();987 echo intval( bp_get_total_blog_count() ); 972 988 } 973 989 /** … … 995 1011 */ 996 1012 function bp_total_blog_count_for_user( $user_id = 0 ) { 997 echo bp_get_total_blog_count_for_user( $user_id);1013 echo intval( bp_get_total_blog_count_for_user( $user_id ) ); 998 1014 } 999 1015 /** … … 1067 1083 printf( 1068 1084 '<p class="error">%s</p>', 1069 $errors->get_error_message()1085 esc_html( $errors->get_error_message() ) 1070 1086 ); 1071 1087 } … … 1168 1184 '<input name="blogname" type="text" id="blogname" value="%1$s" maxlength="63" style="width: auto!important" %2$s/> <span class="suffix_address">.%3$s</span><br />', 1169 1185 esc_attr( $blogname ), 1186 // phpcs:ignore WordPress.Security.EscapeOutput 1170 1187 bp_get_form_field_attributes( 'blogname' ), 1171 bp_signup_get_subdomain_base()1188 esc_url( bp_signup_get_subdomain_base() ) 1172 1189 ); 1173 1190 } 1174 1191 if ( is_wp_error( $errors ) && $errors->get_error_message( 'blogname' ) ) { 1175 printf( '<div class="error">%s</div>', $errors->get_error_message( 'blogname') );1192 printf( '<div class="error">%s</div>', esc_html( $errors->get_error_message( 'blogname' ) ) ); 1176 1193 } 1177 1194 ?> … … 1198 1215 sprintf( 1199 1216 /* translators: %s is the site url. */ 1200 esc_html__( 'Your address will be %s' , 'buddypress' ), $url1217 esc_html__( 'Your address will be %s' , 'buddypress' ), esc_url( $url ) 1201 1218 ), 1202 1219 esc_html__( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!' , 'buddypress' ) … … 1212 1229 <?php 1213 1230 if ( is_wp_error( $errors ) && $errors->get_error_message( 'blog_title' ) ) { 1214 printf( '<div class="error">%s</div>', $errors->get_error_message( 'blog_title') );1231 printf( '<div class="error">%s</div>', esc_html( $errors->get_error_message( 'blog_title' ) ) ); 1215 1232 } 1216 1233 ?> … … 1363 1380 ); 1364 1381 1365 /** 1366 * Filters "Create a Site" links for users viewing their own profiles. 1367 * 1368 * @since 1.0.0 1369 * 1370 * @param string $url HTML link for creating a site. 1371 */ 1372 echo apply_filters( 'bp_create_blog_link', '<a href="' . $url . '">' . __( 'Create a Site', 'buddypress' ) . '</a>' ); 1382 // phpcs:ignore WordPress.Security.EscapeOutput 1383 echo apply_filters( 1384 /** 1385 * Filters "Create a Site" links for users viewing their own profiles. 1386 * 1387 * @since 1.0.0 1388 * 1389 * @param string $url HTML link for creating a site. 1390 */ 1391 'bp_create_blog_link', 1392 '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Create a Site', 'buddypress' ) . '</a>' 1393 ); 1373 1394 } 1374 1395 … … 1390 1411 $search_form_html = '<form action="" method="get" id="search-blogs-form"> 1391 1412 <label for="blogs_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="blogs_search" placeholder="'. esc_attr( $search_value ) .'" /></label> 1392 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . __( 'Search', 'buddypress' ) . '" />1413 <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="' . esc_attr__( 'Search', 'buddypress' ) . '" /> 1393 1414 </form>'; 1394 1415 1395 /** 1396 * Filters the output for the blog directory search form. 1397 * 1398 * @since 1.9.0 1399 * 1400 * @param string $search_form_html HTML markup for blog directory search form. 1401 */ 1402 echo apply_filters( 'bp_directory_blogs_search_form', $search_form_html ); 1416 // phpcs:ignore WordPress.Security.EscapeOutput 1417 echo apply_filters( 1418 /** 1419 * Filters the output for the blog directory search form. 1420 * 1421 * @since 1.9.0 1422 * 1423 * @param string $search_form_html HTML markup for blog directory search form. 1424 */ 1425 'bp_directory_blogs_search_form', 1426 $search_form_html 1427 ); 1403 1428 } 1404 1429 … … 1409 1434 */ 1410 1435 function bp_blog_create_button() { 1436 // Escaping is done in `BP_Core_HTML_Element()`. 1437 // phpcs:ignore WordPress.Security.EscapeOutput 1411 1438 echo bp_get_blog_create_button(); 1412 1439 } … … 1459 1486 */ 1460 1487 function bp_blog_create_nav_item() { 1488 // Escaping is done in `BP_Core_HTML_Element()`. 1489 // phpcs:ignore WordPress.Security.EscapeOutput 1461 1490 echo bp_get_blog_create_nav_item(); 1462 1491 } … … 1519 1548 */ 1520 1549 function bp_blogs_visit_blog_button( $args = '' ) { 1550 // Escaping is done in `BP_Core_HTML_Element()`. 1551 // phpcs:ignore WordPress.Security.EscapeOutput 1521 1552 echo bp_get_blogs_visit_blog_button( $args ); 1522 1553 } … … 1602 1633 */ 1603 1634 function bp_blogs_profile_stats( $args = '' ) { 1604 echo bp_blogs_get_profile_stats( $args ); 1635 echo wp_kses( 1636 bp_blogs_get_profile_stats( $args ), 1637 array( 1638 'li' => array( 'class' => true ), 1639 'div' => array( 'class' => true ), 1640 'strong' => true, 1641 'a' => array( 'href' => true ), 1642 ) 1643 ); 1605 1644 } 1606 1645 add_action( 'bp_members_admin_user_stats', 'bp_blogs_profile_stats', 9, 1 ); -
trunk/src/bp-blogs/bp-blogs-widgets.php
r13481 r13802 12 12 defined( 'ABSPATH' ) || exit; 13 13 14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', esc_html__( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) ); -
trunk/src/bp-blogs/classes/class-bp-blogs-blog.php
r13421 r13802 198 198 // Backward compatibility with old method of passing arguments. 199 199 if ( ! is_array( $args[0] ) || count( $args ) > 1 ) { 200 _deprecated_argument( __METHOD__, '10.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );200 _deprecated_argument( __METHOD__, '10.0.0', sprintf( esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) ); 201 201 202 202 $old_args_keys = [ -
trunk/src/bp-blogs/classes/class-bp-blogs-recent-posts-widget.php
r13481 r13802 12 12 defined( 'ABSPATH' ) || exit; 13 13 14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', esc_html__( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) ); 15 15 16 16 /** -
trunk/src/bp-blogs/classes/class-bp-blogs-template.php
r13405 r13802 103 103 // Backward compatibility with old method of passing arguments. 104 104 if ( ! is_array( $args[0] ) || count( $args ) > 1 ) { 105 _deprecated_argument( __METHOD__, '10.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );105 _deprecated_argument( __METHOD__, '10.0.0', sprintf( esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) ); 106 106 107 107 $old_args_keys = [
Note: See TracChangeset
for help on using the changeset viewer.