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 5 times in this file.
| Line | Code |
|---|---|
| 736 | return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).')); |
| 737 | |
| 738 | $plugins_dir = trailingslashit( $plugins_dir ); |
| 739 | $content_dir = trailingslashit( $content_dir ); |
| 740 | |
| 741 | if ( empty($package) ) |
| 742 | return new WP_Error('no_package', __('Install package not available.')); |
| 743 | |
| 744 | // Download the package |
| 745 | apply_filters('install_feedback', sprintf(__('Downloading plugin package from %s'), $package)); |
| 746 | $download_file = download_url($package); |
| 747 | |
| 748 | if ( is_wp_error($download_file) ) |
| 749 | return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message()); |
| 750 | |
| 751 | $working_dir = $content_dir . 'upgrade/' . basename($package, '.zip'); |
| 752 | |
| 753 | // Clean up working directory |
| 754 | if ( $wp_filesystem->is_dir($working_dir) ) |
| 755 | $wp_filesystem->delete($working_dir, true); |
| 756 | |
| 757 | apply_filters('install_feedback', __('Unpacking the plugin package')); |
| 758 | // Unzip package to working directory |
| 759 | $result = unzip_file($download_file, $working_dir); |
| 760 | |
| 761 | // Once extracted, delete the package |
| 762 | @unlink($download_file); |
| 763 | |
| 764 | if ( is_wp_error($result) ) { |
| 765 | $wp_filesystem->delete($working_dir, true); |
| 766 | return $result; |
| Line | Code |
| 768 | |
| 769 | //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin |
| 770 | $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); |
| 771 | |
| 772 | if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) { |
| 773 | $wp_filesystem->delete($working_dir, true); |
| 774 | return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] ); |
| 775 | } |
| 776 | |
| 777 | apply_filters('install_feedback', __('Installing the plugin')); |
| 778 | // Copy new version of plugin into place. |
| 779 | $result = copy_dir($working_dir, $plugins_dir); |
| 780 | if ( is_wp_error($result) ) { |
| 781 | $wp_filesystem->delete($working_dir, true); |
| 782 | return $result; |
| 783 | } |
| 784 | |
| 785 | //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin |
| 786 | $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); |
| Line | Code |
| 840 | if ( empty($package) ) |
| 841 | return new WP_Error('no_package', __('Install package not available.')); |
| 842 | |
| 843 | $working_dir = $content_dir . 'upgrade/' . basename($package, '.zip'); |
| 844 | |
| 845 | // Clean up working directory |
| 846 | if ( $wp_filesystem->is_dir($working_dir) ) |
| 847 | $wp_filesystem->delete($working_dir, true); |
| 848 | |
| 849 | apply_filters('install_feedback', __('Unpacking the plugin package')); |
| 850 | // Unzip package to working directory |
| 851 | $result = unzip_file($package, $working_dir); |
| 852 | |
| 853 | // Once extracted, delete the package |
| 854 | unlink($package); |
| 855 | |
| 856 | if ( is_wp_error($result) ) { |
| 857 | $wp_filesystem->delete($working_dir, true); |
| 858 | return $result; |
| Line | Code |
| 860 | |
| 861 | //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin |
| 862 | $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); |
| 863 | |
| 864 | if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) { |
| 865 | $wp_filesystem->delete($working_dir, true); |
| 866 | return new WP_Error('install_folder_exists', __('Folder already exists.'), $filelist[0] ); |
| 867 | } |
| 868 | |
| 869 | apply_filters('install_feedback', __('Installing the plugin')); |
| 870 | // Copy new version of plugin into place. |
| 871 | $result = copy_dir($working_dir, $plugins_dir); |
| 872 | if ( is_wp_error($result) ) { |
| 873 | $wp_filesystem->delete($working_dir, true); |
| 874 | return $result; |
| 875 | } |
| 876 | |
| 877 | //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin |
| 878 | $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); |