Skip to:
Content

BuddyPress.org

Changeset 2685


Ignore:
Timestamp:
02/11/2010 05:31:30 PM (16 years ago)
Author:
apeatling
Message:

Make all links within an activity update nofollow - fixes #1912

File:
1 edited

Legend:

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

    r2675 r2685  
    5353add_filter( 'bp_get_activity_latest_update', 'stripslashes_deep' );
    5454add_filter( 'bp_get_activity_feed_item_description', 'stripslashes_deep' );
     55
     56add_filter( 'bp_get_activity_content', 'bp_activity_make_nofollow_filter' );
     57add_filter( 'bp_get_activity_content_body', 'bp_activity_make_nofollow_filter' );
     58add_filter( 'bp_get_activity_parent_content', 'bp_activity_make_nofollow_filter' );
     59add_filter( 'bp_get_activity_latest_update', 'bp_activity_make_nofollow_filter' );
     60add_filter( 'bp_get_activity_feed_item_description', 'bp_activity_make_nofollow_filter' );
    5561
    5662add_filter( 'bp_get_activity_parent_content', 'bp_create_excerpt' );
     
    114120add_filter( 'bp_activity_comment_content', 'bp_activity_at_name_filter' );
    115121
     122function bp_activity_make_nofollow_filter( $text ) {
     123    return preg_replace_callback( '|<a (.+?)>|i', 'bp_activity_make_nofollow_filter_callback', $text );
     124}
     125    function bp_activity_make_nofollow_filter_callback( $matches ) {
     126        $text = $matches[1];
     127        $text = str_replace( array( ' rel="nofollow"', " rel='nofollow'"), '', $text );
     128        return "<a $text rel=\"nofollow\">";
     129    }
     130
    116131?>
Note: See TracChangeset for help on using the changeset viewer.