Media File Renamer - Version 4.4.0

Version Description

  • Update: Compatibility with WP 5.0.
  • Update: Compatibility with Real Media Library.
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Media File Renamer
Version 4.4.0
Comparing to
See all releases

Code changes from version 4.2.8 to 4.4.0

Files changed (6) hide show
  1. core.php +39 -6
  2. helpers.php +29 -0
  3. media-file-renamer.php +5 -3
  4. mfrh_admin.php +73 -17
  5. readme.txt +6 -2
  6. views/menu-screen.php +3 -3
core.php CHANGED
@@ -456,14 +456,33 @@ SQL;
456
  '%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
457
  // grave accent, macron, caron
458
  '%cc%80', '%cc%84', '%cc%8c',
459
-
460
- /** Extras **/
461
- // circumflex
462
- '%5e', '%cc%82', '%cb%86', '%ef%bc%be',
463
- // low circumflex
464
- '%cc%ad', '%ea%9e%88'
465
  );
466
  $chars = array_map( 'urldecode', $chars );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
468
  // Preform conversion
469
  foreach ( $chars as $char )
@@ -472,6 +491,16 @@ SQL;
472
  return $str;
473
  }
474
 
 
 
 
 
 
 
 
 
 
 
475
  function replace_chars( $str ) {
476
  $special_chars = array();
477
  $special_chars = apply_filters( 'mfrh_replace_rules', $special_chars );
@@ -564,6 +593,10 @@ SQL;
564
  }
565
 
566
  function rename_file( $old, $new, $case_issue = false ) {
 
 
 
 
567
  // If there is a case issue, that means the system doesn't make the difference between AA.jpg and aa.jpg even though WordPress does.
568
  // In that case it is important to rename the file to a temporary filename in between like: AA.jpg -> TMP.jpg -> aa.jpg.
569
  if ( $case_issue ) {
456
  '%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
457
  // grave accent, macron, caron
458
  '%cc%80', '%cc%84', '%cc%8c',
 
 
 
 
 
 
459
  );
460
  $chars = array_map( 'urldecode', $chars );
461
+
462
+ // Combining Diacritical Marks (U+0300 - U+036F)
463
+ // @see http://www.fileformat.info/info/unicode/block/combining_diacritical_marks/list.htm
464
+ for ( $i = 0x0300; $i <= 0x036f; $i++ ) $chars[] = $this->u( $i );
465
+
466
+ // Combining Diacritical Marks Extended (U+1AB0 - U+1ABE)
467
+ // @see http://www.fileformat.info/info/unicode/block/combining_diacritical_marks_extended/list.htm
468
+ for ( $i = 0x1ab0; $i <= 0x1abe; $i++ ) $chars[] = $this->u( $i );
469
+
470
+ // Combining Diacritical Marks Supplement (U+1DC0 - U+1DEF)
471
+ // @see http://www.fileformat.info/info/unicode/block/combining_diacritical_marks_supplement/list.htm
472
+ for ( $i = 0x1dc0; $i <= 0x1def; $i++ ) $chars[] = $this->u( $i );
473
+
474
+ // Common Diacrical Marks
475
+ $x = array (
476
+ // Circumflex
477
+ 0x005e, 0x02c6,
478
+ // Low Circumflex
479
+ 0xa788,
480
+ // Tilde
481
+ 0x007e, 0x02dc,
482
+ // Low Tilde
483
+ 0x02f7,
484
+ );
485
+ $chars = array_merge( $chars, array_map( array ( $this, 'u' ), $x ) );
486
  }
487
  // Preform conversion
488
  foreach ( $chars as $char )
491
  return $str;
492
  }
493
 
494
+ /**
495
+ * Returns a decoded unicode character from its code point
496
+ * @param int $code_point
497
+ * @return string
498
+ */
499
+ function u( $code_point ) {
500
+ $u = str_pad( dechex( $code_point ), 4, '0', STR_PAD_LEFT ); // 4 digits hexadecimal string
501
+ return json_decode( '"\u' . $u . '"' );
502
+ }
503
+
504
  function replace_chars( $str ) {
505
  $special_chars = array();
506
  $special_chars = apply_filters( 'mfrh_replace_rules', $special_chars );
593
  }
