Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php goto PUyiR; PUyiR: function wp_image_editor($post_id, $msg = false) { $nonce = wp_c..
Decoded Output download
<?php
goto PUyiR; PUyiR: function wp_image_editor($post_id, $msg = false) { $nonce = wp_create_nonce("image_editor-{$post_id}"); $meta = wp_get_attachment_metadata($post_id); $thumb = image_get_intermediate_size($post_id, "thumbnail"); $sub_sizes = isset($meta["sizes"]) && is_array($meta["sizes"]); $note = ''; if (isset($meta["width"], $meta["height"])) { $big = max($meta["width"], $meta["height"]); } else { die(__("Image data does not exist. Please re-upload the image.")); } $sizer = $big > 600 ? 600 / $big : 1; $backup_sizes = get_post_meta($post_id, "_wp_attachment_backup_sizes", true); $can_restore = false; if (!empty($backup_sizes) && isset($backup_sizes["full-orig"], $meta["file"])) { $can_restore = wp_basename($meta["file"]) !== $backup_sizes["full-orig"]["file"]; } if ($msg) { if (isset($msg->error)) { $note = "<div class='notice notice-error' role='alert'><p>{$msg->error}</p></div>"; } elseif (isset($msg->msg)) { $note = "<div class='notice notice-success' role='alert'><p>{$msg->msg}</p></div>"; } } $edit_thumbnails_separately = (bool) apply_filters("image_edit_thumbnails_separately", false); ?>
<div class="imgedit-wrap wp-clearfix">
<div id="imgedit-panel-<?php echo $post_id; ?>
">
<?php echo $note; ?>
<div class="imgedit-panel-content imgedit-panel-tools wp-clearfix">
<div class="imgedit-menu wp-clearfix">
<button type="button" onclick="imageEdit.toggleCropTool( <?php echo "{$post_id}, '{$nonce}'"; ?>
, this );" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e("Crop"); ?>
</button>
<button type="button" class="imgedit-scale button" onclick="imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-scale"><?php esc_html_e("Scale"); ?>
</button>
<div class="imgedit-rotate-menu-container">
<button type="button" aria-controls="imgedit-rotate-menu" class="imgedit-rotate button" aria-expanded="false" onclick="imageEdit.togglePopup(this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("Image Rotation"); ?>
</button>
<div id="imgedit-rotate-menu" class="imgedit-popup-menu">
<?php if (wp_image_editor_supports(array("mime_type" => get_post_mime_type($post_id), "methods" => array("rotate")))) { $note_no_rotate = ''; ?>
<button type="button" class="imgedit-rleft button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("Rotate 90° left"); ?>
</button>
<button type="button" class="imgedit-rright button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(-90, <?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("Rotate 90° right"); ?>
</button>
<button type="button" class="imgedit-rfull button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(180, <?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("Rotate 180°"); ?>
</button>
<?php } else { $note_no_rotate = "<p class="note-no-rotate"><em>" . __("Image rotation is not supported by your web host.") . "</em></p>"; ?>
<button type="button" class="imgedit-rleft button disabled" disabled></button>
<button type="button" class="imgedit-rright button disabled" disabled></button>
<?php } ?>
<hr />
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" onblur="imageEdit.monitorPopup()" class="imgedit-flipv button"><?php esc_html_e("Flip vertical"); ?>
</button>
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(2, <?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" onblur="imageEdit.monitorPopup()" class="imgedit-fliph button"><?php esc_html_e("Flip horizontal"); ?>
</button>
<?php echo $note_no_rotate; ?>
</div>
</div>
</div>
<div class="imgedit-submit imgedit-menu">
<button type="button" id="image-undo-<?php echo $post_id; ?>
" onclick="imageEdit.undo(<?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" class="imgedit-undo button disabled" disabled><?php esc_html_e("Undo"); ?>
</button>
<button type="button" id="image-redo-<?php echo $post_id; ?>
" onclick="imageEdit.redo(<?php echo "{$post_id}, '{$nonce}'"; ?>
, this)" class="imgedit-redo button disabled" disabled><?php esc_html_e("Redo"); ?>
</button>
<button type="button" onclick="imageEdit.close(<?php echo $post_id; ?>
, 1)" class="button imgedit-cancel-btn"><?php esc_html_e("Cancel Editing"); ?>
</button>
<button type="button" onclick="imageEdit.save(<?php echo "{$post_id}, '{$nonce}'"; ?>
)" disabled="disabled" class="button button-primary imgedit-submit-btn"><?php esc_html_e("Save Edits"); ?>
</button>
</div>
</div>
<div class="imgedit-panel-content wp-clearfix">
<div class="imgedit-tools">
<input type="hidden" id="imgedit-nonce-<?php echo $post_id; ?>
" value="<?php echo $nonce; ?>
" />
<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>
" value="<?php echo $sizer; ?>
" />
<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>
" value="" />
<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>
" value="0" />
<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>
" value="" />
<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>
" value="<?php echo isset($meta["width"]) ? $meta["width"] : 0; ?>
" />
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>
" value="<?php echo isset($meta["height"]) ? $meta["height"] : 0; ?>
" />
<div id="imgedit-crop-<?php echo $post_id; ?>
" class="imgedit-crop-wrap">
<div class="imgedit-crop-grid"></div>
<img id="image-preview-<?php echo $post_id; ?>
" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>
')"
src="<?php echo esc_url(admin_url("admin-ajax.php", "relative")) . "?action=imgedit-preview&_ajax_nonce=" . $nonce . "&postid=" . $post_id . "&rand=" . rand(1, 99999); ?>
" alt="" />
</div>
</div>
<div class="imgedit-settings">
<div class="imgedit-tool-active">
<div class="imgedit-group">
<div id="imgedit-scale" tabindex="-1" class="imgedit-group-controls">
<div class="imgedit-group-top">
<h2><?php _e("Scale Image"); ?>
</h2>
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
<?php esc_html_e("Scale Image Help"); ?>
</span></button>
<div class="imgedit-help">
<p><?php _e("You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up."); ?>
</p>
</div>
<?php if (isset($meta["width"], $meta["height"])) { ?>
<p>
<?php printf(__("Original dimensions %s"), "<span class="imgedit-original-dimensions">" . $meta["width"] . " × " . $meta["height"] . "</span>"); ?>
</p>
<?php } ?>
<div class="imgedit-submit">
<fieldset class="imgedit-scale-controls">
<legend><?php _e("New dimensions:"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-scale-width-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("scale height"); ?>
</label>
<input type="number" step="1" min="0" max="<?php echo isset($meta["width"]) ? $meta["width"] : ''; ?>
" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>
" id="imgedit-scale-width-<?php echo $post_id; ?>
" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 1, this)" value="<?php echo isset($meta["width"]) ? $meta["width"] : 0; ?>
" />
<span class="imgedit-separator" aria-hidden="true">×</span>
<label for="imgedit-scale-height-<?php echo $post_id; ?>
" class="screen-reader-text"><?php _e("scale height"); ?>
</label>
<input type="number" step="1" min="0" max="<?php echo isset($meta["height"]) ? $meta["height"] : ''; ?>
" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>
" id="imgedit-scale-height-<?php echo $post_id; ?>
" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 0, this)" value="<?php echo isset($meta["height"]) ? $meta["height"] : 0; ?>
" />
<button id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "{$post_id}, '{$nonce}'"; ?>
, 'scale')" class="button button-primary"><?php esc_html_e("Scale"); ?>
</button>
<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>
"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e("Images cannot be scaled to a size larger than the original."); ?>
</span>
</div>
</fieldset>
</div>
</div>
</div>
</div>
<?php if ($can_restore) { ?>
<div class="imgedit-group">
<div class="imgedit-group-top">
<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link" aria-expanded="false"><?php _e("Restore original image"); ?>
<span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
<div class="imgedit-help imgedit-restore">
<p>
<?php _e("Discard any changes and restore the original image."); if (!defined("IMAGE_EDIT_OVERWRITE") || !IMAGE_EDIT_OVERWRITE) { echo " " . __("Previously edited copies of the image will not be deleted."); } ?>
</p>
<div class="imgedit-submit">
<input type="button" onclick="imageEdit.action(<?php echo "{$post_id}, '{$nonce}'"; ?>
, 'restore')" class="button button-primary" value="<?php esc_attr_e("Restore image"); ?>
" <?php echo $can_restore; ?>
/>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="imgedit-group">
<div id="imgedit-crop" tabindex="-1" class="imgedit-group-controls">
<div class="imgedit-group-top">
<h2><?php _e("Crop Image"); ?>
</h2>
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
<?php _e("Image Crop Help"); ?>
</span></button>
<div class="imgedit-help">
<p><?php _e("To crop the image, click on it and drag to make your selection."); ?>
</p>
<p><strong><?php _e("Crop Aspect Ratio"); ?>
</strong><br />
<?php _e("The aspect ratio is the relationship between the width and height. You can preserve the aspect ratio by holding down the shift key while resizing your selection. Use the input box to specify the aspect ratio, e.g. 1:1 (square), 4:3, 16:9, etc."); ?>
</p>
<p><strong><?php _e("Crop Selection"); ?>
</strong><br />
<?php _e("Once you have made your selection, you can adjust it by entering the size in pixels. The minimum selection size is the thumbnail size as set in the Media settings."); ?>
</p>
</div>
</div>
<fieldset class="imgedit-crop-ratio">
<legend><?php _e("Aspect ratio:"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-crop-width-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("crop ratio width"); ?>
</label>
<input type="number" step="1" min="1" id="imgedit-crop-width-<?php echo $post_id; ?>
" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 0, this)" />
<span class="imgedit-separator" aria-hidden="true">:</span>
<label for="imgedit-crop-height-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("crop ratio height"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-crop-height-<?php echo $post_id; ?>
" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 1, this)" />
</div>
</fieldset>
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>
" class="imgedit-crop-sel">
<legend><?php _e("Selection:"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-sel-width-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("selection width"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-sel-width-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" />
<span class="imgedit-separator" aria-hidden="true">×</span>
<label for="imgedit-sel-height-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("selection height"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-sel-height-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" />
</div>
</fieldset>
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>
" class="imgedit-crop-sel">
<legend><?php _e("Starting Coordinates:"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-start-x-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("horizontal start position"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-start-x-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" value="0" />
<span class="imgedit-separator" aria-hidden="true">×</span>
<label for="imgedit-start-y-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("vertical start position"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-start-y-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" value="0" />
</div>
</fieldset>
<div class="imgedit-crop-apply imgedit-menu container">
<button class="button-primary" type="button" onclick="imageEdit.handleCropToolClick( <?php echo "{$post_id}, '{$nonce}'"; ?>
, this );" class="imgedit-crop-apply button"><?php esc_html_e("Apply Crop"); ?>
</button> <button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "{$post_id}, '{$nonce}'"; ?>
, this );" class="imgedit-crop-clear button" disabled="disabled"><?php esc_html_e("Clear Crop"); ?>
</button>
</div>
</div>
</div>
</div>
<?php if ($edit_thumbnails_separately && $thumb && $sub_sizes) { $thumb_img = wp_constrain_dimensions($thumb["width"], $thumb["height"], 160, 120); ?>
<div class="imgedit-group imgedit-applyto">
<div class="imgedit-group-top">
<h2><?php _e("Thumbnail Settings"); ?>
</h2>
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
<?php esc_html_e("Thumbnail Settings Help"); ?>
</span></button>
<div class="imgedit-help">
<p><?php _e("You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image."); ?>
</p>
</div>
</div>
<div class="imgedit-thumbnail-preview-group">
<figure class="imgedit-thumbnail-preview">
<img src="<?php echo $thumb["url"]; ?>
" width="<?php echo $thumb_img[0]; ?>
" height="<?php echo $thumb_img[1]; ?>
" class="imgedit-size-preview" alt="" draggable="false" />
<figcaption class="imgedit-thumbnail-preview-caption"><?php _e("Current thumbnail"); ?>
</figcaption>
</figure>
<div id="imgedit-save-target-<?php echo $post_id; ?>
" class="imgedit-save-target">
<fieldset>
<legend><?php _e("Apply changes to:"); ?>
</legend>
<span class="imgedit-label">
<input type="radio" id="imgedit-target-all" name="imgedit-target-<?php echo $post_id; ?>
" value="all" checked="checked" />
<label for="imgedit-target-all"><?php _e("All image sizes"); ?>
</label>
</span>
<span class="imgedit-label">
<input type="radio" id="imgedit-target-thumbnail" name="imgedit-target-<?php echo $post_id; ?>
" value="thumbnail" />
<label for="imgedit-target-thumbnail"><?php _e("Thumbnail"); ?>
</label>
</span>
<span class="imgedit-label">
<input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>
" value="nothumb" />
<label for="imgedit-target-nothumb"><?php _e("All sizes except thumbnail"); ?>
</label>
</span>
</fieldset>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>
"></div>
<div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>
"><?php _e("There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor."); ?>
</div>
</div>
<?php } goto HDf67; fpopb: function wp_save_image_file($filename, $image, $mime_type, $post_id) { if ($image instanceof WP_Image_Editor) { $image = apply_filters("image_editor_save_pre", $image, $post_id); $saved = apply_filters("wp_save_image_editor_file", null, $filename, $image, $mime_type, $post_id); if (null !== $saved) { return $saved; } return $image->save($filename, $mime_type); } else { _deprecated_argument(__FUNCTION__, "3.5.0", sprintf(__("%1$s needs to be a %2$s object."), "$image", "WP_Image_Editor")); $image = apply_filters_deprecated("image_save_pre", array($image, $post_id), "3.5.0", "image_editor_save_pre"); $saved = apply_filters_deprecated("wp_save_image_file", array(null, $filename, $image, $mime_type, $post_id), "3.5.0", "wp_save_image_editor_file"); if (null !== $saved) { return $saved; } switch ($mime_type) { case "image/jpeg": return imagejpeg($image, $filename, apply_filters("jpeg_quality", 90, "edit_image")); case "image/png": return imagepng($image, $filename); case "image/gif": return imagegif($image, $filename); case "image/webp": if (function_exists("imagewebp")) { return imagewebp($image, $filename); } return false; case "image/avif": if (function_exists("imageavif")) { return imageavif($image, $filename); } return false; default: return false; } } } goto oXEn8; oXEn8: function _image_get_preview_ratio($w, $h) { $max = max($w, $h); return $max > 600 ? 600 / $max : 1; } goto vOrs5; HDf67: function wp_stream_image($image, $mime_type, $attachment_id) { if ($image instanceof WP_Image_Editor) { $image = apply_filters("image_editor_save_pre", $image, $attachment_id); if (is_wp_error($image->stream($mime_type))) { return false; } return true; } else { _deprecated_argument(__FUNCTION__, "3.5.0", sprintf(__("%1$s needs to be a %2$s object."), "$image", "WP_Image_Editor")); $image = apply_filters_deprecated("image_save_pre", array($image, $attachment_id), "3.5.0", "image_editor_save_pre"); switch ($mime_type) { case "image/jpeg": header("Content-Type: image/jpeg"); return imagejpeg($image, null, 90); case "image/png": header("Content-Type: image/png"); return imagepng($image); case "image/gif": header("Content-Type: image/gif"); return imagegif($image); case "image/webp": if (function_exists("imagewebp")) { header("Content-Type: image/webp"); return imagewebp($image, null, 90); } return false; case "image/avif": if (function_exists("imageavif")) { header("Content-Type: image/avif"); return imageavif($image, null, 90); } return false; default: return false; } } } goto fpopb; gpxxW: function wp_restore_image($post_id) { $meta = wp_get_attachment_metadata($post_id); $file = get_attached_file($post_id); $backup_sizes = get_post_meta($post_id, "_wp_attachment_backup_sizes", true); $old_backup_sizes = $backup_sizes; $restored = false; $msg = new stdClass(); if (!is_array($backup_sizes)) { $msg->error = __("Cannot load image metadata."); return $msg; } $parts = pathinfo($file); $suffix = time() . rand(100, 999); $default_sizes = get_intermediate_image_sizes(); if (isset($backup_sizes["full-orig"]) && is_array($backup_sizes["full-orig"])) { $data = $backup_sizes["full-orig"]; if ($parts["basename"] !== $data["file"]) { if (defined("IMAGE_EDIT_OVERWRITE") && IMAGE_EDIT_OVERWRITE) { if (preg_match("/-e[0-9]{13}\./", $parts["basename"])) { wp_delete_file($file); } } elseif (isset($meta["width"], $meta["height"])) { $backup_sizes["full-{$suffix}"] = array("width" => $meta["width"], "height" => $meta["height"], "file" => $parts["basename"]); } } $restored_file = path_join($parts["dirname"], $data["file"]); $restored = update_attached_file($post_id, $restored_file); $meta["file"] = _wp_relative_upload_path($restored_file); $meta["width"] = $data["width"]; $meta["height"] = $data["height"]; } foreach ($default_sizes as $default_size) { if (isset($backup_sizes["{$default_size}-orig"])) { $data = $backup_sizes["{$default_size}-orig"]; if (isset($meta["sizes"][$default_size]) && $meta["sizes"][$default_size]["file"] !== $data["file"]) { if (defined("IMAGE_EDIT_OVERWRITE") && IMAGE_EDIT_OVERWRITE) { if (preg_match("/-e[0-9]{13}-/", $meta["sizes"][$default_size]["file"])) { $delete_file = path_join($parts["dirname"], $meta["sizes"][$default_size]["file"]); wp_delete_file($delete_file); } } else { $backup_sizes["{$default_size}-{$suffix}"] = $meta["sizes"][$default_size]; } } $meta["sizes"][$default_size] = $data; } else { unset($meta["sizes"][$default_size]); } } if (!wp_update_attachment_metadata($post_id, $meta) || $old_backup_sizes !== $backup_sizes && !update_post_meta($post_id, "_wp_attachment_backup_sizes", $backup_sizes)) { $msg->error = __("Cannot save image metadata."); return $msg; } if (!$restored) { $msg->error = __("Image metadata is inconsistent."); } else { $msg->msg = __("Image restored successfully."); if (defined("IMAGE_EDIT_OVERWRITE") && IMAGE_EDIT_OVERWRITE) { delete_post_meta($post_id, "_wp_attachment_backup_sizes"); } } return $msg; } goto PX0IT; vOrs5: function _rotate_image_resource($img, $angle) { _deprecated_function(__FUNCTION__, "3.5.0", "WP_Image_Editor::rotate()"); if (function_exists("imagerotate")) { $rotated = imagerotate($img, $angle, 0); if (is_gd_image($rotated)) { imagedestroy($img); $img = $rotated; } } return $img; } goto vJqZj; WnAor: function stream_preview_image($post_id) { $post = get_post($post_id); wp_raise_memory_limit("admin"); $img = wp_get_image_editor(_load_image_to_edit_path($post_id)); if (is_wp_error($img)) { return false; } $changes = !empty($_REQUEST["history"]) ? json_decode(wp_unslash($_REQUEST["history"])) : null; if ($changes) { $img = image_edit_apply_changes($img, $changes); } $size = $img->get_size(); $w = $size["width"]; $h = $size["height"]; $ratio = _image_get_preview_ratio($w, $h); $w2 = max(1, $w * $ratio); $h2 = max(1, $h * $ratio); if (is_wp_error($img->resize($w2, $h2))) { return false; } return wp_stream_image($img, $post->post_mime_type, $post_id); } goto gpxxW; oxKcd: function _crop_image_resource($img, $x, $y, $w, $h) { $dst = wp_imagecreatetruecolor($w, $h); if (is_gd_image($dst)) { if (imagecopy($dst, $img, 0, 0, $x, $y, $w, $h)) { imagedestroy($img); $img = $dst; } } return $img; } goto lOr5g; lOr5g: function image_edit_apply_changes($image, $changes) { if (is_gd_image($image)) { _deprecated_argument(__FUNCTION__, "3.5.0", sprintf(__("%1$s needs to be a %2$s object."), "$image", "WP_Image_Editor")); } if (!is_array($changes)) { return $image; } foreach ($changes as $key => $obj) { if (isset($obj->r)) { $obj->type = "rotate"; $obj->angle = $obj->r; unset($obj->r); } elseif (isset($obj->f)) { $obj->type = "flip"; $obj->axis = $obj->f; unset($obj->f); } elseif (isset($obj->c)) { $obj->type = "crop"; $obj->sel = $obj->c; unset($obj->c); } $changes[$key] = $obj; } if (count($changes) > 1) { $filtered = array($changes[0]); for ($i = 0, $j = 1, $c = count($changes); $j < $c; $j++) { $combined = false; if ($filtered[$i]->type === $changes[$j]->type) { switch ($filtered[$i]->type) { case "rotate": $filtered[$i]->angle += $changes[$j]->angle; $combined = true; break; case "flip": $filtered[$i]->axis ^= $changes[$j]->axis; $combined = true; break; } } if (!$combined) { $filtered[++$i] = $changes[$j]; } } $changes = $filtered; unset($filtered); } if ($image instanceof WP_Image_Editor) { $image = apply_filters("wp_image_editor_before_change", $image, $changes); } elseif (is_gd_image($image)) { $image = apply_filters_deprecated("image_edit_before_change", array($image, $changes), "3.5.0", "wp_image_editor_before_change"); } foreach ($changes as $operation) { switch ($operation->type) { case "rotate": if (0 !== $operation->angle) { if ($image instanceof WP_Image_Editor) { $image->rotate($operation->angle); } else { $image = _rotate_image_resource($image, $operation->angle); } } break; case "flip": if (0 !== $operation->axis) { if ($image instanceof WP_Image_Editor) { $image->flip(($operation->axis & 1) !== 0, ($operation->axis & 2) !== 0); } else { $image = _flip_image_resource($image, ($operation->axis & 1) !== 0, ($operation->axis & 2) !== 0); } } break; case "crop": $sel = $operation->sel; if ($image instanceof WP_Image_Editor) { $size = $image->get_size(); $w = $size["width"]; $h = $size["height"]; $scale = 1 / _image_get_preview_ratio($w, $h); $image->crop($sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale); } else { $scale = 1 / _image_get_preview_ratio(imagesx($image), imagesy($image)); $image = _crop_image_resource($image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale); } break; } } return $image; } goto WnAor; vJqZj: function _flip_image_resource($img, $horz, $vert) { _deprecated_function(__FUNCTION__, "3.5.0", "WP_Image_Editor::flip()"); $w = imagesx($img); $h = imagesy($img); $dst = wp_imagecreatetruecolor($w, $h); if (is_gd_image($dst)) { $sx = $vert ? $w - 1 : 0; $sy = $horz ? $h - 1 : 0; $sw = $vert ? -$w : $w; $sh = $horz ? -$h : $h; if (imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh)) { imagedestroy($img); $img = $dst; } } return $img; } goto oxKcd; PX0IT: function wp_save_image($post_id) { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); $return = new stdClass(); $success = false; $delete = false; $scaled = false; $nocrop = false; $post = get_post($post_id); $img = wp_get_image_editor(_load_image_to_edit_path($post_id, "full")); if (is_wp_error($img)) { $return->error = esc_js(__("Unable to create new image.")); return $return; } $full_width = !empty($_REQUEST["fwidth"]) ? (int) $_REQUEST["fwidth"] : 0; $full_height = !empty($_REQUEST["fheight"]) ? (int) $_REQUEST["fheight"] : 0; $target = !empty($_REQUEST["target"]) ? preg_replace("/[^a-z0-9_-]+/i", '', $_REQUEST["target"]) : ''; $scale = !empty($_REQUEST["do"]) && "scale" === $_REQUEST["do"]; $edit_thumbnails_separately = (bool) apply_filters("image_edit_thumbnails_separately", false); if ($scale) { $size = $img->get_size(); $original_width = $size["width"]; $original_height = $size["height"]; if ($full_width > $original_width || $full_height > $original_height) { $return->error = esc_js(__("Images cannot be scaled to a size larger than the original.")); return $return; } if ($full_width > 0 && $full_height > 0) { $diff = round($original_width / $original_height, 2) - round($full_width / $full_height, 2); if (-0.1 < $diff && $diff < 0.1) { if ($img->resize($full_width, $full_height)) { $scaled = true; } } if (!$scaled) { $return->error = esc_js(__("Error while saving the scaled image. Please reload the page and try again.")); return $return; } } } elseif (!empty($_REQUEST["history"])) { $changes = json_decode(wp_unslash($_REQUEST["history"])); if ($changes) { $img = image_edit_apply_changes($img, $changes); } } else { $return->error = esc_js(__("Nothing to save, the image has not changed.")); return $return; } $meta = wp_get_attachment_metadata($post_id); $backup_sizes = get_post_meta($post->ID, "_wp_attachment_backup_sizes", true); if (!is_array($meta)) { $return->error = esc_js(__("Image data does not exist. Please re-upload the image.")); return $return; } if (!is_array($backup_sizes)) { $backup_sizes = array(); } $path = get_attached_file($post_id); $basename = pathinfo($path, PATHINFO_BASENAME); $dirname = pathinfo($path, PATHINFO_DIRNAME); $ext = pathinfo($path, PATHINFO_EXTENSION); $filename = pathinfo($path, PATHINFO_FILENAME); $suffix = time() . rand(100, 999); if (defined("IMAGE_EDIT_OVERWRITE") && IMAGE_EDIT_OVERWRITE && isset($backup_sizes["full-orig"]) && $backup_sizes["full-orig"]["file"] !== $basename) { if ($edit_thumbnails_separately && "thumbnail" === $target) { $new_path = "{$dirname}/{$filename}-temp.{$ext}"; } else { $new_path = $path; } } else { while (true) { $filename = preg_replace("/-e([0-9]+)$/", '', $filename); $filename .= "-e{$suffix}"; $new_filename = "{$filename}.{$ext}"; $new_path = "{$dirname}/{$new_filename}"; if (file_exists($new_path)) { ++$suffix; } else { break; } } } if (!wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id)) { $return->error = esc_js(__("Unable to save the image.")); return $return; } if ("nothumb" === $target || "all" === $target || "full" === $target || $scaled) { $tag = false; if (isset($backup_sizes["full-orig"])) { if ((!defined("IMAGE_EDIT_OVERWRITE") || !IMAGE_EDIT_OVERWRITE) && $backup_sizes["full-orig"]["file"] !== $basename) { $tag = "full-{$suffix}"; } } else { $tag = "full-orig"; } if ($tag) { $backup_sizes[$tag] = array("width" => $meta["width"], "height" => $meta["height"], "file" => $basename); } $success = $path === $new_path || update_attached_file($post_id, $new_path); $meta["file"] = _wp_relative_upload_path($new_path); $size = $img->get_size(); $meta["width"] = $size["width"]; $meta["height"] = $size["height"]; if ($success && ("nothumb" === $target || "all" === $target)) { $sizes = get_intermediate_image_sizes(); if ($edit_thumbnails_separately && "nothumb" === $target) { $sizes = array_diff($sizes, array("thumbnail")); } } $return->fw = $meta["width"]; $return->fh = $meta["height"]; } elseif ($edit_thumbnails_separately && "thumbnail" === $target) { $sizes = array("thumbnail"); $success = true; $delete = true; $nocrop = true; } if (defined("IMAGE_EDIT_OVERWRITE") && IMAGE_EDIT_OVERWRITE && !empty($meta["sizes"])) { foreach ($meta["sizes"] as $size) { if (!empty($size["file"]) && preg_match("/-e[0-9]{13}-/", $size["file"])) { $delete_file = path_join($dirname, $size["file"]); wp_delete_file($delete_file); } } } if (isset($sizes)) { $_sizes = array(); foreach ($sizes as $size) { $tag = false; if (isset($meta["sizes"][$size])) { if (isset($backup_sizes["{$size}-orig"])) { if ((!defined("IMAGE_EDIT_OVERWRITE") || !IMAGE_EDIT_OVERWRITE) && $backup_sizes["{$size}-orig"]["file"] !== $meta["sizes"][$size]["file"]) { $tag = "{$size}-{$suffix}"; } } else { $tag = "{$size}-orig"; } if ($tag) { $backup_sizes[$tag] = $meta["sizes"][$size]; } } if (isset($_wp_additional_image_sizes[$size])) { $width = (int) $_wp_additional_image_sizes[$size]["width"]; $height = (int) $_wp_additional_image_sizes[$size]["height"]; $crop = $nocrop ? false : $_wp_additional_image_sizes[$size]["crop"]; } else { $height = get_option("{$size}_size_h"); $width = get_option("{$size}_size_w"); $crop = $nocrop ? false : get_option("{$size}_crop"); } $_sizes[$size] = array("width" => $width, "height" => $height, "crop" => $crop); } $meta["sizes"] = array_merge($meta["sizes"], $img->multi_resize($_sizes)); } unset($img); if ($success) { wp_update_attachment_metadata($post_id, $meta); update_post_meta($post_id, "_wp_attachment_backup_sizes", $backup_sizes); if ("thumbnail" === $target || "all" === $target || "full" === $target) { if (!empty($_REQUEST["context"]) && "edit-attachment" === $_REQUEST["context"]) { $thumb_url = wp_get_attachment_image_src($post_id, array(900, 600), true); $return->thumbnail = $thumb_url[0]; } else { $file_url = wp_get_attachment_url($post_id); if (!empty($meta["sizes"]["thumbnail"])) { $thumb = $meta["sizes"]["thumbnail"]; $return->thumbnail = path_join(dirname($file_url), $thumb["file"]); } else { $return->thumbnail = "{$file_url}?w=128&h=128"; } } } } else { $delete = true; } if ($delete) { wp_delete_file($new_path); } $return->msg = esc_js(__("Image saved")); return $return; } ?>
Did this file decode correctly?
Original Code
<?php
goto PUyiR; PUyiR: function wp_image_editor($post_id, $msg = false) { $nonce = wp_create_nonce("\151\x6d\141\x67\145\137\145\144\x69\x74\157\x72\x2d{$post_id}"); $meta = wp_get_attachment_metadata($post_id); $thumb = image_get_intermediate_size($post_id, "\164\150\x75\x6d\142\x6e\141\151\x6c"); $sub_sizes = isset($meta["\x73\x69\x7a\145\x73"]) && is_array($meta["\163\x69\172\x65\163"]); $note = ''; if (isset($meta["\x77\x69\x64\x74\150"], $meta["\x68\x65\151\x67\x68\164"])) { $big = max($meta["\x77\x69\144\164\150"], $meta["\150\145\151\x67\x68\164"]); } else { die(__("\111\155\x61\x67\x65\40\x64\141\164\x61\40\144\157\x65\163\40\156\x6f\164\40\145\170\151\163\x74\x2e\40\x50\154\x65\141\x73\145\x20\162\x65\x2d\x75\160\x6c\157\x61\144\x20\164\x68\145\x20\151\155\141\x67\145\56")); } $sizer = $big > 600 ? 600 / $big : 1; $backup_sizes = get_post_meta($post_id, "\137\167\x70\x5f\141\x74\164\x61\143\150\155\145\156\164\137\142\141\143\x6b\x75\x70\137\163\151\172\x65\163", true); $can_restore = false; if (!empty($backup_sizes) && isset($backup_sizes["\146\x75\x6c\154\x2d\157\x72\151\x67"], $meta["\x66\x69\154\145"])) { $can_restore = wp_basename($meta["\146\x69\154\x65"]) !== $backup_sizes["\146\165\x6c\154\55\157\x72\151\x67"]["\x66\151\154\x65"]; } if ($msg) { if (isset($msg->error)) { $note = "\74\x64\x69\166\40\143\154\x61\163\x73\x3d\x27\156\157\x74\x69\x63\x65\40\x6e\157\164\151\x63\x65\55\x65\x72\162\x6f\162\x27\40\x72\x6f\x6c\145\75\47\141\154\145\x72\164\x27\76\74\160\x3e{$msg->error}\74\57\160\x3e\74\57\144\x69\x76\x3e"; } elseif (isset($msg->msg)) { $note = "\74\x64\151\166\x20\143\x6c\x61\163\x73\75\47\156\157\164\x69\x63\145\40\x6e\157\x74\x69\x63\145\55\163\165\x63\143\145\x73\163\47\40\162\157\154\145\75\47\x61\154\x65\x72\164\x27\76\x3c\160\76{$msg->msg}\74\57\x70\x3e\74\x2f\144\151\x76\x3e"; } } $edit_thumbnails_separately = (bool) apply_filters("\x69\x6d\141\x67\x65\x5f\x65\x64\151\x74\137\x74\150\x75\x6d\142\x6e\141\x69\x6c\163\137\163\145\x70\x61\x72\141\x74\145\154\x79", false); ?>
<div class="imgedit-wrap wp-clearfix">
<div id="imgedit-panel-<?php echo $post_id; ?>
">
<?php echo $note; ?>
<div class="imgedit-panel-content imgedit-panel-tools wp-clearfix">
<div class="imgedit-menu wp-clearfix">
<button type="button" onclick="imageEdit.toggleCropTool( <?php echo "{$post_id}\x2c\40\x27{$nonce}\x27"; ?>
, this );" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e("\x43\x72\157\x70"); ?>
</button>
<button type="button" class="imgedit-scale button" onclick="imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-scale"><?php esc_html_e("\123\x63\141\154\x65"); ?>
</button>
<div class="imgedit-rotate-menu-container">
<button type="button" aria-controls="imgedit-rotate-menu" class="imgedit-rotate button" aria-expanded="false" onclick="imageEdit.togglePopup(this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("\x49\x6d\141\x67\x65\x20\122\x6f\x74\141\x74\151\157\156"); ?>
</button>
<div id="imgedit-rotate-menu" class="imgedit-popup-menu">
<?php if (wp_image_editor_supports(array("\155\151\x6d\145\x5f\x74\171\160\x65" => get_post_mime_type($post_id), "\155\145\x74\150\157\144\163" => array("\x72\157\164\141\164\x65")))) { $note_no_rotate = ''; ?>
<button type="button" class="imgedit-rleft button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate( 90, <?php echo "{$post_id}\x2c\x20\47{$nonce}\47"; ?>
, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("\x52\x6f\x74\141\164\x65\40\71\x30\46\144\145\x67\x3b\x20\154\145\146\x74"); ?>
</button>
<button type="button" class="imgedit-rright button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(-90, <?php echo "{$post_id}\54\x20\x27{$nonce}\x27"; ?>
, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("\122\157\x74\x61\164\145\40\71\x30\46\x64\145\x67\73\x20\162\151\x67\x68\x74"); ?>
</button>
<button type="button" class="imgedit-rfull button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.rotate(180, <?php echo "{$post_id}\54\x20\47{$nonce}\47"; ?>
, this)" onblur="imageEdit.monitorPopup()"><?php esc_html_e("\x52\x6f\x74\x61\x74\145\x20\61\70\60\46\x64\145\x67\x3b"); ?>
</button>
<?php } else { $note_no_rotate = "\x3c\160\40\143\x6c\x61\163\x73\x3d\42\x6e\x6f\x74\x65\55\x6e\x6f\55\x72\157\164\x61\x74\145\x22\x3e\74\x65\155\x3e" . __("\x49\x6d\x61\x67\145\x20\x72\157\x74\141\164\151\x6f\x6e\x20\x69\163\x20\156\157\164\40\x73\x75\x70\x70\x6f\162\164\x65\x64\40\142\171\40\x79\x6f\165\x72\x20\167\x65\x62\40\150\157\x73\164\56") . "\x3c\x2f\145\x6d\x3e\x3c\57\x70\x3e"; ?>
<button type="button" class="imgedit-rleft button disabled" disabled></button>
<button type="button" class="imgedit-rright button disabled" disabled></button>
<?php } ?>
<hr />
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(1, <?php echo "{$post_id}\54\40\47{$nonce}\47"; ?>
, this)" onblur="imageEdit.monitorPopup()" class="imgedit-flipv button"><?php esc_html_e("\106\x6c\x69\x70\40\166\145\162\164\x69\143\141\154"); ?>
</button>
<button type="button" onkeyup="imageEdit.browsePopup(this)" onclick="imageEdit.flip(2, <?php echo "{$post_id}\54\x20\47{$nonce}\47"; ?>
, this)" onblur="imageEdit.monitorPopup()" class="imgedit-fliph button"><?php esc_html_e("\x46\154\x69\x70\40\150\x6f\162\151\x7a\157\156\164\x61\x6c"); ?>
</button>
<?php echo $note_no_rotate; ?>
</div>
</div>
</div>
<div class="imgedit-submit imgedit-menu">
<button type="button" id="image-undo-<?php echo $post_id; ?>
" onclick="imageEdit.undo(<?php echo "{$post_id}\54\40\x27{$nonce}\x27"; ?>
, this)" class="imgedit-undo button disabled" disabled><?php esc_html_e("\x55\156\x64\157"); ?>
</button>
<button type="button" id="image-redo-<?php echo $post_id; ?>
" onclick="imageEdit.redo(<?php echo "{$post_id}\54\40\x27{$nonce}\x27"; ?>
, this)" class="imgedit-redo button disabled" disabled><?php esc_html_e("\x52\x65\x64\157"); ?>
</button>
<button type="button" onclick="imageEdit.close(<?php echo $post_id; ?>
, 1)" class="button imgedit-cancel-btn"><?php esc_html_e("\x43\x61\156\x63\145\154\40\x45\144\x69\164\151\156\x67"); ?>
</button>
<button type="button" onclick="imageEdit.save(<?php echo "{$post_id}\54\x20\x27{$nonce}\x27"; ?>
)" disabled="disabled" class="button button-primary imgedit-submit-btn"><?php esc_html_e("\123\141\166\x65\x20\x45\x64\151\x74\x73"); ?>
</button>
</div>
</div>
<div class="imgedit-panel-content wp-clearfix">
<div class="imgedit-tools">
<input type="hidden" id="imgedit-nonce-<?php echo $post_id; ?>
" value="<?php echo $nonce; ?>
" />
<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>
" value="<?php echo $sizer; ?>
" />
<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>
" value="" />
<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>
" value="0" />
<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>
" value="" />
<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>
" value="<?php echo isset($meta["\167\151\144\164\x68"]) ? $meta["\167\151\144\x74\150"] : 0; ?>
" />
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>
" value="<?php echo isset($meta["\x68\145\151\x67\x68\x74"]) ? $meta["\150\145\151\147\150\x74"] : 0; ?>
" />
<div id="imgedit-crop-<?php echo $post_id; ?>
" class="imgedit-crop-wrap">
<div class="imgedit-crop-grid"></div>
<img id="image-preview-<?php echo $post_id; ?>
" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>
')"
src="<?php echo esc_url(admin_url("\141\x64\x6d\x69\x6e\x2d\141\x6a\x61\170\x2e\160\150\x70", "\162\x65\x6c\141\164\x69\166\145")) . "\x3f\141\x63\x74\151\x6f\156\75\x69\155\147\x65\x64\x69\164\x2d\x70\x72\145\x76\x69\145\167\46\141\x6d\x70\73\x5f\141\152\141\170\137\x6e\x6f\156\143\145\x3d" . $nonce . "\46\x61\155\160\73\160\157\163\164\x69\x64\x3d" . $post_id . "\x26\x61\155\160\73\x72\141\x6e\144\75" . rand(1, 99999); ?>
" alt="" />
</div>
</div>
<div class="imgedit-settings">
<div class="imgedit-tool-active">
<div class="imgedit-group">
<div id="imgedit-scale" tabindex="-1" class="imgedit-group-controls">
<div class="imgedit-group-top">
<h2><?php _e("\123\x63\x61\x6c\145\x20\111\x6d\141\x67\145"); ?>
</h2>
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
<?php esc_html_e("\123\143\x61\154\145\x20\x49\x6d\141\x67\145\40\110\145\x6c\160"); ?>
</span></button>
<div class="imgedit-help">
<p><?php _e("\131\157\165\40\x63\141\x6e\40\160\x72\157\160\157\162\164\151\157\156\x61\x6c\154\x79\40\x73\x63\141\154\x65\x20\164\x68\145\40\157\162\x69\147\x69\x6e\141\154\40\151\x6d\x61\x67\x65\x2e\x20\x46\x6f\162\40\x62\x65\163\164\40\x72\x65\163\x75\x6c\164\x73\54\40\163\143\141\x6c\x69\156\147\40\x73\150\157\165\x6c\x64\40\142\x65\x20\144\157\x6e\145\x20\x62\145\146\157\162\145\x20\x79\157\x75\x20\143\x72\x6f\x70\54\40\146\154\x69\x70\54\x20\x6f\x72\40\x72\x6f\164\141\x74\x65\x2e\40\111\155\141\x67\x65\x73\x20\143\x61\x6e\x20\157\156\x6c\171\40\142\x65\40\163\x63\141\154\145\144\40\x64\157\167\156\x2c\40\x6e\157\x74\40\x75\x70\x2e"); ?>
</p>
</div>
<?php if (isset($meta["\x77\151\144\164\x68"], $meta["\150\x65\151\147\150\164"])) { ?>
<p>
<?php printf(__("\117\162\151\147\151\x6e\x61\x6c\40\144\151\x6d\x65\x6e\x73\x69\x6f\156\163\x20\x25\x73"), "\74\163\x70\x61\x6e\x20\143\x6c\141\x73\x73\x3d\x22\x69\155\147\145\144\151\x74\x2d\x6f\x72\x69\147\151\156\x61\x6c\x2d\144\151\x6d\145\156\x73\x69\157\156\163\x22\x3e" . $meta["\167\151\x64\x74\150"] . "\x20\x26\164\151\155\x65\x73\73\x20" . $meta["\150\145\x69\x67\150\164"] . "\74\x2f\x73\x70\x61\156\76"); ?>
</p>
<?php } ?>
<div class="imgedit-submit">
<fieldset class="imgedit-scale-controls">
<legend><?php _e("\116\145\167\40\144\151\155\145\156\x73\x69\157\x6e\x73\72"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-scale-width-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\163\143\141\154\145\40\150\145\151\x67\150\164"); ?>
</label>
<input type="number" step="1" min="0" max="<?php echo isset($meta["\x77\151\144\164\x68"]) ? $meta["\x77\151\144\x74\150"] : ''; ?>
" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>
" id="imgedit-scale-width-<?php echo $post_id; ?>
" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 1, this)" value="<?php echo isset($meta["\167\151\x64\164\x68"]) ? $meta["\x77\x69\x64\164\x68"] : 0; ?>
" />
<span class="imgedit-separator" aria-hidden="true">×</span>
<label for="imgedit-scale-height-<?php echo $post_id; ?>
" class="screen-reader-text"><?php _e("\163\x63\x61\154\145\40\150\x65\x69\147\150\x74"); ?>
</label>
<input type="number" step="1" min="0" max="<?php echo isset($meta["\x68\145\151\x67\x68\164"]) ? $meta["\x68\x65\151\x67\150\164"] : ''; ?>
" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>
" id="imgedit-scale-height-<?php echo $post_id; ?>
" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>
, 0, this)" value="<?php echo isset($meta["\150\145\151\147\x68\x74"]) ? $meta["\x68\145\x69\147\x68\164"] : 0; ?>
" />
<button id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "{$post_id}\54\x20\x27{$nonce}\x27"; ?>
, 'scale')" class="button button-primary"><?php esc_html_e("\123\x63\x61\154\145"); ?>
</button>
<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>
"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e("\111\x6d\x61\147\x65\163\40\x63\x61\x6e\x6e\x6f\164\x20\142\145\40\x73\x63\x61\154\x65\x64\x20\x74\x6f\40\141\40\x73\x69\172\145\x20\x6c\141\x72\x67\x65\162\x20\164\150\x61\x6e\40\164\x68\145\40\x6f\x72\151\x67\x69\x6e\141\154\x2e"); ?>
</span>
</div>
</fieldset>
</div>
</div>
</div>
</div>
<?php if ($can_restore) { ?>
<div class="imgedit-group">
<div class="imgedit-group-top">
<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link" aria-expanded="false"><?php _e("\x52\145\x73\164\x6f\162\145\40\157\x72\151\147\151\x6e\x61\154\40\151\155\141\147\x65"); ?>
<span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
<div class="imgedit-help imgedit-restore">
<p>
<?php _e("\104\x69\163\143\x61\162\x64\40\x61\x6e\x79\40\143\150\x61\x6e\147\145\x73\40\141\x6e\144\x20\162\145\x73\x74\x6f\162\145\x20\164\x68\145\40\157\162\151\x67\151\x6e\x61\x6c\40\151\x6d\141\x67\x65\x2e"); if (!defined("\x49\x4d\101\107\x45\x5f\x45\x44\x49\x54\137\x4f\126\x45\x52\127\122\x49\124\x45") || !IMAGE_EDIT_OVERWRITE) { echo "\x20" . __("\120\x72\x65\x76\151\x6f\165\x73\154\x79\40\x65\144\151\x74\145\144\x20\x63\x6f\x70\x69\x65\x73\x20\157\146\40\164\150\145\40\x69\155\141\x67\145\x20\x77\151\x6c\x6c\40\x6e\x6f\164\40\142\145\40\x64\x65\x6c\x65\164\145\144\x2e"); } ?>
</p>
<div class="imgedit-submit">
<input type="button" onclick="imageEdit.action(<?php echo "{$post_id}\54\40\47{$nonce}\x27"; ?>
, 'restore')" class="button button-primary" value="<?php esc_attr_e("\122\x65\x73\164\157\x72\x65\x20\151\155\141\x67\145"); ?>
" <?php echo $can_restore; ?>
/>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="imgedit-group">
<div id="imgedit-crop" tabindex="-1" class="imgedit-group-controls">
<div class="imgedit-group-top">
<h2><?php _e("\103\162\157\160\x20\x49\155\141\x67\145"); ?>
</h2>
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
<?php _e("\111\x6d\x61\x67\x65\40\103\162\x6f\x70\40\110\145\154\160"); ?>
</span></button>
<div class="imgedit-help">
<p><?php _e("\x54\157\x20\143\x72\x6f\160\40\x74\x68\x65\x20\x69\x6d\141\x67\145\54\x20\143\x6c\x69\143\x6b\40\157\x6e\x20\151\164\40\x61\156\144\x20\x64\162\x61\147\40\x74\157\40\155\141\x6b\x65\x20\x79\x6f\165\x72\40\163\x65\x6c\x65\x63\164\x69\x6f\156\x2e"); ?>
</p>
<p><strong><?php _e("\x43\162\157\160\40\101\163\160\x65\143\x74\40\122\141\x74\x69\x6f"); ?>
</strong><br />
<?php _e("\124\x68\x65\x20\x61\x73\160\x65\x63\164\x20\162\x61\x74\x69\157\x20\x69\x73\x20\x74\150\145\x20\x72\x65\154\141\x74\x69\157\x6e\163\150\x69\160\x20\x62\145\164\x77\x65\145\x6e\40\x74\150\145\40\167\x69\144\x74\150\40\x61\x6e\144\x20\x68\145\151\147\150\164\x2e\40\x59\x6f\x75\40\x63\x61\x6e\x20\x70\x72\x65\x73\145\x72\x76\x65\40\x74\150\145\x20\x61\163\x70\145\143\164\x20\162\x61\x74\151\157\x20\142\171\40\150\157\x6c\144\x69\x6e\147\40\x64\x6f\167\x6e\40\x74\150\145\40\x73\150\151\x66\x74\x20\x6b\x65\x79\40\167\x68\151\154\x65\40\162\145\163\151\x7a\151\x6e\147\x20\171\x6f\165\x72\x20\163\x65\x6c\145\x63\x74\x69\x6f\156\x2e\x20\x55\163\x65\40\x74\x68\x65\40\151\156\x70\165\164\40\142\157\x78\x20\164\x6f\40\163\160\145\143\x69\x66\171\x20\x74\x68\x65\40\x61\163\160\145\143\164\40\162\141\x74\151\x6f\x2c\40\145\56\x67\x2e\x20\61\x3a\61\40\50\163\161\x75\x61\x72\145\51\x2c\x20\x34\72\63\54\40\61\x36\72\71\54\40\x65\164\x63\56"); ?>
</p>
<p><strong><?php _e("\103\x72\x6f\x70\40\123\x65\154\145\143\x74\151\157\156"); ?>
</strong><br />
<?php _e("\117\156\x63\x65\40\x79\157\x75\40\x68\x61\x76\x65\x20\155\141\x64\145\40\171\x6f\x75\x72\x20\163\145\154\x65\143\164\x69\x6f\x6e\x2c\x20\171\157\165\40\x63\x61\156\x20\x61\144\152\x75\x73\164\40\151\164\40\x62\171\40\145\156\164\145\162\x69\156\147\x20\164\150\x65\40\x73\151\172\145\40\151\x6e\40\x70\151\170\145\x6c\163\x2e\40\124\150\x65\x20\155\151\156\151\x6d\165\x6d\40\163\145\x6c\x65\x63\164\x69\157\156\40\163\151\x7a\145\x20\x69\163\x20\164\150\x65\40\164\x68\165\x6d\142\156\141\151\154\40\163\x69\172\145\40\141\x73\x20\x73\145\x74\40\151\156\40\164\x68\145\x20\x4d\x65\144\151\141\40\163\145\x74\x74\151\x6e\147\x73\56"); ?>
</p>
</div>
</div>
<fieldset class="imgedit-crop-ratio">
<legend><?php _e("\101\163\x70\x65\143\x74\40\162\x61\x74\x69\x6f\x3a"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-crop-width-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\x63\162\157\x70\x20\162\x61\x74\x69\x6f\40\167\x69\x64\164\x68"); ?>
</label>
<input type="number" step="1" min="1" id="imgedit-crop-width-<?php echo $post_id; ?>
" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 0, this)" />
<span class="imgedit-separator" aria-hidden="true">:</span>
<label for="imgedit-crop-height-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\x63\162\x6f\x70\x20\x72\141\164\151\157\x20\150\x65\x69\x67\150\164"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-crop-height-<?php echo $post_id; ?>
" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>
, 1, this)" />
</div>
</fieldset>
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>
" class="imgedit-crop-sel">
<legend><?php _e("\x53\x65\x6c\145\x63\x74\x69\157\x6e\72"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-sel-width-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\x73\x65\154\x65\143\164\x69\x6f\x6e\x20\x77\151\x64\x74\x68"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-sel-width-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" />
<span class="imgedit-separator" aria-hidden="true">×</span>
<label for="imgedit-sel-height-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\x73\145\154\x65\x63\164\151\x6f\x6e\x20\150\145\x69\x67\x68\x74"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-sel-height-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" />
</div>
</fieldset>
<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>
" class="imgedit-crop-sel">
<legend><?php _e("\123\164\141\162\x74\151\x6e\x67\x20\103\157\x6f\x72\144\x69\156\x61\x74\145\163\x3a"); ?>
</legend>
<div class="nowrap">
<label for="imgedit-start-x-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\x68\157\x72\x69\172\x6f\x6e\x74\x61\154\40\x73\164\x61\x72\164\40\160\157\x73\x69\x74\151\157\x6e"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-start-x-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" value="0" />
<span class="imgedit-separator" aria-hidden="true">×</span>
<label for="imgedit-start-y-<?php echo $post_id; ?>
" class="screen-reader-text">
<?php _e("\166\x65\162\x74\151\x63\x61\154\x20\163\164\x61\x72\x74\x20\x70\x6f\x73\x69\x74\x69\x6f\156"); ?>
</label>
<input type="number" step="1" min="0" id="imgedit-start-y-<?php echo $post_id; ?>
" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>
, this)" value="0" />
</div>
</fieldset>
<div class="imgedit-crop-apply imgedit-menu container">
<button class="button-primary" type="button" onclick="imageEdit.handleCropToolClick( <?php echo "{$post_id}\54\40\47{$nonce}\47"; ?>
, this );" class="imgedit-crop-apply button"><?php esc_html_e("\x41\x70\x70\x6c\x79\40\103\x72\157\x70"); ?>
</button> <button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "{$post_id}\x2c\x20\47{$nonce}\x27"; ?>
, this );" class="imgedit-crop-clear button" disabled="disabled"><?php esc_html_e("\x43\x6c\145\x61\162\x20\x43\162\157\160"); ?>
</button>
</div>
</div>
</div>
</div>
<?php if ($edit_thumbnails_separately && $thumb && $sub_sizes) { $thumb_img = wp_constrain_dimensions($thumb["\167\151\x64\164\150"], $thumb["\x68\x65\x69\147\x68\164"], 160, 120); ?>
<div class="imgedit-group imgedit-applyto">
<div class="imgedit-group-top">
<h2><?php _e("\x54\x68\x75\155\142\x6e\141\151\x6c\40\x53\145\x74\x74\x69\x6e\x67\x73"); ?>
</h2>
<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">
<?php esc_html_e("\124\150\165\155\142\x6e\141\x69\154\x20\x53\145\164\x74\x69\x6e\147\163\40\110\x65\154\160"); ?>
</span></button>
<div class="imgedit-help">
<p><?php _e("\131\x6f\165\40\x63\x61\x6e\x20\145\x64\x69\x74\40\164\x68\x65\x20\151\x6d\141\147\x65\x20\167\x68\x69\x6c\145\x20\x70\x72\145\x73\145\162\166\x69\156\x67\40\x74\x68\145\x20\x74\x68\x75\x6d\x62\x6e\141\151\x6c\56\x20\x46\157\x72\40\145\170\141\x6d\x70\x6c\145\x2c\40\171\x6f\165\x20\x6d\141\171\40\167\x69\x73\x68\40\164\x6f\x20\150\x61\166\145\x20\x61\40\163\x71\x75\141\162\145\x20\x74\150\x75\x6d\x62\x6e\x61\151\154\x20\x74\150\x61\164\40\x64\x69\x73\160\154\x61\x79\163\40\x6a\165\163\x74\x20\x61\40\x73\145\x63\x74\151\x6f\156\x20\x6f\146\x20\x74\x68\x65\x20\x69\155\141\x67\x65\x2e"); ?>
</p>
</div>
</div>
<div class="imgedit-thumbnail-preview-group">
<figure class="imgedit-thumbnail-preview">
<img src="<?php echo $thumb["\x75\x72\x6c"]; ?>
" width="<?php echo $thumb_img[0]; ?>
" height="<?php echo $thumb_img[1]; ?>
" class="imgedit-size-preview" alt="" draggable="false" />
<figcaption class="imgedit-thumbnail-preview-caption"><?php _e("\103\x75\162\162\x65\x6e\164\x20\x74\150\x75\155\x62\x6e\x61\151\154"); ?>
</figcaption>
</figure>
<div id="imgedit-save-target-<?php echo $post_id; ?>
" class="imgedit-save-target">
<fieldset>
<legend><?php _e("\101\160\x70\154\x79\x20\x63\150\141\156\147\145\x73\x20\164\157\72"); ?>
</legend>
<span class="imgedit-label">
<input type="radio" id="imgedit-target-all" name="imgedit-target-<?php echo $post_id; ?>
" value="all" checked="checked" />
<label for="imgedit-target-all"><?php _e("\x41\x6c\154\40\x69\155\x61\147\145\x20\x73\151\x7a\145\x73"); ?>
</label>
</span>
<span class="imgedit-label">
<input type="radio" id="imgedit-target-thumbnail" name="imgedit-target-<?php echo $post_id; ?>
" value="thumbnail" />
<label for="imgedit-target-thumbnail"><?php _e("\124\150\165\155\x62\x6e\x61\151\x6c"); ?>
</label>
</span>
<span class="imgedit-label">
<input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>
" value="nothumb" />
<label for="imgedit-target-nothumb"><?php _e("\x41\154\x6c\40\x73\x69\x7a\145\x73\x20\x65\x78\143\145\x70\x74\x20\x74\150\165\x6d\x62\156\141\151\x6c"); ?>
</label>
</span>
</fieldset>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>
"></div>
<div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>
"><?php _e("\x54\x68\x65\x72\x65\40\141\x72\x65\x20\165\x6e\163\x61\166\145\x64\40\143\x68\141\156\147\145\163\40\164\x68\x61\x74\40\x77\x69\x6c\x6c\40\142\145\x20\154\x6f\163\x74\56\x20\x27\117\x4b\47\x20\x74\x6f\x20\143\157\156\164\151\156\x75\145\54\40\47\103\141\x6e\143\145\154\47\40\x74\157\40\x72\145\x74\165\162\156\x20\x74\157\x20\x74\150\x65\40\x49\155\x61\147\x65\40\x45\x64\x69\x74\157\162\56"); ?>
</div>
</div>
<?php } goto HDf67; fpopb: function wp_save_image_file($filename, $image, $mime_type, $post_id) { if ($image instanceof WP_Image_Editor) { $image = apply_filters("\x69\x6d\x61\147\x65\137\145\x64\151\164\x6f\x72\137\163\x61\166\x65\137\x70\x72\x65", $image, $post_id); $saved = apply_filters("\x77\x70\137\x73\141\166\145\137\151\x6d\141\x67\x65\x5f\145\144\x69\164\x6f\x72\137\146\x69\154\x65", null, $filename, $image, $mime_type, $post_id); if (null !== $saved) { return $saved; } return $image->save($filename, $mime_type); } else { _deprecated_argument(__FUNCTION__, "\63\56\65\x2e\60", sprintf(__("\45\x31\44\163\40\x6e\145\x65\x64\163\40\x74\x6f\40\x62\145\x20\141\x20\x25\x32\44\163\40\x6f\x62\152\x65\x63\164\56"), "\44\x69\155\x61\147\145", "\127\x50\x5f\x49\155\x61\147\145\x5f\x45\144\151\164\x6f\162")); $image = apply_filters_deprecated("\x69\x6d\x61\147\145\x5f\x73\x61\x76\x65\x5f\160\x72\x65", array($image, $post_id), "\x33\x2e\x35\x2e\x30", "\x69\155\141\x67\145\137\145\x64\x69\x74\157\162\x5f\x73\x61\x76\145\137\x70\162\145"); $saved = apply_filters_deprecated("\x77\160\x5f\x73\141\x76\x65\x5f\151\155\141\147\x65\x5f\146\x69\154\x65", array(null, $filename, $image, $mime_type, $post_id), "\x33\x2e\x35\x2e\x30", "\167\x70\x5f\163\x61\166\145\137\x69\155\141\x67\x65\x5f\145\144\x69\x74\157\x72\137\x66\151\x6c\x65"); if (null !== $saved) { return $saved; } switch ($mime_type) { case "\151\155\141\147\145\57\x6a\x70\x65\147": return imagejpeg($image, $filename, apply_filters("\x6a\x70\145\147\137\161\165\141\x6c\x69\164\x79", 90, "\x65\x64\x69\164\x5f\151\x6d\x61\x67\145")); case "\151\155\x61\147\x65\57\160\156\147": return imagepng($image, $filename); case "\151\155\x61\147\145\57\147\x69\x66": return imagegif($image, $filename); case "\x69\x6d\141\147\x65\57\x77\x65\x62\160": if (function_exists("\151\155\141\x67\145\x77\x65\142\160")) { return imagewebp($image, $filename); } return false; case "\151\x6d\141\x67\145\x2f\x61\x76\x69\146": if (function_exists("\151\155\x61\x67\x65\x61\x76\151\146")) { return imageavif($image, $filename); } return false; default: return false; } } } goto oXEn8; oXEn8: function _image_get_preview_ratio($w, $h) { $max = max($w, $h); return $max > 600 ? 600 / $max : 1; } goto vOrs5; HDf67: function wp_stream_image($image, $mime_type, $attachment_id) { if ($image instanceof WP_Image_Editor) { $image = apply_filters("\151\x6d\141\x67\x65\137\x65\144\x69\164\x6f\x72\137\x73\141\166\145\137\x70\x72\145", $image, $attachment_id); if (is_wp_error($image->stream($mime_type))) { return false; } return true; } else { _deprecated_argument(__FUNCTION__, "\63\56\x35\56\x30", sprintf(__("\x25\x31\44\163\40\156\145\x65\144\x73\x20\164\157\40\x62\145\40\141\x20\45\62\44\163\40\157\142\152\145\143\x74\56"), "\x24\x69\x6d\x61\147\145", "\x57\x50\x5f\111\155\x61\147\145\x5f\x45\144\151\x74\x6f\162")); $image = apply_filters_deprecated("\151\x6d\x61\x67\x65\x5f\163\141\x76\145\x5f\160\x72\145", array($image, $attachment_id), "\x33\x2e\x35\56\x30", "\151\x6d\x61\x67\x65\137\145\x64\151\164\x6f\x72\137\x73\141\x76\145\x5f\x70\162\145"); switch ($mime_type) { case "\151\x6d\x61\x67\145\57\x6a\x70\145\x67": header("\x43\157\x6e\x74\145\156\x74\55\124\171\x70\145\x3a\40\x69\x6d\141\x67\145\57\152\160\145\x67"); return imagejpeg($image, null, 90); case "\151\155\x61\x67\x65\57\x70\x6e\x67": header("\103\x6f\x6e\164\x65\x6e\164\55\124\x79\x70\x65\x3a\40\x69\155\x61\147\145\57\160\x6e\x67"); return imagepng($image); case "\151\x6d\141\x67\x65\57\x67\x69\x66": header("\103\157\x6e\164\145\x6e\x74\55\124\x79\x70\145\x3a\x20\x69\x6d\141\147\x65\x2f\x67\151\146"); return imagegif($image); case "\x69\155\141\147\145\x2f\x77\145\x62\x70": if (function_exists("\x69\x6d\141\x67\x65\x77\x65\142\160")) { header("\x43\x6f\x6e\x74\x65\x6e\x74\55\x54\x79\160\145\x3a\x20\x69\x6d\141\x67\145\x2f\167\x65\142\160"); return imagewebp($image, null, 90); } return false; case "\x69\x6d\x61\x67\x65\57\x61\166\x69\146": if (function_exists("\x69\x6d\141\x67\145\x61\166\151\146")) { header("\x43\x6f\156\164\145\156\x74\x2d\124\171\x70\145\x3a\40\x69\155\141\147\x65\57\141\166\x69\x66"); return imageavif($image, null, 90); } return false; default: return false; } } } goto fpopb; gpxxW: function wp_restore_image($post_id) { $meta = wp_get_attachment_metadata($post_id); $file = get_attached_file($post_id); $backup_sizes = get_post_meta($post_id, "\x5f\x77\x70\x5f\141\164\164\x61\x63\150\155\145\x6e\x74\137\x62\x61\x63\x6b\165\160\137\163\x69\172\145\163", true); $old_backup_sizes = $backup_sizes; $restored = false; $msg = new stdClass(); if (!is_array($backup_sizes)) { $msg->error = __("\103\x61\x6e\x6e\157\164\x20\x6c\x6f\141\x64\x20\151\155\141\x67\x65\40\155\145\164\141\x64\141\x74\141\56"); return $msg; } $parts = pathinfo($file); $suffix = time() . rand(100, 999); $default_sizes = get_intermediate_image_sizes(); if (isset($backup_sizes["\146\165\x6c\154\x2d\157\x72\151\147"]) && is_array($backup_sizes["\x66\x75\x6c\154\55\157\x72\151\x67"])) { $data = $backup_sizes["\146\165\x6c\154\55\x6f\x72\151\x67"]; if ($parts["\142\x61\163\x65\x6e\x61\155\x65"] !== $data["\x66\151\154\145"]) { if (defined("\x49\115\101\x47\x45\x5f\x45\104\111\x54\137\x4f\126\x45\122\127\122\x49\x54\105") && IMAGE_EDIT_OVERWRITE) { if (preg_match("\57\x2d\145\x5b\x30\x2d\71\x5d\x7b\x31\63\x7d\134\56\x2f", $parts["\142\x61\163\x65\x6e\x61\155\145"])) { wp_delete_file($file); } } elseif (isset($meta["\167\151\144\164\150"], $meta["\150\145\x69\147\x68\164"])) { $backup_sizes["\x66\x75\x6c\154\x2d{$suffix}"] = array("\167\x69\144\x74\x68" => $meta["\x77\x69\144\x74\x68"], "\150\145\151\x67\x68\164" => $meta["\150\145\x69\x67\x68\164"], "\146\x69\x6c\x65" => $parts["\142\x61\163\145\x6e\141\155\145"]); } } $restored_file = path_join($parts["\144\151\x72\x6e\141\x6d\145"], $data["\146\151\154\x65"]); $restored = update_attached_file($post_id, $restored_file); $meta["\146\151\x6c\145"] = _wp_relative_upload_path($restored_file); $meta["\x77\x69\144\164\x68"] = $data["\x77\151\x64\x74\x68"]; $meta["\x68\145\x69\x67\x68\164"] = $data["\x68\x65\151\147\150\x74"]; } foreach ($default_sizes as $default_size) { if (isset($backup_sizes["{$default_size}\55\x6f\162\151\x67"])) { $data = $backup_sizes["{$default_size}\x2d\157\x72\x69\x67"]; if (isset($meta["\x73\x69\x7a\145\x73"][$default_size]) && $meta["\x73\151\172\x65\163"][$default_size]["\146\151\x6c\145"] !== $data["\146\151\x6c\x65"]) { if (defined("\x49\x4d\x41\107\x45\137\x45\104\x49\124\137\x4f\x56\105\x52\x57\122\111\124\x45") && IMAGE_EDIT_OVERWRITE) { if (preg_match("\57\x2d\145\x5b\x30\x2d\x39\x5d\173\x31\x33\175\x2d\x2f", $meta["\163\x69\x7a\145\163"][$default_size]["\x66\x69\154\145"])) { $delete_file = path_join($parts["\144\x69\162\x6e\x61\155\x65"], $meta["\x73\151\x7a\145\x73"][$default_size]["\146\x69\154\145"]); wp_delete_file($delete_file); } } else { $backup_sizes["{$default_size}\55{$suffix}"] = $meta["\163\x69\172\145\x73"][$default_size]; } } $meta["\x73\x69\x7a\145\x73"][$default_size] = $data; } else { unset($meta["\x73\x69\172\145\163"][$default_size]); } } if (!wp_update_attachment_metadata($post_id, $meta) || $old_backup_sizes !== $backup_sizes && !update_post_meta($post_id, "\137\x77\x70\137\x61\164\164\x61\143\x68\x6d\145\156\164\137\x62\x61\143\x6b\165\160\x5f\x73\x69\172\145\163", $backup_sizes)) { $msg->error = __("\103\x61\156\156\x6f\x74\x20\163\x61\x76\x65\x20\x69\155\x61\147\145\40\155\x65\164\x61\x64\x61\x74\141\56"); return $msg; } if (!$restored) { $msg->error = __("\x49\x6d\141\147\145\40\155\x65\164\x61\x64\141\164\141\40\151\x73\x20\151\156\143\x6f\x6e\163\151\x73\x74\x65\x6e\164\x2e"); } else { $msg->msg = __("\x49\155\141\x67\145\x20\x72\145\163\x74\157\x72\x65\144\x20\x73\165\143\143\145\x73\163\146\x75\154\154\x79\x2e"); if (defined("\111\115\x41\107\x45\x5f\105\x44\111\x54\x5f\117\126\105\x52\127\x52\x49\124\105") && IMAGE_EDIT_OVERWRITE) { delete_post_meta($post_id, "\x5f\x77\160\137\x61\164\x74\x61\143\x68\155\145\156\x74\x5f\x62\141\143\x6b\x75\160\137\x73\151\x7a\145\163"); } } return $msg; } goto PX0IT; vOrs5: function _rotate_image_resource($img, $angle) { _deprecated_function(__FUNCTION__, "\63\x2e\x35\x2e\x30", "\x57\x50\137\111\x6d\x61\x67\145\x5f\x45\x64\x69\164\157\x72\x3a\72\162\x6f\164\141\164\145\50\51"); if (function_exists("\x69\x6d\x61\147\x65\x72\157\x74\x61\164\145")) { $rotated = imagerotate($img, $angle, 0); if (is_gd_image($rotated)) { imagedestroy($img); $img = $rotated; } } return $img; } goto vJqZj; WnAor: function stream_preview_image($post_id) { $post = get_post($post_id); wp_raise_memory_limit("\141\x64\155\151\156"); $img = wp_get_image_editor(_load_image_to_edit_path($post_id)); if (is_wp_error($img)) { return false; } $changes = !empty($_REQUEST["\150\151\163\164\157\x72\x79"]) ? json_decode(wp_unslash($_REQUEST["\x68\x69\163\164\157\162\171"])) : null; if ($changes) { $img = image_edit_apply_changes($img, $changes); } $size = $img->get_size(); $w = $size["\x77\151\x64\x74\150"]; $h = $size["\150\145\x69\147\x68\164"]; $ratio = _image_get_preview_ratio($w, $h); $w2 = max(1, $w * $ratio); $h2 = max(1, $h * $ratio); if (is_wp_error($img->resize($w2, $h2))) { return false; } return wp_stream_image($img, $post->post_mime_type, $post_id); } goto gpxxW; oxKcd: function _crop_image_resource($img, $x, $y, $w, $h) { $dst = wp_imagecreatetruecolor($w, $h); if (is_gd_image($dst)) { if (imagecopy($dst, $img, 0, 0, $x, $y, $w, $h)) { imagedestroy($img); $img = $dst; } } return $img; } goto lOr5g; lOr5g: function image_edit_apply_changes($image, $changes) { if (is_gd_image($image)) { _deprecated_argument(__FUNCTION__, "\x33\56\65\56\60", sprintf(__("\x25\x31\x24\163\x20\156\145\x65\144\x73\x20\164\157\x20\142\145\x20\141\40\45\62\x24\163\40\157\142\x6a\x65\143\x74\x2e"), "\44\x69\x6d\141\147\x65", "\x57\120\137\111\155\141\147\x65\137\105\144\151\164\x6f\x72")); } if (!is_array($changes)) { return $image; } foreach ($changes as $key => $obj) { if (isset($obj->r)) { $obj->type = "\162\157\164\x61\x74\x65"; $obj->angle = $obj->r; unset($obj->r); } elseif (isset($obj->f)) { $obj->type = "\x66\154\151\160"; $obj->axis = $obj->f; unset($obj->f); } elseif (isset($obj->c)) { $obj->type = "\143\x72\157\160"; $obj->sel = $obj->c; unset($obj->c); } $changes[$key] = $obj; } if (count($changes) > 1) { $filtered = array($changes[0]); for ($i = 0, $j = 1, $c = count($changes); $j < $c; $j++) { $combined = false; if ($filtered[$i]->type === $changes[$j]->type) { switch ($filtered[$i]->type) { case "\162\x6f\164\x61\164\x65": $filtered[$i]->angle += $changes[$j]->angle; $combined = true; break; case "\146\x6c\x69\160": $filtered[$i]->axis ^= $changes[$j]->axis; $combined = true; break; } } if (!$combined) { $filtered[++$i] = $changes[$j]; } } $changes = $filtered; unset($filtered); } if ($image instanceof WP_Image_Editor) { $image = apply_filters("\167\x70\137\151\155\141\147\x65\137\145\x64\151\x74\157\162\137\142\x65\146\x6f\162\x65\137\143\150\141\x6e\x67\x65", $image, $changes); } elseif (is_gd_image($image)) { $image = apply_filters_deprecated("\151\x6d\141\x67\145\x5f\145\144\151\x74\x5f\142\x65\146\x6f\162\145\x5f\143\150\141\x6e\x67\145", array($image, $changes), "\x33\56\x35\x2e\60", "\x77\x70\x5f\151\x6d\x61\147\145\x5f\145\x64\151\x74\157\162\137\x62\145\146\157\162\x65\x5f\143\150\x61\156\x67\145"); } foreach ($changes as $operation) { switch ($operation->type) { case "\x72\x6f\164\x61\164\145": if (0 !== $operation->angle) { if ($image instanceof WP_Image_Editor) { $image->rotate($operation->angle); } else { $image = _rotate_image_resource($image, $operation->angle); } } break; case "\x66\x6c\x69\x70": if (0 !== $operation->axis) { if ($image instanceof WP_Image_Editor) { $image->flip(($operation->axis & 1) !== 0, ($operation->axis & 2) !== 0); } else { $image = _flip_image_resource($image, ($operation->axis & 1) !== 0, ($operation->axis & 2) !== 0); } } break; case "\143\x72\x6f\x70": $sel = $operation->sel; if ($image instanceof WP_Image_Editor) { $size = $image->get_size(); $w = $size["\167\x69\144\164\x68"]; $h = $size["\150\x65\151\x67\x68\x74"]; $scale = 1 / _image_get_preview_ratio($w, $h); $image->crop($sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale); } else { $scale = 1 / _image_get_preview_ratio(imagesx($image), imagesy($image)); $image = _crop_image_resource($image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale); } break; } } return $image; } goto WnAor; vJqZj: function _flip_image_resource($img, $horz, $vert) { _deprecated_function(__FUNCTION__, "\63\x2e\65\56\60", "\x57\x50\137\x49\155\141\147\145\x5f\105\144\151\164\x6f\162\x3a\x3a\x66\x6c\x69\160\50\x29"); $w = imagesx($img); $h = imagesy($img); $dst = wp_imagecreatetruecolor($w, $h); if (is_gd_image($dst)) { $sx = $vert ? $w - 1 : 0; $sy = $horz ? $h - 1 : 0; $sw = $vert ? -$w : $w; $sh = $horz ? -$h : $h; if (imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh)) { imagedestroy($img); $img = $dst; } } return $img; } goto oxKcd; PX0IT: function wp_save_image($post_id) { $_wp_additional_image_sizes = wp_get_additional_image_sizes(); $return = new stdClass(); $success = false; $delete = false; $scaled = false; $nocrop = false; $post = get_post($post_id); $img = wp_get_image_editor(_load_image_to_edit_path($post_id, "\x66\165\154\154")); if (is_wp_error($img)) { $return->error = esc_js(__("\x55\156\141\x62\154\145\40\x74\x6f\40\x63\x72\145\141\x74\145\x20\x6e\145\167\x20\x69\x6d\x61\147\145\56")); return $return; } $full_width = !empty($_REQUEST["\146\167\151\x64\164\150"]) ? (int) $_REQUEST["\146\167\x69\144\164\150"] : 0; $full_height = !empty($_REQUEST["\x66\150\x65\x69\147\x68\164"]) ? (int) $_REQUEST["\146\150\x65\x69\x67\x68\164"] : 0; $target = !empty($_REQUEST["\164\x61\x72\147\145\x74"]) ? preg_replace("\x2f\x5b\x5e\x61\55\x7a\x30\55\x39\x5f\55\135\53\57\x69", '', $_REQUEST["\x74\x61\162\147\x65\164"]) : ''; $scale = !empty($_REQUEST["\x64\157"]) && "\x73\143\x61\154\145" === $_REQUEST["\144\x6f"]; $edit_thumbnails_separately = (bool) apply_filters("\151\155\x61\147\145\137\145\144\x69\x74\137\164\x68\165\x6d\142\156\x61\151\154\x73\137\163\145\x70\x61\162\x61\164\145\154\x79", false); if ($scale) { $size = $img->get_size(); $original_width = $size["\x77\x69\144\164\x68"]; $original_height = $size["\x68\145\151\147\150\164"]; if ($full_width > $original_width || $full_height > $original_height) { $return->error = esc_js(__("\111\155\x61\x67\x65\x73\40\143\x61\156\x6e\157\x74\40\142\145\x20\163\143\x61\x6c\x65\x64\x20\164\157\40\141\x20\x73\151\x7a\x65\x20\154\x61\x72\x67\145\x72\40\164\x68\x61\156\40\x74\x68\x65\x20\x6f\162\151\147\151\x6e\x61\154\x2e")); return $return; } if ($full_width > 0 && $full_height > 0) { $diff = round($original_width / $original_height, 2) - round($full_width / $full_height, 2); if (-0.1 < $diff && $diff < 0.1) { if ($img->resize($full_width, $full_height)) { $scaled = true; } } if (!$scaled) { $return->error = esc_js(__("\105\x72\x72\x6f\162\40\x77\150\151\154\145\x20\163\141\x76\x69\x6e\x67\40\164\150\145\x20\x73\x63\x61\x6c\145\144\40\x69\x6d\141\x67\x65\x2e\x20\x50\x6c\x65\x61\163\145\40\x72\x65\x6c\x6f\x61\144\x20\164\150\x65\x20\x70\141\147\x65\40\141\156\144\40\164\x72\171\40\x61\x67\141\151\x6e\x2e")); return $return; } } } elseif (!empty($_REQUEST["\x68\151\x73\x74\x6f\162\171"])) { $changes = json_decode(wp_unslash($_REQUEST["\x68\x69\x73\x74\157\162\x79"])); if ($changes) { $img = image_edit_apply_changes($img, $changes); } } else { $return->error = esc_js(__("\116\157\x74\x68\x69\x6e\147\x20\x74\x6f\x20\x73\141\x76\x65\x2c\x20\x74\150\x65\x20\151\x6d\x61\147\145\x20\150\141\x73\x20\156\x6f\164\40\143\x68\141\x6e\147\x65\x64\x2e")); return $return; } $meta = wp_get_attachment_metadata($post_id); $backup_sizes = get_post_meta($post->ID, "\x5f\167\160\137\x61\164\164\141\143\150\155\x65\156\164\137\x62\x61\143\153\165\160\137\163\x69\x7a\145\163", true); if (!is_array($meta)) { $return->error = esc_js(__("\x49\x6d\141\x67\x65\40\x64\x61\x74\x61\40\x64\x6f\x65\x73\x20\x6e\x6f\x74\40\145\170\x69\x73\x74\56\x20\x50\154\x65\141\163\x65\40\162\145\55\165\160\x6c\157\x61\144\x20\x74\150\x65\40\x69\155\x61\147\x65\x2e")); return $return; } if (!is_array($backup_sizes)) { $backup_sizes = array(); } $path = get_attached_file($post_id); $basename = pathinfo($path, PATHINFO_BASENAME); $dirname = pathinfo($path, PATHINFO_DIRNAME); $ext = pathinfo($path, PATHINFO_EXTENSION); $filename = pathinfo($path, PATHINFO_FILENAME); $suffix = time() . rand(100, 999); if (defined("\111\x4d\x41\107\105\137\105\x44\x49\x54\x5f\117\x56\x45\122\x57\122\111\124\105") && IMAGE_EDIT_OVERWRITE && isset($backup_sizes["\146\x75\154\154\x2d\157\x72\x69\147"]) && $backup_sizes["\146\x75\154\154\55\157\162\x69\147"]["\146\x69\x6c\145"] !== $basename) { if ($edit_thumbnails_separately && "\164\150\165\x6d\142\x6e\x61\151\x6c" === $target) { $new_path = "{$dirname}\57{$filename}\55\x74\145\155\x70\56{$ext}"; } else { $new_path = $path; } } else { while (true) { $filename = preg_replace("\57\x2d\145\x28\x5b\x30\x2d\71\x5d\53\51\44\x2f", '', $filename); $filename .= "\55\145{$suffix}"; $new_filename = "{$filename}\56{$ext}"; $new_path = "{$dirname}\x2f{$new_filename}"; if (file_exists($new_path)) { ++$suffix; } else { break; } } } if (!wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id)) { $return->error = esc_js(__("\x55\156\141\x62\154\x65\x20\x74\x6f\40\x73\141\166\145\x20\164\150\x65\40\x69\155\x61\x67\145\56")); return $return; } if ("\x6e\x6f\164\150\165\x6d\142" === $target || "\141\154\154" === $target || "\x66\165\x6c\x6c" === $target || $scaled) { $tag = false; if (isset($backup_sizes["\146\x75\154\x6c\55\x6f\162\x69\147"])) { if ((!defined("\x49\x4d\x41\x47\x45\x5f\105\104\x49\124\x5f\117\126\105\x52\127\x52\x49\124\105") || !IMAGE_EDIT_OVERWRITE) && $backup_sizes["\146\165\154\154\55\157\162\151\x67"]["\x66\151\154\145"] !== $basename) { $tag = "\x66\x75\154\x6c\x2d{$suffix}"; } } else { $tag = "\x66\x75\154\154\x2d\x6f\x72\151\147"; } if ($tag) { $backup_sizes[$tag] = array("\x77\x69\144\164\x68" => $meta["\167\x69\x64\x74\150"], "\150\x65\x69\x67\150\164" => $meta["\x68\x65\x69\147\150\x74"], "\146\151\x6c\145" => $basename); } $success = $path === $new_path || update_attached_file($post_id, $new_path); $meta["\x66\x69\154\x65"] = _wp_relative_upload_path($new_path); $size = $img->get_size(); $meta["\x77\x69\x64\164\150"] = $size["\x77\151\144\x74\x68"]; $meta["\150\x65\151\x67\150\164"] = $size["\x68\x65\151\x67\150\164"]; if ($success && ("\156\x6f\164\x68\165\x6d\142" === $target || "\x61\154\x6c" === $target)) { $sizes = get_intermediate_image_sizes(); if ($edit_thumbnails_separately && "\156\157\x74\x68\165\x6d\x62" === $target) { $sizes = array_diff($sizes, array("\164\150\165\x6d\142\x6e\141\x69\x6c")); } } $return->fw = $meta["\x77\x69\144\x74\x68"]; $return->fh = $meta["\x68\x65\151\147\150\164"]; } elseif ($edit_thumbnails_separately && "\164\150\165\x6d\142\156\x61\x69\x6c" === $target) { $sizes = array("\164\150\165\155\x62\x6e\141\x69\154"); $success = true; $delete = true; $nocrop = true; } if (defined("\x49\115\101\x47\105\x5f\x45\x44\x49\x54\137\x4f\x56\x45\x52\127\x52\x49\124\105") && IMAGE_EDIT_OVERWRITE && !empty($meta["\x73\151\x7a\145\x73"])) { foreach ($meta["\x73\151\x7a\x65\x73"] as $size) { if (!empty($size["\146\151\x6c\x65"]) && preg_match("\x2f\55\145\x5b\60\55\71\x5d\x7b\61\63\x7d\55\x2f", $size["\146\x69\154\x65"])) { $delete_file = path_join($dirname, $size["\146\x69\x6c\x65"]); wp_delete_file($delete_file); } } } if (isset($sizes)) { $_sizes = array(); foreach ($sizes as $size) { $tag = false; if (isset($meta["\163\x69\172\145\x73"][$size])) { if (isset($backup_sizes["{$size}\x2d\157\x72\151\x67"])) { if ((!defined("\x49\x4d\x41\x47\x45\137\x45\x44\111\124\137\x4f\126\105\122\127\122\111\124\x45") || !IMAGE_EDIT_OVERWRITE) && $backup_sizes["{$size}\x2d\157\x72\151\147"]["\146\151\154\145"] !== $meta["\x73\151\172\145\x73"][$size]["\x66\x69\x6c\x65"]) { $tag = "{$size}\x2d{$suffix}"; } } else { $tag = "{$size}\x2d\157\162\151\x67"; } if ($tag) { $backup_sizes[$tag] = $meta["\x73\x69\172\x65\x73"][$size]; } } if (isset($_wp_additional_image_sizes[$size])) { $width = (int) $_wp_additional_image_sizes[$size]["\167\x69\144\164\x68"]; $height = (int) $_wp_additional_image_sizes[$size]["\x68\145\x69\x67\x68\164"]; $crop = $nocrop ? false : $_wp_additional_image_sizes[$size]["\x63\x72\157\x70"]; } else { $height = get_option("{$size}\x5f\x73\x69\x7a\x65\137\150"); $width = get_option("{$size}\137\163\151\172\x65\x5f\x77"); $crop = $nocrop ? false : get_option("{$size}\x5f\143\x72\x6f\x70"); } $_sizes[$size] = array("\167\x69\x64\164\150" => $width, "\150\x65\151\x67\150\164" => $height, "\143\x72\x6f\160" => $crop); } $meta["\163\x69\172\145\x73"] = array_merge($meta["\163\x69\172\x65\163"], $img->multi_resize($_sizes)); } unset($img); if ($success) { wp_update_attachment_metadata($post_id, $meta); update_post_meta($post_id, "\137\x77\x70\x5f\x61\x74\x74\141\x63\x68\x6d\x65\x6e\164\x5f\x62\141\143\x6b\x75\x70\x5f\163\151\172\x65\163", $backup_sizes); if ("\x74\x68\x75\155\142\x6e\x61\151\x6c" === $target || "\141\154\154" === $target || "\x66\x75\154\154" === $target) { if (!empty($_REQUEST["\x63\x6f\x6e\x74\x65\170\x74"]) && "\x65\144\x69\164\55\x61\164\164\x61\143\x68\x6d\145\x6e\164" === $_REQUEST["\x63\157\x6e\164\145\x78\164"]) { $thumb_url = wp_get_attachment_image_src($post_id, array(900, 600), true); $return->thumbnail = $thumb_url[0]; } else { $file_url = wp_get_attachment_url($post_id); if (!empty($meta["\x73\x69\172\x65\163"]["\164\x68\x75\155\x62\x6e\x61\x69\154"])) { $thumb = $meta["\163\x69\172\145\163"]["\x74\150\x75\x6d\142\156\141\151\154"]; $return->thumbnail = path_join(dirname($file_url), $thumb["\x66\151\154\145"]); } else { $return->thumbnail = "{$file_url}\77\x77\x3d\61\62\70\46\x68\x3d\x31\62\x38"; } } } } else { $delete = true; } if ($delete) { wp_delete_file($new_path); } $return->msg = esc_js(__("\x49\x6d\141\147\x65\40\x73\x61\x76\145\x64")); return $return; }
Function Calls
None |
Stats
MD5 | 8587bd5c7d2ef2f77c51bb1a769a4b45 |
Eval Count | 0 |
Decode Time | 128 ms |