Media File Renamer - Version 3.7.0

Version Description

  • Update: Improved Rename on Upload.
  • Fix: Annoying warning (but it was not causing any error).
Download this release

Release Info

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

Code changes from version 3.6.8 to 3.7.0

Files changed (5) hide show
  1. common/admin.php +10 -4
  2. core.php +55 -43
  3. media-file-renamer.php +2 -2
  4. mfrh_admin.php +3 -9
  5. readme.txt +8 -1
common/admin.php CHANGED
@@ -19,6 +19,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
19
  add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
20
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
21
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
 
22
  }
23
  MeowApps_Admin::$loaded = true;
24
  }
@@ -42,6 +43,11 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
42
  }
43
  }
44
 
 
 
 
 
 
45
  function show_meowapps_create_rating_date() {
46
  delete_option( 'meowapps_hide_meowapps' );
47
  $this->create_rating_date();
@@ -77,8 +83,8 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
77
  return;
78
  }
79
  $rating_date = get_option( $this->prefix . '_rating_date' );
80
- echo '<div class="notice notice-success" data-rating-date="' . $rating_date . '>';
81
- echo '<p style="font-size: 120%;">You have been using <b>' . $this->nice_name_from_file( $this->mainfile ) . '</b> for some time now. If you enjoy it, could you share your thoughts and give the developers a sweet spike of motivation? In that case, please: <a target="_blank" href="https://wordpress.org/support/plugin/' . $this->nice_short_url_from_file( $this->mainfile ) . '/reviews/?rate=5#new-post">review it</a>. Thank you :)';
82
  echo '<p>
83
  <form method="post" action="" style="float: right;">
84
  <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
@@ -196,7 +202,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
196
  $value = get_option( 'meowapps_hide_ads', null );
197
  $html = '<input type="checkbox" id="meowapps_hide_ads" name="meowapps_hide_ads" value="1" ' .
198
  checked( 1, get_option( 'meowapps_hide_ads' ), false ) . '/>';
199
- $html .= __( '<label>Hide</label><br /><small>Doesn\'t display the ads.</small>', 'wp-retina-2x' );
200
  echo $html;
201
  }
202
 
@@ -204,7 +210,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
204
  $value = get_option( 'meowapps_hide_meowapps', null );
205
  $html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
206
  checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
207
- $html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a nicer an faster WordPress admin UI. An option will be added in Settings > General to display it again.</small>', 'wp-retina-2x' );
208
  echo $html;
209
  }
210
 
19
  add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
20
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
21
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
22
+ add_filter( 'updraftplus_com_link', array( $this, 'updraftplus_com_link' ) );
23
  }
24
  MeowApps_Admin::$loaded = true;
25
  }
43
  }
44
  }
45
 
46
+ function updraftplus_com_link( $url ) {
47
+ $url = $url . "?afref=460";
48
+ return $url;
49
+ }
50
+
51
  function show_meowapps_create_rating_date() {
52
  delete_option( 'meowapps_hide_meowapps' );
53
  $this->create_rating_date();
83
  return;
84
  }
85
  $rating_date = get_option( $this->prefix . '_rating_date' );
86
+ echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
87
+ echo '<p style="font-size: 100%;">You have been using <b>' . $this->nice_name_from_file( $this->mainfile ) . '</b> for some time now. If you enjoy it, could you share your thoughts and give the developers a sweet spike of motivation? In that case, please: <a target="_blank" href="https://wordpress.org/support/plugin/' . $this->nice_short_url_from_file( $this->mainfile ) . '/reviews/?rate=5#new-post">review it</a>. Thank you :)';
88
  echo '<p>
89
  <form method="post" action="" style="float: right;">
90
  <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
202
  $value = get_option( 'meowapps_hide_ads', null );
203
  $html = '<input type="checkbox" id="meowapps_hide_ads" name="meowapps_hide_ads" value="1" ' .
204
  checked( 1, get_option( 'meowapps_hide_ads' ), false ) . '/>';
