Version Description
- Fix: Rename on Upload issue in a few cases.
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Media File Renamer |
Version | 3.7.1 |
Comparing to | |
See all releases |
Code changes from version 3.7.0 to 3.7.1
- core.php +18 -10
- media-file-renamer.php +2 -2
- readme.txt +4 -1
core.php
CHANGED
@@ -410,8 +410,10 @@ class Meow_MFRH_Core {
|
|
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 |
|
@@ -863,18 +865,24 @@ class Meow_MFRH_Core {
|
|
863 |
return $str;
|
864 |
}
|
865 |
|
866 |
-
// NEW MEDIA FILE INFO (depending on the
|
867 |
-
function new_filename( $media, $
|
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.
|
@@ -886,16 +894,16 @@ class Meow_MFRH_Core {
|
|
886 |
$new_filename = $forceFilename;
|
887 |
}
|
888 |
else {
|
889 |
-
// Filename is generated from $
|
890 |
-
$
|
891 |
-
$
|
892 |
-
$
|
893 |
-
$
|
894 |
$utf8_filename = apply_filters( 'mfrh_utf8', false );
|
895 |
if ( $utf8_filename )
|
896 |
-
$new_filename = sanitize_file_name( $
|
897 |
else
|
898 |
-
$new_filename = str_replace( "%", "-", sanitize_title( $this->replace_special_chars( $
|
899 |
}
|
900 |
if ( empty( $new_filename ) )
|
901 |
$new_filename = "empty";
|
410 |
}
|
411 |
|
412 |
// Otherwise, let's do the basics based on the filename
|
413 |
+
error_log( "BEFORE: " . $file['name'] );
|
414 |
$pp = pathinfo( $file['name'] );
|
415 |
$file['name'] = $this->new_filename( null, $pp['basename'] );
|
416 |
+
error_log( "AFTER: " . $file['name'] );
|
417 |
return $file;
|
418 |
}
|
419 |
|
865 |
return $str;
|
866 |
}
|
867 |
|
868 |
+
// NEW MEDIA FILE INFO (depending on the text/filename of the media)
|
869 |
+
function new_filename( $media, $text, $forceFilename = null ) {
|
870 |
|
871 |
$old_filename = null;
|
872 |
$new_ext = null;
|
873 |
|
|
|
874 |
if ( !empty( $media ) ) {
|
875 |
+
// Media already exists (not a fresh upload). Gets filename and ext.
|
876 |
$old_filepath = get_attached_file( $media['ID'] );
|
877 |
$pp = pathinfo( $old_filepath );
|
878 |
+
$new_ext = $pp['extension'];
|
879 |
$old_filename = $pp['basename'];
|
880 |
+
}
|
881 |
+
else {
|
882 |
+
// It's an upload, let's check if the extension is provided in the text
|
883 |
+
$pp = pathinfo( $text );
|
884 |
$new_ext = $pp['extension'];
|
885 |
+
$text = $pp['filename'];
|
886 |
}
|
887 |
|
888 |
// Generate the new filename.
|
894 |
$new_filename = $forceFilename;
|
895 |
}
|
896 |
else {
|
897 |
+
// Filename is generated from $text, without an extension.
|
898 |
+
$text = str_replace( ".jpg", "", $text );
|
899 |
+
$text = str_replace( ".png", "", $text );
|
900 |
+
$text = str_replace( "'", "-", $text );
|
901 |
+
$text = strtolower( $this->replace_chars( $text ) );
|
902 |
$utf8_filename = apply_filters( 'mfrh_utf8', false );
|
903 |
if ( $utf8_filename )
|
904 |
+
$new_filename = sanitize_file_name( $text );
|
905 |
else
|
906 |
+
$new_filename = str_replace( "%", "-", sanitize_title( $this->replace_special_chars( $text ) ) );
|
907 |
}
|
908 |
if ( empty( $new_filename ) )
|
909 |
$new_filename = "empty";
|
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.7.
|
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.7.
|
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.1
|
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.1';
|
33 |
|
34 |
// Admin
|
35 |
require( 'mfrh_admin.php');
|
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.7.
|
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,9 @@ You are welcome to create plugins using Media File Renamer using special rules f
|
|
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).
|
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.1
|
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.1 =
|
104 |
+
* Fix: Rename on Upload issue in a few cases.
|
105 |
+
|
106 |
= 3.7.0 =
|
107 |
* Update: Improved Rename on Upload.
|
108 |
* Fix: Annoying warning (but it was not causing any error).
|