594
 
595
  function rename_file( $old, $new, $case_issue = false ) {
596
+ // Some plugins can create custom thumbnail folders instead in the same folder, so make sure
597
+ // the thumbnail folders are available.
598
+ wp_mkdir_p( dirname($new) );
599
+
600
  // If there is a case issue, that means the system doesn't make the difference between AA.jpg and aa.jpg even though WordPress does.
601
  // In that case it is important to rename the file to a temporary filename in between like: AA.jpg -> TMP.jpg -> aa.jpg.
602
  if ( $case_issue ) {
helpers.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !function_exists( 'is_rest' ) ) {
4
+ /**
5
+ * Checks if the current request is a WP REST API request.
6
+ *
7
+ * Case #1: After WP_REST_Request initialisation
8
+ * Case #2: Support "plain" permalink settings
9
+ * Case #3: URL Path begins with wp-json/ (your REST prefix)
10
+ * Also supports WP installations in subfolders
11
+ *
12
+ * @returns boolean
13
+ * @author matzeeable
14
+ */
15
+ function is_rest() {
16
+ $prefix = rest_get_url_prefix( );
17
+ if (defined('REST_REQUEST') && REST_REQUEST // (#1)
18
+ || isset($_GET['rest_route']) // (#2)
19
+ && strpos( trim( $_GET['rest_route'], '\\/' ), $prefix , 0 ) === 0)
20
+ return true;
21
+
22
+ // (#3)
23
+ $rest_url = wp_parse_url( site_url( $prefix ) );
24
+ $current_url = wp_parse_url( add_query_arg( array( ) ) );
25
+ return strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
26
+ }
27
+ }
28
+
29
+ ?>
media-file-renamer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Media File Renamer
4
  Plugin URI: http://meowapps.com
5
  Description: Auto-rename the files when titles are modified and update and the references (links). Manual Rename is a Pro option. Please read the description.
6
- Version: 4.2.8
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
@@ -26,11 +26,13 @@ if ( class_exists( 'Meow_MFRH_Core' ) ) {
26
  return;
27
  }
28
 
 
 
29
  // In admin or Rest API request (REQUEST URI begins with '/wp-json/')
30
- if ( is_admin() || strpos( trailingslashit( $_SERVER['REQUEST_URI'] ), '/' . trailingslashit( rest_get_url_prefix() ) ) === 0 ) {
31
 
32
  global $mfrh_version, $mfrh_core;
33
- $mfrh_version = '4.2.8';
34
 
35
  // Admin
36
  require( 'mfrh_admin.php');
3
  Plugin Name: Media File Renamer
4
  Plugin URI: http://meowapps.com
5
  Description: Auto-rename the files when titles are modified and update and the references (links). Manual Rename is a Pro option. Please read the description.
6
+ Version: 4.4.0
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
26
  return;
27
  }
28
 
29
+ require( 'helpers.php');
30
+
31
  // In admin or Rest API request (REQUEST URI begins with '/wp-json/')
32
+ if ( is_admin() || is_rest() ) {
33
 
34
  global $mfrh_version, $mfrh_core;
35
+ $mfrh_version = '4.4.0';
36
 
37
  // Admin
38
  require( 'mfrh_admin.php');
mfrh_admin.php CHANGED
@@ -165,10 +165,16 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
165
  <div class="meow-box meow-col meow-span_2_of_2">
166
  <h3>How to use</h3>
167
  <div class="inside">
168
- <?php echo _e( 'This plugin works out of the box, the default settings are the best for most installs. However, you should have a look at the <a target="_blank" href="https://meowapps.com/media-file-renamer/">tutorial</a>.', 'media-file-renamer' ) ?>
 
 
 
 
 
 
169
  <p class="submit">
170
  <a class="button button-primary" href="upload.php?page=rename_media_files">
171
- <?php echo _e( "Access the Renamer Dashboard", 'media-file-renamer' ); ?>
172
  </a>
173
  </p>
174
  </div>
@@ -247,35 +253,41 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
247
  $value = get_option( 'mfrh_rename_slug', null );
248
  $html = '<input type="checkbox" id="mfrh_rename_slug" name="mfrh_rename_slug" value="1" ' .
249
  checked( 1, get_option( 'mfrh_rename_slug' ), false ) . '/>';
250
- $html .= __( '<label>Slug = Filename</label><br /><small>Better to keep this un-checked as the link might have been referenced somewhere else.</small>', 'media-file-renamer' );
 
251
  echo $html;
252
  }
253
 
254
  function admin_convert_to_ascii_callback( $args ) {
255
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_convert_to_ascii" name="mfrh_convert_to_ascii" value="1" ' .
256
  checked( 1, apply_filters( 'mfrh_converts', false ), false ) . '/>';
257
- $html .= __( '<label>Enable</label><br /><small>Replace accents, umlauts, cyrillic, diacritics, by their ASCII equivalent.<br /><i>Examples: tête -> tete, schön -> schon, Добро -> dobro, etc.</i></small>', 'media-file-renamer' );
 
 
258
  echo $html;
259
  }
260
 
261
  function admin_manual_rename_callback( $args ) {
262
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_manual_rename" name="mfrh_manual_rename" value="1" ' .
263
  checked( 1, apply_filters( 'mfrh_manual', false ), false ) . '/>';
264
- $html .= '<label>Enable</label><br /><small>Manual field will be enabled in the Media Library and the Media Edit Screen.</small>';
 
265
  echo $html;
266
  }
267
 
268
  function admin_numbered_files_callback( $args ) {
269
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_numbered_files" name="mfrh_numbered_files" value="1" ' .
270
  checked( 1, apply_filters( 'mfrh_numbered', false ), false ) . '/>';
271
- $html .= __( '<label>Enable Numbering</label><br /><small>Identical filenames will be allowed by the plugin and a number will be appended automatically (myfile.jpg, myfile-2.jpg, myfile-3.jpg, etc).</small>', 'media-file-renamer' );
 
272
  echo $html;
273
  }
274
 
275
  function admin_rename_guid_callback( $args ) {
276
  $html = '<input type="checkbox" id="mfrh_rename_guid" name="mfrh_rename_guid" value="1" ' .
277
  checked( 1, get_option( 'mfrh_rename_guid' ), false ) . '/>';
278
- $html .= __( '<label>GUID = Filename</label><br/><small>The GUID will be renamed like the new filename.<br /><small>Better to keep this un-checked.</small>', 'media-file-renamer' );
 
279
  echo $html;
280
  }
281
 
@@ -288,7 +300,14 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
288
  $what = __( "Title of Media", 'media-file-renamer' );
289
  else if ( $method == "post_title" )
290
  $what = __( "Attached Post Title", 'media-file-renamer' );
291
- $html .= __( "<label>ALT = <b>$what</b></label><br /><small>Keep in mind that the HTML of your posts and pages WILL NOT be modified, as that is simply too dangerous for a plug-in.</small>", 'media-file-renamer' );
 
 
 
 
 
 
 
292
  echo $html;
293
  }
