WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 1546 | * are not valid ZIPs, so those will also return false. |
| 1547 | * |
| 1548 | * @since 6.4.4 |
| 1549 | * |
| 1550 | * @param string $file Full path to the ZIP file. |
| 1551 | * @return bool Whether the file is a valid ZIP file. |
| 1552 | */ |
| 1553 | function wp_zip_file_is_valid( $file ) { |
| 1554 | /** This filter is documented in wp-admin/includes/file.php */ |
| 1555 | if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { |
| 1556 | $archive = new ZipArchive(); |
| 1557 | $archive_is_valid = $archive->open( $file, ZipArchive::CHECKCONS ); |
| 1558 | if ( true === $archive_is_valid ) { |
| 1559 | $archive->close(); |
| 1560 | return true; |
| 1561 | } |
| 1562 | } |
| 1563 | |
| 1564 | // Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file. |
| Line | Code |
| 1623 | } |
| 1624 | |
| 1625 | /** |
| 1626 | * Filters whether to use ZipArchive to unzip archives. |
| 1627 | * |
| 1628 | * @since 3.0.0 |
| 1629 | * |
| 1630 | * @param bool $ziparchive Whether to use ZipArchive. Default true. |
| 1631 | */ |
| 1632 | if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { |
| 1633 | $result = _unzip_file_ziparchive( $file, $to, $needed_dirs ); |
| 1634 | if ( true === $result ) { |
| 1635 | return $result; |
| 1636 | } elseif ( is_wp_error( $result ) ) { |
| 1637 | if ( 'incompatible_archive' !== $result->get_error_code() ) { |
| 1638 | return $result; |
| 1639 | } |
| 1640 | } |
| 1641 | } |