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 |
|---|---|
| 1570 | * are not valid ZIPs, so those will also return false. |
| 1571 | * |
| 1572 | * @since 6.4.4 |
| 1573 | * |
| 1574 | * @param string $file Full path to the ZIP file. |
| 1575 | * @return bool Whether the file is a valid ZIP file. |
| 1576 | */ |
| 1577 | function wp_zip_file_is_valid( $file ) { |
| 1578 | /** This filter is documented in wp-admin/includes/file.php */ |
| 1579 | if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { |
| 1580 | $archive = new ZipArchive(); |
| 1581 | $archive_is_valid = $archive->open( $file, ZipArchive::CHECKCONS ); |
| 1582 | if ( true === $archive_is_valid ) { |
| 1583 | $archive->close(); |
| 1584 | return true; |
| 1585 | } |
| 1586 | } |
| 1587 | |
| 1588 | // Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file. |
| Line | Code |
| 1647 | } |
| 1648 | |
| 1649 | /** |
| 1650 | * Filters whether to use ZipArchive to unzip archives. |
| 1651 | * |
| 1652 | * @since 3.0.0 |
| 1653 | * |
| 1654 | * @param bool $ziparchive Whether to use ZipArchive. Default true. |
| 1655 | */ |
| 1656 | if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) { |
| 1657 | $result = _unzip_file_ziparchive( $file, $to, $needed_dirs ); |
| 1658 | if ( true === $result ) { |
| 1659 | return $result; |
| 1660 | } elseif ( is_wp_error( $result ) ) { |
| 1661 | if ( 'incompatible_archive' !== $result->get_error_code() ) { |
| 1662 | return $result; |
| 1663 | } |
| 1664 | } |
| 1665 | } |