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 |
---|---|
429 | $default_sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') ); |
430 |
|
431 | if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) { |
432 | $data = $backup_sizes['full-orig']; |
433 |
|
434 | if ( $parts['basename'] != $data['file'] ) { |
435 | if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { |
436 | // delete only if it's edited image |
437 | if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) { |
438 | $delpath = apply_filters('wp_delete_file', $file); |
439 | @unlink($delpath); |
440 | } |
441 | } else { |
442 | $backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']); |
443 | } |
444 | } |
445 |
|
446 | $restored_file = path_join($parts['dirname'], $data['file']); |
447 | $restored = update_attached_file($post_id, $restored_file); |
Line | Code |
454 | } |
455 |
|
456 | foreach ( $default_sizes as $default_size ) { |
457 | if ( isset($backup_sizes["$default_size-orig"]) ) { |
458 | $data = $backup_sizes["$default_size-orig"]; |
459 | if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) { |
460 | if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { |
461 | // delete only if it's edited image |
462 | if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) { |
463 | $delpath = apply_filters( 'wp_delete_file', path_join($parts['dirname'], $meta['sizes'][$default_size]['file']) ); |
464 | @unlink($delpath); |
465 | } |
466 | } else { |
467 | $backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size]; |
468 | } |
469 | } |
470 |
|
471 | $meta['sizes'][$default_size] = $data; |
472 | } else { |
Line | Code |
645 | $return->thumbnail = path_join( dirname($file_url), $thumb['file'] ); |
646 | else |
647 | $return->thumbnail = "$file_url?w=128&h=128"; |
648 | } |
649 | } else { |
650 | $delete = true; |
651 | } |
652 |
|
653 | if ( $delete ) { |
654 | $delpath = apply_filters('wp_delete_file', $new_path); |
655 | @unlink($delpath); |
656 | } |
657 |
|
658 | imagedestroy($img); |
659 |
|
660 | $return->msg = esc_js( __('Image saved') ); |
661 | return $return; |
662 | } |
663 |
|