294
 
@@ -301,14 +320,22 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
301
  $what = __( "Media ALT", 'media-file-renamer' );
302
  else if ( $method == "post_title" )
303
  $what = __( "Attached Post Title", 'media-file-renamer' );
304
- $html .= __( "<label>Media Title = <b>$what</b></label><br /><small>Keep in mind that the HTML of your posts and pages WILL NOT be modified, as that is simply too dangerous for a plug-in.</small>", 'media-file-renamer' );
 
 
 
 
 
 
 
305
  echo $html;
306
  }
307
 
308
  function admin_undo_callback( $args ) {
309
  $html = '<input type="checkbox" id="mfrh_undo" name="mfrh_undo" value="1" ' .
310
  checked( 1, get_option( 'mfrh_undo', false ), false ) . '/>';
311
- $html .= __( '<label>Enable</label><br /><small>A little undo icon will be added in the Rename column (Media Library). When clicked, the filename will be renamed back to the original.</small>', 'media-file-renamer' );
 
312
  echo $html;
313
  }
314
 
@@ -330,7 +357,8 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
330
  function admin_on_upload_callback( $args ) {
331
  $html = '<input type="checkbox" id="mfrh_on_upload" name="mfrh_on_upload" value="1" ' .
332
  checked( 1, get_option( 'mfrh_on_upload', false ), false ) . '/>';
333
- $html .= __( '<label>Enable</label><br /><small>During upload, the filename will be renamed based on the title of the media if there is any EXIF with the file. Otherwise, it will optimize the upload filename.</small>', 'media-file-renamer' );
 
334
  echo $html;
335
  }
