Media File Renamer - Version 3.5.4

Version Description

  • Add: mfrh_replace_rules filter allows you to personalize the renaming at the character level.
Download this release

Release Info

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

Code changes from version 3.5.2 to 3.5.4

Files changed (5) hide show
  1. common/admin.css +1 -1
  2. core.php +10 -0
  3. media-file-renamer.php +2 -2
  4. mfrh_custom.php +8 -1
  5. readme.txt +16 -2
common/admin.css CHANGED
@@ -16,7 +16,7 @@
16
  }
17
 
18
  .meow-box small {
19
- font-size: 11px !important;
20
  }
21
 
22
  .meow-box h3 {
16
  }
17
 
18
  .meow-box small {
19
+ font-size: 12px !important;
20
  }
21
 
22
  .meow-box h3 {
core.php CHANGED
@@ -642,6 +642,15 @@ class Meow_MFRH_Core {
642
  return $str;
643
  }
644
 
 
 
 
 
 
 
 
 
 
645
  // NEW MEDIA FILE INFO (depending on the title of the media)
646
  function new_filename( $media, $title, $forceFilename = null ) {
647
 
@@ -656,6 +665,7 @@ class Meow_MFRH_Core {
656
  if ( !empty( $forceFilename ) )
657
  $new_filename = $forceFilename;
658
  else {
 
659
  $utf8_filename = apply_filters( 'mfrh_utf8', false );
660
  if ( $utf8_filename )
661
  $new_filename = sanitize_file_name( $title );
642
  return $str;
643
  }
644
 
645
+ function replace_chars( $str ) {
646
+ $special_chars = array();
647
+ $special_chars = apply_filters( 'mfrh_replace_rules', $special_chars );
648
+ if ( !empty( $special_chars ) )
649
+ foreach ( $special_chars as $key => $value )
650
+ $str = str_replace( $key, $value, $str );
651
+ return $str;
652
+ }
653
+
654
  // NEW MEDIA FILE INFO (depending on the title of the media)
655
  function new_filename( $media, $title, $forceFilename = null ) {
656
 
665
  if ( !empty( $forceFilename ) )
666
  $new_filename = $forceFilename;
667
  else {
668
+ $title = $this->replace_chars( $title );
669
  $utf8_filename = apply_filters( 'mfrh_utf8', false );
670
  if ( $utf8_filename )
671
  $new_filename = sanitize_file_name( $title );
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.5.2
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
@@ -21,7 +21,7 @@ Originally developed for two of my websites:
21
  if ( is_admin() ) {
22
 
23
  global $mfrh_version;
24
- $mfrh_version = '3.5.2';
25
 
26
  // Admin
27
  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.5.4
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
21
  if ( is_admin() ) {
22
 
23
  global $mfrh_version;
24
+ $mfrh_version = '3.5.4';
25
 
26
  // Admin
27
  require( 'mfrh_admin.php');
mfrh_custom.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  // For help about this file, check:
4
- // http://apps.meow.fr/media-file-renamer/faq/
5
 
6
  // add_filter( 'mfrh_new_filename', 'add_hello_in_front_of_filenames', 10, 3 );
7
  //
@@ -21,4 +21,11 @@
21
  //
22
  // }
23
 
 
 
 
 
 
 
 
24
  ?>
1
  <?php
2
 
3
  // For help about this file, check:
4
+ // http://meowapps.com/media-file-renamer/faq/
5
 
6
  // add_filter( 'mfrh_new_filename', 'add_hello_in_front_of_filenames', 10, 3 );
7
  //
21
  //
22
  // }
23
 
24
+ // add_filter( 'mfrh_replace_rules', 'replace_s_by_z', 10, 1 );
25
+ //
26
+ // function replace_s_by_z( $rules ) {
27
+ // $rules['s'] = 'z';
28
+ // return $rules;
29
+ // }
30
+
31
  ?>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.7
6
- Stable tag: 3.5.2
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
@@ -53,6 +53,17 @@ function my_filter_filename( $new, $old, $post ) {
53
  }
54
  `
55
 
 
 
 
 
 
 
 
 
 
 
 
56
  **Update References**
57
 
58
  You can also update the references to the files or URLs which are renamed/modified by using the following filters. If you themes or another plugins are storing those references by yourself, then this is a chance to achieve this :)
@@ -89,6 +100,9 @@ You are welcome to create plugins using Media File Renamer using special rules f
89
 
90
  == Changelog ==
91
 
 
 
 
92
  = 3.5.2 =
93
  * Fix: Update system fixed and code cleaning.
94
 
2
  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.5.4
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
53
  }
54
  `
55
 
56
+ The mfrh_replace_rules filter is a bit simpler and allows you to customize specific characters or bit of strings, like with the example below.
57
+
58
+ `
59
+ add_filter( 'mfrh_replace_rules', 'replace_s_by_z', 10, 1 );
60
+
61
+ function replace_s_by_z( $rules ) {
62
+ $rules['s'] = 'z';
63
+ return $rules;
64
+ }
65
+ `
66
+
67
  **Update References**
68
 
69
  You can also update the references to the files or URLs which are renamed/modified by using the following filters. If you themes or another plugins are storing those references by yourself, then this is a chance to achieve this :)
100
 
101
  == Changelog ==
102
 
103
+ = 3.5.4 =
104
+ * Add: mfrh_replace_rules filter allows you to personalize the renaming at the character level.
105
+
106
  = 3.5.2 =
107
  * Fix: Update system fixed and code cleaning.
108