Image Watermark - Version 1.6.1

Version Description

  • Fix: Minor bug with AJAX requests, thanks to JoryHogeveen
  • Fix: Prevent watermarking the watermark image, thanks to JoryHogeveen
  • Tweak: Code cleanup
Download this release

Release Info

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

Code changes from version 1.6.0 to 1.6.1

css/image-watermark.css CHANGED
@@ -1,27 +1,86 @@
1
  /* Image Watermark settings */
2
- .df-credits { float: right; width: 280px; background: #fff; margin: 20px -300px 20px 20px; position: relative; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05); }
3
- .df-credits .inner { padding-left: 10px; padding-right: 10px; }
4
- .df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
5
- .df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
6
- .df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
7
- .image-watermark-settings .df-credits form { min-width: 260px; margin-bottom: 1em; }
8
- .image-watermark-settings .df-credits form input { margin: 0; padding: 0; }
9
- .image-watermark-settings { margin-right: 300px; }
10
- .image-watermark-settings hr, .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
11
- .image-watermark-settings form { float: left; min-width: 100%; width: auto; }
12
- .image-watermark-settings fieldset span.description { margin-bottom: 8px; margin-top: 4px; display: block; }
13
- .image-watermark-settings.ui-button { margin-bottom: 5px; }
14
- .image-watermark-settings .description { font-size: 13px; margin-bottom: 8px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  /* All Mobile Sizes (devices and browser) */
17
  @media only screen and (max-width: 959px) {
18
- .df-credits { width: 100%; float: none; margin: 20px 0; }
19
- .image-watermark-settings { margin-right: 0; }
20
  }
21
 
22
  /* Larger sizes */
23
  @media only screen and (min-width: 959px) {
24
- .df-credits { position: fixed; right: 0; margin: 0 20px; }
25
  }
26
 
27
  #cpt-select { margin-top: 5px; }
@@ -30,27 +89,27 @@
30
  .wplike-slider span.right { margin-left: 10px; }
31
 
32
  #image_watermark_buttons {
33
- margin: 10px 0;
34
  }
35
 
36
  .iw-overlay .spinner {
37
- margin: 0;
38
- height: 20px;
39
- width: 40px;
40
- padding: 0;
41
  }
42
 
43
  div.iw-notice {
44
- margin: 12px 0;
45
  }
46
 
47
  .iw-watermark-action {
48
- text-decoration: none;
49
  }
50
  .delete-watermark, .media-frame a.delete-watermark {
51
- color: #bc0b0b;
52
  }
53
 
54
  .delete-watermark:hover, .delete-watermark:focus, .media-frame a.delete-watermark:hover, .media-frame a.delete-watermark:focus {
55
- color: #f00;
56
  }
1
  /* Image Watermark settings */
2
+ .df-sidebar {
3
+ float: right;
4
+ width: 280px;
5
+ margin: 20px -300px 20px 20px;
6
+ position: relative;
7
+ }
8
+ .df-sidebar .df-credits {
9
+ background: #fff;
10
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
11
+ margin-bottom: 20px;
12
+ }
13
+ .df-sidebar .inner {
14
+ padding-left: 10px;
15
+ padding-right: 10px;
16
+ }
17
+ .df-sidebar h3 {
18
+ font-size: 14px;
19
+ line-height: 1.4;
20
+ margin: 0;
21
+ padding: 8px 12px;
22
+ border-bottom: 1px solid #eee;
23
+ }
24
+ .df-sidebar .df-link {
25
+ font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
26
+ font-style:italic;
27
+ padding-bottom: 10px;
28
+ margin: 0;
29
+ }
30
+ .df-sidebar .df-link a {
31
+ vertical-align: middle;
32
+ padding: 5px 0 0 4px;
33
+ }
34
+ .image-watermark-settings .df-credits form {
35
+ min-width: 260px;
36
+ margin-bottom: 1em;
37
+ }
38
+ .image-watermark-settings .df-credits form input {
39
+ margin: 0;
40
+ padding: 0;
41
+ }
42
+ .image-watermark-settings {
43
+ margin-right: 300px;
44
+ }
45
+ .image-watermark-settings hr, .df-credits hr {
46
+ border: solid #eee;
47
+ border-width: 1px 0 0;
48
+ clear: both;
49
+ height: 0;
50
+ }
51
+ .image-watermark-settings form {
52
+ float: left;
53
+ min-width: 100%;
54
+ width: auto;
55
+ }
56
+ .image-watermark-settings fieldset span.description {
57
+ margin-bottom: 8px;
58
+ margin-top: 4px;
59
+ display: block;
60
+ }
61
+ .image-watermark-settings.ui-button {
62
+ margin-bottom: 5px;
63
+ }
64
+ .image-watermark-settings .description {
65
+ font-size: 13px;
66
+ margin-bottom: 8px;
67
+ }
68
+ .image-watermark-settings #watermark_position td {
69
+ padding: 15px 20px;
70
+ }
71
+ .image-watermark-settings #watermark_position td input {
72
+ margin: 0;
73
+ }
74
 
75
  /* All Mobile Sizes (devices and browser) */
76
  @media only screen and (max-width: 959px) {
77
+ .df-sidebar { width: 100%; float: none; margin: 20px 0; }
78
+ .image-watermark-settings { margin-right: 0; }
79
  }
80
 
81
  /* Larger sizes */
82
  @media only screen and (min-width: 959px) {
83
+ .df-sidebar { position: fixed; right: 0; margin: 0 20px; }
84
  }
85
 
86
  #cpt-select { margin-top: 5px; }
89
  .wplike-slider span.right { margin-left: 10px; }
90
 
91
  #image_watermark_buttons {
92
+ margin: 10px 0;
93
  }
94
 
95
  .iw-overlay .spinner {
96
+ margin: 0;
97
+ height: 20px;
98
+ width: 40px;
99
+ padding: 0;
100
  }
101
 
102
  div.iw-notice {
103
+ margin: 12px 0;
104
  }
105
 
106
  .iw-watermark-action {
107
+ text-decoration: none;
108
  }
109
  .delete-watermark, .media-frame a.delete-watermark {
110
+ color: #bc0b0b;
111
  }
112
 
113
  .delete-watermark:hover, .delete-watermark:focus, .media-frame a.delete-watermark:hover, .media-frame a.delete-watermark:focus {
114
+ color: #f00;
115
  }
