Enable Media Replace - Version 3.0.4

Version Description

  • Fixed typo in .pt translations (https://github.com/mansj/enable-media-replace/pull/18)
  • Fixed better error handling in modification date functions (https://github.com/mansj/enable-media-replace/pull/16)
  • Tested with WP 4.4.1
Download this release

Release Info

Developer MungoBBQ
Plugin Icon 128x128 Enable Media Replace
Version 3.0.4
Comparing to
See all releases

Code changes from version 3.0.3 to 3.0.4

enable-media-replace.php CHANGED
@@ -3,15 +3,13 @@
3
  Plugin Name: Enable Media Replace
4
  Plugin URI: http://www.mansjonasson.se/enable-media-replace
5
  Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
6
- Version: 3.0.3
7
  Author: Måns Jonasson
8
  Author URI: http://www.mansjonasson.se
9
 
10
  Dual licensed under the MIT and GPL licenses:
11
  http://www.opensource.org/licenses/mit-license.php
12
  http://www.gnu.org/licenses/gpl.html
13
-
14
- Developed for .SE (Stiftelsen för Internetinfrastruktur) - http://www.iis.se
15
  */
16
 
17
  /**
@@ -127,14 +125,19 @@ function emr_get_modified_date($atts) {
127
  // Get path to file
128
  $current_file = get_attached_file($id);
129
 
 
 
 
 
130
  // Get file modification time
131
  $filetime = filemtime($current_file);
132
 
133
- // do date conversion
134
- $content = date($format, $filetime);
 
 
135
 
136
- return $content;
137
-
138
  }
139
 
140
  // Add Last replaced by EMR plugin in the media edit screen metabox - Thanks Jonas Lundman (http://wordpress.org/support/topic/add-filter-hook-suggestion-to)
@@ -143,9 +146,14 @@ function ua_admin_date_replaced_media_on_edit_media_screen() {
143
  global $post;
144
  $id = $post->ID;
145
  $shortcode = "[file_modified id=$id]";
 
 
 
 
 
146
  ?>
147
  <div class="misc-pub-section curtime">
148
- <span id="timestamp"><?php _e( 'Revised', 'enable-media-replace' ); ?>: <b><?php echo do_shortcode($shortcode); ?></b></span>
149
  </div>
150
  <?php
151
  }
3
  Plugin Name: Enable Media Replace
4
  Plugin URI: http://www.mansjonasson.se/enable-media-replace
5
  Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
6
+ Version: 3.0.4
7
  Author: Måns Jonasson
8
  Author URI: http://www.mansjonasson.se
9
 
10
  Dual licensed under the MIT and GPL licenses:
11
  http://www.opensource.org/licenses/mit-license.php
12
  http://www.gnu.org/licenses/gpl.html
 
 
13
  */
14
 
15
  /**
125
  // Get path to file
126
  $current_file = get_attached_file($id);
127
 
128
+ if ( ! file_exists( $current_file ) ) {
129
+ return false;
130
+ }
131
+
132
  // Get file modification time
133
  $filetime = filemtime($current_file);
134
 
135
+ if ( false !== $filetime ) {
136
+ // do date conversion
137
+ return date( $format, $filetime );
138
+ }
139
 
140
+ return false;
 
141
  }
142
 
143
  // Add Last replaced by EMR plugin in the media edit screen metabox - Thanks Jonas Lundman (http://wordpress.org/support/topic/add-filter-hook-suggestion-to)
146
  global $post;
147
  $id = $post->ID;
148
  $shortcode = "[file_modified id=$id]";
149
+
150
+ $file_modified_time = do_shortcode($shortcode);
151
+ if ( ! $file_modified_time ) {
152
+ return;
153
+ }
154
  ?>
155
  <div class="misc-pub-section curtime">
156
+ <span id="timestamp"><?php _e( 'Revised', 'enable-media-replace' ); ?>: <b><?php echo $file_modified_time; ?></b></span>
157
  </div>
158
  <?php
159
  }
languages/enable-media-replace-pt_PT.mo CHANGED
Binary file
languages/enable-media-replace-pt_PT.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: enable-media-replace\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-06-03 14:32+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
8
  "Language-Team: Pedro Mendonça <ped.gaspar@gmail.com>\n"
@@ -12,98 +12,118 @@ msgstr ""
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "X-Poedit-KeywordsList: __;_e\n"
14
  "X-Poedit-Basepath: .\n"
15
- "X-Generator: Poedit 1.6.4\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
17
  "X-Poedit-SearchPath-0: .\n"
 
18
 
19
- #: enable-media-replace.php:40 enable-media-replace.php:79
20
- #: enable-media-replace.php:120
21
  msgid "Replace media"
22
  msgstr "Substituir media"
23
 
24
- #: enable-media-replace.php:79
25
  msgid "Upload a new file"
26
  msgstr "Carregar novo ficheiro"
27
 
28
- #: enable-media-replace.php:79
29
  msgid "To replace the current file, click the link and upload a replacement."
30
  msgstr ""
31
  "Para subtituir o ficheiro actual, clique na ligação e carregue um substituto."
32
 
33
- #: enable-media-replace.php:168
34
  msgid "Revised"
35
  msgstr "Revisto"
36
 
37
- #: popup.php:14 upload.php:3
38
  msgid "You do not have permission to upload files."
39
  msgstr "Não tem permissão para carregar ficheiros."
40
 
41
- #: popup.php:30
42
  msgid "Replace Media Upload"
43
- msgstr "Carregar Substituição de Media"
44
 
45
- #: popup.php:46
46
  msgid "NOTE: You are about to replace the media file"
47
  msgstr "NOTA: Irá substituir o ficheiro de media"
48
 
49
- #: popup.php:46
50
  msgid "There is no undo. Think about it!"
51
  msgstr "Não será possível voltar a trás!"
52
 
53
- #: popup.php:48
54
  msgid "Choose a file to upload from your computer"
55
  msgstr "Escolher um ficheiro para carregar a partir do computador"
56
 
57
- #: popup.php:52
58
  msgid "Select media replacement type:"
59
  msgstr "Seleccione o tipo de substituição de media"
60
 
61
- #: popup.php:54
62
  msgid "Just replace the file"
63
  msgstr "Apenas substituir o ficheiro"
64
 
65
- #: popup.php:55
66
  msgid "Note: This option requires you to upload a file of the same type ("
67
  msgstr "Nota: Esta opção requer o carregamento de um ficheiro do mesmo tipo ("
68
 
69
- #: popup.php:55
70
  msgid ""
71
  ") as the one you are replacing. The name of the attachment will stay the "
72
  "same ("
73
  msgstr ") daquele a substituir. O nome do ficheiro permanecerá o mesmo ("
74
 
75
- #: popup.php:55
76
  msgid ") no matter what the file you upload is called."
77
  msgstr "), independentemente do nome do ficheiro carregado."
78
 
79
- #: popup.php:57
80
  msgid "Replace the file, use new file name and update all links"
81
  msgstr ""
82
  "Substituir o ficheiro, usar o novo nome de ficheiro e actualizar todas as "
83
  "ligações"
84
 
85
- #: popup.php:58
86
  msgid ""
87
  "Note: If you check this option, the name and type of the file you are about "
88
  "to upload will replace the old file. All links pointing to the current file ("
89
  msgstr ""
90
- "Nota: Se selecionar esta opção, o nome e tipo do ficheiro que está prestes a "
91
- "carregar irá substituir os do ficheiro antigo. Todas as ligações que "
92
  "referenciam o ficheiro actual ("
93
 
94
- #: popup.php:58
95
  msgid ") will be updated to point to the new file name."
96
  msgstr ") serão actualizadas de forma a referenciar o novo nome de ficheiro."
97
 
98
- #: popup.php:60
 
 
 
 
 
 
 
 
 
99
  msgid "Upload"
100
  msgstr "Carregar"
101
 
102
- #: popup.php:60
103
  msgid "Cancel"
104
  msgstr "Cancelar"
105
 
106
- #: upload.php:33
 
 
 
 
 
 
 
 
 
107
  msgid "File type does not meet security guidelines. Try another."
108
  msgstr ""
109
  "O tipo de ficheiro não está de acordo com os padrões de segurança. Tente "
2
  msgstr ""
3
  "Project-Id-Version: enable-media-replace\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-01-16 16:33-0000\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
8
  "Language-Team: Pedro Mendonça <ped.gaspar@gmail.com>\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "X-Poedit-KeywordsList: __;_e\n"
14
  "X-Poedit-Basepath: .\n"
15
+ "X-Generator: Poedit 1.8.6\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
+ "X-Poedit-SearchPath-1: ..\n"
20
 
21
+ #: ../enable-media-replace.php:40 ../enable-media-replace.php:79
22
+ #: ../enable-media-replace.php:120
23
  msgid "Replace media"
24
  msgstr "Substituir media"
25
 
26
+ #: ../enable-media-replace.php:79
27
  msgid "Upload a new file"
28
  msgstr "Carregar novo ficheiro"
29
 
30
+ #: ../enable-media-replace.php:79
31
  msgid "To replace the current file, click the link and upload a replacement."
32
  msgstr ""
33
  "Para subtituir o ficheiro actual, clique na ligação e carregue um substituto."
34
 
35
+ #: ../enable-media-replace.php:161
36
  msgid "Revised"
37
  msgstr "Revisto"
38
 
39
+ #: ../popup.php:14 ../upload.php:3
40
  msgid "You do not have permission to upload files."
41
  msgstr "Não tem permissão para carregar ficheiros."
42
 
43
+ #: ../popup.php:30
44
  msgid "Replace Media Upload"
45
+ msgstr "Carregar substituição de media"
46
 
47
+ #: ../popup.php:46
48
  msgid "NOTE: You are about to replace the media file"
49
  msgstr "NOTA: Irá substituir o ficheiro de media"
50
 
51
+ #: ../popup.php:46
52
  msgid "There is no undo. Think about it!"
53
  msgstr "Não será possível voltar a trás!"
54
 
55
+ #: ../popup.php:48
56
  msgid "Choose a file to upload from your computer"
57
  msgstr "Escolher um ficheiro para carregar a partir do computador"
58
 
59
+ #: ../popup.php:55
60
  msgid "Select media replacement type:"
61
  msgstr "Seleccione o tipo de substituição de media"
62
 
63
+ #: ../popup.php:57
64
  msgid "Just replace the file"
65
  msgstr "Apenas substituir o ficheiro"
66
 
67
+ #: ../popup.php:58
68
  msgid "Note: This option requires you to upload a file of the same type ("
69
  msgstr "Nota: Esta opção requer o carregamento de um ficheiro do mesmo tipo ("
70
 
71
+ #: ../popup.php:58
72
  msgid ""
73
  ") as the one you are replacing. The name of the attachment will stay the "
74
  "same ("
75
  msgstr ") daquele a substituir. O nome do ficheiro permanecerá o mesmo ("
76
 
77
+ #: ../popup.php:58
78
  msgid ") no matter what the file you upload is called."
79
  msgstr "), independentemente do nome do ficheiro carregado."
80
 
81
+ #: ../popup.php:61
82
  msgid "Replace the file, use new file name and update all links"
83
  msgstr ""
84
  "Substituir o ficheiro, usar o novo nome de ficheiro e actualizar todas as "
85
  "ligações"
86
 
87
+ #: ../popup.php:62
88
  msgid ""
89
  "Note: If you check this option, the name and type of the file you are about "
90
  "to upload will replace the old file. All links pointing to the current file ("
91
  msgstr ""
92
+ "Nota: Se seleccionar esta opção, o nome e tipo do ficheiro que está prestes "
93
+ "a carregar irá substituir os do ficheiro antigo. Todas as ligações que "
94
  "referenciam o ficheiro actual ("
95
 
96
+ #: ../popup.php:62
97
  msgid ") will be updated to point to the new file name."
98
  msgstr ") serão actualizadas de forma a referenciar o novo nome de ficheiro."
99
 
100
+ #: ../popup.php:63
101
+ msgid ""
102
+ "Please note that if you upload a new image, only embeds/links of the "
103
+ "original size image will be replaced in your posts."
104
+ msgstr ""
105
+ "Por favor tenha em atenção que se carregar uma nova imagem, apenas as "
106
+ "imagens incorporadas e ligações com o tamanho original serão substituídas "
107
+ "nos seus artigos."
108
+
109
+ #: ../popup.php:68
110
  msgid "Upload"
111
  msgstr "Carregar"
112
 
113
+ #: ../popup.php:68
114
  msgid "Cancel"
115
  msgstr "Cancelar"
116
 
117
+ #: ../upload.php:26
118
+ #, php-format
119
+ msgid ""
120
+ "The file %1$s can not be deleted by the web server, most likely because the "
121
+ "permissions on the file are wrong."
122
+ msgstr ""
123
+ "O ficheiro %1$s não pode ser apagado pelo servidor web, provavelmente porque "
124
+ "as permissões do ficheiro estão incorrectas."
125
+
126
+ #: ../upload.php:84
127
  msgid "File type does not meet security guidelines. Try another."
128
  msgstr ""
129
  "O tipo de ficheiro não está de acordo com os padrões de segurança. Tente "
languages/enable-media-replace.mo CHANGED
Binary file
languages/enable-media-replace.po CHANGED
@@ -2,99 +2,116 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: enable-media-replace\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-06-03 14:32+0100\n"
6
  "PO-Revision-Date: \n"
7
- "Last-Translator: Måns Jonasson <mans@thejonassons.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Poedit-KeywordsList: __;_e\n"
13
  "X-Poedit-Basepath: .\n"
14
- "X-Generator: Poedit 1.5.5\n"
 
 
 
15
  "X-Poedit-SearchPath-0: .\n"
 
16
 
17
- #: enable-media-replace.php:40 enable-media-replace.php:79
18
- #: enable-media-replace.php:120
19
  msgid "Replace media"
20
  msgstr ""
21
 
22
- #: enable-media-replace.php:79
23
  msgid "Upload a new file"
24
  msgstr ""
25
 
26
- #: enable-media-replace.php:79
27
  msgid "To replace the current file, click the link and upload a replacement."
28
  msgstr ""
29
 
30
- #: enable-media-replace.php:168
31
  msgid "Revised"
32
  msgstr ""
33
 
34
- #: popup.php:14 upload.php:3
35
  msgid "You do not have permission to upload files."
36
  msgstr ""
37
 
38
- #: popup.php:30
39
  msgid "Replace Media Upload"
40
  msgstr ""
41
 
42
- #: popup.php:46
43
  msgid "NOTE: You are about to replace the media file"
44
  msgstr ""
45
 
46
- #: popup.php:46
47
  msgid "There is no undo. Think about it!"
48
  msgstr ""
49
 
50
- #: popup.php:48
51
  msgid "Choose a file to upload from your computer"
52
  msgstr ""
53
 
54
- #: popup.php:52
55
  msgid "Select media replacement type:"
56
  msgstr ""
57
 
58
- #: popup.php:54
59
  msgid "Just replace the file"
60
  msgstr ""
61
 
62
- #: popup.php:55
63
  msgid "Note: This option requires you to upload a file of the same type ("
64
  msgstr ""
65
 
66
- #: popup.php:55
67
  msgid ""
68
  ") as the one you are replacing. The name of the attachment will stay the "
69
  "same ("
70
  msgstr ""
71
 
72
- #: popup.php:55
73
  msgid ") no matter what the file you upload is called."
74
  msgstr ""
75
 
76
- #: popup.php:57
77
  msgid "Replace the file, use new file name and update all links"
78
  msgstr ""
79
 
80
- #: popup.php:58
81
  msgid ""
82
  "Note: If you check this option, the name and type of the file you are about "
83
  "to upload will replace the old file. All links pointing to the current file ("
84
  msgstr ""
85
 
86
- #: popup.php:58
87
  msgid ") will be updated to point to the new file name."
88
  msgstr ""
89
 
90
- #: popup.php:60
 
 
 
 
 
 
91
  msgid "Upload"
92
  msgstr ""
93
 
94
- #: popup.php:60
95
  msgid "Cancel"
96
  msgstr ""
97
 
98
- #: upload.php:33
 
 
 
 
 
 
 
99
  msgid "File type does not meet security guidelines. Try another."
100
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: enable-media-replace\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-01-16 17:42-0000\n"
6
  "PO-Revision-Date: \n"
7
+ "Last-Translator: Pedro Mendonça <ped.gaspar@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Poedit-KeywordsList: __;_e\n"
13
  "X-Poedit-Basepath: .\n"
14
+ "X-Generator: Poedit 1.7.1\n"
15
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "Language: en\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
+ "X-Poedit-SearchPath-1: ..\n"
20
 
21
+ #: ../enable-media-replace.php:40 ../enable-media-replace.php:79
22
+ #: ../enable-media-replace.php:120
23
  msgid "Replace media"
24
  msgstr ""
25
 
26
+ #: ../enable-media-replace.php:79
27
  msgid "Upload a new file"
28
  msgstr ""
29
 
30
+ #: ../enable-media-replace.php:79
31
  msgid "To replace the current file, click the link and upload a replacement."
32
  msgstr ""
33
 
34
+ #: ../enable-media-replace.php:161
35
  msgid "Revised"
36
  msgstr ""
37
 
38
+ #: ../popup.php:14 ../upload.php:3
39
  msgid "You do not have permission to upload files."
40
  msgstr ""
41
 
42
+ #: ../popup.php:30
43
  msgid "Replace Media Upload"
44
  msgstr ""
45
 
46
+ #: ../popup.php:46
47
  msgid "NOTE: You are about to replace the media file"
48
  msgstr ""
49
 
50
+ #: ../popup.php:46
51
  msgid "There is no undo. Think about it!"
52
  msgstr ""
53
 
54
+ #: ../popup.php:48
55
  msgid "Choose a file to upload from your computer"
56
  msgstr ""
57
 
58
+ #: ../popup.php:55
59
  msgid "Select media replacement type:"
60
  msgstr ""
61
 
62
+ #: ../popup.php:57
63
  msgid "Just replace the file"
64
  msgstr ""
65
 
66
+ #: ../popup.php:58
67
  msgid "Note: This option requires you to upload a file of the same type ("
68
  msgstr ""
69
 
70
+ #: ../popup.php:58
71
  msgid ""
72
  ") as the one you are replacing. The name of the attachment will stay the "
73
  "same ("
74
  msgstr ""
75
 
76
+ #: ../popup.php:58
77
  msgid ") no matter what the file you upload is called."
78
  msgstr ""
79
 
80
+ #: ../popup.php:61
81
  msgid "Replace the file, use new file name and update all links"
82
  msgstr ""
83
 
84
+ #: ../popup.php:62
85
  msgid ""
86
  "Note: If you check this option, the name and type of the file you are about "
87
  "to upload will replace the old file. All links pointing to the current file ("
88
  msgstr ""
89
 
90
+ #: ../popup.php:62
91
  msgid ") will be updated to point to the new file name."
92
  msgstr ""
93
 
94
+ #: ../popup.php:63
95
+ msgid ""
96
+ "Please note that if you upload a new image, only embeds/links of the "
97
+ "original size image will be replaced in your posts."
98
+ msgstr ""
99
+
100
+ #: ../popup.php:68
101
  msgid "Upload"
102
  msgstr ""
103
 
104
+ #: ../popup.php:68
105
  msgid "Cancel"
106
  msgstr ""
107
 
108
+ #: ../upload.php:26
109
+ #, php-format
110
+ msgid ""
111
+ "The file %1$s can not be deleted by the web server, most likely because the "
112
+ "permissions on the file are wrong."
113
+ msgstr ""
114
+
115
+ #: ../upload.php:84
116
  msgid "File type does not meet security guidelines. Try another."
117
  msgstr ""
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: mungobbq
3
  Tags: admin, attachment, media, files
4
  Requires at least: 3.5
5
- Tested up to: 4.1
6
  Stable tag: trunk
7
 
8
  Enables replacing attachment files by simply uploading a new file in the media library edit view.
@@ -37,6 +37,11 @@ If you want more control over the format used to display the time, you can use t
37
 
38
  == Changelog ==
39
 
 
 
 
 
 
40
  = 3.0.3 =
41
  * Scrapped old method of detecting media screen, button to replace media will now show up in more places, yay!
42
  * Made sure the call to get_attached_file() no longer skips filters, in response to several users wishes.
2
  Contributors: mungobbq
3
  Tags: admin, attachment, media, files
4
  Requires at least: 3.5
5
+ Tested up to: 4.4.1
6
  Stable tag: trunk
7
 
8
  Enables replacing attachment files by simply uploading a new file in the media library edit view.
37
 
38
  == Changelog ==
39
 
40
+ = 3.0.4 =
41
+ * Fixed typo in .pt translations (https://github.com/mansj/enable-media-replace/pull/18)
42
+ * Fixed better error handling in modification date functions (https://github.com/mansj/enable-media-replace/pull/16)
43
+ * Tested with WP 4.4.1
44
+
45
  = 3.0.3 =
46
  * Scrapped old method of detecting media screen, button to replace media will now show up in more places, yay!
47
  * Made sure the call to get_attached_file() no longer skips filters, in response to several users wishes.
upload.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  if (!current_user_can('upload_files'))
3
- wp_die(__('You do not have permission to upload files.'));
4
 
5
  // Define DB table names
6
  global $wpdb;
@@ -67,7 +67,7 @@ list($current_filename, $current_filetype) = $wpdb->get_row($sql, ARRAY_N);
67
  $current_guid = $current_filename;
68
  $current_filename = substr($current_filename, (strrpos($current_filename, "/") + 1));
69
 
70
- $current_file = get_attached_file((int) $_POST["ID"], true);
71
  $current_path = substr($current_file, 0, (strrpos($current_file, "/")));
72
  $current_file = str_replace("//", "/", $current_file);
73
  $current_filename = basename($current_file);
@@ -81,7 +81,7 @@ if (is_uploaded_file($_FILES["userfile"]["tmp_name"])) {
81
  $filedata = wp_check_filetype_and_ext($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"]);
82
 
83
  if ($filedata["ext"] == "") {
84
- echo __("File type does not meet security guidelines. Try another.");
85
  exit;
86
  }
87
 
@@ -201,4 +201,4 @@ if (FORCE_SSL_ADMIN) {
201
 
202
  //save redirection
203
  wp_redirect($returnurl);
204
- ?>
1
  <?php
2
  if (!current_user_can('upload_files'))
3
+ wp_die(__('You do not have permission to upload files.', 'enable-media-replace'));
4
 
5
  // Define DB table names
6
  global $wpdb;
67
  $current_guid = $current_filename;
68
  $current_filename = substr($current_filename, (strrpos($current_filename, "/") + 1));
69
 
70
+ $current_file = get_attached_file((int) $_POST["ID"], apply_filters( 'emr_unfiltered_get_attached_file', true ));
71
  $current_path = substr($current_file, 0, (strrpos($current_file, "/")));
72
  $current_file = str_replace("//", "/", $current_file);
73
  $current_filename = basename($current_file);
81
  $filedata = wp_check_filetype_and_ext($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"]);
82
 
83
  if ($filedata["ext"] == "") {
84
+ echo __("File type does not meet security guidelines. Try another.", 'enable-media-replace');
85
  exit;
86
  }
87
 
201
 
202
  //save redirection
203
  wp_redirect($returnurl);
204
+ ?>