Version Description
- Add: Bulk rename in the Media Library.
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Media File Renamer |
Version | 3.6.7 |
Comparing to | |
See all releases |
Code changes from version 3.6.6 to 3.6.7
- common/admin.php +86 -5
- core.php +10 -4
- media-file-renamer.php +2 -2
- mfrh_admin.php +11 -0
- readme.txt +5 -2
common/admin.php
CHANGED
@@ -5,7 +5,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
5 |
class MeowApps_Admin {
|
6 |
|
7 |
public static $loaded = false;
|
8 |
-
public static $admin_version = "1.
|
9 |
|
10 |
public $prefix; // prefix used for actions, filters (mfrh)
|
11 |
public $mainfile; // plugin main file (media-file-renamer.php)
|
@@ -28,14 +28,95 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
28 |
$this->mainfile = $mainfile;
|
29 |
$this->domain = $domain;
|
30 |
|
31 |
-
|
32 |
-
|
33 |
if ( is_admin() ) {
|
34 |
$license = get_option( $this->prefix . '_license', "" );
|
35 |
if ( ( !empty( $license ) ) && !file_exists( plugin_dir_path( $this->mainfile ) . 'common/meowapps/admin.php' ) ) {
|
36 |
add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
|
|
39 |
}
|
40 |
|
41 |
function admin_notices_licensed_free() {
|
@@ -45,7 +126,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
45 |
return;
|
46 |
}
|
47 |
echo '<div class="error">';
|
48 |
-
echo '<p>It looks like you are using the free version of the plugin (<b>' . $this->mainfile
|
49 |
echo '<p>
|
50 |
<form method="post" action="">
|
51 |
<input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
|
@@ -61,7 +142,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
61 |
}
|
62 |
|
63 |
function display_title( $title = "Meow Apps",
|
64 |
-
$author = "By <a style='text-decoration: none;' href='
|
65 |
if ( !empty( $this->prefix ) )
|
66 |
$title = apply_filters( $this->prefix . '_plugin_title', $title );
|
67 |
if ( $this->display_ads() ) {
|
5 |
class MeowApps_Admin {
|
6 |
|
7 |
public static $loaded = false;
|
8 |
+
public static $admin_version = "1.4";
|
9 |
|
10 |
public $prefix; // prefix used for actions, filters (mfrh)
|
11 |
public $mainfile; // plugin main file (media-file-renamer.php)
|
28 |
$this->mainfile = $mainfile;
|
29 |
$this->domain = $domain;
|
30 |
|
31 |
+
register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) );
|
32 |
+
|
33 |
if ( is_admin() ) {
|
34 |
$license = get_option( $this->prefix . '_license', "" );
|
35 |
if ( ( !empty( $license ) ) && !file_exists( plugin_dir_path( $this->mainfile ) . 'common/meowapps/admin.php' ) ) {
|
36 |
add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
|
37 |
}
|
38 |
+
$rating_date = $this->create_rating_date();
|
39 |
+
if ( time() > $rating_date ) {
|
40 |
+
add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) );
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
function show_meowapps_create_rating_date() {
|
46 |
+
delete_option( 'meowapps_hide_meowapps' );
|
47 |
+
$this->create_rating_date();
|
48 |
+
}
|
49 |
+
|
50 |
+
function create_rating_date() {
|
51 |
+
$rating_date = get_option( $this->prefix . '_rating_date' );
|
52 |
+
if ( empty( $rating_date ) ) {
|
53 |
+
$two_months = strtotime( '+2 months' );
|
54 |
+
$six_months = strtotime( '+6 months' );
|
55 |
+
$rating_date = mt_rand( $two_months, $six_months );
|
56 |
+
update_option( $this->prefix . '_rating_date', $rating_date, false );
|
57 |
+
}
|
58 |
+
return $rating_date;
|
59 |
+
}
|
60 |
+
|
61 |
+
function admin_notices_rating() {
|
62 |
+
if ( isset( $_POST[$this->prefix . '_remind_me'] ) ) {
|
63 |
+
$two_weeks = strtotime( '+2 weeks' );
|
64 |
+
$six_weeks = strtotime( '+6 weeks' );
|
65 |
+
$future_date = mt_rand( $two_weeks, $six_weeks );
|
66 |
+
update_option( $this->prefix . '_rating_date', $future_date, false );
|
67 |
+
return;
|
68 |
+
}
|
69 |
+
else if ( isset( $_POST[$this->prefix . '_never_remind_me'] ) ) {
|
70 |
+
$twenty_years = strtotime( '+20 years' );
|
71 |
+
update_option( $this->prefix . '_rating_date', $twenty_years, false );
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) {
|
75 |
+
$twenty_years = strtotime( '+100 years' );
|
76 |
+
update_option( $this->prefix . '_rating_date', $twenty_years, false );
|
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">
|
85 |
+
<input type="submit" name="submit" id="submit" class="button button-red" value="Never remind me!">
|
86 |
+
</form>
|
87 |
+
<form method="post" action="" style="float: right; margin-right: 10px;">
|
88 |
+
<input type="hidden" name="' . $this->prefix . '_remind_me" value="true">
|
89 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="Remind me in a few weeks...">
|
90 |
+
</form>
|
91 |
+
<form method="post" action="" style="float: right; margin-right: 10px;">
|
92 |
+
<input type="hidden" name="' . $this->prefix . '_did_it" value="true">
|
93 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="Yes, I did it!">
|
94 |
+
</form>
|
95 |
+
<div style="clear: both;"></div>
|
96 |
+
</p>
|
97 |
+
';
|
98 |
+
echo '</div>';
|
99 |
+
}
|
100 |
+
|
101 |
+
function nice_short_url_from_file( $file ) {
|
102 |
+
$info = pathinfo( $file );
|
103 |
+
if ( !empty( $info ) ) {
|
104 |
+
$info['filename'] = str_replace( '-pro', '', $info['filename'] );
|
105 |
+
return $info['filename'];
|
106 |
+
}
|
107 |
+
return "";
|
108 |
+
}
|
109 |
+
|
110 |
+
function nice_name_from_file( $file ) {
|
111 |
+
$info = pathinfo( $file );
|
112 |
+
if ( !empty( $info ) ) {
|
113 |
+
if ( $info['filename'] == 'wplr-sync' ) {
|
114 |
+
return "WP/LR Sync";
|
115 |
+
}
|
116 |
+
$info['filename'] = str_replace( '-', ' ', $info['filename'] );
|
117 |
+
$file = ucwords( $info['filename'] );
|
118 |
}
|
119 |
+
return $file;
|
120 |
}
|
121 |
|
122 |
function admin_notices_licensed_free() {
|
126 |
return;
|
127 |
}
|
128 |
echo '<div class="error">';
|
129 |
+
echo '<p>It looks like you are using the free version of the plugin (<b>' . $this->nice_name_from_file( $this->mainfile ) . '</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.';
|
130 |
echo '<p>
|
131 |
<form method="post" action="">
|
132 |
<input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
|
142 |
}
|
143 |
|
144 |
function display_title( $title = "Meow Apps",
|
145 |
+
$author = "By <a style='text-decoration: none;' href='https://meowapps.com' target='_blank'>Jordy Meow</a>" ) {
|
146 |
if ( !empty( $this->prefix ) )
|
147 |
$title = apply_filters( $this->prefix . '_plugin_title', $title );
|
148 |
if ( $this->display_ads() ) {
|
core.php
CHANGED
@@ -90,8 +90,9 @@ class Meow_MFRH_Core {
|
|
90 |
*/
|
91 |
|
92 |
function library_bulk_actions( $bulk_actions ) {
|
93 |
-
$bulk_actions['mfrh_lock_all'] = __( 'Lock
|
94 |
-
$bulk_actions['mfrh_unlock_all'] = __( 'Unlock
|
|
|
95 |
return $bulk_actions;
|
96 |
}
|
97 |
|
@@ -105,6 +106,11 @@ class Meow_MFRH_Core {
|
|
105 |
foreach ( $ids as $post_id ) {
|
106 |
delete_post_meta( $post_id, '_manual_file_renaming' );
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
return $redirect_to;
|
110 |
}
|
@@ -582,11 +588,11 @@ class Meow_MFRH_Core {
|
|
582 |
|
583 |
<?php if ( get_option( 'mfrh_flagging' ) ): ?>
|
584 |
<p>
|
585 |
-
<b>There are <span class='mfrh-flagged' style='color: red;'><?php _e( $flagged ); ?></span> media files flagged for auto-renaming out of <?php _e( $total ); ?> in total.</b> Those are the files that couldn't be renamed on the fly when their names were updated. You can now rename those flagged media, or rename all of them (which will unlock them all and force their renaming). <span style='color: red; font-weight: bold;'>Please backup your uploads folder + DB before using this.</span>
|
586 |
</p>
|
587 |
<?php else: ?>
|
588 |
<p>
|
589 |
-
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>
|
590 |
</p>
|
591 |
<?php endif; ?>
|
592 |
|
90 |
*/
|
91 |
|
92 |
function library_bulk_actions( $bulk_actions ) {
|
93 |
+
$bulk_actions['mfrh_lock_all'] = __( 'Lock (Renamer)', 'media-file-renamer');
|
94 |
+
$bulk_actions['mfrh_unlock_all'] = __( 'Unlock (Renamer)', 'media-file-renamer');
|
95 |
+
$bulk_actions['mfrh_rename_all'] = __( 'Rename (Renamer)', 'media-file-renamer');
|
96 |
return $bulk_actions;
|
97 |
}
|
98 |
|
106 |
foreach ( $ids as $post_id ) {
|
107 |
delete_post_meta( $post_id, '_manual_file_renaming' );
|
108 |
}
|
109 |
+
}
|
110 |
+
if ( $doaction == 'mfrh_rename_all' ) {
|
111 |
+
foreach ( $ids as $post_id ) {
|
112 |
+
$this->rename_media( get_post( $post_id, ARRAY_A ), null );
|
113 |
+
}
|
114 |
}
|
115 |
return $redirect_to;
|
116 |
}
|
588 |
|
589 |
<?php if ( get_option( 'mfrh_flagging' ) ): ?>
|
590 |
<p>
|
591 |
+
<b>There are <span class='mfrh-flagged' style='color: red;'><?php _e( $flagged ); ?></span> media files flagged for auto-renaming out of <?php _e( $total ); ?> in total.</b> Those are the files that couldn't be renamed on the fly when their names were updated. You can now rename those flagged media, or rename all of them (which will unlock them all and force their renaming). <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://updraftplus.com/?afref=460' target='_blank'>UpdraftPlus</a>.
|
592 |
</p>
|
593 |
<?php else: ?>
|
594 |
<p>
|
595 |
+
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://updraftplus.com/?afref=460' target='_blank'>UpdraftPlus</a>.
|
596 |
</p>
|
597 |
<?php endif; ?>
|
598 |
|
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.
|
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;
|
32 |
-
$mfrh_version = '3.6.
|
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.6.7
|
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;
|
32 |
+
$mfrh_version = '3.6.7';
|
33 |
|
34 |
// Admin
|
35 |
require( 'mfrh_admin.php');
|
mfrh_admin.php
CHANGED
@@ -9,9 +9,15 @@ 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 |
}
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
function admin_notices() {
|
16 |
if ( isset( $_GET['reset'] ) ) {
|
17 |
if ( file_exists( plugin_dir_path( __FILE__ ) . '/media-file-renamer.log' ) )
|
@@ -165,6 +171,11 @@ class Meow_MFRH_Admin extends MeowApps_Admin {
|
|
165 |
<h3>How to use</h3>
|
166 |
<div class="inside">
|
167 |
<?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' ) ?>
|
|
|
|
|
|
|
|
|
|
|
168 |
</div>
|
169 |
</div>
|
170 |
</div>
|
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' ) )
|
171 |
<h3>How to use</h3>
|
172 |
<div class="inside">
|
173 |
<?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' ) ?>
|
174 |
+
<p class="submit">
|
175 |
+
<a class="button button-primary" href="upload.php?page=rename_media_files">
|
176 |
+
<?php echo _e( "Access the Renamer Dashboard", 'media-file-renamer' ); ?>
|
177 |
+
</a>
|
178 |
+
</p>
|
179 |
</div>
|
180 |
</div>
|
181 |
</div>
|
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.
|
7 |
|
8 |
Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
|
9 |
|
@@ -17,7 +17,7 @@ The Media File Renamer is a WordPress plugin that physically renames media files
|
|
17 |
|
18 |
**PRO VERSION**. The [Pro Version](http://meowapps.com/media-file-renamer/) gives a few more features like manual renaming, renaming depending on the post the media is attached to or the content of the alternative text (ALT), logging of SQL queries and a few more options. A good process is to actually let the plugin do the renaming automatically (like in the free version) and to do manual renaming for the files that require fine tuning.
|
19 |
|
20 |
-
**BE CAREFUL**. File renaming is a dangerous process. Before renaming everything automatically, try to rename a few files first and check if all the references to those files have been properly updated on your website. WordPress has so many themes and plugins that this renaming process can't unfortunately cover all the cases, especially if other plugins are using unconventional ways. If references aren't updated properly, please write a nice post (not an angry one) in the support threads :) I will try my best to cover more and more special cases. In any case, always make a **backup** of your database and files before using a plugin that alter your install. Also, it your website seems broken after a few renames, try to **clear your cache**. The cached HTML will indeed not be linked to the new filenames.
|
21 |
|
22 |
**FOR DEVELOPER**. The plugin can be tweaked and reference updates enhanced for your themes/plugins. Have a look [here](https://wordpress.org/plugins/media-file-renamer/faq/).
|
23 |
|
@@ -100,6 +100,9 @@ You are welcome to create plugins using Media File Renamer using special rules f
|
|
100 |
|
101 |
== Changelog ==
|
102 |
|
|
|
|
|
|
|
103 |
= 3.6.6 =
|
104 |
* Add: Table with the filenames before and after renaming + CSV Export (works with Redirection plugin).
|
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.6.7
|
7 |
|
8 |
Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
|
9 |
|
17 |
|
18 |
**PRO VERSION**. The [Pro Version](http://meowapps.com/media-file-renamer/) gives a few more features like manual renaming, renaming depending on the post the media is attached to or the content of the alternative text (ALT), logging of SQL queries and a few more options. A good process is to actually let the plugin do the renaming automatically (like in the free version) and to do manual renaming for the files that require fine tuning.
|
19 |
|
20 |
+
**BE CAREFUL**. File renaming is a dangerous process. Before renaming everything automatically, try to rename a few files first and check if all the references to those files have been properly updated on your website. WordPress has so many themes and plugins that this renaming process can't unfortunately cover all the cases, especially if other plugins are using unconventional ways. If references aren't updated properly, please write a nice post (not an angry one) in the support threads :) I will try my best to cover more and more special cases. In any case, always make a **backup** of your database and files before using a plugin that alter your install. For backup, you can use such a plugin as [UpdraftPlus](https://updraftplus.com/?afref=460). Also, it your website seems broken after a few renames, try to **clear your cache**. The cached HTML will indeed not be linked to the new filenames.
|
21 |
|
22 |
**FOR DEVELOPER**. The plugin can be tweaked and reference updates enhanced for your themes/plugins. Have a look [here](https://wordpress.org/plugins/media-file-renamer/faq/).
|
23 |
|
100 |
|
101 |
== Changelog ==
|
102 |
|
103 |
+
= 3.6.7 =
|
104 |
+
* Add: Bulk rename in the Media Library.
|
105 |
+
|
106 |
= 3.6.6 =
|
107 |
* Add: Table with the filenames before and after renaming + CSV Export (works with Redirection plugin).
|
108 |
|