unzip_file
Filters the result of unzipping an archive.
Использование
add_filter( 'unzip_file', 'wp_kama_unzip_file_filter', 10, 5 );
/**
* Function for `unzip_file` filter-hook.
*
* @param true|WP_Error $result The result of unzipping the archive. True on success, otherwise WP_Error.
* @param string $file Full path and filename of ZIP archive.
* @param string $to Full path on the filesystem the archive was extracted to.
* @param string[] $needed_dirs A full list of required folders that were created.
* @param float $required_space The space required to unzip the file and copy its contents, with a 10% buffer.
*
* @return true|WP_Error
*/
function wp_kama_unzip_file_filter( $result, $file, $to, $needed_dirs, $required_space ){
// filter...
return $result;
}
- $result(true|WP_Error)
- The result of unzipping the archive. True on success, otherwise WP_Error.
По умолчанию: true - $file(строка)
- Full path and filename of ZIP archive.
- $to(строка)
- Full path on the filesystem the archive was extracted to.
- $needed_dirs(string[])
- A full list of required folders that were created.
- $required_space(float)
- The space required to unzip the file and copy its contents, with a 10% buffer.
Список изменений
| С версии 6.4.0 | Введена. |
Где вызывается хук
unzip_file
unzip_file
wp-admin/includes/file.php 1853
$result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );
wp-admin/includes/file.php 2000
$result = apply_filters( 'unzip_file', true, $file, $to, $needed_dirs, $required_space );