205
+ $html .= __( '<label>Hide</label><br /><small>Doesn\'t display the ads.</small>', 'meowapps' );
206
  echo $html;
207
  }
208
 
210
  $value = get_option( 'meowapps_hide_meowapps', null );
211
  $html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
212
  checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
213
+ $html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a nicer an faster WordPress admin UI. An option will be added in Settings > General to display it again.</small>', 'meowapps' );
214
  echo $html;
215
  }
216
 
core.php CHANGED
@@ -397,6 +397,8 @@ class Meow_MFRH_Core {
397
  }
398
 
399
  function wp_handle_upload_prefilter( $file ) {
 
 
400
  $method = apply_filters( 'mfrh_method', 'media_title' );
401
  if ( $method == 'media_title' ) {
402
  $exif = wp_read_image_metadata( $file['tmp_name'] );
@@ -406,6 +408,10 @@ class Meow_MFRH_Core {
406
  return $file;
407
  }
408
  }
 
 
 
 
409
  return $file;
410
  }
411
 
@@ -820,8 +826,9 @@ class Meow_MFRH_Core {
820
  function log( $data, $inErrorLog = false ) {
821
  if ( $inErrorLog )
822
  error_log( $data );
823
- if ( !get_option( 'mfrh_log' ) )
824
  return;
 
825
  $fh = fopen( trailingslashit( dirname(__FILE__) ) . 'media-file-renamer.log', 'a' );
826
  $date = date( "Y-m-d H:i:s" );
827
  fwrite( $fh, "$date: {$data}\n" );
@@ -859,17 +866,30 @@ class Meow_MFRH_Core {
859
  // NEW MEDIA FILE INFO (depending on the title of the media)
860
  function new_filename( $media, $title, $forceFilename = null ) {
861
 
862
- // Clean the title
863
- $title = str_replace( ".jpg", "", $title );
864
- $title = str_replace( ".png", "", $title );
865
- $title = str_replace( "'", "-", $title );
 
 
 
 
 
 
866
 
867
- // Filename is forced (in case of manual, for example)
868
- if ( $forceFilename )
869
- $forceFilename = preg_replace( '/\\.[^.\\s]{3,4}$/', '', trim( $forceFilename ) );
870
- if ( !empty( $forceFilename ) )
 
 
871
  $new_filename = $forceFilename;
 
872
  else {
 
 
 
 
873
  $title = strtolower( $this->replace_chars( $title ) );
874
  $utf8_filename = apply_filters( 'mfrh_utf8', false );
875
  if ( $utf8_filename )
@@ -877,25 +897,12 @@ class Meow_MFRH_Core {
877
  else
878
  $new_filename = str_replace( "%", "-", sanitize_title( $this->replace_special_chars( $title ) ) );
879
  }
880
-
881
- if ( !empty( $media ) ) {
882
- $old_filepath = get_attached_file( $media['ID'] );
883
- $path_parts = pathinfo( $old_filepath );
884
- $old_filename = $path_parts['basename'];
885
- // This line is problematic during the further rename that exclude the extensions. Better to implement
886
- // this properly with thorough testing later.
887
- //$ext = str_replace( 'jpeg', 'jpg', $path_parts['extension'] ); // In case of a jpeg extension, rename it to jpg
888
- $ext = $path_parts['extension'];
889
- }
890
- else {
891
- // New upload, a filename without extension will be returned
892
- $old_filename = null;
893
- $ext = null;
894
- }
895
-
896
  if ( empty( $new_filename ) )
897
  $new_filename = "empty";
898
- $new_filename = !empty( $ext ) ? ( $new_filename . '.' . $ext ) : $new_filename;
 
 
 
899
  if ( !$forceFilename )
900
  $new_filename = apply_filters( 'mfrh_new_filename', $new_filename, $old_filename, $media );
901
  return $new_filename;
@@ -941,9 +948,7 @@ class Meow_MFRH_Core {
941
 
942
  $numbered_filename = get_post_meta( $post['ID'], '_numbered_filename', true );
943
  if ( !empty( $numbered_filename ) ) {
944
- // TODO: Why was this done...
945
- // $this->log( "Numbered filename ($numbered_filename) is being injected." );
946
- // $forceFilename = $numbered_filename;
947
  delete_post_meta( $post['ID'], '_numbered_filename' );
948
  }
949
 
@@ -955,11 +960,6 @@ class Meow_MFRH_Core {
955
  $old_filename = $path_parts['basename']; // 'whatever.jpeg'
956
  $old_ext = $path_parts['extension'];
957
 
958
- // This line is problematic during the further rename that exclude the extensions. Better to implement
959
- // this properly with thorough testing later.
960
- //$ext = str_replace( 'jpeg', 'jpg', $path_parts['extension'] ); // In case of a jpeg extension, rename it to jpg
961
- $ext = $path_parts['extension'];
962
-
963
  $this->log( "** Rename Media: " . $old_filename );
964
 
965
  // If this is being renamed based on the post the media is attached to.
@@ -1046,8 +1046,6 @@ class Meow_MFRH_Core {
1046
  }
1047
  }
1048
 
1049
- //return;
1050
-
1051
  // Exact same code as rename-media, it's a good idea to keep track of the original filename.
1052
  $original_filename = get_post_meta( $post['ID'], '_original_filename', true );
1053
  if ( empty( $original_filename ) )
@@ -1066,18 +1064,26 @@ class Meow_MFRH_Core {
1066
  return $post;
1067
  }
1068
 
 
 
 
 
 
 
 
1069
  // Filenames without extensions
1070
  $noext_old_filename = $this->str_replace( '.' . $old_ext, '', $old_filename );
1071
- $noext_new_filename = $this->str_replace( '.' . $ext, '', $sanitized_media_title );
1072
  $this->log( "Files with no extensions: $noext_old_filename and $noext_new_filename." );
1073
 
1074
  // Update the attachment meta
1075
  if ( $meta ) {
1076
- $meta['file'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['file'] );
1077
- if ( isset( $meta["url"] ) && $meta["url"] != "" && count( $meta["url"] ) > 4 )
1078
- $meta["url"] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta["url"] );
 
1079
  else
1080
- $meta["url"] = $noext_new_filename . "." . $ext;
1081
  }
1082
 
1083
  // Images
@@ -1096,6 +1102,12 @@ class Meow_MFRH_Core {
1096
  $meta_old_filename = $meta['sizes'][$size]['file'];
1097
  $meta_old_filepath = trailingslashit( $directory ) . $meta_old_filename;
1098
  $meta_new_filename = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta_old_filename );
 
 
 
 
 
 
1099
  $meta_new_filepath = trailingslashit( $directory ) . $meta_new_filename;
1100
  $orig_image_data = wp_get_attachment_image_src( $post['ID'], $size );
1101
  $orig_image_urls[$size] = $orig_image_data[0];
@@ -1104,8 +1116,8 @@ class Meow_MFRH_Core {
1104
  || is_writable( $meta_new_filepath ) ) ) ) {
1105
  // WP Retina 2x is detected, let's rename those files as well
1106
  if ( function_exists( 'wr2x_get_retina' ) ) {
1107
- $wr2x_old_filepath = $this->str_replace( '.' . $ext, '@2x.' . $ext, $meta_old_filepath );
1108
- $wr2x_new_filepath = $this->str_replace( '.' . $ext, '@2x.' . $ext, $meta_new_filepath );
1109
  if ( file_exists( $wr2x_old_filepath ) && ( (!file_exists( $wr2x_new_filepath ) ) || is_writable( $wr2x_new_filepath ) ) ) {
1110
  @rename( $wr2x_old_filepath, $wr2x_new_filepath );
1111
  $this->log( "Retina file $wr2x_old_filepath renamed to $wr2x_new_filepath." );
397
  }
398
 
399
  function wp_handle_upload_prefilter( $file ) {
400
+
401
+ // If everything's fine, renames in based on the Title in the EXIF
402
  $method = apply_filters( 'mfrh_method', 'media_title' );
403
  if ( $method == 'media_title' ) {
404
  $exif = wp_read_image_metadata( $file['tmp_name'] );
408
  return $file;
409
  }
410
  }
411
+
412
+ // Otherwise, let's do the basics based on the filename
413
+ $pp = pathinfo( $file['name'] );
414
+ $file['name'] = $this->new_filename( null, $pp['basename'] );
415
  return $file;
416
  }
417
 
826
  function log( $data, $inErrorLog = false ) {
827
  if ( $inErrorLog )
828
  error_log( $data );
829
+ if ( !get_option( 'mfrh_log' ) ) {
830
  return;
831
+ }
832
  $fh = fopen( trailingslashit( dirname(__FILE__) ) . 'media-file-renamer.log', 'a' );
833
  $date = date( "Y-m-d H:i:s" );
834
  fwrite( $fh, "$date: {$data}\n" );
866
  // NEW MEDIA FILE INFO (depending on the title of the media)
867
  function new_filename( $media, $title, $forceFilename = null ) {
868
 
869
+ $old_filename = null;
870
+ $new_ext = null;
871
+
872
+ // Media already exists (not a fresh upload). Gets filename and ext.
873
+ if ( !empty( $media ) ) {
874
+ $old_filepath = get_attached_file( $media['ID'] );
875
+ $pp = pathinfo( $old_filepath );
876
+ $old_filename = $pp['basename'];
877
+ $new_ext = $pp['extension'];
878
+ }
879
 
880
+ // Generate the new filename.
881
+ if ( !empty( $forceFilename ) ) {
882
+ // Filename is forced. Strip the extension. Keeps this extension in $new_ext.
883
+ $pp = pathinfo( $forceFilename );
884
+ $forceFilename = $pp['filename'];
885
+ $new_ext = empty( $pp['extension'] ) ? $new_ext : $pp['extension'];
886
  $new_filename = $forceFilename;
887
+ }
888
  else {
889
+ // Filename is generated from $title, without an extension.
890
+ $title = str_replace( ".jpg", "", $title );
891
+ $title = str_replace( ".png", "", $title );
892
+ $title = str_replace( "'", "-", $title );
893
  $title = strtolower( $this->replace_chars( $title ) );
894
  $utf8_filename = apply_filters( 'mfrh_utf8', false );
895
  if ( $utf8_filename )
897
  else
898
  $new_filename = str_replace( "%", "-", sanitize_title( $this->replace_special_chars( $title ) ) );
899
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
900
  if ( empty( $new_filename ) )
901
  $new_filename = "empty";
902
+
903
+ // We know have a new filename, let's add an extension.
904
+ $new_filename = !empty( $new_ext ) ? ( $new_filename . '.' . $new_ext ) : $new_filename;
905
+
906
  if ( !$forceFilename )
907
  $new_filename = apply_filters( 'mfrh_new_filename', $new_filename, $old_filename, $media );
908
  return $new_filename;
948
 
949
  $numbered_filename = get_post_meta( $post['ID'], '_numbered_filename', true );
950
  if ( !empty( $numbered_filename ) ) {
951
+ // Not clear anymore why this is here, but it wouldn't cause any issue anyway.
 
 
952
  delete_post_meta( $post['ID'], '_numbered_filename' );
953
  }
954
 
960
  $old_filename = $path_parts['basename']; // 'whatever.jpeg'
961
  $old_ext = $path_parts['extension'];
962
 
 
 
 
 
 
963
  $this->log( "** Rename Media: " . $old_filename );
964
 
965
  // If this is being renamed based on the post the media is attached to.
1046
  }
1047
  }
1048
 
 
 
1049
  // Exact same code as rename-media, it's a good idea to keep track of the original filename.
1050
  $original_filename = get_post_meta( $post['ID'], '_original_filename', true );
1051
  if ( empty( $original_filename ) )
1064
  return $post;
1065
  }
1066
 
1067
+ // The new extension (or maybe it's just the old one)
1068
+ $new_ext = $old_ext;
1069
+ if ( $forceFilename ) {
1070
+ $pp = pathinfo( $forceFilename );
1071
+ $new_ext = $pp['extension'];
1072
+ }
1073
+
1074
  // Filenames without extensions
1075
  $noext_old_filename = $this->str_replace( '.' . $old_ext, '', $old_filename );
1076
+ $noext_new_filename = $this->str_replace( '.' . $old_ext, '', $sanitized_media_title );
1077
  $this->log( "Files with no extensions: $noext_old_filename and $noext_new_filename." );
1078
 
1079
  // Update the attachment meta
1080
  if ( $meta ) {
1081
+ if ( isset( $meta['file'] ) && !empty( $meta['file'] ) )
1082
+ $meta['file'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['file'] );
1083
+ if ( isset( $meta['url'] ) && !empty( $meta['url'] ) && count( $meta['url'] ) > 4 )
1084
+ $meta['url'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['url'] );
1085
  else
1086
+ $meta['url'] = $noext_new_filename . '.' . $old_ext;
1087
  }
1088
 
1089
  // Images
1102
  $meta_old_filename = $meta['sizes'][$size]['file'];
1103
  $meta_old_filepath = trailingslashit( $directory ) . $meta_old_filename;
1104
  $meta_new_filename = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta_old_filename );
1105
+
1106
+ // Manual Rename also uses the new extension (if it was not stripped to avoid user mistake)
1107
+ if ( $force_rename && !empty( $new_ext ) ) {
1108
+ $meta_new_filename = $this->str_replace( $old_ext, $new_ext, $meta_new_filename );
1109
+ }
1110
+
1111
  $meta_new_filepath = trailingslashit( $directory ) . $meta_new_filename;
1112
  $orig_image_data = wp_get_attachment_image_src( $post['ID'], $size );
1113
  $orig_image_urls[$size] = $orig_image_data[0];
1116
  || is_writable( $meta_new_filepath ) ) ) ) {
1117
  // WP Retina 2x is detected, let's rename those files as well
1118
  if ( function_exists( 'wr2x_get_retina' ) ) {
1119
+ $wr2x_old_filepath = $this->str_replace( '.' . $old_ext, '@2x.' . $old_ext, $meta_old_filepath );
1120
+ $wr2x_new_filepath = $this->str_replace( '.' . $new_ext, '@2x.' . $new_ext, $meta_new_filepath );
1121
  if ( file_exists( $wr2x_old_filepath ) && ( (!file_exists( $wr2x_new_filepath ) ) || is_writable( $wr2x_new_filepath ) ) ) {
1122
  @rename( $wr2x_old_filepath, $wr2x_new_filepath );
1123
  $this->log( "Retina file $wr2x_old_filepath renamed to $wr2x_new_filepath." );
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: 3.6.8
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
@@ -29,7 +29,7 @@ if ( class_exists( 'Meow_MFRH_Core' ) ) {
29
  if ( is_admin() ) {
30
 
31
  global $mfrh_version, $mfrh_core;
32
- $mfrh_version = '3.6.8';
33
 
34
  // Admin
35
  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: 3.7.0
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
29
  if ( is_admin() ) {
30
 
31
  global $mfrh_version, $mfrh_core;
32
+ $mfrh_version = '3.7.0';
33
 
34
  // Admin
35
  require( 'mfrh_admin.php');
mfrh_admin.php CHANGED
@@ -9,15 +9,9 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
9
  if ( is_admin() ) {
10
  add_action( 'admin_menu', array( $this, 'app_menu' ) );
11
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
12
- add_filter( 'updraftplus_com_link', array( $this, 'updraftplus_com_link' ) );
13
  }
14
  }
15
 
16
- function updraftplus_com_link( $url ) {
17
- $url = $url . "?afref=460";
18
- return $url;
19
- }
20
-
21
  function admin_notices() {
22
  if ( isset( $_GET['reset'] ) ) {
23
  if ( file_exists( plugin_dir_path( __FILE__ ) . '/media-file-renamer.log' ) )
@@ -328,7 +322,7 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
328
  function admin_on_upload_callback( $args ) {
329
  $html = '<input type="checkbox" id="mfrh_on_upload" name="mfrh_on_upload" value="1" ' .
330
  checked( 1, get_option( 'mfrh_on_upload', false ), false ) . '/>';
331
- $html .= __( '<label>Enable</label><br /><small>During upload, the filename will be renamed based on the title of the media.</small>', 'media-file-renamer' );
332
  echo $html;
333
  }
334
 
@@ -376,7 +370,7 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
376
  $value = get_option( 'mfrh_log', null );
377
  $html = '<input type="checkbox" id="mfrh_log" name="mfrh_log" value="1" ' .
378
  checked( 1, get_option( 'mfrh_log' ), false ) . '/>';
379
- $html .= __( '<label>Enabled</label><br/><small>Simple logging that explains which actions has been run. The file is <a target="_blank" href="' . plugins_url("media-file-renamer") . '/media-file-renamer.log">media-file-renamer.log</a>.</small>', 'media-file-renamer' );
380
  echo $html;
381
  }
382
 
@@ -384,7 +378,7 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
384
  $value = get_option( 'mfrh_logsql', null );
385
  $html = '<input ' . disabled( $this->is_registered(), false, false ) . ' type="checkbox" id="mfrh_logsql" name="mfrh_logsql" value="1" ' .
386
  checked( 1, get_option( 'mfrh_logsql' ), false ) . '/>';
387
- $html .= __( '<label>Enabled</label><br/><small>The files <a target="_blank" href="' . plugins_url( "media-file-renamer" ) . '/mfrh_sql.log">mfrh_sql.log</a> and <a target="_blank" href="' . plugins_url( "media-file-renamer" ) . '/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' );
388
  echo $html;
389
  }
390
 
9
  if ( is_admin() ) {
10
  add_action( 'admin_menu', array( $this, 'app_menu' ) );
11
  add_action( 'admin_notices', array( $this, 'admin_notices' ) );
 
12
  }
13
  }
14
 
 
 
 
 
 
15
  function admin_notices() {
16
  if ( isset( $_GET['reset'] ) ) {
17
  if ( file_exists( plugin_dir_path( __FILE__ ) . '/media-file-renamer.log' ) )
322
  function admin_on_upload_callback( $args ) {
323
  $html = '<input type="checkbox" id="mfrh_on_upload" name="mfrh_on_upload" value="1" ' .
324
  checked( 1, get_option( 'mfrh_on_upload', false ), false ) . '/>';
325
+ $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' );
326
  echo $html;
327
  }
328
 
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. 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
  $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
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: TigrouMeow
3
  Tags: rename, file, media, management, image, renamer, wpml, wp-retina-2x
4
  Requires at least: 4.2
5
  Tested up to: 4.8
6
- Stable tag: 3.6.8
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
@@ -100,6 +100,13 @@ You are welcome to create plugins using Media File Renamer using special rules f
100
 
101
  == Changelog ==
102
 
 
 
 
 
 
 
 
103
  = 3.6.8 =
104
  * Add: Little API.
105
 
3
  Tags: rename, file, media, management, image, renamer, wpml, wp-retina-2x
4
  Requires at least: 4.2
5
  Tested up to: 4.8
6
+ Stable tag: 3.7.0
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
100
 
101
  == Changelog ==
102
 
103
+ = 3.7.0 =
104
+ * Update: Improved Rename on Upload.
105
+ * Fix: Annoying warning (but it was not causing any error).
106
+
107
+ = 3.6.9 =
108
+ * Update: Manual Rename allows a new extension.
109
+
110
  = 3.6.8 =
111
  * Add: Little API.
112