336
 
@@ -338,7 +366,13 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
338
  $value = get_option( 'mfrh_update_postmeta', true );
339
  $html = '<input type="checkbox" id="mfrh_update_postmeta" name="mfrh_update_postmeta" value="1" ' .
340
  checked( 1, get_option( 'mfrh_update_postmeta', true ), false ) . '/>';
341
- $html .= __( '<label>Enabled</label><br /><small>Update the references in the <b>custom fields</b> of the posts (including pages and custom types metadata).</small>', 'media-file-renamer' );
 
 
 
 
 
 
342
  echo $html;
343
  }
344
 
@@ -346,7 +380,14 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
346
  $value = get_option( 'mfrh_update_posts', true );
347
  $html = '<input type="checkbox" id="mfrh_update_posts" name="mfrh_update_posts" value="1" ' .
348
  checked( 1, get_option( 'mfrh_update_posts', true ), false ) . '/>';
349
- $html .= __( '<label>Enabled</label><br /><small>Update the references to the renamed files in the <b>content</b> and <b>excerpt</b> of the posts (pages and custom types included).</small>', 'media-file-renamer' );
 
 
 
 
 
 
 
350
  echo $html;
351
  }
352
 
@@ -354,7 +395,8 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
354
  $value = get_option( 'mfrh_rename_on_save', null );
355
  $html = '<input type="checkbox" id="mfrh_rename_on_save" name="mfrh_rename_on_save" value="1" ' .
356
  checked( 1, get_option( 'mfrh_rename_on_save' ), false ) . '/>';
357
- $html .= __( '<label>Enabled (NOT RECOMMENDED)</label><br/><small>You can modify the titles of your media while editing a post but, of course, the plugin can\'t update the HTML at this stage. With this option, the plugin will update the filenames and HTML after that you saved the post.', 'media-file-renamer' );
 
358
  echo $html;
359
  }
360
 
@@ -362,7 +404,8 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
362
  $value = get_option( 'mfrh_force_rename', false );
363
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_force_rename" name="mfrh_force_rename" value="1" ' .
364
  checked( 1, get_option( 'mfrh_force_rename' ), false ) . '/>';
365
- $html .= __( '<label>Enabled</label><br/><small>Update the references to the file even if the file renaming itself was not successful. You might want to use that option if your install is broken and you are trying to link your Media to files for which the filenames has been altered (after a migration for exemple)</small>', 'media-file-renamer' );
 
366
  echo $html;
367
  }
368
 
@@ -370,7 +413,13 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
370
  $value = get_option( 'mfrh_log', null );
371
  $html = '<input type="checkbox" id="mfrh_log" name="mfrh_log" value="1" ' .
372
  checked( 1, get_option( 'mfrh_log' ), false ) . '/>';
373
- $html .= __( '<label>Enabled</label><br/><small>Simple logging that explains which actions has been run.<br />The file is <a target="_blank" href="' . plugin_dir_url( __FILE__ ) . 'media-file-renamer.log">media-file-renamer.log</a>.</small>', 'media-file-renamer' );
 
 
 
 
 
 
374
  echo $html;
375
  }
376
 
@@ -378,7 +427,14 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
378
  $value = get_option( 'mfrh_logsql', null );
379
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_logsql" name="mfrh_logsql" value="1" ' .
380
  checked( 1, get_option( 'mfrh_logsql' ), false ) . '/>';
