bp_document_get_preview_text_from_attachment( $attachment_id )
Return the ouptput of the file.
Description
Parameters
- $attachment_id
-
(Required)
Return
(mixed|void)
Source
File: bp-templates/bp-nouveau/includes/document/functions.php
function bp_document_get_preview_text_from_attachment( $attachment_id ) { $data = get_transient( 'attachment_text' . $attachment_id ); if ( false === $data ) { $file_open = fopen( get_attached_file( $attachment_id ), 'r' ); $file_data = fread( $file_open, 10000 ); $more_text = false; if ( strlen( $file_data ) >= 9999 ) { $file_data .= '...'; $more_text = true; } fclose( $file_open ); $data = array(); $data['text'] = $file_data; $data['more_text'] = $more_text; if ( ! empty( $file_data ) ) { set_transient( 'attachment_text' . $attachment_id, $data ); } } return apply_filters( 'bp_document_get_preview_text_from_attachment', $data, $attachment_id ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.