bp_document_mirror_text( $attachment_id )
Return the preview text for the document files.
Description
Parameters
- $attachment_id
-
(Required)
Return
(false|mixed|string)
Source
File: bp-templates/bp-nouveau/includes/document/functions.php
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | function bp_document_mirror_text( $attachment_id ) { $mirror_text = '' ; $extension = bp_document_extension( $attachment_id ); if ( isset( $extension ) && ! empty ( $extension ) && in_array( $extension , bp_get_document_preview_code_extensions() ) ) { $words = 8000; $more = '...' ; $text = get_post_meta( $attachment_id , 'document_preview_mirror_text' , true ); if ( $text ) { $mirror_text = strlen ( $text ) > $words ? substr ( $text , 0, $words ) . '...' : $text ; } else { if ( file_exists ( get_attached_file( $attachment_id ) ) ) { $image_data = file_get_contents ( get_attached_file( $attachment_id ) ); $words = 10000; $mirror_text = strlen ( $image_data ) > $words ? substr ( $image_data , 0, $words ) . '...' : $image_data ; update_post_meta( $attachment_id , 'document_preview_mirror_text' , $mirror_text ); } } } return $mirror_text ; } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.1 | 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.