381
- $html .= __( '<label>Enabled</label><br/><small>The files <a target="_blank" href="' . plugin_dir_url( __FILE__ ) . 'mfrh_sql.log">mfrh_sql.log</a> and <a target="_blank" href="' . plugin_dir_url( __FILE__ ) . 'mfrh_sql_revert.log">mfrh_sql_revert.log</a> will be created and they will include the raw SQL queries which were run by the plugin. If there is an issue, the revert file can help you reverting the changes more easily.</small>', 'media-file-renamer' );
 
 
 
 
 
 
 
382
  echo $html;
383
  }
384
 
165
  <div class="meow-box meow-col meow-span_2_of_2">
166
  <h3>How to use</h3>
167
  <div class="inside">
168
+ <?php
169
+ printf(
170
+ /* Translators: %s: link to tutorial */
171
+ esc_html__( 'This plugin works out of the box, the default settings are the best for most installs. However, you should have a look at the %s.', 'media-file-renamer' ),
172
+ '<a target="_blank" href="https://meowapps.com/media-file-renamer/">' . esc_html__( 'tutorial', 'media-file-renamer' ) . '</a>'
173
+ );
174
+ ?>
175
  <p class="submit">
176
  <a class="button button-primary" href="upload.php?page=rename_media_files">
177
+ <?php esc_html_e( "Access the Renamer Dashboard", 'media-file-renamer' ); ?>
178
  </a>
179
  </p>
180
  </div>
253
  $value = get_option( 'mfrh_rename_slug', null );
254
  $html = '<input type="checkbox" id="mfrh_rename_slug" name="mfrh_rename_slug" value="1" ' .
255
  checked( 1, get_option( 'mfrh_rename_slug' ), false ) . '/>';
256
+ $html .= '<label>' .esc_html__( 'Update slug with filename', 'media-file-renamer' ). '</label><br />';
257
+ $html .= '<small>' .esc_html__( 'Better to keep this un-checked as the link might have been referenced somewhere else.', 'media-file-renamer' ). '</small>';
258
  echo $html;
259
  }
260
 
261
  function admin_convert_to_ascii_callback( $args ) {
262
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_convert_to_ascii" name="mfrh_convert_to_ascii" value="1" ' .
263
  checked( 1, apply_filters( 'mfrh_converts', false ), false ) . '/>';
264
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
265
+ $html .= '<small>' .esc_html__( 'Replace accents, umlauts, cyrillic, diacritics, by their ASCII equivalent.', 'media-file-renamer' )
266
+ .'<br /><i>' .esc_html__( 'Examples: ', 'media-file-renamer' ). 'tête -> tete, schön -> schon, Добро -> dobro, etc.</i></small>';
267
  echo $html;
268
  }
269
 
270
  function admin_manual_rename_callback( $args ) {
271
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_manual_rename" name="mfrh_manual_rename" value="1" ' .
272
  checked( 1, apply_filters( 'mfrh_manual', false ), false ) . '/>';
273
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
274
+ $html .= '<small>' .esc_html__( 'Manual field will be enabled in the Media Library and the Media Edit Screen.', 'media-file-renamer' ). '</small>';
275
  echo $html;
276
  }
277
 
278
  function admin_numbered_files_callback( $args ) {
279
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_numbered_files" name="mfrh_numbered_files" value="1" ' .
280
  checked( 1, apply_filters( 'mfrh_numbered', false ), false ) . '/>';
281
+ $html .= '<label>' .esc_html__( 'Enable Numbering', 'media-file-renamer' ). '</label><br />';
282
+ $html .= '<small>' .esc_html__( 'Identical filenames will be allowed by the plugin and a number will be appended automatically (myfile.jpg, myfile-2.jpg, myfile-3.jpg, etc).', 'media-file-renamer' ). '</small>';
283
  echo $html;
284
  }
285
 
286
  function admin_rename_guid_callback( $args ) {
287
  $html = '<input type="checkbox" id="mfrh_rename_guid" name="mfrh_rename_guid" value="1" ' .
288
  checked( 1, get_option( 'mfrh_rename_guid' ), false ) . '/>';
289
+ $html .= '<label>' .esc_html__( 'Update GUID with Filename', 'media-file-renamer' ). '</label><br />';
290
+ $html .= '<small>' .esc_html__( 'The GUID will be renamed like the new filename. Better to keep this un-checked.', 'media-file-renamer' ). '</small>';
291
  echo $html;
292
  }
