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
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | 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.