Skip to:
Content

BuddyPress.org

Changeset 3269


Ignore:
Timestamp:
09/13/2010 11:13:20 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2632(trunk) props Paul Gibbs. (Also patches missing branch updates from merge.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-filters.php

    r2722 r3269  
    22
    33/* 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 );
     4add_filter( 'bp_get_activity_action',                'bp_activity_filter_kses', 1 );
     5add_filter( 'bp_get_activity_content_body',          'bp_activity_filter_kses', 1 );
     6add_filter( 'bp_get_activity_content',               'bp_activity_filter_kses', 1 );
     7add_filter( 'bp_get_activity_parent_content',        'bp_activity_filter_kses', 1 );
     8add_filter( 'bp_get_activity_latest_update',         'bp_activity_filter_kses', 1 );
     9add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_filter_kses', 1 );
    910add_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 );
     11add_filter( 'bp_activity_content_before_save',       'bp_activity_filter_kses', 1 );
     12add_filter( 'bp_activity_action_before_save',        'bp_activity_filter_kses', 1 );
    1213
    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' );
     14add_filter( 'bp_get_activity_action',                'force_balance_tags' );
     15add_filter( 'bp_get_activity_content_body',          'force_balance_tags' );
     16add_filter( 'bp_get_activity_content',               'force_balance_tags' );
     17add_filter( 'bp_get_activity_latest_update',         'force_balance_tags' );
     18add_filter( 'bp_get_activity_latest_update_excerpt', 'force_balance_tags' );
    1719add_filter( 'bp_get_activity_feed_item_description', 'force_balance_tags' );
     20add_filter( 'bp_activity_content_before_save',       'force_balance_tags' );
     21add_filter( 'bp_activity_action_before_save',        'force_balance_tags' );
    1822
    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' );
     23add_filter( 'bp_get_activity_action',                'wptexturize' );
     24add_filter( 'bp_get_activity_content_body',          'wptexturize' );
     25add_filter( 'bp_get_activity_content',               'wptexturize' );
     26add_filter( 'bp_get_activity_parent_content',        'wptexturize' );
     27add_filter( 'bp_get_activity_latest_update',         'wptexturize' );
     28add_filter( 'bp_get_activity_latest_update_excerpt', 'wptexturize' );
    2429
    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' );
     30add_filter( 'bp_get_activity_action',                'convert_smilies' );
     31add_filter( 'bp_get_activity_content_body',          'convert_smilies' );
     32add_filter( 'bp_get_activity_content',               'convert_smilies' );
     33add_filter( 'bp_get_activity_parent_content',        'convert_smilies' );
     34add_filter( 'bp_get_activity_latest_update',         'convert_smilies' );
     35add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_smilies' );
    3036
    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' );
     37add_filter( 'bp_get_activity_action',                'convert_chars' );
     38add_filter( 'bp_get_activity_content_body',          'convert_chars' );
     39add_filter( 'bp_get_activity_content',               'convert_chars' );
     40add_filter( 'bp_get_activity_parent_content',        'convert_chars' );
     41add_filter( 'bp_get_activity_latest_update',         'convert_chars' );
     42add_filter( 'bp_get_activity_latest_update_excerpt', 'convert_chars' );
    3643
    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' );
     44add_filter( 'bp_get_activity_action',                'wpautop' );
     45add_filter( 'bp_get_activity_content_body',          'wpautop' );
     46add_filter( 'bp_get_activity_content',               'wpautop' );
    4047add_filter( 'bp_get_activity_feed_item_description', 'wpautop' );
    4148
    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' );
     49add_filter( 'bp_get_activity_action',                'make_clickable' );
     50add_filter( 'bp_get_activity_content_body',          'make_clickable' );
     51add_filter( 'bp_get_activity_content',               'make_clickable' );
     52add_filter( 'bp_get_activity_parent_content',        'make_clickable' );
     53add_filter( 'bp_get_activity_latest_update',         'make_clickable' );
     54add_filter( 'bp_get_activity_latest_update_excerpt', 'make_clickable' );
    4755add_filter( 'bp_get_activity_feed_item_description', 'make_clickable' );
    4856
    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' );
     57add_filter( 'bp_acomment_name',                      'stripslashes_deep' );
     58add_filter( 'bp_get_activity_action',                'stripslashes_deep' );
     59add_filter( 'bp_get_activity_content',               'stripslashes_deep' );
     60add_filter( 'bp_get_activity_content_body',          'stripslashes_deep' );
     61add_filter( 'bp_get_activity_parent_content',        'stripslashes_deep' );
     62add_filter( 'bp_get_activity_latest_update',         'stripslashes_deep' );
     63add_filter( 'bp_get_activity_latest_update_excerpt', 'stripslashes_deep' );
    5464add_filter( 'bp_get_activity_feed_item_description', 'stripslashes_deep' );
    5565
    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 */
     67add_filter( 'bp_get_activity_content',               'bp_activity_make_nofollow_filter' );
     68add_filter( 'bp_get_activity_content_body',          'bp_activity_make_nofollow_filter' );
     69add_filter( 'bp_get_activity_parent_content',        'bp_activity_make_nofollow_filter' );
     70add_filter( 'bp_get_activity_latest_update',         'bp_activity_make_nofollow_filter' );
     71add_filter( 'bp_get_activity_latest_update_excerpt', 'bp_activity_make_nofollow_filter' );
    6072add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' );
    6173
     
    7082
    7183    $activity_allowedtags = $allowedtags;
    72     $activity_allowedtags['span'] = array();
     84    $activity_allowedtags['span']          = array();
    7385    $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();
    8395    $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();
    88100
    89101    $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
     
    94106    include_once( ABSPATH . WPINC . '/registration.php' );
    95107
    96     $pattern = '/[@]+([A-Za-z0-9-_]+)/';
     108    $pattern = '/[@]+([A-Za-z0-9-_\.]+)/';
    97109    preg_match_all( $pattern, $content, $usernames );
    98110
    99     /* Make sure there's only one instance of each username */
     111    // Make sure there's only one instance of each username
    100112    if ( !$usernames = array_unique( $usernames[1] ) )
    101113        return $content;
     
    105117            continue;
    106118
    107         /* Increase the number of new @ mentions for the user */
    108         $new_mention_count = (int)get_usermeta( $user_id, 'bp_new_mention_count' );
    109         update_usermeta( $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 );
    110122
    111123        $content = str_replace( "@$username", "<a href='" . bp_core_get_user_domain( bp_core_get_userid( $username ) ) . "' rel='nofollow'>@$username</a>", $content );
     
    114126    return $content;
    115127}
    116 add_filter( 'bp_activity_new_update_content', 'bp_activity_at_name_filter' );
     128add_filter( 'bp_activity_new_update_content',     'bp_activity_at_name_filter' );
    117129add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' );
    118 add_filter( 'pre_comment_content', 'bp_activity_at_name_filter' );
     130add_filter( 'pre_comment_content',                'bp_activity_at_name_filter' );
    119131add_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' );
     132add_filter( 'group_forum_post_text_before_save',  'bp_activity_at_name_filter' );
     133add_filter( 'bp_activity_comment_content',        'bp_activity_at_name_filter' );
    122134
    123135function bp_activity_make_nofollow_filter( $text ) {
Note: See TracChangeset for help on using the changeset viewer.