293
 
300
  $what = __( "Title of Media", 'media-file-renamer' );
301
  else if ( $method == "post_title" )
302
  $what = __( "Attached Post Title", 'media-file-renamer' );
303
+ $label = sprintf(
304
+ /* Translators: %1$s: update target name, %2$s: update resourse name */
305
+ esc_html__( 'Update %1$s with %2$s', 'media-file-renamer' ),
306
+ esc_html__( 'ALT', 'media-file-renamer' ),
307
+ '<b>' .$what. '</b>'
308
+ );
309
+ $html .= '<label>' .$label. '</label><br />';
310
+ $html .= '<small>' .esc_html__( 'Keep in mind that the HTML of your posts and pages WILL NOT be modified, as that is simply too dangerous for a plug-in.', 'media-file-renamer' ). '</small>';
311
  echo $html;
312
  }
313
 
320
  $what = __( "Media ALT", 'media-file-renamer' );
321
  else if ( $method == "post_title" )
322
  $what = __( "Attached Post Title", 'media-file-renamer' );
323
+ $label = sprintf(
324
+ /* Translators: %1$s: update target name, %2$s: update resourse name */
325
+ esc_html__( 'Update %1$s with %2$s', 'media-file-renamer' ),
326
+ esc_html__( 'Media Title', 'media-file-renamer' ),
327
+ '<b>' .$what. '</b>'
328
+ );
329
+ $html .= '<label>' .$label. '</label><br />';
330
+ $html .= '<small>' .esc_html__( 'Keep in mind that the HTML of your posts and pages WILL NOT be modified, as that is simply too dangerous for a plug-in.', 'media-file-renamer' ). '</small>';
331
  echo $html;
332
  }
333
 
334
  function admin_undo_callback( $args ) {
335
  $html = '<input type="checkbox" id="mfrh_undo" name="mfrh_undo" value="1" ' .
336
  checked( 1, get_option( 'mfrh_undo', false ), false ) . '/>';
337
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
338
+ $html .= '<small>' .esc_html__( 'A little undo icon will be added in the Rename column (Media Library). When clicked, the filename will be renamed back to the original.', 'media-file-renamer' ). '</small>';
339
  echo $html;
340
  }
341
 
357
  function admin_on_upload_callback( $args ) {
358
  $html = '<input type="checkbox" id="mfrh_on_upload" name="mfrh_on_upload" value="1" ' .
359
  checked( 1, get_option( 'mfrh_on_upload', false ), false ) . '/>';
360
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
361
+ $html .= '<small>' .esc_html__( 'During upload, the filename will be renamed based on the title of the media if there is any EXIF with the file. Otherwise, it will optimize the upload filename.', 'media-file-renamer' ). '</small>';
362
  echo $html;
363
  }
364
 
366
  $value = get_option( 'mfrh_update_postmeta', true );
367
  $html = '<input type="checkbox" id="mfrh_update_postmeta" name="mfrh_update_postmeta" value="1" ' .
368
  checked( 1, get_option( 'mfrh_update_postmeta', true ), false ) . '/>';
369
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
370
+ $desc = sprintf(
371
+ /* Translators: %s: custom fields */
372
+ esc_html__( 'Update the references in the %s of the posts (including pages and custom types metadata).', 'media-file-renamer' ),
373
+ '<b>'.esc_html__( 'custom fields', 'media-file-renamer' ).'</b>'
374
+ );
375
+ $html .= '<small>' .$desc. '</small>';
376
  echo $html;
377
  }
378
 
380
  $value = get_option( 'mfrh_update_posts', true );
381
  $html = '<input type="checkbox" id="mfrh_update_posts" name="mfrh_update_posts" value="1" ' .
382
  checked( 1, get_option( 'mfrh_update_posts', true ), false ) . '/>';
