Changeset 12392
- Timestamp:
- 05/03/2019 05:24:02 PM (6 years ago)
- Location:
- branches/4.0
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0/src/bp-activity/bp-activity-filters.php
r12379 r12392 14 14 15 15 // Apply WordPress defined filters. 16 add_filter( 'bp_get_activity_action', 'bp_activity_filter_kses', 1 );17 16 add_filter( 'bp_get_activity_content_body', 'bp_activity_filter_kses', 1 ); 18 17 add_filter( 'bp_get_activity_parent_content', 'bp_activity_filter_kses', 1 ); -
branches/4.0/src/bp-activity/bp-activity-functions.php
r12294 r12392 1524 1524 */ 1525 1525 function bp_activity_format_activity_action_activity_update( $action, $activity ) { 1526 $action = sprintf( __( '%s posted an update', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) );1526 $action = sprintf( esc_html__( '%s posted an update', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) ); 1527 1527 1528 1528 /** … … 1547 1547 */ 1548 1548 function bp_activity_format_activity_action_activity_comment( $action, $activity ) { 1549 $action = sprintf( __( '%s posted a new activity comment', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) );1549 $action = sprintf( esc_html__( '%s posted a new activity comment', 'buddypress' ), bp_core_get_userlink( $activity->user_id ) ); 1550 1550 1551 1551 /** … … 1590 1590 } 1591 1591 1592 $post_link = '<a href="' . esc_url( $post_url ) . '">' . esc_html_x( 'item', 'Default text for the post type name', 'buddypress' ) . '</a>'; 1593 1592 1594 if ( is_multisite() ) { 1593 $blog_link = '<a href="' . esc_url( $blog_url ) . '">' . get_blog_option( $activity->item_id, 'blogname') . '</a>';1595 $blog_link = '<a href="' . esc_url( $blog_url ) . '">' . esc_html( get_blog_option( $activity->item_id, 'blogname' ) ) . '</a>'; 1594 1596 1595 1597 if ( ! empty( $bp->activity->track[ $activity->type ]->new_post_type_action_ms ) ) { 1596 $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action_ms, $user_link, $post_url, $blog_link );1598 $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action_ms, $user_link, esc_url( $post_url ), $blog_link ); 1597 1599 } else { 1598 $action = sprintf( _x( '%1$s wrote a new <a href="%2$s">item</a>, on the site %3$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, esc_url( $post_url ), $blog_link ); 1600 1601 $action = sprintf( esc_html_x( '%1$s wrote a new %2$s, on the site %3$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, $post_link, $blog_link ); 1599 1602 } 1600 1603 } else { … … 1602 1605 $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_action, $user_link, $post_url ); 1603 1606 } else { 1604 $action = sprintf( _x( '%1$s wrote a new <a href="%2$s">item</a>', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, esc_url( $post_url ));1607 $action = sprintf( esc_html_x( '%1$s wrote a new %2$s', 'Activity Custom Post Type post action', 'buddypress' ), $user_link, $post_link ); 1605 1608 } 1606 1609 } … … 1640 1643 1641 1644 $user_link = bp_core_get_userlink( $activity->user_id ); 1645 $post_link = '<a href="' . esc_url( $activity->primary_link ) . '">' . esc_html_x( 'item', 'Default text for the post type name', 'buddypress' ) . '</a>'; 1642 1646 1643 1647 if ( is_multisite() ) { … … 1647 1651 $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action_ms, $user_link, $activity->primary_link, $blog_link ); 1648 1652 } else { 1649 $action = sprintf( _x( '%1$s commented on the <a href="%2$s">item</a>, on the site %3$s', 'Activity Custom Post Type comment action', 'buddypress' ), $user_link, $activity->primary_link, $blog_link );1653 $action = sprintf( esc_html_x( '%1$s commented on the %2$s, on the site %3$s', 'Activity Custom Post Type comment action', 'buddypress' ), $user_link, $post_link, $blog_link ); 1650 1654 } 1651 1655 } else { … … 1653 1657 $action = sprintf( $bp->activity->track[ $activity->type ]->new_post_type_comment_action, $user_link, $activity->primary_link ); 1654 1658 } else { 1655 $action = sprintf( _x( '%1$s commented on the <a href="%2$s">item</a>', 'Activity Custom Post Type post comment action', 'buddypress' ), $user_link, $activity->primary_link );1659 $action = sprintf( esc_html_x( '%1$s commented on the %2$s', 'Activity Custom Post Type post comment action', 'buddypress' ), $user_link, $post_link ); 1656 1660 } 1657 1661 } -
branches/4.0/src/bp-blogs/bp-blogs-activity.php
r12281 r12392 128 128 $blog_name = bp_blogs_get_blogmeta( $activity->item_id, 'name' ); 129 129 130 $action = sprintf( __( '%s created the site %s', 'buddypress' ), bp_core_get_userlink( $activity->user_id ), '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' );130 $action = sprintf( esc_html__( '%s created the site %s', 'buddypress' ), bp_core_get_userlink( $activity->user_id ), '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' ); 131 131 132 132 // Legacy filter - requires the BP_Blogs_Blog object. … … 210 210 if ( empty( $post_title ) ) { 211 211 // Defaults to no title. 212 $post_title = esc_html__( '(no title)', 'buddypress' );212 $post_title = __( '(no title)', 'buddypress' ); 213 213 214 214 switch_to_blog( $activity->item_id ); … … 231 231 232 232 // Build the 'post link' part of the activity action string. 233 $post_link = '<a href="' . esc_url( $post_url ) . '">' . $post_title. '</a>';233 $post_link = '<a href="' . esc_url( $post_url ) . '">' . esc_html( $post_title ) . '</a>'; 234 234 235 235 $user_link = bp_core_get_userlink( $activity->user_id ); … … 237 237 // Build the complete activity action string. 238 238 if ( is_multisite() ) { 239 $action = sprintf( __( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), $user_link, $post_link, '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' );239 $action = sprintf( esc_html__( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), $user_link, $post_link, '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' ); 240 240 } else { 241 $action = sprintf( __( '%1$s wrote a new post, %2$s', 'buddypress' ), $user_link, $post_link );241 $action = sprintf( esc_html__( '%1$s wrote a new post, %2$s', 'buddypress' ), $user_link, $post_link ); 242 242 } 243 243 … … 359 359 } 360 360 361 $post_link = '<a href="' . esc_url( $post_url ) . '">' . $post_title. '</a>';361 $post_link = '<a href="' . esc_url( $post_url ) . '">' . esc_html( $post_title ) . '</a>'; 362 362 $user_link = bp_core_get_userlink( $activity->user_id ); 363 363 364 364 if ( is_multisite() ) { 365 $action = sprintf( __( '%1$s commented on the post, %2$s, on the site %3$s', 'buddypress' ), $user_link, $post_link, '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' );365 $action = sprintf( esc_html__( '%1$s commented on the post, %2$s, on the site %3$s', 'buddypress' ), $user_link, $post_link, '<a href="' . esc_url( $blog_url ) . '">' . esc_html( $blog_name ) . '</a>' ); 366 366 } else { 367 $action = sprintf( __( '%1$s commented on the post, %2$s', 'buddypress' ), $user_link, $post_link );367 $action = sprintf( esc_html__( '%1$s commented on the post, %2$s', 'buddypress' ), $user_link, $post_link ); 368 368 } 369 369 -
branches/4.0/src/bp-friends/bp-friends-activity.php
r12186 r12392 142 142 $friend_link = bp_core_get_userlink( $activity->secondary_item_id ); 143 143 144 $action = sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $initiator_link, $friend_link );144 $action = sprintf( esc_html__( '%1$s and %2$s are now friends', 'buddypress' ), $initiator_link, $friend_link ); 145 145 146 146 // Backward compatibility for legacy filter … … 176 176 $friend_link = bp_core_get_userlink( $activity->secondary_item_id ); 177 177 178 $action = sprintf( __( '%1$s and %2$s are now friends', 'buddypress' ), $initiator_link, $friend_link );178 $action = sprintf( esc_html__( '%1$s and %2$s are now friends', 'buddypress' ), $initiator_link, $friend_link ); 179 179 180 180 // Backward compatibility for legacy filter -
branches/4.0/src/bp-groups/bp-groups-activity.php
r12368 r12392 79 79 $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>'; 80 80 81 $action = sprintf( __( '%1$s created the group %2$s', 'buddypress'), $user_link, $group_link );81 $action = sprintf( esc_html__( '%1$s created the group %2$s', 'buddypress'), $user_link, $group_link ); 82 82 83 83 /** … … 107 107 $group_link = '<a href="' . esc_url( bp_get_group_permalink( $group ) ) . '">' . esc_html( $group->name ) . '</a>'; 108 108 109 $action = sprintf( __( '%1$s joined the group %2$s', 'buddypress' ), $user_link, $group_link );109 $action = sprintf( esc_html__( '%1$s joined the group %2$s', 'buddypress' ), $user_link, $group_link ); 110 110 111 111 // Legacy filters (do not follow parameter patterns of other activity … … 154 154 // No changed details were found, so use a generic message. 155 155 if ( empty( $changed ) ) { 156 $action = sprintf( __( '%1$s updated details for the group %2$s', 'buddypress' ), $user_link, $group_link );156 $action = sprintf( esc_html__( '%1$s updated details for the group %2$s', 'buddypress' ), $user_link, $group_link ); 157 157 158 158 // Name and description changed - to keep things short, don't describe changes in detail. 159 159 } elseif ( isset( $changed['name'] ) && isset( $changed['description'] ) ) { 160 $action = sprintf( __( '%1$s changed the name and description of the group %2$s', 'buddypress' ), $user_link, $group_link );160 $action = sprintf( esc_html__( '%1$s changed the name and description of the group %2$s', 'buddypress' ), $user_link, $group_link ); 161 161 162 162 // Name only. 163 163 } elseif ( ! empty( $changed['name']['old'] ) && ! empty( $changed['name']['new'] ) ) { 164 $action = sprintf( __( '%1$s changed the name of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['name']['old'] ), esc_html( $changed['name']['new'] ) );164 $action = sprintf( esc_html__( '%1$s changed the name of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['name']['old'] ), esc_html( $changed['name']['new'] ) ); 165 165 166 166 // Description only. 167 167 } elseif ( ! empty( $changed['description']['old'] ) && ! empty( $changed['description']['new'] ) ) { 168 $action = sprintf( __( '%1$s changed the description of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['description']['old'] ), esc_html( $changed['description']['new'] ) );168 $action = sprintf( esc_html__( '%1$s changed the description of the group %2$s from "%3$s" to "%4$s"', 'buddypress' ), $user_link, $group_link, esc_html( $changed['description']['old'] ), esc_html( $changed['description']['new'] ) ); 169 169 170 170 } elseif ( ! empty( $changed['slug']['old'] ) && ! empty( $changed['slug']['new'] ) ) { 171 $action = sprintf( __( '%1$s changed the permalink of the group %2$s.', 'buddypress' ), $user_link, $group_link );171 $action = sprintf( esc_html__( '%1$s changed the permalink of the group %2$s.', 'buddypress' ), $user_link, $group_link ); 172 172 173 173 } -
branches/4.0/src/bp-groups/bp-groups-functions.php
r12180 r12392 1313 1313 1314 1314 // Record this in activity streams. 1315 $activity_action = sprintf( __( '%1$s posted an update in the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . bp_get_group_permalink( $bp->groups->current_group ) . '">' . esc_attr( $bp->groups->current_group->name ) . '</a>' );1315 $activity_action = sprintf( esc_html__( '%1$s posted an update in the group %2$s', 'buddypress'), bp_core_get_userlink( $user_id ), '<a href="' . esc_url( bp_get_group_permalink( $bp->groups->current_group ) ) . '">' . esc_html( $bp->groups->current_group->name ) . '</a>' ); 1316 1316 $activity_content = $content; 1317 1317 -
branches/4.0/src/bp-members/bp-members-activity.php
r10825 r12392 48 48 function bp_members_format_activity_action_new_member( $action, $activity ) { 49 49 $userlink = bp_core_get_userlink( $activity->user_id ); 50 $action = sprintf( __( '%s became a registered member', 'buddypress' ), $userlink );50 $action = sprintf( esc_html__( '%s became a registered member', 'buddypress' ), $userlink ); 51 51 52 52 // Legacy filter - pass $user_id instead of $activity. -
branches/4.0/src/bp-members/bp-members-functions.php
r11829 r12392 416 416 * @param int $user_id ID of the user to check. 417 417 */ 418 return apply_filters( 'bp_core_get_userlink', '<a href="' . $url. '">' . $display_name . '</a>', $user_id );418 return apply_filters( 'bp_core_get_userlink', '<a href="' . esc_url( $url ) . '">' . $display_name . '</a>', $user_id ); 419 419 } 420 420 -
branches/4.0/src/bp-xprofile/bp-xprofile-activity.php
r11447 r12392 61 61 function bp_xprofile_format_activity_action_new_avatar( $action, $activity ) { 62 62 $userlink = bp_core_get_userlink( $activity->user_id ); 63 $action = sprintf( __( '%s changed their profile picture', 'buddypress' ), $userlink );63 $action = sprintf( esc_html__( '%s changed their profile picture', 'buddypress' ), $userlink ); 64 64 65 65 // Legacy filter - pass $user_id instead of $activity. … … 95 95 // natural translation. 96 96 $profile_link = trailingslashit( bp_core_get_user_domain( $activity->user_id ) . bp_get_profile_slug() ); 97 $action = sprintf( __( "%s's profile was updated", 'buddypress' ), '<a href="' . $profile_link. '">' . bp_core_get_user_displayname( $activity->user_id ) . '</a>' );97 $action = sprintf( esc_html__( "%s's profile was updated", 'buddypress' ), '<a href="' . esc_url( $profile_link ) . '">' . bp_core_get_user_displayname( $activity->user_id ) . '</a>' ); 98 98 99 99 /** -
branches/4.0/tests/phpunit/testcases/groups/activity.php
r12132 r12392 122 122 $this->assertNotEmpty( $a['activities'] ); 123 123 124 $expected = sprintf( __( '%s changed the name of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ), '<a href="' . bp_get_group_permalink( $group ) . '">Foo</a>', $group->name, 'Foo' );124 $expected = sprintf( esc_html__( '%s changed the name of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ), '<a href="' . bp_get_group_permalink( $group ) . '">Foo</a>', $group->name, 'Foo' ); 125 125 $this->assertSame( $expected, $a['activities'][0]->action ); 126 126 … … 154 154 $this->assertNotEmpty( $a['activities'] ); 155 155 156 $expected = sprintf( __( '%s changed the description of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ), '<a href="' . bp_get_group_permalink( $group ) . '">' . $group->name . '</a>', $group->description, 'Bar' );156 $expected = sprintf( esc_html__( '%s changed the description of the group %s from "%s" to "%s"', 'buddypress' ), bp_core_get_userlink( $u ), '<a href="' . bp_get_group_permalink( $group ) . '">' . $group->name . '</a>', $group->description, 'Bar' ); 157 157 $this->assertSame( $expected, $a['activities'][0]->action ); 158 158 -
branches/4.0/tests/phpunit/testcases/xprofile/activity.php
r11737 r12392 304 304 ) ); 305 305 306 $expected = sprintf( __( "%s's profile was updated", 'buddypress' ), '<a href="' . bp_core_get_user_domain( $u ) . bp_get_profile_slug() . '/">' . bp_core_get_user_displayname( $u ) . '</a>' );306 $expected = sprintf( esc_html__( "%s's profile was updated", 'buddypress' ), '<a href="' . bp_core_get_user_domain( $u ) . bp_get_profile_slug() . '/">' . bp_core_get_user_displayname( $u ) . '</a>' ); 307 307 308 308 $a_obj = new BP_Activity_Activity( $a );
Note: See TracChangeset
for help on using the changeset viewer.