Image Watermark - Version 1.7.1

Version Description

  • Fix: Watermark option not available in Media Library
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Image Watermark
Version 1.7.1
Comparing to
See all releases

Code changes from version 1.7.0 to 1.7.1

Files changed (2) hide show
  1. image-watermark.php +22 -39
  2. readme.txt +8 -6
image-watermark.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Image Watermark
4
  Description: Image Watermark allows you to automatically watermark images uploaded to the WordPress Media Library and bulk watermark previously uploaded images.
5
- Version: 1.7.0
6
  Author: dFactory
7
  Author URI: https://dfactory.eu/
8
  Plugin URI: https://dfactory.eu/plugins/image-watermark/
@@ -32,7 +32,7 @@ define( 'IMAGE_WATERMARK_PATH', plugin_dir_path( __FILE__ ) );
32
  * Image Watermark class.
33
  *
34
  * @class Image_Watermark
35
- * @version 1.7.0
36
  */
37
  final class Image_Watermark {
38
 
@@ -81,7 +81,7 @@ final class Image_Watermark {
81
  'backup_quality' => 90
82
  )
83
  ),
84
- 'version' => '1.7.0'
85
  );
86
  public $options = array();
87
 
@@ -109,7 +109,6 @@ final class Image_Watermark {
109
  // actions
110
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
111
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
112
- add_action( 'admin_print_scripts', array( $this, 'admin_print_scripts' ), 20 );
113
  add_action( 'wp_enqueue_media', array( $this, 'wp_enqueue_media' ) );
114
  add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
115
  add_action( 'load-upload.php', array( $this, 'watermark_bulk_action' ) );
@@ -254,36 +253,6 @@ final class Image_Watermark {
254
  load_plugin_textdomain( 'image-watermark', false, basename( dirname( __FILE__ ) ) . '/languages' );
255
  }
256
 
257
- /**
258
- * Admin inline scripts.
259
- *
260
- * @global $pagenow
261
- * @return void
262
- */
263
- public function admin_print_scripts() {
264
- global $pagenow;
265
-
266
- if ( $pagenow === 'upload.php' ) {
267
- if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
268
- ?>
269
- <script type="text/javascript">
270
- jQuery( function( $ ) {
271
- $( document ).ready( function() {
272
- var backup = <?php echo (int) $this->options['backup']['backup_image']; ?>;
273
-
274
- $( "<option>" ).val( "applywatermark" ).text( "<?php _e( 'Apply watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action'], select[name='action2']" );
275
-
276
- if ( backup === 1 ) {
277
- $( "<option>" ).val( "removewatermark" ).text( "<?php _e( 'Remove watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action'], select[name='action2']" );
278
- }
279
- });
280
- });
281
- </script>
282
- <?php
283
- }
284
- }
285
- }
286
-
287
  /**
288
  * Enqueue admin scripts and styles.
289
  *
@@ -340,8 +309,23 @@ final class Image_Watermark {
340
  wp_enqueue_script( 'postbox' );
341
  }
342
 
343
- if ( $pagenow === 'upload.php' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  wp_enqueue_style( 'watermark-style' );
 
345
 
346
  // image modal could be loaded in various places
347
  if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
@@ -497,10 +481,9 @@ final class Image_Watermark {
497
  <div class="clear"></div>
498
  </div>
499
  <script>
500
- jQuery( document ).ready( function( $ ) {
501
- if ( typeof watermarkImageActions !== "undefined" ) {
502
- $( "#image_watermark_buttons" ).show();
503
- }
504
  } );
505
  </script>'
506
  );
2
  /*
3
  Plugin Name: Image Watermark
4
  Description: Image Watermark allows you to automatically watermark images uploaded to the WordPress Media Library and bulk watermark previously uploaded images.
5
+ Version: 1.7.1
6
  Author: dFactory
7
  Author URI: https://dfactory.eu/
8
  Plugin URI: https://dfactory.eu/plugins/image-watermark/
32
  * Image Watermark class.
33
  *
34
  * @class Image_Watermark
35
+ * @version 1.7.1
36
  */
37
  final class Image_Watermark {
38
 
81
  'backup_quality' => 90
82
  )
83
  ),
84
+ 'version' => '1.7.1'
85
  );
86
  public $options = array();
87
 
109
  // actions
110
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
111
  add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
 
112
  add_action( 'wp_enqueue_media', array( $this, 'wp_enqueue_media' ) );
113
  add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
114
  add_action( 'load-upload.php', array( $this, 'watermark_bulk_action' ) );
253
  load_plugin_textdomain( 'image-watermark', false, basename( dirname( __FILE__ ) ) . '/languages' );
254
  }
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  /**
257
  * Enqueue admin scripts and styles.
258
  *
309
  wp_enqueue_script( 'postbox' );
310
  }
311
 
312
+ if ( $pagenow === 'upload.php' ) {
313
+ if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
314
+ wp_enqueue_script( 'watermark-admin-media', plugins_url( '/js/admin-media.js', __FILE__ ), array( 'jquery' ), $this->defaults['version'], false );
315
+
316
+ wp_localize_script(
317
+ 'watermark-admin-media',
318
+ 'iwMediaArgs',
319
+ array(
320
+ 'backupImage' => (int) $this->options['backup']['backup_image'],
321
+ 'applyWatermark' => __( 'Apply watermark', 'image-watermark' ),
322
+ 'removeWatermark' => __( 'Remove watermark', 'image-watermark' )
323
+ )
324
+ );
325
+ }
326
+
327
  wp_enqueue_style( 'watermark-style' );
328
+ }
329
 
330
  // image modal could be loaded in various places
331
  if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
481
  <div class="clear"></div>
482
  </div>
483
  <script>
484
+ jQuery( function() {
485
+ if ( typeof watermarkImageActions !== "undefined" )
486
+ jQuery( "#image_watermark_buttons" ).show();
 
487
  } );
488
  </script>'
489
  );
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: image, images, picture, photo, watermark, watermarking, protection, image protection, image security
5
  Requires at least: 4.3
6
- Requires PHP: 5.3
7
- Tested up to: 5.9.1
8
- Stable tag: 1.7.0
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
@@ -55,6 +55,9 @@ No questions yet.
55
 
56
  == Changelog ==
57
 
 
 
 
58
  = 1.7.0 =
59
  * Tweak: WordPress 5.9 compatibility
60
  * Tweak: PHP 8.x compatibility
@@ -192,6 +195,5 @@ Initial release
192
 
193
  == Upgrade Notice ==
194
 
195
- = 1.7.0 =
196
- * Tweak: WordPress 5.9 compatibility
197
- * Tweak: PHP 8.x compatibility
3
  Donate link: http://www.dfactory.eu/
4
  Tags: image, images, picture, photo, watermark, watermarking, protection, image protection, image security
5
  Requires at least: 4.3
6
+ Requires PHP: 5.4
7
+ Tested up to: 6.0
8
+ Stable tag: 1.7.1
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
11
 
55
 
56
  == Changelog ==
57
 
58
+ = 1.7.1 =
59
+ * Fix: Watermark option not available in Media Library
60
+
61
  = 1.7.0 =
62
  * Tweak: WordPress 5.9 compatibility
63
  * Tweak: PHP 8.x compatibility
195
 
196
  == Upgrade Notice ==
197
 
198
+ = 1.7.1 =
199
+ * Fix: Watermark option not available in Media Library