image-watermark.php CHANGED
@@ -1,1323 +1,1333 @@
1
- <?php
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.6.0
6
- Author: dFactory
7
- Author URI: http://www.dfactory.eu/
8
- Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
9
- License: MIT License
10
- License URI: http://opensource.org/licenses/MIT
11
- Text Domain: image-watermark
12
- Domain Path: /languages
13
-
14
- Image Watermark
15
- Copyright (C) 2013-2016, Digital Factory - info@digitalfactory.pl
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
- */
23
-
24
- // exit if accessed directly
25
- if ( ! defined( 'ABSPATH' ) )
26
- exit;
27
-
28
- define( 'IMAGE_WATERMARK_URL', plugins_url( '', __FILE__ ) );
29
- define( 'IMAGE_WATERMARK_PATH', plugin_dir_path( __FILE__ ) );
30
-
31
- /**
32
- * Image Watermark class.
33
- *
34
- * @class Image_Watermark
35
- * @version 1.6.0
36
- */
37
- final class Image_Watermark {
38
-
39
- /**
40
- * Main plugin instance.
41
- */
42
- private static $instance;
43
-
44
- private $is_admin = true;
45
- private $extension = false;
46
- private $allowed_mime_types = array(
47
- 'image/jpeg',
48
- 'image/pjpeg',
49
- 'image/png'
50
- );
51
- private $is_watermarked_metakey = 'iw-is-watermarked';
52
- public $is_backup_folder_writable = null;
53
- public $extensions;
54
- public $defaults = array(
55
- 'options' => array(
56
- 'watermark_on' => array(),
57
- 'watermark_cpt_on' => array( 'everywhere' ),
58
- 'watermark_image' => array(
59
- 'extension' => '',
60
- 'url' => 0,
61
- 'width' => 80,
62
- 'plugin_off' => 0,
63
- 'frontend_active' => false,
64
- 'manual_watermarking' => 0,
65
- 'position' => 'bottom_right',
66
- 'watermark_size_type' => 2,
67
- 'offset_width' => 0,
68
- 'offset_height' => 0,
69
- 'absolute_width' => 0,
70
- 'absolute_height' => 0,
71
- 'transparent' => 50,
72
- 'quality' => 90,
73
- 'jpeg_format' => 'baseline',
74
- 'deactivation_delete' => false,
75
- 'media_library_notice' => true
76
- ),
77
- 'image_protection' => array(
78
- 'rightclick' => 0,
79
- 'draganddrop' => 0,
80
- 'forlogged' => 0,
81
- ),
82
- 'backup' => array(
83
- 'backup_image' => true,
84
- 'backup_quality' => 90,
85
- ),
86
- ),
87
- 'version' => '1.6.0'
88
- );
89
- public $options = array();
90
-
91
- public function __construct() {
92
- // installer
93
- register_activation_hook( __FILE__, array( $this, 'activate_watermark' ) );
94
- register_deactivation_hook( __FILE__, array( $this, 'deactivate_watermark' ) );
95
-
96
- // settings
97
- $this->options = array_merge( $this->defaults['options'], get_option( 'image_watermark_options', $this->defaults['options'] ) );
98
-
99
- include_once( IMAGE_WATERMARK_PATH . 'includes/class-update.php' );
100
- include_once( IMAGE_WATERMARK_PATH . 'includes/class-settings.php' );
101
-
102
- // actions
103
- add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
104
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
105
- add_action( 'admin_print_scripts', array( $this, 'admin_print_scripts' ), 20 );
106
- add_action( 'wp_enqueue_media', array( $this, 'wp_enqueue_media' ) );
107
- add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
108
- add_action( 'load-upload.php', array( $this, 'watermark_bulk_action' ) );
109
- add_action( 'admin_init', array( $this, 'update_plugin' ) );
110
- add_action( 'admin_init', array( $this, 'check_extensions' ) );
111
- add_action( 'admin_notices', array( $this, 'bulk_admin_notices' ) );
112
- add_action( 'delete_attachment', array( $this, 'delete_attachment' ) );
113
- add_action( 'wp_ajax_iw_watermark_bulk_action', array( $this, 'watermark_action_ajax' ) );
114
-
115
- // filters
116
- add_filter( 'plugin_row_meta', array( $this, 'plugin_extend_links' ), 10, 2 );
117
- add_filter( 'plugin_action_links', array( $this, 'plugin_settings_link' ), 10, 2 );
118
- add_filter( 'wp_handle_upload', array( $this, 'handle_upload_files' ) );
119
- add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );
120
-
121
- // Define our backup location
122
- $upload_dir = wp_upload_dir();
123
- define( 'IMAGE_WATERMARK_BACKUP_DIR', apply_filters( 'image_watermark_backup_dir', $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'iw-backup' ) );
124
-
125
- // create backup folder and security if enabled
126
- if ( $this->options['backup']['backup_image'] ) {
127
-
128
- if ( is_writable( $upload_dir['basedir'] ) ) {
129
- $this->is_backup_folder_writable = true;
130
-
131
- // Create backup folder ( if it exists this returns true: https://codex.wordpress.org/Function_Reference/wp_mkdir_p )
132
- $backup_folder_created = wp_mkdir_p( IMAGE_WATERMARK_BACKUP_DIR );
133
-
134
- // Check if the folder exists and is writable
135
- if ( $backup_folder_created && is_writable( IMAGE_WATERMARK_BACKUP_DIR ) ) {
136
- // Check if the htaccess file exists
137
- if ( ! file_exists( IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . '.htaccess' ) ) {
138
- // htaccess security
139
- file_put_contents( IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . '.htaccess', 'deny from all' );
140
- }
141
- } else {
142
- $this->is_backup_folder_writable = false;
143
- }
144
- } else {
145
- $this->is_backup_folder_writable = false;
146
- }
147
- if ( true !== $this->is_backup_folder_writable ) {
148
- // Disable backup setting
149
- $this->options['backup']['backup_image'] = false;
150
- update_option( 'image_watermark_options', $this->options );
151
- }
152
-
153
- add_action( 'admin_notices', array( $this, 'filder_writable_admin_notice' ) );
154
- }
155
- }
156
-
157
- /**
158
- * Create single instance.
159
- *
160
- * @return object Main plugin instance
161
- */
162
- public static function instance() {
163
- if ( self::$instance === null )
164
- self::$instance = new self();
165
-
166
- return self::$instance;
167
- }
168
-
169
- /**
170
- * Plugin activation.
171
- */
172
- public function activate_watermark() {
173
- add_option( 'image_watermark_options', $this->defaults['options'], '', 'no' );
174
- add_option( 'image_watermark_version', $this->defaults['version'], '', 'no' );
175
- }
176
-
177
- /**
178
- * Plugin deactivation.
179
- */
180
- public function deactivate_watermark() {
181
- // remove options from database?
182
- if ( $this->options['watermark_image']['deactivation_delete'] )
183
- delete_option( 'image_watermark_options' );
184
- }
185
-
186
- /**
187
- * Plugin update, fix for version < 1.5.0
188
- */
189
- public function update_plugin() {
190
- if ( ! current_user_can( 'install_plugins' ) )
191
- return;
192
-
193
- $db_version = get_option( 'image_watermark_version' );
194
- $db_version = ! ( $db_version ) && ( get_option( 'df_watermark_installed' ) != false ) ? get_option( 'version' ) : $db_version;
195
-
196
- if ( $db_version != false ) {
197
- if ( version_compare( $db_version, '1.5.0', '<' ) ) {
198
- $options = array();
199
-
200
- $old_new = array(
201
- 'df_watermark_on' => 'watermark_on',
202
- 'df_watermark_cpt_on' => 'watermark_cpt_on',
203
- 'df_watermark_image' => 'watermark_image',
204
- 'df_image_protection' => 'image_protection',
205
- 'df_watermark_installed' => '',
206
- 'version' => '',
207
- 'image_watermark_version' => '',
208
- );
209
-
210
- foreach ( $old_new as $old => $new ) {
211
- if ( $new ) {
212
- $options[$new] = get_option( $old );
213
- }
214
- delete_option( $old );
215
- }
216
-
217
- add_option( 'image_watermark_options', $options, '', 'no' );
218
- add_option( 'image_watermark_version', $this->defaults['version'], '', 'no' );
219
- }
220
- }
221
- }
222
-
223
- /**
224
- * Load textdomain.
225
- */
226
- public function load_textdomain() {
227
- load_plugin_textdomain( 'image-watermark', false, basename( dirname( __FILE__ ) ) . '/languages' );
228
- }
229
-
230
- /**
231
- * Admin inline scripts.
232
- */
233
- public function admin_print_scripts() {
234
- global $pagenow;
235
-
236
- if ( $pagenow === 'upload.php' ) {
237
- if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
238
- ?>
239
- <script type="text/javascript">
240
- jQuery( function( $ ) {
241
- $( document ).ready( function() {
242
- var backup = <?php echo (int)$this->options['backup']['backup_image']; ?>;
243
-
244
- $( "<option>" ).val( "applywatermark" ).text( "<?php _e( 'Apply watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action']" );
245
- $( "<option>" ).val( "applywatermark" ).text( "<?php _e( 'Apply watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action2']" );
246
-
247
- if ( backup === 1 ) {
248
- $( "<option>" ).val( "removewatermark" ).text( "<?php _e( 'Remove watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action']" );
249
- $( "<option>" ).val( "removewatermark" ).text( "<?php _e( 'Remove watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action2']" );
250
- }
251
- });
252
- });
253
- </script>
254
- <?php
255
- }
256
- }
257
- }
258
-
259
- /**
260
- * Enqueue admin scripts and styles.
261
- */
262
- public function wp_enqueue_media( $page ) {
263
- wp_enqueue_style( 'watermark-style', plugins_url( 'css/image-watermark.css', __FILE__ ), array(), $this->defaults['version'] );
264
- }
265
-
266
- /**
267
- * Enqueue admin scripts and styles.
268
- */
269
- public function admin_enqueue_scripts( $page ) {
270
- global $pagenow;
271
-
272
- wp_register_style( 'watermark-style', plugins_url( 'css/image-watermark.css', __FILE__ ), array(), $this->defaults['version'] );
273
-
274
- if ( $page === 'settings_page_watermark-options' ) {
275
- wp_enqueue_media();
276
-
277
- wp_enqueue_script( 'upload-manager', plugins_url( '/js/admin-upload.js', __FILE__ ), array(), $this->defaults['version'] );
278
-
279
- wp_localize_script(
280
- 'upload-manager',
281
- 'iwUploadArgs',
282
- array(
283
- 'title' => __( 'Select watermark', 'image-watermark' ),
284
- 'originalSize' => __( 'Original size', 'image-watermark' ),
285
- 'noSelectedImg' => __( 'Watermak has not been selected yet.', 'image-watermark' ),
286
- 'notAllowedImg' => __( 'This image is not supported as watermark. Use JPEG, PNG or GIF.', 'image-watermark' ),
287
- 'px' => __( 'px', 'image-watermark' ),
288
- 'frame' => 'select',
289
- 'button' => array( 'text' => __( 'Add watermark', 'image-watermark' ) ),
290
- 'multiple' => false
291
- )
292
- );
293
-
294
- wp_enqueue_script( 'watermark-admin-script', plugins_url( 'js/admin-settings.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-slider' ), $this->defaults['version'] );
295
-
296
- wp_localize_script(
297
- 'watermark-admin-script',
298
- 'iwArgs',
299
- array(
300
- 'resetToDefaults' => __( 'Are you sure you want to reset settings to defaults?', 'image-watermark' )
301
- )
302
- );
303
-
304
- wp_enqueue_style( 'wp-like-ui-theme', plugins_url( 'css/wp-like-ui-theme.css', __FILE__ ), array(), $this->defaults['version'] );
305
- wp_enqueue_style( 'watermark-style' );
306
-
307
- wp_enqueue_script( 'postbox' );
308
- }
309
-
310
- if ( $pagenow === 'upload.php' ) {
311
- wp_enqueue_style( 'watermark-style' );
312
- }
313
-
314
- // I've omitted $pagenow === 'upload.php' because the image modal could be loaded in various places
315
- if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
316
-
317
- wp_enqueue_script( 'watermark-admin-image-actions', plugins_url( '/js/admin-image-actions.js', __FILE__ ), array( 'jquery' ), $this->defaults['version'], true );
318
-
319
- wp_localize_script(
320
- 'watermark-admin-image-actions',
321
- 'iwImageActionArgs',
322
- array(
323
- 'backup_image' => (int)$this->options['backup']['backup_image'],
324
- '_nonce' => wp_create_nonce( 'image-watermark' ),
325
- '__applied_none' => __( 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ),
326
- '__applied_one' => __( 'Watermark was succesfully applied to 1 image.', 'image-watermark' ),
327
- '__applied_multi' => __( 'Watermark was succesfully applied to %s images.', 'image-watermark' ),
328
- '__removed_none' => __( 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ),
329
- '__removed_one' => __( 'Watermark was succesfully removed from 1 image.', 'image-watermark' ),
330
- '__removed_multi' => __( 'Watermark was succesfully removed from %s images.', 'image-watermark' ),
331
- '__skipped' => __( 'Skipped files', 'image-watermark' ),
332
- '__running' => __( 'Bulk action is currently running, please wait.', 'image-watermark' ),
333
- '__dismiss' => __( 'Dismiss this notice.' ), // Wordpress default string
334
- )
335
- );
336
- }
337
- }
338
-
339
- /**
340
- * Enqueue frontend script with 'no right click' and 'drag and drop' functions.
341
- */
342
- public function wp_enqueue_scripts() {
343
- if ( ($this->options['image_protection']['forlogged'] == 0 && is_user_logged_in()) || ($this->options['image_protection']['draganddrop'] == 0 && $this->options['image_protection']['rightclick'] == 0) )
344
- return;
345
-
346
- wp_enqueue_script( 'no-right-click', plugins_url( 'js/no-right-click.js', __FILE__ ), array(), $this->defaults['version'] );
347
-
348
- wp_localize_script(
349
- 'no-right-click', 'norightclick_args', array(
350
- 'rightclick' => ($this->options['image_protection']['rightclick'] == 1 ? 'Y' : 'N'),
351
- 'draganddrop' => ($this->options['image_protection']['draganddrop'] == 1 ? 'Y' : 'N')
352
- )
353
- );
354
- }
355
-
356
- /**
357
- * Check which extension is available and set it.
358
- *
359
- * @return void
360
- */
361
- public function check_extensions() {
362
- $ext = null;
363
-
364
- if ( $this->check_imagick() ) {
365
- $this->extensions['imagick'] = 'ImageMagick';
366
- $ext = 'imagick';
367
- }
368
-
369
- if ( $this->check_gd() ) {
370
- $this->extensions['gd'] = 'GD';
371
-
372
- if ( is_null( $ext ) )
373
- $ext = 'gd';
374
- }
375
-
376
- if ( isset( $this->options['watermark_image']['extension'] ) ) {
377
- if ( $this->options['watermark_image']['extension'] === 'imagick' && isset( $this->extensions['imagick'] ) )
378
- $this->extension = 'imagick';
379
- elseif ( $this->options['watermark_image']['extension'] === 'gd' && isset( $this->extensions['gd'] ) )
380
- $this->extension = 'gd';
381
- else
382
- $this->extension = $ext;
383
- } else
384
- $this->extension = $ext;
385
- }
386
-
387
- /**
388
- * Apply watermark everywhere or for specific post types.
389
- *
390
- * @param resource $file
391
- * @return resource
392
- */
393
- public function handle_upload_files( $file ) {
394
- // is extension available?
395
- if ( $this->extension ) {
396
- // determine ajax frontend or backend request
397
- $script_filename = isset( $_SERVER['SCRIPT_FILENAME'] ) ? $_SERVER['SCRIPT_FILENAME'] : '';
398
-
399
- // try to figure out if frontend AJAX request... if we are DOING_AJAX; let's look closer
400
- if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
401
- // from wp-includes/functions.php, wp_get_referer() function.
402
- // required to fix: https://core.trac.wordpress.org/ticket/25294
403
- $ref = '';
404
- if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
405
- $ref = wp_unslash( $_REQUEST['_wp_http_referer'] );
406
- elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) )
407
- $ref = wp_unslash( $_SERVER['HTTP_REFERER'] );
408
-
409
- // if referer does not contain admin URL and we are using the admin-ajax.php endpoint, this is likely a frontend AJAX request
410
- if ( ( ( strpos( $ref, admin_url() ) === false ) && ( basename( $script_filename ) === 'admin-ajax.php' ) ) )
411
- $this->is_admin = false;
412
- else
413
- $this->is_admin = true;
414
- // not an AJAX request, simple here
415
- } else {
416
- if ( is_admin() )
417
- $this->is_admin = true;
418
- else
419
- $this->is_admin = false;
420
- }
421
-
422
- // admin
423
- if ( $this->is_admin === true ) {
424
- if ( $this->options['watermark_image']['plugin_off'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
425
- add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
426
- }
427
- // frontend
428
- } else {
429
- if ( $this->options['watermark_image']['frontend_active'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
430
- add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
431
- }
432
- }
433
- }
434
-
435
- return $file;
436
- }
437
-
438
- /**
439
- * Add watermark buttons on attachment image locations
440
- */
441
- public function attachment_fields_to_edit( $form_fields, $post ) {
442
-
443
- if ( $this->options['watermark_image']['manual_watermarking'] == 1 && $this->options['backup']['backup_image'] ) {
444
-
445
- $data = wp_get_attachment_metadata( $post->ID, false );
446
-
447
- // is this really an image?
448
- if ( in_array( get_post_mime_type( $post->ID ), $this->allowed_mime_types ) && is_array( $data ) ) {
449
- $form_fields['image_watermark'] = array(
450
- 'show_in_edit' => false,
451
- 'tr' => '
452
- <div id="image_watermark_buttons"' . ( get_post_meta( $post->ID, $this->is_watermarked_metakey, true ) ? ' class="watermarked"' : '' ) . ' data-id="' . $post->ID . '" style="display: none;">
453
- <label class="setting">
454
- <span class="name">' . __( 'Image Watermark', 'image-watermark' ) . '</span>
455
- <span class="value" style="width: 63%"><a href="#" class="iw-watermark-action" data-action="applywatermark" data-id="' . $post->ID . '">' . __( 'Apply watermark', 'image-watermark' ) . '</a> | <a href="#" class="iw-watermark-action delete-watermark" data-action="removewatermark" data-id="' . $post->ID . '">' . __( 'Remove watermark', 'image-watermark' ) . '</a></span>
456
- </label>
457
- <div class="clear"></div>
458
- </div>
459
- <script>
460
- jQuery( document ).ready( function ( $ ) {
461
- if ( typeof watermarkImageActions != "undefined" ) {
462
- $( "#image_watermark_buttons" ).show();
463
- }
464
- });
465
- </script>'
466
- );
467
- }
468
- }
469
- return $form_fields;
470
- }
471
-
472
- /**
473
- * Apply watermark for selected images on media page.
474
- */
475
- public function watermark_action_ajax() {
476
- // Security & data check
477
- if ( ! defined( 'DOING_AJAX' )
478
- || ! DOING_AJAX
479
- || ! isset( $_POST['_iw_nonce'] )
480
- || ! isset( $_POST['iw-action'] )
481
- || ! isset( $_POST['attachment_id'] )
482
- || ! is_numeric( $_POST['attachment_id'] )
483
- || ! wp_verify_nonce( $_POST['_iw_nonce'], 'image-watermark' )
484
- || ! $this->options['backup']['backup_image']
485
- )
486
- wp_send_json_error( __('Cheatin uh?', 'image-watermark') );
487
-
488
- $post_id = (int) $_POST['attachment_id'];
489
- $action = false;
490
-
491
- switch ( $_POST['iw-action'] ) {
492
- case 'applywatermark': $action = 'applywatermark'; break;
493
- case 'removewatermark': $action = 'removewatermark'; break;
494
- }
495
-
496
- // only if manual watermarking is turned and we have a valid action
497
- // if the action is NOT "removewatermark" we also require a watermark image to be set
498
- if ( $post_id > 0 && $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
499
-
500
- $data = wp_get_attachment_metadata( $post_id, false );
501
-
502
- // is this really an image?
503
- if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
504
-
505
- if ( $action === 'applywatermark' ) {
506
- $this->apply_watermark( $data, $post_id, 'manual' );
507
- wp_send_json_success( 'watermarked' );
508
-
509
- } elseif ( $action === 'removewatermark' ) {
510
- $success = $this->remove_watermark( $data, $post_id, 'manual' );
511
- if ( $success ) {
512
- wp_send_json_success( 'watermarkremoved' );
513
- } else {
514
- wp_send_json_success( 'skipped' );
515
- }
516
- }
517
- } else {
518
- wp_send_json_success( 'skipped' );
519
- }
520
- }
521
-
522
- wp_send_json_error( __('Cheatin uh?', 'image-watermark') );
523
- }
524
-
525
- /**
526
- * Apply watermark for selected images on media page.
527
- */
528
- public function watermark_bulk_action() {
529
- global $pagenow;
530
-
531
- if ( $pagenow == 'upload.php' && $this->extension ) {
532
- $wp_list_table = _get_list_table( 'WP_Media_List_Table' );
533
-
534
- $action = false;
535
- switch ( $wp_list_table->current_action() ) {
536
- case 'applywatermark': $action = 'applywatermark'; break;
537
- case 'removewatermark': $action = 'removewatermark'; break;
538
- }
539
- // only if manual watermarking is turned and we have a valid action
540
- // if the action is NOT "removewatermark" we also require a watermark image to be set
541
- if ( $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
542
- // security check
543
- check_admin_referer( 'bulk-media' );
544
-
545
- $location = esc_url( remove_query_arg( array( 'watermarked', 'watermarkremoved', 'skipped', 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), wp_get_referer() ) );
546
-
547
- if ( ! $location ) {
548
- $location = 'upload.php';
549
- }
550
-
551
- $location = esc_url( add_query_arg( 'paged', $wp_list_table->get_pagenum(), $location ) );
552
-
553
- // make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
554
- if ( isset( $_REQUEST['media'] ) ) {
555
- $post_ids = array_map( 'intval', $_REQUEST['media'] );
556
- }
557
-
558
- // do we have selected attachments?
559
- if ( $post_ids ) {
560
-
561
- $watermarked = $watermarkremoved = $skipped = 0;
562
-
563
- foreach ( $post_ids as $post_id ) {
564
- $data = wp_get_attachment_metadata( $post_id, false );
565
-
566
- // is this really an image?
567
- if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
568
- if ( $action === 'applywatermark' ) {
569
- $this->apply_watermark( $data, $post_id, 'manual' );
570
- $watermarked ++;
571
- $watermarkremoved = -1;
572
- } elseif ( $action === 'removewatermark' ) {
573
- $success = $this->remove_watermark( $data, $post_id, 'manual' );
574
- if ( $success ) {
575
- $watermarkremoved ++;
576
- } else {
577
- $skipped ++;
578
- }
579
- $watermarked = -1;
580
- }
581
- } else {
582
- $skipped ++;
583
- }
584
- }
585
-
586
- $location = esc_url( add_query_arg( array( 'watermarked' => $watermarked, 'watermarkremoved' => $watermarkremoved, 'skipped' => $skipped ), $location ), null, '' );
587
- }
588
-
589
- wp_redirect( $location );
590
- exit();
591
- } else
592
- return;
593
- }
594
- }
595
-
596
- /**
597
- * Display admin notices.
598
- */
599
- public function bulk_admin_notices() {
600
- global $post_type, $pagenow;
601
-
602
- if ( $pagenow === 'upload.php' ) {
603
-
604
- if ( ! current_user_can( 'upload_files' ) )
605
- return;
606
-
607
- // hide media library notice
608
- if ( isset( $_GET['iw_action'] ) && $_GET['iw_action'] == 'hide_library_notice' ) {
609
- $this->options['watermark_image']['media_library_notice'] = false;
610
- update_option( 'image_watermark_options', $this->options );
611
- }
612
-
613
- // check if manual watermarking is enabled
614
- if ( ! empty( $this->options['watermark_image']['manual_watermarking'] ) && ( ! isset( $this->options['watermark_image']['media_library_notice']) || $this->options['watermark_image']['media_library_notice'] === true ) ) {
615
- $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
616
-
617
- if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], array( 'grid', 'list' ) ) ) {
618
- $mode = $_GET['mode'];
619
- }
620
-
621
- // display notice in grid mode only
622
- if ( $mode === 'grid' ) {
623
- // get current admin url
624
- $query_string = array();
625
- parse_str( $_SERVER['QUERY_STRING'], $query_string );
626
- $current_url = esc_url( add_query_arg( array_merge( (array) $query_string, array( 'iw_action' => 'hide_library_notice' ) ), '', admin_url( trailingslashit( $pagenow ) ) ) );
627
-
628
- echo '<div class="error notice"><p>' . sprintf( __( '<strong>Image Watermark:</strong> Bulk watermarking is available in list mode only, under <em>Bulk Actions</em> dropdown. <a href="%1$s">Got to List Mode</a> or <a href="%2$s">Hide this notice</a>', 'image-watermark' ), esc_url( admin_url( 'upload.php?mode=list' ) ), esc_url( $current_url ) ) . '</p></div>';
629
- }
630
- }
631
-
632
- if ( isset( $_REQUEST['watermarked'], $_REQUEST['watermarkremoved'], $_REQUEST['skipped'] ) && $post_type === 'attachment' ) {
633
- $watermarked = (int) $_REQUEST['watermarked'];
634
- $watermarkremoved = (int) $_REQUEST['watermarkremoved'];
635
- $skipped = (int) $_REQUEST['skipped'];
636
-
637
- if ( $watermarked === 0 ) {
638
- echo '<div class="error"><p>' . __( 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
639
- } elseif ( $watermarked > 0 ) {
640
- echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully applied to 1 image.', 'Watermark was succesfully applied to %s images.', $watermarked, 'image-watermark' ), number_format_i18n( $watermarked ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
641
- }
642
- if ( $watermarkremoved === 0 ) {
643
- echo '<div class="error"><p>' . __( 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
644
- } elseif ( $watermarkremoved > 0 ) {
645
- echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully removed from 1 image.', 'Watermark was succesfully removed from %s images.', $watermarkremoved, 'image-watermark' ), number_format_i18n( $watermarkremoved ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
646
- }
647
-
648
- $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'watermarked', 'skipped' ), $_SERVER['REQUEST_URI'] ) );
649
- }
650
- }
651
- }
652
-
653
- /**
654
- * Check whether ImageMagick extension is available.
655
- *
656
- * @return boolean True if extension is available
657
- */
658
- public function check_imagick() {
659
- // check Imagick's extension and classes
660
- if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick', false ) || ! class_exists( 'ImagickPixel', false ) )
661
- return false;
662
-
663
- // check version
664
- if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
665
- return false;
666
-
667
- // check for deep requirements within Imagick
668
- if ( ! defined( 'imagick::COMPRESSION_JPEG' ) || ! defined( 'imagick::COMPOSITE_OVERLAY' ) || ! defined( 'Imagick::INTERLACE_PLANE' ) || ! defined( 'imagick::FILTER_CATROM' ) || ! defined( 'Imagick::CHANNEL_ALL' ) )
669
- return false;
670
-
671
- // check methods
672
- if ( array_diff( array( 'clear', 'destroy', 'valid', 'getimage', 'writeimage', 'getimagegeometry', 'getimageformat', 'setimageformat', 'setimagecompression', 'setimagecompressionquality', 'scaleimage' ), get_class_methods( 'Imagick' ) ) )
673
- return false;
674
-
675
- return true;
676
- }
677
-
678
- /**
679
- * Check whether GD extension is available.
680
- *
681
- * @return boolean True if extension is available
682
- */
683
- public function check_gd( $args = array() ) {
684
- // check extension
685
- if ( ! extension_loaded( 'gd' ) || ! function_exists( 'gd_info' ) )
686
- return false;
687
-
688
- return true;
689
- }
690
-
691
- /**
692
- * Apply watermark to selected image sizes.
693
- *
694
- * @param array $data
695
- * @param int|string $attachment_id Attachment ID
696
- * @param string $method
697
- * @return array
698
- */
699
- public function apply_watermark( $data, $attachment_id, $method = '' ) {
700
- $post = get_post( (int) $attachment_id );
701
- $post_id = ( ! empty( $post ) ? (int) $post->post_parent : 0 );
702
-
703
- // something went wrong or is it automatic mode?
704
- if ( $method !== 'manual'
705
- && (
706
- $this->is_admin === true
707
- && ! (
708
- ( isset( $this->options['watermark_cpt_on'][0] ) && $this->options['watermark_cpt_on'][0] === 'everywhere' )
709
- || ( $post_id > 0 && in_array( get_post_type( $post_id ), array_keys( $this->options['watermark_cpt_on'] ) ) === true )
710
- )
711
- )
712
- )
713
- return $data;
714
-
715
- if ( apply_filters( 'iw_watermark_display', $attachment_id ) === false )
716
- return $data;
717
-
718
- $upload_dir = wp_upload_dir();
719
-
720
- // is this really an image?
721
- if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
722
- // Remove the watermark if this image was allready watermarked, not === because the database can't hold booleans
723
- if ( get_post_meta( $attachment_id, $this->is_watermarked_metakey ) == true )
724
- $this->remove_watermark( $data, $attachment_id, 'manual' );
725
-
726
- // create a backup if this is enabled
727
- if ( $this->options['backup']['backup_image'] )
728
- $this->do_backup( $data, $upload_dir, $attachment_id );
729
-
730
- // loop through active image sizes
731
- foreach ( $this->options['watermark_on'] as $image_size => $active_size ) {
732
-
733
- if ( $active_size === 1 ) {
734
- switch ( $image_size ) {
735
- case 'full':
736
- $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
737
- break;
738
-
739
- default:
740
- if ( ! empty( $data['sizes'] ) && array_key_exists( $image_size, $data['sizes'] ) )
741
- $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname( $data['file'] ) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
742
- else
743
- // early getaway
744
- continue 2;
745
- }
746
-
747
- do_action( 'iw_before_apply_watermark', $attachment_id, $image_size );
748
-
749
- // apply watermark
750
- $this->do_watermark( $attachment_id, $filepath, $image_size, $upload_dir );
751
-
752
- do_action( 'iw_after_apply_watermark', $attachment_id, $image_size );
753
- }
754
- }
755
- // Update watermark status
756
- update_post_meta( $attachment_id, $this->is_watermarked_metakey, true );
757
- }
758
-
759
- // pass forward attachment metadata
760
- return $data;
761
- }
762
-
763
- /**
764
- * Remove watermark to selected image sizes.
765
- *
766
- * @param array $data
767
- * @param int|string $attachment_id Attachment ID
768
- * @param string $method
769
- * @return array
770
- */
771
- private function remove_watermark( $data, $attachment_id, $method = '' ) {
772
- if ( $method !== 'manual' ) {
773
- return $data;
774
- }
775
-
776
- $upload_dir = wp_upload_dir();
777
-
778
- // is this really an image?
779
- if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
780
-
781
- // Live file path (probably watermarked)
782
- $filepath = get_attached_file( $attachment_id );
783
-
784
- // Backup file path (not watermarked)
785
- $backup_filepath = $this->get_image_backup_filepath( get_post_meta( $attachment_id, '_wp_attached_file', true ) );
786
-
787
- // Replace the image in uploads with our backup if one exists
788
- if ( file_exists( $backup_filepath ) ) {
789
- if ( ! copy( $backup_filepath, $filepath ) ) {
790
- // Failed to copy
791
- }
792
- }
793
- // If no backup exists, use the current full-size image to regenerate
794
- // If the "full" size is enabled for watermarks and no backup has been made the removal of watermarks can't be done
795
-
796
- // Regenerate metadata (and thumbs)
797
- $metadata = wp_generate_attachment_metadata( $attachment_id, $filepath );
798
-
799
- // Update attachment metadata with new metadata
800
- wp_update_attachment_metadata( $attachment_id, $metadata );
801
-
802
- // Update watermark status
803
- update_post_meta( $attachment_id, $this->is_watermarked_metakey, false );
804
-
805
- // Return the attachment metadata
806
- return wp_get_attachment_metadata( $attachment_id );
807
- }
808
- return false;
809
- }
810
-
811
- /**
812
- * Apply watermark to image.
813
- *
814
- * @param int $attachment_id Attachment ID
815
- * @param string $image_path Path to the file
816
- * @param string $image_size Image size
817
- * @param array $upload_dir Upload media data
818
- * @return void
819
- */
820
- public function do_watermark( $attachment_id, $image_path, $image_size, $upload_dir ) {
821
- $options = apply_filters( 'iw_watermark_options', $this->options );
822
-
823
- // get image mime type
824
- $mime = wp_check_filetype( $image_path );
825
-
826
- // get watermark path
827
- $watermark_file = wp_get_attachment_metadata( $options['watermark_image']['url'], true );
828
- $watermark_path = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $watermark_file['file'];
829
-
830
- // imagick extension
831
- if ( $this->extension === 'imagick' ) {
832
- // create image resource
833
- $image = new Imagick( $image_path );
834
-
835
- // create watermark resource
836
- $watermark = new Imagick( $watermark_path );
837
-
838
- // set transparency
839
- $image->setImageOpacity( round( 1 - (float)( $options['watermark_image']['transparent'] / 100 ), 2 ) );
840
-
841
- // set compression quality
842
- if ( $mime['type'] === 'image/jpeg' ) {
843
- $image->setImageCompressionQuality( $options['watermark_image']['quality'] );
844
- $image->setImageCompression( imagick::COMPRESSION_JPEG );
845
- } else
846
- $image->setImageCompressionQuality( $options['watermark_image']['quality'] );
847
-
848
- // set image output to progressive
849
- if ( $options['watermark_image']['jpeg_format'] === 'progressive' )
850
- $image->setImageInterlaceScheme( Imagick::INTERLACE_PLANE );
851
-
852
- // get image dimensions
853
- $image_dim = $image->getImageGeometry();
854
-
855
- // get watermark dimensions
856
- $watermark_dim = $watermark->getImageGeometry();
857
-
858
- // calculate watermark new dimensions
859
- list( $width, $height ) = $this->calculate_watermark_dimensions( $image_dim['width'], $image_dim['height'], $watermark_dim['width'], $watermark_dim['height'], $options );
860
-
861
- // resize watermark
862
- $watermark->resizeImage( $width, $height, imagick::FILTER_CATROM, 1 );
863
-
864
- // calculate image coordinates
865
- list( $dest_x, $dest_y ) = $this->calculate_image_coordinates( $image_dim['width'], $image_dim['height'], $width, $height, $options );
866
-
867
- // combine two images together
868
- $image->compositeImage( $watermark, Imagick::COMPOSITE_OVERLAY, $dest_x, $dest_y, Imagick::CHANNEL_ALL );
869
-
870
- // save watermarked image
871
- $image->writeImage( $image_path );
872
-
873
- // clear image memory
874
- $image->clear();
875
- $image->destroy();
876
- $image = null;
877
-
878
- // clear watermark memory
879
- $watermark->clear();
880
- $watermark->destroy();
881
- $watermark = null;
882
- // gd extension
883
- } else {
884
- // get image resource
885
- $image = $this->get_image_resource( $image_path, $mime['type'] );
886
-
887
- if ( $image !== false ) {
888
- // add watermark image to image
889
- $image = $this->add_watermark_image( $image, $options, $upload_dir );
890
-
891
- if ( $image !== false ) {
892
- // save watermarked image
893
- $this->save_image_file( $image, $mime['type'], $image_path, $options['watermark_image']['quality'] );
894
-
895
- // clear watermark memory
896
- imagedestroy( $image );
897
-
898
- $image = null;
899
- }
900
- }
901
- }
902
- }
903
-
904
- /**
905
- * Make a backup of the full size image
906
- *
907
- * $param
908
- * $return bool
909
- */
910
- private function do_backup( $data, $upload_dir, $attachment_id ) {
911
- // get the filepath for the backup image we're creating
912
- $backup_filepath = $this->get_image_backup_filepath( $data['file'] );
913
-
914
- // Make sure the backup isn't created yet
915
- if ( ! file_exists( $backup_filepath ) ) {
916
- // The original (full size) image
917
- $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
918
- $mime = wp_check_filetype( $filepath );
919
-
920
- // get image resource
921
- $image = $this->get_image_resource( $filepath, $mime['type'] );
922
-
923
- if ( false !== $image ) {
924
- // create backup directory if needed
925
- wp_mkdir_p( $this->get_image_backup_folder_location( $data['file'] ) );
926
-
927
- // save backup image
928
- $this->save_image_file( $image, $mime['type'], $backup_filepath, $this->options['backup']['backup_quality'] );
929
-
930
- // clear backup memory
931
- imagedestroy( $image );
932
- $image = null;
933
- }
934
- }
935
- }
936
-
937
- /**
938
- * Get image resource accordingly to mimetype.
939
- *
940
- * @param string $filepath
941
- * @param string $mime_type
942
- * @return resource
943
- */
944
- private function get_image_resource( $filepath, $mime_type ) {
945
- switch ( $mime_type ) {
946
- case 'image/jpeg':
947
- case 'image/pjpeg':
948
- $image = imagecreatefromjpeg( $filepath );
949
- break;
950
-
951
- case 'image/png':
952
- $image = imagecreatefrompng( $filepath );
953
-
954
- imagefilledrectangle( $image, 0, 0, imagesx( $image ), imagesy( $image ), imagecolorallocatealpha( $image, 255, 255, 255, 127 ) );
955
- break;
956
-
957
- default:
958
- $image = false;
959
- }
960
-
961
- if ( is_resource( $image ) ) {
962
- imagealphablending( $image, false );
963
- imagesavealpha( $image, true );
964
- }
965
-
966
- return $image;
967
- }
968
-
969
- /**
970
- * Get image filename without the uploaded folders
971
- *
972
- * @param string $filepath
973
- * @return string $filename
974
- */
975
- private function get_image_filename( $filepath ) {
976
- return basename( $filepath );
977
- }
978
-
979
- /**
980
- * Get image backup folder
981
- *
982
- * @param string $filepath
983
- * @return string $image_backup_folder
984
- */
985
- private function get_image_backup_folder_location( $filepath ) {
986
- $path = explode( DIRECTORY_SEPARATOR, $filepath );
987
- array_pop( $path );
988
- $path = implode( DIRECTORY_SEPARATOR, $path );
989
- // Multisite?
990
- /*if ( is_multisite() && ! is_main_site() ) {
991
- $path = 'sites' . DIRECTORY_SEPARATOR . get_current_blog_id() . DIRECTORY_SEPARATOR . $path;
992
- }*/
993
- return IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . $path;
994
- }
995
-
996
- /**
997
- * Get image resource from the backup folder (if available).
998
- *
999
- * @param string $filepath
1000
- * @return string $backup_filepath
1001
- */
1002
- private function get_image_backup_filepath( $filepath ) {
1003
- // Multisite?
1004
- /*if ( is_multisite() && ! is_main_site() ) {
1005
- $filepath = 'sites' . DIRECTORY_SEPARATOR . get_current_blog_id() . DIRECTORY_SEPARATOR . $filepath;
1006
- }*/
1007
- return IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . $filepath;
1008
- }
1009
-
1010
- /**
1011
- * Delete the image backup if one exists
1012
- *
1013
- * @param int $attachment_id
1014
- * @return bool $force_delete
1015
- */
1016
- public function delete_attachment( $attachment_id ) {
1017
- // see get_attached_file() in wp-includes/post.php
1018
- $filepath = get_post_meta( $attachment_id, '_wp_attached_file', true );
1019
- $backup_filepath = $this->get_image_backup_filepath( $filepath );
1020
-
1021
- if ( file_exists( $backup_filepath ) ) {
1022
- unlink( $backup_filepath );
1023
- }
1024
- }
1025
-
1026
- /**
1027
- * Create admin notice when we can't create the backup folder
1028
- * @return void
1029
- */
1030
- function filder_writable_admin_notice() {
1031
- if ( current_user_can('manage_options') && true !== $this->is_backup_folder_writable ) {
1032
- ?>
1033
- <div class="notice notice-error is-dismissible">
1034
- <p><?php _e( 'Image Watermark', 'image-watermark' ); ?> - <?php _e( 'Image backup', 'image-watermark' ); ?>: <?php _e( "Your uploads folder is not writable so we can't create a backup of your image uploads. We've disabled this feature for now.", 'image-watermark' ); ?></p>
1035
- </div>
1036
- <?php
1037
- }
1038
- }
1039
-
1040
- /**
1041
- * Calculate watermark dimensions.
1042
- *
1043
- * @param $image_width Image width
1044
- * @param $image_height Image height
1045
- * @param $watermark_width Watermark width
1046
- * @param $watermark_height Watermark height
1047
- * @param $options Options
1048
- * @return array Watermark new dimensions
1049
- */
1050
- private function calculate_watermark_dimensions( $image_width, $image_height, $watermark_width, $watermark_height, $options ) {
1051
- // custom
1052
- if ( $options['watermark_image']['watermark_size_type'] === 1 ) {
1053
- $width = $options['watermark_image']['absolute_width'];
1054
- $height = $options['watermark_image']['absolute_height'];
1055
- // scale
1056
- } elseif ( $options['watermark_image']['watermark_size_type'] === 2 ) {
1057
- $ratio = $image_width * $options['watermark_image']['width'] / 100 / $watermark_width;
1058
-
1059
- $width = (int) ( $watermark_width * $ratio );
1060
- $height = (int) ( $watermark_height * $ratio );
1061
-
1062
- // if watermark scaled height is bigger then image watermark
1063
- if ( $height > $image_height ) {
1064
- $width = (int) ( $image_height * $width / $height );
1065
- $height = $image_height;
1066
- }
1067
- // original
1068
- } else {
1069
- $width = $watermark_width;
1070
- $height = $watermark_height;
1071
- }
1072
-
1073
- return array( $width, $height );
1074
- }
1075
-
1076
- /**
1077
- * Calculate image coordinates for watermark.
1078
- *
1079
- * @param $image_width Image width
1080
- * @param $image_height Image height
1081
- * @param $watermark_width Watermark width
1082
- * @param $watermark_height Watermark height
1083
- * @param $options Options
1084
- * @return array Image coordinates
1085
- */
1086
- private function calculate_image_coordinates( $image_width, $image_height, $watermark_width, $watermark_height, $options ) {
1087
- switch ( $options['watermark_image']['position'] ) {
1088
- case 'top_left':
1089
- $dest_x = $dest_y = 0;
1090
- break;
1091
-
1092
- case 'top_center':
1093
- $dest_x = ( $image_width / 2 ) - ( $watermark_width / 2 );
1094
- $dest_y = 0;
1095
- break;
1096
-
1097
- case 'top_right':
1098
- $dest_x = $image_width - $watermark_width;
1099
- $dest_y = 0;
1100
- break;
1101
-
1102
- case 'middle_left':
1103
- $dest_x = 0;
1104
- $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1105
- break;
1106
-
1107
- case 'middle_right':
1108
- $dest_x = $image_width - $watermark_width;
1109
- $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1110
- break;
1111
-
1112
- case 'bottom_left':
1113
- $dest_x = 0;
1114
- $dest_y = $image_height - $watermark_height;
1115
- break;
1116
-
1117
- case 'bottom_center':
1118
- $dest_x = ( $image_width / 2 ) - ( $watermark_width / 2 );
1119
- $dest_y = $image_height - $watermark_height;
1120
- break;
1121
-
1122
- case 'bottom_right':
1123
- $dest_x = $image_width - $watermark_width;
1124
- $dest_y = $image_height - $watermark_height;
1125
- break;
1126
-
1127
- case 'middle_center':
1128
- default:
1129
- $dest_x = ( $image_width / 2 ) - ( $watermark_width / 2 );
1130
- $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1131
- }
1132
-
1133
- $dest_x += $options['watermark_image']['offset_width'];
1134
- $dest_y += $options['watermark_image']['offset_height'];
1135
-
1136
- return array( $dest_x, $dest_y );
1137
- }
1138
-
1139
- /**
1140
- * Add watermark image to image.
1141
- *
1142
- * @param resource $image Image resource
1143
- * @param array $options Plugin options
1144
- * @param array $upload_dir WP upload dir data
1145
- * @return resource Watermarked image
1146
- */
1147
- private function add_watermark_image( $image, $options, $upload_dir ) {
1148
- $watermark_file = wp_get_attachment_metadata( $options['watermark_image']['url'], true );
1149
- $url = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $watermark_file['file'];
1150
- $watermark_file_info = getimagesize( $url );
1151
-
1152
- switch ( $watermark_file_info['mime'] ) {
1153
- case 'image/jpeg':
1154
- case 'image/pjpeg':
1155
- $watermark = imagecreatefromjpeg( $url );
1156
- break;
1157
-
1158
- case 'image/gif':
1159
- $watermark = imagecreatefromgif( $url );
1160
- break;
1161
-
1162
- case 'image/png':
1163
- $watermark = imagecreatefrompng( $url );
1164
- break;
1165
-
1166
- default:
1167
- return false;
1168
- }
1169
-
1170
- // get image dimensions
1171
- $image_width = imagesx( $image );
1172
- $image_height = imagesy( $image );
1173
-
1174
- // calculate watermark new dimensions
1175
- list( $w, $h ) = $this->calculate_watermark_dimensions( $image_width, $image_height, imagesx( $watermark ), imagesy( $watermark ), $options );
1176
-
1177
- // calculate image coordinates
1178
- list( $dest_x, $dest_y ) = $this->calculate_image_coordinates( $image_width, $image_height, $w, $h, $options );
1179
-
1180
- // combine two images together
1181
- $this->imagecopymerge_alpha( $image, $this->resize( $watermark, $w, $h, $watermark_file_info ), $dest_x, $dest_y, 0, 0, $w, $h, $options['watermark_image']['transparent'] );
1182
-
1183
- if ( $options['watermark_image']['jpeg_format'] === 'progressive' )
1184
- imageinterlace( $image, true );
1185
-
1186
- return $image;
1187
- }
1188
-
1189
- /**
1190
- * Create new image function.
1191
- *
1192
- * @param resource $dst_im
1193
- * @param resource $src_im
1194
- * @param int $dst_x
1195
- * @param int $dst_y
1196
- * @param int $src_x
1197
- * @param int $src_y
1198
- * @param int $src_w
1199
- * @param int $src_h
1200
- * @param int $pct
1201
- */
1202
- private function imagecopymerge_alpha( $dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct ) {
1203
- // create a cut resource
1204
- $cut = imagecreatetruecolor( $src_w, $src_h );
1205
-
1206
- // copy relevant section from background to the cut resource
1207
- imagecopy( $cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h );
1208
-
1209
- // copy relevant section from watermark to the cut resource
1210
- imagecopy( $cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h );
1211
-
1212
- // insert cut resource to destination image
1213
- imagecopymerge( $dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct );
1214
- }
1215
-
1216
- /**
1217
- * Resize image.
1218
- *
1219
- * @param resource $image Image resource
1220
- * @param int $width Image width
1221
- * @param int $height Image height
1222
- * @param array $info Image data
1223
- * @return resource Resized image
1224
- */
1225
- private function resize( $image, $width, $height, $info ) {
1226
- $new_image = imagecreatetruecolor( $width, $height );
1227
-
1228
- // check if this image is PNG, then set if transparent
1229
- if ( $info[2] === 3 ) {
1230
- imagealphablending( $new_image, false );
1231
- imagesavealpha( $new_image, true );
1232
- imagefilledrectangle( $new_image, 0, 0, $width, $height, imagecolorallocatealpha( $new_image, 255, 255, 255, 127 ) );
1233
- }
1234
-
1235
- imagecopyresampled( $new_image, $image, 0, 0, 0, 0, $width, $height, $info[0], $info[1] );
1236
-
1237
- return $new_image;
1238
- }
1239
-
1240
- /**
1241
- * Save image from image resource.
1242
- *
1243
- * @param resource $image Image resource
1244
- * @param string $mime_type Image mime type
1245
- * @param string $filepath Path where image should be saved
1246
- * @return void
1247
- */
1248
- private function save_image_file( $image, $mime_type, $filepath, $quality ) {
1249
- switch ( $mime_type ) {
1250
- case 'image/jpeg':
1251
- case 'image/pjpeg':
1252
- imagejpeg( $image, $filepath, $quality );
1253
- break;
1254
-
1255
- case 'image/png':
1256
- imagepng( $image, $filepath, (int) round( 9 - ( 9 * $quality / 100 ), 0 ) );
1257
- break;
1258
- }
1259
- }
1260
-
1261
- /**
1262
- * Add links to Support Forum.
1263
- *
1264
- * @param array $links
1265
- * @param string $file
1266
- * @return array
1267
- */
1268
- public function plugin_extend_links( $links, $file ) {
1269
- if ( ! current_user_can( 'install_plugins' ) )
1270
- return $links;
1271
-
1272
- $plugin = plugin_basename( __FILE__ );
1273
-
1274
- if ( $file == $plugin ) {
1275
- return array_merge(
1276
- $links, array( sprintf( '<a href="http://www.dfactory.eu/support/forum/image-watermark/" target="_blank">%s</a>', __( 'Support', 'image-watermark' ) ) )
1277
- );
1278
- }
1279
-
1280
- return $links;
1281
- }
1282
-
1283
- /**
1284
- * Add links to Settings page.
1285
- *
1286
- * @param array $links
1287
- * @param string $file
1288
- * @return array
1289
- */
1290
- function plugin_settings_link( $links, $file ) {
1291
- if ( ! is_admin() || ! current_user_can( 'manage_options' ) )
1292
- return $links;
1293
-
1294
- static $plugin;
1295
-
1296
- $plugin = plugin_basename( __FILE__ );
1297
-
1298
- if ( $file == $plugin ) {
1299
- $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php' ) . '?page=watermark-options', __( 'Settings', 'image-watermark' ) );
1300
- array_unshift( $links, $settings_link );
1301
- }
1302
-
1303
- return $links;
1304
- }
1305
- }
1306
-
1307
-
1308
- /**
1309
- * Get instance of main class.
1310
- *
1311
- * @return object Instance
1312
- */
1313
- function Image_Watermark() {
1314
- static $instance;
1315
-
1316
- // first call to instance() initializes the plugin
1317
- if ( $instance === null || ! ( $instance instanceof Image_Watermark ) )
1318
- $instance = Image_Watermark::instance();
1319
-
1320
- return $instance;
1321
- }
1322
-
1323
- Image_Watermark();
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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.6.1
6
+ Author: dFactory
7
+ Author URI: http://www.dfactory.eu/
8
+ Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
9
+ License: MIT License
10
+ License URI: http://opensource.org/licenses/MIT
11
+ Text Domain: image-watermark
12
+ Domain Path: /languages
13
+
14
+ Image Watermark
15
+ Copyright (C) 2013-2016, Digital Factory - info@digitalfactory.pl
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ // exit if accessed directly
25
+ if ( ! defined( 'ABSPATH' ) )
26
+ exit;
27
+
28
+ define( 'IMAGE_WATERMARK_URL', plugins_url( '', __FILE__ ) );
29
+ define( 'IMAGE_WATERMARK_PATH', plugin_dir_path( __FILE__ ) );
30
+
31
+ /**
32
+ * Image Watermark class.
33
+ *
34
+ * @class Image_Watermark
35
+ * @version 1.6.1
36
+ */
37
+ final class Image_Watermark {
38
+
39
+ private static $instance;
40
+ private $is_admin = true;
41
+ private $extension = false;
42
+ private $allowed_mime_types = array(
43
+ 'image/jpeg',
44
+ 'image/pjpeg',
45
+ 'image/png'
46
+ );
47
+ private $is_watermarked_metakey = 'iw-is-watermarked';
48
+ public $is_backup_folder_writable = null;
49
+ public $extensions;
50
+ public $defaults = array(
51
+ 'options' => array(
52
+ 'watermark_on' => array(),
53
+ 'watermark_cpt_on' => array( 'everywhere' ),
54
+ 'watermark_image' => array(
55
+ 'extension' => '',
56
+ 'url' => 0,
57
+ 'width' => 80,
58
+ 'plugin_off' => 0,
59
+ 'frontend_active' => false,
60
+ 'manual_watermarking' => 0,
61
+ 'position' => 'bottom_right',
62
+ 'watermark_size_type' => 2,
63
+ 'offset_width' => 0,
64
+ 'offset_height' => 0,
65
+ 'absolute_width' => 0,
66
+ 'absolute_height' => 0,
67
+ 'transparent' => 50,
68
+ 'quality' => 90,
69
+ 'jpeg_format' => 'baseline',
70
+ 'deactivation_delete' => false,
71
+ 'media_library_notice' => true
72
+ ),
73
+ 'image_protection' => array(
74
+ 'rightclick' => 0,
75
+ 'draganddrop' => 0,
76
+ 'forlogged' => 0,
77
+ ),
78
+ 'backup' => array(
79
+ 'backup_image' => true,
80
+ 'backup_quality' => 90,
81
+ ),
82
+ ),
83
+ 'version' => '1.6.1'
84
+ );
85
+ public $options = array();
86
+
87
+ /**
88
+ * Class constructor.
89
+ */
90
+ public function __construct() {
91
+ // installer
92
+ register_activation_hook( __FILE__, array( $this, 'activate_watermark' ) );
93
+ register_deactivation_hook( __FILE__, array( $this, 'deactivate_watermark' ) );
94
+
95
+ // settings
96
+ $this->options = array_merge( $this->defaults['options'], get_option( 'image_watermark_options', $this->defaults['options'] ) );
97
+
98
+ include_once( IMAGE_WATERMARK_PATH . 'includes/class-update.php' );
99
+ include_once( IMAGE_WATERMARK_PATH . 'includes/class-settings.php' );
100
+
101
+ // actions
102
+ add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
103
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
104
+ add_action( 'admin_print_scripts', array( $this, 'admin_print_scripts' ), 20 );
105
+ add_action( 'wp_enqueue_media', array( $this, 'wp_enqueue_media' ) );
106
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
107
+ add_action( 'load-upload.php', array( $this, 'watermark_bulk_action' ) );
108
+ add_action( 'admin_init', array( $this, 'update_plugin' ) );
109
+ add_action( 'admin_init', array( $this, 'check_extensions' ) );
110
+ add_action( 'admin_notices', array( $this, 'bulk_admin_notices' ) );
111
+ add_action( 'delete_attachment', array( $this, 'delete_attachment' ) );
112
+ add_action( 'wp_ajax_iw_watermark_bulk_action', array( $this, 'watermark_action_ajax' ) );
113
+
114
+ // filters
115
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_extend_links' ), 10, 2 );
116
+ add_filter( 'plugin_action_links', array( $this, 'plugin_settings_link' ), 10, 2 );
117
+ add_filter( 'wp_handle_upload', array( $this, 'handle_upload_files' ) );
118
+ add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 );
119
+
120
+ // define our backup location
121
+ $upload_dir = wp_upload_dir();
122
+ define( 'IMAGE_WATERMARK_BACKUP_DIR', apply_filters( 'image_watermark_backup_dir', $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'iw-backup' ) );
123
+
124
+ // create backup folder and security if enabled
125
+ if ( $this->options['backup']['backup_image'] ) {
126
+
127
+ if ( is_writable( $upload_dir['basedir'] ) ) {
128
+ $this->is_backup_folder_writable = true;
129
+
130
+ // create backup folder ( if it exists this returns true: https://codex.wordpress.org/Function_Reference/wp_mkdir_p )
131
+ $backup_folder_created = wp_mkdir_p( IMAGE_WATERMARK_BACKUP_DIR );
132
+
133
+ // check if the folder exists and is writable
134
+ if ( $backup_folder_created && is_writable( IMAGE_WATERMARK_BACKUP_DIR ) ) {
135
+ // check if the htaccess file exists
136
+ if ( ! file_exists( IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . '.htaccess' ) ) {
137
+ // htaccess security
138
+ file_put_contents( IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . '.htaccess', 'deny from all' );
139
+ }
140
+ } else {
141
+ $this->is_backup_folder_writable = false;
142
+ }
143
+ } else {
144
+ $this->is_backup_folder_writable = false;
145
+ }
146
+ if ( true !== $this->is_backup_folder_writable ) {
147
+ // disable backup setting
148
+ $this->options['backup']['backup_image'] = false;
149
+ update_option( 'image_watermark_options', $this->options );
150
+ }
151
+
152
+ add_action( 'admin_notices', array( $this, 'folder_writable_admin_notice' ) );
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Create single instance.
158
+ *
159
+ * @return object Main plugin instance
160
+ */
161
+ public static function instance() {
162
+ if ( self::$instance === null )
163
+ self::$instance = new self();
164
+
165
+ return self::$instance;
166
+ }
167
+
168
+ /**
169
+ * Plugin activation.
170
+ */
171
+ public function activate_watermark() {
172
+ add_option( 'image_watermark_options', $this->defaults['options'], '', 'no' );
173
+ add_option( 'image_watermark_version', $this->defaults['version'], '', 'no' );
174
+ }
175
+
176
+ /**
177
+ * Plugin deactivation.
178
+ */
179
+ public function deactivate_watermark() {
180
+ // remove options from database?
181
+ if ( $this->options['watermark_image']['deactivation_delete'] )
182
+ delete_option( 'image_watermark_options' );
183
+ }
184
+
185
+ /**
186
+ * Plugin update, fix for version < 1.5.0
187
+ */
188
+ public function update_plugin() {
189
+ if ( ! current_user_can( 'install_plugins' ) )
190
+ return;
191
+
192
+ $db_version = get_option( 'image_watermark_version' );
193
+ $db_version = ! ( $db_version ) && ( get_option( 'df_watermark_installed' ) != false ) ? get_option( 'version' ) : $db_version;
194
+
195
+ if ( $db_version != false ) {
196
+ if ( version_compare( $db_version, '1.5.0', '<' ) ) {
197
+ $options = array();
198
+
199
+ $old_new = array(
200
+ 'df_watermark_on' => 'watermark_on',
201
+ 'df_watermark_cpt_on' => 'watermark_cpt_on',
202
+ 'df_watermark_image' => 'watermark_image',
203
+ 'df_image_protection' => 'image_protection',
204
+ 'df_watermark_installed' => '',
205
+ 'version' => '',
206
+ 'image_watermark_version' => '',
207
+ );
208
+
209
+ foreach ( $old_new as $old => $new ) {
210
+ if ( $new ) {
211
+ $options[$new] = get_option( $old );
212
+ }
213
+ delete_option( $old );
214
+ }
215
+
216
+ add_option( 'image_watermark_options', $options, '', 'no' );
217
+ add_option( 'image_watermark_version', $this->defaults['version'], '', 'no' );
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Load textdomain.
224
+ */
225
+ public function load_textdomain() {
226
+ load_plugin_textdomain( 'image-watermark', false, basename( dirname( __FILE__ ) ) . '/languages' );
227
+ }
228
+
229
+ /**
230
+ * Admin inline scripts.
231
+ *
232
+ * @global $pagenow
233
+ */
234
+ public function admin_print_scripts() {
235
+ global $pagenow;
236
+
237
+ if ( $pagenow === 'upload.php' ) {
238
+ if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
239
+ ?>
240
+ <script type="text/javascript">
241
+ jQuery( function( $ ) {
242
+ $( document ).ready( function() {
243
+ var backup = <?php echo (int) $this->options['backup']['backup_image']; ?>;
244
+
245
+ $( "<option>" ).val( "applywatermark" ).text( "<?php _e( 'Apply watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action'], select[name='action2']" );
246
+
247
+ if ( backup === 1 ) {
248
+ $( "<option>" ).val( "removewatermark" ).text( "<?php _e( 'Remove watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action'], select[name='action2']" );
249
+ }
250
+ });
251
+ });
252
+ </script>
253
+ <?php
254
+ }
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Enqueue admin scripts and styles.
260
+ */
261
+ public function wp_enqueue_media( $page ) {
262
+ wp_enqueue_style( 'watermark-style', plugins_url( 'css/image-watermark.css', __FILE__ ), array(), $this->defaults['version'] );
263
+ }
264
+
265
+ /**
266
+ * Enqueue admin scripts and styles.
267
+ *
268
+ * @global $pagenow
269
+ */
270
+ public function admin_enqueue_scripts( $page ) {
271
+ global $pagenow;
272
+
273
+ wp_register_style( 'watermark-style', plugins_url( 'css/image-watermark.css', __FILE__ ), array(), $this->defaults['version'] );
274
+
275
+ if ( $page === 'settings_page_watermark-options' ) {
276
+ wp_enqueue_media();
277
+
278
+ wp_enqueue_script( 'upload-manager', plugins_url( '/js/admin-upload.js', __FILE__ ), array(), $this->defaults['version'] );
279
+
280
+ wp_localize_script(
281
+ 'upload-manager', 'iwUploadArgs', array(
282
+ 'title' => __( 'Select watermark', 'image-watermark' ),
283
+ 'originalSize' => __( 'Original size', 'image-watermark' ),
284
+ 'noSelectedImg' => __( 'Watermak has not been selected yet.', 'image-watermark' ),
285
+ 'notAllowedImg' => __( 'This image is not supported as watermark. Use JPEG, PNG or GIF.', 'image-watermark' ),
286
+ 'px' => __( 'px', 'image-watermark' ),
287
+ 'frame' => 'select',
288
+ 'button' => array( 'text' => __( 'Add watermark', 'image-watermark' ) ),
289
+ 'multiple' => false
290
+ )
291
+ );
292
+
293
+ wp_enqueue_script( 'watermark-admin-script', plugins_url( 'js/admin-settings.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-slider' ), $this->defaults['version'] );
294
+
295
+ wp_localize_script(
296
+ 'watermark-admin-script', 'iwArgs', array(
297
+ 'resetToDefaults' => __( 'Are you sure you want to reset settings to defaults?', 'image-watermark' )
298
+ )
299
+ );
300
+
301
+ wp_enqueue_style( 'wp-like-ui-theme', plugins_url( 'css/wp-like-ui-theme.css', __FILE__ ), array(), $this->defaults['version'] );
302
+ wp_enqueue_style( 'watermark-style' );
303
+
304
+ wp_enqueue_script( 'postbox' );
305
+ }
306
+
307
+ if ( $pagenow === 'upload.php' ) {
308
+ wp_enqueue_style( 'watermark-style' );
309
+ }
310
+
311
+ // I've omitted $pagenow === 'upload.php' because the image modal could be loaded in various places
312
+ if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
313
+
314
+ wp_enqueue_script( 'watermark-admin-image-actions', plugins_url( '/js/admin-image-actions.js', __FILE__ ), array( 'jquery' ), $this->defaults['version'], true );
315
+
316
+ wp_localize_script(
317
+ 'watermark-admin-image-actions', 'iwImageActionArgs', array(
318
+ 'backup_image' => (int) $this->options['backup']['backup_image'],
319
+ '_nonce' => wp_create_nonce( 'image-watermark' ),
320
+ '__applied_none' => __( 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ),
321
+ '__applied_one' => __( 'Watermark was succesfully applied to 1 image.', 'image-watermark' ),
322
+ '__applied_multi' => __( 'Watermark was succesfully applied to %s images.', 'image-watermark' ),
323
+ '__removed_none' => __( 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ),
324
+ '__removed_one' => __( 'Watermark was succesfully removed from 1 image.', 'image-watermark' ),
325
+ '__removed_multi' => __( 'Watermark was succesfully removed from %s images.', 'image-watermark' ),
326
+ '__skipped' => __( 'Skipped files', 'image-watermark' ),
327
+ '__running' => __( 'Bulk action is currently running, please wait.', 'image-watermark' ),
328
+ '__dismiss' => __( 'Dismiss this notice.' ), // Wordpress default string
329
+ )
330
+ );
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Enqueue frontend script with 'no right click' and 'drag and drop' functions.
336
+ */
337
+ public function wp_enqueue_scripts() {
338
+ if ( ($this->options['image_protection']['forlogged'] == 0 && is_user_logged_in()) || ($this->options['image_protection']['draganddrop'] == 0 && $this->options['image_protection']['rightclick'] == 0) )
339
+ return;
340
+
341
+ wp_enqueue_script( 'iw-no-right-click', plugins_url( 'js/no-right-click.js', __FILE__ ), array(), $this->defaults['version'] );
342
+
343
+ wp_localize_script(
344
+ 'iw-no-right-click', 'IwNRCargs', array(
345
+ 'rightclick' => ($this->options['image_protection']['rightclick'] == 1 ? 'Y' : 'N'),
346
+ 'draganddrop' => ($this->options['image_protection']['draganddrop'] == 1 ? 'Y' : 'N')
347
+ )
348
+ );
349
+ }
350
+
351
+ /**
352
+ * Check which extension is available and set it.
353
+ *
354
+ * @return void
355
+ */
356
+ public function check_extensions() {
357
+ $ext = null;
358
+
359
+ if ( $this->check_imagick() ) {
360
+ $this->extensions['imagick'] = 'ImageMagick';
361
+ $ext = 'imagick';
362
+ }
363
+
364
+ if ( $this->check_gd() ) {
365
+ $this->extensions['gd'] = 'GD';
366
+
367
+ if ( is_null( $ext ) )
368
+ $ext = 'gd';
369
+ }
370
+
371
+ if ( isset( $this->options['watermark_image']['extension'] ) ) {
372
+ if ( $this->options['watermark_image']['extension'] === 'imagick' && isset( $this->extensions['imagick'] ) )
373
+ $this->extension = 'imagick';
374
+ elseif ( $this->options['watermark_image']['extension'] === 'gd' && isset( $this->extensions['gd'] ) )
375
+ $this->extension = 'gd';
376
+ else
377
+ $this->extension = $ext;
378
+ } else
379
+ $this->extension = $ext;
380
+ }
381
+
382
+ /**
383
+ * Apply watermark everywhere or for specific post types.
384
+ *
385
+ * @param resource $file
386
+ * @return resource
387
+ */
388
+ public function handle_upload_files( $file ) {
389
+ // is extension available?
390
+ if ( $this->extension ) {
391
+ // determine ajax frontend or backend request
392
+ $script_filename = isset( $_SERVER['SCRIPT_FILENAME'] ) ? $_SERVER['SCRIPT_FILENAME'] : '';
393
+
394
+ // try to figure out if frontend AJAX request... if we are DOING_AJAX; let's look closer
395
+ if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
396
+ // from wp-includes/functions.php, wp_get_referer() function.
397
+ // required to fix: https://core.trac.wordpress.org/ticket/25294
398
+ $ref = '';
399
+ if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
400
+ $ref = wp_unslash( $_REQUEST['_wp_http_referer'] );
401
+ elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) )
402
+ $ref = wp_unslash( $_SERVER['HTTP_REFERER'] );
403
+
404
+ // if referer does not contain admin URL and we are using the admin-ajax.php endpoint, this is likely a frontend AJAX request
405
+ if ( ( ( strpos( $ref, admin_url() ) === false ) && ( basename( $script_filename ) === 'admin-ajax.php' ) ) )
406
+ $this->is_admin = false;
407
+ else
408
+ $this->is_admin = true;
409
+ // not an AJAX request, simple here
410
+ } else {
411
+ if ( is_admin() )
412
+ $this->is_admin = true;
413
+ else
414
+ $this->is_admin = false;
415
+ }
416
+
417
+ // admin
418
+ if ( $this->is_admin === true ) {
419
+ if ( $this->options['watermark_image']['plugin_off'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
420
+ add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
421
+ }
422
+ // frontend
423
+ } else {
424
+ if ( $this->options['watermark_image']['frontend_active'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
425
+ add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
426
+ }
427
+ }
428
+ }
429
+
430
+ return $file;
431
+ }
432
+
433
+ /**
434
+ * Add watermark buttons on attachment image locations
435
+ */
436
+ public function attachment_fields_to_edit( $form_fields, $post ) {
437
+
438
+ if ( $this->options['watermark_image']['manual_watermarking'] == 1 && $this->options['backup']['backup_image'] ) {
439
+
440
+ $data = wp_get_attachment_metadata( $post->ID, false );
441
+
442
+ // is this really an image?
443
+ if ( in_array( get_post_mime_type( $post->ID ), $this->allowed_mime_types ) && is_array( $data ) ) {
444
+ $form_fields['image_watermark'] = array(
445
+ 'show_in_edit' => false,
446
+ 'tr' => '
447
+ <div id="image_watermark_buttons"' . ( get_post_meta( $post->ID, $this->is_watermarked_metakey, true ) ? ' class="watermarked"' : '' ) . ' data-id="' . $post->ID . '" style="display: none;">
448
+ <label class="setting">
449
+ <span class="name">' . __( 'Image Watermark', 'image-watermark' ) . '</span>
450
+ <span class="value" style="width: 63%"><a href="#" class="iw-watermark-action" data-action="applywatermark" data-id="' . $post->ID . '">' . __( 'Apply watermark', 'image-watermark' ) . '</a> | <a href="#" class="iw-watermark-action delete-watermark" data-action="removewatermark" data-id="' . $post->ID . '">' . __( 'Remove watermark', 'image-watermark' ) . '</a></span>
451
+ </label>
452
+ <div class="clear"></div>
453
+ </div>
454
+ <script>
455
+ jQuery( document ).ready( function ( $ ) {
456
+ if ( typeof watermarkImageActions != "undefined" ) {
457
+ $( "#image_watermark_buttons" ).show();
458
+ }
459
+ });
460
+ </script>'
461
+ );
462
+ }
463
+ }
464
+ return $form_fields;
465
+ }
466
+
467
+ /**
468
+ * Apply watermark for selected images on media page.
469
+ */
470
+ public function watermark_action_ajax() {
471
+ // Security & data check
472
+ if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['_iw_nonce'] ) || ! isset( $_POST['iw-action'] ) || ! isset( $_POST['attachment_id'] ) || ! is_numeric( $_POST['attachment_id'] ) || ! wp_verify_nonce( $_POST['_iw_nonce'], 'image-watermark' )
473
+ )
474
+ wp_send_json_error( __( 'Cheatin uh?', 'image-watermark' ) );
475
+
476
+ $post_id = (int) $_POST['attachment_id'];
477
+ $action = false;
478
+
479
+ switch ( $_POST['iw-action'] ) {
480
+ case 'applywatermark': $action = 'applywatermark';
481
+ break;
482
+ case 'removewatermark': $action = 'removewatermark';
483
+ break;
484
+ }
485
+
486
+ // only if manual watermarking is turned and we have a valid action
487
+ // if the action is NOT "removewatermark" we also require a watermark image to be set
488
+ if ( $post_id > 0 && $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
489
+
490
+ $data = wp_get_attachment_metadata( $post_id, false );
491
+
492
+ // is this really an image?
493
+ if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
494
+
495
+ if ( $action === 'applywatermark' ) {
496
+ $success = $this->apply_watermark( $data, $post_id, 'manual' );
497
+ if ( ! empty( $success['error'] ) ) {
498
+ wp_send_json_success( $success['error'] );
499
+ } else {
500
+ wp_send_json_success( 'watermarked' );
501
+ }
502
+ } elseif ( $action === 'removewatermark' ) {
503
+ $success = $this->remove_watermark( $data, $post_id, 'manual' );
504
+ if ( $success ) {
505
+ wp_send_json_success( 'watermarkremoved' );
506
+ } else {
507
+ wp_send_json_success( 'skipped' );
508
+ }
509
+ }
510
+ } else {
511
+ wp_send_json_success( 'skipped' );
512
+ }
513
+ }
514
+
515
+ wp_send_json_error( __( 'Cheatin uh?', 'image-watermark' ) );
516
+ }
517
+
518
+ /**
519
+ * Apply watermark for selected images on media page.
520
+ *
521
+ * @return void
522
+ */
523
+ public function watermark_bulk_action() {
524
+ global $pagenow;
525
+
526
+ if ( $pagenow == 'upload.php' && $this->extension ) {
527
+ $wp_list_table = _get_list_table( 'WP_Media_List_Table' );
528
+
529
+ $action = false;
530
+ switch ( $wp_list_table->current_action() ) {
531
+ case 'applywatermark': $action = 'applywatermark';
532
+ break;
533
+ case 'removewatermark': $action = 'removewatermark';
534
+ break;
535
+ }
536
+ // only if manual watermarking is turned and we have a valid action
537
+ // if the action is NOT "removewatermark" we also require a watermark image to be set
538
+ if ( $action && $this->options['watermark_image']['manual_watermarking'] == 1 && ( $this->options['watermark_image']['url'] != 0 || $action == 'removewatermark' ) ) {
539
+ // security check
540
+ check_admin_referer( 'bulk-media' );
541
+
542
+ $location = esc_url( remove_query_arg( array( 'watermarked', 'watermarkremoved', 'skipped', 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), wp_get_referer() ) );
543
+
544
+ if ( ! $location ) {
545
+ $location = 'upload.php';
546
+ }
547
+
548
+ $location = esc_url( add_query_arg( 'paged', $wp_list_table->get_pagenum(), $location ) );
549
+
550
+ // make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
551
+ if ( isset( $_REQUEST['media'] ) ) {
552
+ $post_ids = array_map( 'intval', $_REQUEST['media'] );
553
+ }
554
+
555
+ // do we have selected attachments?
556
+ if ( $post_ids ) {
557
+
558
+ $watermarked = $watermarkremoved = $skipped = 0;
559
+ $messages = array();
560
+
561
+ foreach ( $post_ids as $post_id ) {
562
+ $data = wp_get_attachment_metadata( $post_id, false );
563
+
564
+ // is this really an image?
565
+ if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
566
+ if ( $action === 'applywatermark' ) {
567
+ $success = $this->apply_watermark( $data, $post_id, 'manual' );
568
+ if ( ! empty( $success['error'] ) ) {
569
+ $messages[] = $success['error'];
570
+ } else {
571
+ $watermarked ++;
572
+ $watermarkremoved = -1;
573
+ }
574
+ } elseif ( $action === 'removewatermark' ) {
575
+ $success = $this->remove_watermark( $data, $post_id, 'manual' );
576
+ if ( $success ) {
577
+ $watermarkremoved ++;
578
+ } else {
579
+ $skipped ++;
580
+ }
581
+ $watermarked = -1;
582
+ }
583
+ } else {
584
+ $skipped ++;
585
+ }
586
+ }
587
+
588
+ $location = esc_url( add_query_arg( array( 'watermarked' => $watermarked, 'watermarkremoved' => $watermarkremoved, 'skipped' => $skipped, 'messages' => $messages ), $location ), null, '' );
589
+ }
590
+
591
+ wp_redirect( $location );
592
+ exit();
593
+ } else
594
+ return;
595
+ }
596
+ }
597
+
598
+ /**
599
+ * Display admin notices.
600
+ *
601
+ * @return mixed
602
+ */
603
+ public function bulk_admin_notices() {
604
+ global $post_type, $pagenow;
605
+
606
+ if ( $pagenow === 'upload.php' ) {
607
+
608
+ if ( ! current_user_can( 'upload_files' ) )
609
+ return;
610
+
611
+ // hide media library notice
612
+ if ( isset( $_GET['iw_action'] ) && $_GET['iw_action'] == 'hide_library_notice' ) {
613
+ $this->options['watermark_image']['media_library_notice'] = false;
614
+ update_option( 'image_watermark_options', $this->options );
615
+ }
616
+
617
+ // check if manual watermarking is enabled
618
+ if ( ! empty( $this->options['watermark_image']['manual_watermarking'] ) && ( ! isset( $this->options['watermark_image']['media_library_notice'] ) || $this->options['watermark_image']['media_library_notice'] === true ) ) {
619
+ $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
620
+
621
+ if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], array( 'grid', 'list' ) ) ) {
622
+ $mode = $_GET['mode'];
623
+ }
624
+
625
+ // display notice in grid mode only
626
+ if ( $mode === 'grid' ) {
627
+ // get current admin url
628
+ $query_string = array();
629
+ parse_str( $_SERVER['QUERY_STRING'], $query_string );
630
+ $current_url = esc_url( add_query_arg( array_merge( (array) $query_string, array( 'iw_action' => 'hide_library_notice' ) ), '', admin_url( trailingslashit( $pagenow ) ) ) );
631
+
632
+ echo '<div class="error notice"><p>' . sprintf( __( '<strong>Image Watermark:</strong> Bulk watermarking is available in list mode only, under <em>Bulk Actions</em> dropdown. <a href="%1$s">Got to List Mode</a> or <a href="%2$s">Hide this notice</a>', 'image-watermark' ), esc_url( admin_url( 'upload.php?mode=list' ) ), esc_url( $current_url ) ) . '</p></div>';
633
+ }
634
+ }
635
+
636
+ if ( isset( $_REQUEST['watermarked'], $_REQUEST['watermarkremoved'], $_REQUEST['skipped'] ) && $post_type === 'attachment' ) {
637
+ $watermarked = (int) $_REQUEST['watermarked'];
638
+ $watermarkremoved = (int) $_REQUEST['watermarkremoved'];
639
+ $skipped = (int) $_REQUEST['skipped'];
640
+
641
+ if ( $watermarked === 0 ) {
642
+ echo '<div class="error"><p>' . __( 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
643
+ } elseif ( $watermarked > 0 ) {
644
+ echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully applied to 1 image.', 'Watermark was succesfully applied to %s images.', $watermarked, 'image-watermark' ), number_format_i18n( $watermarked ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
645
+ }
646
+ if ( $watermarkremoved === 0 ) {
647
+ echo '<div class="error"><p>' . __( 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.', 'image-watermark' ) . ($skipped > 0 ? ' ' . __( 'Images skipped', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
648
+ } elseif ( $watermarkremoved > 0 ) {
649
+ echo '<div class="updated"><p>' . sprintf( _n( 'Watermark was succesfully removed from 1 image.', 'Watermark was succesfully removed from %s images.', $watermarkremoved, 'image-watermark' ), number_format_i18n( $watermarkremoved ) ) . ($skipped > 0 ? ' ' . __( 'Skipped files', 'image-watermark' ) . ': ' . $skipped . '.' : '') . '</p></div>';
650
+ }
651
+
652
+ $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'watermarked', 'skipped' ), $_SERVER['REQUEST_URI'] ) );
653
+ }
654
+ }
655
+ }
656
+
657
+ /**
658
+ * Check whether ImageMagick extension is available.
659
+ *
660
+ * @return boolean True if extension is available
661
+ */
662
+ public function check_imagick() {
663
+ // check Imagick's extension and classes
664
+ if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick', false ) || ! class_exists( 'ImagickPixel', false ) )
665
+ return false;
666
+
667
+ // check version
668
+ if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
669
+ return false;
670
+
671
+ // check for deep requirements within Imagick
672
+ if ( ! defined( 'imagick::COMPRESSION_JPEG' ) || ! defined( 'imagick::COMPOSITE_OVERLAY' ) || ! defined( 'Imagick::INTERLACE_PLANE' ) || ! defined( 'imagick::FILTER_CATROM' ) || ! defined( 'Imagick::CHANNEL_ALL' ) )
673
+ return false;
674
+
675
+ // check methods
676
+ if ( array_diff( array( 'clear', 'destroy', 'valid', 'getimage', 'writeimage', 'getimagegeometry', 'getimageformat', 'setimageformat', 'setimagecompression', 'setimagecompressionquality', 'scaleimage' ), get_class_methods( 'Imagick' ) ) )
677
+ return false;
678
+
679
+ return true;
680
+ }
681
+
682
+ /**
683
+ * Check whether GD extension is available.
684
+ *
685
+ * @return boolean True if extension is available
686
+ */
687
+ public function check_gd( $args = array() ) {
688
+ // check extension
689
+ if ( ! extension_loaded( 'gd' ) || ! function_exists( 'gd_info' ) )
690
+ return false;
691
+
692
+ return true;
693
+ }
694
+
695
+ /**
696
+ * Apply watermark to selected image sizes.
697
+ *
698
+ * @param array $data
699
+ * @param int|string $attachment_id Attachment ID
700
+ * @param string $method
701
+ * @return array
702
+ */
703
+ public function apply_watermark( $data, $attachment_id, $method = '' ) {
704
+ $post = get_post( (int) $attachment_id );
705
+ $post_id = ( ! empty( $post ) ? (int) $post->post_parent : 0 );
706
+
707
+ if ( $attachment_id == $this->options['watermark_image']['url'] ) {
708
+ // this is the current watermark, do not apply
709
+ return array( 'error' => __( 'Watermark prevented, this is your selected watermark image', 'image-watermark' ) );
710
+ }
711
+
712
+ // something went wrong or is it automatic mode?
713
+ if ( $method !== 'manual' && (
714
+ $this->is_admin === true && ! (
715
+ ( isset( $this->options['watermark_cpt_on'][0] ) && $this->options['watermark_cpt_on'][0] === 'everywhere' ) || ( $post_id > 0 && in_array( get_post_type( $post_id ), array_keys( $this->options['watermark_cpt_on'] ) ) === true )
716
+ )
717
+ )
718
+ )
719
+ return $data;
720
+
721
+ if ( apply_filters( 'iw_watermark_display', $attachment_id ) === false )
722
+ return $data;
723
+
724
+ $upload_dir = wp_upload_dir();
725
+
726
+ // is this really an image?
727
+ if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
728
+ // remove the watermark if this image was already watermarked, not === because the database can't hold booleans
729
+ if ( get_post_meta( $attachment_id, $this->is_watermarked_metakey ) == true )
730
+ $this->remove_watermark( $data, $attachment_id, 'manual' );
731
+
732
+ // create a backup if this is enabled
733
+ if ( $this->options['backup']['backup_image'] )
734
+ $this->do_backup( $data, $upload_dir, $attachment_id );
735
+
736
+ // loop through active image sizes
737
+ foreach ( $this->options['watermark_on'] as $image_size => $active_size ) {
738
+
739
+ if ( $active_size === 1 ) {
740
+ switch ( $image_size ) {
741
+ case 'full':
742
+ $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
743
+ break;
744
+
745
+ default:
746
+ if ( ! empty( $data['sizes'] ) && array_key_exists( $image_size, $data['sizes'] ) )
747
+ $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname( $data['file'] ) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
748
+ else
749
+ // early getaway
750
+ continue 2;
751
+ }
752
+
753
+ do_action( 'iw_before_apply_watermark', $attachment_id, $image_size );
754
+
755
+ // apply watermark
756
+ $this->do_watermark( $attachment_id, $filepath, $image_size, $upload_dir );
757
+
758
+ do_action( 'iw_after_apply_watermark', $attachment_id, $image_size );
759
+ }
760
+ }
761
+ // update watermark status
762
+ update_post_meta( $attachment_id, $this->is_watermarked_metakey, true );
763
+ }
764
+
765
+ // pass forward attachment metadata
766
+ return $data;
767
+ }
768
+
769
+ /**
770
+ * Remove watermark from selected image sizes.
771
+ *
772
+ * @param array $data
773
+ * @param int|string $attachment_id Attachment ID
774
+ * @param string $method
775
+ * @return array
776
+ */
777
+ private function remove_watermark( $data, $attachment_id, $method = '' ) {
778
+ if ( $method !== 'manual' ) {
779
+ return $data;
780
+ }
781
+
782
+ $upload_dir = wp_upload_dir();
783
+
784
+ // is this really an image?
785
+ if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
786
+
787
+ // live file path (probably watermarked)
788
+ $filepath = get_attached_file( $attachment_id );
789
+
790
+ // backup file path (not watermarked)
791
+ $backup_filepath = $this->get_image_backup_filepath( get_post_meta( $attachment_id, '_wp_attached_file', true ) );
792
+
793
+ // replace the image in uploads with our backup if one exists
794
+ if ( file_exists( $backup_filepath ) ) {
795
+ if ( ! copy( $backup_filepath, $filepath ) ) {
796
+ // Failed to copy
797
+ }
798
+ }
799
+ // if no backup exists, use the current full-size image to regenerate
800
+ // if the "full" size is enabled for watermarks and no backup has been made the removal of watermarks can't be done
801
+ // regenerate metadata (and thumbs)
802
+ $metadata = wp_generate_attachment_metadata( $attachment_id, $filepath );
803
+
804
+ // update attachment metadata with new metadata
805
+ wp_update_attachment_metadata( $attachment_id, $metadata );
806
+
807
+ // update watermark status
808
+ update_post_meta( $attachment_id, $this->is_watermarked_metakey, false );
809
+
810
+ // ureturn the attachment metadata
811
+ return wp_get_attachment_metadata( $attachment_id );
812
+ }
813
+ return false;
814
+ }
815
+
816
+ /**
817
+ * Apply watermark to image.
818
+ *
819
+ * @param int $attachment_id Attachment ID
820
+ * @param string $image_path Path to the file
821
+ * @param string $image_size Image size
822
+ * @param array $upload_dir Upload media data
823
+ * @return void
824
+ */
825
+ public function do_watermark( $attachment_id, $image_path, $image_size, $upload_dir ) {
826
+ $options = apply_filters( 'iw_watermark_options', $this->options );
827
+
828
+ // get image mime type
829
+ $mime = wp_check_filetype( $image_path );
830
+
831
+ // get watermark path
832
+ $watermark_file = wp_get_attachment_metadata( $options['watermark_image']['url'], true );
833
+ $watermark_path = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $watermark_file['file'];
834
+
835
+ // imagick extension
836
+ if ( $this->extension === 'imagick' ) {
837
+ // create image resource
838
+ $image = new Imagick( $image_path );
839
+
840
+ // create watermark resource
841
+ $watermark = new Imagick( $watermark_path );
842
+
843
+ // set transparency
844
+ $image->setImageOpacity( round( 1 - (float) ( $options['watermark_image']['transparent'] / 100 ), 2 ) );
845
+
846
+ // set compression quality
847
+ if ( $mime['type'] === 'image/jpeg' ) {
848
+ $image->setImageCompressionQuality( $options['watermark_image']['quality'] );
849
+ $image->setImageCompression( imagick::COMPRESSION_JPEG );
850
+ } else
851
+ $image->setImageCompressionQuality( $options['watermark_image']['quality'] );
852
+
853
+ // set image output to progressive
854
+ if ( $options['watermark_image']['jpeg_format'] === 'progressive' )
855
+ $image->setImageInterlaceScheme( Imagick::INTERLACE_PLANE );
856
+
857
+ // get image dimensions
858
+ $image_dim = $image->getImageGeometry();
859
+
860
+ // get watermark dimensions
861
+ $watermark_dim = $watermark->getImageGeometry();
862
+
863
+ // calculate watermark new dimensions
864
+ list( $width, $height ) = $this->calculate_watermark_dimensions( $image_dim['width'], $image_dim['height'], $watermark_dim['width'], $watermark_dim['height'], $options );
865
+
866
+ // resize watermark
867
+ $watermark->resizeImage( $width, $height, imagick::FILTER_CATROM, 1 );
868
+
869
+ // calculate image coordinates
870
+ list( $dest_x, $dest_y ) = $this->calculate_image_coordinates( $image_dim['width'], $image_dim['height'], $width, $height, $options );
871
+
872
+ // combine two images together
873
+ $image->compositeImage( $watermark, Imagick::COMPOSITE_OVERLAY, $dest_x, $dest_y, Imagick::CHANNEL_ALL );
874
+
875
+ // save watermarked image
876
+ $image->writeImage( $image_path );
877
+
878
+ // clear image memory
879
+ $image->clear();
880
+ $image->destroy();
881
+ $image = null;
882
+
883
+ // clear watermark memory
884
+ $watermark->clear();
885
+ $watermark->destroy();
886
+ $watermark = null;
887
+ // gd extension
888
+ } else {
889
+ // get image resource
890
+ $image = $this->get_image_resource( $image_path, $mime['type'] );
891
+
892
+ if ( $image !== false ) {
893
+ // add watermark image to image
894
+ $image = $this->add_watermark_image( $image, $options, $upload_dir );
895
+
896
+ if ( $image !== false ) {
897
+ // save watermarked image
898
+ $this->save_image_file( $image, $mime['type'], $image_path, $options['watermark_image']['quality'] );
899
+
900
+ // clear watermark memory
901
+ imagedestroy( $image );
902
+
903
+ $image = null;
904
+ }
905
+ }
906
+ }
907
+ }
908
+
909
+ /**
910
+ * Make a backup of the full size image.
911
+ *
912
+ * @param array $data
913
+ * @param string $upload_dir
914
+ * @param int $attachment_id
915
+ * @return bool
916
+ */
917
+ private function do_backup( $data, $upload_dir, $attachment_id ) {
918
+ // get the filepath for the backup image we're creating
919
+ $backup_filepath = $this->get_image_backup_filepath( $data['file'] );
920
+
921
+ // make sure the backup isn't created yet
922
+ if ( ! file_exists( $backup_filepath ) ) {
923
+ // the original (full size) image
924
+ $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
925
+ $mime = wp_check_filetype( $filepath );
926
+
927
+ // get image resource
928
+ $image = $this->get_image_resource( $filepath, $mime['type'] );
929
+
930
+ if ( false !== $image ) {
931
+ // create backup directory if needed
932
+ wp_mkdir_p( $this->get_image_backup_folder_location( $data['file'] ) );
933
+
934
+ // save backup image
935
+ $this->save_image_file( $image, $mime['type'], $backup_filepath, $this->options['backup']['backup_quality'] );
936
+
937
+ // clear backup memory
938
+ imagedestroy( $image );
939
+ $image = null;
940
+ }
941
+ }
942
+ }
943
+
944
+ /**
945
+ * Get image resource accordingly to mimetype.
946
+ *
947
+ * @param string $filepath
948
+ * @param string $mime_type
949
+ * @return resource
950
+ */
951
+ private function get_image_resource( $filepath, $mime_type ) {
952
+ switch ( $mime_type ) {
953
+ case 'image/jpeg':
954
+ case 'image/pjpeg':
955
+ $image = imagecreatefromjpeg( $filepath );
956
+ break;
957
+
958
+ case 'image/png':
959
+ $image = imagecreatefrompng( $filepath );
960
+
961
+ imagefilledrectangle( $image, 0, 0, imagesx( $image ), imagesy( $image ), imagecolorallocatealpha( $image, 255, 255, 255, 127 ) );
962
+ break;
963
+
964
+ default:
965
+ $image = false;
966
+ }
967
+
968
+ if ( is_resource( $image ) ) {
969
+ imagealphablending( $image, false );
970
+ imagesavealpha( $image, true );
971
+ }
972
+
973
+ return $image;
974
+ }
975
+
976
+ /**
977
+ * Get image filename without the uploaded folders.
978
+ *
979
+ * @param string $filepath
980
+ * @return string $filename
981
+ */
982
+ private function get_image_filename( $filepath ) {
983
+ return basename( $filepath );
984
+ }
985
+
986
+ /**
987
+ * Get image backup folder.
988
+ *
989
+ * @param string $filepath
990
+ * @return string $image_backup_folder
991
+ */
992
+ private function get_image_backup_folder_location( $filepath ) {
993
+ $path = explode( DIRECTORY_SEPARATOR, $filepath );
994
+ array_pop( $path );
995
+ $path = implode( DIRECTORY_SEPARATOR, $path );
996
+
997
+ // Multisite?
998
+ /* if ( is_multisite() && ! is_main_site() ) {
999
+ $path = 'sites' . DIRECTORY_SEPARATOR . get_current_blog_id() . DIRECTORY_SEPARATOR . $path;
1000
+ } */
1001
+
1002
+ return IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . $path;
1003
+ }
1004
+
1005
+ /**
1006
+ * Get image resource from the backup folder (if available).
1007
+ *
1008
+ * @param string $filepath
1009
+ * @return string $backup_filepath
1010
+ */
1011
+ private function get_image_backup_filepath( $filepath ) {
1012
+ // Multisite?
1013
+ /* if ( is_multisite() && ! is_main_site() ) {
1014
+ $filepath = 'sites' . DIRECTORY_SEPARATOR . get_current_blog_id() . DIRECTORY_SEPARATOR . $filepath;
1015
+ } */
1016
+ return IMAGE_WATERMARK_BACKUP_DIR . DIRECTORY_SEPARATOR . $filepath;
1017
+ }
1018
+
1019
+ /**
1020
+ * Delete the image backup if one exists.
1021
+ *
1022
+ * @param int $attachment_id
1023
+ * @return bool $force_delete
1024
+ */
1025
+ public function delete_attachment( $attachment_id ) {
1026
+ // see get_attached_file() in wp-includes/post.php
1027
+ $filepath = get_post_meta( $attachment_id, '_wp_attached_file', true );
1028
+ $backup_filepath = $this->get_image_backup_filepath( $filepath );
1029
+
1030
+ if ( file_exists( $backup_filepath ) ) {
1031
+ unlink( $backup_filepath );
1032
+ }
1033
+ }
1034
+
1035
+ /**
1036
+ * Create admin notice when we can't create the backup folder.
1037
+ *
1038
+ * @return void
1039
+ */
1040
+ function folder_writable_admin_notice() {
1041
+ if ( current_user_can( 'manage_options' ) && true !== $this->is_backup_folder_writable ) {
1042
+ ?>
1043
+ <div class="notice notice-error is-dismissible">
1044
+ <p><?php _e( 'Image Watermark', 'image-watermark' ); ?> - <?php _e( 'Image backup', 'image-watermark' ); ?>: <?php _e( "Your uploads folder is not writable so we can't create a backup of your image uploads. We've disabled this feature for now.", 'image-watermark' ); ?></p>
1045
+ </div>
1046
+ <?php
1047
+ }
1048
+ }
1049
+
1050
+ /**
1051
+ * Calculate watermark dimensions.
1052
+ *
1053
+ * @param $image_width Image width
1054
+ * @param $image_height Image height
1055
+ * @param $watermark_width Watermark width
1056
+ * @param $watermark_height Watermark height
1057
+ * @param $options Options
1058
+ * @return array Watermark new dimensions
1059
+ */
1060
+ private function calculate_watermark_dimensions( $image_width, $image_height, $watermark_width, $watermark_height, $options ) {
1061
+ // custom
1062
+ if ( $options['watermark_image']['watermark_size_type'] === 1 ) {
1063
+ $width = $options['watermark_image']['absolute_width'];
1064
+ $height = $options['watermark_image']['absolute_height'];
1065
+ // scale
1066
+ } elseif ( $options['watermark_image']['watermark_size_type'] === 2 ) {
1067
+ $ratio = $image_width * $options['watermark_image']['width'] / 100 / $watermark_width;
1068
+
1069
+ $width = (int) ( $watermark_width * $ratio );
1070
+ $height = (int) ( $watermark_height * $ratio );
1071
+
1072
+ // if watermark scaled height is bigger then image watermark
1073
+ if ( $height > $image_height ) {
1074
+ $width = (int) ( $image_height * $width / $height );
1075
+ $height = $image_height;
1076
+ }
1077
+ // original
1078
+ } else {
1079
+ $width = $watermark_width;
1080
+ $height = $watermark_height;
1081
+ }
1082
+
1083
+ return array( $width, $height );
1084
+ }
1085
+
1086
+ /**
1087
+ * Calculate image coordinates for watermark.
1088
+ *
1089
+ * @param $image_width Image width
1090
+ * @param $image_height Image height
1091
+ * @param $watermark_width Watermark width
1092
+ * @param $watermark_height Watermark height
1093
+ * @param $options Options
1094
+ * @return array Image coordinates
1095
+ */
1096
+ private function calculate_image_coordinates( $image_width, $image_height, $watermark_width, $watermark_height, $options ) {
1097
+ switch ( $options['watermark_image']['position'] ) {
1098
+ case 'top_left':
1099
+ $dest_x = $dest_y = 0;
1100
+ break;
1101
+
1102
+ case 'top_center':
1103
+ $dest_x = ( $image_width / 2 ) - ( $watermark_width / 2 );
1104
+ $dest_y = 0;
1105
+ break;
1106
+
1107
+ case 'top_right':
1108
+ $dest_x = $image_width - $watermark_width;
1109
+ $dest_y = 0;
1110
+ break;
1111
+
1112
+ case 'middle_left':
1113
+ $dest_x = 0;
1114
+ $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1115
+ break;
1116
+
1117
+ case 'middle_right':
1118
+ $dest_x = $image_width - $watermark_width;
1119
+ $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1120
+ break;
1121
+
1122
+ case 'bottom_left':
1123
+ $dest_x = 0;
1124
+ $dest_y = $image_height - $watermark_height;
1125
+ break;
1126
+
1127
+ case 'bottom_center':
1128
+ $dest_x = ( $image_width / 2 ) - ( $watermark_width / 2 );
1129
+ $dest_y = $image_height - $watermark_height;
1130
+ break;
1131
+
1132
+ case 'bottom_right':
1133
+ $dest_x = $image_width - $watermark_width;
1134
+ $dest_y = $image_height - $watermark_height;
1135
+ break;
1136
+
1137
+ case 'middle_center':
1138
+ default:
1139
+ $dest_x = ( $image_width / 2 ) - ( $watermark_width / 2 );
1140
+ $dest_y = ( $image_height / 2 ) - ( $watermark_height / 2 );
1141
+ }
1142
+
1143
+ $dest_x += $options['watermark_image']['offset_width'];
1144
+ $dest_y += $options['watermark_image']['offset_height'];
1145
+
1146
+ return array( $dest_x, $dest_y );
1147
+ }
1148
+
1149
+ /**
1150
+ * Add watermark image to an image.
1151
+ *
1152
+ * @param resource $image Image resource
1153
+ * @param array $options Plugin options
1154
+ * @param array $upload_dir WP upload dir data
1155
+ * @return resource Watermarked image
1156
+ */
1157
+ private function add_watermark_image( $image, $options, $upload_dir ) {
1158
+ $watermark_file = wp_get_attachment_metadata( $options['watermark_image']['url'], true );
1159
+ $url = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $watermark_file['file'];
1160
+ $watermark_file_info = getimagesize( $url );
1161
+
1162
+ switch ( $watermark_file_info['mime'] ) {
1163
+ case 'image/jpeg':
1164
+ case 'image/pjpeg':
1165
+ $watermark = imagecreatefromjpeg( $url );
1166
+ break;
1167
+
1168
+ case 'image/gif':
1169
+ $watermark = imagecreatefromgif( $url );
1170
+ break;
1171
+
1172
+ case 'image/png':
1173
+ $watermark = imagecreatefrompng( $url );
1174
+ break;
1175
+
1176
+ default:
1177
+ return false;
1178
+ }
1179
+
1180
+ // get image dimensions
1181
+ $image_width = imagesx( $image );
1182
+ $image_height = imagesy( $image );
1183
+
1184
+ // calculate watermark new dimensions
1185
+ list( $w, $h ) = $this->calculate_watermark_dimensions( $image_width, $image_height, imagesx( $watermark ), imagesy( $watermark ), $options );
1186
+
1187
+ // calculate image coordinates
1188
+ list( $dest_x, $dest_y ) = $this->calculate_image_coordinates( $image_width, $image_height, $w, $h, $options );
1189
+
1190
+ // combine two images together
1191
+ $this->imagecopymerge_alpha( $image, $this->resize( $watermark, $w, $h, $watermark_file_info ), $dest_x, $dest_y, 0, 0, $w, $h, $options['watermark_image']['transparent'] );
1192
+
1193
+ if ( $options['watermark_image']['jpeg_format'] === 'progressive' )
1194
+ imageinterlace( $image, true );
1195
+
1196
+ return $image;
1197
+ }
1198
+
1199
+ /**
1200
+ * Create a new image function.
1201
+ *
1202
+ * @param resource $dst_im
1203
+ * @param resource $src_im
1204
+ * @param int $dst_x
1205
+ * @param int $dst_y
1206
+ * @param int $src_x
1207
+ * @param int $src_y
1208
+ * @param int $src_w
1209
+ * @param int $src_h
1210
+ * @param int $pct
1211
+ */
1212
+ private function imagecopymerge_alpha( $dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct ) {
1213
+ // create a cut resource
1214
+ $cut = imagecreatetruecolor( $src_w, $src_h );
1215
+
1216
+ // copy relevant section from background to the cut resource
1217
+ imagecopy( $cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h );
1218
+
1219
+ // copy relevant section from watermark to the cut resource
1220
+ imagecopy( $cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h );
1221
+
1222
+ // insert cut resource to destination image
1223
+ imagecopymerge( $dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct );
1224
+ }
1225
+
1226
+ /**
1227
+ * Resize image.
1228
+ *
1229
+ * @param resource $image Image resource
1230
+ * @param int $width Image width
1231
+ * @param int $height Image height
1232
+ * @param array $info Image data
1233
+ * @return resource Resized image
1234
+ */
1235
+ private function resize( $image, $width, $height, $info ) {
1236
+ $new_image = imagecreatetruecolor( $width, $height );
1237
+
1238
+ // check if this image is PNG, then set if transparent
1239
+ if ( $info[2] === 3 ) {
1240
+ imagealphablending( $new_image, false );
1241
+ imagesavealpha( $new_image, true );
1242
+ imagefilledrectangle( $new_image, 0, 0, $width, $height, imagecolorallocatealpha( $new_image, 255, 255, 255, 127 ) );
1243
+ }
1244
+
1245
+ imagecopyresampled( $new_image, $image, 0, 0, 0, 0, $width, $height, $info[0], $info[1] );
1246
+
1247
+ return $new_image;
1248
+ }
1249
+
1250
+ /**
1251
+ * Save image from image resource.
1252
+ *
1253
+ * @param resource $image Image resource
1254
+ * @param string $mime_type Image mime type
1255
+ * @param string $filepath Path where image should be saved
1256
+ * @return void
1257
+ */
1258
+ private function save_image_file( $image, $mime_type, $filepath, $quality ) {
1259
+ switch ( $mime_type ) {
1260
+ case 'image/jpeg':
1261
+ case 'image/pjpeg':
1262
+ imagejpeg( $image, $filepath, $quality );
1263
+ break;
1264
+
1265
+ case 'image/png':
1266
+ imagepng( $image, $filepath, (int) round( 9 - ( 9 * $quality / 100 ), 0 ) );
1267
+ break;
1268
+ }
1269
+ }
1270
+
1271
+ /**
1272
+ * Add links to support forum.
1273
+ *
1274
+ * @param array $links
1275
+ * @param string $file
1276
+ * @return array
1277
+ */
1278
+ public function plugin_extend_links( $links, $file ) {
1279
+ if ( ! current_user_can( 'install_plugins' ) )
1280
+ return $links;
1281
+
1282
+ $plugin = plugin_basename( __FILE__ );
1283
+
1284
+ if ( $file == $plugin ) {
1285
+ return array_merge(
1286
+ $links, array( sprintf( '<a href="http://www.dfactory.eu/support/forum/image-watermark/" target="_blank">%s</a>', __( 'Support', 'image-watermark' ) ) )
1287
+ );
1288
+ }
1289
+
1290
+ return $links;
1291
+ }
1292
+
1293
+ /**
1294
+ * Add links to settings page.
1295
+ *
1296
+ * @param array $links
1297
+ * @param string $file
1298
+ * @return array
1299
+ */
1300
+ function plugin_settings_link( $links, $file ) {
1301
+ if ( ! is_admin() || ! current_user_can( 'manage_options' ) )
1302
+ return $links;
1303
+
1304
+ static $plugin;
1305
+
1306
+ $plugin = plugin_basename( __FILE__ );
1307
+
1308
+ if ( $file == $plugin ) {
1309
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php' ) . '?page=watermark-options', __( 'Settings', 'image-watermark' ) );
1310
+ array_unshift( $links, $settings_link );
1311
+ }
1312
+
1313
+ return $links;
1314
+ }
1315
+
1316
+ }
1317
+
1318
+ /**
1319
+ * Get instance of main class.
1320
+ *
1321
+ * @return object Instance
1322
+ */
1323
+ function Image_Watermark() {
1324
+ static $instance;
1325
+
1326
+ // first call to instance() initializes the plugin
1327
+ if ( $instance === null || ! ( $instance instanceof Image_Watermark ) )
1328
+ $instance = Image_Watermark::instance();
1329
+
1330
+ return $instance;
1331
+ }
1332
+
1333
+ Image_Watermark();
includes/class-settings.php CHANGED
@@ -5,6 +5,11 @@ if ( ! defined( 'ABSPATH' ) )
5
 
