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 3 times in this file.
| Line | Code |
|---|---|
| 495 | |
| 496 | if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) { |
| 497 | $data = $backup_sizes['full-orig']; |
| 498 | |
| 499 | if ( $parts['basename'] != $data['file'] ) { |
| 500 | if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { |
| 501 | // delete only if it's edited image |
| 502 | if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) { |
| 503 | /** This filter is documented in wp-admin/custom-header.php */ |
| 504 | $delpath = apply_filters('wp_delete_file', $file); |
| 505 | @unlink($delpath); |
| 506 | } |
| 507 | } elseif ( isset( $meta['width'], $meta['height'] ) ) { |
| 508 | $backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']); |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | $restored_file = path_join($parts['dirname'], $data['file']); |
| 513 | $restored = update_attached_file($post_id, $restored_file); |
| Line | Code |
| 519 | |
| 520 | foreach ( $default_sizes as $default_size ) { |
| 521 | if ( isset($backup_sizes["$default_size-orig"]) ) { |
| 522 | $data = $backup_sizes["$default_size-orig"]; |
| 523 | if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) { |
| 524 | if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { |
| 525 | // delete only if it's edited image |
| 526 | if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) { |
| 527 | /** This filter is documented in wp-admin/custom-header.php */ |
| 528 | $delpath = apply_filters( 'wp_delete_file', path_join($parts['dirname'], $meta['sizes'][$default_size]['file']) ); |
| 529 | @unlink($delpath); |
| 530 | } |
| 531 | } else { |
| 532 | $backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size]; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | $meta['sizes'][$default_size] = $data; |
| 537 | } else { |
| Line | Code |
| 720 | $return->thumbnail = "$file_url?w=128&h=128"; |
| 721 | } |
| 722 | } |
| 723 | } else { |
| 724 | $delete = true; |
| 725 | } |
| 726 | |
| 727 | if ( $delete ) { |
| 728 | /** This filter is documented in wp-admin/custom-header.php */ |
| 729 | $delpath = apply_filters('wp_delete_file', $new_path); |
| 730 | @unlink( $delpath ); |
| 731 | } |
| 732 | |
| 733 | $return->msg = esc_js( __('Image saved') ); |
| 734 | return $return; |
| 735 | } |
| 736 | |