Filters how a protected file is handed over: 'php' sends it from PHP; 'x-sendfile' asks Apache's mod_xsendfile or LiteSpeed to send it; 'x-accel-redirect' asks Nginx, which then needs an internal location for the protected folder (see the readme).
Parameters
$howstring- 'php', 'x-sendfile' or 'x-accel-redirect'. Default 'php'.
$filestring- Absolute path.
$idint- Attachment ID.
More Information
X-Sendfile names the file's absolute path, wherever it is kept, so with RIFF_PROTECTED_PATH the web server must be allowed that folder (XSendFilePath on Apache). X-Accel-Redirect names the file's address under uploads, or, with RIFF_PROTECTED_PATH, its path inside that folder under /riff-protected/, which an internal location aliases to it; a file in neither, as one not yet moved into the folder it belongs in is, is sent from PHP instead.
Usage
add_filter( 'riff_protected_send', function ( $how, $file, $id ) {
return $how;
}, 10, 3 );Source
$how = (string) apply_filters( 'riff_protected_send', 'php', $file, $id );plugins/riff/src/class-protect.phpView on GitHub
Changelog
| Version | Description |
|---|---|
| 6.5.0 | With RIFF_PROTECTED_PATH, x-accel-redirect names /riff-protected/. |
| 4.18.0 | Introduced. |