6
  new Image_Watermark_Settings( );
7
 
 
 
 
 
 
8
  class Image_Watermark_Settings {
9
  private $image_sizes;
10
  private $watermark_positions = array(
@@ -13,7 +18,7 @@ class Image_Watermark_Settings {
13
  );
14
 
15
  /**
16
- *
17
  */
18
  public function __construct( ) {
19
  // actions
@@ -34,6 +39,8 @@ class Image_Watermark_Settings {
34
 
35
  /**
36
  * Get post types.
 
 
37
  */
38
  private function get_post_types() {
39
  return array_merge( array( 'post', 'page' ), get_post_types( array( '_builtin' => false ), 'names' ) );
@@ -118,12 +125,6 @@ class Image_Watermark_Settings {
118
  <p class="inner">' . __( 'If you are having problems with this plugin, checkout plugin', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/docs/image-watermark-plugin/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=documentation" target="_blank" title="' . __( 'Documentation', 'image-watermark' ) . '">' . __( 'Documentation', 'image-watermark' ) . '</a> ' . __( 'or talk about them in the', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/support/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=support" target="_blank" title="' . __( 'Support forum', 'image-watermark' ) . '">' . __( 'Support forum', 'image-watermark' ) . '</a></p>
119
  <hr />
120
  <h4 class="inner">' . __( 'Do you like this plugin?', 'image-watermark' ) . '</h4>
121
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" class="inner">
122
- <input type="hidden" name="cmd" value="_s-xclick">
123
- <input type="hidden" name="hosted_button_id" value="DCF3AXC9A5A88">
124
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
125
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
126
- </form>
127
  <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/image-watermark" target="_blank" title="' . __( 'Rate it 5', 'image-watermark' ) . '">' . __( 'Rate it 5', 'image-watermark' ) . '</a> ' . __( 'on WordPress.org', 'image-watermark' ) . '<br />' .
128
  __( 'Blog about it & link to the', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/plugins/image-watermark/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="' . __( 'plugin page', 'image-watermark' ) . '">' . __( 'plugin page', 'image-watermark' ) . '</a><br />' .
129
  __( 'Check out our other', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/plugins/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="' . __( 'WordPress plugins', 'image-watermark' ) . '">' . __( 'WordPress plugins', 'image-watermark' ) . '</a>
@@ -132,6 +133,10 @@ class Image_Watermark_Settings {
132
  <p class="df-link inner">' . __( 'Created by', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . plugins_url( '../images/logo-dfactory.png', __FILE__ ) . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
133
  </div>
134
  </div>
 
 
 
 
135
  </div>
136
  <form action="options.php" method="post">
137
  <div id="main-sortables" class="meta-box-sortables ui-sortable">';
@@ -170,8 +175,8 @@ class Image_Watermark_Settings {
170
  /**
171
  * Validate options.
172
  *
173
- * @param array $input
174
- * @return array
175
  */
176
  public function validate_options( $input ) {
177
  if ( ! current_user_can( 'manage_options' ) )
@@ -268,6 +273,8 @@ class Image_Watermark_Settings {
268
 
269
  /**
270
  * PHP extension.
 
 
271
  */
272
  public function iw_extension() {
273
  echo '
@@ -289,6 +296,8 @@ class Image_Watermark_Settings {
289
 
290
  /**
291
  * Automatic watermarking option.
 
 
292
  */
293
  public function iw_automatic_watermarking() {
294
  ?>
@@ -301,6 +310,8 @@ class Image_Watermark_Settings {
301
 
302
  /**
303
  * Manual watermarking option.
 
 
304
  */
305
  public function iw_manual_watermarking() {
306
  ?>
@@ -313,6 +324,8 @@ class Image_Watermark_Settings {
313
 
314
  /**
315
  * Enable watermark for option.
 
 
316
  */
317
  public function iw_enable_for() {
318
  ?>
@@ -367,6 +380,8 @@ class Image_Watermark_Settings {
367
 
368
  /**
369
  * Frontend watermarking option.
 
 
370
  */
371
  public function iw_frontend_watermarking() {
372
  ?>
@@ -380,6 +395,8 @@ class Image_Watermark_Settings {
380
 
381
  /**
382
  * Remove data on deactivation option.
 
 
383
  */
384
  public function iw_deactivation() {
385
  ?>
@@ -392,6 +409,8 @@ class Image_Watermark_Settings {
392
 
393
  /**
394
  * Watermark alignment option.
 
 
395
  */
396
  public function iw_alignment() {
397
  ?>
@@ -423,6 +442,8 @@ class Image_Watermark_Settings {
423
 
424
  /**
425
  * Watermark offset option.
 
 
426
  */
427
  public function iw_offset() {
428
  ?>
@@ -436,6 +457,8 @@ class Image_Watermark_Settings {
436
 
437
  /**
438
  * Watermark image option.
 
 
439
  */
440
  public function iw_watermark_image() {
441
  if ( Image_Watermark()->options['watermark_image']['url'] !== NULL && Image_Watermark()->options['watermark_image']['url'] != 0 ) {
@@ -456,6 +479,8 @@ class Image_Watermark_Settings {
456
 
457
  /**
458
  * Watermark image preview.
 
 
459
  */
460
  public function iw_watermark_preview() {
461
  if ( Image_Watermark()->options['watermark_image']['url'] !== NULL && Image_Watermark()->options['watermark_image']['url'] != 0 ) {
@@ -493,6 +518,8 @@ class Image_Watermark_Settings {
493
 
494
  /**
495
  * Watermark size option.
 
 
496
  */
497
  public function iw_watermark_size() {
498
  ?>
@@ -512,6 +539,8 @@ class Image_Watermark_Settings {
512
 
513
  /**
514
  * Watermark custom size option.
 
 
515
  */
516
  public function iw_watermark_size_custom() {
517
  ?>
@@ -526,6 +555,8 @@ class Image_Watermark_Settings {
526
 
527
  /**
528
  * Watermark scaled size option.
 
 
529
  */
530
  public function iw_watermark_size_scaled() {
531
  ?>
@@ -543,6 +574,8 @@ class Image_Watermark_Settings {
543
 
544
  /**
545
  * Watermark custom size option.
 
 
546
  */
547
  public function iw_watermark_opacity() {
548
  ?>
@@ -560,6 +593,8 @@ class Image_Watermark_Settings {
560
 
561
  /**
562
  * Image quality option.
 
 
563
  */
564
  public function iw_image_quality() {
565
  ?>
@@ -577,6 +612,8 @@ class Image_Watermark_Settings {
577
 
578
  /**
579
  * Image format option.
 
 
580
  */
581
  public function iw_image_format() {
582
  ?>
@@ -594,6 +631,8 @@ class Image_Watermark_Settings {
594
 
595
  /**
596
  * Right click image protection option.
 
 
597
  */
598
  public function iw_protection_right_click() {
599
  ?>
@@ -606,6 +645,8 @@ class Image_Watermark_Settings {
606
 
607
  /**
608
  * Drag and drop image protection option.
 
 
609
  */
610
  public function iw_protection_drag_drop() {
611
  ?>
@@ -618,6 +659,8 @@ class Image_Watermark_Settings {
618
 
619
  /**
620
  * Logged-in users image protection option.
 
 
621
  */
622
  public function iw_protection_logged() {
623
  ?>
@@ -630,6 +673,8 @@ class Image_Watermark_Settings {
630
 
631
  /**
632
  * Backup the original image
 
 
633
  */
634
  public function iw_backup_image() {
635
  ?>
@@ -642,6 +687,8 @@ class Image_Watermark_Settings {
642
 
643
  /**
644
  * Image backup quality option.
 
 
645
  */
646
  public function iw_backup_image_quality() {
647
  ?>
5
 
6
  new Image_Watermark_Settings( );
7
 
8
+ /**
9
+ * Image Watermark settings class.
10
+ *
11
+ * @class Image_Watermark_Settings
12
+ */
13
  class Image_Watermark_Settings {
14
  private $image_sizes;
15
  private $watermark_positions = array(
18
  );
19
 
20
  /**
21
+ * Class constructor.
22
  */
23
  public function __construct( ) {
24
  // actions
39
 
40
  /**
41
  * Get post types.
42
+ *
43
+ * @return array
44
  */
45
  private function get_post_types() {
46
  return array_merge( array( 'post', 'page' ), get_post_types( array( '_builtin' => false ), 'names' ) );
125
  <p class="inner">' . __( 'If you are having problems with this plugin, checkout plugin', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/docs/image-watermark-plugin/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=documentation" target="_blank" title="' . __( 'Documentation', 'image-watermark' ) . '">' . __( 'Documentation', 'image-watermark' ) . '</a> ' . __( 'or talk about them in the', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/support/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=support" target="_blank" title="' . __( 'Support forum', 'image-watermark' ) . '">' . __( 'Support forum', 'image-watermark' ) . '</a></p>
126
  <hr />
127
  <h4 class="inner">' . __( 'Do you like this plugin?', 'image-watermark' ) . '</h4>
 
 
 
 
 
 
128
  <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/image-watermark" target="_blank" title="' . __( 'Rate it 5', 'image-watermark' ) . '">' . __( 'Rate it 5', 'image-watermark' ) . '</a> ' . __( 'on WordPress.org', 'image-watermark' ) . '<br />' .
129
  __( 'Blog about it & link to the', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/plugins/image-watermark/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="' . __( 'plugin page', 'image-watermark' ) . '">' . __( 'plugin page', 'image-watermark' ) . '</a><br />' .
130
  __( 'Check out our other', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/plugins/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="' . __( 'WordPress plugins', 'image-watermark' ) . '">' . __( 'WordPress plugins', 'image-watermark' ) . '</a>
133
  <p class="df-link inner">' . __( 'Created by', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . plugins_url( '../images/logo-dfactory.png', __FILE__ ) . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
134
  </div>
135
  </div>
136
+ <div class="df-promo">
137
+ <h4 class="inner">' . __( 'Need image optimization?', 'image-watermark' ) . '</h4>
138
+ <p class="inner">' . sprintf( __( 'Speed up your site with <a href="%s" target="_blank">ShortPixel</a>. Sign up as Image Watermark user and get 50&#37; extra monthly optimizations!', 'image-watermark' ), 'https://shortpixel.com/h/af/E0IQA8M124741' ) . '</p>
139
+ </div>
140
  </div>
141
  <form action="options.php" method="post">
142
  <div id="main-sortables" class="meta-box-sortables ui-sortable">';
175
  /**
176
  * Validate options.
177
  *
178
+ * @param array $input
179
+ * @return array
180
  */
181
  public function validate_options( $input ) {
182
  if ( ! current_user_can( 'manage_options' ) )
273
 
274
  /**
275
  * PHP extension.
276
+ *
277
+ * @return mixed
278
  */
279
  public function iw_extension() {
280
  echo '
296
 
297
  /**
298
  * Automatic watermarking option.
299
+ *
300
+ * @return mixed
301
  */
302
  public function iw_automatic_watermarking() {
303
  ?>
310
 
311
  /**
312
  * Manual watermarking option.
313
+ *
314
+ * @return mixed
315
  */
316
  public function iw_manual_watermarking() {
317
  ?>
324
 
325
  /**
326
  * Enable watermark for option.
327
+ *
328
+ * @return mixed
329
  */
330
  public function iw_enable_for() {
331
  ?>
380
 
381
  /**
382
  * Frontend watermarking option.
383
+ *
384
+ * @return mixed
385
  */
386
  public function iw_frontend_watermarking() {
387
  ?>
395
 
396
  /**
397
  * Remove data on deactivation option.
398
+ *
399
+ * @return mixed
400
  */
401
  public function iw_deactivation() {
402
  ?>
409
 
410
  /**
411
  * Watermark alignment option.
412
+ *
413
+ * @return mixed
414
  */
415
  public function iw_alignment() {
416
  ?>
442
 
443
  /**
444
  * Watermark offset option.
445
+ *
446
+ * @return mixed
447
  */
448
  public function iw_offset() {
449
  ?>
457
 
458
  /**
459
  * Watermark image option.
460
+ *
461
+ * @return mixed
462
  */
463
  public function iw_watermark_image() {
464
  if ( Image_Watermark()->options['watermark_image']['url'] !== NULL && Image_Watermark()->options['watermark_image']['url'] != 0 ) {
479
 
480
  /**
481
  * Watermark image preview.
482
+ *
483
+ * @return mixed
484
  */
485
  public function iw_watermark_preview() {
486
  if ( Image_Watermark()->options['watermark_image']['url'] !== NULL && Image_Watermark()->options['watermark_image']['url'] != 0 ) {
518
 
519
  /**
520
  * Watermark size option.
521
+ *
522
+ * @return mixed
523
  */
524
  public function iw_watermark_size() {
525
  ?>
539
 
540
  /**
541
  * Watermark custom size option.
542
+ *
543
+ * @return mixed
544
  */
545
  public function iw_watermark_size_custom() {
546
  ?>
555
 
556
  /**
557
  * Watermark scaled size option.
558
+ *
559
+ * @return mixed
560
  */
561
  public function iw_watermark_size_scaled() {
562
  ?>
574
 
575
  /**
576
  * Watermark custom size option.
577
+ *
578
+ * @return mixed
579
  */
580
  public function iw_watermark_opacity() {
581
  ?>
593
 
594
  /**
595
  * Image quality option.
596
+ *
597
+ * @return mixed
598
  */
599
  public function iw_image_quality() {
600
  ?>
612
 
613
  /**
614
  * Image format option.
615
+ *
616
+ * @return mixed
617
  */
618
  public function iw_image_format() {
619
  ?>
631
 
632
  /**
633
  * Right click image protection option.
634
+ *
635
+ * @return mixed
636
  */
637
  public function iw_protection_right_click() {
638
  ?>
645
 
646
  /**
647
  * Drag and drop image protection option.
648
+ *
649
+ * @return mixed
650
  */
651
  public function iw_protection_drag_drop() {
652
  ?>
659
 
660
  /**
661
  * Logged-in users image protection option.
662
+ *
663
+ * @return mixed
664
  */
665
  public function iw_protection_logged() {
666
  ?>
673
 
674
  /**
675
  * Backup the original image
676
+ *
677
+ * @return mixed
678
  */
679
  public function iw_backup_image() {
680
  ?>
687
 
688
  /**
689
  * Image backup quality option.
690
+ *
691
+ * @return mixed
692
  */
693
  public function iw_backup_image_quality() {
694
  ?>
includes/class-update.php CHANGED
@@ -5,13 +5,26 @@ if ( ! defined( 'ABSPATH' ) )
5
 
6
  new Image_Watermark_Update( );
7
 
 
 
 
 
 
8
  class Image_Watermark_Update {
9
 
 
 
 
10
  public function __construct( ) {
11
  // actions
12
  add_action( 'admin_init', array( $this, 'check_update' ) );
13
  }
14
 
 
 
 
 
 
15
  public function check_update() {
16
  if( ! current_user_can( 'manage_options' ) || ! current_user_can( 'install_plugins' ) )
17
  return;
@@ -22,7 +35,7 @@ class Image_Watermark_Update {
22
  // new version?
23
  if ( version_compare( $current_db_version, Image_Watermark()->defaults['version'], '<' ) ) {
24
  // update plugin version
25
- update_option( 'image_watermark_version', Image_Watermark()->defaults['version'] );
26
  }
27
  }
28
  }
5
 
6
  new Image_Watermark_Update( );
7
 
8
+ /**
9
+ * Image Watermark update class.
10
+ *
11
+ * @class Image_Watermark_Update
12
+ */
13
  class Image_Watermark_Update {
14
 
15
+ /**
16
+ * Class constructor.
17
+ */
18
  public function __construct( ) {
19
  // actions
20
  add_action( 'admin_init', array( $this, 'check_update' ) );
21
  }
22
 
23
+ /**
24
+ * Check if update is required.
25
+ *
26
+ * @return void
27
+ */
28
  public function check_update() {
29
  if( ! current_user_can( 'manage_options' ) || ! current_user_can( 'install_plugins' ) )
30
  return;
35
  // new version?
36
  if ( version_compare( $current_db_version, Image_Watermark()->defaults['version'], '<' ) ) {
37
  // update plugin version
38
+ update_option( 'image_watermark_version', Image_Watermark()->defaults['version'], false );
39
  }
40
  }
41
  }
js/admin-image-actions.js CHANGED
@@ -1,484 +1,545 @@
1
-
2
- jQuery( document ).ready( function ( $ ) {
3
-
4
- /**
5
- * wp_localize_script object: iwImageActionArgs
6
- *
7
- * Params:
8
- *
9
- * _nonce
10
- * __applied_none => 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.'
11
- * __applied_one => 'Watermark was succesfully applied to 1 image.
12
- * __applied_multi => 'Watermark was succesfully applied to %s images.'
13
- * __removed_none => 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.'
14
- * __removed_one => 'Watermark was succesfully removed from 1 image.'
15
- * __removed_multi => 'Watermark was succesfully removed from %s images.'
16
- * __skipped => 'Skipped files'
17
- * __running => 'Bulk action is currently running, please wait.'
18
- * __dismiss => 'Dismiss this notice.' // Wordpress default string
19
- *
20
- */
21
-
22
- watermarkImageActions = {
23
- running: false,
24
- action_location: '',
25
- action: '',
26
- response: '',
27
- selected: [],
28
- successCount: 0,
29
- skippedCount: 0,
30
-
31
- init: function() {
32
-
33
- // Normal (list) mode
34
- $(document).on('click', '.bulkactions input#doaction', function(e) {
35
- // Get the selected bulk action
36
- action = $(this).parent().children('select').val();
37
-
38
- if ( ! iwImageActionArgs.backup_image && action === 'removewatermark' ) {
39
- return;
40
- }
41
-
42
- // Validate action
43
- if ( 'applywatermark' == action || 'removewatermark' == action ) {
44
- // Stop default
45
- e.preventDefault();
46
-
47
- // Is this script running?
48
- if ( false === watermarkImageActions.running ) {
49
- // No! set it on running
50
- watermarkImageActions.running = true;
51
-
52
- // store current action
53
- watermarkImageActions.action = action;
54
-
55
- // store current location where the action was fired
56
- watermarkImageActions.action_location = 'upload-list';
57
-
58
- // store selected attachment id's
59
- $('.wp-list-table .check-column input:checkbox:checked').each(function(){
60
- watermarkImageActions.selected.push( $(this).val() );
61
- });
62
-
63
- // remove current notices
64
- $('.iw-notice').slideUp('fast', function() {
65
- $(this).remove();
66
- });
67
-
68
- // begin the update!
69
- watermarkImageActions.post_loop();
70
-
71
- } else {
72
- // script is running, can't run two at the same time
73
- watermarkImageActions.notice( 'iw-notice error', iwImageActionArgs.__running, false );
74
- }
75
-
76
- }
77
- });
78
-
79
- // Media modal or edit attachment screen mode
80
- $(document).on('click', '#image_watermark_buttons a.iw-watermark-action', function(e) {
81
- // Get the selected bulk action
82
- action = $(this).attr('data-action');
83
- id = $(this).attr('data-id');
84
-
85
- // Validate action
86
- if ( 'applywatermark' == action || 'removewatermark' == action && ! isNaN( id ) ) {
87
- // Stop default
88
- e.preventDefault();
89
-
90
- // store current action
91
- watermarkImageActions.action = action;
92
-
93
- // Is this script running?
94
- if ( false === watermarkImageActions.running ) {
95
- // No! set it on running
96
- watermarkImageActions.running = true;
97
-
98
- // store current action
99
- watermarkImageActions.action = action;
100
-
101
- // store current location where the action was fired
102
- if ( $(this).parents('.media-modal ').length ) {
103
- watermarkImageActions.action_location = 'media-modal';
104
- } else {
105
- watermarkImageActions.action_location = 'edit';
106
- }
107
-
108
- // store attachment id
109
- watermarkImageActions.selected.push( id );
110
-
111
- // remove current notices
112
- $('.iw-notice').slideUp( 'fast', function() {
113
- $( this ).remove();
114
- });
115
-
116
- // begin the update!
117
- watermarkImageActions.post_loop();
118
- } else {
119
- // script is running, can't run two at the same time
120
- watermarkImageActions.notice( 'iw-notice error', iwMediaModal.__running, false );
121
- }
122
- }
123
- });
124
-
125
- // Since these are added later we'll need to enable dismissing again
126
- $(document).on('click', '.iw-notice.is-dismissible .notice-dismiss', function() {
127
- $(this).parents('.iw-notice').slideUp( 'fast', function() {
128
- $(this).remove();
129
- } );
130
- });
131
-
132
- },
133
-
134
- post_loop: function() {
135
- // do we have selected attachments?
136
- if ( watermarkImageActions.selected.length ) {
137
-
138
- // take the first id
139
- id = watermarkImageActions.selected[ 0 ];
140
-
141
- // check for a valid ID (needs to be numeric)
142
- if ( ! isNaN( id ) ) {
143
-
144
- // Show loading icon
145
- watermarkImageActions.row_image_feedback( 'loading', id );
146
-
147
- // post data
148
- data = {
149
- '_iw_nonce': iwImageActionArgs._nonce,
150
- 'action': 'iw_watermark_bulk_action',
151
- 'iw-action': watermarkImageActions.action,
152
- 'attachment_id': id
153
- };
154
-
155
- // the ajax post!
156
- $.post( ajaxurl, data, function( response ) {
157
- // show result
158
- watermarkImageActions.result( response, id );
159
- // remove this ID/key from the selected attachments
160
- watermarkImageActions.selected.splice( 0, 1 );
161
- // Redo this function
162
- watermarkImageActions.post_loop();
163
-
164
- $('.iw-overlay').first().each( function() {
165
- $(this).fadeOut( 'fast', function() {
166
- $(this).remove();
167
-
168
- if ( response.data === 'watermarked' ) {
169
- $( '#image_watermark_buttons .value' ).append( '<span class="dashicons dashicons-yes" style="font-size: 24px;float: none;min-width: 28px;padding: 0;margin: 0; display: none;"></span>' );
170
- $( '#image_watermark_buttons .value .dashicons' ).fadeIn( 'fast' );
171
- } else if ( response.data === 'watermarkremoved' ) {
172
- $( '#image_watermark_buttons .value' ).append( '<span class="dashicons dashicons-yes" style="font-size: 24px;float: none;min-width: 28px;padding: 0;margin: 0; display: none;"></span>' );
173
- $( '#image_watermark_buttons .value .dashicons' ).fadeIn( 'fast' );
174
- }
175
-
176
- $( '#image_watermark_buttons .value .dashicons' ).delay( 1500 ).fadeOut( 'fast', function() {
177
- $( this ).remove();
178
- } );
179
- } );
180
- } );
181
- } );
182
-
183
- } else {
184
- // ID is not valid so remove this key from the selected attachments
185
- watermarkImageActions.selected.splice( 0, 1 );
186
- // Redo this function
187
- watermarkImageActions.post_loop();
188
- }
189
- } else {
190
- // All is done, reset this "class"
191
- watermarkImageActions.reset();
192
- }
193
- },
194
-
195
- result: function( response, id ) {
196
-
197
- // Was the ajax post successful?
198
- if ( true === response.success ) {
199
-
200
- // defaults
201
- type = false;
202
- message = '';
203
- // store response data
204
- watermarkImageActions.response = response.data;
205
-
206
- // Check what kind of action is done (watermarked, watermarkremoved or skipped)
207
- switch ( response.data ) {
208
- case 'watermarked':
209
- // The css classes for the notice
210
- type = 'iw-notice updated iw-watermarked';
211
- // another successful update
212
- watermarkImageActions.successCount += 1;
213
- // did we have more success updates?
214
- if ( 1 < watermarkImageActions.successCount ) {
215
- //yes
216
- message = iwImageActionArgs.__applied_multi.replace( '%s', watermarkImageActions.successCount );
217
- } else {
218
- //no
219
- message = iwImageActionArgs.__applied_one;
220
- }
221
- // update the row feedback
222
- watermarkImageActions.row_image_feedback( 'success', id );
223
- // reload the image
224
- watermarkImageActions.reload_image( id );
225
- break;
226
- case 'watermarkremoved':
227
- // The css classes for the notice
228
- type = 'iw-notice updated iw-watermarkremoved';
229
- // another successful update
230
- watermarkImageActions.successCount += 1;
231
- // did we have more success updates?
232
- if ( 1 < watermarkImageActions.successCount ) {
233
- //yes
234
- message = iwImageActionArgs.__removed_multi.replace( '%s', watermarkImageActions.successCount );
235
- } else {
236
- //no
237
- message = iwImageActionArgs.__removed_one;
238
- }
239
- // update the row feedback
240
- watermarkImageActions.row_image_feedback( 'success', id );
241
- // reload the image
242
- watermarkImageActions.reload_image( id );
243
- break;
244
- case 'skipped':
245
- // The css classes for the notice
246
- type = 'iw-notice error iw-skipped';
247
- // another skipped update
248
- watermarkImageActions.skippedCount += 1;
249
- // adjust the message with the number of skipped updates
250
- message = iwImageActionArgs.__skipped + ': ' + watermarkImageActions.skippedCount;
251
- // update the row feedback
252
- watermarkImageActions.row_image_feedback( 'error', id );
253
- break;
254
- }
255
- if ( false !== type ) {
256
- // we have a valid terun type, show the notice! (Overwrite current notice if available)
257
- watermarkImageActions.notice( type, message, true );
258
- }
259
- } else {
260
- // No success...
261
- watermarkImageActions.notice( 'iw-notice error', response.data, false );
262
- // update the row feedback
263
- watermarkImageActions.row_image_feedback( 'error', id );
264
- }
265
-
266
- },
267
-
268
- row_image_feedback: function( type, id ) {
269
- var css = {},
270
- cssinner = {},
271
- container_selector;
272
-
273
- switch ( watermarkImageActions.action_location ) {
274
- case 'upload-list':
275
- container_selector = '.wp-list-table #post-'+id+' .media-icon';
276
- css = {
277
- display: 'table',
278
- width: $(container_selector).width() + 'px',
279
- height: $(container_selector).height() + 'px',
280
- top: '0',
281
- left: '0',
282
- position: 'absolute',
283
- font: 'normal normal normal dashicons',
284
- background: 'rgba(255,255,255,0.75)',
285
- content: ''
286
- };
287
- cssinner = {
288
- 'vertical-align': 'middle',
289
- 'text-align': 'center',
290
- display: 'table-cell',
291
- width: '100%',
292
- height: '100%',
293
- };
294
- break;
295
-
296
- case 'edit':
297
- container_selector = '.wp_attachment_holder #thumbnail-head-'+id+'';
298
- css = {
299
- display: 'table',
300
- width: $(container_selector+' img').width() + 'px',
301
- height: $(container_selector+' img').height() + 'px',
302
- top: '0',
303
- left: '0',
304
- position: 'absolute',
305
- font: 'normal normal normal dashicons',
306
- background: 'rgba(255,255,255,0.75)',
307
- content: ''
308
- };
309
- cssinner = {
310
- 'vertical-align': 'middle',
311
- 'text-align': 'center',
312
- display: 'table-cell',
313
- width: '100%',
314
- height: '100%',
315
- };
316
- break;
317
-
318
- case 'media-modal':
319
- container_selector = '.media-modal #image_watermark_buttons[data-id="'+id+'"] .value';
320
- css = {
321
- 'float': 'none'
322
- };
323
- cssinner = {
324
- 'float': 'none'
325
- };
326
- break;
327
-
328
- default:
329
- return false;
330
- }
331
-
332
- // css rules
333
- $( container_selector ).css( 'position', 'relative' );
334
-
335
- // Only create the element if it doesn't exist
336
- if ( ! $( container_selector + ' .iw-overlay').length ) {
337
- $( container_selector ).append( '<span class="iw-overlay"><span class="iw-overlay-inner"></span></span>' );
338
- }
339
-
340
- // Overwrite with new data
341
- $( container_selector + ' .iw-overlay' ).css( css );
342
- $( container_selector + ' .iw-overlay .iw-overlay-inner' ).css( cssinner );
343
- $( container_selector + ' .iw-overlay .iw-overlay-inner' ).html( '<span class="spinner is-active"></span>' );
344
-
345
- if ( watermarkImageActions.action_location === 'media-modal' ) {
346
- $( container_selector + ' .iw-overlay .iw-overlay-inner .spinner' ).css( { 'float': 'none', 'padding': 0, 'margin': '-4px 0 0 10px' } );
347
- }
348
- },
349
-
350
- notice: function( type, message, overwrite ) {
351
-
352
- if ( watermarkImageActions.action_location === 'media-modal' ) {
353
- return;
354
- }
355
-
356
- type += ' notice is-dismissible';
357
-
358
- // Get the prefix based on the action location
359
- switch ( watermarkImageActions.action_location ) {
360
- case 'upload-list': prefix = '.wrap > h1'; break;
361
- default: prefix = '#image_watermark_buttons'; break;
362
- }
363
-
364
- // Overwrite the current notice?
365
- if ( true === overwrite ) {
366
- selector = false;
367
-
368
- // Get the selector based on the response
369
- switch ( watermarkImageActions.response ) {
370
- case 'watermarked': selector = '.iw-notice.iw-watermarked'; break;
371
- case 'watermarkremoved': selector = '.iw-notice.iw-watermarkremoved'; break;
372
- case 'skipped': selector = '.iw-notice.iw-skipped'; break;
373
- }
374
- // Do we have a selector and can we find it? If not, just create a new notice
375
- if ( selector && $('.wrap '+selector+' > p').length ) {
376
-
377
- // Get the selector based on the action location (not not forget the ending space)
378
- switch ( watermarkImageActions.action_location ) {
379
- case 'upload-list': prefix = '.wrap '; break;
380
- default: prefix = '#image_watermark_buttons '; break;
381
- }
382
- $(prefix+selector+' > p').html( message );
383
- } else {
384
- $(prefix).after('<div class="' + type + '" style="display: none;"><p>' + message + '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + iwImageActionArgs.__dismiss + '</span></button></div>');
385
- $('.iw-notice').slideDown('fast');
386
- }
387
- } else {
388
- // create a new notice
389
- $(prefix).after('<div class="' + type + '" style="display: none;"><p>' + message + '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + iwImageActionArgs.__dismiss + '</span></button></div>');
390
- $('.iw-notice').slideDown('fast');
391
- }
392
-
393
- },
394
-
395
- reset: function() {
396
- watermarkImageActions.running = false;
397
- watermarkImageActions.action = '';
398
- watermarkImageActions.response = '';
399
- watermarkImageActions.selected = [];
400
- watermarkImageActions.successCount = 0;
401
- watermarkImageActions.skippedCount = 0;
402
-
403
- // remove the overlay
404
- setTimeout( function() {
405
- $( '.iw-overlay' ).each( function() {
406
- $(this).fadeOut('fast', function() {
407
- $(this).remove();
408
- });
409
- });
410
- }, 100 );
411
- },
412
-
413
- reload_image: function( id ) {
414
- // reload the images
415
- time = new Date().getTime();
416
- selector = false;
417
- // Get the selector based on the action location
418
- switch ( watermarkImageActions.action_location ) {
419
- case 'upload-list': selector = '.wp-list-table #post-'+id+' .image-icon img'; break;
420
- case 'media-modal': selector = '.attachment-details[data-id="'+id+'"] img, .attachment[data-id="'+id+'"] img'; break;
421
- case 'edit': selector = '.wp_attachment_holder img'; break;
422
- }
423
-
424
- if ( selector ) {
425
- image = $( selector );
426
- image.each( function () {
427
- // Remove the responsive metadata, this prevents reloading the image
428
- $(this).removeAttr('srcset');
429
- $(this).removeAttr('sizes');
430
- // Reload the image (actually a browser hack by adding a time parameter to the image)
431
- $(this).attr('src', watermarkImageActions.replace_url_param( $(this).attr('src'), 't', time ) );
432
- });
433
- }
434
- },
435
-
436
- rotate_icon: function( icon ) {
437
- // This function accepts selectors and objects
438
- if ( typeof icon == 'string') {
439
- icon = $( icon );
440
- }
441
- // Check for the length of the selected object.
442
- if ( $( icon.selector ).length ) {
443
- // Set rotation to 0
444
- icon.css({
445
- '-webkit-transform': 'rotate(0deg)',
446
- '-ms-transform': 'rotate(0deg)',
447
- 'transform': 'rotate(0deg)',
448
- 'borderSpacing': '0',
449
- });
450
- // Do animation (one rotation)
451
- icon.animate(
452
- { borderSpacing: 360 },
453
- {
454
- duration: 1000,
455
- step: function(now, fx) {
456
- $(this).css('-webkit-transform', 'rotate('+now+'deg)');
457
- $(this).css('-ms-transform', 'rotate('+now+'deg)');
458
- $(this).css('transform', 'rotate('+now+'deg)');
459
- if (now == 360) {
460
- // Animation finished, stop loop and restart
461
- icon.stop();
462
- watermarkImageActions.rotate_icon( icon );
463
- }
464
- },
465
- }
466
- );
467
- }
468
- },
469
-
470
- replace_url_param: function( url, paramName, paramValue ) {
471
- var pattern = new RegExp('\\b('+paramName+'=).*?(&|$)');
472
- if(url.search(pattern)>=0){
473
- return url.replace(pattern,'$1' + paramValue + '$2');
474
- }
475
- return url + (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue;
476
- },
477
- };
478
-
479
- // We need that nonce!
480
- if ( typeof iwImageActionArgs._nonce != 'undefined' ) {
481
- watermarkImageActions.init();
482
- }
483
-
484
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function ( $ ) {
2
+
3
+ /**
4
+ * wp_localize_script object: iwImageActionArgs
5
+ *
6
+ * Params:
7
+ *
8
+ * _nonce
9
+ * __applied_none => 'Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected.'
10
+ * __applied_one => 'Watermark was succesfully applied to 1 image.
11
+ * __applied_multi => 'Watermark was succesfully applied to %s images.'
12
+ * __removed_none => 'Watermark could not be removed from selected files or no valid images (JPEG, PNG) were selected.'
13
+ * __removed_one => 'Watermark was succesfully removed from 1 image.'
14
+ * __removed_multi => 'Watermark was succesfully removed from %s images.'
15
+ * __skipped => 'Skipped files'
16
+ * __running => 'Bulk action is currently running, please wait.'
17
+ * __dismiss => 'Dismiss this notice.' // Wordpress default string
18
+ *
19
+ */
20
+
21
+ watermarkImageActions = {
22
+ running: false,
23
+ action_location: '',
24
+ action: '',
25
+ response: '',
26
+ selected: [ ],
27
+ successCount: 0,
28
+ skippedCount: 0,
29
+ init: function () {
30
+
31
+ // Normal (list) mode
32
+ $( document ).on( 'click', '.bulkactions input#doaction, .bulkactions input#doaction2', function ( e ) {
33
+ // Get the selected bulk action
34
+ action = $( this ).parent().children( 'select' ).val();
35
+
36
+ if ( !iwImageActionArgs.backup_image && action === 'removewatermark' ) {
37
+ return;
38
+ }
39
+
40
+ // Validate action
41
+ if ( 'applywatermark' == action || 'removewatermark' == action ) {
42
+ // Stop default
43
+ e.preventDefault();
44
+
45
+ // Is this script running?
46
+ if ( false === watermarkImageActions.running ) {
47
+ // No! set it on running
48
+ watermarkImageActions.running = true;
49
+
50
+ // store current action
51
+ watermarkImageActions.action = action;
52
+
53
+ // store current location where the action was fired
54
+ watermarkImageActions.action_location = 'upload-list';
55
+
56
+ // store selected attachment id's
57
+ $( '.wp-list-table .check-column input:checkbox:checked' ).each( function () {
58
+ watermarkImageActions.selected.push( $( this ).val() );
59
+ } );
60
+
61
+ // remove current notices
62
+ $( '.iw-notice' ).slideUp( 'fast', function () {
63
+ $( this ).remove();
64
+ } );
65
+
66
+ // begin the update!
67
+ watermarkImageActions.post_loop();
68
+
69
+ } else {
70
+ // script is running, can't run two at the same time
71
+ watermarkImageActions.notice( 'iw-notice error', iwImageActionArgs.__running, false );
72
+ }
73
+
74
+ }
75
+ } );
76
+
77
+ // Media modal or edit attachment screen mode
78
+ $( document ).on( 'click', '#image_watermark_buttons a.iw-watermark-action', function ( e ) {
79
+ // Get the selected bulk action
80
+ action = $( this ).attr( 'data-action' );
81
+ id = $( this ).attr( 'data-id' );
82
+
83
+ // Validate action
84
+ if ( 'applywatermark' == action || 'removewatermark' == action && !isNaN( id ) ) {
85
+ // Stop default
86
+ e.preventDefault();
87
+
88
+ // store current action
89
+ watermarkImageActions.action = action;
90
+
91
+ // Is this script running?
92
+ if ( false === watermarkImageActions.running ) {
93
+ // No! set it on running
94
+ watermarkImageActions.running = true;
95
+
96
+ // store current action
97
+ watermarkImageActions.action = action;
98
+
99
+ // store current location where the action was fired
100
+ if ( $( this ).parents( '.media-modal ' ).length ) {
101
+ watermarkImageActions.action_location = 'media-modal';
102
+ } else {
103
+ watermarkImageActions.action_location = 'edit';
104
+ }
105
+
106
+ // store attachment id
107
+ watermarkImageActions.selected.push( id );
108
+
109
+ // remove current notices
110
+ $( '.iw-notice' ).slideUp( 'fast', function () {
111
+ $( this ).remove();
112
+ } );
113
+
114
+ // begin the update!
115
+ watermarkImageActions.post_loop();
116
+ } else {
117
+ // script is running, can't run two at the same time
118
+ watermarkImageActions.notice( 'iw-notice error', iwMediaModal.__running, false );
119
+ }
120
+ }
121
+ } );
122
+
123
+ // Since these are added later we'll need to enable dismissing again
124
+ $( document ).on( 'click', '.iw-notice.is-dismissible .notice-dismiss', function () {
125
+ $( this ).parents( '.iw-notice' ).slideUp( 'fast', function () {
126
+ $( this ).remove();
127
+ } );
128
+ } );
129
+
130
+ },
131
+ post_loop: function () {
132
+ // do we have selected attachments?
133
+ if ( watermarkImageActions.selected.length ) {
134
+
135
+ // take the first id
136
+ id = watermarkImageActions.selected[ 0 ];
137
+
138
+ // check for a valid ID (needs to be numeric)
139
+ if ( !isNaN( id ) ) {
140
+
141
+ // Show loading icon
142
+ watermarkImageActions.row_image_feedback( 'loading', id );
143
+
144
+ // post data
145
+ data = {
146
+ '_iw_nonce': iwImageActionArgs._nonce,
147
+ 'action': 'iw_watermark_bulk_action',
148
+ 'iw-action': watermarkImageActions.action,
149
+ 'attachment_id': id
150
+ };
151
+
152
+ if ( watermarkImageActions.action_location == 'upload-list' ) {
153
+ watermarkImageActions.scroll_to( '#post-' + id, 'bottom' );
154
+ }
155
+
156
+ // the ajax post!
157
+ $.post( ajaxurl, data, function ( response ) {
158
+ // show result
159
+ watermarkImageActions.result( response, id );
160
+ // remove this ID/key from the selected attachments
161
+ watermarkImageActions.selected.splice( 0, 1 );
162
+ // Redo this function
163
+ watermarkImageActions.post_loop();
164
+
165
+ $( '.iw-overlay' ).first().each( function () {
166
+ $( this ).fadeOut( 'fast', function () {
167
+ $( this ).remove();
168
+
169
+ if ( response.data === 'watermarked' ) {
170
+ $( '#image_watermark_buttons .value' ).append( '<span class="dashicons dashicons-yes" style="font-size: 24px;float: none;min-width: 28px;padding: 0;margin: 0; display: none;"></span>' );
171
+ $( '#image_watermark_buttons .value .dashicons' ).fadeIn( 'fast' );
172
+ } else if ( response.data === 'watermarkremoved' ) {
173
+ $( '#image_watermark_buttons .value' ).append( '<span class="dashicons dashicons-yes" style="font-size: 24px;float: none;min-width: 28px;padding: 0;margin: 0; display: none;"></span>' );
174
+ $( '#image_watermark_buttons .value .dashicons' ).fadeIn( 'fast' );
175
+ }
176
+
177
+ $( '#image_watermark_buttons .value .dashicons' ).delay( 1500 ).fadeOut( 'fast', function () {
178
+ $( this ).remove();
179
+ } );
180
+ } );
181
+ } );
182
+ } );
183
+
184
+ } else {
185
+ // ID is not valid so remove this key from the selected attachments
186
+ watermarkImageActions.selected.splice( 0, 1 );
187
+ // Redo this function
188
+ watermarkImageActions.post_loop();
189
+ }
190
+ } else {
191
+ // All is done, reset this "class"
192
+ watermarkImageActions.reset();
193
+ }
194
+ },
195
+ result: function ( response, id ) {
196
+
197
+ // Was the ajax post successful?
198
+ if ( true === response.success ) {
199
+
200
+ // defaults
201
+ var type = false;
202
+ var message = '';
203
+ var overwrite = true;
204
+ // store response data
205
+ watermarkImageActions.response = response.data;
206
+
207
+ // Check what kind of action is done (watermarked, watermarkremoved or skipped)
208
+ switch ( response.data ) {
209
+ case 'watermarked':
210
+ // The css classes for the notice
211
+ type = 'iw-notice updated iw-watermarked';
212
+ // another successful update
213
+ watermarkImageActions.successCount += 1;
214
+ // did we have more success updates?
215
+ if ( 1 < watermarkImageActions.successCount ) {
216
+ //yes
217
+ message = iwImageActionArgs.__applied_multi.replace( '%s', watermarkImageActions.successCount );
218
+ } else {
219
+ //no
220
+ message = iwImageActionArgs.__applied_one;
221
+ }
222
+ // update the row feedback
223
+ watermarkImageActions.row_image_feedback( 'success', id );
224
+ // reload the image
225
+ watermarkImageActions.reload_image( id );
226
+ break;
227
+ case 'watermarkremoved':
228
+ // The css classes for the notice
229
+ type = 'iw-notice updated iw-watermarkremoved';
230
+ // another successful update
231
+ watermarkImageActions.successCount += 1;
232
+ // did we have more success updates?
233
+ if ( 1 < watermarkImageActions.successCount ) {
234
+ //yes
235
+ message = iwImageActionArgs.__removed_multi.replace( '%s', watermarkImageActions.successCount );
236
+ } else {
237
+ //no
238
+ message = iwImageActionArgs.__removed_one;
239
+ }
240
+ // update the row feedback
241
+ watermarkImageActions.row_image_feedback( 'success', id );
242
+ // reload the image
243
+ watermarkImageActions.reload_image( id );
244
+ break;
245
+ case 'skipped':
246
+ // The css classes for the notice
247
+ type = 'iw-notice error iw-skipped';
248
+ // another skipped update
249
+ watermarkImageActions.skippedCount += 1;
250
+ // adjust the message with the number of skipped updates
251
+ message = iwImageActionArgs.__skipped + ': ' + watermarkImageActions.skippedCount;
252
+ // update the row feedback
253
+ watermarkImageActions.row_image_feedback( 'error', id );
254
+ break;
255
+ default:
256
+ // The css classes for the notice
257
+ type = 'iw-notice error iw-message';
258
+ // The error message
259
+ message = response.data;
260
+ // update the row feedback
261
+ watermarkImageActions.row_image_feedback( 'error', id );
262
+ // This can be anything so don't overwrite
263
+ overwrite = false;
264
+ break;
265
+ }
266
+ if ( false !== type ) {
267
+ // we have a valid terun type, show the notice! (Overwrite current notice if available)
268
+ watermarkImageActions.notice( type, message, overwrite );
269
+ }
270
+ } else {
271
+ // No success...
272
+ watermarkImageActions.notice( 'iw-notice error', response.data, false );
273
+ // update the row feedback
274
+ watermarkImageActions.row_image_feedback( 'error', id );
275
+ }
276
+
277
+ },
278
+ row_image_feedback: function ( type, id ) {
279
+ var css = { },
280
+ cssinner = { },
281
+ container_selector;
282
+
283
+ switch ( watermarkImageActions.action_location ) {
284
+ case 'upload-list':
285
+ container_selector = '.wp-list-table #post-' + id + ' .media-icon';
286
+ css = {
287
+ display: 'table',
288
+ width: $( container_selector ).width() + 'px',
289
+ height: $( container_selector ).height() + 'px',
290
+ top: '0',
291
+ left: '0',
292
+ position: 'absolute',
293
+ font: 'normal normal normal dashicons',
294
+ background: 'rgba(255,255,255,0.75)',
295
+ content: ''
296
+ };
297
+ cssinner = {
298
+ 'vertical-align': 'middle',
299
+ 'text-align': 'center',
300
+ display: 'table-cell',
301
+ width: '100%',
302
+ height: '100%',
303
+ };
304
+ break;
305
+
306
+ case 'edit':
307
+ container_selector = '.wp_attachment_holder #thumbnail-head-' + id + '';
308
+ css = {
309
+ display: 'table',
310
+ width: $( container_selector + ' img' ).width() + 'px',
311
+ height: $( container_selector + ' img' ).height() + 'px',
312
+ top: '0',
313
+ left: '0',
314
+ position: 'absolute',
315
+ font: 'normal normal normal dashicons',
316
+ background: 'rgba(255,255,255,0.75)',
317
+ content: ''
318
+ };
319
+ cssinner = {
320
+ 'vertical-align': 'middle',
321
+ 'text-align': 'center',
322
+ display: 'table-cell',
323
+ width: '100%',
324
+ height: '100%',
325
+ };
326
+ break;
327
+
328
+ case 'media-modal':
329
+ container_selector = '.media-modal #image_watermark_buttons[data-id="' + id + '"] .value';
330
+ css = {
331
+ 'float': 'none'
332
+ };
333
+ cssinner = {
334
+ 'float': 'none'
335
+ };
336
+ break;
337
+
338
+ default:
339
+ return false;
340
+ }
341
+
342
+ // css rules
343
+ $( container_selector ).css( 'position', 'relative' );
344
+
345
+ // Only create the element if it doesn't exist
346
+ if ( !$( container_selector + ' .iw-overlay' ).length ) {
347
+ $( container_selector ).append( '<span class="iw-overlay"><span class="iw-overlay-inner"></span></span>' );
348
+ }
349
+
350
+ // Overwrite with new data
351
+ $( container_selector + ' .iw-overlay' ).css( css );
352
+ $( container_selector + ' .iw-overlay .iw-overlay-inner' ).css( cssinner );
353
+ $( container_selector + ' .iw-overlay .iw-overlay-inner' ).html( '<span class="spinner is-active"></span>' );
354
+
355
+ if ( watermarkImageActions.action_location === 'media-modal' ) {
356
+ $( container_selector + ' .iw-overlay .iw-overlay-inner .spinner' ).css( { 'float': 'none', 'padding': 0, 'margin': '-4px 0 0 10px' } );
357
+ }
358
+ },
359
+ notice: function ( type, message, overwrite ) {
360
+
361
+ if ( watermarkImageActions.action_location === 'media-modal' ) {
362
+ return;
363
+ }
364
+
365
+ type += ' notice is-dismissible';
366
+
367
+ // Get the prefix based on the action location
368
+ switch ( watermarkImageActions.action_location ) {
369
+ case 'upload-list':
370
+ prefix = '.wrap > h1';
371
+ break;
372
+ default:
373
+ prefix = '#image_watermark_buttons';
374
+ break;
375
+ }
376
+
377
+ // Overwrite the current notice?
378
+ if ( true === overwrite ) {
379
+ selector = false;
380
+
381
+ // Get the selector based on the response
382
+ switch ( watermarkImageActions.response ) {
383
+ case 'watermarked':
384
+ selector = '.iw-notice.iw-watermarked';
385
+ break;
386
+ case 'watermarkremoved':
387
+ selector = '.iw-notice.iw-watermarkremoved';
388
+ break;
389
+ case 'skipped':
390
+ selector = '.iw-notice.iw-skipped';
391
+ break;
392
+ }
393
+ // Do we have a selector and can we find it? If not, just create a new notice
394
+ if ( selector && $( '.wrap ' + selector + ' > p' ).length ) {
395
+
396
+ // Get the selector based on the action location (not not forget the ending space)
397
+ switch ( watermarkImageActions.action_location ) {
398
+ case 'upload-list':
399
+ prefix = '.wrap ';
400
+ break;
401
+ default:
402
+ prefix = '#image_watermark_buttons ';
403
+ break;
404
+ }
405
+ $( prefix + selector + ' > p' ).html( message );
406
+ } else {
407
+ $( prefix ).after( '<div class="' + type + '" style="display: none;"><p>' + message + '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + iwImageActionArgs.__dismiss + '</span></button></div>' );
408
+ $( '.iw-notice' ).slideDown( 'fast' );
409
+ }
410
+ } else {
411
+ // create a new notice
412
+ $( prefix ).after( '<div class="' + type + '" style="display: none;"><p>' + message + '</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' + iwImageActionArgs.__dismiss + '</span></button></div>' );
413
+ $( '.iw-notice' ).slideDown( 'fast' );
414
+ }
415
+
416
+ },
417
+ reset: function () {
418
+ watermarkImageActions.running = false;
419
+ watermarkImageActions.action = '';
420
+ watermarkImageActions.response = '';
421
+ watermarkImageActions.selected = [ ];
422
+ watermarkImageActions.successCount = 0;
423
+ watermarkImageActions.skippedCount = 0;
424
+
425
+ // remove the overlay
426
+ setTimeout( function () {
427
+ $( '.iw-overlay' ).each( function () {
428
+ $( this ).fadeOut( 'fast', function () {
429
+ $( this ).remove();
430
+ } );
431
+ } );
432
+ }, 100 );
433
+ },
434
+ reload_image: function ( id ) {
435
+ // reload the images
436
+ time = new Date().getTime();
437
+ selector = false;
438
+ // Get the selector based on the action location
439
+ switch ( watermarkImageActions.action_location ) {
440
+ case 'upload-list':
441
+ selector = '.wp-list-table #post-' + id + ' .image-icon img';
442
+ break;
443
+ case 'media-modal':
444
+ selector = '.attachment-details[data-id="' + id + '"] img, .attachment[data-id="' + id + '"] img';
445
+ break;
446
+ case 'edit':
447
+ selector = '.wp_attachment_holder img';
448
+ break;
449
+ }
450
+
451
+ if ( selector ) {
452
+ image = $( selector );
453
+ image.each( function () {
454
+ // Remove the responsive metadata, this prevents reloading the image
455
+ $( this ).removeAttr( 'srcset' );
456
+ $( this ).removeAttr( 'sizes' );
457
+ // Reload the image (actually a browser hack by adding a time parameter to the image)
458
+ $( this ).attr( 'src', watermarkImageActions.replace_url_param( $( this ).attr( 'src' ), 't', time ) );
459
+ } );
460
+ }
461
+ },
462
+ rotate_icon: function ( icon ) {
463
+ // This function accepts selectors and objects
464
+ if ( typeof icon == 'string' ) {
465
+ icon = $( icon );
466
+ }
467
+ // Check for the length of the selected object.
468
+ if ( $( icon.selector ).length ) {
469
+ // Set rotation to 0
470
+ icon.css( {
471
+ '-webkit-transform': 'rotate(0deg)',
472
+ '-ms-transform': 'rotate(0deg)',
473
+ 'transform': 'rotate(0deg)',
474
+ 'borderSpacing': '0',
475
+ } );
476
+ // Do animation (one rotation)
477
+ icon.animate(
478
+ { borderSpacing: 360 },
479
+ {
480
+ duration: 1000,
481
+ step: function ( now, fx ) {
482
+ $( this ).css( '-webkit-transform', 'rotate(' + now + 'deg)' );
483
+ $( this ).css( '-ms-transform', 'rotate(' + now + 'deg)' );
484
+ $( this ).css( 'transform', 'rotate(' + now + 'deg)' );
485
+ if ( now == 360 ) {
486
+ // Animation finished, stop loop and restart
487
+ icon.stop();
488
+ watermarkImageActions.rotate_icon( icon );
489
+ }
490
+ },
491
+ }
492
+ );
493
+ }
494
+ },
495
+ replace_url_param: function ( url, paramName, paramValue ) {
496
+ var pattern = new RegExp( '\\b(' + paramName + '=).*?(&|$)' );
497
+ if ( url.search( pattern ) >= 0 ) {
498
+ return url.replace( pattern, '$1' + paramValue + '$2' );
499
+ }
500
+ return url + ( url.indexOf( '?' ) > 0 ? '&' : '?' ) + paramName + '=' + paramValue;
501
+ },
502
+ scroll_to: function ( elementSelector, verticalTarget ) {
503
+
504
+ var offset = $( elementSelector ).offset();
505
+ var offsetTop = offset.top;
506
+
507
+ // If the element it above the current viewport, scroll to it
508
+ if ( offset.top < $( window ).scrollTop() ) {
509
+ $( window ).scrollTop( offsetTop );
510
+ return; // No further actions needed
511
+ }
512
+
513
+ var windowTopOffset = $( window ).scrollTop();
514
+ var windowBottomOffset = windowTopOffset + $( window ).outerHeight();
515
+
516
+ switch ( verticalTarget ) {
517
+ case 'top':
518
+ offsetTop = offsetTop - $( elementSelector ).outerHeight();
519
+ break;
520
+ case 'bottom':
521
+ if ( offset.top < windowBottomOffset ) {
522
+ return; // The element is in the viewport
523
+ }
524
+ offsetTop = offsetTop - $( window ).outerHeight();
525
+ offsetTop = offsetTop + $( elementSelector ).outerHeight();
526
+ break;
527
+ case 'center':
528
+ if ( offsetTop < windowBottomOffset && offsetTop >= windowTopOffset ) {
529
+ return; // The element is in the viewport
530
+ }
531
+ offsetTop = offsetTop - ( $( window ).outerHeight() / 2 );
532
+ offsetTop = offsetTop + ( $( elementSelector ).outerHeight() / 2 );
533
+ break;
534
+ }
535
+
536
+ $( window ).scrollTop( offsetTop );
537
+ }
538
+ };
539
+
540
+ // We need that nonce!
541
+ if ( typeof iwImageActionArgs._nonce != 'undefined' ) {
542
+ watermarkImageActions.init();
543
+ }
544
+
545
+ } );
js/admin-settings.js CHANGED
@@ -1,68 +1,68 @@
1
  jQuery( document ).ready( function ( $ ) {
2
 
3
- // enable watermark for
4
- $( document ).on( 'change', '#df_option_everywhere, #df_option_cpt', function () {
5
- if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'everywhere' ) {
6
- $( '#cpt-select' ).fadeOut( 300 );
7
- } else if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'specific' ) {
8
- $( '#cpt-select' ).fadeIn( 300 );
9
- }
10
- } );
11
 
12
- $( document ).on( 'click', '#reset_image_watermark_options', function () {
13
- return confirm( iwArgs.resetToDefaults );
14
- } );
15
 
16
- // size slider
17
- $( '#iw_size_span' ).slider( {
18
- value: $( '#iw_size_input' ).val(),
19
- min: 0,
20
- max: 100,
21
- step: 1,
22
- orientation: 'horizontal',
23
- slide: function ( e, ui ) {
24
- $( '#iw_size_input' ).attr( 'value', ui.value );
25
- $( '#iw_size_span' ).attr( 'title', ui.value );
26
- }
27
- } );
28
 
29
- // opacity slider
30
- $( '#iw_opacity_span' ).slider( {
31
- value: $( '#iw_opacity_input' ).val(),
32
- min: 0,
33
- max: 100,
34
- step: 1,
35
- orientation: 'horizontal',
36
- slide: function ( e, ui ) {
37
- $( '#iw_opacity_input' ).attr( 'value', ui.value );
38
- $( '#iw_opacity_span' ).attr( 'title', ui.value );
39
- }
40
- } );
41
 
42
- // quality slider
43
- $( '#iw_quality_span' ).slider( {
44
- value: $( '#iw_quality_input' ).val(),
45
- min: 0,
46
- max: 100,
47
- step: 1,
48
- orientation: 'horizontal',
49
- slide: function ( e, ui ) {
50
- $( '#iw_quality_input' ).attr( 'value', ui.value );
51
- $( '#iw_quality_span' ).attr( 'title', ui.value );
52
- }
53
- } );
54
-
55
- // quality slider
56
- $( '#iw_backup_quality_span' ).slider( {
57
- value: $( '#iw_backup_quality_input' ).val(),
58
- min: 0,
59
- max: 100,
60
- step: 1,
61
- orientation: 'horizontal',
62
- slide: function ( e, ui ) {
63
- $( '#iw_backup_quality_input' ).attr( 'value', ui.value );
64
- $( '#iw_backup_quality_span' ).attr( 'title', ui.value );
65
- }
66
- } );
67
 
68
  } );
1
  jQuery( document ).ready( function ( $ ) {
2
 
3
+ // enable watermark for
4
+ $( document ).on( 'change', '#df_option_everywhere, #df_option_cpt', function () {
5
+ if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'everywhere' ) {
6
+ $( '#cpt-select' ).fadeOut( 300 );
7
+ } else if ( $( '#cpt-specific input[type=radio]:checked' ).val() === 'specific' ) {
8
+ $( '#cpt-select' ).fadeIn( 300 );
9
+ }
10
+ } );
11
 
12
+ $( document ).on( 'click', '#reset_image_watermark_options', function () {
13
+ return confirm( iwArgs.resetToDefaults );
14
+ } );
15
 
16
+ // size slider
17
+ $( '#iw_size_span' ).slider( {
18
+ value: $( '#iw_size_input' ).val(),
19
+ min: 0,
20
+ max: 100,
21
+ step: 1,
22
+ orientation: 'horizontal',
23
+ slide: function ( e, ui ) {
24
+ $( '#iw_size_input' ).attr( 'value', ui.value );
25
+ $( '#iw_size_span' ).attr( 'title', ui.value );
26
+ }
27
+ } );
28
 
29
+ // opacity slider
30
+ $( '#iw_opacity_span' ).slider( {
31
+ value: $( '#iw_opacity_input' ).val(),
32
+ min: 0,
33
+ max: 100,
34
+ step: 1,
35
+ orientation: 'horizontal',
36
+ slide: function ( e, ui ) {
37
+ $( '#iw_opacity_input' ).attr( 'value', ui.value );
38
+ $( '#iw_opacity_span' ).attr( 'title', ui.value );
39
+ }
40
+ } );
41
 
42
+ // quality slider
43
+ $( '#iw_quality_span' ).slider( {
44
+ value: $( '#iw_quality_input' ).val(),
45
+ min: 0,
46
+ max: 100,
47
+ step: 1,
48
+ orientation: 'horizontal',
49
+ slide: function ( e, ui ) {
50
+ $( '#iw_quality_input' ).attr( 'value', ui.value );
51
+ $( '#iw_quality_span' ).attr( 'title', ui.value );
52
+ }
53
+ } );
54
+
55
+ // quality slider
56
+ $( '#iw_backup_quality_span' ).slider( {
57
+ value: $( '#iw_backup_quality_input' ).val(),
58
+ min: 0,
59
+ max: 100,
60
+ step: 1,
61
+ orientation: 'horizontal',
62
+ slide: function ( e, ui ) {
63
+ $( '#iw_backup_quality_input' ).attr( 'value', ui.value );
64
+ $( '#iw_backup_quality_span' ).attr( 'title', ui.value );
65
+ }
66
+ } );
67
 
68
  } );
js/admin-upload.js CHANGED
@@ -1,70 +1,70 @@
1
  jQuery( document ).ready( function ( $ ) {
2
-
3
- watermarkFileUpload = {
4
- frame: function () {
5
- if ( this._frameWatermark )
6
- return this._frameWatermark;
7
 
8
- this._frameWatermark = wp.media( {
9
- title: iwUploadArgs.title,
10
- frame: iwUploadArgs.frame,
11
- button: iwUploadArgs.button,
12
- multiple: iwUploadArgs.multiple,
13
- library: {
14
- type: 'image'
15
- }
16
- } );
17
 
18
- this._frameWatermark.on( 'open', this.updateFrame ).state( 'library' ).on( 'select', this.select );
19
- return this._frameWatermark;
20
- },
21
- select: function () {
22
- var attachment = this.frame.state().get( 'selection' ).first();
 
 
 
 
 
 
 
 
 
 
23
 
24
- if ( jQuery.inArray( attachment.attributes.mime, ['image/gif', 'image/jpg', 'image/jpeg', 'image/png'] ) !== -1 ) {
25
-
26
- $( '#iw_upload_image' ).val( attachment.attributes.id );
27
 
28
- if ( $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src' ) !== '' ) {
29
- $( 'div#previewImg_imageDiv img#previewImg_image' ).replaceWith( '<img id="previewImg_image" src="' + attachment.attributes.url + '" alt="" width="300" />' );
30
- } else {
31
- $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', attachment.attributes.url );
32
- }
 
 
33
 
34
- $( '#iw_turn_off_image_button' ).removeAttr( 'disabled' );
35
- $( 'div#previewImg_imageDiv img#previewImg_image' ).show();
36
 
37
- var img = new Image();
38
- img.src = attachment.attributes.url;
39
 
40
- img.onload = function () {
41
- $( 'p#previewImageInfo' ).html( iwUploadArgs.originalSize + ': ' + this.width + ' ' + iwUploadArgs.px + ' / ' + this.height + ' ' + iwUploadArgs.px );
42
- }
43
-
44
- } else {
45
-
46
- $( '#iw_turn_off_image_button' ).attr( 'disabled', 'true' );
47
- $( '#iw_upload_image' ).val( 0 );
48
- $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', '' ).hide();
49
- $( 'p#previewImageInfo' ).html( '<strong>' + iwUploadArgs.notAllowedImg + '</strong>' );
50
-
51
- }
52
- },
53
- init: function () {
54
- $( '#wpbody' ).on( 'click', 'input#iw_upload_image_button', function ( e ) {
55
- e.preventDefault();
56
- watermarkFileUpload.frame().open();
57
- } );
58
  }
59
- };
60
 
61
- watermarkFileUpload.init();
62
 
63
- $( document ).on( 'click', '#iw_turn_off_image_button', function ( event ) {
64
- $( this ).attr( 'disabled', 'true' );
65
  $( '#iw_upload_image' ).val( 0 );
66
  $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', '' ).hide();
67
- $( 'p#previewImageInfo' ).html( iwUploadArgs.noSelectedImg );
68
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  } );
1
  jQuery( document ).ready( function ( $ ) {
 
 
 
 
 
2
 
3
+ watermarkFileUpload = {
4
+ frame: function () {
5
+ if ( this._frameWatermark )
6
+ return this._frameWatermark;
 
 
 
 
 
7
 
8
+ this._frameWatermark = wp.media( {
9
+ title: iwUploadArgs.title,
10
+ frame: iwUploadArgs.frame,
11
+ button: iwUploadArgs.button,
12
+ multiple: iwUploadArgs.multiple,
13
+ library: {
14
+ type: 'image'
15
+ }
16
+ } );
17
+
18
+ this._frameWatermark.on( 'open', this.updateFrame ).state( 'library' ).on( 'select', this.select );
19
+ return this._frameWatermark;
20
+ },
21
+ select: function () {
22
+ var attachment = this.frame.state().get( 'selection' ).first();
23
 
24
+ if ( $.inArray( attachment.attributes.mime, [ 'image/gif', 'image/jpg', 'image/jpeg', 'image/png' ] ) !== -1 ) {
 
 
25
 
26
+ $( '#iw_upload_image' ).val( attachment.attributes.id );
27
+
28
+ if ( $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src' ) !== '' ) {
29
+ $( 'div#previewImg_imageDiv img#previewImg_image' ).replaceWith( '<img id="previewImg_image" src="' + attachment.attributes.url + '" alt="" width="300" />' );
30
+ } else {
31
+ $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', attachment.attributes.url );
32
+ }
33
 
34
+ $( '#iw_turn_off_image_button' ).removeAttr( 'disabled' );
35
+ $( 'div#previewImg_imageDiv img#previewImg_image' ).show();
36
 
37
+ var img = new Image();
38
+ img.src = attachment.attributes.url;
39
 
40
+ img.onload = function () {
41
+ $( 'p#previewImageInfo' ).html( iwUploadArgs.originalSize + ': ' + this.width + ' ' + iwUploadArgs.px + ' / ' + this.height + ' ' + iwUploadArgs.px );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
 
43
 
44
+ } else {
45
 
46
+ $( '#iw_turn_off_image_button' ).attr( 'disabled', 'true' );
 
47
  $( '#iw_upload_image' ).val( 0 );
48
  $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', '' ).hide();
49
+ $( 'p#previewImageInfo' ).html( '<strong>' + iwUploadArgs.notAllowedImg + '</strong>' );
50
+
51
+ }
52
+ },
53
+ init: function () {
54
+ $( '#wpbody' ).on( 'click', 'input#iw_upload_image_button', function ( e ) {
55
+ e.preventDefault();
56
+ watermarkFileUpload.frame().open();
57
+ } );
58
+ }
59
+ };
60
+
61
+ watermarkFileUpload.init();
62
+
63
+ $( document ).on( 'click', '#iw_turn_off_image_button', function ( event ) {
64
+ $( this ).attr( 'disabled', 'true' );
65
+ $( '#iw_upload_image' ).val( 0 );
66
+ $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', '' ).hide();
67
+ $( 'p#previewImageInfo' ).html( iwUploadArgs.noSelectedImg );
68
+ } );
69
 
70
  } );
js/no-right-click.js CHANGED
@@ -5,253 +5,253 @@
5
  http://www.blogseye.com
6
  */
7
 
8
- var df_nrc_targImg = null;
9
- var df_nrc_targSrc = null;
10
- var df_nrc_inContext = false;
11
- var df_nrc_notimage = new Image();
12
- var df_nrc_limit = 0;
13
- var df_nrc_extra = norightclick_args.rightclick;
14
- var df_nrc_drag = norightclick_args.draganddrop;
15
 
16
- function df_nrc_dragdropAll( event ) {
17
- try {
18
- var ev = event || window.event;
19
- var targ = ev.srcElement || ev.target;
20
- if ( targ.tagName.toUpperCase() == "A" ) {
21
- // is this IE and are we dragging a link to the image?
22
- var hr = targ.href;
23
- hr = hr.toUpperCase();
24
- if ( hr.indexOf( '.JPG' ) || hr.indexOf( '.PNG' ) || hr.indexOf( '.GIF' ) ) {
25
- ev.returnValue = false;
26
- if ( ev.preventDefault ) {
27
- ev.preventDefault();
28
- }
29
- df_nrc_inContext = false;
30
- return false;
31
- }
32
- }
33
- if ( targ.tagName.toUpperCase() != "IMG" )
34
- return true;
35
  ev.returnValue = false;
36
  if ( ev.preventDefault ) {
37
- ev.preventDefault();
38
  }
39
- df_nrc_inContext = false;
40
  return false;
41
- } catch ( er ) {
42
- // alert(er);
43
  }
44
- return true;
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
 
47
- function df_nrc_dragdrop( event ) {
48
- // I am beginning to doubt if this event ever fires
49
- try {
50
- var ev = event || window.event;
51
- var targ = ev.srcElement || ev.target;
52
- ev.returnValue = false;
53
- if ( ev.preventDefault ) {
54
- ev.preventDefault();
55
- }
56
- ev.returnValue = false;
57
- df_nrc_inContext = false;
58
- return false;
59
- } catch ( er ) {
60
- // alert(er);
61
  }
62
- return true;
 
 
 
 
 
 
63
  }
64
 
65
- function df_nrc_context( event ) {
66
- try {
67
- df_nrc_inContext = true;
68
- var ev = event || window.event;
69
- var targ = ev.srcElement || ev.target;
70
- df_nrc_replace( targ );
71
- ev.returnValue = false;
72
- if ( ev.preventDefault ) {
73
- ev.preventDefault();
74
- }
75
- ev.returnValue = false;
76
- df_nrc_targImg = targ;
77
- } catch ( er ) {
78
- // alert(er);
79
  }
80
- return false;
 
 
 
 
 
81
  }
82
 
83
- function df_nrc_contextAll( event ) {
84
- try {
85
- if ( df_nrc_targImg == null ) {
86
- return true;
87
- }
88
- df_nrc_inContext = true;
89
- var ev = event || window.event;
90
- var targ = ev.srcElement || ev.target;
91
- if ( targ.tagName.toUpperCase() == "IMG" ) {
92
- ev.returnValue = false;
93
- if ( ev.preventDefault ) {
94
- ev.preventDefault();
95
- }
96
- ev.returnValue = false;
97
- df_nrc_replace( targ );
98
- return false;
99
- }
100
- return true;
101
- } catch ( er ) {
102
- // alert(er);
103
  }
104
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
- function kpg_nrc1_mousedown( event ) {
108
- try {
109
- df_nrc_inContext = false;
110
- var ev = event || window.event;
111
- var targ = ev.srcElement || ev.target;
112
- if ( ev.button == 2 ) {
113
- df_nrc_replace( targ );
114
- return false;
115
- }
116
- df_nrc_targImg = targ;
117
- if ( df_nrc_drag == 'Y' ) {
118
- if ( ev.preventDefault ) {
119
- ev.preventDefault();
120
- }
121
- }
122
- return true;
123
- } catch ( er ) {
124
- // alert(er);
125
  }
126
  return true;
 
 
 
 
127
  }
128
 
129
- function kpg_nrc1_mousedownAll( event ) {
130
- try {
131
- df_nrc_inContext = false;
132
- var ev = event || window.event;
133
- var targ = ev.srcElement || ev.target;
134
- if ( targ.style.backgroundImage != '' && ev.button == 2 ) {
135
- targ.oncontextmenu = function ( event ) {
136
- return false;
137
- } // iffy - might not work
138
- }
139
- if ( targ.tagName.toUpperCase() == "IMG" ) {
140
- if ( ev.button == 2 ) {
141
- df_nrc_replace( targ );
142
- return false;
143
- }
144
- if ( df_nrc_drag == 'Y' ) {
145
- if ( ev.preventDefault ) {
146
- ev.preventDefault();
147
- }
148
- }
149
- df_nrc_targImg = targ;
150
  }
151
- return true;
152
- } catch ( er ) {
153
- // alert(er);
154
  }
155
  return true;
 
 
 
 
156
  }
157
 
158
- function df_nrc_replace( targ ) {
159
- return false;
160
- if ( df_nrc_targImg != null && df_nrc_targImg.src == df_nrc_notimage.src ) {
161
- // restore the old image before hiding this one
162
- df_nrc_targImg.src = df_nrc_targSrc;
163
- df_nrc_targImg = null;
164
- df_nrc_targSrc = null;
165
- }
166
- df_nrc_targImg = targ;
167
- if ( df_nrc_extra != 'Y' )
168
- return;
169
- var w = targ.width + '';
170
- var h = targ.height + '';
171
- if ( w.indexOf( 'px' ) <= 0 )
172
- w = w + 'px';
173
- if ( h.indexOf( 'px' ) <= 0 )
174
- h = h + 'px';
175
- df_nrc_targSrc = targ.src;
176
- targ.src = df_nrc_notimage.src;
177
- targ.style.width = w;
178
- targ.style.height = h;
179
- df_nrc_limit = 0;
180
- var t = setTimeout( "df_nrc_restore()", 500 );
181
- return false;
182
  }
183
 
184
- function df_nrc_restore() {
185
- if ( df_nrc_inContext ) {
186
- if ( df_nrc_limit <= 20 ) {
187
- df_nrc_limit++;
188
- var t = setTimeout( "df_nrc_restore()", 500 );
189
- return;
190
- }
191
  }
192
- df_nrc_limit = 0;
193
- if ( df_nrc_targImg == null )
194
- return;
195
- if ( df_nrc_targSrc == null )
196
- return;
197
- df_nrc_targImg.src = df_nrc_targSrc;
198
- df_nrc_targImg = null;
199
- df_nrc_targSrc = null;
200
  return;
 
 
 
 
 
 
201
  }
202
 
203
  // set the image onclick event
204
  // need to check for dblclick to see if there is a right double click in IE
205
- function df_nrc_action( event ) {
206
- try {
207
- document.onmousedown = function ( event ) {
208
- return kpg_nrc1_mousedownAll( event );
209
- }
210
- document.oncontextmenu = function ( event ) {
211
- return df_nrc_contextAll( event );
212
- }
213
- document.oncopy = function ( event ) {
214
- return df_nrc_contextAll( event );
215
- }
216
- if ( df_nrc_drag == 'Y' )
217
- document.ondragstart = function ( event ) {
218
- return df_nrc_dragdropAll( event );
219
- }
220
- var b = document.getElementsByTagName( "IMG" );
221
- for ( var i = 0; i < b.length; i++ ) {
222
- b[i].oncontextmenu = function ( event ) {
223
- return df_nrc_context( event );
224
- }
225
- b[i].oncopy = function ( event ) {
226
- return df_nrc_context( event );
227
- }
228
- b[i].onmousedown = function ( event ) {
229
- return kpg_nrc1_mousedown( event );
230
- }
231
- if ( df_nrc_drag == 'Y' )
232
- b[i].ondragstart = function ( event ) {
233
- return df_nrc_dragdrop( event );
234
- }
235
  }
236
- } catch ( er ) {
237
- return false;
238
  }
 
 
 
239
  }
240
 
241
  if ( document.addEventListener ) {
242
- document.addEventListener( "DOMContentLoaded", function ( event ) {
243
- df_nrc_action( event );
244
- }, false );
245
  } else if ( window.attachEvent ) {
246
- window.attachEvent( "onload", function ( event ) {
247
- df_nrc_action( event );
248
- } );
249
  } else {
250
- var oldFunc = window.onload;
251
- window.onload = function () {
252
- if ( oldFunc ) {
253
- oldFunc();
254
- }
255
- df_nrc_action( 'load' );
256
- };
257
  }
5
  http://www.blogseye.com
6
  */
7
 
8
+ var IwNRCtargImg = null;
9
+ var IwNRCtargSrc = null;
10
+ var IwNRCinContext = false;
11
+ var IwNRCnotimage = new Image();
12
+ var IwNRClimit = 0;
13
+ var IwNRCextra = IwNRCargs.rightclick;
14
+ var IwNRCdrag = IwNRCargs.draganddrop;
15
 
16
+ function IwNRCdragdropAll( event ) {
17
+ try {
18
+ var ev = event || window.event;
19
+ var targ = ev.srcElement || ev.target;
20
+ if ( targ.tagName.toUpperCase() == "A" ) {
21
+ // is this IE and are we dragging a link to the image?
22
+ var hr = targ.href;
23
+ hr = hr.toUpperCase();
24
+ if ( hr.indexOf( '.JPG' ) || hr.indexOf( '.PNG' ) || hr.indexOf( '.GIF' ) ) {
 
 
 
 
 
 
 
 
 
 
25
  ev.returnValue = false;
26
  if ( ev.preventDefault ) {
27
+ ev.preventDefault();
28
  }
29
+ IwNRCinContext = false;
30
  return false;
31
+ }
 
32
  }
33
+ if ( targ.tagName.toUpperCase() != "IMG" )
34
+ return true;
35
+ ev.returnValue = false;
36
+ if ( ev.preventDefault ) {
37
+ ev.preventDefault();
38
+ }
39
+ IwNRCinContext = false;
40
+ return false;
41
+ } catch ( er ) {
42
+ // alert(er);
43
+ }
44
+ return true;
45
  }
46
 
47
+ function IwNRCdragdrop( event ) {
48
+ // I am beginning to doubt if this event ever fires
49
+ try {
50
+ var ev = event || window.event;
51
+ var targ = ev.srcElement || ev.target;
52
+ ev.returnValue = false;
53
+ if ( ev.preventDefault ) {
54
+ ev.preventDefault();
 
 
 
 
 
 
55
  }
56
+ ev.returnValue = false;
57
+ IwNRCinContext = false;
58
+ return false;
59
+ } catch ( er ) {
60
+ // alert(er);
61
+ }
62
+ return true;
63
  }
64
 
65
+ function IwNRCcontext( event ) {
66
+ try {
67
+ IwNRCinContext = true;
68
+ var ev = event || window.event;
69
+ var targ = ev.srcElement || ev.target;
70
+ IwNRCreplace( targ );
71
+ ev.returnValue = false;
72
+ if ( ev.preventDefault ) {
73
+ ev.preventDefault();
 
 
 
 
 
74
  }
75
+ ev.returnValue = false;
76
+ IwNRCtargImg = targ;
77
+ } catch ( er ) {
78
+ // alert(er);
79
+ }
80
+ return false;
81
  }
82
 
83
+ function IwNRCcontextAll( event ) {
84
+ try {
85
+ if ( IwNRCtargImg == null ) {
86
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
+ IwNRCinContext = true;
89
+ var ev = event || window.event;
90
+ var targ = ev.srcElement || ev.target;
91
+ if ( targ.tagName.toUpperCase() == "IMG" ) {
92
+ ev.returnValue = false;
93
+ if ( ev.preventDefault ) {
94
+ ev.preventDefault();
95
+ }
96
+ ev.returnValue = false;
97
+ IwNRCreplace( targ );
98
+ return false;
99
+ }
100
+ return true;
101
+ } catch ( er ) {
102
+ // alert(er);
103
+ }
104
+ return false;
105
  }
106
 
107
+ function IwNRCmousedown( event ) {
108
+ try {
109
+ IwNRCinContext = false;
110
+ var ev = event || window.event;
111
+ var targ = ev.srcElement || ev.target;
112
+ if ( ev.button == 2 ) {
113
+ IwNRCreplace( targ );
114
+ return false;
115
+ }
116
+ IwNRCtargImg = targ;
117
+ if ( IwNRCdrag == 'Y' ) {
118
+ if ( ev.preventDefault ) {
119
+ ev.preventDefault();
120
+ }
 
 
 
 
121
  }
122
  return true;
123
+ } catch ( er ) {
124
+ // alert(er);
125
+ }
126
+ return true;
127
  }
128
 
129
+ function IwNRCmousedownAll( event ) {
130
+ try {
131
+ IwNRCinContext = false;
132
+ var ev = event || window.event;
133
+ var targ = ev.srcElement || ev.target;
134
+ if ( targ.style.backgroundImage != '' && ev.button == 2 ) {
135
+ targ.oncontextmenu = function ( event ) {
136
+ return false;
137
+ } // iffy - might not work
138
+ }
139
+ if ( targ.tagName.toUpperCase() == "IMG" ) {
140
+ if ( ev.button == 2 ) {
141
+ IwNRCreplace( targ );
142
+ return false;
143
+ }
144
+ if ( IwNRCdrag == 'Y' ) {
145
+ if ( ev.preventDefault ) {
146
+ ev.preventDefault();
 
 
 
147
  }
148
+ }
149
+ IwNRCtargImg = targ;
 
150
  }
151
  return true;
152
+ } catch ( er ) {
153
+ // alert(er);
154
+ }
155
+ return true;
156
  }
157
 
158
+ function IwNRCreplace( targ ) {
159
+ return false;
160
+ if ( IwNRCtargImg != null && IwNRCtargImg.src == IwNRCnotimage.src ) {
161
+ // restore the old image before hiding this one
162
+ IwNRCtargImg.src = IwNRCtargSrc;
163
+ IwNRCtargImg = null;
164
+ IwNRCtargSrc = null;
165
+ }
166
+ IwNRCtargImg = targ;
167
+ if ( IwNRCextra != 'Y' )
168
+ return;
169
+ var w = targ.width + '';
170
+ var h = targ.height + '';
171
+ if ( w.indexOf( 'px' ) <= 0 )
172
+ w = w + 'px';
173
+ if ( h.indexOf( 'px' ) <= 0 )
174
+ h = h + 'px';
175
+ IwNRCtargSrc = targ.src;
176
+ targ.src = IwNRCnotimage.src;
177
+ targ.style.width = w;
178
+ targ.style.height = h;
179
+ IwNRClimit = 0;
180
+ var t = setTimeout( "IwNRCrestore()", 500 );
181
+ return false;
182
  }
183
 
184
+ function IwNRCrestore() {
185
+ if ( IwNRCinContext ) {
186
+ if ( IwNRClimit <= 20 ) {
187
+ IwNRClimit++;
188
+ var t = setTimeout( "IwNRCrestore()", 500 );
189
+ return;
 
190
  }
191
+ }
192
+ IwNRClimit = 0;
193
+ if ( IwNRCtargImg == null )
 
 
 
 
 
194
  return;
195
+ if ( IwNRCtargSrc == null )
196
+ return;
197
+ IwNRCtargImg.src = IwNRCtargSrc;
198
+ IwNRCtargImg = null;
199
+ IwNRCtargSrc = null;
200
+ return;
201
  }
202
 
203
  // set the image onclick event
204
  // need to check for dblclick to see if there is a right double click in IE
205
+ function IwNRCaction( event ) {
206
+ try {
207
+ document.onmousedown = function ( event ) {
208
+ return IwNRCmousedownAll( event );
209
+ }
210
+ document.oncontextmenu = function ( event ) {
211
+ return IwNRCcontextAll( event );
212
+ }
213
+ document.oncopy = function ( event ) {
214
+ return IwNRCcontextAll( event );
215
+ }
216
+ if ( IwNRCdrag == 'Y' )
217
+ document.ondragstart = function ( event ) {
218
+ return IwNRCdragdropAll( event );
219
+ }
220
+ var b = document.getElementsByTagName( "IMG" );
221
+ for ( var i = 0; i < b.length; i++ ) {
222
+ b[i].oncontextmenu = function ( event ) {
223
+ return IwNRCcontext( event );
224
+ }
225
+ b[i].oncopy = function ( event ) {
226
+ return IwNRCcontext( event );
227
+ }
228
+ b[i].onmousedown = function ( event ) {
229
+ return IwNRCmousedown( event );
230
+ }
231
+ if ( IwNRCdrag == 'Y' )
232
+ b[i].ondragstart = function ( event ) {
233
+ return IwNRCdragdrop( event );
 
234
  }
 
 
235
  }
236
+ } catch ( er ) {
237
+ return false;
238
+ }
239
  }
240
 
241
  if ( document.addEventListener ) {
242
+ document.addEventListener( "DOMContentLoaded", function ( event ) {
243
+ IwNRCaction( event );
244
+ }, false );
245
  } else if ( window.attachEvent ) {
246
+ window.attachEvent( "onload", function ( event ) {
247
+ IwNRCaction( event );
248
+ } );
249
  } else {
250
+ var oldFunc = window.onload;
251
+ window.onload = function () {
252
+ if ( oldFunc ) {
253
+ oldFunc();
254
+ }
255
+ IwNRCaction( 'load' );
256
+ };
257
  }
languages/image-watermark-ar.mo DELETED
Binary file
languages/image-watermark-ar.pot DELETED
@@ -1,360 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress Watermark\n"
4
- "POT-Creation-Date: 2013-06-11 13:16+0100\n"
5
- "PO-Revision-Date: 2013-08-13 08:17+0300\n"
6
- "Last-Translator: Hassan\n"
7
- "Language-Team: dFactory <info@dfactory.pl>\n"
8
- "Language: English\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.7\n"
13
- "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
- "_n:1,2\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
- "X-Poedit-SearchPath-0: ..\n"
19
-
20
- #: ../image-watermark.php:27
21
- msgid ""
22
- "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher."
23
- msgstr "عفوا، هذه الإضافة تتطلب على الأقل PHP 5.0 وووردبريس 3.5 أو أعلى."
24
-
25
- #: ../image-watermark.php:164
26
- msgid ""
27
- "Watermark could not be applied to selected files or no valid images (JPEG, "
28
- "PNG) were selected."
29
- msgstr ""
30
- "تعذر تطبيق العلامة المائية على الملفات المختارة أو لم يتم إختيار ملفات صحيحة "
31
- "(JPEG, PNG)"
32
-
33
- #: ../image-watermark.php:164 ../image-watermark.php:168
34
- msgid "Skipped files"
35
- msgstr "الملفات المتخطاة"
36
-
37
- #: ../image-watermark.php:168
38
- #, php-format
39
- msgid "Watermark was succesfully applied to 1 image."
40
- msgid_plural "Watermark was succesfully applied to %s images."
41
- msgstr[0] "تم تطبيق العلامة المائية بنجاح على صورة واحدة."
42
- msgstr[1] "تم تطبيق العلامة المائية بنجاح على %s صور."
43
-
44
- #: ../image-watermark.php:234
45
- msgid "Support"
46
- msgstr "دعم"
47
-
48
- #: ../image-watermark.php:256
49
- msgid "Settings"
50
- msgstr "إعدادات"
51
-
52
- #: ../image-watermark.php:287
53
- msgid "Apply watermark"
54
- msgstr "تطبيق العلامة المائية"
55
-
56
- #: ../image-watermark.php:311
57
- msgid "Select watermark"
58
- msgstr "اختر علامة مائية"
59
-
60
- #: ../image-watermark.php:312 ../image-watermark.php:707
61
- msgid "Original size"
62
- msgstr "الحجم الأصلي"
63
-
64
- #: ../image-watermark.php:313 ../image-watermark.php:701
65
- msgid "Watermak has not been selected yet."
66
- msgstr "لم يتم اختيار العلامة المائية بعد."
67
-
68
- #: ../image-watermark.php:314
69
- msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
70
- msgstr "هذه الصورة غير مدعومة كعلامة مائية. استخدم JPEG, PNG or GIF."
71
-
72
- #: ../image-watermark.php:316
73
- msgid "Add watermark"
74
- msgstr "أضف علامة مائية"
75
-
76
- #: ../image-watermark.php:361
77
- msgid "Image Watermark Options"
78
- msgstr "خيارات العلامة المائية المصورة"
79
-
80
- #: ../image-watermark.php:362
81
- msgid "Watermark"
82
- msgstr "العلامة المائية"
83
-
84
- #: ../image-watermark.php:388
85
- msgid "Image Watermark will not work properly without GD PHP extension."
86
- msgstr "الإضافة لن تعمل بصورة صحيحة بدون ملحق GD PHP."
87
-
88
- #: ../image-watermark.php:525
89
- msgid "Settings saved."
90
- msgstr "تم حفظ الإعدادات."
91
-
92
- #: ../image-watermark.php:546
93
- msgid "Watermark will not be applied when <b>watermark image is not set</b>."
94
- msgstr ""
95
- "لن يتم تطبيق العلامة المائية عندما تكون <b>العلامة المائية غير محددة</b>."
96
-
97
- #: ../image-watermark.php:551
98
- msgid "Watermark will not be applied when <b>no image sizes are selected</b>."
99
- msgstr "لن يتم تطبيق العلامة المائية عندما لا تكون <b>أحجام الصور محددة</b>."
100
-
101
- #: ../image-watermark.php:559
102
- msgid "Image Watermark Settings"
103
- msgstr "إعدادات العلامة المائية المصورة"
104
-
105
- #: ../image-watermark.php:563
106
- msgid "General settings"
107
- msgstr "إعدادات عامة"
108
-
109
- #: ../image-watermark.php:566
110
- msgid "Automatic watermarking"
111
- msgstr "تطبيق آلي للعلامة المائية"
112
-
113
- #: ../image-watermark.php:570 ../image-watermark.php:586
114
- msgid "on"
115
- msgstr "تشغيل"
116
-
117
- #: ../image-watermark.php:572 ../image-watermark.php:588
118
- msgid "off"
119
- msgstr "إيقاف"
120
-
121
- #: ../image-watermark.php:575
122
- msgid "Enable or disable watermark for uploaded images."
123
- msgstr "تفعيل أو تعطيل العلامة المائية للصور المرفوعة."
124
-
125
- #: ../image-watermark.php:582
126
- msgid "Manual watermarking"
127
- msgstr "تطبيق يدوي للعلامة المائية"
128
-
129
- #: ../image-watermark.php:591
130
- msgid "Enable or disable Apply Watermark option for images in Media Library."
131
- msgstr "تفعيل أو تعطيل خيار تطبيق العلامة المائية للصور في مكتبة الوسائط."
132
-
133
- #: ../image-watermark.php:598
134
- msgid "Enable watermark for"
135
- msgstr "تفعيل العلامة المائية لـ"
136
-
137
- #: ../image-watermark.php:607
138
- msgid ""
139
- "Check image sizes on which watermark should appear. <b>Notice:</b> checking "
140
- "full size is not recommened as it's the original image."
141
- msgstr ""
142
- "اختر أحجام الصور التي يجب أن تظهر فيها العلامة المائية. <b>تنبيه:</b> اختيار "
143
- "الحجم الكامل (full size) غير موصى به لأنها الصورة الأصلية."
144
-
145
- #: ../image-watermark.php:613
146
- msgid "everywhere"
147
- msgstr "في أي مكان"
148
-
149
- #: ../image-watermark.php:614
150
- msgid "on selected post types only"
151
- msgstr "في أنواع التدوينات المختارة فقط"
152
-
153
- #: ../image-watermark.php:622
154
- msgid ""
155
- "Check custom post types on which watermark should be applied to uploaded "
156
- "images."
157
- msgstr ""
158
- "اختر أنواع التدوينات التي يجب أن يتم تطبيق العلامة المائية على الصور "
159
- "المرفوعة فيها."
160
-
161
- #: ../image-watermark.php:628
162
- msgid "Watermark position"
163
- msgstr "موضع العلامة المائية"
164
-
165
- #: ../image-watermark.php:631
166
- msgid "Watermark alignment"
167
- msgstr "محاذاة العلامة المائية"
168
-
169
- #: ../image-watermark.php:646
170
- msgid "Choose the position of watermark image."
171
- msgstr "اختر موضع العلامة المائية المصورة."
172
-
173
- #: ../image-watermark.php:651
174
- msgid "Watermark offset"
175
- msgstr "تكفاؤ العلامة المائية"
176
-
177
- #: ../image-watermark.php:654 ../image-watermark.php:734
178
- msgid "x:"
179
- msgstr "س:"
180
-
181
- #: ../image-watermark.php:654 ../image-watermark.php:656
182
- #: ../image-watermark.php:734 ../image-watermark.php:736
183
- msgid "px"
184
- msgstr "بكسل"
185
-
186
- #: ../image-watermark.php:656 ../image-watermark.php:736
187
- msgid "y:"
188
- msgstr "ص:"
189
-
190
- #: ../image-watermark.php:672 ../image-watermark.php:676
191
- msgid "Watermark image"
192
- msgstr "صورة العلامة المائية"
193
-
194
- #: ../image-watermark.php:673
195
- msgid ""
196
- "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
197
- msgstr ""
198
- "قم بتعديل صورة العلامة المائية الخاصة بك. أنواع الملفات المسموح بها: JPEG, "
199
- "PNG, GIF."
200
-
201
- #: ../image-watermark.php:679
202
- msgid "Select image"
203
- msgstr "اختر صورة"
204
-
205
- #: ../image-watermark.php:680
206
- msgid "Turn off image"
207
- msgstr "تعطيل الصورة"
208
-
209
- #: ../image-watermark.php:681
210
- msgid "You have to save changes after the selection or removal of the image."
211
- msgstr "يجب عليك حفظ التغييرات بعد اختيار أو حذف الصور."
212
-
213
- #: ../image-watermark.php:685
214
- msgid "Watermark preview"
215
- msgstr "معاينة العلامة المائية"
216
-
217
- #: ../image-watermark.php:715
218
- msgid "Watermark size"
219
- msgstr "حجم العلامة المائية"
220
-
221
- #: ../image-watermark.php:719
222
- msgid "original"
223
- msgstr "الأصل"
224
-
225
- #: ../image-watermark.php:721
226
- msgid "custom"
227
- msgstr "مخصوص"
228
-
229
- #: ../image-watermark.php:723
230
- msgid "scaled"
231
- msgstr "تناسب"
232
-
233
- #: ../image-watermark.php:726
234
- msgid "Select method of aplying watermark size."
235
- msgstr "اختر طريقة تطبيق حجم العلامة المائية."
236
-
237
- #: ../image-watermark.php:731
238
- msgid "Watermark custom size"
239
- msgstr "الحجم المخصوص للعلامة المائية"
240
-
241
- #: ../image-watermark.php:738
242
- msgid "Those dimensions will be used if \"custom\" method is selected above."
243
- msgstr "سيتم استخدام هذه الأبعاد إذا تم اختيار الطريقة \"مخصوص\" أعلاه."
244
-
245
- #: ../image-watermark.php:742
246
- msgid "Scale of watermark in relation to image width"
247
- msgstr "تناسب العلامة المائية بالنسبة لعرض الصورة"
248
-
249
- #: ../image-watermark.php:747
250
- msgid ""
251
- "This value will be used if \"scaled\" method if selected above. <br />Enter "
252
- "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
253
- "width of the image it is applied to."
254
- msgstr ""
255
- "سيتم استخدام هذه القيمة إذا تم اختيار طريقة \"تناسب\" أعلاه. <br />أدخل رقما "
256
- "بين 0 و 100. 100 تجعل عرض العلامة المائية مساويا لعرض الصورة المطبقة عليها."
257
-
258
- #: ../image-watermark.php:751
259
- msgid "Watermark transparency / opacity"
260
- msgstr "شفافية / تعتيم العلامة المائية"
261
-
262
- #: ../image-watermark.php:756
263
- msgid ""
264
- "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
265
- "transparent, 100 shows it as is."
266
- msgstr ""
267
- "أدخل رقما بين 0 و 100. 0 تجعل العلامة المائية شفافة تماما، 100 تعرضها كما هي."
268
-
269
- #: ../image-watermark.php:760
270
- msgid "Image quality"
271
- msgstr "جودة الصورة"
272
-
273
- #: ../image-watermark.php:765
274
- msgid "Set watermark image quality."
275
- msgstr "اختر جودة صورة العلامة المائية."
276
-
277
- #: ../image-watermark.php:769
278
- msgid "Image format"
279
- msgstr "تنسيق الصورة"
280
-
281
- #: ../image-watermark.php:773
282
- msgid "baseline"
283
- msgstr "خط أساس"
284
-
285
- #: ../image-watermark.php:775
286
- msgid "progressive"
287
- msgstr "تقدمي"
288
-
289
- #: ../image-watermark.php:779
290
- msgid "Select baseline or progressive image format."
291
- msgstr "اختر تنسيق صورة بين خط أساس أو تقدمي."
292
-
293
- #: ../image-watermark.php:785
294
- msgid "Image protection"
295
- msgstr "حماية الصورة"
296
-
297
- #: ../image-watermark.php:788
298
- msgid "Disable right mouse click on images"
299
- msgstr "تعطيل النقر بزر الفأرة الأيمن على الصور"
300
-
301
- #: ../image-watermark.php:792
302
- msgid "Prevent drag and drop"
303
- msgstr "منع السحب والإلقاء"
304
-
305
- #: ../image-watermark.php:796
306
- msgid "Enable image protection for logged-in users also"
307
- msgstr "تفعيل حماية الصور للمستخدمين المسجلي الدخول أيضا"
308
-
309
- #: ../image-watermark.php:801
310
- msgid "Save Changes"
311
- msgstr "حفظ التغييرات"
312
-
313
- #: ../image-watermark.php:807
314
- msgid "Image Watermark"
315
- msgstr "العلامة المائية المصورة"
316
-
317
- #: ../image-watermark.php:809
318
- msgid "Need support?"
319
- msgstr "تحتاج لدعم؟"
320
-
321
- #: ../image-watermark.php:810
322
- msgid ""
323
- "If you are having problems with this plugin, please talk about them in the"
324
- msgstr "إذا كانت لديك مشاكل مع هذه الإضافة، الرجاء مناقشتها في"
325
-
326
- #: ../image-watermark.php:810
327
- msgid "Support forum"
328
- msgstr "منتدى الدعم"
329
-
330
- #: ../image-watermark.php:812
331
- msgid "Do you like this plugin?"
332
- msgstr "هل أعجبتك هذه الإضافة؟"
333
-
334
- #: ../image-watermark.php:813
335
- msgid "Rate it 5"
336
- msgstr "اعطها تصنيف 5"
337
-
338
- #: ../image-watermark.php:813
339
- msgid "on WordPress.org"
340
- msgstr "على WordPress.org"
341
-
342
- #: ../image-watermark.php:814
343
- msgid "Blog about it & link to the"
344
- msgstr "اكتب تدوينة عنها وأضف رابطا إلى"
345
-
346
- #: ../image-watermark.php:814
347
- msgid "plugin page"
348
- msgstr "صفحة الإضافة"
349
-
350
- #: ../image-watermark.php:815
351
- msgid "Check out our other"
352
- msgstr "انظر ما لدينا من"
353
-
354
- #: ../image-watermark.php:815
355
- msgid "WordPress plugins"
356
- msgstr "إضافات ووردبريس"
357
-
358
- #: ../image-watermark.php:819
359
- msgid "Created by"
360
- msgstr "صنع بواسطة"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/image-watermark-de_DE.mo DELETED
Binary file
languages/image-watermark-de_DE.pot DELETED
@@ -1,437 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress Watermark\n"
4
- "POT-Creation-Date: 2013-10-02 13:01+0100\n"
5
- "PO-Revision-Date: 2013-12-09 12:07+0100\n"
6
- "Last-Translator: Matthias Siebler <matthias.siebler@gmail.com>\n"
7
- "Language-Team: Matthias Siebler <matthias.siebler@gmail.com>\n"
8
- "Language: de\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.6.1\n"
13
- "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
- "_n:1,2\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
- "X-Poedit-SearchPath-0: ..\n"
19
-
20
- #: ../image-watermark.php:27
21
- msgid ""
22
- "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher."
23
- msgstr ""
24
- "Sorry, das Image Watermark Plugin benötigt mindestens WordPress 3.5 und PHP "
25
- "5.0"
26
-
27
- #: ../image-watermark.php:215
28
- msgid ""
29
- "Watermark could not be applied to selected files or no valid images (JPEG, "
30
- "PNG) were selected."
31
- msgstr ""
32
- "Das Wasserzeichen konnte nicht auf die ausgewählten Bilder aufgebracht "
33
- "werden oder es wurden Bilder in einem ungültigen Format ausgewählt. (JPG und "
34
- "PNG sind erlaubt)"
35
-
36
- #: ../image-watermark.php:215 ../image-watermark.php:219
37
- msgid "Skipped files"
38
- msgstr "Übersprungene Dateien"
39
-
40
- #: ../image-watermark.php:219
41
- #, php-format
42
- msgid "Watermark was succesfully applied to 1 image."
43
- msgid_plural "Watermark was succesfully applied to %s images."
44
- msgstr[0] "Das Wasserzeichen wurde auf 1 Bild angewendet."
45
- msgstr[1] "Das Wasserzeichen wurde auf %s Bilden angewendet."
46
-
47
- #: ../image-watermark.php:262
48
- msgid "Support"
49
- msgstr "Support"
50
-
51
- #: ../image-watermark.php:284
52
- msgid "Settings"
53
- msgstr "Einstellungen"
54
-
55
- #: ../image-watermark.php:315
56
- msgid "Apply watermark"
57
- msgstr "Wasserzeichen anwenden"
58
-
59
- #: ../image-watermark.php:335
60
- msgid "Select watermark"
61
- msgstr "Wähle ein Wasserzeichen"
62
-
63
- #: ../image-watermark.php:336 ../image-watermark.php:813
64
- msgid "Original size"
65
- msgstr "Originalgröße"
66
-
67
- #: ../image-watermark.php:337 ../image-watermark.php:807
68
- msgid "Watermak has not been selected yet."
69
- msgstr "Es wurde ein Wasserzeichen ausgewählt."
70
-
71
- #: ../image-watermark.php:338
72
- msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
73
- msgstr ""
74
- "Dieses Bildformat ist nicht unterstützt. Benutze bitte JPG-, PNG- oder GIF-"
75
- "Dateien"
76
-
77
- #: ../image-watermark.php:340
78
- msgid "Add watermark"
79
- msgstr "Wasserzeichen hinzufügen"
80
-
81
- #: ../image-watermark.php:357
82
- msgid "Are you sure you want to reset settings to defaults?"
83
- msgstr "Bist du sicher, dass du alle Einstellungen zurücksetzen möchtest?"
84
-
85
- #: ../image-watermark.php:412
86
- msgid "Image Watermark Options"
87
- msgstr "Image Watermark Optionen"
88
-
89
- #: ../image-watermark.php:413
90
- msgid "Watermark"
91
- msgstr "Wasserzeichen"
92
-
93
- #: ../image-watermark.php:439
94
- msgid "Image Watermark will not work properly without GD PHP extension."
95
- msgstr ""
96
- "Image Watermark wird nicht richtig funktionieren ohne der PHP-Erweiterung "
97
- "GD. "
98
-
99
- #: ../image-watermark.php:581
100
- msgid "Settings saved."
101
- msgstr "Einstellungen gespeichert."
102
-
103
- #: ../image-watermark.php:594
104
- msgid "Settings restored to defaults."
105
- msgstr "Einstellungen zurückgesetzt."
106
-
107
- #: ../image-watermark.php:614
108
- msgid "Watermark will not be applied when <b>watermark image is not set</b>."
109
- msgstr ""
110
- "Wasserzeichen konnte nicht aufgebracht werden. <b>Es wurde keine "
111
- "Wasserzeichen-Bilddatei ausgewählt.</b>"
112
-
113
- #: ../image-watermark.php:617
114
- msgid "Watermark will not be applied when <b>no image sizes are selected</b>."
115
- msgstr ""
116
- "Wasserzeichen konnte nicht aufgebracht werden. <b>Es wurde keine Bildgröße "
117
- "ausgewählt.</b>"
118
-
119
- #: ../image-watermark.php:623
120
- msgid ""
121
- "Watermark will not be applied while frontend image upload if <b>watermark "
122
- "image is not set</b>."
123
- msgstr ""
124
- "Wasserzeichen konnte nicht beim Frontend-Upload aufgebracht werden. <b>Es "
125
- "wurde keine Wasserzeichen-Bilddatei ausgewählt.</b>"
126
-
127
- #: ../image-watermark.php:626
128
- msgid ""
129
- "Watermark will not be applied while frontend image upload if <b>no image "
130
- "sizes are selected</b>."
131
- msgstr ""
132
- "Wasserzeichen konnte nicht beim Frontend-Upload aufgebracht werden. <b>Es "
133
- "wurde keine Bildgröße ausgewählt.</b>"
134
-
135
- #: ../image-watermark.php:633
136
- msgid "Image Watermark Settings"
137
- msgstr "Image Watermark Einstellungen"
138
-
139
- #: ../image-watermark.php:637
140
- msgid "General settings"
141
- msgstr "Allgemeine Einstellungen"
142
-
143
- #: ../image-watermark.php:640
144
- msgid "Automatic watermarking"
145
- msgstr "Automatisches Wasserzeichen"
146
-
147
- #: ../image-watermark.php:644 ../image-watermark.php:660
148
- #: ../image-watermark.php:707 ../image-watermark.php:723
149
- msgid "on"
150
- msgstr "an"
151
-
152
- #: ../image-watermark.php:646 ../image-watermark.php:662
153
- #: ../image-watermark.php:709 ../image-watermark.php:725
154
- msgid "off"
155
- msgstr "aus"
156
-
157
- #: ../image-watermark.php:649
158
- msgid "Enable or disable watermark for uploaded images."
159
- msgstr ""
160
- "Aktiviert oder deaktiviert das automatische Wasserzeichen beim upload von "
161
- "Bildern. "
162
-
163
- #: ../image-watermark.php:656
164
- msgid "Manual watermarking"
165
- msgstr "Manuelles Wasserzeichen"
166
-
167
- #: ../image-watermark.php:665
168
- msgid "Enable or disable Apply Watermark option for images in Media Library."
169
- msgstr ""
170
- "Aktiviert oder deaktiviert das manuelle hinzufügen des Wasserzeichen bei "
171
- "Bildern in der Mediathek. "
172
-
173
- #: ../image-watermark.php:672
174
- msgid "Enable watermark for"
175
- msgstr "Aktiviere das Wasserzeichen für"
176
-
177
- #: ../image-watermark.php:681
178
- msgid ""
179
- "Check image sizes on which watermark should appear. <b>Notice:</b> checking "
180
- "full size is not recommened as it's the original image."
181
- msgstr ""
182
- "Überprüfe die Bildgröße der Datei wo das Wasserzeichen aufgebracht werden "
183
- "soll. <b>Hinweis:</b> Überprüfung in voller Größe ist beim Originalbild "
184
- "nicht empfohlen."
185
-
186
- #: ../image-watermark.php:687
187
- msgid "everywhere"
188
- msgstr "überall"
189
-
190
- #: ../image-watermark.php:688
191
- msgid "on selected post types only"
192
- msgstr "nur an ausgewählten Post-Types "
193
-
194
- #: ../image-watermark.php:696
195
- msgid ""
196
- "Check custom post types on which watermark should be applied to uploaded "
197
- "images."
198
- msgstr ""
199
- "Wähle den Custom Post Types in dem das Wasserzeichen beim Upload aufgebracht "
200
- "werden soll. "
201
-
202
- #: ../image-watermark.php:703
203
- msgid "Automatic frontend watermarking"
204
- msgstr "Automatisches Frontend-Wasserzeichen"
205
-
206
- #: ../image-watermark.php:712
207
- msgid ""
208
- "Enable or disable watermark for frontend image uploading. (uploading script "
209
- "is not included, but you may use a plugin or custom code). Notice: This "
210
- "functionality works only if uploaded images are processed using WordPress "
211
- "native upload methods."
212
- msgstr ""
213
- "Aktiviere oder deaktiviere das aufbringen eines Wasserzeichens beim Fronten-"
214
- "Upload. (<b>Hinweis: </b>Eine Funktion für den Frontend-Upload ist in diesem "
215
- "Plugin nicht enthalten. Es sind aber zahlreiche Plugins für Wordpress "
216
- "verfügbar. Ein Aufbringen des Wasserzeichens ist nur dann möglich, wenn die "
217
- "Wordpress-Upload-Funktion verwendet wird.) "
218
-
219
- #: ../image-watermark.php:719
220
- msgid "Plugin deactivation"
221
- msgstr "Deaktivierung des Plugins"
222
-
223
- #: ../image-watermark.php:728
224
- msgid "Delete all database settings on plugin deactivation."
225
- msgstr "Löschen aller Datenbankeinstellungen zur deaktivierung des Plugins"
226
-
227
- #: ../image-watermark.php:734
228
- msgid "Watermark position"
229
- msgstr "Position des Wasserzeichens"
230
-
231
- #: ../image-watermark.php:737
232
- msgid "Watermark alignment"
233
- msgstr "Ausrichtung des Wasserzeichens"
234
-
235
- #: ../image-watermark.php:752
236
- msgid "Choose the position of watermark image."
237
- msgstr "Wähle die Position des Wasserzeichens"
238
-
239
- #: ../image-watermark.php:757
240
- msgid "Watermark offset"
241
- msgstr "Wasserzeichen einrücken"
242
-
243
- #: ../image-watermark.php:760 ../image-watermark.php:840
244
- msgid "x:"
245
- msgstr "x:"
246
-
247
- #: ../image-watermark.php:760 ../image-watermark.php:762
248
- #: ../image-watermark.php:840 ../image-watermark.php:842
249
- msgid "px"
250
- msgstr "Pixel"
251
-
252
- #: ../image-watermark.php:762 ../image-watermark.php:842
253
- msgid "y:"
254
- msgstr "y:"
255
-
256
- #: ../image-watermark.php:778 ../image-watermark.php:782
257
- msgid "Watermark image"
258
- msgstr "Wasserzeichen Bilddatei"
259
-
260
- #: ../image-watermark.php:779
261
- msgid ""
262
- "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
263
- msgstr ""
264
- "Einstellen der Wasserzeichen Bilddatei. Erlaubte formate sind JPG, PNG und "
265
- "GIF."
266
-
267
- #: ../image-watermark.php:785
268
- msgid "Select image"
269
- msgstr "Wähle ein Bild"
270
-
271
- #: ../image-watermark.php:786
272
- msgid "Turn off image"
273
- msgstr "Schalte das Bild aus"
274
-
275
- #: ../image-watermark.php:787
276
- msgid "You have to save changes after the selection or removal of the image."
277
- msgstr ""
278
- "Einstellungen müssen gespeichert werden nach dem hinzufügen oder entfernen "
279
- "von Wasserzeichen-Bildern"
280
-
281
- #: ../image-watermark.php:791
282
- msgid "Watermark preview"
283
- msgstr "Vorschau des Wasserzeichens"
284
-
285
- #: ../image-watermark.php:821
286
- msgid "Watermark size"
287
- msgstr "Größe des Wasserzeichens"
288
-
289
- #: ../image-watermark.php:825
290
- msgid "original"
291
- msgstr "original"
292
-
293
- #: ../image-watermark.php:827
294
- msgid "custom"
295
- msgstr "angepasst"
296
-
297
- #: ../image-watermark.php:829
298
- msgid "scaled"
299
- msgstr "skaliert"
300
-
301
- #: ../image-watermark.php:832
302
- msgid "Select method of aplying watermark size."
303
- msgstr "Wähle die Methode, wie das Wasserzeichen angebracht wird "
304
-
305
- #: ../image-watermark.php:837
306
- msgid "Watermark custom size"
307
- msgstr "Angepasste Größe des Wasserzeichens"
308
-
309
- #: ../image-watermark.php:844
310
- msgid "Those dimensions will be used if \"custom\" method is selected above."
311
- msgstr ""
312
- "Dieses Größenverhältnis wird verwendet wenn die Einstellung <b>angepasst</b> "
313
- "oben ausgewählt ist."
314
-
315
- #: ../image-watermark.php:848
316
- msgid "Scale of watermark in relation to image width"
317
- msgstr "Skaliere das Wasserzeichen in Abhängigkeit von der Bildweite"
318
-
319
- #: ../image-watermark.php:858
320
- msgid ""
321
- "This value will be used if \"scaled\" method if selected above. <br />Enter "
322
- "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
323
- "width of the image it is applied to."
324
- msgstr ""
325
- "Diese Einstellungen werden verwendet wenn die Einstellung <b>skaliert</b> "
326
- "oben ausgewählt ist. <br />Gib eine Zahl zwischen 0 und 100 an. 100 macht "
327
- "das Wasserzeichen genau so groß wie die Bilddatei. 50 macht das "
328
- "Wasserzeichen nur halb so groß."
329
-
330
- #: ../image-watermark.php:862
331
- msgid "Watermark transparency / opacity"
332
- msgstr "Transparenz bzw. Deckkraft des Wasserzeichens"
333
-
334
- #: ../image-watermark.php:872
335
- msgid ""
336
- "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
337
- "transparent, 100 shows it as is."
338
- msgstr ""
339
- "Gib eine Zahl zwischen 0 und 100 an. 0 macht das Wasserzeichen komplett "
340
- "transparent, 100 zeige es, wie es ist."
341
-
342
- #: ../image-watermark.php:876
343
- msgid "Image quality"
344
- msgstr "Bildqualität"
345
-
346
- #: ../image-watermark.php:886
347
- msgid "Set output image quality."
348
- msgstr "Einstellen der Bildqualität für die Ausgabe"
349
-
350
- #: ../image-watermark.php:890
351
- msgid "Image format"
352
- msgstr "Bildformat"
353
-
354
- #: ../image-watermark.php:894
355
- msgid "baseline"
356
- msgstr "Baseline"
357
-
358
- #: ../image-watermark.php:896
359
- msgid "progressive"
360
- msgstr "Progressive"
361
-
362
- #: ../image-watermark.php:900
363
- msgid "Select baseline or progressive image format."
364
- msgstr "Wähle bei dem Bildformat Baseline oder Progressive."
365
-
366
- #: ../image-watermark.php:906
367
- msgid "Image protection"
368
- msgstr "Bildschutz"
369
-
370
- #: ../image-watermark.php:909
371
- msgid "Disable right mouse click on images"
372
- msgstr "Deaktiviere die rechte Maustaste auf Bildern"
373
-
374
- #: ../image-watermark.php:913
375
- msgid "Prevent drag and drop"
376
- msgstr "Verhindere Drag&Drop"
377
-
378
- #: ../image-watermark.php:917
379
- msgid "Enable image protection for logged-in users also"
380
- msgstr "Aktiviere Bildschutz auch für angemeldete Benutzer"
381
-
382
- #: ../image-watermark.php:922
383
- msgid "Save Changes"
384
- msgstr "Änderungen übernehmen"
385
-
386
- #: ../image-watermark.php:923
387
- msgid "Reset to defaults"
388
- msgstr "Zurücksetzen auf Standarteinstellungen"
389
-
390
- #: ../image-watermark.php:928
391
- msgid "Image Watermark"
392
- msgstr "Image Watermark"
393
-
394
- #: ../image-watermark.php:930
395
- msgid "Need support?"
396
- msgstr "Brauchst du Hilfe?"
397
-
398
- #: ../image-watermark.php:931
399
- msgid ""
400
- "If you are having problems with this plugin, please talk about them in the"
401
- msgstr "Wenn du mit diesem Plugin Probleme hast, wende dich an das "
402
-
403
- #: ../image-watermark.php:931
404
- msgid "Support forum"
405
- msgstr "Support Forum"
406
-
407
- #: ../image-watermark.php:933
408
- msgid "Do you like this plugin?"
409
- msgstr "Magst du dieses Plugin?"
410
-
411
- #: ../image-watermark.php:934
412
- msgid "Rate it 5"
413
- msgstr "Bewerte das Plugin mit 5 Sternen"
414
-
415
- #: ../image-watermark.php:934
416
- msgid "on WordPress.org"
417
- msgstr "auf wordpress.org"
418
-
419
- #: ../image-watermark.php:935
420
- msgid "Blog about it & link to the"
421
- msgstr "Schreibe darüber und verlinke die "
422
-
423
- #: ../image-watermark.php:935
424
- msgid "plugin page"
425
- msgstr "Plugin-Seite"
426
-
427
- #: ../image-watermark.php:936
428
- msgid "Check out our other"
429
- msgstr "Probiere auch unsere anderen"
430
-
431
- #: ../image-watermark.php:936
432
- msgid "WordPress plugins"
433
- msgstr "WordPress-Plugins"
434
-
435
- #: ../image-watermark.php:939
436
- msgid "Created by"
437
- msgstr "Erstellt von"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/image-watermark-hu_HU.mo DELETED
Binary file
languages/image-watermark-hu_HU.po DELETED
@@ -1,403 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress Watermark\n"
4
- "POT-Creation-Date: 2015-02-03 11:40+0100\n"
5
- "PO-Revision-Date: 2015-02-05 00:04+0100\n"
6
- "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
- "Language-Team: dFactory <info@dfactory.pl>\n"
8
- "Language: hu_HU\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.7.4\n"
13
- "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;_n:1,2\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-SourceCharset: UTF-8\n"
16
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
-
19
- #: ../image-watermark.php:29
20
- msgid "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher."
21
- msgstr "Kép Vízjel bővítményhez szükséges PHP 5.0 és WP 3.5 vagy magyasabb verzió"
22
-
23
- #: ../image-watermark.php:218
24
- msgid ""
25
- "Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected."
26
- msgstr ""
27
- "Vízjelnél nem lehetett alkalmazni a kijelölt fájlokat, vagy nincsenek érvényes képek (JPEG,PNG) "
28
- "kiválasztásnál."
29
-
30
- #: ../image-watermark.php:218 ../image-watermark.php:222
31
- msgid "Skipped files"
32
- msgstr "Kihagyott fájlok"
33
-
34
- #: ../image-watermark.php:222
35
- #, php-format
36
- msgid "Watermark was succesfully applied to 1 image."
37
- msgid_plural "Watermark was succesfully applied to %s images."
38
- msgstr[0] "Vízjelet sikeresen alkalmaztunk 1 képnél."
39
- msgstr[1] "Vízjelet sikeresen alkalmaztunk %s képeknél."
40
-
41
- #: ../image-watermark.php:265
42
- msgid "Support"
43
- msgstr "Támogatás"
44
-
45
- #: ../image-watermark.php:287
46
- msgid "Settings"
47
- msgstr "Beállítások"
48
-
49
- #: ../image-watermark.php:318
50
- msgid "Apply watermark"
51
- msgstr "Vízjel alkalmazása"
52
-
53
- #: ../image-watermark.php:338
54
- msgid "Select watermark"
55
- msgstr "Vízjel kiválasztása"
56
-
57
- #: ../image-watermark.php:339 ../image-watermark.php:834
58
- msgid "Original size"
59
- msgstr "Eredeti méret"
60
-
61
- #: ../image-watermark.php:340 ../image-watermark.php:828
62
- msgid "Watermak has not been selected yet."
63
- msgstr "Vízjelnek még semmi nem lett kiválasztva."
64
-
65
- #: ../image-watermark.php:341
66
- msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
67
- msgstr "Ez a kép nem támogatott vízjelre. Használj JPEG, PNG vagy GIF formátumot."
68
-
69
- #: ../image-watermark.php:343
70
- msgid "Add watermark"
71
- msgstr "Vízjel hozzáadása"
72
-
73
- #: ../image-watermark.php:360
74
- msgid "Are you sure you want to reset settings to defaults?"
75
- msgstr "Biztos újra akarod indítani az alapértékeket?"
76
-
77
- #: ../image-watermark.php:417
78
- msgid "Image Watermark Options"
79
- msgstr "Vízjel kép opciók"
80
-
81
- #: ../image-watermark.php:418
82
- msgid "Watermark"
83
- msgstr "Vízjel"
84
-
85
- #: ../image-watermark.php:444
86
- msgid "Image Watermark will not work properly without GD PHP extension."
87
- msgstr "A kép Vízjel nem fog megfelelően működni anélkül, GD PHP kiterjesztéssel."
88
-
89
- #: ../image-watermark.php:586
90
- msgid "Settings saved."
91
- msgstr "Beállítások mentve."
92
-
93
- #: ../image-watermark.php:599
94
- msgid "Settings restored to defaults."
95
- msgstr "Beállítások helyreállítva az alapértékekre."
96
-
97
- #: ../image-watermark.php:619
98
- msgid "Watermark will not be applied when <b>watermark image is not set</b>."
99
- msgstr "Vízjel nem alkalmazható, ha a <b> vízjel képe nincs beállítva </ b>."
100
-
101
- #: ../image-watermark.php:622
102
- msgid "Watermark will not be applied when <b>no image sizes are selected</b>."
103
- msgstr "Vízjel nem alkalmazható, ha a <b> nem választottál ki képméretet</ b>."
104
-
105
- #: ../image-watermark.php:628
106
- msgid ""
107
- "Watermark will not be applied while frontend image upload if <b>watermark image is not set</b>."
108
- msgstr ""
109
- "Vízjelet nem alkalmazható, míg frontend kép feltöltés esetén <b> vízjel képnél nincs beállítás</ "
110
- "b>."
111
-
112
- #: ../image-watermark.php:631
113
- msgid ""
114
- "Watermark will not be applied while frontend image upload if <b>no image sizes are selected</b>."
115
- msgstr ""
116
- "Vízjelet nem alkalmazható, míg frontend kép feltöltés esetén <b> vízjel képnél nincs "
117
- "kiválasztás</ b>."
118
-
119
- #: ../image-watermark.php:638
120
- msgid "Image Watermark Settings"
121
- msgstr "Kép vízjel beállítás"
122
-
123
- #: ../image-watermark.php:642
124
- msgid "Image Watermark"
125
- msgstr "Kép vízjel"
126
-
127
- #: ../image-watermark.php:644
128
- msgid "Need support?"
129
- msgstr "Támogatás szükséges?"
130
-
131
- #: ../image-watermark.php:645
132
- msgid "If you are having problems with this plugin, please talk about them in the"
133
- msgstr "Ha problémái vannak a plugint, kérjük, beszéljen róluk a"
134
-
135
- #: ../image-watermark.php:645
136
- msgid "Support forum"
137
- msgstr "Fórum támogatás"
138
-
139
- #: ../image-watermark.php:647
140
- msgid "Do you like this plugin?"
141
- msgstr "Kedveled ezt a bővítményt?"
142
-
143
- #: ../image-watermark.php:648
144
- msgid "Rate it 5"
145
- msgstr "Értékelje 5-ösre"
146
-
147
- #: ../image-watermark.php:648
148
- msgid "on WordPress.org"
149
- msgstr "WordPress.org-on"
150
-
151
- #: ../image-watermark.php:649
152
- msgid "Blog about it & link to the"
153
- msgstr "Blogról & link a"
154
-
155
- #: ../image-watermark.php:649
156
- msgid "plugin page"
157
- msgstr "bővítmény oldal"
158
-
159
- #: ../image-watermark.php:650
160
- msgid "Check out our other"
161
- msgstr "Nézd meg a többit"
162
-
163
- #: ../image-watermark.php:650
164
- msgid "WordPress plugins"
165
- msgstr "WordPress bővítmény"
166
-
167
- #: ../image-watermark.php:653
168
- msgid "Created by"
169
- msgstr "Készítette"
170
-
171
- #: ../image-watermark.php:658
172
- msgid "General settings"
173
- msgstr "Általános beállítások"
174
-
175
- #: ../image-watermark.php:661
176
- msgid "Automatic watermarking"
177
- msgstr "Automatikus vízjelzés"
178
-
179
- #: ../image-watermark.php:665 ../image-watermark.php:681 ../image-watermark.php:728
180
- #: ../image-watermark.php:744
181
- msgid "on"
182
- msgstr "be"
183
-
184
- #: ../image-watermark.php:667 ../image-watermark.php:683 ../image-watermark.php:730
185
- #: ../image-watermark.php:746
186
- msgid "off"
187
- msgstr "ki"
188
-
189
- #: ../image-watermark.php:670
190
- msgid "Enable or disable watermark for uploaded images."
191
- msgstr "Vízjel engedélyezése vagy tiltása a feltöltött képeknél."
192
-
193
- #: ../image-watermark.php:677
194
- msgid "Manual watermarking"
195
- msgstr "Kézi vízjelzés"
196
-
197
- #: ../image-watermark.php:686
198
- msgid "Enable or disable Apply Watermark option for images in Media Library."
199
- msgstr "Vízjelzés alkalmazásának engedélyezése vagy tiltása a képeknél a Média Könyvtárban."
200
-
201
- #: ../image-watermark.php:693
202
- msgid "Enable watermark for"
203
- msgstr "Engedélyezze a vízjelet"
204
-
205
- #: ../image-watermark.php:702
206
- msgid ""
207
- "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</strong> checking "
208
- "full size is NOT recommended as it's the original image. You may need it later - for removing or "
209
- "changing watermark, image sizes regeneration or any other image manipulations. Use it only if you "
210
- "know what you are doing."
211
- msgstr ""
212
- "Betölti a képméretet, amelyen vízjel jelenik meg. <br /> <Strong> FONTOS: </strong> betöltése "
213
- "teljes méretben nem ajánlott, mivel ez az eredeti kép. Szükséged lehet később - eltávolításra "
214
- "vagy megváltoztatod a vízjel képméretet helyreállítod, vagy bármilyen más képet manipulálász. "
215
- "Használd, de csak akkor, ha tudod, hogy mit csinálsz."
216
-
217
- #: ../image-watermark.php:708
218
- msgid "everywhere"
219
- msgstr "mindenhol"
220
-
221
- #: ../image-watermark.php:709
222
- msgid "on selected post types only"
223
- msgstr "a választott hozzászólás típusoknál"
224
-
225
- #: ../image-watermark.php:717
226
- msgid "Check custom post types on which watermark should be applied to uploaded images."
227
- msgstr "Betöltés egyéni típusokhoz, amelyre vízjelet szeretnél alkalmazni - feltölthetsz képeket."
228
-
229
- #: ../image-watermark.php:724
230
- msgid "Automatic frontend watermarking"
231
- msgstr "Automatikus frontend vízjel"
232
-
233
- #: ../image-watermark.php:733
234
- msgid ""
235
- "Enable or disable watermark for frontend image uploading. (uploading script is not included, but "
236
- "you may use a plugin or custom code). <strong>Notice:</strong> This functionality works only if "
237
- "uploaded images are processed using WordPress native upload methods."
238
- msgstr ""
239
- "vízjel engedélyezése vagy tiltás frontend képfeltöltésnél. (Feltöltés script nem szerepel, de "
240
- "lehet használni a plugint, vagy egyéni kód). <strong> Megjegyzés: </strong> Ez a funkció csak "
241
- "akkor működik, ha a feltöltött képeket kerülnek feldolgozásra WordPress natív feltöltési "
242
- "módszereknél."
243
-
244
- #: ../image-watermark.php:740
245
- msgid "Plugin deactivation"
246
- msgstr "Bővítmény inaktíválása"
247
-
248
- #: ../image-watermark.php:749
249
- msgid "Delete all database settings on plugin deactivation."
250
- msgstr "Törölje az összes adatbázis bővítmény beállításainak kikapcsolását."
251
-
252
- #: ../image-watermark.php:755
253
- msgid "Watermark position"
254
- msgstr "Vízjel pozició"
255
-
256
- #: ../image-watermark.php:758
257
- msgid "Watermark alignment"
258
- msgstr "Vízjel igazítás"
259
-
260
- #: ../image-watermark.php:773
261
- msgid "Choose the position of watermark image."
262
- msgstr "Pozicíó kiválasztása a vízjel képnél."
263
-
264
- #: ../image-watermark.php:778
265
- msgid "Watermark offset"
266
- msgstr "Vízjel kordináták"
267
-
268
- #: ../image-watermark.php:781 ../image-watermark.php:861
269
- msgid "x:"
270
- msgstr "x:"
271
-
272
- #: ../image-watermark.php:781 ../image-watermark.php:783 ../image-watermark.php:861
273
- #: ../image-watermark.php:863
274
- msgid "px"
275
- msgstr "px"
276
-
277
- #: ../image-watermark.php:783 ../image-watermark.php:863
278
- msgid "y:"
279
- msgstr "y:"
280
-
281
- #: ../image-watermark.php:799 ../image-watermark.php:803
282
- msgid "Watermark image"
283
- msgstr "Vízjel kép"
284
-
285
- #: ../image-watermark.php:800
286
- msgid "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
287
- msgstr "Állítsd be a vízjel képet. Engedélyezett fájl formátumok: JPEG, PNG, GIF."
288
-
289
- #: ../image-watermark.php:806
290
- msgid "Select image"
291
- msgstr "Kép kiválasztás"
292
-
293
- #: ../image-watermark.php:807
294
- msgid "Turn off image"
295
- msgstr "Kép kikapcsolása"
296
-
297
- #: ../image-watermark.php:808
298
- msgid "You have to save changes after the selection or removal of the image."
299
- msgstr "El kell menteni változtatások után a kép kiválasztását vagy eltávolítását."
300
-
301
- #: ../image-watermark.php:812
302
- msgid "Watermark preview"
303
- msgstr "Vízjel előnézet"
304
-
305
- #: ../image-watermark.php:842
306
- msgid "Watermark size"
307
- msgstr "Vízjel méret"
308
-
309
- #: ../image-watermark.php:846
310
- msgid "original"
311
- msgstr "eredeti"
312
-
313
- #: ../image-watermark.php:848
314
- msgid "custom"
315
- msgstr "szokásos"
316
-
317
- #: ../image-watermark.php:850
318
- msgid "scaled"
319
- msgstr "méretarányos"
320
-
321
- #: ../image-watermark.php:853
322
- msgid "Select method of aplying watermark size."
323
- msgstr "Válassza ki a módszert alkalmazott vízjel mérethez."
324
-
325
- #: ../image-watermark.php:858
326
- msgid "Watermark custom size"
327
- msgstr "Vízjel szokásos mérete"
328
-
329
- #: ../image-watermark.php:865
330
- msgid "Those dimensions will be used if \"custom\" method is selected above."
331
- msgstr "E dimenziók fogják használni, ha \"egyedi\" módszert fent kiválasztottad."
332
-
333
- #: ../image-watermark.php:869
334
- msgid "Scale of watermark in relation to image width"
335
- msgstr "Képarány a vízjelnél a kép szélességével kapcsolatban"
336
-
337
- #: ../image-watermark.php:879
338
- msgid ""
339
- "This value will be used if \"scaled\" method if selected above. <br />Enter a number ranging from "
340
- "0 to 100. 100 makes width of watermark image equal to width of the image it is applied to."
341
- msgstr ""
342
- "Ez az érték lesz, ha \"képarány\" módszer, ha a fentiekben kiválasztott. <br /> Enteregy szám 0-"
343
- "tól 100 100 teszi szélességét vízjel kép egyenlő szélességű képnél ezt alkalmazzák."
344
-
345
- #: ../image-watermark.php:883
346
- msgid "Watermark transparency / opacity"
347
- msgstr "Vízjel átlátszóság / homályosság"
348
-
349
- #: ../image-watermark.php:893
350
- msgid ""
351
- "Enter a number ranging from 0 to 100. 0 makes watermark image completely transparent, 100 shows "
352
- "it as is."
353
- msgstr ""
354
- "Adjon meg egy számot 0-tól 100 0 teszi vízjel képét teljesen átláthatóvá, 100 mutatja, úgy ahogy "
355
- "van."
356
-
357
- #: ../image-watermark.php:897
358
- msgid "Image quality"
359
- msgstr "Kép minősége"
360
-
361
- #: ../image-watermark.php:907
362
- msgid "Set output image quality."
363
- msgstr "Képminőség kimenet beállítása."
364
-
365
- #: ../image-watermark.php:911
366
- msgid "Image format"
367
- msgstr "Kép formátum"
368
-
369
- #: ../image-watermark.php:915
370
- msgid "baseline"
371
- msgstr "kiindulás"
372
-
373
- #: ../image-watermark.php:917
374
- msgid "progressive"
375
- msgstr "progresszív"
376
-
377
- #: ../image-watermark.php:921
378
- msgid "Select baseline or progressive image format."
379
- msgstr "Kiindulási vagy progresszív kép formátum kiválasztása"
380
-
381
- #: ../image-watermark.php:927
382
- msgid "Image protection"
383
- msgstr "Kép védelem"
384
-
385
- #: ../image-watermark.php:930
386
- msgid "Disable right mouse click on images"
387
- msgstr "Kikapcsolja a jobb egér kattintást a képeknél"
388
-
389
- #: ../image-watermark.php:934
390
- msgid "Prevent drag and drop"
391
- msgstr "Drag and drop megakadályozása"
392
-
393
- #: ../image-watermark.php:938
394
- msgid "Enable image protection for logged-in users also"
395
- msgstr "Engedélyezze a kép védelemet a bejelentkezett felhasználóknál is"
396
-
397
- #: ../image-watermark.php:943
398
- msgid "Save Changes"
399
- msgstr "Változatatások mentése"
400
-
401
- #: ../image-watermark.php:944
402
- msgid "Reset to defaults"
403
- msgstr "Alapértékek újraindítása"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/image-watermark-zh_CN.mo DELETED
Binary file
languages/image-watermark-zh_CN.po DELETED
@@ -1,428 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WordPress Watermark\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-02-14 11:40+0100\n"
6
- "PO-Revision-Date: 2014-05-13 19:43+0800\n"
7
- "Last-Translator: 逍遥乐汉化 <luoxiao123@outlook.com>\n"
8
- "Language-Team: 逍遥乐汉化 <luoxiao123@outlook.com>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "Language: pl_PL\n"
13
- "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e;_n:1,2;esc_attr__;esc_attr_e\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-SourceCharset: UTF-8\n"
16
- "X-Generator: Poedit 1.6.4\n"
17
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
- "X-Poedit-Language: Chinese\n"
19
- "X-Poedit-Country: CHINA\n"
20
- "X-Poedit-SearchPath-0: ..\n"
21
-
22
- #: ../image-watermark.php:29
23
- msgid "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher."
24
- msgstr "对不起,图片水印插件需要至少PHP 5.0和W P3.5或更高版本。"
25
-
26
- #: ../image-watermark.php:218
27
- msgid "Watermark could not be applied to selected files or no valid images (JPEG, PNG) were selected."
28
- msgstr "水印不能被应用到选定的文件或者没有有效的图像(JPEG,PNG)被选定。"
29
-
30
- #: ../image-watermark.php:218
31
- #: ../image-watermark.php:222
32
- msgid "Skipped files"
33
- msgstr "跳过的文件"
34
-
35
- #: ../image-watermark.php:222
36
- #, php-format
37
- msgid "Watermark was succesfully applied to 1 image."
38
- msgid_plural "Watermark was succesfully applied to %s images."
39
- msgstr[0] "水印被成功地应用到1个图像。"
40
- msgstr[1] "水印被成功地应用到%s个图像。"
41
-
42
- #: ../image-watermark.php:265
43
- msgid "Support"
44
- msgstr "支持"
45
-
46
- #: ../image-watermark.php:287
47
- msgid "Settings"
48
- msgstr "设置"
49
-
50
- #: ../image-watermark.php:318
51
- msgid "Apply watermark"
52
- msgstr "添加水印"
53
-
54
- #: ../image-watermark.php:338
55
- msgid "Select watermark"
56
- msgstr "选择水印"
57
-
58
- #: ../image-watermark.php:339
59
- #: ../image-watermark.php:834
60
- msgid "Original size"
61
- msgstr "原稿尺寸"
62
-
63
- #: ../image-watermark.php:340
64
- #: ../image-watermark.php:828
65
- msgid "Watermak has not been selected yet."
66
- msgstr "水印没有被选中。"
67
-
68
- #: ../image-watermark.php:341
69
- msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
70
- msgstr "此图片是不支持的水印。只能使用JPEG,PNG或GIF格式的图像。"
71
-
72
- #: ../image-watermark.php:343
73
- msgid "Add watermark"
74
- msgstr "添加水印"
75
-
76
- #: ../image-watermark.php:360
77
- msgid "Are you sure you want to reset settings to defaults?"
78
- msgstr "您确定要重置设置为默认值?"
79
-
80
- #: ../image-watermark.php:417
81
- msgid "Image Watermark Options"
82
- msgstr "图像水印选项"
83
-
84
- #: ../image-watermark.php:418
85
- msgid "Watermark"
86
- msgstr "水印"
87
-
88
- #: ../image-watermark.php:444
89
- msgid "Image Watermark will not work properly without GD PHP extension."
90
- msgstr "没有GD PHP扩展图像水印将无法正常工作。"
91
-
92
- #: ../image-watermark.php:586
93
- msgid "Settings saved."
94
- msgstr "设置已保存。"
95
-
96
- #: ../image-watermark.php:599
97
- msgid "Settings restored to defaults."
98
- msgstr "设置已恢复到默认值。"
99
-
100
- #: ../image-watermark.php:619
101
- msgid "Watermark will not be applied when <b>watermark image is not set</b>."
102
- msgstr "当<b>水印图像没有设置</b>水印将不会被应用。"
103
-
104
- #: ../image-watermark.php:622
105
- msgid "Watermark will not be applied when <b>no image sizes are selected</b>."
106
- msgstr "当<b>无图像尺寸被选择</b>水印将不会被应用。"
107
-
108
- #: ../image-watermark.php:628
109
- msgid "Watermark will not be applied while frontend image upload if <b>watermark image is not set</b>."
110
- msgstr "如果<b>水印图像没有设置</b>,而前端图像上传,水印将不会被应用。"
111
-
112
- #: ../image-watermark.php:631
113
- msgid "Watermark will not be applied while frontend image upload if <b>no image sizes are selected</b>."
114
- msgstr "如果<b>没有图像尺寸被选择</b>,而前端图像上传,水印将不会被应用。"
115
-
116
- #: ../image-watermark.php:638
117
- msgid "Image Watermark Settings"
118
- msgstr "图像水印设置"
119
-
120
- #: ../image-watermark.php:642
121
- msgid "Image Watermark"
122
- msgstr "图像水印"
123
-
124
- #: ../image-watermark.php:644
125
- msgid "Need support?"
126
- msgstr "需要支持吗?"
127
-
128
- #: ../image-watermark.php:645
129
- msgid "If you are having problems with this plugin, please talk about them in the"
130
- msgstr "更多汉化主题和汉化插件请关注逍遥乐汉化-逍遥乐IT博客:<a href=\"http://www.luoxiao123.cn\">逍遥乐汉化</a><br>如果您有这个插件的任何问题,告诉在"
131
-
132
- #: ../image-watermark.php:645
133
- msgid "Support forum"
134
- msgstr "支持论坛"
135
-
136
- #: ../image-watermark.php:647
137
- msgid "Do you like this plugin?"
138
- msgstr "你喜欢这个插件?"
139
-
140
- #: ../image-watermark.php:648
141
- msgid "Rate it 5"
142
- msgstr "评分5"
143
-
144
- #: ../image-watermark.php:648
145
- msgid "on WordPress.org"
146
- msgstr "在 WordPress.org<br>如果你有更多汉化问题请访问逍遥乐汉化:<a href=\"http://www.luoxiao123.cn\">逍遥乐汉化</a>"
147
-
148
- #: ../image-watermark.php:649
149
- msgid "Blog about it & link to the"
150
- msgstr "在博客添加关于它的链接"
151
-
152
- #: ../image-watermark.php:649
153
- msgid "plugin page"
154
- msgstr "插件页面"
155
-
156
- #: ../image-watermark.php:650
157
- msgid "Check out our other"
158
- msgstr "看看我们的其他"
159
-
160
- #: ../image-watermark.php:650
161
- msgid "WordPress plugins"
162
- msgstr "WordPress插件"
163
-
164
- #: ../image-watermark.php:653
165
- msgid "Created by"
166
- msgstr "创建者"
167
-
168
- #: ../image-watermark.php:658
169
- msgid "General settings"
170
- msgstr "常规设置"
171
-
172
- #: ../image-watermark.php:661
173
- msgid "Automatic watermarking"
174
- msgstr "自动添加水印"
175
-
176
- #: ../image-watermark.php:665
177
- #: ../image-watermark.php:681
178
- #: ../image-watermark.php:728
179
- #: ../image-watermark.php:744
180
- msgid "on"
181
- msgstr "开启"
182
-
183
- #: ../image-watermark.php:667
184
- #: ../image-watermark.php:683
185
- #: ../image-watermark.php:730
186
- #: ../image-watermark.php:746
187
- msgid "off"
188
- msgstr "关闭"
189
-
190
- #: ../image-watermark.php:670
191
- msgid "Enable or disable watermark for uploaded images."
192
- msgstr "对上传的图片启用或禁用水印。"
193
-
194
- #: ../image-watermark.php:677
195
- msgid "Manual watermarking"
196
- msgstr "手动添加水印"
197
-
198
- #: ../image-watermark.php:686
199
- msgid "Enable or disable Apply Watermark option for images in Media Library."
200
- msgstr "启用或禁用添加水印到媒体库中的图像。"
201
-
202
- #: ../image-watermark.php:693
203
- msgid "Enable watermark for"
204
- msgstr "启用水印"
205
-
206
- #: ../image-watermark.php:702
207
- msgid "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</strong> checking full size is NOT recommended as it's the original image. You may need it later - for removing or changing watermark, image sizes regeneration or any other image manipulations. Use it only if you know what you are doing."
208
- msgstr "选择水印应该出现的图像尺寸<br /><strong>重要提示:</strong> 不推荐选择全尺寸,因为它是原始图像。你以后可能会需要它 - 去除或改变水印,图像尺寸再生或任何其他图像操作,使用它只有当你知道你在做什么。"
209
-
210
- #: ../image-watermark.php:708
211
- msgid "everywhere"
212
- msgstr "所有位置"
213
-
214
- #: ../image-watermark.php:709
215
- msgid "on selected post types only"
216
- msgstr "只在选择的文章类型"
217
-
218
- #: ../image-watermark.php:717
219
- msgid "Check custom post types on which watermark should be applied to uploaded images."
220
- msgstr "选择其中的水印应适用于自定义文章类型上传的图片。"
221
-
222
- #: ../image-watermark.php:724
223
- msgid "Automatic frontend watermarking"
224
- msgstr "自动前端水印"
225
-
226
- #: ../image-watermark.php:733
227
- msgid "Enable or disable watermark for frontend image uploading. (uploading script is not included, but you may use a plugin or custom code). <strong>Notice:</strong> This functionality works only if uploaded images are processed using WordPress native upload methods."
228
- msgstr "启用或禁用水印前端上传图像。 (上传脚本是不包括在内,但你可以使用一个插件或自定义代码)。 <strong>注意:</strong>此功能只有当上传的图片都使用WordPress本地上传方法处理才能实现。"
229
-
230
- #: ../image-watermark.php:740
231
- msgid "Plugin deactivation"
232
- msgstr "停用插件"
233
-
234
- #: ../image-watermark.php:749
235
- msgid "Delete all database settings on plugin deactivation."
236
- msgstr "停用插件时删除所有的数据库设置。"
237
-
238
- #: ../image-watermark.php:755
239
- msgid "Watermark position"
240
- msgstr "水印位置"
241
-
242
- #: ../image-watermark.php:758
243
- msgid "Watermark alignment"
244
- msgstr "水印对齐方式"
245
-
246
- #: ../image-watermark.php:773
247
- msgid "Choose the position of watermark image."
248
- msgstr "选择水印在图片上的位置"
249
-
250
- #: ../image-watermark.php:778
251
- msgid "Watermark offset"
252
- msgstr "水印偏移"
253
-
254
- #: ../image-watermark.php:781
255
- #: ../image-watermark.php:861
256
- msgid "x:"
257
- msgstr "x:"
258
-
259
- #: ../image-watermark.php:781
260
- #: ../image-watermark.php:783
261
- #: ../image-watermark.php:861
262
- #: ../image-watermark.php:863
263
- msgid "px"
264
- msgstr "像素"
265
-
266
- #: ../image-watermark.php:783
267
- #: ../image-watermark.php:863
268
- msgid "y:"
269
- msgstr "y:"
270
-
271
- #: ../image-watermark.php:799
272
- #: ../image-watermark.php:803
273
- msgid "Watermark image"
274
- msgstr "水印图像"
275
-
276
- #: ../image-watermark.php:800
277
- msgid "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
278
- msgstr "配置你的水印图像。可以接受的文件格式为JPEG,PNG,GIF等。"
279
-
280
- #: ../image-watermark.php:806
281
- msgid "Select image"
282
- msgstr "选择图像"
283
-
284
- #: ../image-watermark.php:807
285
- msgid "Turn off image"
286
- msgstr "关闭图像"
287
-
288
- #: ../image-watermark.php:808
289
- msgid "You have to save changes after the selection or removal of the image."
290
- msgstr "您必须选择或清除图像后保存更改。"
291
-
292
- #: ../image-watermark.php:812
293
- msgid "Watermark preview"
294
- msgstr "水印预览"
295
-
296
- #: ../image-watermark.php:842
297
- msgid "Watermark size"
298
- msgstr "水印大小"
299
-
300
- #: ../image-watermark.php:846
301
- msgid "original"
302
- msgstr "原始"
303
-
304
- #: ../image-watermark.php:848
305
- msgid "custom"
306
- msgstr "自定义"
307
-
308
- #: ../image-watermark.php:850
309
- msgid "scaled"
310
- msgstr "缩放"
311
-
312
- #: ../image-watermark.php:853
313
- msgid "Select method of aplying watermark size."
314
- msgstr "选择用于确定水印大小的方法。"
315
-
316
- #: ../image-watermark.php:858
317
- msgid "Watermark custom size"
318
- msgstr "水印自定义尺寸"
319
-
320
- #: ../image-watermark.php:865
321
- msgid "Those dimensions will be used if \"custom\" method is selected above."
322
- msgstr "如果上面选择 \"自定义 \"方法,这些尺寸将被使用。"
323
-
324
- #: ../image-watermark.php:869
325
- msgid "Scale of watermark in relation to image width"
326
- msgstr "水印相对于图像的宽度规模"
327
-
328
- #: ../image-watermark.php:879
329
- msgid "This value will be used if \"scaled\" method if selected above. <br />Enter a number ranging from 0 to 100. 100 makes width of watermark image equal to width of the image it is applied to."
330
- msgstr "如果选择上面\"缩放\"方法,这个值将被使用。 <br />输入一个数字范围从0到100。如果为100使得宽度的水印图像等于宽度将它应用到图像的,即宽度为100%。"
331
-
332
- #: ../image-watermark.php:883
333
- msgid "Watermark transparency / opacity"
334
- msgstr "水印透明/不透明"
335
-
336
- #: ../image-watermark.php:893
337
- msgid "Enter a number ranging from 0 to 100. 0 makes watermark image completely transparent, 100 shows it as is."
338
- msgstr "输入一个数字范围:从0到100。0使得水印图像完全透明,100表示保持原样。"
339
-
340
- #: ../image-watermark.php:897
341
- msgid "Image quality"
342
- msgstr "图像质量"
343
-
344
- #: ../image-watermark.php:907
345
- msgid "Set output image quality."
346
- msgstr "设置输出的图像质量。"
347
-
348
- #: ../image-watermark.php:911
349
- msgid "Image format"
350
- msgstr "图像格式"
351
-
352
- #: ../image-watermark.php:915
353
- msgid "baseline"
354
- msgstr "基线"
355
-
356
- #: ../image-watermark.php:917
357
- msgid "progressive"
358
- msgstr "逐行"
359
-
360
- #: ../image-watermark.php:921
361
- msgid "Select baseline or progressive image format."
362
- msgstr "选择图像格式。"
363
-
364
- #: ../image-watermark.php:927
365
- msgid "Image protection"
366
- msgstr "图像保护"
367
-
368
- #: ../image-watermark.php:930
369
- msgid "Disable right mouse click on images"
370
- msgstr "禁用鼠标右键点击图片"
371
-
372
- #: ../image-watermark.php:934
373
- msgid "Prevent drag and drop"
374
- msgstr "防止拖放"
375
-
376
- #: ../image-watermark.php:938
377
- msgid "Enable image protection for logged-in users also"
378
- msgstr "对登录用户也启用图像保护"
379
-
380
- #: ../image-watermark.php:943
381
- msgid "Save Changes"
382
- msgstr "保存更改"
383
-
384
- #: ../image-watermark.php:944
385
- msgid "Reset to defaults"
386
- msgstr "重置为默认值"
387
-
388
- #~ msgid ""
389
- #~ "Check image sizes on which watermark should appear. <b>Notice:</b> "
390
- #~ "checking full size is not recommened as it's the original image."
391
- #~ msgstr ""
392
- #~ "Zaznacz wielkości obazków dla których będzie dodany znak wodny. <b>Uwaga:"
393
- #~ "</b> zaznaczenie pełnej wielkości nie jest rekomendowane, ponieważ jest "
394
- #~ "to oryginał obrazka."
395
-
396
- #, fuzzy
397
- #~ msgid "Enable or disable watermark for uploaded images on frontend."
398
- #~ msgstr "Włącz lub wyłącz dodawanie znaku wodnego do wgrywanych obrazków."
399
-
400
- #~ msgid "Check image sizes on which watermark should appear."
401
- #~ msgstr "Zaznacz wielkości obrazków dla których ma być dodawany znak wodny."
402
-
403
- #~ msgid "Width"
404
- #~ msgstr "Szerokość"
405
-
406
- #~ msgid "Watermark Preview"
407
- #~ msgstr "Podgląd obrazka"
408
-
409
- #~ msgid "WordPress Watermark"
410
- #~ msgstr "Znak wodny"
411
-
412
- #~ msgid "Options updated."
413
- #~ msgstr "Ustawienia zostały zaktualizowane"
414
-
415
- #~ msgid "Watermark image URL"
416
- #~ msgstr "Ścieżka do obrazka"
417
-
418
- #~ msgid "Upload Image"
419
- #~ msgstr "Wgraj obrazek"
420
-
421
- #~ msgid ""
422
- #~ "Enter an URL, upload an image or select image from media library.<br /"
423
- #~ "><b>Important:</b> You must select a <b>file URL</b> while inserting "
424
- #~ "image."
425
- #~ msgstr ""
426
- #~ "Podaj adres URL, wgraj obrazek lub wybierz obrazek z biblioteki mediów."
427
- #~ "<br /><b>Ważne:</b> Dodając obrazek musisz zaznaczyć <b>Adres URL pliku</"
428
- #~ "b>."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/image-watermark.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WordPress Watermark\n"
5
- "POT-Creation-Date: 2015-07-16 20:09+0200\n"
6
  "PO-Revision-Date: 2015-05-15 19:55+0100\n"
7
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
8
  "Language-Team: dFactory <info@dfactory.pl>\n"
@@ -10,7 +10,7 @@ msgstr ""
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Poedit 1.8.2\n"
14
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
15
  "_n:1,2\n"
16
  "X-Poedit-Basepath: .\n"
@@ -18,224 +18,332 @@ msgstr ""
18
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
- #: ../image-watermark.php:197 ../image-watermark.php:198
22
  msgid "Apply watermark"
23
  msgstr ""
24
 
25
- #: ../image-watermark.php:222
 
 
 
 
26
  msgid "Select watermark"
27
  msgstr ""
28
 
29
- #: ../image-watermark.php:223 ../image-watermark.php:705
30
  msgid "Original size"
31
  msgstr ""
32
 
33
- #: ../image-watermark.php:224 ../image-watermark.php:701
34
  msgid "Watermak has not been selected yet."
35
  msgstr ""
36
 
37
- #: ../image-watermark.php:225
38
  msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
39
  msgstr ""
40
 
41
- #: ../image-watermark.php:227
42
- msgid "Add watermark"
 
 
43
  msgstr ""
44
 
45
- #: ../image-watermark.php:240
46
- msgid "Are you sure you want to reset settings to defaults?"
47
  msgstr ""
48
 
49
- #: ../image-watermark.php:393
50
- #, php-format
51
- msgid ""
52
- "<strong>Image Watermark:</strong> Bulk watermarking is available in list "
53
- "mode only, under <em>Bulk Actions</em> dropdown. <a href=\"%1$s\">Got to "
54
- "List Mode</a> or <a href=\"%2$s\">Hide this notice</a>"
55
  msgstr ""
56
 
57
- #: ../image-watermark.php:402
58
  msgid ""
59
  "Watermark could not be applied to selected files or no valid images (JPEG, "
60
  "PNG) were selected."
61
  msgstr ""
62
 
63
- #: ../image-watermark.php:402
64
- msgid "Images skipped"
65
- msgstr ""
66
-
67
- #: ../image-watermark.php:404
68
  #, php-format
69
  msgid "Watermark was succesfully applied to 1 image."
70
  msgid_plural "Watermark was succesfully applied to %s images."
71
  msgstr[0] ""
72
  msgstr[1] ""
73
 
74
- #: ../image-watermark.php:404
75
- msgid "Skipped files"
76
- msgstr ""
77
-
78
- #: ../image-watermark.php:417
79
- msgid "Image Watermark Options"
80
  msgstr ""
81
 
82
- #: ../image-watermark.php:417
83
- msgid "Watermark"
 
 
84
  msgstr ""
85
 
86
- #: ../image-watermark.php:431 ../image-watermark.php:437
87
- msgid "Image Watermark"
88
- msgstr ""
 
 
 
89
 
90
- #: ../image-watermark.php:439
91
- msgid "Need support?"
 
92
  msgstr ""
93
 
94
- #: ../image-watermark.php:440
95
- msgid "If you are having problems with this plugin, checkout plugin"
 
96
  msgstr ""
97
 
98
- #: ../image-watermark.php:440
99
- msgid "Documentation"
100
  msgstr ""
101
 
102
- #: ../image-watermark.php:440
103
- msgid "or talk about them in the"
104
  msgstr ""
105
 
106
- #: ../image-watermark.php:440
107
- msgid "Support forum"
 
108
  msgstr ""
109
 
110
- #: ../image-watermark.php:442
111
- msgid "Do you like this plugin?"
112
  msgstr ""
113
 
114
- #: ../image-watermark.php:449
115
- msgid "Rate it 5"
 
 
 
 
116
  msgstr ""
117
 
118
- #: ../image-watermark.php:449
119
- msgid "on WordPress.org"
120
  msgstr ""
121
 
122
- #: ../image-watermark.php:450
123
- msgid "Blog about it & link to the"
124
  msgstr ""
125
 
126
- #: ../image-watermark.php:450
127
- msgid "plugin page"
128
  msgstr ""
129
 
130
- #: ../image-watermark.php:451
131
- msgid "Check out our other"
 
 
132
  msgstr ""
133
 
134
- #: ../image-watermark.php:451
135
- msgid "WordPress plugins"
136
  msgstr ""
137
 
138
- #: ../image-watermark.php:454
139
- msgid "Created by"
140
  msgstr ""
141
 
142
- #: ../image-watermark.php:466
143
- msgid "Reset to defaults"
144
  msgstr ""
145
 
146
- #: ../image-watermark.php:481
147
- msgid "General settings"
148
  msgstr ""
149
 
150
- #: ../image-watermark.php:482
151
  msgid "Automatic watermarking"
152
  msgstr ""
153
 
154
- #: ../image-watermark.php:483
155
  msgid "Manual watermarking"
156
  msgstr ""
157
 
158
- #: ../image-watermark.php:484
159
  msgid "Enable watermark for"
160
  msgstr ""
161
 
162
- #: ../image-watermark.php:485
163
  msgid "Frontend watermarking"
164
  msgstr ""
165
 
166
- #: ../image-watermark.php:486
167
  msgid "Deactivation"
168
  msgstr ""
169
 
170
- #: ../image-watermark.php:488
171
  msgid "Watermark position"
172
  msgstr ""
173
 
174
- #: ../image-watermark.php:489
175
  msgid "Watermark alignment"
176
  msgstr ""
177
 
178
- #: ../image-watermark.php:490
179
  msgid "Watermark offset"
180
  msgstr ""
181
 
182
- #: ../image-watermark.php:492 ../image-watermark.php:493
183
  msgid "Watermark image"
184
  msgstr ""
185
 
186
- #: ../image-watermark.php:494
187
  msgid "Watermark preview"
188
  msgstr ""
189
 
190
- #: ../image-watermark.php:495
191
  msgid "Watermark size"
192
  msgstr ""
193
 
194
- #: ../image-watermark.php:496
195
  msgid "Watermark custom size"
196
  msgstr ""
197
 
198
- #: ../image-watermark.php:497
199
  msgid "Scale of watermark in relation to image width"
200
  msgstr ""
201
 
202
- #: ../image-watermark.php:498
203
  msgid "Watermark transparency / opacity"
204
  msgstr ""
205
 
206
- #: ../image-watermark.php:499
207
  msgid "Image quality"
208
  msgstr ""
209
 
210
- #: ../image-watermark.php:500
211
  msgid "Image format"
212
  msgstr ""
213
 
214
- #: ../image-watermark.php:502
215
  msgid "Image protection"
216
  msgstr ""
217
 
218
- #: ../image-watermark.php:503
219
  msgid "Right click"
220
  msgstr ""
221
 
222
- #: ../image-watermark.php:504
223
  msgid "Drag and drop"
224
  msgstr ""
225
 
226
- #: ../image-watermark.php:505
227
  msgid "Logged-in users"
228
  msgstr ""
229
 
230
- #: ../image-watermark.php:515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  msgid "Enable watermark for uploaded images."
232
  msgstr ""
233
 
234
- #: ../image-watermark.php:527
235
  msgid "Enable Apply Watermark option for images in Media Library."
236
  msgstr ""
237
 
238
- #: ../image-watermark.php:549
239
  msgid ""
240
  "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
241
  "strong> checking full size is NOT recommended as it's the original image. "
@@ -244,146 +352,125 @@ msgid ""
244
  "you are doing."
245
  msgstr ""
246
 
247
- #: ../image-watermark.php:566
248
  msgid "everywhere"
249
  msgstr ""
250
 
251
- #: ../image-watermark.php:567
252
  msgid "on selected post types only"
253
  msgstr ""
254
 
255
- #: ../image-watermark.php:581
256
  msgid ""
257
  "Check custom post types on which watermark should be applied to uploaded "
258
  "images."
259
  msgstr ""
260
 
261
- #: ../image-watermark.php:593
262
  msgid ""
263
  "Enable frontend image uploading. (uploading script is not included, but you "
264
  "may use a plugin or custom code)."
265
  msgstr ""
266
 
267
- #: ../image-watermark.php:595
268
  msgid ""
269
  "<br /><strong>Notice:</strong> This functionality works only if uploaded "
270
  "images are processed using WordPress native upload methods."
271
  msgstr ""
272
 
273
- #: ../image-watermark.php:606
274
  msgid "Delete all database settings on plugin deactivation."
275
  msgstr ""
276
 
277
- #: ../image-watermark.php:637
278
  msgid "Choose the position of watermark image."
279
  msgstr ""
280
 
281
- #: ../image-watermark.php:648 ../image-watermark.php:738
282
  msgid "x:"
283
  msgstr ""
284
 
285
- #: ../image-watermark.php:648 ../image-watermark.php:650
286
- #: ../image-watermark.php:738 ../image-watermark.php:740
287
- msgid "px"
288
- msgstr ""
289
-
290
- #: ../image-watermark.php:650 ../image-watermark.php:740
291
  msgid "y:"
292
  msgstr ""
293
 
294
- #: ../image-watermark.php:668
295
  msgid "Select image"
296
  msgstr ""
297
 
298
- #: ../image-watermark.php:669
299
  msgid "Remove image"
300
  msgstr ""
301
 
302
- #: ../image-watermark.php:670
303
  msgid "You have to save changes after the selection or removal of the image."
304
  msgstr ""
305
 
306
- #: ../image-watermark.php:720
307
  msgid "original"
308
  msgstr ""
309
 
310
- #: ../image-watermark.php:722
311
  msgid "custom"
312
  msgstr ""
313
 
314
- #: ../image-watermark.php:724
315
  msgid "scaled"
316
  msgstr ""
317
 
318
- #: ../image-watermark.php:727
319
  msgid "Select method of aplying watermark size."
320
  msgstr ""
321
 
322
- #: ../image-watermark.php:742
323
  msgid "Those dimensions will be used if \"custom\" method is selected above."
324
  msgstr ""
325
 
326
- #: ../image-watermark.php:759
327
  msgid ""
328
  "This value will be used if \"scaled\" method if selected above. <br />Enter "
329
  "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
330
  "width of the image it is applied to."
331
  msgstr ""
332
 
333
- #: ../image-watermark.php:776
334
  msgid ""
335
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
336
  "transparent, 100 shows it as is."
337
  msgstr ""
338
 
339
- #: ../image-watermark.php:793
340
  msgid "Set output image quality."
341
  msgstr ""
342
 
343
- #: ../image-watermark.php:804
344
  msgid "baseline"
345
  msgstr ""
346
 
347
- #: ../image-watermark.php:806
348
  msgid "progressive"
349
  msgstr ""
350
 
351
- #: ../image-watermark.php:810
352
  msgid "Select baseline or progressive image format."
353
  msgstr ""
354
 
355
- #: ../image-watermark.php:821
356
  msgid "Disable right mouse click on images"
357
  msgstr ""
358
 
359
- #: ../image-watermark.php:833
360
  msgid "Prevent drag and drop"
361
  msgstr ""
362
 
363
- #: ../image-watermark.php:845
364
  msgid "Enable image protection for logged-in users also"
365
  msgstr ""
366
 
367
- #: ../image-watermark.php:924
368
- msgid "Settings saved."
369
  msgstr ""
370
 
371
- #: ../image-watermark.php:929
372
- msgid "Settings restored to defaults."
373
- msgstr ""
374
-
375
- #: ../image-watermark.php:934
376
- msgid "Watermark will not be applied when watermark image is not set."
377
- msgstr ""
378
-
379
- #: ../image-watermark.php:937
380
- msgid "Watermark will not be applied when no image sizes are selected."
381
- msgstr ""
382
-
383
- #: ../image-watermark.php:1249
384
- msgid "Support"
385
- msgstr ""
386
-
387
- #: ../image-watermark.php:1272
388
- msgid "Settings"
389
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WordPress Watermark\n"
5
+ "POT-Creation-Date: 2016-12-22 13:03+0100\n"
6
  "PO-Revision-Date: 2015-05-15 19:55+0100\n"
7
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
8
  "Language-Team: dFactory <info@dfactory.pl>\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 1.8.11\n"
14
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
15
  "_n:1,2\n"
16
  "X-Poedit-Basepath: .\n"
18
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
+ #: ../image-watermark.php:245 ../image-watermark.php:450
22
  msgid "Apply watermark"
23
  msgstr ""
24
 
25
+ #: ../image-watermark.php:248 ../image-watermark.php:450
26
+ msgid "Remove watermark"
27
+ msgstr ""
28
+
29
+ #: ../image-watermark.php:282
30
  msgid "Select watermark"
31
  msgstr ""
32
 
33
+ #: ../image-watermark.php:283 ../includes/class-settings.php:511
34
  msgid "Original size"
35
  msgstr ""
36
 
37
+ #: ../image-watermark.php:284 ../includes/class-settings.php:507
38
  msgid "Watermak has not been selected yet."
39
  msgstr ""
40
 
41
+ #: ../image-watermark.php:285
42
  msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
43
  msgstr ""
44
 
45
+ #: ../image-watermark.php:286 ../includes/class-settings.php:451
46
+ #: ../includes/class-settings.php:453 ../includes/class-settings.php:511
47
+ #: ../includes/class-settings.php:548 ../includes/class-settings.php:550
48
+ msgid "px"
49
  msgstr ""
50
 
51
+ #: ../image-watermark.php:288
52
+ msgid "Add watermark"
53
  msgstr ""
54
 
55
+ #: ../image-watermark.php:297
56
+ msgid "Are you sure you want to reset settings to defaults?"
 
 
 
 
57
  msgstr ""
58
 
59
+ #: ../image-watermark.php:320 ../image-watermark.php:642
60
  msgid ""
61
  "Watermark could not be applied to selected files or no valid images (JPEG, "
62
  "PNG) were selected."
63
  msgstr ""
64
 
65
+ #: ../image-watermark.php:321 ../image-watermark.php:644
 
 
 
 
66
  #, php-format
67
  msgid "Watermark was succesfully applied to 1 image."
68
  msgid_plural "Watermark was succesfully applied to %s images."
69
  msgstr[0] ""
70
  msgstr[1] ""
71
 
72
+ #: ../image-watermark.php:322
73
+ #, php-format
74
+ msgid "Watermark was succesfully applied to %s images."
 
 
 
75
  msgstr ""
76
 
77
+ #: ../image-watermark.php:323 ../image-watermark.php:647
78
+ msgid ""
79
+ "Watermark could not be removed from selected files or no valid images (JPEG, "
80
+ "PNG) were selected."
81
  msgstr ""
82
 
83
+ #: ../image-watermark.php:324 ../image-watermark.php:649
84
+ #, php-format
85
+ msgid "Watermark was succesfully removed from 1 image."
86
+ msgid_plural "Watermark was succesfully removed from %s images."
87
+ msgstr[0] ""
88
+ msgstr[1] ""
89
 
90
+ #: ../image-watermark.php:325
91
+ #, php-format
92
+ msgid "Watermark was succesfully removed from %s images."
93
  msgstr ""
94
 
95
+ #: ../image-watermark.php:326 ../image-watermark.php:644
96
+ #: ../image-watermark.php:649
97
+ msgid "Skipped files"
98
  msgstr ""
99
 
100
+ #: ../image-watermark.php:327
101
+ msgid "Bulk action is currently running, please wait."
102
  msgstr ""
103
 
104
+ #: ../image-watermark.php:328
105
+ msgid "Dismiss this notice."
106
  msgstr ""
107
 
108
+ #: ../image-watermark.php:449 ../image-watermark.php:1044
109
+ #: ../includes/class-settings.php:116 ../includes/class-settings.php:122
110
+ msgid "Image Watermark"
111
  msgstr ""
112
 
113
+ #: ../image-watermark.php:474 ../image-watermark.php:515
114
+ msgid "Cheatin uh?"
115
  msgstr ""
116
 
117
+ #: ../image-watermark.php:632
118
+ #, php-format
119
+ msgid ""
120
+ "<strong>Image Watermark:</strong> Bulk watermarking is available in list "
121
+ "mode only, under <em>Bulk Actions</em> dropdown. <a href=\"%1$s\">Got to "
122
+ "List Mode</a> or <a href=\"%2$s\">Hide this notice</a>"
123
  msgstr ""
124
 
125
+ #: ../image-watermark.php:642 ../image-watermark.php:647
126
+ msgid "Images skipped"
127
  msgstr ""
128
 
129
+ #: ../image-watermark.php:709
130
+ msgid "Watermark prevented, this is your selected watermark image"
131
  msgstr ""
132
 
133
+ #: ../image-watermark.php:1044 ../includes/class-settings.php:92
134
+ msgid "Image backup"
135
  msgstr ""
136
 
137
+ #: ../image-watermark.php:1044
138
+ msgid ""
139
+ "Your uploads folder is not writable so we can't create a backup of your "
140
+ "image uploads. We've disabled this feature for now."
141
  msgstr ""
142
 
143
+ #: ../image-watermark.php:1286
144
+ msgid "Support"
145
  msgstr ""
146
 
147
+ #: ../image-watermark.php:1309
148
+ msgid "Settings"
149
  msgstr ""
150
 
151
+ #: ../includes/class-settings.php:56
152
+ msgid "General settings"
153
  msgstr ""
154
 
155
+ #: ../includes/class-settings.php:60
156
+ msgid "PHP library"
157
  msgstr ""
158
 
159
+ #: ../includes/class-settings.php:63
160
  msgid "Automatic watermarking"
161
  msgstr ""
162
 
163
+ #: ../includes/class-settings.php:64
164
  msgid "Manual watermarking"
165
  msgstr ""
166
 
167
+ #: ../includes/class-settings.php:65
168
  msgid "Enable watermark for"
169
  msgstr ""
170
 
171
+ #: ../includes/class-settings.php:66
172
  msgid "Frontend watermarking"
173
  msgstr ""
174
 
175
+ #: ../includes/class-settings.php:67
176
  msgid "Deactivation"
177
  msgstr ""
178
 
179
+ #: ../includes/class-settings.php:70
180
  msgid "Watermark position"
181
  msgstr ""
182
 
183
+ #: ../includes/class-settings.php:71
184
  msgid "Watermark alignment"
185
  msgstr ""
186
 
187
+ #: ../includes/class-settings.php:72
188
  msgid "Watermark offset"
189
  msgstr ""
190
 
191
+ #: ../includes/class-settings.php:75 ../includes/class-settings.php:76
192
  msgid "Watermark image"
193
  msgstr ""
194
 
195
+ #: ../includes/class-settings.php:77
196
  msgid "Watermark preview"
197
  msgstr ""
198
 
199
+ #: ../includes/class-settings.php:78
200
  msgid "Watermark size"
201
  msgstr ""
202
 
203
+ #: ../includes/class-settings.php:79
204
  msgid "Watermark custom size"
205
  msgstr ""
206
 
207
+ #: ../includes/class-settings.php:80
208
  msgid "Scale of watermark in relation to image width"
209
  msgstr ""
210
 
211
+ #: ../includes/class-settings.php:81
212
  msgid "Watermark transparency / opacity"
213
  msgstr ""
214
 
215
+ #: ../includes/class-settings.php:82
216
  msgid "Image quality"
217
  msgstr ""
218
 
219
+ #: ../includes/class-settings.php:83
220
  msgid "Image format"
221
  msgstr ""
222
 
223
+ #: ../includes/class-settings.php:86
224
  msgid "Image protection"
225
  msgstr ""
226
 
227
+ #: ../includes/class-settings.php:87
228
  msgid "Right click"
229
  msgstr ""
230
 
231
+ #: ../includes/class-settings.php:88
232
  msgid "Drag and drop"
233
  msgstr ""
234
 
235
+ #: ../includes/class-settings.php:89
236
  msgid "Logged-in users"
237
  msgstr ""
238
 
239
+ #: ../includes/class-settings.php:93
240
+ msgid "Backup full size image"
241
+ msgstr ""
242
+
243
+ #: ../includes/class-settings.php:94
244
+ msgid "Backup image quality"
245
+ msgstr ""
246
+
247
+ #: ../includes/class-settings.php:102
248
+ msgid "Image Watermark Options"
249
+ msgstr ""
250
+
251
+ #: ../includes/class-settings.php:102
252
+ msgid "Watermark"
253
+ msgstr ""
254
+
255
+ #: ../includes/class-settings.php:124
256
+ msgid "Need support?"
257
+ msgstr ""
258
+
259
+ #: ../includes/class-settings.php:125
260
+ msgid "If you are having problems with this plugin, checkout plugin"
261
+ msgstr ""
262
+
263
+ #: ../includes/class-settings.php:125
264
+ msgid "Documentation"
265
+ msgstr ""
266
+
267
+ #: ../includes/class-settings.php:125
268
+ msgid "or talk about them in the"
269
+ msgstr ""
270
+
271
+ #: ../includes/class-settings.php:125
272
+ msgid "Support forum"
273
+ msgstr ""
274
+
275
+ #: ../includes/class-settings.php:127
276
+ msgid "Do you like this plugin?"
277
+ msgstr ""
278
+
279
+ #: ../includes/class-settings.php:128
280
+ msgid "Rate it 5"
281
+ msgstr ""
282
+
283
+ #: ../includes/class-settings.php:128
284
+ msgid "on WordPress.org"
285
+ msgstr ""
286
+
287
+ #: ../includes/class-settings.php:129
288
+ msgid "Blog about it & link to the"
289
+ msgstr ""
290
+
291
+ #: ../includes/class-settings.php:129
292
+ msgid "plugin page"
293
+ msgstr ""
294
+
295
+ #: ../includes/class-settings.php:130
296
+ msgid "Check out our other"
297
+ msgstr ""
298
+
299
+ #: ../includes/class-settings.php:130
300
+ msgid "WordPress plugins"
301
+ msgstr ""
302
+
303
+ #: ../includes/class-settings.php:133
304
+ msgid "Created by"
305
+ msgstr ""
306
+
307
+ #: ../includes/class-settings.php:137
308
+ msgid "Need image optimization?"
309
+ msgstr ""
310
+
311
+ #: ../includes/class-settings.php:138
312
+ #, php-format
313
+ msgid ""
314
+ "Speed up your site with <a href=\"%s\" target=\"_blank\">ShortPixel</a>. "
315
+ "Sign up as Image Watermark user and get 50&#37; extra monthly optimizations!"
316
+ msgstr ""
317
+
318
+ #: ../includes/class-settings.php:152
319
+ msgid "Reset to defaults"
320
+ msgstr ""
321
+
322
+ #: ../includes/class-settings.php:255
323
+ msgid "Settings saved."
324
+ msgstr ""
325
+
326
+ #: ../includes/class-settings.php:260
327
+ msgid "Settings restored to defaults."
328
+ msgstr ""
329
+
330
+ #: ../includes/class-settings.php:265
331
+ msgid "Watermark will not be applied when watermark image is not set."
332
+ msgstr ""
333
+
334
+ #: ../includes/class-settings.php:268
335
+ msgid "Watermark will not be applied when no image sizes are selected."
336
+ msgstr ""
337
+
338
+ #: ../includes/class-settings.php:306
339
  msgid "Enable watermark for uploaded images."
340
  msgstr ""
341
 
342
+ #: ../includes/class-settings.php:320
343
  msgid "Enable Apply Watermark option for images in Media Library."
344
  msgstr ""
345
 
346
+ #: ../includes/class-settings.php:344
347
  msgid ""
348
  "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
349
  "strong> checking full size is NOT recommended as it's the original image. "
352
  "you are doing."
353
  msgstr ""
354
 
355
+ #: ../includes/class-settings.php:361
356
  msgid "everywhere"
357
  msgstr ""
358
 
359
+ #: ../includes/class-settings.php:362
360
  msgid "on selected post types only"
361
  msgstr ""
362
 
363
+ #: ../includes/class-settings.php:376
364
  msgid ""
365
  "Check custom post types on which watermark should be applied to uploaded "
366
  "images."
367
  msgstr ""
368
 
369
+ #: ../includes/class-settings.php:390
370
  msgid ""
371
  "Enable frontend image uploading. (uploading script is not included, but you "
372
  "may use a plugin or custom code)."
373
  msgstr ""
374
 
375
+ #: ../includes/class-settings.php:392
376
  msgid ""
377
  "<br /><strong>Notice:</strong> This functionality works only if uploaded "
378
  "images are processed using WordPress native upload methods."
379
  msgstr ""
380
 
381
+ #: ../includes/class-settings.php:405
382
  msgid "Delete all database settings on plugin deactivation."
383
  msgstr ""
384
 
385
+ #: ../includes/class-settings.php:438
386
  msgid "Choose the position of watermark image."
387
  msgstr ""
388
 
389
+ #: ../includes/class-settings.php:451 ../includes/class-settings.php:548
390
  msgid "x:"
391
  msgstr ""
392
 
393
+ #: ../includes/class-settings.php:453 ../includes/class-settings.php:550
 
 
 
 
 
394
  msgid "y:"
395
  msgstr ""
396
 
397
+ #: ../includes/class-settings.php:473
398
  msgid "Select image"
399
  msgstr ""
400
 
401
+ #: ../includes/class-settings.php:474
402
  msgid "Remove image"
403
  msgstr ""
404
 
405
+ #: ../includes/class-settings.php:475
406
  msgid "You have to save changes after the selection or removal of the image."
407
  msgstr ""
408
 
409
+ #: ../includes/class-settings.php:528
410
  msgid "original"
411
  msgstr ""
412
 
413
+ #: ../includes/class-settings.php:530
414
  msgid "custom"
415
  msgstr ""
416
 
417
+ #: ../includes/class-settings.php:532
418
  msgid "scaled"
419
  msgstr ""
420
 
421
+ #: ../includes/class-settings.php:535
422
  msgid "Select method of aplying watermark size."
423
  msgstr ""
424
 
425
+ #: ../includes/class-settings.php:552
426
  msgid "Those dimensions will be used if \"custom\" method is selected above."
427
  msgstr ""
428
 
429
+ #: ../includes/class-settings.php:571
430
  msgid ""
431
  "This value will be used if \"scaled\" method if selected above. <br />Enter "
432
  "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
433
  "width of the image it is applied to."
434
  msgstr ""
435
 
436
+ #: ../includes/class-settings.php:590
437
  msgid ""
438
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
439
  "transparent, 100 shows it as is."
440
  msgstr ""
441
 
442
+ #: ../includes/class-settings.php:609 ../includes/class-settings.php:703
443
  msgid "Set output image quality."
444
  msgstr ""
445
 
446
+ #: ../includes/class-settings.php:622
447
  msgid "baseline"
448
  msgstr ""
449
 
450
+ #: ../includes/class-settings.php:624
451
  msgid "progressive"
452
  msgstr ""
453
 
454
+ #: ../includes/class-settings.php:628
455
  msgid "Select baseline or progressive image format."
456
  msgstr ""
457
 
458
+ #: ../includes/class-settings.php:641
459
  msgid "Disable right mouse click on images"
460
  msgstr ""
461
 
462
+ #: ../includes/class-settings.php:655
463
  msgid "Prevent drag and drop"
464
  msgstr ""
465
 
466
+ #: ../includes/class-settings.php:669
467
  msgid "Enable image protection for logged-in users also"
468
  msgstr ""
469
 
470
+ #: ../includes/class-settings.php:683
471
+ msgid "Backup the full size image."
472
  msgstr ""
473
 
474
+ #: ../includes/class-settings.php:726
475
+ msgid "Toggle panel"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  msgstr ""
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: image, images, picture, photo, watermark, watermarking, protection, image protection, image security, plugin
5
- Requires at least: 3.5
6
- Tested up to: 4.6
7
- Stable tag: 1.6.0
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -21,11 +21,12 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
21
  * Bulk watermark - Apply watermark option in Media Library actions
22
  * Watermark images already uploaded to Media Library
23
  * GD LIbrary and ImageMagic support
24
- * Choose the position of watermark image
25
- * Upload custom watermark image
 
26
  * Watermark image preview
27
  * Set watermark offset
28
- * Select post types where watermark will be aplied to images or select adding watermark during any image upload
29
  * Select from 3 methods of aplying watermark size: original, custom or scaled
30
  * Set watermark transparency / opacity
31
  * Select image format (baseline or progressive)
@@ -53,6 +54,11 @@ No questions yet.
53
 
54
  == Changelog ==
55
 
 
 
 
 
 
56
  = 1.6.0 =
57
  * New: Image backup functionality, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
58
  * New: Option to remove watermark (if backup is available)
@@ -161,6 +167,5 @@ Initial release
161
 
162
  == Upgrade Notice ==
163
 
164
- = 1.6.0 =
165
- * New: Image backup functionality, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
166
- * New: Option to remove watermark (if backup is available)
2
  Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: image, images, picture, photo, watermark, watermarking, protection, image protection, image security, plugin
5
+ Requires at least: 4.0
6
+ Tested up to: 4.7
7
+ Stable tag: 1.6.1
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
21
  * Bulk watermark - Apply watermark option in Media Library actions
22
  * Watermark images already uploaded to Media Library
23
  * GD LIbrary and ImageMagic support
24
+ * Image backup functionality
25
+ * Option to remove watermark
26
+ * Flexible watermark position
27
  * Watermark image preview
28
  * Set watermark offset
29
+ * Select post types where watermark will be aplied to uploaded images or select adding watermark during any image upload
30
  * Select from 3 methods of aplying watermark size: original, custom or scaled
31
  * Set watermark transparency / opacity
32
  * Select image format (baseline or progressive)
54
 
55
  == Changelog ==
56
 
57
+ = 1.6.1 =
58
+ * Fix: Minor bug with AJAX requests, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
59
+ * Fix: Prevent watermarking the watermark image, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
60
+ * Tweak: Code cleanup
61
+
62
  = 1.6.0 =
63
  * New: Image backup functionality, thanks to [JoryHogeveen](https://github.com/JoryHogeveen)
64
  * New: Option to remove watermark (if backup is available)
167
 
168
  == Upgrade Notice ==
169
 
170
+ = 1.6.1 =
171
+ * Fix: Minor bug with AJAX requests * Fix: Prevent watermarking the watermark image * Tweak: Code cleanup