PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 2.8.3
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v2.8.3
3.1.9 3.1.8 3.1.7 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 trunk 1.3.7 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9 2.9.1 2.9.2
folders / templates / admin / media-replace.php
folders / templates / admin Last commit date
admin-content.php 4 years ago folder-deactivate-form.php 4 years ago folder-popup.php 4 years ago general-settings.php 4 years ago help.php 4 years ago media-cleaning.php 4 years ago media-replace.php 4 years ago recommended-plugins.php 4 years ago update.php 4 years ago upgrade-table.php 4 years ago upgrade-to-pro.php 4 years ago
media-replace.php
171 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 if (!current_user_can('upload_files'))
5 wp_die(esc_html__('You do not have permission to upload files.', 'enable-media-replace'));
6
7 global $wpdb;
8
9 $attachment_id = intval($_GET['attachment_id']);
10 $attachment = get_post($attachment_id);
11
12 $size = 0;
13 if(isset($attachment->guid)) {
14 $size = $this->getFileSize($attachment_id);
15 }
16 //$url = wp_get_attachment_url($attachment_id); die;
17 $guid = $attachment->guid;
18 $url = wp_get_attachment_url($attachment_id);
19 if(!empty($url)) {
20 $guid = $url;
21 }
22 $guid = explode(".", $guid);
23 $ext = array_pop($guid);
24 $image_meta = wp_get_attachment_metadata($attachment_id);
25 $thumb = wp_get_attachment_image_src($attachment_id, 'thumbnail');
26 $source_type = get_post_mime_type($attachment_id);
27 $url = "";
28 if(isset($thumb[0])) {
29 $url = $thumb[0];
30 }
31 $file_parts = pathinfo($attachment->guid);
32 $file_name = $file_parts['basename'];
33
34 $customize_folders = get_option("customize_folders");
35 if(isset($customize_folders['show_folder_in_settings']) && $customize_folders['show_folder_in_settings'] == "yes") {
36 $upgradeURL = admin_url("options-general.php?page=wcp_folders_settings&setting_page=upgrade-to-pro");
37 } else {
38 $upgradeURL = admin_url("admin.php?page=folders-upgrade-to-pro");
39 }
40 $current_date = date_i18n('d/M/Y H:i', strtotime($attachment->post_date) )
41
42 /*
43 * Forked from Enable Media Replace
44 *
45 * */
46 ?>
47 <div class="wrap">
48 <h2><?php esc_html_e("Replace Media", "folders"); ?></h2>
49 <form enctype="multipart/form-data" method="POST" action="">
50 <div class="replace-media-page">
51 <p><b><?php esc_html_e("Current File", "folders") ?></b>: <?php echo esc_attr($file_name) ?></p>
52 <p><?php esc_html_e("Upload a new file instead of the current one", "folders") ?></p>
53 <p><?php printf(__('Maximum file size: <strong>%s</strong>', 'enable-media-replace'), size_format(wp_max_upload_size())) ?></p>
54 <input type="hidden" name="attachment_id" value="<?php echo esc_attr__($attachment_id) ?>"/>
55 <input type="hidden" name="ext" id="file_ext" value="<?php echo esc_attr__($ext) ?>"/>
56 <div class="upload-media-box">
57
58 </div>
59 <div class="">
60 <div class="current-image-box">
61 <div class="file-option"><?php esc_html_e("Current File", "folders") ?></div>
62 <div class="preview-box">
63 <?php if (wp_attachment_is('image', $attachment_id)) { ?>
64 <?php if(!empty($url)) { ?>
65 <img src="<?php echo esc_url($url) ?>" />
66 <span class="image-size"><?php echo esc_attr($image_meta['width']." PX x ".$image_meta['height'])." PX" ?></span>
67 <?php } ?>
68 <?php } else { ?>
69 <span class="dashicons dashicons-media-document"></span>
70 <?php } ?>
71 </div>
72 <?php if(!empty($size)) { ?>
73 <div class="file-size"><a target="_blank" href="<?php echo esc_url($upgradeURL) ?>"><?php esc_html_e("Upgrade to Pro", "folders") ?></a> <?php esc_html_e("to compare file size", "folders") ?></div>
74 <?php } ?>
75 </div>
76 <div class="new-image-box">
77 <div class="file-option"><?php esc_html_e("New File", "folders") ?></div>
78 <div class="preview-box">
79 <div class="container" >
80 <div class="container" >
81 <input type="file" name="new_media_file" id="media_file">
82
83 <!-- Drag and Drop container-->
84 <div class="upload-area" id="upload-file">
85 <div class="drag-and-drop-title">
86 <span><?php echo esc_html_e("Click here to upload file", "folders") ?></span>
87 </div>
88 <div class="upgrade-btn-box">
89 <a target="_blank" href="<?php echo esc_url($upgradeURL) ?>"><?php esc_html_e("Upgrade to Pro", "folders") ?></a>
90 </div>
91 </div>
92 </div>
93 </div>
94 </div>
95 <div class="file-size hide-it"><a target="_blank" href="<?php echo esc_url($upgradeURL) ?>"><?php esc_html_e("Upgrade to Pro", "folders") ?></a> <?php esc_html_e("to compare file size", "folders") ?></div>
96 </div>
97 <div class="clearfix"></div>
98 </div>
99
100 <div class="file-type warning replace-message">
101 <?php esc_html_e("Replacement file is not the same filetype. This might cause unexpected issues", "folders"); ?>
102 </div>
103
104 <div class="media-bottom-box pro">
105 <div class="media-bottom-pro">
106 <div class="media-bottom-box-left">
107 <div class="media-setting">
108 <div class="media-title"><?php esc_html_e("Replace Files", "folders") ?></div>
109 <div class="media-form">
110 <div class="media-option">
111 <label for="replace_only_file"><input type="radio" checked name="replacement_option" value="replace_only_file" id="replace_only_file" /> <?php esc_html_e("Replace File Only", "folders") ?></label>
112 </div>
113 <div class="media-note">
114 <?php printf(esc_html__("%s Please upload a file with the same extension (jpg, jpeg, png etc). The file name will remain the same as the file being replaced.", "folders"), "<b>".esc_html__("Note:", "folders")."</b>" ); ?>
115 </div>
116 <div class="media-option">
117 <label for="replace_file_with_name"><input type="radio" name="replacement_option" value="replace_file_with_name" id="replace_file_with_name" /> <?php esc_html_e("Replace File and Update URLs with New File name", "folders") ?></label>
118 </div>
119 <div class="media-note">
120 <?php printf(esc_html__("%s After selecting this option, the new file name will be retained, and all the URLs pointing to the current file will be revised to the new file. If the file URL has been shared on external web pages, the links may not work.", "folders"), "<b>".esc_html__("Warning:", "folders")."</b>"); ?>
121 </div>
122 </div>
123 </div>
124 </div>
125 <div class="media-bottom-box-right">
126 <div class="media-setting">
127 <div class="media-title"><?php esc_html_e("File Date", "folders") ?></div>
128 <div class="media-form">
129 <div class="media-note">
130 <?php esc_html_e("After swapping the old file with the new one:", "folders"); ?>
131 </div>
132 <ul>
133 <li>
134 <label for="replace_date"><input type="radio" name="date_options" value="replace_date" id="replace_date" /> <?php esc_html_e("Set the date of upload of the new file", "folders") ?></label>
135 </li>
136 <li>
137 <label for="keep_date"><input type="radio" checked name="date_options" value="keep_date" id="keep_date" /> <?php esc_html_e("Keep the old file's date of the upload", "folders") ?> <small>(<?php echo esc_attr($current_date) ?>)</small></label>
138 </li>
139 <li>
140 <label for="select_custom_date"><input type="radio" name="date_options" value="custom_date" id="select_custom_date" /> <?php esc_html_e("Set a date", "folders") ?></label>
141 </li>
142 </ul>
143 <div class="custom-date" id="custom-date">
144 <label for="custom_date"><?php esc_html_e("Custom date", "folders"); ?></label>
145 <span class="inline"><input type="text" class="media-date" name="custom_date" value="<?php echo date("F j, Y") ?>" id="custom_date"></span><span class="inline-block">@</span><span class="inline"><input type="text" name="custom_date_hour" class="media-time" value="<?php echo date("m") ?>" id="custom_date_hour"></span><span class="inline-block">:</span><span class="inline"><input type="text" class="media-time" name="custom_date_min" value="<?php echo date("i") ?>" id="custom_date_min"></span>
146 </div>
147 <div class="custom-date" id="custom-path">
148 <input type="hidden" name="new_folder_option" value="0">
149 <label for="new_folder_option"><input type="checkbox" id="new_folder_option" name="new_folder_option" value="1"><?php esc_html_e("Put new Upload in Updated Folder", "folders"); ?></label>
150 <span class="inline"><input type="text" class="media-date" name="new_folder_path" value="<?php echo date("Y/m") ?>" id="new_folder_path"></span>
151 </div>
152 </div>
153 </div>
154 </div>
155 <div class="clear"></div>
156 </div>
157 <div class="media-bottom-pro-button">
158 <div class="pro-button">
159 <a target="_blank" href="<?php echo esc_url($upgradeURL) ?>"><?php esc_html_e("Upgrade to Pro", "folders") ?></a>
160 </div>
161 </div>
162 </div>
163
164 <div class="replace-media-buttons">
165 <button type="submit" class="button button-primary" disabled><?php echo esc_html_e("Replace File", "folders") ?></button>
166 <button type="button" class="button button-secondary" onclick="history.back();"><?php echo esc_html_e("Cancel", "folders") ?></button>
167 </div>
168 </div>
169 </form>
170 </div>
171