Changeset 3269
- Timestamp:
- 09/13/2010 11:13:20 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-filters.php
r2722 r3269 2 2 3 3 /* Apply WordPress defined filters */ 4 add_filter( 'bp_get_activity_action', 'bp_activity_filter_kses', 1 ); 5 add_filter( 'bp_get_activity_content_body', 'bp_activity_filter_kses', 1 ); 6 add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 ); 7 add_filter( 'bp_get_activity_parent_content', 'bp_activity_filter_kses', 1 ); 8 add_filter( 'bp_get_activity_latest_update', 'bp_activity_filter_kses', 1 ); 4 add_filter( 'bp_get_activity_action', 'bp_activity_filter_kses', 1 ); 5 add_filter( 'bp_get_activity_content_body', 'bp_activity_filter_kses', 1 ); 6 add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 ); 7 add_filter( 'bp_get_activity_parent_content', 'bp_activity_filter_kses', 1 ); 8 add_filter( 'bp_get_activity_latest_update', 'bp_activity_filter_kses', 1 ); 9 add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_filter_kses', 1 ); 9 10 add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_filter_kses', 1 ); 10 add_filter( 'bp_activity_content_before_save', 'bp_activity_filter_kses', 1 );11 add_filter( 'bp_activity_action_before_save', 'bp_activity_filter_kses', 1 );11 add_filter( 'bp_activity_content_before_save', 'bp_activity_filter_kses', 1 ); 12 add_filter( 'bp_activity_action_before_save', 'bp_activity_filter_kses', 1 ); 12 13 13 add_filter( 'bp_get_activity_action', 'force_balance_tags' ); 14 add_filter( 'bp_get_activity_content_body', 'force_balance_tags' ); 15 add_filter( 'bp_get_activity_content', 'force_balance_tags' ); 16 add_filter( 'bp_get_activity_latest_update', 'force_balance_tags' ); 14 add_filter( 'bp_get_activity_action', 'force_balance_tags' ); 15 add_filter( 'bp_get_activity_content_body', 'force_balance_tags' ); 16 add_filter( 'bp_get_activity_content', 'force_balance_tags' ); 17 add_filter( 'bp_get_activity_latest_update', 'force_balance_tags' ); 18 add_filter( 'bp_get_activity_latest_update_excerpt', 'force_balance_tags' ); 17 19 add_filter( 'bp_get_activity_feed_item_description', 'force_balance_tags' ); 20 add_filter( 'bp_activity_content_before_save', 'force_balance_tags' ); 21 add_filter( 'bp_activity_action_before_save', 'force_balance_tags' ); 18 22 19 add_filter( 'bp_get_activity_action', 'wptexturize' ); 20 add_filter( 'bp_get_activity_content_body', 'wptexturize' ); 21 add_filter( 'bp_get_activity_content', 'wptexturize' ); 22 add_filter( 'bp_get_activity_parent_content', 'wptexturize' ); 23 add_filter( 'bp_get_activity_latest_update', 'wptexturize' ); 23 add_filter( 'bp_get_activity_action', 'wptexturize' ); 24 add_filter( 'bp_get_activity_content_body', 'wptexturize' ); 25 add_filter( 'bp_get_activity_content', 'wptexturize' ); 26 add_filter( 'bp_get_activity_parent_content', 'wptexturize' ); 27 add_filter( 'bp_get_activity_latest_update', 'wptexturize' ); 28 add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' ); 24 29 25 add_filter( 'bp_get_activity_action', 'convert_smilies' ); 26 add_filter( 'bp_get_activity_content_body', 'convert_smilies' ); 27 add_filter( 'bp_get_activity_content', 'convert_smilies' ); 28 add_filter( 'bp_get_activity_parent_content', 'convert_smilies' ); 29 add_filter( 'bp_get_activity_latest_update', 'convert_smilies' ); 30 add_filter( 'bp_get_activity_action', 'convert_smilies' ); 31 add_filter( 'bp_get_activity_content_body', 'convert_smilies' ); 32 add_filter( 'bp_get_activity_content', 'convert_smilies' ); 33 add_filter( 'bp_get_activity_parent_content', 'convert_smilies' ); 34 add_filter( 'bp_get_activity_latest_update', 'convert_smilies' ); 35 add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' ); 30 36 31 add_filter( 'bp_get_activity_action', 'convert_chars' ); 32 add_filter( 'bp_get_activity_content_body', 'convert_chars' ); 33 add_filter( 'bp_get_activity_content', 'convert_chars' ); 34 add_filter( 'bp_get_activity_parent_content', 'convert_chars' ); 35 add_filter( 'bp_get_activity_latest_update', 'convert_chars' ); 37 add_filter( 'bp_get_activity_action', 'convert_chars' ); 38 add_filter( 'bp_get_activity_content_body', 'convert_chars' ); 39 add_filter( 'bp_get_activity_content', 'convert_chars' ); 40 add_filter( 'bp_get_activity_parent_content', 'convert_chars' ); 41 add_filter( 'bp_get_activity_latest_update', 'convert_chars' ); 42 add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' ); 36 43 37 add_filter( 'bp_get_activity_action', 'wpautop' );38 add_filter( 'bp_get_activity_content_body', 'wpautop' );39 add_filter( 'bp_get_activity_content', 'wpautop' );44 add_filter( 'bp_get_activity_action', 'wpautop' ); 45 add_filter( 'bp_get_activity_content_body', 'wpautop' ); 46 add_filter( 'bp_get_activity_content', 'wpautop' ); 40 47 add_filter( 'bp_get_activity_feed_item_description', 'wpautop' ); 41 48 42 add_filter( 'bp_get_activity_action', 'make_clickable' ); 43 add_filter( 'bp_get_activity_content_body', 'make_clickable' ); 44 add_filter( 'bp_get_activity_content', 'make_clickable' ); 45 add_filter( 'bp_get_activity_parent_content', 'make_clickable' ); 46 add_filter( 'bp_get_activity_latest_update', 'make_clickable' ); 49 add_filter( 'bp_get_activity_action', 'make_clickable' ); 50 add_filter( 'bp_get_activity_content_body', 'make_clickable' ); 51 add_filter( 'bp_get_activity_content', 'make_clickable' ); 52 add_filter( 'bp_get_activity_parent_content', 'make_clickable' ); 53 add_filter( 'bp_get_activity_latest_update', 'make_clickable' ); 54 add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable' ); 47 55 add_filter( 'bp_get_activity_feed_item_description', 'make_clickable' ); 48 56 49 add_filter( 'bp_get_activity_action', 'stripslashes_deep' ); 50 add_filter( 'bp_get_activity_content', 'stripslashes_deep' ); 51 add_filter( 'bp_get_activity_content_body', 'stripslashes_deep' ); 52 add_filter( 'bp_get_activity_parent_content', 'stripslashes_deep' ); 53 add_filter( 'bp_get_activity_latest_update', 'stripslashes_deep' ); 57 add_filter( 'bp_acomment_name', 'stripslashes_deep' ); 58 add_filter( 'bp_get_activity_action', 'stripslashes_deep' ); 59 add_filter( 'bp_get_activity_content', 'stripslashes_deep' ); 60 add_filter( 'bp_get_activity_content_body', 'stripslashes_deep' ); 61 add_filter( 'bp_get_activity_parent_content', 'stripslashes_deep' ); 62 add_filter( 'bp_get_activity_latest_update', 'stripslashes_deep' ); 63 add_filter( 'bp_get_activity_latest_update_excerpt', 'stripslashes_deep' ); 54 64 add_filter( 'bp_get_activity_feed_item_description', 'stripslashes_deep' ); 55 65 56 add_filter( 'bp_get_activity_content', 'bp_activity_make_nofollow_filter' ); 57 add_filter( 'bp_get_activity_content_body', 'bp_activity_make_nofollow_filter' ); 58 add_filter( 'bp_get_activity_parent_content', 'bp_activity_make_nofollow_filter' ); 59 add_filter( 'bp_get_activity_latest_update', 'bp_activity_make_nofollow_filter' ); 66 /* Apply BuddyPress defined filters */ 67 add_filter( 'bp_get_activity_content', 'bp_activity_make_nofollow_filter' ); 68 add_filter( 'bp_get_activity_content_body', 'bp_activity_make_nofollow_filter' ); 69 add_filter( 'bp_get_activity_parent_content', 'bp_activity_make_nofollow_filter' ); 70 add_filter( 'bp_get_activity_latest_update', 'bp_activity_make_nofollow_filter' ); 71 add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_make_nofollow_filter' ); 60 72 add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' ); 61 73 … … 70 82 71 83 $activity_allowedtags = $allowedtags; 72 $activity_allowedtags['span'] = array();84 $activity_allowedtags['span'] = array(); 73 85 $activity_allowedtags['span']['class'] = array(); 74 $activity_allowedtags['div'] = array();75 $activity_allowedtags['div']['class'] = array();76 $activity_allowedtags['div']['id'] = array();77 $activity_allowedtags['a']['class'] = array();78 $activity_allowedtags['img'] = array();79 $activity_allowedtags['img']['src'] = array();80 $activity_allowedtags['img']['alt'] = array();81 $activity_allowedtags['img']['class'] = array();82 $activity_allowedtags['img']['width'] = array();86 $activity_allowedtags['div'] = array(); 87 $activity_allowedtags['div']['class'] = array(); 88 $activity_allowedtags['div']['id'] = array(); 89 $activity_allowedtags['a']['class'] = array(); 90 $activity_allowedtags['img'] = array(); 91 $activity_allowedtags['img']['src'] = array(); 92 $activity_allowedtags['img']['alt'] = array(); 93 $activity_allowedtags['img']['class'] = array(); 94 $activity_allowedtags['img']['width'] = array(); 83 95 $activity_allowedtags['img']['height'] = array(); 84 $activity_allowedtags['img']['class'] = array();85 $activity_allowedtags['img']['id'] = array();86 $activity_allowedtags['img']['title'] = array();87 $activity_allowedtags['code'] = array();96 $activity_allowedtags['img']['class'] = array(); 97 $activity_allowedtags['img']['id'] = array(); 98 $activity_allowedtags['img']['title'] = array(); 99 $activity_allowedtags['code'] = array(); 88 100 89 101 $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags ); … … 94 106 include_once( ABSPATH . WPINC . '/registration.php' ); 95 107 96 $pattern = '/[@]+([A-Za-z0-9-_ ]+)/';108 $pattern = '/[@]+([A-Za-z0-9-_\.]+)/'; 97 109 preg_match_all( $pattern, $content, $usernames ); 98 110 99 / * Make sure there's only one instance of each username */111 // Make sure there's only one instance of each username 100 112 if ( !$usernames = array_unique( $usernames[1] ) ) 101 113 return $content; … … 105 117 continue; 106 118 107 / * Increase the number of new @ mentions for the user */108 $new_mention_count = (int)get_user meta( $user_id, 'bp_new_mention_count');109 update_user meta( $user_id, 'bp_new_mention_count', $new_mention_count + 1 );119 // Increase the number of new @ mentions for the user 120 $new_mention_count = (int)get_user_meta( $user_id, 'bp_new_mention_count', true ); 121 update_user_meta( $user_id, 'bp_new_mention_count', $new_mention_count + 1 ); 110 122 111 123 $content = str_replace( "@$username", "<a href='" . bp_core_get_user_domain( bp_core_get_userid( $username ) ) . "' rel='nofollow'>@$username</a>", $content ); … … 114 126 return $content; 115 127 } 116 add_filter( 'bp_activity_new_update_content', 'bp_activity_at_name_filter' );128 add_filter( 'bp_activity_new_update_content', 'bp_activity_at_name_filter' ); 117 129 add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' ); 118 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' );130 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' ); 119 131 add_filter( 'group_forum_topic_text_before_save', 'bp_activity_at_name_filter' ); 120 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' );121 add_filter( 'bp_activity_comment_content', 'bp_activity_at_name_filter' );132 add_filter( 'group_forum_post_text_before_save', 'bp_activity_at_name_filter' ); 133 add_filter( 'bp_activity_comment_content', 'bp_activity_at_name_filter' ); 122 134 123 135 function bp_activity_make_nofollow_filter( $text ) {
Note: See TracChangeset
for help on using the changeset viewer.