* @copyright Måns Jonasson 13 sep 2010 * @version $Revision: 2303 $ | $Date: 2010-09-13 11:12:35 +0200 (ma, 13 sep 2010) $ * @package wordpress * @subpackage enable-media-replace * */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. if (!current_user_can('upload_files')) wp_die( esc_html__('You do not have permission to upload files.', 'enable-media-replace') ); global $wpdb; //$emr = EnableMediaReplacePlugin::get(); $table_name = $wpdb->prefix . "posts"; $attachment_id = intval($_GET['attachment_id']); $attachment = get_post($attachment_id); if (! emr()->checkImagePermission($attachment)) { wp_die( esc_html__('You do not have permission to upload files for this author.', 'enable-media-replace') ); } $replacer = new Replacer($attachment_id); $file = $replacer->getSourceFile(); $filepath = $file->getFullPath(); $filename = $file->getFileName(); $filetype = $file->getExtension(); $source_mime = get_post_mime_type($attachment_id); $uiHelper = emr()->uiHelper(); $uiHelper->setPreviewSizes(); $uiHelper->setSourceSizes($attachment_id); $defaults = array( 'replace_type' => 'replace', 'timestamp_replace' => \EnableMediaReplace\Replacer::TIME_UPDATEMODIFIED, 'custom_date' => date("Y-m-d H:i:s"), 'new_location' => false, 'new_location_dir' => false, ); $settings = get_option('enable_media_replace', $defaults); $settings = array_merge($defaults, $settings); // might miss some ?>

getFormUrl($attachment_id); $formurl = wp_nonce_url( $url, "media_replace_upload" ); if (FORCE_SSL_ADMIN) { $formurl = str_replace("http:", "https:", $formurl); } ?>

%s','enable-media-replace'), size_format(wp_max_upload_size() ) ) ?>

', ''); ?>

- '); ?>

getPreviewImage($attachment_id, $file); echo $uiHelper->getPreviewImage(-1, $file); } else { if (strlen($filepath) == 0) // check if image in error state. { echo $uiHelper->getPreviewError(-1); echo $uiHelper->getPreviewImage(-1, $file); } else { echo $uiHelper->getPreviewFile($attachment_id, $file); echo $uiHelper->getPreviewFile(-1, $file); } } ?>
'enable-media-replace/enable-media-replace.php', 'action' => 'emr_prepare_remove', 'attachment_id' => $attachment_id, ), $url); ?>

 

isBackgroundRemovable($attachment)): ?>


post_date) ); $attachment_now_date = date_i18n('d/M/Y H:i' ); $time = current_time('mysql'); $date = $nowDate = new \dateTime($time); // default to now. $attachmentDate = new \dateTime($attachment->post_date); if ($settings['timestamp_replace'] == \EnableMediaReplace\Replacer::TIME_CUSTOM) { $date = new \dateTime($settings['custom_date']); } ?>

@   %s', $nowDate->format(get_option('date_format')), $nowDate->format('H'), $nowDate->format('i'), $nowDate->format('Y-m-d'), __('Now', 'enable-media-replace')); echo " "; printf('%s', $attachmentDate->format(get_option('date_format')), $attachmentDate->format('H'), $attachmentDate->format('i'), $attachmentDate->format('Y-m-d'), __('Original', 'enable-media-replace')); ?>
getRelPathNow()): if ($settings['new_location'] !== false) $subdir = $settings['new_location_dir']; ?>
" />