Version Description
- Add: New filter 'mfrh_allow_rename'. Developers can now allow/reject the renaming (useful for bulk).
- Fix: The file numbering wasn't working fine in a few specific cases.
- Note: If you like it, please review the plugin by clicking here. It's important for us - we need motivation for all the work we want to put in the next version :)
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Media File Renamer |
Version | 4.6.8 |
Comparing to | |
See all releases |
Code changes from version 4.6.7 to 4.6.8
- core.php +14 -1
- media-file-renamer.php +2 -2
- mfrh_admin.php +12 -0
- readme.txt +7 -4
core.php
CHANGED
@@ -39,7 +39,13 @@ class Meow_MFRH_Core {
|
|
39 |
|
40 |
// Check if the file exists, if it is, return the real path for it
|
41 |
// https://stackoverflow.com/questions/3964793/php-case-insensitive-version-of-file-exists
|
42 |
-
static function sensitive_file_exists( $filename, $
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
$output = false;
|
44 |
$directoryName = mfrh_dirname( $filename );
|
45 |
$fileArray = glob( $directoryName . '/*', GLOB_NOSORT );
|
@@ -309,6 +315,7 @@ SQL;
|
|
309 |
return false;
|
310 |
}
|
311 |
$new_filepath = trailingslashit( $directory ) . $new_filename;
|
|
|
312 |
}
|
313 |
}
|
314 |
|
@@ -835,6 +842,12 @@ SQL;
|
|
835 |
$id = null;
|
836 |
$post = null;
|
837 |
|
|
|
|
|
|
|
|
|
|
|
|
|
838 |
// Check the arguments
|
839 |
if ( is_numeric( $media ) ) {
|
840 |
$id = $media;
|
39 |
|
40 |
// Check if the file exists, if it is, return the real path for it
|
41 |
// https://stackoverflow.com/questions/3964793/php-case-insensitive-version-of-file-exists
|
42 |
+
static function sensitive_file_exists( $filename, $caseInsensitive = true ) {
|
43 |
+
|
44 |
+
$sensitive_check = get_option( 'mfrh_case_sensitive_check', true );
|
45 |
+
if ( !$sensitive_check ) {
|
46 |
+
return file_exists( $filename );
|
47 |
+
}
|
48 |
+
|
49 |
$output = false;
|
50 |
$directoryName = mfrh_dirname( $filename );
|
51 |
$fileArray = glob( $directoryName . '/*', GLOB_NOSORT );
|
315 |
return false;
|
316 |
}
|
317 |
$new_filepath = trailingslashit( $directory ) . $new_filename;
|
318 |
+
$existing_file = Meow_MFRH_Core::sensitive_file_exists( $new_filepath );
|
319 |
}
|
320 |
}
|
321 |
|
842 |
$id = null;
|
843 |
$post = null;
|
844 |
|
845 |
+
// This filter permits developers to allow or not the renaming of certain files.
|
846 |
+
$allowed = apply_filters( 'mfrh_allow_rename', true, $media, $manual_filename );
|
847 |
+
if ( !$allowed ) {
|
848 |
+
return $post;
|
849 |
+
}
|
850 |
+
|
851 |
// Check the arguments
|
852 |
if ( is_numeric( $media ) ) {
|
853 |
$id = $media;
|
media-file-renamer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Media File Renamer (Auto Rename)
|
4 |
Plugin URI: https://meowapps.com
|
5 |
Description: Renames automatically the files depending on Media titles and updates the links.
|
6 |
-
Version: 4.6.
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://jordymeow.com
|
9 |
Text Domain: media-file-renamer
|
@@ -32,7 +32,7 @@ require( 'helpers.php');
|
|
32 |
if ( is_admin() || is_rest() ) {
|
33 |
|
34 |
global $mfrh_version, $mfrh_core;
|
35 |
-
$mfrh_version = '4.6.
|
36 |
|
37 |
// Admin
|
38 |
require( 'mfrh_admin.php');
|
3 |
Plugin Name: Media File Renamer (Auto Rename)
|
4 |
Plugin URI: https://meowapps.com
|
5 |
Description: Renames automatically the files depending on Media titles and updates the links.
|
6 |
+
Version: 4.6.8
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://jordymeow.com
|
9 |
Text Domain: media-file-renamer
|
32 |
if ( is_admin() || is_rest() ) {
|
33 |
|
34 |
global $mfrh_version, $mfrh_core;
|
35 |
+
$mfrh_version = '4.6.8';
|
36 |
|
37 |
// Admin
|
38 |
require( 'mfrh_admin.php');
|
mfrh_admin.php
CHANGED
@@ -145,11 +145,15 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
|
|
145 |
add_settings_field( 'mfrh_rename_guid', "Sync GUID",
|
146 |
array( $this, 'admin_rename_guid_callback' ),
|
147 |
'mfrh_developer_settings-menu', 'mfrh_developer_settings' );
|
|
|
|
|
|
|
148 |
add_settings_field( 'mfrh_rename_on_save', "Rename on Post Save",
|
149 |
array( $this, 'admin_rename_on_save_callback' ),
|
150 |
'mfrh_developer_settings-menu', 'mfrh_developer_settings' );
|
151 |
|
152 |
register_setting( 'mfrh_developer_settings', 'mfrh_rename_guid' );
|
|
|
153 |
register_setting( 'mfrh_developer_settings', 'mfrh_force_rename' );
|
154 |
register_setting( 'mfrh_developer_settings', 'mfrh_log' );
|
155 |
register_setting( 'mfrh_developer_settings', 'mfrh_logsql' );
|
@@ -295,6 +299,14 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
|
|
295 |
checked( 1, get_option( 'mfrh_rename_guid' ), false ) . '/>';
|
296 |
$html .= '<label>' .esc_html__( 'Update GUID with Filename', 'media-file-renamer' ). '</label><br />';
|
297 |
$html .= '<small>' .esc_html__( 'The GUID will be renamed like the new filename. Better to keep this un-checked.', 'media-file-renamer' ). '</small>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
echo $html;
|
299 |
}
|
300 |
|
145 |
add_settings_field( 'mfrh_rename_guid', "Sync GUID",
|
146 |
array( $this, 'admin_rename_guid_callback' ),
|
147 |
'mfrh_developer_settings-menu', 'mfrh_developer_settings' );
|
148 |
+
add_settings_field( 'mfrh_case_sensitive_check', "Case Sensitive",
|
149 |
+
array( $this, 'admin_case_sensitive_callback' ),
|
150 |
+
'mfrh_developer_settings-menu', 'mfrh_developer_settings' );
|
151 |
add_settings_field( 'mfrh_rename_on_save', "Rename on Post Save",
|
152 |
array( $this, 'admin_rename_on_save_callback' ),
|
153 |
'mfrh_developer_settings-menu', 'mfrh_developer_settings' );
|
154 |
|
155 |
register_setting( 'mfrh_developer_settings', 'mfrh_rename_guid' );
|
156 |
+
register_setting( 'mfrh_developer_settings', 'mfrh_case_sensitive_check' );
|
157 |
register_setting( 'mfrh_developer_settings', 'mfrh_force_rename' );
|
158 |
register_setting( 'mfrh_developer_settings', 'mfrh_log' );
|
159 |
register_setting( 'mfrh_developer_settings', 'mfrh_logsql' );
|
299 |
checked( 1, get_option( 'mfrh_rename_guid' ), false ) . '/>';
|
300 |
$html .= '<label>' .esc_html__( 'Update GUID with Filename', 'media-file-renamer' ). '</label><br />';
|
301 |
$html .= '<small>' .esc_html__( 'The GUID will be renamed like the new filename. Better to keep this un-checked.', 'media-file-renamer' ). '</small>';
|
302 |
+
echo $html;
|
303 |
+
}
|
304 |
+
|
305 |
+
function admin_case_sensitive_callback( $args ) {
|
306 |
+
$html = '<input type="checkbox" id="mfrh_case_sensitive_check" name="mfrh_case_sensitive_check" value="1" ' .
|
307 |
+
checked( 1, get_option( 'mfrh_case_sensitive_check', true ), false ) . '/>';
|
308 |
+
$html .= '<label>' .esc_html__( 'Enable', 'media-file-renamer' ). '</label><br />';
|
309 |
+
$html .= '<small>' .esc_html__( 'This will check and detect as different such files as "abc.jpg" and "ABC.jpg". PHP itself recognize it as a same file, but probably not your system.', 'media-file-renamer' ). '</small>';
|
310 |
echo $html;
|
311 |
}
|
312 |
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: TigrouMeow, amekusa
|
|
3 |
Tags: rename, seo, file, files, media, renamer, optimize, library
|
4 |
Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
|
5 |
Requires at least: 4.8
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 7.0
|
8 |
-
Stable tag: 4.6.
|
9 |
|
10 |
Physically renames your files nicely for a cleaner system and for a better SEO. Please read the description.
|
11 |
|
@@ -57,10 +57,14 @@ Check the FAQ on the official website, [here](https://meowapps.com/media-file-re
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
|
|
|
|
|
|
|
|
|
|
60 |
= 4.6.7 =
|
61 |
* Add: Better handling of dots and hyphens (especially the non-standard ones).
|
62 |
* Add: Support for WebP.
|
63 |
-
* Note: If you like it, please review the plugin [by clicking here](https://wordpress.org/support/plugin/media-file-renamer/reviews/?rate=5#new-post). It's important for us - we need motivation for all the work we want to put in the next version :)
|
64 |
|
65 |
= 4.6.5 =
|
66 |
* Fix: Little (i18n) fixes in the admin.
|
@@ -79,7 +83,6 @@ Check the FAQ on the official website, [here](https://meowapps.com/media-file-re
|
|
79 |
* Fix: The WooCommerce add-on file was missing.
|
80 |
* Fix: Search was sometimes not working properly in the Media Library.
|
81 |
* Info: We are working on a bunch of updates concerning the usage of dots, hyphens and other characters, so expect the renaming rules to change a bit (for the best).
|
82 |
-
* Note: If you like it, please review the plugin here: https://wordpress.org/support/plugin/media-file-renamer/reviews/?rate=5#new-post. It's important for us :) Thank you!
|
83 |
|
84 |
= 4.5.2 =
|
85 |
* Update: Code cleaning, Youtube video.
|
3 |
Tags: rename, seo, file, files, media, renamer, optimize, library
|
4 |
Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
|
5 |
Requires at least: 4.8
|
6 |
+
Tested up to: 5.4
|
7 |
Requires PHP: 7.0
|
8 |
+
Stable tag: 4.6.8
|
9 |
|
10 |
Physically renames your files nicely for a cleaner system and for a better SEO. Please read the description.
|
11 |
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
+
= 4.6.8 =
|
61 |
+
* Add: New filter 'mfrh_allow_rename'. Developers can now allow/reject the renaming (useful for bulk).
|
62 |
+
* Fix: The file numbering wasn't working fine in a few specific cases.
|
63 |
+
* Note: If you like it, please review the plugin [by clicking here](https://wordpress.org/support/plugin/media-file-renamer/reviews/?rate=5#new-post). It's important for us - we need motivation for all the work we want to put in the next version :)
|
64 |
+
|
65 |
= 4.6.7 =
|
66 |
* Add: Better handling of dots and hyphens (especially the non-standard ones).
|
67 |
* Add: Support for WebP.
|
|
|
68 |
|
69 |
= 4.6.5 =
|
70 |
* Fix: Little (i18n) fixes in the admin.
|
83 |
* Fix: The WooCommerce add-on file was missing.
|
84 |
* Fix: Search was sometimes not working properly in the Media Library.
|
85 |
* Info: We are working on a bunch of updates concerning the usage of dots, hyphens and other characters, so expect the renaming rules to change a bit (for the best).
|
|
|
86 |
|
87 |
= 4.5.2 =
|
88 |
* Update: Code cleaning, Youtube video.
|