-
Notifications
You must be signed in to change notification settings - Fork 0
/
3d-party-encryption.php
39 lines (27 loc) · 890 Bytes
/
3d-party-encryption.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*
Plugin Name: WP Document Revisions - State Permission Code Sample
Plugin URI: http://
Description: Code sample to demonstrate third-party resting encryption on file upload / download
Version: 1.0
Author: Benjamin J. Balter
Author URI: http://ben.balter.com
License: GPL2
*/
function wpdr_encrypt( $attachment ) {
//get path to attached file
$file = get_attached_file( $attachment->ID );
//pass path to file to third party encryption
//third_party_encryption_function( $file );
//alternately, can be done directly via shell
//`crypt PASS < $file`
}
add_action( 'document_upload', 'wpdr_encrypt' );
function wpdr_decrypt( $postID, $file ) {
//pass path to file to third party encryption
//third_party_decryption_function( $file );
//alternately, can be done directly via shell
//`decrypt PASS < $file`
}
add_action( 'serve_document', 'wpdr_decrypt' );
?>