Attachments: Remove all PDF files

This snippet for Broadcast shows how to prevent all attached PDF files from being broadcasted.

add_action( 'threewp_broadcast_broadcasting_started', function( $action )
{
    $bcd = $action->broadcasting_data;

    // Go through all attachments and remove all PDFs
    foreach( $bcd->attachment_data as $index => $attachment )
    {
        // Lowercase the filename.
        $filename = strtolower( $attachment->filename_base );
        if ( strpos( $filename, '.pdf' ) === false )
            continue;
        ThreeWP_Broadcast()->debug( 'Removing %s', $filename );
        unset( $bcd->attachment_data[ $index ] );
    }
} );