Skip to:
Content

BuddyPress.org

Ticket #5938: bp-activity-filters-5938.diff

File bp-activity-filters-5938.diff, 5.9 KB (added by tw2113, 10 years ago)

Diff file for the activity filters file hooks

  • src/bp-activity/bp-activity-filters.php

     
    113113/**
    114114 * Types of activity stream items to moderate.
    115115 *
    116  * @since BuddyPress (1.6)
     116 * @since BuddyPress (1.6.0)
    117117 *
    118118 * @return array $types List of the activity types to moderate.
    119119 */
     
    122122                'activity_comment',
    123123                'activity_update'
    124124        );
     125
     126        /**
     127         * Filters the default activity types that BuddyPress should moderate.
     128         *
     129         * @since BuddyPress (1.6.0)
     130         *
     131         * @param array $types Default activity types to moderate.
     132         */
    125133        return apply_filters( 'bp_activity_check_activity_types', $types );
    126134}
    127135
     
    128136/**
    129137 * Moderate the posted activity item, if it contains moderate keywords.
    130138 *
    131  * @since BuddyPress (1.6)
     139 * @since BuddyPress (1.6.0)
    132140 *
    133141 * @param BP_Activity_Activity $activity The activity object to check.
    134142 */
     
    147155/**
    148156 * Mark the posted activity as spam, if it contains blacklist keywords.
    149157 *
    150  * @since BuddyPress (1.6)
     158 * @since BuddyPress (1.6.0)
    151159 *
    152160 * @param BP_Activity_Activity $activity The activity object to check.
    153161 */
     
    165173/**
    166174 * Custom kses filtering for activity content.
    167175 *
    168  * @since BuddyPress (1.1)
     176 * @since BuddyPress (1.1.0)
    169177 *
    170178 * @uses apply_filters() To call the 'bp_activity_allowed_tags' hook.
    171179 * @uses wp_kses()
     
    196204        $activity_allowedtags['span']['class'] = array();
    197205
    198206
     207        /**
     208         * Filters the allowed HTML tags for BuddyPress Activity content.
     209         *
     210         * @since BuddyPress (1.2.0)
     211         *
     212         * @param array Array of allowed HTML tags and attributes.
     213         */
    199214        $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
    200215        return wp_kses( $content, $activity_allowedtags );
    201216}
     
    261276 * If mentions are found, replace @mention text with user links and add our
    262277 * hook to send mention notifications after the activity item is saved.
    263278 *
    264  * @since BuddyPress (1.5)
     279 * @since BuddyPress (1.5.0)
    265280 *
    266281 * @uses bp_activity_find_mentions()
    267282 *
     
    298313/**
    299314 * Sends emails and BP notifications for users @-mentioned in an activity item.
    300315 *
    301  * @since BuddyPress (1.7)
     316 * @since BuddyPress (1.7.0)
    302317 *
    303318 * @uses bp_activity_at_message_notification()
    304319 * @uses bp_activity_update_mention_count_for_user()
     
    323338
    324339        // Send @mentions and setup BP notifications
    325340        foreach( (array) $usernames as $user_id => $username ) {
    326                 // If you want to disable notifications, you can use this filter to stop email sending
     341                /**
     342                 * Filters BuddyPress' ability to send email notifications for @mentions.
     343                 *
     344                 * @since BuddyPress (1.6.0)
     345                 *
     346                 * @param bool  Whether or not BuddyPress should send a notification to the mentioned users.
     347                 * @param array $usernames Array of users potentially notified.
     348                 */
    327349                if ( apply_filters( 'bp_activity_at_name_do_notifications', true, $usernames ) ) {
    328350                        bp_activity_at_message_notification( $activity->id, $user_id );
    329351                }
     
    336358/**
    337359 * Catch links in activity text so rel=nofollow can be added.
    338360 *
    339  * @since BuddyPress (1.2)
     361 * @since BuddyPress (1.2.0)
    340362 *
    341363 * @param string $text Activity text.
    342364 * @return string $text Text with rel=nofollow added to any links.
     
    348370        /**
    349371         * Add rel=nofollow to a link.
    350372         *
    351          * @since BuddyPress (1.2)
     373         * @since BuddyPress (1.2.0)
    352374         *
    353375         * @param array $matches
    354376         *
     
    364386/**
    365387 * Truncate long activity entries when viewed in activity streams.
    366388 *
    367  * @since BuddyPress (1.5)
     389 * @since BuddyPress (1.5.0)
    368390 *
    369391 * @uses bp_is_single_activity()
    370392 * @uses apply_filters() To call the 'bp_activity_excerpt_append_text' hook.
     
    384406        if ( bp_is_single_activity() )
    385407                return $text;
    386408
     409        /**
     410         * Filters the appended text for the activity excerpt.
     411         *
     412         * @since BuddyPress (1.5.0)
     413         *
     414         * @param string $read_more Internationalized "Read more" text.
     415         */
    387416        $append_text    = apply_filters( 'bp_activity_excerpt_append_text', __( '[Read more]', 'buddypress' ) );
     417
     418        /**
     419         * Filters the excerpt length for the activity excerpt.
     420         *
     421         * @since BuddyPress (1.5.0)
     422         *
     423         * @param int $excerpt_length Number indicating how many words to trim the excerpt down to.
     424         */
    388425        $excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 );
    389426
    390427        // Run the text through the excerpt function. If it's too short, the original text will be
     
    400437                $excerpt = sprintf( '%1$s<span class="activity-read-more" id="%2$s"><a href="%3$s" rel="nofollow">%4$s</a></span>', $excerpt, $id, bp_get_activity_thread_permalink(), $append_text );
    401438        }
    402439
     440        /**
     441         * Filters the composite activity excerpt entry.
     442         *
     443         * @since BuddyPress (1.5.0)
     444         *
     445         * @param string $excerpt Excerpt text and markup to be displayed.
     446         * @param string $text The original activity entry text.
     447         * @param string $append_text The final append text applied.
     448         */
    403449        return apply_filters( 'bp_activity_truncate_entry', $excerpt, $text, $append_text );
    404450}
    405451
     
    552598
    553599        $global_pulse = 0;
    554600
    555         // Check whether the global heartbeat settings already exist.
     601        /**
     602         * Filter that checks whether the global heartbeat settings already exist.
     603         *
     604         * @since BuddyPress (2.0.0)
     605         *
     606         * @param array $settings Heartbeat settings array.
     607         */
    556608        $heartbeat_settings = apply_filters( 'heartbeat_settings', array() );
    557609        if ( ! empty( $heartbeat_settings['interval'] ) ) {
    558610                // 'Fast' is 5
     
    559611                $global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5;
    560612        }
    561613
    562         // Filter here to specify a BP-specific pulse frequency
     614        /**
     615         * Filters the pulse frequency to be used for the BuddyPress Activity heartbeat.
     616         *
     617         * @since BuddyPress (2.0.0)
     618         *
     619         * @param int $frequency The frequency in seconds between pulses.
     620         */
    563621        $bp_activity_pulse = apply_filters( 'bp_activity_heartbeat_pulse', 15 );
    564622
    565623        /**