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.
Line | Code |
---|---|
212 | //Locate which directory to copy to the new folder, This is based on the actual folder holding the files. |
213 | if ( 1 == count($source_files) && $wp_filesystem->is_dir( trailingslashit($source) . $source_files[0] . '/') ) //Only one folder? Then we want its contents. |
214 | $source = trailingslashit($source) . trailingslashit($source_files[0]); |
215 | elseif ( count($source_files) == 0 ) |
216 | return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files? |
217 | else //It's only a single file, the upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename. |
218 | $source = trailingslashit($source); |
219 |
|
220 | //Hook ability to change the source file location.. |
221 | $source = apply_filters('upgrader_source_selection', $source, $remote_source, $this); |
222 | if ( is_wp_error($source) ) |
223 | return $source; |
224 |
|
225 | //Has the source location changed? If so, we need a new source_files list. |
226 | if ( $source !== $remote_source ) |
227 | $source_files = array_keys( $wp_filesystem->dirlist($source) ); |
228 |
|
229 | // Protection against deleting files in any important base directories. |
230 | // Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the destination directory (WP_PLUGIN_DIR / wp-content/themes) |