reSmush.it Image Optimizer - Version 0.3.7

Version Description

  • Fix : CSS+JS load on every admin page, now restricted to reSmush.it pages & medias
  • Fix : Links verification format for admin menu
Download this release

Release Info

Developer resmushit
Plugin Icon 128x128 reSmush.it Image Optimizer
Version 0.3.7
Comparing to
See all releases

Code changes from version 0.3.6 to 0.3.7

Files changed (4) hide show
  1. readme.txt +6 -2
  2. resmushit.admin.php +16 -7
  3. resmushit.php +7 -2
  4. resmushit.settings.php +1 -1
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: resmushit
3
  Tags: image, optimizer, image optimization, resmush.it, smush, jpg, png, gif, optimization, compression, Compress, Images, Pictures, Reduce Image Size, Smush, Smush.it
4
  Requires at least: 4.0.0
5
- Tested up to: 5.4.1
6
- Stable tag: 0.3.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -74,6 +74,10 @@ Yes ! Absolutely free, the only restriction is to send images below 5MB.
74
 
75
  == Changelog ==
76
 
 
 
 
 
77
  = 0.3.6 =
78
  * Fix : cron multiple run issue.
79
 
2
  Contributors: resmushit
3
  Tags: image, optimizer, image optimization, resmush.it, smush, jpg, png, gif, optimization, compression, Compress, Images, Pictures, Reduce Image Size, Smush, Smush.it
4
  Requires at least: 4.0.0
5
+ Tested up to: 5.4.2
6
+ Stable tag: 0.3.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
74
 
75
  == Changelog ==
76
 
77
+ = 0.3.7 =
78
+ * Fix : CSS+JS load on every admin page, now restricted to reSmush.it pages & medias
79
+ * Fix : Links verification format for admin menu
80
+
81
  = 0.3.6 =
82
  * Fix : cron multiple run issue.
83
 
resmushit.admin.php CHANGED
@@ -150,13 +150,22 @@ function resmushit_settings_page() {
150
  * @return none
151
  */
152
  function resmushit_register_plugin_assets(){
153
-
154
- wp_register_style( 'resmushit-css', plugins_url( 'css/resmushit.css', __FILE__ ) );
155
- wp_enqueue_style( 'resmushit-css' );
156
- wp_enqueue_style( 'prefix-style', esc_url_raw( 'https://fonts.googleapis.com/css?family=Roboto+Slab:700' ), array(), null );
157
-
158
- wp_register_script( 'resmushit-js', plugins_url( 'js/script.js?' . hash_file('crc32', dirname(__FILE__) . '/js/script.js'), __FILE__ ) );
159
- wp_enqueue_script( 'resmushit-js' );
 
 
 
 
 
 
 
 
 
160
  }
161
  add_action( 'admin_head', 'resmushit_register_plugin_assets' );
162
 
150
  * @return none
151
  */
152
  function resmushit_register_plugin_assets(){
153
+ $allowed_pages = array( 'media_page_resmushit_options',
154
+ 'upload',
155
+ 'attachment');
156
+
157
+ if ( function_exists( 'get_current_screen' ) ) {
158
+ $current_page = get_current_screen();
159
+ }
160
+
161
+ if ( isset( $current_page->id ) && in_array( $current_page->id, $allowed_pages ) ) {
162
+ wp_register_style( 'resmushit-css', plugins_url( 'css/resmushit.css', __FILE__ ) );
163
+ wp_enqueue_style( 'resmushit-css' );
164
+ wp_enqueue_style( 'prefix-style', esc_url_raw( 'https://fonts.googleapis.com/css?family=Roboto+Slab:700' ), array(), null );
165
+
166
+ wp_register_script( 'resmushit-js', plugins_url( 'js/script.js?' . hash_file('crc32', dirname(__FILE__) . '/js/script.js'), __FILE__ ) );
167
+ wp_enqueue_script( 'resmushit-js' );
168
+ }
169
  }
170
  add_action( 'admin_head', 'resmushit_register_plugin_assets' );
171
 
resmushit.php CHANGED
@@ -10,8 +10,8 @@
10
  * Plugin Name: reSmush.it Image Optimizer
11
  * Plugin URI: https://wordpress.org/plugins/resmushit-image-optimizer/
12
  * Description: Image Optimization API. Provides image size optimization
13
- * Version: 0.3.6
14
- * Timestamp: 2020.05.10
15
  * Author: reSmush.it
16
  * Author URI: https://resmush.it
17
  * Author: Charles Bourgeaux
@@ -283,6 +283,11 @@ add_action( 'wp_ajax_resmushit_update_statistics', 'resmushit_update_statistics'
283
  * @return string
284
  */
285
  function resmushit_add_plugin_page_settings_link($links) {
 
 
 
 
 
286
  $links[] = '<a href="' . admin_url( 'upload.php?page=resmushit_options' ) . '">' . __('Settings', "resmushit-image-optimizer") . '</a>';
287
  return $links;
288
  }
10
  * Plugin Name: reSmush.it Image Optimizer
11
  * Plugin URI: https://wordpress.org/plugins/resmushit-image-optimizer/
12
  * Description: Image Optimization API. Provides image size optimization
13
+ * Version: 0.3.7
14
+ * Timestamp: 2020.06.13
15
  * Author: reSmush.it
16
  * Author URI: https://resmush.it
17
  * Author: Charles Bourgeaux
283
  * @return string
284
  */
285
  function resmushit_add_plugin_page_settings_link($links) {
286
+ if(is_string($links)) {
287
+ $oneLink = $links;
288
+ $links = array();
289
+ $links[] = $oneLink;
290
+ }
291
  $links[] = '<a href="' . admin_url( 'upload.php?page=resmushit_options' ) . '">' . __('Settings', "resmushit-image-optimizer") . '</a>';
292
  return $links;
293
  }
resmushit.settings.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  define('RESMUSHIT_ENDPOINT', 'http://api.resmush.it/');
4
- define('RESMUSHIT_VERSION', '0.3.6');
5
  define('RESMUSHIT_DEFAULT_QLTY', '92');
6
  define('RESMUSHIT_TIMEOUT', '10');
7
  define('RESMUSHIT_LOGS_PATH', 'resmushit.log');
1
  <?php
2
 
3
  define('RESMUSHIT_ENDPOINT', 'http://api.resmush.it/');
4
+ define('RESMUSHIT_VERSION', '0.3.7');
5
  define('RESMUSHIT_DEFAULT_QLTY', '92');
6
  define('RESMUSHIT_TIMEOUT', '10');
7
  define('RESMUSHIT_LOGS_PATH', 'resmushit.log');