Regenerate Thumbnails - Version 2.2.6

Version Description

Download this release

Release Info

Developer Viper007Bond
Plugin Icon 128x128 Regenerate Thumbnails
Version 2.2.6
Comparing to
See all releases

Code changes from version 2.2.5 to 2.2.6

Files changed (2) hide show
  1. readme.txt +4 -0
  2. regenerate-thumbnails.php +22 -22
readme.txt CHANGED
@@ -31,6 +31,10 @@ See the [screenshots tab](http://wordpress.org/extend/plugins/regenerate-thumbna
31
 
32
  == ChangeLog ==
33
 
 
 
 
 
34
  = Version 2.2.5 =
35
 
36
  * Updates relating to plugin language pack support.
31
 
32
  == ChangeLog ==
33
 
34
+ = Version 2.2.6 =
35
+
36
+ * PHP 7 compatibility.
37
+
38
  = Version 2.2.5 =
39
 
40
  * Updates relating to plugin language pack support.
regenerate-thumbnails.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin Name: Regenerate Thumbnails
6
  Plugin URI: http://www.viper007bond.com/wordpress-plugins/regenerate-thumbnails/
7
  Description: Allows you to regenerate all thumbnails after changing the thumbnail sizes.
8
- Version: 2.2.5
9
  Author: Alex Mills (Viper007Bond)
10
  Author URI: http://www.viper007bond.com/
11
  Text Domain: regenerate-thumbnails
@@ -30,21 +30,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30
  **************************************************************************/
31
 
32
  class RegenerateThumbnails {
33
- var $menu_id;
34
 
35
  // Plugin initialization
36
- function RegenerateThumbnails() {
37
  // Load up the localization file if we're using WordPress in a different language
38
  load_plugin_textdomain( 'regenerate-thumbnails' );
39
 
40
- add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) );
41
- add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueues' ) );
42
- add_action( 'wp_ajax_regeneratethumbnail', array( &$this, 'ajax_process_image' ) );
43
- add_filter( 'media_row_actions', array( &$this, 'add_media_row_action' ), 10, 2 );
44
- //add_filter( 'bulk_actions-upload', array( &$this, 'add_bulk_actions' ), 99 ); // A last minute change to 3.1 makes this no longer work
45
- add_action( 'admin_head-upload.php', array( &$this, 'add_bulk_actions_via_javascript' ) );
46
- add_action( 'admin_action_bulk_regenerate_thumbnails', array( &$this, 'bulk_action_handler' ) ); // Top drowndown
47
- add_action( 'admin_action_-1', array( &$this, 'bulk_action_handler' ) ); // Bottom dropdown (assumes top dropdown = default value)
48
 
49
  // Allow people to change what capability is required to use this plugin
50
  $this->capability = apply_filters( 'regenerate_thumbs_cap', 'manage_options' );
@@ -52,13 +52,13 @@ class RegenerateThumbnails {
52
 
53
 
54
  // Register the management page
55
- function add_admin_menu() {
56
- $this->menu_id = add_management_page( __( 'Regenerate Thumbnails', 'regenerate-thumbnails' ), __( 'Regen. Thumbnails', 'regenerate-thumbnails' ), $this->capability, 'regenerate-thumbnails', array(&$this, 'regenerate_interface') );
57
  }
58
 
59
 
60
  // Enqueue the needed Javascript and CSS
61
- function admin_enqueues( $hook_suffix ) {
62
  if ( $hook_suffix != $this->menu_id )
63
  return;
64
 
@@ -73,7 +73,7 @@ class RegenerateThumbnails {
73
 
74
 
75
  // Add a "Regenerate Thumbnails" link to the media row actions
76
- function add_media_row_action( $actions, $post ) {
77
  if ( 'image/' != substr( $post->post_mime_type, 0, 6 ) || ! current_user_can( $this->capability ) )
78
  return $actions;
79
 
@@ -85,7 +85,7 @@ class RegenerateThumbnails {
85
 
86
 
87
  // Add "Regenerate Thumbnails" to the Bulk Actions media dropdown
88
- function add_bulk_actions( $actions ) {
89
  $delete = false;
90
  if ( ! empty( $actions['delete'] ) ) {
91
  $delete = $actions['delete'];
@@ -103,7 +103,7 @@ class RegenerateThumbnails {
103
 
104
  // Add new items to the Bulk Actions using Javascript
105
  // A last minute change to the "bulk_actions-xxxxx" filter in 3.1 made it not possible to add items using that
106
- function add_bulk_actions_via_javascript() {
107
  if ( ! current_user_can( $this->capability ) )
108
  return;
109
  ?>
@@ -117,7 +117,7 @@ class RegenerateThumbnails {
117
 
118
 
119
  // Handles the bulk actions POST
120
- function bulk_action_handler() {
121
  if ( empty( $_REQUEST['action'] ) || ( 'bulk_regenerate_thumbnails' != $_REQUEST['action'] && 'bulk_regenerate_thumbnails' != $_REQUEST['action2'] ) )
122
  return;
123
 
@@ -135,7 +135,7 @@ class RegenerateThumbnails {
135
 
136
 
137
  // The user interface plus thumbnail regenerator
138
- function regenerate_interface() {
139
  global $wpdb;
140
 
141
  ?>
@@ -348,7 +348,7 @@ class RegenerateThumbnails {
348
 
349
 
350
  // Process a single image ID (this is an AJAX handler)
351
- function ajax_process_image() {
352
  @error_reporting( 0 ); // Don't break the JSON result
353
 
354
  header( 'Content-type: application/json' );
@@ -384,13 +384,13 @@ class RegenerateThumbnails {
384
 
385
 
386
  // Helper to make a JSON error message
387
- function die_json_error_msg( $id, $message ) {
388
  die( json_encode( array( 'error' => sprintf( __( '&quot;%1$s&quot; (ID %2$s) failed to resize. The error message was: %3$s', 'regenerate-thumbnails' ), esc_html( get_the_title( $id ) ), $id, $message ) ) ) );
389
  }
390
 
391
 
392
  // Helper function to escape quotes in strings for use in Javascript
393
- function esc_quotes( $string ) {
394
  return str_replace( '"', '\"', $string );
395
  }
396
  }
5
  Plugin Name: Regenerate Thumbnails
6
  Plugin URI: http://www.viper007bond.com/wordpress-plugins/regenerate-thumbnails/
7
  Description: Allows you to regenerate all thumbnails after changing the thumbnail sizes.
8
+ Version: 2.2.6
9
  Author: Alex Mills (Viper007Bond)
10
  Author URI: http://www.viper007bond.com/
11
  Text Domain: regenerate-thumbnails
30
  **************************************************************************/
31
 
32
  class RegenerateThumbnails {
33
+ public $menu_id;
34
 
35
  // Plugin initialization
36
+ public function __construct() {
37
  // Load up the localization file if we're using WordPress in a different language
38
  load_plugin_textdomain( 'regenerate-thumbnails' );
39
 
40
+ add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
41
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueues' ) );
42
+ add_action( 'wp_ajax_regeneratethumbnail', array( $this, 'ajax_process_image' ) );
43
+ add_filter( 'media_row_actions', array( $this, 'add_media_row_action' ), 10, 2 );
44
+ //add_filter( 'bulk_actions-upload', array( $this, 'add_bulk_actions' ), 99 ); // A last minute change to 3.1 makes this no longer work
45
+ add_action( 'admin_head-upload.php', array( $this, 'add_bulk_actions_via_javascript' ) );
46
+ add_action( 'admin_action_bulk_regenerate_thumbnails', array( $this, 'bulk_action_handler' ) ); // Top drowndown
47
+ add_action( 'admin_action_-1', array( $this, 'bulk_action_handler' ) ); // Bottom dropdown (assumes top dropdown = default value)
48
 
49
  // Allow people to change what capability is required to use this plugin
50
  $this->capability = apply_filters( 'regenerate_thumbs_cap', 'manage_options' );
52
 
53
 
54
  // Register the management page
55
+ public function add_admin_menu() {
56
+ $this->menu_id = add_management_page( __( 'Regenerate Thumbnails', 'regenerate-thumbnails' ), __( 'Regen. Thumbnails', 'regenerate-thumbnails' ), $this->capability, 'regenerate-thumbnails', array($this, 'regenerate_interface') );
57
  }
58
 
59
 
60
  // Enqueue the needed Javascript and CSS
61
+ public function admin_enqueues( $hook_suffix ) {
62
  if ( $hook_suffix != $this->menu_id )
63
  return;
64
 
73
 
74
 
75
  // Add a "Regenerate Thumbnails" link to the media row actions
76
+ public function add_media_row_action( $actions, $post ) {
77
  if ( 'image/' != substr( $post->post_mime_type, 0, 6 ) || ! current_user_can( $this->capability ) )
78
  return $actions;
79
 
85
 
86
 
87
  // Add "Regenerate Thumbnails" to the Bulk Actions media dropdown
88
+ public function add_bulk_actions( $actions ) {
89
  $delete = false;
90
  if ( ! empty( $actions['delete'] ) ) {
91
  $delete = $actions['delete'];
103
 
104
  // Add new items to the Bulk Actions using Javascript
105
  // A last minute change to the "bulk_actions-xxxxx" filter in 3.1 made it not possible to add items using that
106
+ public function add_bulk_actions_via_javascript() {
107
  if ( ! current_user_can( $this->capability ) )
108
  return;
109
  ?>
117
 
118
 
119
  // Handles the bulk actions POST
120
+ public function bulk_action_handler() {
121
  if ( empty( $_REQUEST['action'] ) || ( 'bulk_regenerate_thumbnails' != $_REQUEST['action'] && 'bulk_regenerate_thumbnails' != $_REQUEST['action2'] ) )
122
  return;
123
 
135
 
136
 
137
  // The user interface plus thumbnail regenerator
138
+ public function regenerate_interface() {
139
  global $wpdb;
140
 
141
  ?>
348
 
349
 
350
  // Process a single image ID (this is an AJAX handler)
351
+ public function ajax_process_image() {
352
  @error_reporting( 0 ); // Don't break the JSON result
353
 
354
  header( 'Content-type: application/json' );
384
 
385
 
386
  // Helper to make a JSON error message
387
+ public function die_json_error_msg( $id, $message ) {
388
  die( json_encode( array( 'error' => sprintf( __( '&quot;%1$s&quot; (ID %2$s) failed to resize. The error message was: %3$s', 'regenerate-thumbnails' ), esc_html( get_the_title( $id ) ), $id, $message ) ) ) );
389
  }
390
 
391
 
392
  // Helper function to escape quotes in strings for use in Javascript
393
+ public function esc_quotes( $string ) {
394
  return str_replace( '"', '\"', $string );
395
  }
396
  }