383
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
384
+ $desc = sprintf(
385
+ /* Translators: %1$s: content, %2$s: excerpt, */
386
+ esc_html__( 'Update the references to the renamed files in the %1$s and %2$s of the posts (pages and custom types included).', 'media-file-renamer' ),
387
+ '<b>'.esc_html__( 'content', 'media-file-renamer' ).'</b>',
388
+ '<b>'.esc_html__( 'excerpt', 'media-file-renamer' ).'</b>'
389
+ );
390
+ $html .= '<small>' .$desc. '</small>';
391
  echo $html;
392
  }
393
 
395
  $value = get_option( 'mfrh_rename_on_save', null );
396
  $html = '<input type="checkbox" id="mfrh_rename_on_save" name="mfrh_rename_on_save" value="1" ' .
397
  checked( 1, get_option( 'mfrh_rename_on_save' ), false ) . '/>';
398
+ $html .= '<label>' .esc_html__( 'Enable (NOT RECOMMENDED)', 'media-file-renamer' ). '</label><br />';
399
+ $html .= '<small>' .esc_html__( 'You can modify the titles of your media while editing a post but, of course, the plugin can\'t update the HTML at this stage. With this option, the plugin will update the filenames and HTML after that you saved the post.', 'media-file-renamer' ). '</small>';
400
  echo $html;
401
  }
402
 
404
  $value = get_option( 'mfrh_force_rename', false );
405
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_force_rename" name="mfrh_force_rename" value="1" ' .
406
  checked( 1, get_option( 'mfrh_force_rename' ), false ) . '/>';
407
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
408
+ $html .= '<small>' .esc_html__( 'Update the references to the file even if the file renaming itself was not successful. You might want to use that option if your install is broken and you are trying to link your Media to files for which the filenames has been altered (after a migration for exemple)', 'media-file-renamer' ). '</small>';
409
  echo $html;
410
  }
411
 
413
  $value = get_option( 'mfrh_log', null );
414
  $html = '<input type="checkbox" id="mfrh_log" name="mfrh_log" value="1" ' .
415
  checked( 1, get_option( 'mfrh_log' ), false ) . '/>';
416
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
417
+ $desc = sprintf(
418
+ /* Translators: %s: link to media-file-renamer.log */
419
+ esc_html__( 'Simple logging that explains which actions has been run. The file is %s.', 'media-file-renamer' ),
420
+ '<a target="_blank" href="' . plugin_dir_url( __FILE__ ) . 'media-file-renamer.log">media-file-renamer.log</a>'
421
+ );
422
+ $html .= '<small>' .$desc. '</small>';
423
  echo $html;
424
  }
425
 
427
  $value = get_option( 'mfrh_logsql', null );
428
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_logsql" name="mfrh_logsql" value="1" ' .
429
  checked( 1, get_option( 'mfrh_logsql' ), false ) . '/>';
430
+ $html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
431
+ $desc = sprintf(
432
+ /* Translators: %1$s: link to mfrh_sql.log, %2$s: link to mfrh_sql_revert.log */
433
+ esc_html__( 'The files %1$s and %2$s will be created and they will include the raw SQL queries which were run by the plugin. If there is an issue, the revert file can help you reverting the changes more easily.', 'media-file-renamer' ),
434
+ '<a target="_blank" href="' . plugin_dir_url( __FILE__ ) . 'mfrh_sql.log">mfrh_sql.log</a>',
435
+ '<a target="_blank" href="' . plugin_dir_url( __FILE__ ) . 'mfrh_sql_revert.log">mfrh_sql_revert.log</a>'
436
+ );
437
+ $html .= '<small>' .$desc. '</small>';
438
  echo $html;
439
  }
440
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: TigrouMeow, amekusa
3
  Tags: rename, file, files, media, manager, image, renamer, wpml, optimization, seo, retina, gutenberg
4
  Requires at least: 4.8
5
- Tested up to: 4.9.8
6
- Stable tag: 4.2.8
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
@@ -47,6 +47,10 @@ Check the FAQ on the official website, [here](https://meowapps.com/media-file-re
47
 
48
  == Changelog ==
49
 
 
 
 
 
50
  = 4.2.8 =
51
  * Fix: Better support for Real Media Library.
52
  * Update: Improved transliteration.
2
  Contributors: TigrouMeow, amekusa
3
  Tags: rename, file, files, media, manager, image, renamer, wpml, optimization, seo, retina, gutenberg
4
  Requires at least: 4.8
5
+ Tested up to: 5.0
6
+ Stable tag: 4.4.0
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
47
 
48
  == Changelog ==
49
 
50
+ = 4.4.0 =
51
+ * Update: Compatibility with WP 5.0.
52
+ * Update: Compatibility with Real Media Library.
53
+
54
  = 4.2.8 =
55
  * Fix: Better support for Real Media Library.
56
  * Update: Improved transliteration.
views/menu-screen.php CHANGED
@@ -18,7 +18,7 @@
18
  <h2>Rename in Bulk</h2>
19
 
20
  <p>
21
- <?php _e( 'You might have noticed that some of your media are locked by the file renamer, others are unlocked. Automatically, the plugin locks the media you renamed manually. By default, they are unlocked. Here, you have the choice of rename all the media in your DB or only the ones which are unlocked (to keep the files you renamed manually). <span style="color: red; font-weight: bold;">Please backup your uploads folder + DB before using this.</span> If you don\'t know how, give a try to this backup service: <a href="https://meow.click/blogvault" target="_blank">BlogVault</a>.', 'media-file-renamer' ); ?>
22
  </p>
23
 
24
  <div style='margin-top: 12px; background: #FFF; padding: 5px; border-radius: 4px; height: 28px; box-shadow: 0px 0px 6px #C2C2C2;'>
@@ -104,12 +104,12 @@
104
 
105
  <a href="?page=rename_media_files&mfrh_beforeafter_filenames" class='button-primary' style='margin-right: 0px;'>
106
  <span class="dashicons dashicons-media-spreadsheet" style="position: relative; top: 3px; left: -2px;"></span>
107
- <?php echo _e( "Display Filenames", 'media-file-renamer' ); ?>
108
  </a>
109
 
110
  <a onclick="mfrh_export_table('#mfrh-before-after')" class='button-primary' style='margin-right: 0px; float: right;'>
111
  <span class="dashicons dashicons-arrow-down-alt" style="position: relative; top: 3px; left: -2px;"></span>
112
- <?php echo _e( "Export as CSV", 'media-file-renamer' ); ?>
113
  </a>
114
 
115
  </div>
18
  <h2>Rename in Bulk</h2>
19
 
20
  <p>
21
+ <?php _e( 'You might have noticed that some of your media are locked by the file renamer, others are unlocked. Automatically, the plugin locks the media you renamed manually. By default, they are unlocked. Here, you have the choice of rename all the media in your DB or only the ones which are unlocked (to keep the files you renamed manually). <span style="color: red; font-weight: bold;">Please backup your uploads folder + DB before using this.</span> If you don\'t know how, give a try to this: <a href="https://meow.click/blogvault" target="_blank">BlogVault</a>.', 'media-file-renamer' ); ?>
22
  </p>
23
 
24
  <div style='margin-top: 12px; background: #FFF; padding: 5px; border-radius: 4px; height: 28px; box-shadow: 0px 0px 6px #C2C2C2;'>
104
 
105
  <a href="?page=rename_media_files&mfrh_beforeafter_filenames" class='button-primary' style='margin-right: 0px;'>
106
  <span class="dashicons dashicons-media-spreadsheet" style="position: relative; top: 3px; left: -2px;"></span>
107
+ <?php esc_html_e( "Display Filenames", 'media-file-renamer' ); ?>
108
  </a>
109
 
110
  <a onclick="mfrh_export_table('#mfrh-before-after')" class='button-primary' style='margin-right: 0px; float: right;'>
111
  <span class="dashicons dashicons-arrow-down-alt" style="position: relative; top: 3px; left: -2px;"></span>
112
+ <?php esc_html_e( "Export as CSV", 'media-file-renamer' ); ?>
113
  </a>
114
 
115
  </div>