Image Watermark - Version 1.5.0

Version Description

  • Tweak: Plugins setting adjusted to WP settings API
  • Tweak: General code cleanup
  • Tweak: Added Media Library bulk watermarking notice
Download this release

Release Info

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

Code changes from version 1.4.1 to 1.5.0

image-watermark.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Image Watermark
4
  Description: Image Watermark allows you to automatically watermark images uploaded to the WordPress Media Library and bulk watermark previously uploaded images.
5
- Version: 1.4.1
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
@@ -12,7 +12,7 @@ Text Domain: image-watermark
12
  Domain Path: /languages
13
 
14
  Image Watermark
15
- Copyright (C) 2013, 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
 
@@ -21,1153 +21,1064 @@ The above copyright notice and this permission notice shall be included in all c
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
-
25
- global $wp_version;
26
-
27
- if(version_compare(PHP_VERSION, '5.0', '<') || version_compare($wp_version, '3.5', '<'))
28
- {
29
- wp_die(__('Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher.'));
30
- }
31
-
32
-
33
- class Image_Watermark
34
- {
35
- private $is_admin = TRUE;
36
- private $_messages = array();
37
- private $_image_sizes = array();
38
- private $_watermark_positions = array (
39
- 'x' => array('left', 'center', 'right'),
40
- 'y' => array('top', 'middle', 'bottom'),
41
  );
42
- private $_allowed_mime_types = array(
43
  'image/jpeg',
44
  'image/pjpeg',
45
  'image/png'
46
  );
47
- protected $_options = array(
48
- 'df_watermark_on' => array(),
49
- 'df_watermark_cpt_on' => array('everywhere'),
50
- 'df_watermark_image' => array(
51
- 'url' => 0,
52
- 'width' => 80,
53
- 'plugin_off' => 0,
54
- 'frontend_active' => FALSE,
55
- 'manual_watermarking' => 0,
56
- 'position' => 'bottom_right',
57
- 'watermark_size_type' => 2,
58
- 'offset_width' => 0,
59
- 'offset_height' => 0,
60
- 'absolute_width' => 0,
61
- 'absolute_height' => 0,
62
- 'transparent' => 50,
63
- 'quality' => 90,
64
- 'jpeg_format' => 'baseline',
65
- 'deactivation_delete' => FALSE
 
 
 
 
 
 
 
 
66
  ),
67
- 'df_image_protection' => array(
68
- 'rightclick' => 0,
69
- 'draganddrop' => 0,
70
- 'forlogged' => 0,
71
- ),
72
- 'version' => '1.4.1'
73
  );
74
-
75
-
76
- public function __construct()
77
- {
78
- //register installer function
79
- register_activation_hook(__FILE__, array(&$this, 'activate_watermark'));
80
- register_deactivation_hook(__FILE__, array(&$this, 'deactivate_watermark'));
81
-
82
- //update-fix from 1.1.4
83
- if(version_compare((($db_version = get_option('image_watermark_version')) === FALSE ? '1.0.0' : $db_version), '1.2.0', '<'))
84
- {
85
- $options_wi = (($tmp = get_option('df_watermark_image')) !== FALSE ? $tmp : $this->_options['df_watermark_image']);
86
-
87
- //new options
88
- $options_wi['frontend_active'] = $this->_options['df_watermark_image']['frontend_active'];
89
- $options_wi['deactivation_delete'] = $this->_options['df_watermark_image']['deactivation_delete'];
90
-
91
- //save new options
92
- update_option('df_watermark_image', $options_wi);
93
-
94
- //update version
95
- update_option('image_watermark_version', $this->_options['version']);
96
- }
97
-
98
- //actions
99
- add_action('plugins_loaded', array(&$this, 'load_textdomain'));
100
- add_action('wp_loaded', array(&$this, 'load_image_sizes'));
101
- add_action('admin_enqueue_scripts', array(&$this, 'admin_watermark_scripts_styles'));
102
- add_action('wp_enqueue_scripts', array(&$this, 'front_watermark_scripts_styles'));
103
- add_action('admin_menu', array(&$this, 'watermark_admin_menu'));
104
- add_action('load-upload.php', array(&$this, 'apply_watermark_bulk_action'));
105
- add_action('admin_notices', array(&$this, 'bulk_admin_notices'));
106
-
107
- //filters
108
- add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
109
- add_filter('plugin_action_links', array(&$this, 'plugin_settings_link'), 10, 2);
110
- add_filter('wp_handle_upload', array(&$this, 'handle_upload_files'));
111
  }
112
 
 
 
 
 
 
 
 
113
 
114
  /**
115
- * Applies watermark everywhere or for specific (custom) post types
116
- */
117
- public function handle_upload_files($file)
118
- {
119
- $opt = get_option('df_watermark_image');
120
-
121
- //admin side, we cant use is_admin() here due to frontend's admin-ajax.php request
122
- if(strpos(strtolower(wp_get_referer()), strtolower(admin_url()), 0) === 0)
123
- {
124
- $this->is_admin = TRUE;
125
-
126
- //apply watermark if backend is active and watermark image is set
127
- if($opt['plugin_off'] === 0 && $opt['url'] !== 0 && in_array($file['type'], $this->_allowed_mime_types))
128
- add_filter('wp_generate_attachment_metadata', array(&$this, 'apply_watermark'), 10, 2);
129
- }
130
- //front side
131
- else
132
- {
133
- $this->is_admin = FALSE;
134
-
135
- //apply watermark if frontend is active and watermark image is set
136
- if($opt['frontend_active'] === TRUE && $opt['url'] !== 0 && in_array($file['type'], $this->_allowed_mime_types))
137
- add_filter('wp_generate_attachment_metadata', array(&$this, 'apply_watermark'), 10, 2);
138
  }
139
-
140
- return $file;
141
  }
142
 
143
-
144
  /**
145
- * Applies watermark for selected images on media page
146
  */
147
- public function apply_watermark_bulk_action()
148
- {
149
- global $pagenow;
150
-
151
- if($pagenow == 'upload.php')
152
- {
153
- $opt = get_option('df_watermark_image');
154
- $wp_list_table = _get_list_table('WP_Media_List_Table');
155
-
156
- //update-fix from 1.1.0
157
- $opt['manual_watermarking'] = (isset($opt['manual_watermarking']) ? $opt['manual_watermarking'] : $this->_options['df_watermark_image']['manual_watermarking']);
158
-
159
- //only if manual watermarking is turned on and image watermark is set
160
- if($wp_list_table->current_action() === 'applywatermark' && $opt['manual_watermarking'] === 1 && $opt['url'] !== 0)
161
- {
162
- //security check
163
- check_admin_referer('bulk-media');
164
-
165
- $location = remove_query_arg(array('watermarked', 'skipped', 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), wp_get_referer());
166
-
167
- if(!$location)
168
- {
169
- $location = 'upload.php';
170
- }
171
-
172
- $location = add_query_arg('paged', $wp_list_table->get_pagenum(), $location);
173
-
174
- //do we have selected attachments?
175
- if(!empty($_REQUEST['media']))
176
- {
177
- $watermarked = $skipped = 0;
178
 
179
- foreach($_REQUEST['media'] as $media_id)
180
- {
181
- $data = wp_get_attachment_metadata($media_id, FALSE);
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
- //is this really an image?
184
- if(in_array(get_post_mime_type($media_id), $this->_allowed_mime_types) && is_array($data))
185
- {
186
- $this->apply_watermark($data, 'manual');
187
- $watermarked++;
188
- }
189
- else
190
- $skipped++;
191
  }
192
-
193
- $location = add_query_arg(array('watermarked' => $watermarked, 'skipped' => $skipped), $location);
194
  }
195
 
196
- wp_redirect($location);
197
- exit();
198
  }
199
- else return;
200
  }
201
  }
202
-
203
-
204
  /**
205
- * Shows admin notices
206
  */
207
- public function bulk_admin_notices()
208
- {
209
- global $post_type, $pagenow;
210
-
211
- if($pagenow === 'upload.php' && $post_type === 'attachment' && isset($_REQUEST['watermarked'], $_REQUEST['skipped']))
212
- {
213
- $watermarked = (int)$_REQUEST['watermarked'];
214
- $skipped = (int)$_REQUEST['skipped'];
215
-
216
- if($watermarked === 0)
217
- {
218
- 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 ? ' '.__('Skipped files', 'image-watermark').': '.$skipped.'.' : '').'</p></div>';
219
- }
220
- else
221
- {
222
- 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>';
223
- }
224
-
225
- $_SERVER['REQUEST_URI'] = remove_query_arg(array('watermarked', 'skipped'), $_SERVER['REQUEST_URI']);
226
- }
227
  }
228
 
229
-
230
  /**
231
- * Loads available image sizes
232
- */
233
- public function load_image_sizes()
234
- {
235
- $this->_image_sizes = get_intermediate_image_sizes();
236
- $this->_image_sizes[] = 'full';
237
-
238
- sort($this->_image_sizes, SORT_STRING);
239
- }
240
-
241
 
242
- /**
243
- * Loads textdomain
244
- */
245
- public function load_textdomain()
246
- {
247
- load_plugin_textdomain('image-watermark', FALSE, basename(dirname(__FILE__)).'/languages');
248
  }
249
 
250
-
251
  /**
252
- * Add links to Support Forum
253
- */
254
- public function plugin_extend_links($links, $file)
255
- {
256
- if(!current_user_can('install_plugins'))
257
- return $links;
258
-
259
- $plugin = plugin_basename(__FILE__);
260
-
261
- if($file == $plugin)
262
- {
263
- return array_merge(
264
- $links,
265
- array(sprintf('<a href="http://www.dfactory.eu/support/forum/image-watermark/" target="_blank">%s</a>', __('Support', 'image-watermark')))
266
- );
267
- }
268
-
269
- return $links;
270
  }
271
 
272
-
273
  /**
274
- * Add links to Settings page
275
- */
276
- function plugin_settings_link($links, $file)
277
- {
278
- if(!is_admin() || !current_user_can('manage_options'))
279
- return $links;
280
-
281
- static $plugin;
282
-
283
- $plugin = plugin_basename(__FILE__);
284
 
285
- if($file == $plugin)
286
- {
287
- $settings_link = sprintf('<a href="%s">%s</a>', admin_url('options-general.php').'?page=watermark-options', __('Settings', 'image-watermark'));
288
- array_unshift($links, $settings_link);
 
 
 
 
 
 
 
 
 
289
  }
290
-
291
- return $links;
292
  }
293
 
294
-
295
  /**
296
- * Enqueues admin-side scripts and styles
297
- */
298
- public function admin_watermark_scripts_styles($page)
299
- {
300
- if($page === 'upload.php')
301
- {
302
- $opt = get_option('df_watermark_image');
303
-
304
- //update-fix from 1.1.0
305
- $opt['manual_watermarking'] = (isset($opt['manual_watermarking']) ? $opt['manual_watermarking'] : $this->_options['df_watermark_image']['manual_watermarking']);
306
-
307
- if($opt['manual_watermarking'] === 1)
308
- {
309
- wp_enqueue_script(
310
- 'apply-watermark',
311
- plugins_url('/js/apply-watermark-admin.js', __FILE__)
312
- );
313
-
314
- wp_localize_script(
315
- 'apply-watermark',
316
- 'watermark_args',
317
- array(
318
- 'apply_watermark' => __('Apply watermark', 'image-watermark')
319
- )
320
- );
321
- }
322
- }
323
- elseif($page === 'settings_page_watermark-options')
324
- {
325
  wp_enqueue_media();
326
 
327
  wp_register_script(
328
- 'upload-manager',
329
- plugins_url('/js/upload-manager-admin.js', __FILE__)
330
  );
331
 
332
- wp_enqueue_script('upload-manager');
333
 
334
  wp_localize_script(
335
- 'upload-manager',
336
- 'upload_manager_args',
337
- array(
338
- 'title' => __('Select watermark', 'image-watermark'),
339
- 'originalSize' => __('Original size', 'image-watermark'),
340
- 'noSelectedImg' => __('Watermak has not been selected yet.', 'image-watermark'),
341
- 'notAllowedImg' => __('This image is not supported as watermark. Use JPEG, PNG or GIF.', 'image-watermark'),
342
- 'frame' => 'select',
343
- 'button' => array('text' => __('Add watermark', 'image-watermark')),
344
- 'multiple' => FALSE,
345
  )
346
  );
347
 
348
  wp_register_script(
349
- 'watermark-admin-script',
350
- plugins_url('js/image-watermark-admin.js', __FILE__),
351
- array('jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-slider')
352
  );
353
 
354
- wp_enqueue_script('watermark-admin-script');
355
 
356
  wp_localize_script(
357
- 'watermark-admin-script',
358
- 'iwArgs',
359
- array(
360
- 'resetToDefaults' => __('Are you sure you want to reset settings to defaults?', 'image-watermark')
361
  )
362
  );
363
 
364
  wp_register_style(
365
- 'watermark-style',
366
- plugins_url('css/image-watermark.css', __FILE__)
367
  );
368
 
369
- wp_enqueue_style('watermark-style');
370
 
371
  wp_register_style(
372
- 'wp-like-ui-theme',
373
- plugins_url('css/wp-like-ui-theme.css', __FILE__)
374
  );
375
 
376
- wp_enqueue_style('wp-like-ui-theme');
377
  }
378
  }
379
 
380
-
381
  /**
382
- * Enqueues front-side script with 'no right click' and 'drag and drop' functions
383
- */
384
- public function front_watermark_scripts_styles()
385
- {
386
- $options = get_option('df_image_protection');
387
-
388
- // backward compatibility options
389
- $options['forlogged'] = (!empty($options['forlogged']) ? 1 : 0);
390
- $options['draganddrop'] = (!empty($options['draganddrop']) ? 1 : 0);
391
- $options['rightclick'] = (!empty($options['rightclick']) ? 1 : 0);
392
-
393
- if(($options['forlogged'] == 0 && is_user_logged_in()) || ($options['draganddrop'] == 0 && $options['rightclick'] == 0))
394
  return;
395
 
396
  wp_enqueue_script(
397
- 'no-right-click',
398
- plugins_url('js/no-right-click-front.js', __FILE__)
399
  );
400
 
401
  wp_localize_script(
402
- 'no-right-click',
403
- 'norightclick_args',
404
- array(
405
- 'rightclick' => ($options['rightclick'] == 1 ? 'Y' : 'N'),
406
- 'draganddrop' => ($options['draganddrop'] == 1 ? 'Y' : 'N')
407
  )
408
  );
409
  }
410
 
411
-
412
  /**
413
- * Creates options page in menu
414
- */
415
- public function watermark_admin_menu()
416
- {
417
- add_options_page(
418
- __('Image Watermark Options', 'image-watermark'),
419
- __('Watermark', 'image-watermark'),
420
- 'manage_options',
421
- 'watermark-options',
422
- array(&$this, 'watermark_options_page')
423
- );
424
- }
425
 
 
 
426
 
427
- /**
428
- * Gets custom post types with additional post and page types
429
- */
430
- private function getCustomPostTypes()
431
- {
432
- return array_merge(array('post', 'page'), get_post_types(array('_builtin' => FALSE), 'names'));
433
- }
 
 
 
 
 
 
 
 
 
434
 
 
 
435
 
436
  /**
437
- * Display options page
438
  */
439
- public function watermark_options_page()
440
- {
441
- if(!extension_loaded('gd'))
442
- {
443
- echo '
444
- <div class="error">
445
- <p>'.__('Image Watermark will not work properly without GD PHP extension.', 'image-watermark').'</p>
446
- </div>';
447
 
448
- return;
449
- }
450
 
451
- //saves changes
452
- if(isset($_POST['submit']))
453
- {
454
- foreach($this->_options as $option => $value)
455
- {
456
- if(array_key_exists($option, $_POST))
457
- {
458
- switch($option)
459
- {
460
- case 'df_watermark_on':
461
- {
462
- $tmp = array();
463
-
464
- foreach($this->_image_sizes as $size)
465
- {
466
- if(in_array($size, array_keys($_POST[$option])))
467
- {
468
- $tmp[$size] = 1;
469
- }
470
- }
471
 
472
- update_option($option, $tmp);
473
- break;
474
- }
475
- case 'df_watermark_cpt_on':
476
- {
477
- if($_POST['df_watermark_cpt_on'] === 'everywhere')
478
- {
479
- update_option($option, array('everywhere'));
480
- }
481
- elseif($_POST['df_watermark_cpt_on'] === 'specific')
482
- {
483
- if(isset($_POST['df_watermark_cpt_on_type']))
484
- {
485
- $tmp = array();
486
-
487
- foreach($this->getCustomPostTypes() as $cpt)
488
- {
489
- if(in_array($cpt, array_keys($_POST['df_watermark_cpt_on_type'])))
490
- {
491
- $tmp[$cpt] = 1;
492
- }
493
- }
494
-
495
- if(count($tmp) === 0) update_option($option, array('everywhere'));
496
- else update_option($option, $tmp);
497
- }
498
- else update_option($option, array('everywhere'));
499
- }
500
 
501
- break;
502
- }
503
- case 'df_watermark_image':
504
- {
505
- $tmp = array();
506
-
507
- foreach($this->_options[$option] as $image_option => $value_i)
508
- {
509
- switch($image_option)
510
- {
511
- case 'watermark_size_type':
512
- $tmp[$image_option] = (int)(isset($_POST[$option][$image_option]) && in_array($_POST[$option][$image_option], array(0, 1, 2)) ? $_POST[$option][$image_option] : $this->_options[$option][$image_option]);
513
- break;
514
-
515
- case 'transparent':
516
- case 'quality':
517
- case 'width':
518
- $tmp[$image_option] = (isset($_POST[$option][$image_option]) ? ($_POST[$option][$image_option] <= 0 ? 0 : ($_POST[$option][$image_option] >= 100 ? 100 : (int)$_POST[$option][$image_option])) : $this->_options[$option][$image_option]);
519
- break;
520
-
521
- case 'deactivation_delete':
522
- case 'frontend_active':
523
- $tmp[$image_option] = (isset($_POST[$option][$image_option]) ? ($_POST[$option][$image_option] == 1 ? TRUE : FALSE) : $this->_options[$option][$image_option]);
524
- break;
525
-
526
- case 'plugin_off':
527
- case 'manual_watermarking':
528
- case 'offset_width':
529
- case 'offset_height':
530
- case 'absolute_width':
531
- case 'absolute_height':
532
- $tmp[$image_option] = (int)(isset($_POST[$option][$image_option]) ? $_POST[$option][$image_option] : $this->_options[$option][$image_option]);
533
- break;
534
-
535
- case 'url':
536
- $tmp[$image_option] = (isset($_POST[$option][$image_option]) ? (int)$_POST[$option][$image_option] : $this->_options[$option][$image_option]);
537
- break;
538
-
539
- case 'jpeg_format':
540
- $tmp[$image_option] = (isset($_POST[$option][$image_option]) && in_array($_POST[$option][$image_option], array('baseline', 'progressive')) ? $_POST[$option][$image_option] : $this->_options[$option][$image_option]);
541
- break;
542
-
543
- case 'position':
544
- $positions = array();
545
-
546
- foreach($this->_watermark_positions['y'] as $position_y)
547
- {
548
- foreach($this->_watermark_positions['x'] as $position_x)
549
- {
550
- $positions[] = $position_y.'_'.$position_x;
551
- }
552
- }
553
-
554
- $tmp[$image_option] = (isset($_POST[$option][$image_option]) && in_array($_POST[$option][$image_option], $positions) ? $_POST[$option][$image_option] : $this->_options[$option][$image_option]);
555
- break;
556
- }
557
- }
558
 
559
- update_option($option, $tmp);
560
- break;
561
- }
562
- case 'df_image_protection':
563
- {
564
- $tmp = array();
565
-
566
- foreach($this->_options[$option] as $protection => $value_p)
567
- {
568
- if(in_array($protection, array_keys($_POST[$option])))
569
- $tmp[$protection] = 1;
570
- else
571
- $tmp[$protection] = 0;
572
- }
573
 
574
- update_option($option, $tmp);
575
- break;
576
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  }
 
 
578
  }
579
- else
580
- {
581
- update_option($option, $value);
582
- }
583
- }
584
 
585
- echo '
586
- <div class="updated">
587
- <p>'.__('Settings saved.').'</p>
588
- </div>';
589
  }
590
- //reset to defaults
591
- elseif(isset($_POST['reset']))
592
- {
593
- foreach($this->_options as $option => $value)
594
- {
595
- update_option($option, $value);
596
- }
597
 
598
- echo '
599
- <div class="updated">
600
- <p>'.__('Settings restored to defaults.').'</p>
601
- </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
  }
 
603
 
604
- $watermark_image = get_option('df_watermark_image');
605
- $image_protection = get_option('df_image_protection');
606
- $watermark_on = get_option('df_watermark_on');
 
 
 
 
 
607
 
608
- //update-fix from 1.1.0
609
- $watermark_image['manual_watermarking'] = (isset($watermark_image['manual_watermarking']) ? $watermark_image['manual_watermarking'] : $this->_options['df_watermark_image']['manual_watermarking']);
 
 
610
 
611
- //update-fix from 1.1.2
612
- $watermark_image['jpeg_format'] = (isset($watermark_image['jpeg_format']) ? $watermark_image['jpeg_format'] : $this->_options['df_watermark_image']['jpeg_format']);
613
- $watermark_image['quality'] = (isset($watermark_image['quality']) ? $watermark_image['quality'] : $this->_options['df_watermark_image']['quality']);
614
 
615
- $errors = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
 
617
- if($watermark_image['plugin_off'] === 0 || $watermark_image['manual_watermarking'] === 1)
618
- {
619
- if($watermark_image['url'] === 0)
620
- $errors .= ($errors !== '' ? '<br />' : '').__('Watermark will not be applied when <b>watermark image is not set</b>.', 'image-watermark');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
 
622
- if(empty($watermark_on))
623
- $errors .= ($errors !== '' ? '<br />' : '').__('Watermark will not be applied when <b>no image sizes are selected</b>.', 'image-watermark');
624
- }
 
 
 
 
 
 
 
 
625
 
626
- if($watermark_image['frontend_active'] === TRUE)
627
- {
628
- if($watermark_image['url'] === 0)
629
- $errors .= ($errors !== '' ? '<br />' : '').__('Watermark will not be applied while frontend image upload if <b>watermark image is not set</b>.', 'image-watermark');
 
 
 
 
 
 
 
630
 
631
- if(empty($watermark_on))
632
- $errors .= ($errors !== '' ? '<br />' : '').__('Watermark will not be applied while frontend image upload if <b>no image sizes are selected</b>.', 'image-watermark');
633
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
634
 
635
- echo ($errors !== '' ? sprintf('<div class="error"><p>%s</p></div>', $errors) : '');
636
- ?>
637
- <div class="wrap">
638
- <div id="icon-options-general" class="icon32"><br /></div>
639
- <h2><?php echo __('Image Watermark Settings', 'image-watermark'); ?></h2>
640
-
641
- <div class="image-watermark-settings">
642
- <div class="df-credits">
643
- <h3 class="hndle"><?php echo __('Image Watermark', 'image-watermark') .' '.$this->_options['version']; ?></h3>
644
- <div class="inside">
645
- <h4 class="inner"><?php _e('Need support?', 'image-watermark'); ?></h4>
646
- <p class="inner"><?php _e('If you are having problems with this plugin, please talk about them in the', 'image-watermark'); ?> <a href="http://dfactory.eu/support/" target="_blank" title="<?php _e('Support forum', 'image-watermark'); ?>"><?php _e('Support forum', 'image-watermark'); ?></a></p>
647
- <hr />
648
- <h4 class="inner"><?php _e('Do you like this plugin?', 'image-watermark'); ?></h4>
649
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" class="inner">
650
- <input type="hidden" name="cmd" value="_s-xclick">
651
- <input type="hidden" name="hosted_button_id" value="DCF3AXC9A5A88">
652
- <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!">
653
- <img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
654
- </form>
655
- <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/image-watermark?filter=5" target="_blank" title="<?php _e('Rate it 5', 'image-watermark'); ?>"><?php _e('Rate it 5', 'image-watermark'); ?></a> <?php _e('on WordPress.org', 'image-watermark'); ?><br />
656
- <?php _e('Blog about it & link to the','image-watermark'); ?> <a href="http://dfactory.eu/plugins/image-watermark/" target="_blank" title="<?php _e('plugin page', 'image-watermark'); ?>"><?php _e('plugin page', 'image-watermark'); ?></a><br />
657
- <?php _e('Check out our other', 'image-watermark'); ?> <a href="http://dfactory.eu/plugins/" target="_blank" title="<?php _e('WordPress plugins', 'image-watermark'); ?>"><?php _e('WordPress plugins', 'image-watermark'); ?></a>
658
- </p>
659
- <hr />
660
- <p class="df-link inner"><?php _e('Created by', 'restrict-widgets'); ?><a href="http://www.dfactory.eu" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="<?php echo plugins_url( 'images/logo-dfactory.png' , __FILE__ ); ?>" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
661
- </div>
662
- </div>
663
 
664
- <form method="post" action="">
665
- <h3><?php echo __('General settings', 'image-watermark'); ?></h3>
666
- <table id="watermark-general-table" class="form-table">
667
- <tr valign="top">
668
- <th scope="row"><?php echo __('Automatic watermarking', 'image-watermark'); ?></th>
669
- <td class="wr_width">
670
- <fieldset class="wr_width">
671
- <div id="run-watermark">
672
- <label for="plugin_on"><?php echo __('on', 'image-watermark'); ?></label>
673
- <input type="radio" id="plugin_on" value="0" name="df_watermark_image[plugin_off]" <?php checked($watermark_image['plugin_off'], 0, TRUE); ?> />
674
- <label for="plugin_off"><?php echo __('off', 'image-watermark'); ?></label>
675
- <input type="radio" id="plugin_off" value="1" name="df_watermark_image[plugin_off]" <?php checked($watermark_image['plugin_off'], 1, TRUE); ?> />
676
- </div>
677
- <p class="description"><?php echo __('Enable or disable watermark for uploaded images.', 'image-watermark'); ?></p>
678
- </fieldset>
679
- </td>
680
- </tr>
681
- </table>
682
- <table id="watermark-manual-table" class="form-table">
683
- <tr valign="top">
684
- <th scope="row"><?php echo __('Manual watermarking', 'image-watermark'); ?></th>
685
- <td class="wr_width">
686
- <fieldset class="wr_width">
687
- <div id="run-manual-watermark">
688
- <label for="manual_watermarking_on"><?php echo __('on', 'image-watermark'); ?></label>
689
- <input type="radio" id="manual_watermarking_on" value="1" name="df_watermark_image[manual_watermarking]" <?php checked($watermark_image['manual_watermarking'], 1, TRUE); ?> />
690
- <label for="manual_watermarking_off"><?php echo __('off', 'image-watermark'); ?></label>
691
- <input type="radio" id="manual_watermarking_off" value="0" name="df_watermark_image[manual_watermarking]" <?php checked($watermark_image['manual_watermarking'], 0, TRUE); ?> />
692
- </div>
693
- <p class="description"><?php echo __('Enable or disable Apply Watermark option for images in Media Library.', 'image-watermark'); ?></p>
694
- </fieldset>
695
- </td>
696
- </tr>
697
- </table>
698
- <table id="watermark-for-table" class="form-table">
699
- <tr valign="top">
700
- <th scope="row"><?php echo __('Enable watermark for', 'image-watermark'); ?></th>
701
- <td class="wr_width">
702
- <fieldset class="wr_width">
703
- <div id="thumbnail-select">
704
- <?php foreach($this->_image_sizes as $image_size) : ?>
705
- <input name="df_watermark_on[<?php echo $image_size; ?>]" type="checkbox" id="<?php echo $image_size; ?>" value="1" <?php echo (in_array($image_size, array_keys($watermark_on)) ? ' checked="checked"' : ''); ?> />
706
- <label for="<?php echo $image_size; ?>"><?php echo $image_size; ?></label>
707
- <?php endforeach; ?>
708
- </div>
709
- <p class="description"><?php echo __('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.', 'image-watermark'); ?></p>
710
- <?php $watermark_cpt_on = array_keys(get_option('df_watermark_cpt_on'));
711
- if(in_array('everywhere', $watermark_cpt_on) && count($watermark_cpt_on) === 1)
712
- { $first_checked = TRUE; $second_checked = FALSE; $watermark_cpt_on = array(); }
713
- else { $first_checked = FALSE; $second_checked = TRUE; } ?>
714
- <div id="cpt-specific">
715
- <input id="df_option_everywhere" type="radio" name="df_watermark_cpt_on" value="everywhere" <?php echo ($first_checked === TRUE ? 'checked="checked"' : ''); ?>/><label for="df_option_everywhere"><?php _e('everywhere', 'image-watermark'); ?></label>
716
- <input id="df_option_cpt" type="radio" name="df_watermark_cpt_on" value="specific" <?php echo ($second_checked === TRUE ? 'checked="checked"' : ''); ?> /><label for="df_option_cpt"><?php _e('on selected post types only', 'image-watermark'); ?></label>
717
- </div>
718
- <div id="cpt-select" <?php echo ($second_checked === FALSE ? 'style="display: none;"' : ''); ?>>
719
- <?php foreach($this->getCustomPostTypes() as $cpt) : ?>
720
- <input name="df_watermark_cpt_on_type[<?php echo $cpt; ?>]" type="checkbox" id="<?php echo $cpt; ?>" value="1" <?php echo (in_array($cpt, $watermark_cpt_on) ? ' checked="checked"' : ''); ?> />
721
- <label for="<?php echo $cpt; ?>"><?php echo $cpt; ?></label>
722
- <?php endforeach; ?>
723
- </div>
724
- <p class="description"><?php echo __('Check custom post types on which watermark should be applied to uploaded images.', 'image-watermark'); ?></p>
725
- </fieldset>
726
- </td>
727
- </tr>
728
- </table>
729
- <table id="watermark-general-table-front" class="form-table">
730
- <tr valign="top">
731
- <th scope="row"><?php echo __('Automatic frontend watermarking', 'image-watermark'); ?></th>
732
- <td class="wr_width">
733
- <fieldset class="wr_width">
734
- <div id="run-watermark-front">
735
- <label for="frontend_active"><?php echo __('on', 'image-watermark'); ?></label>
736
- <input type="radio" id="frontend_active" value="1" name="df_watermark_image[frontend_active]" <?php checked($watermark_image['frontend_active'], TRUE, TRUE); ?> />
737
- <label for="frontend_inactive"><?php echo __('off', 'image-watermark'); ?></label>
738
- <input type="radio" id="frontend_inactive" value="0" name="df_watermark_image[frontend_active]" <?php checked($watermark_image['frontend_active'], FALSE, TRUE); ?> />
739
- </div>
740
- <p class="description"><?php echo __('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.', 'image-watermark'); ?></p>
741
- </fieldset>
742
- </td>
743
- </tr>
744
- </table>
745
- <table id="watermark-general-table-deactivation" class="form-table">
746
- <tr valign="top">
747
- <th scope="row"><?php echo __('Plugin deactivation', 'image-watermark'); ?></th>
748
- <td class="wr_width">
749
- <fieldset class="wr_width">
750
- <div id="deactivation-delete">
751
- <label for="deactivate_on"><?php echo __('on', 'image-watermark'); ?></label>
752
- <input type="radio" id="deactivate_on" value="1" name="df_watermark_image[deactivation_delete]" <?php checked($watermark_image['deactivation_delete'], TRUE, TRUE); ?> />
753
- <label for="deactivate_off"><?php echo __('off', 'image-watermark'); ?></label>
754
- <input type="radio" id="deactivate_off" value="0" name="df_watermark_image[deactivation_delete]" <?php checked($watermark_image['deactivation_delete'], FALSE, TRUE); ?> />
755
- </div>
756
- <p class="description"><?php echo __('Delete all database settings on plugin deactivation.', 'image-watermark'); ?></p>
757
- </fieldset>
758
- </td>
759
- </tr>
760
- </table>
761
- <hr />
762
- <h3><?php echo __('Watermark position', 'image-watermark'); ?></h3>
763
- <table id="watermark-position-table" class="form-table">
764
- <tr valign="top">
765
- <th scope="row"><?php echo __('Watermark alignment','image-watermark'); ?></th>
766
- <td>
767
- <fieldset>
768
- <table id="watermark_position" border="1">
769
- <?php $watermark_position = $watermark_image['position']; ?>
770
- <?php foreach($this->_watermark_positions['y'] as $y) : ?>
771
- <tr>
772
- <?php foreach($this->_watermark_positions['x'] as $x) : ?>
773
- <td title="<?php echo ucfirst($y . ' ' . $x); ?>">
774
- <input name="df_watermark_image[position]" type="radio" value="<?php echo $y . '_' . $x; ?>"<?php echo ($watermark_position == $y . '_' . $x ? ' checked="checked"' : NULL); ?> />
775
- </td>
776
- <?php endforeach; ?>
777
- </tr>
778
- <?php endforeach; ?>
779
- </table>
780
- <p class="description"><?php echo __('Choose the position of watermark image.','image-watermark'); ?></p>
781
- </fieldset>
782
- </td>
783
- </tr>
784
- <tr valign="top">
785
- <th scope="row"><?php echo __('Watermark offset','image-watermark'); ?></th>
786
- <td>
787
- <fieldset>
788
- <?php echo __('x:','image-watermark'); ?> <input type="text" size="5" name="df_watermark_image[offset_width]" value="<?php echo $watermark_image['offset_width']; ?>"> <?php echo __('px','image-watermark'); ?>
789
- <br />
790
- <?php echo __('y:','image-watermark'); ?> <input type="text" size="5" name="df_watermark_image[offset_height]" value="<?php echo $watermark_image['offset_height']; ?>"> <?php echo __('px','image-watermark'); ?>
791
- </fieldset>
792
- </td>
793
- </tr>
794
- </table>
795
- <hr />
796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  <?php
798
- if($watermark_image['url'] !== NULL && $watermark_image['url'] != 0)
799
- {
800
- $image = wp_get_attachment_image_src($watermark_image['url'], array(300, 300), FALSE);
801
- $imageSelected = TRUE;
802
- }
803
- else $imageSelected = FALSE;
804
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
805
 
806
- <h3><?php echo __('Watermark image','image-watermark'); ?></h3>
807
- <p class="description"><?php echo __('Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF.','image-watermark'); ?></p>
808
- <table id="watermark-image-table" class="form-table">
809
- <tr valign="top">
810
- <th scope="row"><?php echo __('Watermark image','image-watermark'); ?></th>
811
- <td>
812
- <input id="upload_image" type="hidden" name="df_watermark_image[url]" value="<?php echo (int)$watermark_image['url']; ?>" />
813
- <input id="upload_image_button" type="button" class="button button-secondary" value="<?php echo __('Select image','image-watermark'); ?>" />
814
- <input id="turn_off_image_button" type="button" class="button button-secondary" value="<?php echo __('Turn off image','image-watermark'); ?>" <?php if($imageSelected === FALSE) echo 'disabled="disabled"'; ?>/>
815
- <p class="description"><?php _e('You have to save changes after the selection or removal of the image.', 'image-watermark'); ?></p>
816
- </td>
817
- </tr>
818
- <tr valign="top">
819
- <th scope="row"><?php echo __('Watermark preview', 'image-watermark'); ?></th>
820
- <td class="wr_width">
821
- <fieldset class="wr_width">
822
- <div id="previewImg_imageDiv">
823
- <?php if($imageSelected === TRUE) {
824
- $image = wp_get_attachment_image_src($watermark_image['url'], array(300, 300), FALSE);
825
- ?>
826
- <img id="previewImg_image" src="<?php echo $image[0]; ?>" alt="" width="300" />
827
- <?php } else { ?>
828
- <img id="previewImg_image" src="" alt="" width="300" style="display: none;" />
829
- <?php } ?>
830
- </div>
831
- <p id="previewImageInfo" class="description">
832
- <?php
833
- if($imageSelected === FALSE)
834
- {
835
- _e('Watermak has not been selected yet.', 'image-watermark');
836
- }
837
- else
838
- {
839
- $imageFullSize = wp_get_attachment_image_src($watermark_image['url'], 'full', FALSE);
840
-
841
- _e('Original size', 'image-watermark').': '.$imageFullSize[1].' px / '.$imageFullSize[2].' px';
842
- }
843
- ?>
844
- </p>
845
- </fieldset>
846
- </td>
847
- </tr>
848
- <tr valign="top">
849
- <th scope="row"><?php _e('Watermark size', 'image-watermark'); ?></th>
850
- <td class="wr_width">
851
- <fieldset class="wr_width">
852
- <div id="watermark-type">
853
- <label for="type1"><?php _e('original', 'image-watermark'); ?></label>
854
- <input type="radio" id="type1" value="0" name="df_watermark_image[watermark_size_type]" <?php checked($watermark_image['watermark_size_type'], 0, TRUE); ?> />
855
- <label for="type2"><?php _e('custom', 'image-watermark'); ?></label>
856
- <input type="radio" id="type2" value="1" name="df_watermark_image[watermark_size_type]" <?php checked($watermark_image['watermark_size_type'], 1, TRUE); ?> />
857
- <label for="type3"><?php _e('scaled', 'image-watermark'); ?></label>
858
- <input type="radio" id="type3" value="2" name="df_watermark_image[watermark_size_type]" <?php checked($watermark_image['watermark_size_type'], 2, TRUE); ?> />
859
- </div>
860
- <p class="description"><?php _e('Select method of aplying watermark size.', 'image-watermark'); ?></p>
861
- </fieldset>
862
- </td>
863
- </tr>
864
- <tr valign="top" id="watermark_size_custom">
865
- <th scope="row"><?php _e('Watermark custom size', 'image-watermark'); ?></th>
866
- <td class="wr_width">
867
- <fieldset class="wr_width">
868
- <?php _e('x:', 'image-watermark'); ?> <input type="text" size="5" name="df_watermark_image[absolute_width]" value="<?php echo $watermark_image['absolute_width']; ?>"> <?php _e('px', 'image-watermark'); ?>
869
- <br />
870
- <?php _e('y:', 'image-watermark'); ?> <input type="text" size="5" name="df_watermark_image[absolute_height]" value="<?php echo $watermark_image['absolute_height']; ?>"> <?php _e('px','image-watermark'); ?>
871
- </fieldset>
872
- <p class="description"><?php _e('Those dimensions will be used if "custom" method is selected above.', 'image-watermark'); ?></p>
873
- </td>
874
- </tr>
875
- <tr valign="top" id="watermark_size_scale">
876
- <th scope="row"><?php _e('Scale of watermark in relation to image width', 'image-watermark'); ?></th>
877
- <td class="wr_width">
878
- <fieldset class="wr_width">
879
- <div>
880
- <input type="text" id="iw_size_input" maxlength="3" class="hide-if-js" name="df_watermark_image[width]" value="<?php echo $watermark_image['width']; ?>" />
881
- <div class="wplike-slider">
882
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_size_span" title="<?php echo $watermark_image['width']; ?>"></span><span class="right hide-if-no-js">100</span>
883
- </div>
884
- </div>
885
- </fieldset>
886
- <p class="description"><?php _e('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.', 'image-watermark'); ?></p>
887
- </td>
888
- </tr>
889
- <tr valign="top">
890
- <th scope="row"><?php _e('Watermark transparency / opacity', 'image-watermark'); ?></th>
891
- <td class="wr_width">
892
- <fieldset class="wr_width">
893
- <div>
894
- <input type="text" id="iw_opacity_input" maxlength="3" class="hide-if-js" name="df_watermark_image[transparent]" value="<?php echo $watermark_image['transparent']; ?>" />
895
- <div class="wplike-slider">
896
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_opacity_span" title="<?php echo $watermark_image['transparent']; ?>"></span><span class="right hide-if-no-js">100</span>
897
- </div>
898
- </div>
899
- </fieldset>
900
- <p class="description"><?php _e('Enter a number ranging from 0 to 100. 0 makes watermark image completely transparent, 100 shows it as is.', 'image-watermark'); ?></p>
901
- </td>
902
- </tr>
903
- <tr valign="top">
904
- <th scope="row"><?php _e('Image quality', 'image-watermark'); ?></th>
905
- <td class="wr_width">
906
- <fieldset class="wr_width">
907
- <div>
908
- <input type="text" id="iw_quality_input" maxlength="3" class="hide-if-js" name="df_watermark_image[quality]" value="<?php echo $watermark_image['quality']; ?>" />
909
- <div class="wplike-slider">
910
- <span class="left hide-if-no-js">0</span><span class="middle" id="iw_quality_span" title="<?php echo $watermark_image['quality']; ?>"></span><span class="right hide-if-no-js">100</span>
911
- </div>
912
- </div>
913
- </fieldset>
914
- <p class="description"><?php _e('Set output image quality.', 'image-watermark'); ?></p>
915
- </td>
916
- </tr>
917
- <tr valign="top">
918
- <th scope="row"><?php _e('Image format', 'image-watermark'); ?></th>
919
- <td class="wr_width">
920
- <fieldset class="wr_width">
921
- <div id="jpeg-format">
922
- <label for="baseline"><?php _e('baseline', 'image-watermark'); ?></label>
923
- <input type="radio" id="baseline" value="baseline" name="df_watermark_image[jpeg_format]" <?php checked($watermark_image['jpeg_format'], 'baseline', TRUE); ?> />
924
- <label for="progressive"><?php _e('progressive', 'image-watermark'); ?></label>
925
- <input type="radio" id="progressive" value="progressive" name="df_watermark_image[jpeg_format]" <?php checked($watermark_image['jpeg_format'], 'progressive', TRUE); ?> />
926
- </div>
927
- </fieldset>
928
- <p class="description"><?php _e('Select baseline or progressive image format.', 'image-watermark'); ?></p>
929
- </td>
930
- </tr>
931
- </table>
932
- <input type="hidden" name="action" value="update" />
933
- <hr />
934
- <h3><?php _e('Image protection', 'image-watermark'); ?></h3>
935
- <table id="watermark-protection-table" class="form-table">
936
- <tr>
937
- <th><?php _e('Disable right mouse click on images', 'image-watermark'); ?></th>
938
- <td><input type="checkbox" <?php checked((!empty($image_protection['rightclick']) ? 1 : 0), 1, TRUE); ?> value="1" name="df_image_protection[rightclick]"></td>
939
- </tr>
940
- <tr>
941
- <th><?php _e('Prevent drag and drop', 'image-watermark'); ?></th>
942
- <td><input type="checkbox" <?php checked((!empty($image_protection['draganddrop']) ? 1 : 0), 1, TRUE); ?> value="1" name="df_image_protection[draganddrop]"></td>
943
- </tr>
944
- <tr>
945
- <th><?php _e('Enable image protection for logged-in users also', 'image-watermark'); ?></th>
946
- <td><input type="checkbox" <?php checked((!empty($image_protection['forlogged']) ? 1 : 0), 1, TRUE); ?> value="1" name="df_image_protection[forlogged]"></td>
947
- </tr>
948
- </table>
949
- <hr />
950
- <input type="submit" id="watermark-submit" class="button button-primary" name="submit" value="<?php _e('Save Changes', 'image-watermark'); ?>" />
951
- <input type="submit" id="watermark-reset" class="button button-secondary" name="reset" value="<?php _e('Reset to defaults', 'image-watermark'); ?>" />
952
- </form>
953
- </div>
954
- </div>
955
- <?php
956
  }
957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958
 
959
  /**
960
- * Plugin activation
961
  */
962
- public function activate_watermark()
963
- {
964
- //save install time
965
- add_option('df_watermark_installed', current_time('timestamp'), '', 'no');
966
-
967
- //loop through default options and add them into DB
968
- foreach($this->_options as $option => $value)
969
- {
970
- add_option($option, $value, '', 'no');
971
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
972
  }
973
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
974
 
975
  /**
976
- * Plugin deactivation
977
  */
978
- public function deactivate_watermark()
979
- {
980
- $opt = get_option('df_watermark_image');
981
-
982
- //remove options from database?
983
- if($opt['deactivation_delete'] === TRUE)
984
- {
985
- delete_option('df_image_protection');
986
- delete_option('df_watermark_cpt_on');
987
- delete_option('df_watermark_image');
988
- delete_option('df_watermark_installed');
989
- delete_option('df_watermark_on');
990
- delete_option('image_watermark_version');
991
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
  }
993
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994
 
995
  /**
996
- * Apply watermark to selected image sizes
997
  *
998
- * @param array $data
999
- * @return array
 
1000
  */
1001
- public function apply_watermark($data, $attachment_id)
1002
- {
1003
- $opt_img = get_option('df_watermark_image');
1004
- $opt_cpt = get_option('df_watermark_cpt_on');
1005
- $opt_won = get_option('df_watermark_on');
1006
 
1007
- $post = get_post((int)$attachment_id);
1008
- $post_id = (!empty($post) ? (int)$post->post_parent : 0);
1009
 
1010
- //something went wrong or is it automatic mode?
1011
- if($attachment_id !== 'manual' && ($this->is_admin === TRUE && !((isset($opt_cpt[0]) && $opt_cpt[0] === 'everywhere') || ($post_id > 0 && in_array(get_post_type($post_id), array_keys($opt_cpt)) === TRUE))))
1012
  return $data;
1013
 
1014
- if(apply_filters('iw_watermark_display', $attachment_id) === FALSE)
1015
  return $data;
1016
 
1017
  $upload_dir = wp_upload_dir();
1018
 
1019
- //is this really an iamge?
1020
- if(getimagesize($upload_dir['basedir'].DIRECTORY_SEPARATOR.$data['file']) !== FALSE)
1021
- {
1022
- //loop through active image sizes
1023
- foreach($opt_won as $image_size => $active_size)
1024
- {
1025
- if($active_size === 1)
1026
- {
1027
- switch($image_size)
1028
- {
1029
  case 'full':
1030
- $filepath = $upload_dir['basedir'].DIRECTORY_SEPARATOR.$data['file'];
1031
  break;
1032
 
1033
  default:
1034
- if(!empty($data['sizes']) && array_key_exists($image_size, $data['sizes']))
1035
- {
1036
- $filepath = $upload_dir['basedir'].DIRECTORY_SEPARATOR.dirname($data['file']).DIRECTORY_SEPARATOR.$data['sizes'][$image_size]['file'];
1037
- }
1038
- else
1039
- {
1040
- //early getaway
1041
  continue 2;
1042
  }
1043
  }
1044
 
1045
- do_action('iw_before_apply_watermark');
1046
 
1047
- //apply watermark
1048
- $this->do_watermark($filepath);
1049
 
1050
- do_action('iw_after_apply_watermark');
1051
  }
1052
  }
1053
  }
1054
 
1055
- //pass forward attachment metadata
1056
  return $data;
1057
  }
1058
 
1059
-
1060
  /**
1061
- * Apply watermark to certain image
1062
- *
1063
- * @param string $filepath
1064
- */
1065
- public function do_watermark($filepath)
1066
- {
1067
- $options = array();
1068
-
1069
- //get watermark settings
1070
- foreach($this->_options as $option => $value)
1071
- {
1072
- $options[$option] = get_option($option);
1073
- }
1074
-
1075
- //update-fix from 1.1.2
1076
- $options['df_watermark_image']['quality'] = (isset($options['df_watermark_image']['quality']) ? $options['df_watermark_image']['quality'] : $this->_options['df_watermark_image']['quality']);
1077
 
1078
- $options = apply_filters('iw_watermark_options', $options);
1079
 
1080
- //get image mime type
1081
- $mime_type = wp_check_filetype($filepath);
1082
 
1083
- //get image resource
1084
- if(($image = $this->get_image_resource($filepath, $mime_type['type'])) !== FALSE)
1085
- {
1086
- //add watermark image to image
1087
- if($this->add_watermark_image($image, $options) !== FALSE)
1088
- {
1089
- //update-fix from 1.1.2
1090
- $options['df_watermark_image']['jpeg_format'] = (isset($options['df_watermark_image']['jpeg_format']) ? $options['df_watermark_image']['jpeg_format'] : $this->_options['df_watermark_image']['jpeg_format']);
1091
 
1092
- if($options['df_watermark_image']['jpeg_format'] === 'progressive')
1093
- {
1094
- imageinterlace($image, true);
1095
  }
1096
 
1097
- //save watermarked image
1098
- $this->save_image_file($image, $mime_type['type'], $filepath, $options['df_watermark_image']['quality']);
1099
  }
1100
  }
1101
  }
1102
 
1103
-
1104
  /**
1105
- * Add watermark image to image
1106
  *
1107
- * @param resource $image
1108
- * @param array $opt
1109
- * @return resource
1110
  */
1111
- private function add_watermark_image($image, array $opt)
1112
- {
1113
- //due to allow_url_fopen restrictions on some servers in getimagesize() we need to use server path (not URL)
1114
  $upload_dir = wp_upload_dir();
1115
- $watermark_file = wp_get_attachment_metadata($opt['df_watermark_image']['url'], TRUE);
1116
- $url = $upload_dir['basedir'].DIRECTORY_SEPARATOR.$watermark_file['file'];
1117
- $watermark_file_info = getimagesize($url);
1118
 
1119
- switch($watermark_file_info['mime'])
1120
- {
1121
  case 'image/jpeg':
1122
  case 'image/pjpeg':
1123
- $watermark = imagecreatefromjpeg($url);
1124
  break;
1125
 
1126
  case 'image/gif':
1127
- $watermark = imagecreatefromgif($url);
1128
  break;
1129
 
1130
  case 'image/png':
1131
- $watermark = imagecreatefrompng($url);
1132
  break;
1133
 
1134
  default:
1135
- return FALSE;
1136
  }
1137
 
1138
- $watermark_width = imagesx($watermark);
1139
- $watermark_height = imagesy($watermark);
1140
- $img_width = imagesx($image);
1141
- $img_height = imagesy($image);
1142
- $size_type = $opt['df_watermark_image']['watermark_size_type'];
1143
 
1144
- if($size_type === 1) //custom
1145
- {
1146
- $w = $opt['df_watermark_image']['absolute_width'];
1147
- $h = $opt['df_watermark_image']['absolute_height'];
1148
- }
1149
- elseif($size_type === 2) //scale
1150
- {
1151
- $ratio = $img_width * $opt['df_watermark_image']['width'] / 100 / $watermark_width;
1152
 
1153
- $w = (int)($watermark_width * $ratio);
1154
- $h = (int)($watermark_height * $ratio);
1155
 
1156
- //if watermark scaled height is bigger then image watermark
1157
- if($h > $img_height)
1158
- {
1159
- $w = (int)($img_height * $w / $h);
1160
  $h = $img_height;
1161
  }
1162
- }
1163
- else //original
1164
- {
1165
  $w = $watermark_width;
1166
  $h = $watermark_height;
1167
  }
1168
 
1169
- switch($opt['df_watermark_image']['position'])
1170
- {
1171
  case 'top_left':
1172
  $dest_x = $dest_y = 0;
1173
  break;
@@ -1212,106 +1123,157 @@ class Image_Watermark
1212
  $dest_y = ($img_height / 2) - ($h / 2);
1213
  }
1214
 
1215
- $dest_x += $opt['df_watermark_image']['offset_width'];
1216
- $dest_y += $opt['df_watermark_image']['offset_height'];
1217
 
1218
- $this->imagecopymerge_alpha($image, $this->resize($watermark, $url, $w, $h, $watermark_file_info), $dest_x, $dest_y, 0, 0, $w, $h, $opt['df_watermark_image']['transparent']);
1219
 
1220
  return $image;
1221
  }
1222
 
1223
-
1224
  /**
1225
- * Creates new image
1226
- */
1227
- private function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct)
1228
- {
1229
- //creating a cut resource
1230
- $cut = imagecreatetruecolor($src_w, $src_h);
 
 
 
 
 
 
 
 
 
1231
 
1232
- //copying relevant section from background to the cut resource
1233
- imagecopy($cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h);
1234
 
1235
- //copying relevant section from watermark to the cut resource
1236
- imagecopy($cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h);
1237
 
1238
- //insert cut resource to destination image
1239
- imagecopymerge($dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct);
1240
  }
1241
 
1242
-
1243
  /**
1244
- * Resizes image
1245
- */
1246
- private function resize($im, $path, $nWidth, $nHeight, $imgInfo)
1247
- {
1248
- $newImg = imagecreateTRUEcolor($nWidth, $nHeight);
1249
-
1250
- //check if this image is PNG, then set if transparent
1251
- if($imgInfo[2] === 3)
1252
- {
1253
- imagealphablending($newImg, FALSE);
1254
- imagesavealpha($newImg, TRUE);
1255
- $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127);
1256
- imagefilledrectangle($newImg, 0, 0, $nWidth, $nHeight, $transparent);
 
 
 
 
 
1257
  }
1258
 
1259
- imagecopyresampled($newImg, $im, 0, 0, 0, 0, $nWidth, $nHeight, $imgInfo[0], $imgInfo[1]);
1260
 
1261
  return $newImg;
1262
  }
1263
 
1264
-
1265
  /**
1266
- * Get image resource accordingly to mimetype
1267
- *
1268
- * @param string $filepath
1269
- * @param string $mime_type
1270
- * @return resource
1271
- */
1272
- private function get_image_resource($filepath, $mime_type)
1273
- {
1274
- switch($mime_type)
1275
- {
1276
  case 'image/jpeg':
1277
  case 'image/pjpeg':
1278
- return imagecreatefromjpeg($filepath);
1279
 
1280
  case 'image/png':
1281
- $res = imagecreatefrompng($filepath);
1282
- $transparent = imagecolorallocatealpha($res, 255, 255, 254, 127);
1283
- imagefilledrectangle($res, 0, 0, imagesx($res), imagesy($res), $transparent);
1284
  return $res;
1285
 
1286
  default:
1287
- return FALSE;
1288
  }
1289
  }
1290
 
1291
-
1292
  /**
1293
- * Save image from image resource
1294
  *
1295
- * @param resource $image
1296
- * @param string $mime_type
1297
- * @param string $filepath
1298
- * @return boolean
1299
  */
1300
- private function save_image_file($image, $mime_type, $filepath, $quality)
1301
- {
1302
- switch($mime_type)
1303
- {
1304
  case 'image/jpeg':
1305
  case 'image/pjpeg':
1306
- imagejpeg($image, $filepath, $quality);
1307
  break;
1308
 
1309
  case 'image/png':
1310
- imagepng($image, $filepath, (int)round(9 * $quality / 100));
1311
  break;
1312
  }
1313
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1314
  }
1315
 
1316
  $image_watermark = new Image_Watermark();
1317
- ?>
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.5.0
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/image-watermark/
12
  Domain Path: /languages
13
 
14
  Image Watermark
15
+ Copyright (C) 2013-2015, 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
 
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
+ /**
29
+ * Image Watermark class.
30
+ *
31
+ * @class Image_Watermark
32
+ * @version 1.5.0
33
+ */
34
+ class Image_Watermark {
35
+
36
+ private $is_admin = true;
37
+ private $image_sizes = array();
38
+ private $watermark_positions = array(
39
+ 'x' => array( 'left', 'center', 'right' ),
40
+ 'y' => array( 'top', 'middle', 'bottom' ),
41
  );
42
+ private $allowed_mime_types = array(
43
  'image/jpeg',
44
  'image/pjpeg',
45
  'image/png'
46
  );
47
+ protected $defaults = array(
48
+ 'options' => array(
49
+ 'watermark_on' => array(),
50
+ 'watermark_cpt_on' => array( 'everywhere' ),
51
+ 'watermark_image' => array(
52
+ 'url' => 0,
53
+ 'width' => 80,
54
+ 'plugin_off' => 0,
55
+ 'frontend_active' => false,
56
+ 'manual_watermarking' => 0,
57
+ 'position' => 'bottom_right',
58
+ 'watermark_size_type' => 2,
59
+ 'offset_width' => 0,
60
+ 'offset_height' => 0,
61
+ 'absolute_width' => 0,
62
+ 'absolute_height' => 0,
63
+ 'transparent' => 50,
64
+ 'quality' => 90,
65
+ 'jpeg_format' => 'baseline',
66
+ 'deactivation_delete' => false,
67
+ 'media_library_notice' => true
68
+ ),
69
+ 'image_protection' => array(
70
+ 'rightclick' => 0,
71
+ 'draganddrop' => 0,
72
+ 'forlogged' => 0,
73
+ ),
74
  ),
75
+ 'version' => '1.5.0'
 
 
 
 
 
76
  );
77
+ public $options = array();
78
+
79
+ public function __construct() {
80
+ // installer
81
+ register_activation_hook( __FILE__, array( &$this, 'activate_watermark' ) );
82
+ register_deactivation_hook( __FILE__, array( &$this, 'deactivate_watermark' ) );
83
+
84
+ // settings
85
+ $this->options = array_merge( $this->defaults['options'], (array) get_option( 'image_watermark_options' ) );
86
+
87
+ // actions
88
+ add_action( 'plugins_loaded', array( &$this, 'load_textdomain' ) );
89
+ add_action( 'wp_loaded', array( &$this, 'load_image_sizes' ) );
90
+ add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
91
+ add_action( 'admin_print_scripts', array( &$this, 'admin_print_scripts' ), 20 );
92
+ add_action( 'wp_enqueue_scripts', array( &$this, 'wp_enqueue_scripts' ) );
93
+ add_action( 'admin_menu', array( &$this, 'options_page' ) );
94
+ add_action( 'load-upload.php', array( &$this, 'apply_watermark_bulk_action' ) );
95
+ add_action( 'admin_init', array( &$this, 'update_watermark' ) );
96
+ add_action( 'admin_init', array( &$this, 'register_settings' ) );
97
+ add_action( 'admin_notices', array( &$this, 'bulk_admin_notices' ) );
98
+
99
+ // filters
100
+ add_filter( 'plugin_row_meta', array( &$this, 'plugin_extend_links' ), 10, 2 );
101
+ add_filter( 'plugin_action_links', array( &$this, 'plugin_settings_link' ), 10, 2 );
102
+ add_filter( 'wp_handle_upload', array( &$this, 'handle_upload_files' ) );
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
+ /**
106
+ * Plugin activation.
107
+ */
108
+ public function activate_watermark() {
109
+ add_option( 'image_watermark_options', $this->defaults['options'], '', 'no' );
110
+ add_option( 'image_watermark_version', $this->defaults['version'], '', 'no' );
111
+ }
112
 
113
  /**
114
+ * Plugin deactivation.
115
+ */
116
+ public function deactivate_watermark() {
117
+ // remove options from database?
118
+ if ( $this->options['image_watermark_image']['deactivation_delete'] === true ) {
119
+ delete_option( 'image_watermark_options' );
120
+ delete_option( 'image_watermark_version' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
 
 
122
  }
123
 
 
124
  /**
125
+ * Plugin update, fix for version < 1.5.0
126
  */
127
+ public function update_watermark() {
128
+ if ( ! current_user_can( 'install_plugins' ) )
129
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
+ $db_version = get_option( 'image_watermark_version' );
132
+ $db_version = ! ( $db_version ) && ( get_option( 'df_watermark_installed' ) != false ) ? get_option( 'version' ) : $db_version;
133
+
134
+ if ( $db_version != false ) {
135
+ if ( version_compare( $db_version, '1.5.0', '<' ) ) {
136
+ $options = array();
137
+
138
+ $old_new = array(
139
+ 'df_watermark_on' => 'watermark_on',
140
+ 'df_watermark_cpt_on' => 'watermark_cpt_on',
141
+ 'df_watermark_image' => 'watermark_image',
142
+ 'df_image_protection' => 'image_protection',
143
+ 'df_watermark_installed' => '',
144
+ 'version' => '',
145
+ 'image_watermark_version' => '',
146
+ );
147
 
148
+ foreach ( $old_new as $old => $new ) {
149
+ if ( $new ) {
150
+ $options[$new] = get_option( $old );
 
 
 
 
 
151
  }
152
+ delete_option( $old );
 
153
  }
154
 
155
+ add_option( 'image_watermark_options', $options, '', 'no' );
156
+ add_option( 'image_watermark_version', $this->defaults['version'], '', 'no' );
157
  }
 
158
  }
159
  }
160
+
 
161
  /**
162
+ * Load textdomain.
163
  */
164
+ public function load_textdomain() {
165
+ load_plugin_textdomain( 'image-watermark', false, basename( dirname( __FILE__ ) ) . '/languages' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  }
167
 
 
168
  /**
169
+ * Load available image sizes.
170
+ */
171
+ public function load_image_sizes() {
172
+ $this->image_sizes = get_intermediate_image_sizes();
173
+ $this->image_sizes[] = 'full';
 
 
 
 
 
174
 
175
+ sort( $this->image_sizes, SORT_STRING );
 
 
 
 
 
176
  }
177
 
 
178
  /**
179
+ * Get post types.
180
+ */
181
+ private function get_post_types() {
182
+ return array_merge( array( 'post', 'page' ), get_post_types( array( '_builtin' => false ), 'names' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
 
 
185
  /**
186
+ * Admin inline scripts.
187
+ */
188
+ public function admin_print_scripts() {
189
+ global $pagenow;
 
 
 
 
 
 
190
 
191
+ if ( $pagenow === 'upload.php' ) {
192
+ if ( $this->options['watermark_image']['manual_watermarking'] == 1 ) {
193
+ ?>
194
+ <script type="text/javascript">
195
+ jQuery( function( $ ) {
196
+ $( document ).ready( function() {
197
+ $( "<option>" ).val( "applywatermark" ).text( "<?php _e( 'Apply watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action']" );
198
+ $( "<option>" ).val( "applywatermark" ).text( "<?php _e( 'Apply watermark', 'image-watermark' ); ?>" ).appendTo( "select[name='action2']" );
199
+ });
200
+ });
201
+ </script>
202
+ <?php
203
+ }
204
  }
 
 
205
  }
206
 
 
207
  /**
208
+ * Enqueue admin scripts and styles.
209
+ */
210
+ public function admin_enqueue_scripts( $page ) {
211
+ if ( $page === 'settings_page_watermark-options' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  wp_enqueue_media();
213
 
214
  wp_register_script(
215
+ 'upload-manager', plugins_url( '/js/admin-upload.js', __FILE__ ), array(), $this->defaults['version']
 
216
  );
217
 
218
+ wp_enqueue_script( 'upload-manager' );
219
 
220
  wp_localize_script(
221
+ 'upload-manager', 'upload_manager_args', array(
222
+ 'title' => __( 'Select watermark', 'image-watermark' ),
223
+ 'originalSize' => __( 'Original size', 'image-watermark' ),
224
+ 'noSelectedImg' => __( 'Watermak has not been selected yet.', 'image-watermark' ),
225
+ 'notAllowedImg' => __( 'This image is not supported as watermark. Use JPEG, PNG or GIF.', 'image-watermark' ),
226
+ 'frame' => 'select',
227
+ 'button' => array( 'text' => __( 'Add watermark', 'image-watermark' ) ),
228
+ 'multiple' => false,
 
 
229
  )
230
  );
231
 
232
  wp_register_script(
233
+ 'watermark-admin-script', plugins_url( 'js/admin-settings.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-slider' ), $this->defaults['version']
 
 
234
  );
235
 
236
+ wp_enqueue_script( 'watermark-admin-script' );
237
 
238
  wp_localize_script(
239
+ 'watermark-admin-script', 'iwArgs', array(
240
+ 'resetToDefaults' => __( 'Are you sure you want to reset settings to defaults?', 'image-watermark' )
 
 
241
  )
242
  );
243
 
244
  wp_register_style(
245
+ 'watermark-style', plugins_url( 'css/image-watermark.css', __FILE__ ), array(), $this->defaults['version']
 
246
  );
247
 
248
+ wp_enqueue_style( 'watermark-style' );
249
 
250
  wp_register_style(
251
+ 'wp-like-ui-theme', plugins_url( 'css/wp-like-ui-theme.css', __FILE__ ), array(), $this->defaults['version']
 
252
  );
253
 
254
+ wp_enqueue_style( 'wp-like-ui-theme' );
255
  }
256
  }
257
 
 
258
  /**
259
+ * Enqueue frontend script with 'no right click' and 'drag and drop' functions.
260
+ */
261
+ public function wp_enqueue_scripts() {
262
+ if ( ($this->options['image_protection']['forlogged'] == 0 && is_user_logged_in()) || ($this->options['image_protection']['draganddrop'] == 0 && $this->options['image_protection']['rightclick'] == 0) )
 
 
 
 
 
 
 
 
263
  return;
264
 
265
  wp_enqueue_script(
266
+ 'no-right-click', plugins_url( 'js/no-right-click.js', __FILE__ ), array(), $this->defaults['version']
 
267
  );
268
 
269
  wp_localize_script(
270
+ 'no-right-click', 'norightclick_args', array(
271
+ 'rightclick' => ($this->options['image_protection']['rightclick'] == 1 ? 'Y' : 'N'),
272
+ 'draganddrop' => ($this->options['image_protection']['draganddrop'] == 1 ? 'Y' : 'N')
 
 
273
  )
274
  );
275
  }
276
 
 
277
  /**
278
+ * Apply watermark everywhere or for specific post types.
279
+ *
280
+ * @param resource $file
281
+ * @return resource
282
+ */
283
+ public function handle_upload_files( $file ) {
 
 
 
 
 
 
284
 
285
+ // admin, we cant use is_admin() here due to frontend's admin-ajax.php request
286
+ if ( strpos( strtolower( wp_get_referer() ), strtolower( admin_url() ), 0 ) === 0 ) {
287
 
288
+ $this->is_admin = true;
289
+
290
+ // apply watermark if backend is active and watermark image is set
291
+ if ( $this->options['watermark_image']['plugin_off'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
292
+ add_filter( 'wp_generate_attachment_metadata', array( &$this, 'apply_watermark' ), 10, 2 );
293
+ }
294
+ } else {
295
+
296
+ // frontend
297
+ $this->is_admin = false;
298
+
299
+ // apply watermark if frontend is active and watermark image is set
300
+ if ( $this->options['watermark_image']['frontend_active'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
301
+ add_filter( 'wp_generate_attachment_metadata', array( &$this, 'apply_watermark' ), 10, 2 );
302
+ }
303
+ }
304
 
305
+ return $file;
306
+ }
307
 
308
  /**
309
+ * Apply watermark for selected images on media page.
310
  */
311
+ public function apply_watermark_bulk_action() {
312
+ global $pagenow;
 
 
 
 
 
 
313
 
314
+ if ( $pagenow == 'upload.php' ) {
 
315
 
316
+ $wp_list_table = _get_list_table( 'WP_Media_List_Table' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
+ // only if manual watermarking is turned on and image watermark is set
319
+ if ( $wp_list_table->current_action() === 'applywatermark' && $this->options['watermark_image']['manual_watermarking'] == 1 && $this->options['watermark_image']['url'] != 0 ) {
320
+ // security check
321
+ check_admin_referer( 'bulk-media' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
+ $location = esc_url( remove_query_arg( array( 'watermarked', 'skipped', 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), wp_get_referer() ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
+ if ( ! $location ) {
326
+ $location = 'upload.php';
327
+ }
 
 
 
 
 
 
 
 
 
 
 
328
 
329
+ $location = esc_url( add_query_arg( 'paged', $wp_list_table->get_pagenum(), $location ) );
330
+
331
+ // make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
332
+ if ( isset( $_REQUEST['media'] ) ) {
333
+ $post_ids = array_map( 'intval', $_REQUEST['media'] );
334
+ }
335
+
336
+ // do we have selected attachments?
337
+ if ( $post_ids ) {
338
+ $watermarked = $skipped = 0;
339
+
340
+ foreach ( $post_ids as $post_id ) {
341
+ $data = wp_get_attachment_metadata( $post_id, false );
342
+
343
+ // is this really an image?
344
+ if ( in_array( get_post_mime_type( $post_id ), $this->allowed_mime_types ) && is_array( $data ) ) {
345
+ $this->apply_watermark( $data, 'manual' );
346
+ $watermarked ++;
347
+ } else
348
+ $skipped ++;
349
  }
350
+
351
+ $location = esc_url( add_query_arg( array( 'watermarked' => $watermarked, 'skipped' => $skipped ), $location ), null, '' );
352
  }
 
 
 
 
 
353
 
354
+ wp_redirect( $location );
355
+ exit();
356
+ } else
357
+ return;
358
  }
359
+ }
360
+
361
+ /**
362
+ * Display admin notices.
363
+ */
364
+ public function bulk_admin_notices() {
365
+ global $post_type, $pagenow;
366
 
367
+ if ( $pagenow === 'upload.php' ) {
368
+
369
+ if ( ! current_user_can( 'upload_files' ) )
370
+ return;
371
+
372
+ // hide media library notice
373
+ if ( isset( $_GET['iw_action'] ) && $_GET['iw_action'] == 'hide_library_notice' ) {
374
+ $this->options['watermark_image']['media_library_notice'] = false;
375
+ update_option( 'image_watermark_options', $this->options );
376
+ }
377
+
378
+ // check if manual watermarking is enabled
379
+ if ( ! empty( $this->options['watermark_image']['manual_watermarking'] ) && ( ! isset( $this->options['watermark_image']['media_library_notice']) || $this->options['watermark_image']['media_library_notice'] === true ) ) {
380
+ $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
381
+
382
+ if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], array( 'grid', 'list' ) ) ) {
383
+ $mode = $_GET['mode'];
384
+ }
385
+
386
+ // display notice in grid mode only
387
+ if ( $mode === 'grid' ) {
388
+ // get current admin url
389
+ $query_string = array();
390
+ parse_str( $_SERVER['QUERY_STRING'], $query_string );
391
+ $current_url = esc_url( add_query_arg( array_merge( (array) $query_string, array( 'iw_action' => 'hide_library_notice' ) ), '', admin_url( trailingslashit( $pagenow ) ) ) );
392
+
393
+ 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>';
394
+ }
395
+ }
396
+
397
+ if ( isset( $_REQUEST['watermarked'], $_REQUEST['skipped'] ) && $post_type === 'attachment' ) {
398
+ $watermarked = (int) $_REQUEST['watermarked'];
399
+ $skipped = (int) $_REQUEST['skipped'];
400
+
401
+ if ( $watermarked === 0 ) {
402
+ 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>';
403
+ } else {
404
+ 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>';
405
+ }
406
+
407
+ $_SERVER['REQUEST_URI'] = esc_url( remove_query_arg( array( 'watermarked', 'skipped' ), $_SERVER['REQUEST_URI'] ) );
408
+ }
409
  }
410
+ }
411
 
412
+ /**
413
+ * Create options page in menu.
414
+ */
415
+ public function options_page() {
416
+ add_options_page(
417
+ __( 'Image Watermark Options', 'image-watermark' ), __( 'Watermark', 'image-watermark' ), 'manage_options', 'watermark-options', array( &$this, 'options_page_output' )
418
+ );
419
+ }
420
 
421
+ /**
422
+ * Options page output.
423
+ */
424
+ public function options_page_output() {
425
 
426
+ if ( ! current_user_can( 'manage_options' ) )
427
+ return;
 
428
 
429
+ echo '
430
+ <div class="wrap">
431
+ <h2>' . __( 'Image Watermark', 'image-watermark' ) . '</h2>';
432
+
433
+ echo '
434
+ <div class="image-watermark-settings">
435
+ <div class="df-sidebar">
436
+ <div class="df-credits">
437
+ <h3 class="hndle">' . __( 'Image Watermark', 'image-watermark' ) . ' ' . $this->defaults['version'] . '</h3>
438
+ <div class="inside">
439
+ <h4 class="inner">' . __( 'Need support?', 'image-watermark' ) . '</h4>
440
+ <p class="inner">' . __( 'If you are having problems with this plugin, please 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>
441
+ <hr />
442
+ <h4 class="inner">' . __( 'Do you like this plugin?', 'image-watermark' ) . '</h4>
443
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" class="inner">
444
+ <input type="hidden" name="cmd" value="_s-xclick">
445
+ <input type="hidden" name="hosted_button_id" value="DCF3AXC9A5A88">
446
+ <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!">
447
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
448
+ </form>
449
+ <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 />' .
450
+ __( '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 />' .
451
+ __( '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>
452
+ </p>
453
+ <hr />
454
+ <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="' . EVENTS_MAKER_URL . '/images/logo-dfactory.png' . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
455
+ </div>
456
+ </div>
457
+ <form action="options.php" method="post">';
458
+
459
+ settings_fields( 'image_watermark_options' );
460
+ do_settings_sections( 'image_watermark_options' );
461
+
462
+ echo '
463
+ <p class="submit">';
464
+ submit_button( '', 'primary', 'save_image_watermark_options', false );
465
+ echo ' ';
466
+ submit_button( __( 'Reset to defaults', 'image-watermark' ), 'secondary', 'reset_image_watermark_options', false );
467
+
468
+ echo ' </p>
469
+ </form>
470
+ </div>
471
+ <div class="clear"></div>
472
+ </div>';
473
+ }
474
 
475
+ /**
476
+ * Register settings.
477
+ */
478
+ public function register_settings() {
479
+ register_setting( 'image_watermark_options', 'image_watermark_options', array( $this, 'validate_options' ) );
480
+
481
+ add_settings_section( 'image_watermark_general', __( 'General settings', 'image-watermark' ), '', 'image_watermark_options' );
482
+ add_settings_field( 'iw_automatic_watermarking', __( 'Automatic watermarking', 'image-watermark' ), array( $this, 'iw_automatic_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
483
+ add_settings_field( 'iw_manual_watermarking', __( 'Manual watermarking', 'image-watermark' ), array( $this, 'iw_manual_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
484
+ add_settings_field( 'iw_enable_for', __( 'Enable watermark for', 'image-watermark' ), array( $this, 'iw_enable_for' ), 'image_watermark_options', 'image_watermark_general' );
485
+ add_settings_field( 'iw_frontend_watermarking', __( 'Frontend watermarking', 'image-watermark' ), array( $this, 'iw_frontend_watermarking' ), 'image_watermark_options', 'image_watermark_general' );
486
+ add_settings_field( 'iw_deactivation', __( 'Deactivation', 'image-watermark' ), array( $this, 'iw_deactivation' ), 'image_watermark_options', 'image_watermark_general' );
487
+
488
+ add_settings_section( 'image_watermark_position', __( 'Watermark position', 'image-watermark' ), '', 'image_watermark_options' );
489
+ add_settings_field( 'iw_alignment', __( 'Watermark alignment', 'image-watermark' ), array( $this, 'iw_alignment' ), 'image_watermark_options', 'image_watermark_position' );
490
+ add_settings_field( 'iw_offset', __( 'Watermark offset', 'image-watermark' ), array( $this, 'iw_offset' ), 'image_watermark_options', 'image_watermark_position' );
491
+
492
+ add_settings_section( 'image_watermark_image', __( 'Watermark image', 'image-watermark' ), '', 'image_watermark_options' );
493
+ add_settings_field( 'iw_watermark_image', __( 'Watermark image', 'image-watermark' ), array( $this, 'iw_watermark_image' ), 'image_watermark_options', 'image_watermark_image' );
494
+ add_settings_field( 'iw_watermark_preview', __( 'Watermark preview', 'image-watermark' ), array( $this, 'iw_watermark_preview' ), 'image_watermark_options', 'image_watermark_image' );
495
+ add_settings_field( 'iw_watermark_size', __( 'Watermark size', 'image-watermark' ), array( $this, 'iw_watermark_size' ), 'image_watermark_options', 'image_watermark_image' );
496
+ add_settings_field( 'iw_watermark_size_custom', __( 'Watermark custom size', 'image-watermark' ), array( $this, 'iw_watermark_size_custom' ), 'image_watermark_options', 'image_watermark_image' );
497
+ add_settings_field( 'iw_watermark_size_scaled', __( 'Scale of watermark in relation to image width', 'image-watermark' ), array( $this, 'iw_watermark_size_scaled' ), 'image_watermark_options', 'image_watermark_image' );
498
+ add_settings_field( 'iw_watermark_opacity', __( 'Watermark transparency / opacity', 'image-watermark' ), array( $this, 'iw_watermark_opacity' ), 'image_watermark_options', 'image_watermark_image' );
499
+ add_settings_field( 'iw_image_quality', __( 'Image quality', 'image-watermark' ), array( $this, 'iw_image_quality' ), 'image_watermark_options', 'image_watermark_image' );
500
+ add_settings_field( 'iw_image_format', __( 'Image format', 'image-watermark' ), array( $this, 'iw_image_format' ), 'image_watermark_options', 'image_watermark_image' );
501
+
502
+ add_settings_section( 'image_watermark_protection', __( 'Image protection', 'image-watermark' ), '', 'image_watermark_options' );
503
+ add_settings_field( 'iw_protection_right_click', __( 'Right click', 'image-watermark' ), array( $this, 'iw_protection_right_click' ), 'image_watermark_options', 'image_watermark_protection' );
504
+ add_settings_field( 'iw_protection_drag_drop', __( 'Drag and drop', 'image-watermark' ), array( $this, 'iw_protection_drag_drop' ), 'image_watermark_options', 'image_watermark_protection' );
505
+ add_settings_field( 'iw_protection_logged', __( 'Logged-in users', 'image-watermark' ), array( $this, 'iw_protection_logged' ), 'image_watermark_options', 'image_watermark_protection' );
506
+ }
507
 
508
+ /**
509
+ * Automatic watermarking option.
510
+ */
511
+ public function iw_automatic_watermarking() {
512
+ ?>
513
+ <label for="iw_automatic_watermarking">
514
+ <input id="iw_automatic_watermarking" type="checkbox" <?php checked( ( ! empty( $this->options['watermark_image']['plugin_off'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[watermark_image][plugin_off]">
515
+ <?php echo __( 'Enable watermark for uploaded images.', 'image-watermark' ); ?>
516
+ </label>
517
+ <?php
518
+ }
519
 
520
+ /**
521
+ * Manual watermarking option.
522
+ */
523
+ public function iw_manual_watermarking() {
524
+ ?>
525
+ <label for="iw_manual_watermarking">
526
+ <input id="iw_manual_watermarking" type="checkbox" <?php checked( ( ! empty( $this->options['watermark_image']['manual_watermarking'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[watermark_image][manual_watermarking]">
527
+ <?php echo __( 'Enable Apply Watermark option for images in Media Library.', 'image-watermark' ); ?>
528
+ </label>
529
+ <?php
530
+ }
531
 
532
+ /**
533
+ * Enable watermark for option.
534
+ */
535
+ public function iw_enable_for() {
536
+ ?>
537
+ <fieldset id="iw_enable_for">
538
+ <div id="thumbnail-select">
539
+ <?php
540
+ foreach ( $this->image_sizes as $image_size ) {
541
+ ?>
542
+ <input name="iw_options[watermark_on][<?php echo $image_size; ?>]" type="checkbox" id="<?php echo $image_size; ?>" value="1" <?php echo (in_array( $image_size, array_keys( $this->options['watermark_on'] ) ) ? ' checked="checked"' : ''); ?> />
543
+ <label for="<?php echo $image_size; ?>"><?php echo $image_size; ?></label>
544
+ <?php
545
+ }
546
+ ?>
547
+ </div>
548
+ <p class="description">
549
+ <?php echo __( '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.', 'image-watermark' ); ?>
550
+ </p>
551
+
552
+ <?php
553
+ $watermark_cpt_on = array_keys( $this->options['watermark_cpt_on'] );
554
+
555
+ if ( in_array( 'everywhere', $watermark_cpt_on ) && count( $watermark_cpt_on ) === 1 ) {
556
+ $first_checked = true;
557
+ $second_checked = false;
558
+ $watermark_cpt_on = array();
559
+ } else {
560
+ $first_checked = false;
561
+ $second_checked = true;
562
+ }
563
+ ?>
564
+
565
+ <div id="cpt-specific">
566
+ <input id="df_option_everywhere" type="radio" name="iw_options[watermark_cpt_on]" value="everywhere" <?php echo ($first_checked === true ? 'checked="checked"' : ''); ?>/><label for="df_option_everywhere"><?php _e( 'everywhere', 'image-watermark' ); ?></label>
567
+ <input id="df_option_cpt" type="radio" name="iw_options[watermark_cpt_on]" value="specific" <?php echo ($second_checked === true ? 'checked="checked"' : ''); ?> /><label for="df_option_cpt"><?php _e( 'on selected post types only', 'image-watermark' ); ?></label>
568
+ </div>
569
+
570
+ <div id="cpt-select" <?php echo ($second_checked === false ? 'style="display: none;"' : ''); ?>>
571
+ <?php
572
+ foreach ( $this->get_post_types() as $cpt ) {
573
+ ?>
574
+ <input name="iw_options[watermark_cpt_on_type][<?php echo $cpt; ?>]" type="checkbox" id="<?php echo $cpt; ?>" value="1" <?php echo (in_array( $cpt, $watermark_cpt_on ) ? ' checked="checked"' : ''); ?> />
575
+ <label for="<?php echo $cpt; ?>"><?php echo $cpt; ?></label>
576
+ <?php
577
+ }
578
+ ?>
579
+ </div>
580
+
581
+ <p class="description"><?php echo __( 'Check custom post types on which watermark should be applied to uploaded images.', 'image-watermark' ); ?></p>
582
+ </fieldset>
583
+ <?php
584
+ }
585
 
586
+ /**
587
+ * Frontend watermarking option.
588
+ */
589
+ public function iw_frontend_watermarking() {
590
+ ?>
591
+ <label for="iw_frontend_watermarking">
592
+ <input id="iw_frontend_watermarking" type="checkbox" <?php checked( ( ! empty( $this->options['watermark_image']['frontend_active'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[watermark_image][frontend_active]">
593
+ <?php echo __( 'Enable frontend image uploading. (uploading script is not included, but you may use a plugin or custom code).', 'image-watermark' ); ?>
594
+ </label>
595
+ <span class="description"><?php echo __( '<br /><strong>Notice:</strong> This functionality works only if uploaded images are processed using WordPress native upload methods.', 'image-watermark' ); ?></span>
596
+ <?php
597
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
 
599
+ /**
600
+ * Remove data on deactivation option.
601
+ */
602
+ public function iw_deactivation() {
603
+ ?>
604
+ <label for="iw_deactivation">
605
+ <input id="iw_deactivation" type="checkbox" <?php checked( ( ! empty( $this->options['watermark_image']['deactivation_delete'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[watermark_image][deactivation_delete]">
606
+ <?php echo __( 'Delete all database settings on plugin deactivation.', 'image-watermark' ); ?>
607
+ </label>
608
+ <?php
609
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
 
611
+ /**
612
+ * Watermark alignment option.
613
+ */
614
+ public function iw_alignment() {
615
+ ?>
616
+ <fieldset id="iw_alignment">
617
+ <table id="watermark_position" border="1">
618
+ <?php
619
+ $watermark_position = $this->options['watermark_image']['position'];
620
+
621
+ foreach ( $this->watermark_positions['y'] as $y ) {
622
+ ?>
623
+ <tr>
624
  <?php
625
+ foreach ( $this->watermark_positions['x'] as $x ) {
 
 
 
 
 
626
  ?>
627
+ <td title="<?php echo ucfirst( $y . ' ' . $x ); ?>">
628
+ <input name="iw_options[watermark_image][position]" type="radio" value="<?php echo $y . '_' . $x; ?>"<?php echo ($watermark_position == $y . '_' . $x ? ' checked="checked"' : NULL); ?> />
629
+ </td>
630
+ <?php }
631
+ ?>
632
+ </tr>
633
+ <?php
634
+ }
635
+ ?>
636
+ </table>
637
+ <p class="description"><?php echo __( 'Choose the position of watermark image.', 'image-watermark' ); ?></p>
638
+ </fieldset>
639
+ <?php
640
+ }
641
 
642
+ /**
643
+ * Watermark offset option.
644
+ */
645
+ public function iw_offset() {
646
+ ?>
647
+ <fieldset id="iw_offset">
648
+ <?php echo __( 'x:', 'image-watermark' ); ?> <input type="text" size="5" name="iw_options[watermark_image][offset_width]" value="<?php echo $this->options['watermark_image']['offset_width']; ?>"> <?php echo __( 'px', 'image-watermark' ); ?>
649
+ <br />
650
+ <?php echo __( 'y:', 'image-watermark' ); ?> <input type="text" size="5" name="iw_options[watermark_image][offset_height]" value="<?php echo $this->options['watermark_image']['offset_height']; ?>"> <?php echo __( 'px', 'image-watermark' ); ?>
651
+ </fieldset>
652
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
653
  }
654
 
655
+ /**
656
+ * Watermark image option.
657
+ */
658
+ public function iw_watermark_image() {
659
+ if ( $this->options['watermark_image']['url'] !== NULL && $this->options['watermark_image']['url'] != 0 ) {
660
+ $image = wp_get_attachment_image_src( $this->options['watermark_image']['url'], array( 300, 300 ), false );
661
+ $image_selected = true;
662
+ } else {
663
+ $image_selected = false;
664
+ }
665
+ ?>
666
+ <div class="iw_watermark_image">
667
+ <input id="upload_image" type="hidden" name="iw_options[watermark_image][url]" value="<?php echo (int) $this->options['watermark_image']['url']; ?>" />
668
+ <input id="upload_image_button" type="button" class="button button-secondary" value="<?php echo __( 'Select image', 'image-watermark' ); ?>" />
669
+ <input id="turn_off_image_button" type="button" class="button button-secondary" value="<?php echo __( 'Remove image', 'image-watermark' ); ?>" <?php if ( $image_selected === false ) echo 'disabled="disabled"'; ?>/>
670
+ <p class="description"><?php _e( 'You have to save changes after the selection or removal of the image.', 'image-watermark' ); ?></p>
671
+ </div>
672
+ <?php
673
+ }
674
 
675
  /**
676
+ * Watermark image preview.
677
  */
678
+ public function iw_watermark_preview() {
679
+ if ( $this->options['watermark_image']['url'] !== NULL && $this->options['watermark_image']['url'] != 0 ) {
680
+ $image = wp_get_attachment_image_src( $this->options['watermark_image']['url'], array( 300, 300 ), false );
681
+ $image_selected = true;
682
+ } else {
683
+ $image_selected = false;
 
 
 
684
  }
685
+ ?>
686
+ <fieldset id="iw_watermark_preview">
687
+ <div id="previewImg_imageDiv">
688
+ <?php
689
+ if ( $image_selected === true ) {
690
+ $image = wp_get_attachment_image_src( $this->options['watermark_image']['url'], array( 300, 300 ), false );
691
+ ?>
692
+ <img id="previewImg_image" src="<?php echo $image[0]; ?>" alt="" width="300" />
693
+ <?php } else { ?>
694
+ <img id="previewImg_image" src="" alt="" width="300" style="display: none;" />
695
+ <?php }
696
+ ?>
697
+ </div>
698
+ <p id="previewImageInfo" class="description">
699
+ <?php
700
+ if ( $image_selected === false ) {
701
+ _e( 'Watermak has not been selected yet.', 'image-watermark' );
702
+ } else {
703
+ $image_full_size = wp_get_attachment_image_src( $this->options['watermark_image']['url'], 'full', false );
704
+
705
+ _e( 'Original size', 'image-watermark' ) . ': ' . $image_full_size[1] . ' px / ' . $image_full_size[2] . ' px';
706
+ }
707
+ ?>
708
+ </p>
709
+ </fieldset>
710
+ <?php
711
  }
712
 
713
+ /**
714
+ * Watermark size option.
715
+ */
716
+ public function iw_watermark_size() {
717
+ ?>
718
+ <fieldset id="iw_watermark_size">
719
+ <div id="watermark-type">
720
+ <label for="type1"><?php _e( 'original', 'image-watermark' ); ?></label>
721
+ <input type="radio" id="type1" value="0" name="iw_options[watermark_image][watermark_size_type]" <?php checked( $this->options['watermark_image']['watermark_size_type'], 0, true ); ?> />
722
+ <label for="type2"><?php _e( 'custom', 'image-watermark' ); ?></label>
723
+ <input type="radio" id="type2" value="1" name="iw_options[watermark_image][watermark_size_type]" <?php checked( $this->options['watermark_image']['watermark_size_type'], 1, true ); ?> />
724
+ <label for="type3"><?php _e( 'scaled', 'image-watermark' ); ?></label>
725
+ <input type="radio" id="type3" value="2" name="iw_options[watermark_image][watermark_size_type]" <?php checked( $this->options['watermark_image']['watermark_size_type'], 2, true ); ?> />
726
+ </div>
727
+ <p class="description"><?php _e( 'Select method of aplying watermark size.', 'image-watermark' ); ?></p>
728
+ </fieldset>
729
+ <?php
730
+ }
731
 
732
  /**
733
+ * Watermark custom size option.
734
  */
735
+ public function iw_watermark_size_custom() {
736
+ ?>
737
+ <fieldset id="iw_watermark_size_custom">
738
+ <?php _e( 'x:', 'image-watermark' ); ?> <input type="text" size="5" name="iw_options[watermark_image][absolute_width]" value="<?php echo $this->options['watermark_image']['absolute_width']; ?>"> <?php _e( 'px', 'image-watermark' ); ?>
739
+ <br />
740
+ <?php _e( 'y:', 'image-watermark' ); ?> <input type="text" size="5" name="iw_options[watermark_image][absolute_height]" value="<?php echo $this->options['watermark_image']['absolute_height']; ?>"> <?php _e( 'px', 'image-watermark' ); ?>
741
+ </fieldset>
742
+ <p class="description"><?php _e( 'Those dimensions will be used if "custom" method is selected above.', 'image-watermark' ); ?></p>
743
+ <?php
744
+ }
745
+
746
+ /**
747
+ * Watermark scaled size option.
748
+ */
749
+ public function iw_watermark_size_scaled() {
750
+ ?>
751
+ <fieldset id="iw_watermark_size_scaled">
752
+ <div>
753
+ <input type="text" id="iw_size_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][width]" value="<?php echo $this->options['watermark_image']['width']; ?>" />
754
+ <div class="wplike-slider">
755
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_size_span" title="<?php echo $this->options['watermark_image']['width']; ?>"></span><span class="right hide-if-no-js">100</span>
756
+ </div>
757
+ </div>
758
+ </fieldset>
759
+ <p class="description"><?php _e( '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.', 'image-watermark' ); ?></p>
760
+ <?php
761
+ }
762
+
763
+ /**
764
+ * Watermark custom size option.
765
+ */
766
+ public function iw_watermark_opacity() {
767
+ ?>
768
+ <fieldset id="iw_watermark_opacity">
769
+ <div>
770
+ <input type="text" id="iw_opacity_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][transparent]" value="<?php echo $this->options['watermark_image']['transparent']; ?>" />
771
+ <div class="wplike-slider">
772
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_opacity_span" title="<?php echo $this->options['watermark_image']['transparent']; ?>"></span><span class="right hide-if-no-js">100</span>
773
+ </div>
774
+ </div>
775
+ </fieldset>
776
+ <p class="description"><?php _e( 'Enter a number ranging from 0 to 100. 0 makes watermark image completely transparent, 100 shows it as is.', 'image-watermark' ); ?></p>
777
+ <?php
778
+ }
779
+
780
+ /**
781
+ * Image quality option.
782
+ */
783
+ public function iw_image_quality() {
784
+ ?>
785
+ <fieldset id="iw_image_quality">
786
+ <div>
787
+ <input type="text" id="iw_quality_input" maxlength="3" class="hide-if-js" name="iw_options[watermark_image][quality]" value="<?php echo $this->options['watermark_image']['quality']; ?>" />
788
+ <div class="wplike-slider">
789
+ <span class="left hide-if-no-js">0</span><span class="middle" id="iw_quality_span" title="<?php echo $this->options['watermark_image']['quality']; ?>"></span><span class="right hide-if-no-js">100</span>
790
+ </div>
791
+ </div>
792
+ </fieldset>
793
+ <p class="description"><?php _e( 'Set output image quality.', 'image-watermark' ); ?></p>
794
+ <?php
795
+ }
796
+
797
+ /**
798
+ * Image format option.
799
+ */
800
+ public function iw_image_format() {
801
+ ?>
802
+ <fieldset id="iw_image_format">
803
+ <div id="jpeg-format">
804
+ <label for="baseline"><?php _e( 'baseline', 'image-watermark' ); ?></label>
805
+ <input type="radio" id="baseline" value="baseline" name="iw_options[watermark_image][jpeg_format]" <?php checked( $this->options['watermark_image']['jpeg_format'], 'baseline', true ); ?> />
806
+ <label for="progressive"><?php _e( 'progressive', 'image-watermark' ); ?></label>
807
+ <input type="radio" id="progressive" value="progressive" name="iw_options[watermark_image][jpeg_format]" <?php checked( $this->options['watermark_image']['jpeg_format'], 'progressive', true ); ?> />
808
+ </div>
809
+ </fieldset>
810
+ <p class="description"><?php _e( 'Select baseline or progressive image format.', 'image-watermark' ); ?></p>
811
+ <?php
812
  }
813
 
814
+ /**
815
+ * Right click image protection option.
816
+ */
817
+ public function iw_protection_right_click() {
818
+ ?>
819
+ <label for="iw_protection_right_click">
820
+ <input id="iw_protection_right_click" type="checkbox" <?php checked( ( ! empty( $this->options['image_protection']['rightclick'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[image_protection][rightclick]">
821
+ <?php _e( 'Disable right mouse click on images', 'image-watermark' ); ?>
822
+ </label>
823
+ <?php
824
+ }
825
+
826
+ /**
827
+ * Drag and drop image protection option.
828
+ */
829
+ public function iw_protection_drag_drop() {
830
+ ?>
831
+ <label for="iw_protection_drag_drop">
832
+ <input id="iw_protection_drag_drop" type="checkbox" <?php checked( ( ! empty( $this->options['image_protection']['draganddrop'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[image_protection][draganddrop]">
833
+ <?php _e( 'Prevent drag and drop', 'image-watermark' ); ?>
834
+ </label>
835
+ <?php
836
+ }
837
+
838
+ /**
839
+ * Logged-in users image protection option.
840
+ */
841
+ public function iw_protection_logged() {
842
+ ?>
843
+ <label for="iw_protection_logged">
844
+ <input id="iw_protection_logged" type="checkbox" <?php checked( ( ! empty( $this->options['image_protection']['forlogged'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[image_protection][forlogged]">
845
+ <?php _e( 'Enable image protection for logged-in users also', 'image-watermark' ); ?>
846
+ </label>
847
+ <?php
848
+ }
849
+
850
+ /**
851
+ * Validate options.
852
+ *
853
+ * @param array $input
854
+ * @return array
855
+ */
856
+ public function validate_options( $input ) {
857
+
858
+ if ( ! current_user_can( 'manage_options' ) )
859
+ return $input;
860
+
861
+ if ( isset( $_POST['save_image_watermark_options'] ) ) {
862
+
863
+ $input['watermark_image']['plugin_off'] = isset( $_POST['iw_options']['watermark_image']['plugin_off'] ) ? ((bool) $_POST['iw_options']['watermark_image']['plugin_off'] == 1 ? true : false) : $this->defaults['options']['watermark_image']['plugin_off'];
864
+ $input['watermark_image']['manual_watermarking'] = isset( $_POST['iw_options']['watermark_image']['manual_watermarking'] ) ? ((bool) $_POST['iw_options']['watermark_image']['manual_watermarking'] == 1 ? true : false) : $this->defaults['options']['watermark_image']['manual_watermarking'];
865
+
866
+ $watermark_on = array();
867
+
868
+ if ( isset( $_POST['iw_options']['watermark_on'] ) && is_array( $_POST['iw_options']['watermark_on'] ) ) {
869
+ foreach ( $this->image_sizes as $size ) {
870
+ if ( in_array( $size, array_keys( $_POST['iw_options']['watermark_on'] ) ) ) {
871
+ $watermark_on[$size] = 1;
872
+ }
873
+ }
874
+ }
875
+ $input['watermark_on'] = $watermark_on;
876
+
877
+ $input['watermark_cpt_on'] = $this->defaults['options']['watermark_cpt_on'];
878
+
879
+ if ( isset( $_POST['iw_options']['watermark_cpt_on'] ) && in_array( esc_attr( $_POST['iw_options']['watermark_cpt_on'] ), array( 'everywhere', 'specific' ) ) ) {
880
+ if ( $_POST['iw_options']['watermark_cpt_on'] === 'specific' ) {
881
+ if ( isset( $_POST['iw_options']['watermark_cpt_on_type'] ) ) {
882
+ $tmp = array();
883
+
884
+ foreach ( $this->get_post_types() as $cpt ) {
885
+ if ( in_array( $cpt, array_keys( $_POST['iw_options']['watermark_cpt_on_type'] ) ) ) {
886
+ $tmp[$cpt] = 1;
887
+ }
888
+ }
889
+
890
+ if ( count( $tmp ) > 0 ) {
891
+ $input['watermark_cpt_on'] = $tmp;
892
+ }
893
+ }
894
+ }
895
+ }
896
+
897
+ $input['watermark_image']['frontend_active'] = isset( $_POST['iw_options']['watermark_image']['frontend_active'] ) ? ((bool) $_POST['iw_options']['watermark_image']['frontend_active'] == 1 ? true : false) : $this->defaults['options']['watermark_image']['frontend_active'];
898
+ $input['watermark_image']['deactivation_delete'] = isset( $_POST['iw_options']['watermark_image']['deactivation_delete'] ) ? ((bool) $_POST['iw_options']['watermark_image']['deactivation_delete'] == 1 ? true : false) : $this->defaults['options']['watermark_image']['deactivation_delete'];
899
+
900
+ $positions = array();
901
+
902
+ foreach ( $this->watermark_positions['y'] as $position_y ) {
903
+ foreach ( $this->watermark_positions['x'] as $position_x ) {
904
+ $positions[] = $position_y . '_' . $position_x;
905
+ }
906
+ }
907
+ $input['watermark_image']['position'] = isset( $_POST['iw_options']['watermark_image']['position'] ) && in_array( esc_attr( $_POST['iw_options']['watermark_image']['position'] ), $positions ) ? esc_attr( $_POST['iw_options']['watermark_image']['position'] ) : $this->defaults['options']['watermark_image']['position'];
908
+
909
+ $input['watermark_image']['offset_width'] = isset( $_POST['iw_options']['watermark_image']['offset_width'] ) ? (int) $_POST['iw_options']['watermark_image']['offset_width'] : $this->defaults['options']['watermark_image']['offset_width'];
910
+ $input['watermark_image']['offset_height'] = isset( $_POST['iw_options']['watermark_image']['offset_height'] ) ? (int) $_POST['iw_options']['watermark_image']['offset_height'] : $this->defaults['options']['watermark_image']['offset_height'];
911
+ $input['watermark_image']['url'] = isset( $_POST['iw_options']['watermark_image']['url'] ) ? (int) $_POST['iw_options']['watermark_image']['url'] : $this->defaults['options']['watermark_image']['url'];
912
+ $input['watermark_image']['watermark_size_type'] = isset( $_POST['iw_options']['watermark_image']['watermark_size_type'] ) ? (int) $_POST['iw_options']['watermark_image']['watermark_size_type'] : $this->defaults['options']['watermark_image']['watermark_size_type'];
913
+ $input['watermark_image']['absolute_width'] = isset( $_POST['iw_options']['watermark_image']['absolute_width'] ) ? (int) $_POST['iw_options']['watermark_image']['absolute_width'] : $this->defaults['options']['watermark_image']['absolute_width'];
914
+ $input['watermark_image']['absolute_height'] = isset( $_POST['iw_options']['watermark_image']['absolute_height'] ) ? (int) $_POST['iw_options']['watermark_image']['absolute_height'] : $this->defaults['options']['watermark_image']['absolute_height'];
915
+ $input['watermark_image']['width'] = isset( $_POST['iw_options']['watermark_image']['width'] ) ? (int) $_POST['iw_options']['watermark_image']['width'] : $this->defaults['options']['watermark_image']['width'];
916
+ $input['watermark_image']['transparent'] = isset( $_POST['iw_options']['watermark_image']['transparent'] ) ? (int) $_POST['iw_options']['watermark_image']['transparent'] : $this->defaults['options']['watermark_image']['transparent'];
917
+ $input['watermark_image']['quality'] = isset( $_POST['iw_options']['watermark_image']['quality'] ) ? (int) $_POST['iw_options']['watermark_image']['quality'] : $this->defaults['options']['watermark_image']['quality'];
918
+ $input['watermark_image']['jpeg_format'] = isset( $_POST['iw_options']['watermark_image']['jpeg_format'] ) && in_array( esc_attr( $_POST['iw_options']['watermark_image']['jpeg_format'] ), array( 'baseline', 'progressive' ) ) ? esc_attr( $_POST['iw_options']['watermark_image']['jpeg_format'] ) : $this->defaults['options']['watermark_image']['jpeg_format'];
919
+
920
+ $input['image_protection']['rightclick'] = isset( $_POST['iw_options']['image_protection']['rightclick'] ) ? ((bool) $_POST['iw_options']['image_protection']['rightclick'] == 1 ? true : false) : $this->defaults['options']['image_protection']['rightclick'];
921
+ $input['image_protection']['draganddrop'] = isset( $_POST['iw_options']['image_protection']['draganddrop'] ) ? ((bool) $_POST['iw_options']['image_protection']['draganddrop'] == 1 ? true : false) : $this->defaults['options']['image_protection']['draganddrop'];
922
+ $input['image_protection']['forlogged'] = isset( $_POST['iw_options']['image_protection']['forlogged'] ) ? ((bool) $_POST['iw_options']['image_protection']['forlogged'] == 1 ? true : false) : $this->defaults['options']['image_protection']['forlogged'];
923
+
924
+ add_settings_error( 'iw_settings_errors', 'iw_settings_saved', __( 'Settings saved.', 'image-watermark' ), 'updated' );
925
+ } elseif ( isset( $_POST['reset_image_watermark_options'] ) ) {
926
+
927
+ $input = $this->defaults['options'];
928
+
929
+ add_settings_error( 'iw_settings_errors', 'iw_settings_reset', __( 'Settings restored to defaults.', 'image-watermark' ), 'updated' );
930
+ }
931
+
932
+ if ( $input['watermark_image']['plugin_off'] != 0 || $input['watermark_image']['manual_watermarking'] != 0 ) {
933
+ if ( empty( $input['watermark_image']['url'] ) )
934
+ add_settings_error( 'iw_settings_errors', 'iw_image_not_set', __( 'Watermark will not be applied when watermark image is not set.', 'image-watermark' ), 'error' );
935
+
936
+ if ( empty( $input['watermark_on'] ) )
937
+ add_settings_error( 'iw_settings_errors', 'iw_sizes_not_set', __( 'Watermark will not be applied when no image sizes are selected.', 'image-watermark' ), 'error' );
938
+ }
939
+
940
+ return $input;
941
+ }
942
 
943
  /**
944
+ * Apply watermark to selected image sizes.
945
  *
946
+ * @param array $data
947
+ * @param int $attachment_id
948
+ * @return array
949
  */
950
+ public function apply_watermark( $data, $attachment_id ) {
 
 
 
 
951
 
952
+ $post = get_post( (int) $attachment_id );
953
+ $post_id = ( ! empty( $post ) ? (int) $post->post_parent : 0);
954
 
955
+ // something went wrong or is it automatic mode?
956
+ if ( $attachment_id !== 'manual' && ($this->is_admin === true && ! ((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))) )
957
  return $data;
958
 
959
+ if ( apply_filters( 'iw_watermark_display', $attachment_id ) === false )
960
  return $data;
961
 
962
  $upload_dir = wp_upload_dir();
963
 
964
+ // is this really an iamge?
965
+ if ( getimagesize( $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'] ) !== false ) {
966
+ // loop through active image sizes
967
+ foreach ( $this->options['watermark_on'] as $image_size => $active_size ) {
968
+ if ( $active_size === 1 ) {
969
+ switch ( $image_size ) {
 
 
 
 
970
  case 'full':
971
+ $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
972
  break;
973
 
974
  default:
975
+ if ( ! empty( $data['sizes'] ) && array_key_exists( $image_size, $data['sizes'] ) ) {
976
+ $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname( $data['file'] ) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
977
+ } else {
978
+ // early getaway
 
 
 
979
  continue 2;
980
  }
981
  }
982
 
983
+ do_action( 'iw_before_apply_watermark' );
984
 
985
+ // apply watermark
986
+ $this->do_watermark( $filepath );
987
 
988
+ do_action( 'iw_after_apply_watermark' );
989
  }
990
  }
991
  }
992
 
993
+ // pass forward attachment metadata
994
  return $data;
995
  }
996
 
 
997
  /**
998
+ * Apply watermark to image.
999
+ *
1000
+ * @param string $filepath
1001
+ */
1002
+ public function do_watermark( $filepath ) {
 
 
 
 
 
 
 
 
 
 
 
1003
 
1004
+ $options = apply_filters( 'iw_watermark_options', $this->options );
1005
 
1006
+ // get image mime type
1007
+ $mime_type = wp_check_filetype( $filepath );
1008
 
1009
+ // get image resource
1010
+ if ( ($image = $this->get_image_resource( $filepath, $mime_type['type'] )) !== false ) {
1011
+ // add watermark image to image
1012
+ if ( $this->add_watermark_image( $image, $options ) !== false ) {
 
 
 
 
1013
 
1014
+ if ( $options['watermark_image']['jpeg_format'] === 'progressive' ) {
1015
+ imageinterlace( $image, true );
 
1016
  }
1017
 
1018
+ // save watermarked image
1019
+ $this->save_image_file( $image, $mime_type['type'], $filepath, $options['watermark_image']['quality'] );
1020
  }
1021
  }
1022
  }
1023
 
 
1024
  /**
1025
+ * Add watermark image to image.
1026
  *
1027
+ * @param resource $image
1028
+ * @param array $opt
1029
+ * @return resource
1030
  */
1031
+ private function add_watermark_image( $image, $opt ) {
1032
+ // due to allow_url_fopen restrictions on some servers in getimagesize() we need to use server path (not URL)
 
1033
  $upload_dir = wp_upload_dir();
1034
+ $watermark_file = wp_get_attachment_metadata( $opt['watermark_image']['url'], true );
1035
+ $url = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $watermark_file['file'];
1036
+ $watermark_file_info = getimagesize( $url );
1037
 
1038
+ switch ( $watermark_file_info['mime'] ) {
 
1039
  case 'image/jpeg':
1040
  case 'image/pjpeg':
1041
+ $watermark = imagecreatefromjpeg( $url );
1042
  break;
1043
 
1044
  case 'image/gif':
1045
+ $watermark = imagecreatefromgif( $url );
1046
  break;
1047
 
1048
  case 'image/png':
1049
+ $watermark = imagecreatefrompng( $url );
1050
  break;
1051
 
1052
  default:
1053
+ return false;
1054
  }
1055
 
1056
+ $watermark_width = imagesx( $watermark );
1057
+ $watermark_height = imagesy( $watermark );
1058
+ $img_width = imagesx( $image );
1059
+ $img_height = imagesy( $image );
1060
+ $size_type = $opt['watermark_image']['watermark_size_type'];
1061
 
1062
+ if ( $size_type === 1 ) { // custom
1063
+ $w = $opt['watermark_image']['absolute_width'];
1064
+ $h = $opt['watermark_image']['absolute_height'];
1065
+ } elseif ( $size_type === 2 ) { // scale
1066
+ $ratio = $img_width * $opt['watermark_image']['width'] / 100 / $watermark_width;
 
 
 
1067
 
1068
+ $w = (int) ($watermark_width * $ratio);
1069
+ $h = (int) ($watermark_height * $ratio);
1070
 
1071
+ // if watermark scaled height is bigger then image watermark
1072
+ if ( $h > $img_height ) {
1073
+ $w = (int) ($img_height * $w / $h);
 
1074
  $h = $img_height;
1075
  }
1076
+ } else { // original
 
 
1077
  $w = $watermark_width;
1078
  $h = $watermark_height;
1079
  }
1080
 
1081
+ switch ( $opt['watermark_image']['position'] ) {
 
1082
  case 'top_left':
1083
  $dest_x = $dest_y = 0;
1084
  break;
1123
  $dest_y = ($img_height / 2) - ($h / 2);
1124
  }
1125
 
1126
+ $dest_x += $opt['watermark_image']['offset_width'];
1127
+ $dest_y += $opt['watermark_image']['offset_height'];
1128
 
1129
+ $this->imagecopymerge_alpha( $image, $this->resize( $watermark, $url, $w, $h, $watermark_file_info ), $dest_x, $dest_y, 0, 0, $w, $h, $opt['watermark_image']['transparent'] );
1130
 
1131
  return $image;
1132
  }
1133
 
 
1134
  /**
1135
+ * Create new image function.
1136
+ *
1137
+ * @param resource $dst_im
1138
+ * @param resource $src_im
1139
+ * @param int $dst_x
1140
+ * @param int $dst_y
1141
+ * @param int $src_x
1142
+ * @param int $src_y
1143
+ * @param int $src_w
1144
+ * @param int $src_h
1145
+ * @param int $pct
1146
+ */
1147
+ private function imagecopymerge_alpha( $dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct ) {
1148
+ // create a cut resource
1149
+ $cut = imagecreatetruecolor( $src_w, $src_h );
1150
 
1151
+ // copy relevant section from background to the cut resource
1152
+ imagecopy( $cut, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h );
1153
 
1154
+ // copy relevant section from watermark to the cut resource
1155
+ imagecopy( $cut, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h );
1156
 
1157
+ // insert cut resource to destination image
1158
+ imagecopymerge( $dst_im, $cut, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct );
1159
  }
1160
 
 
1161
  /**
1162
+ * Resize image function.
1163
+ *
1164
+ * @param resource $Im
1165
+ * @param string $path
1166
+ * @param int $nWidth
1167
+ * @param int $nHeight
1168
+ * @param array $imgInfo
1169
+ * @return resource
1170
+ */
1171
+ private function resize( $im, $path, $nWidth, $nHeight, $imgInfo ) {
1172
+ $newImg = imagecreatetruecolor( $nWidth, $nHeight );
1173
+
1174
+ // check if this image is PNG, then set if transparent
1175
+ if ( $imgInfo[2] === 3 ) {
1176
+ imagealphablending( $newImg, false );
1177
+ imagesavealpha( $newImg, true );
1178
+ $transparent = imagecolorallocatealpha( $newImg, 255, 255, 255, 127 );
1179
+ imagefilledrectangle( $newImg, 0, 0, $nWidth, $nHeight, $transparent );
1180
  }
1181
 
1182
+ imagecopyresampled( $newImg, $im, 0, 0, 0, 0, $nWidth, $nHeight, $imgInfo[0], $imgInfo[1] );
1183
 
1184
  return $newImg;
1185
  }
1186
 
 
1187
  /**
1188
+ * Get image resource accordingly to mimetype.
1189
+ *
1190
+ * @param string $filepath
1191
+ * @param string $mime_type
1192
+ * @return resource
1193
+ */
1194
+ private function get_image_resource( $filepath, $mime_type ) {
1195
+ switch ( $mime_type ) {
 
 
1196
  case 'image/jpeg':
1197
  case 'image/pjpeg':
1198
+ return imagecreatefromjpeg( $filepath );
1199
 
1200
  case 'image/png':
1201
+ $res = imagecreatefrompng( $filepath );
1202
+ $transparent = imagecolorallocatealpha( $res, 255, 255, 254, 127 );
1203
+ imagefilledrectangle( $res, 0, 0, imagesx( $res ), imagesy( $res ), $transparent );
1204
  return $res;
1205
 
1206
  default:
1207
+ return false;
1208
  }
1209
  }
1210
 
 
1211
  /**
1212
+ * Save image from image resource.
1213
  *
1214
+ * @param resource $image
1215
+ * @param string $mime_type
1216
+ * @param string $filepath
1217
+ * @return boolean
1218
  */
1219
+ private function save_image_file( $image, $mime_type, $filepath, $quality ) {
1220
+ switch ( $mime_type ) {
 
 
1221
  case 'image/jpeg':
1222
  case 'image/pjpeg':
1223
+ imagejpeg( $image, $filepath, $quality );
1224
  break;
1225
 
1226
  case 'image/png':
1227
+ imagepng( $image, $filepath, (int) round( 9 * $quality / 100 ) );
1228
  break;
1229
  }
1230
  }
1231
+
1232
+ /**
1233
+ * Add links to Support Forum.
1234
+ *
1235
+ * @param array $links
1236
+ * @param string $file
1237
+ * @return array
1238
+ */
1239
+ public function plugin_extend_links( $links, $file ) {
1240
+ if ( ! current_user_can( 'install_plugins' ) )
1241
+ return $links;
1242
+
1243
+ $plugin = plugin_basename( __FILE__ );
1244
+
1245
+ if ( $file == $plugin ) {
1246
+ return array_merge(
1247
+ $links, array( sprintf( '<a href="http://www.dfactory.eu/support/forum/image-watermark/" target="_blank">%s</a>', __( 'Support', 'image-watermark' ) ) )
1248
+ );
1249
+ }
1250
+
1251
+ return $links;
1252
+ }
1253
+
1254
+ /**
1255
+ * Add links to Settings page.
1256
+ *
1257
+ * @param array $links
1258
+ * @param string $file
1259
+ * @return array
1260
+ */
1261
+ function plugin_settings_link( $links, $file ) {
1262
+ if ( ! is_admin() || ! current_user_can( 'manage_options' ) )
1263
+ return $links;
1264
+
1265
+ static $plugin;
1266
+
1267
+ $plugin = plugin_basename( __FILE__ );
1268
+
1269
+ if ( $file == $plugin ) {
1270
+ $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php' ) . '?page=watermark-options', __( 'Settings', 'image-watermark' ) );
1271
+ array_unshift( $links, $settings_link );
1272
+ }
1273
+
1274
+ return $links;
1275
+ }
1276
+
1277
  }
1278
 
1279
  $image_watermark = new Image_Watermark();
 
js/admin-settings.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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', 'input#watermark-reset', 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
+ } );
js/admin-upload.js ADDED
@@ -0,0 +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: upload_manager_args.title,
10
+ frame: upload_manager_args.frame,
11
+ button: upload_manager_args.button,
12
+ multiple: upload_manager_args.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
+ $( '#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
+ $( '#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( upload_manager_args.originalSize + ': ' + this.width + ' px / ' + this.height + ' px' );
42
+ }
43
+
44
+ } else {
45
+
46
+ $( '#turn_off_image_button' ).attr( 'disabled', 'true' );
47
+ $( '#upload_image' ).val( 0 );
48
+ $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', '' ).hide();
49
+ $( 'p#previewImageInfo' ).html( '<strong>' + upload_manager_args.notAllowedImg + '</strong>' );
50
+
51
+ }
52
+ },
53
+ init: function () {
54
+ $( '#wpbody' ).on( 'click', 'input#upload_image_button', function ( e ) {
55
+ e.preventDefault();
56
+ watermarkFileUpload.frame().open();
57
+ } );
58
+ }
59
+ };
60
+
61
+ watermarkFileUpload.init();
62
+
63
+ $( document ).on( 'click', '#turn_off_image_button', function ( event ) {
64
+ $( this ).attr( 'disabled', 'true' );
65
+ $( '#upload_image' ).val( 0 );
66
+ $( 'div#previewImg_imageDiv img#previewImg_image' ).attr( 'src', '' ).hide();
67
+ $( 'p#previewImageInfo' ).html( upload_manager_args.noSelectedImg );
68
+ } );
69
+
70
+ } );
js/apply-watermark-admin.js DELETED
@@ -1,4 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- jQuery('<option>').val('applywatermark').text(watermark_args.apply_watermark).appendTo("select[name='action']");
3
- jQuery('<option>').val('applywatermark').text(watermark_args.apply_watermark).appendTo("select[name='action2']");
4
- });
 
 
 
 
js/image-watermark-admin.js DELETED
@@ -1,63 +0,0 @@
1
- jQuery(document).ready(function($) {
2
-
3
- //hover states
4
- $('#dialog_link, ul#icons li').hover(
5
- function() { $(this).addClass('ui-state-hover'); },
6
- function() { $(this).removeClass('ui-state-hover'); }
7
- );
8
-
9
- //buttons
10
- $('#deactivation-delete, #run-watermark, #run-watermark-front, #jpeg-format, #thumbnail-select, #watermark-type, #cpt-select, #cpt-specific, #run-manual-watermark').buttonset();
11
-
12
- //enable watermark for
13
- $(document).on('change', '#df_option_everywhere, #df_option_cpt', function() {
14
- if($('#cpt-specific input[name=df_watermark_cpt_on]:checked').val() === 'everywhere') {
15
- $('#cpt-select').fadeOut(300);
16
- } else if($('#cpt-specific input[name=df_watermark_cpt_on]:checked').val() === 'specific') {
17
- $('#cpt-select').fadeIn(300);
18
- }
19
- });
20
-
21
- $(document).on('click', 'input#watermark-reset', function() {
22
- return confirm(iwArgs.resetToDefaults);
23
- });
24
-
25
- //size slider
26
- $('#iw_size_span').slider({
27
- value: $('#iw_size_input').val(),
28
- min: 0,
29
- max: 100,
30
- step: 1,
31
- orientation: 'horizontal',
32
- slide: function(e, ui) {
33
- $('#iw_size_input').attr('value', ui.value);
34
- $('#iw_size_span').attr('title', ui.value);
35
- }
36
- });
37
-
38
- //opacity slider
39
- $('#iw_opacity_span').slider({
40
- value: $('#iw_opacity_input').val(),
41
- min: 0,
42
- max: 100,
43
- step: 1,
44
- orientation: 'horizontal',
45
- slide: function(e, ui) {
46
- $('#iw_opacity_input').attr('value', ui.value);
47
- $('#iw_opacity_span').attr('title', ui.value);
48
- }
49
- });
50
-
51
- //quality slider
52
- $('#iw_quality_span').slider({
53
- value: $('#iw_quality_input').val(),
54
- min: 0,
55
- max: 100,
56
- step: 1,
57
- orientation: 'horizontal',
58
- slide: function(e, ui) {
59
- $('#iw_quality_input').attr('value', ui.value);
60
- $('#iw_quality_span').attr('title', ui.value);
61
- }
62
- });
63
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/no-right-click-front.js DELETED
@@ -1,226 +0,0 @@
1
- /**************************************************************************
2
- This javascript is used by the no-right-click-images plugin for wordpress.
3
- Version 2.2
4
- Please give credit as no-right-click-images.js by Keith P. Graham
5
- http://www.blogseye.com
6
- **************************************************************************/
7
- var df_nrc_targImg=null;
8
- var df_nrc_targSrc=null;
9
- var df_nrc_inContext=false;
10
- var df_nrc_notimage=new Image();
11
- var df_nrc_limit=0;
12
- var df_nrc_extra = norightclick_args.rightclick;
13
- var df_nrc_drag = norightclick_args.draganddrop;
14
-
15
- function df_nrc_dragdropAll(event) {
16
- try {
17
- var ev=event||window.event;
18
- var targ=ev.srcElement||ev.target;
19
- if (targ.tagName.toUpperCase()=="A") {
20
- // is this IE and are we dragging a link to the image?
21
- var hr=targ.href;
22
- hr=hr.toUpperCase();
23
- if (hr.indexOf('.JPG')||hr.indexOf('.PNG')||hr.indexOf('.GIF')) {
24
- ev.returnValue=false;
25
- if (ev.preventDefault) {
26
- ev.preventDefault();
27
- }
28
- df_nrc_inContext=false;
29
- return false;
30
- }
31
- }
32
- if (targ.tagName.toUpperCase()!="IMG") return true;
33
- ev.returnValue=false;
34
- if (ev.preventDefault) {
35
- ev.preventDefault();
36
- }
37
- df_nrc_inContext=false;
38
- return false;
39
- } catch (er) {
40
- //alert(er);
41
- }
42
- return true;
43
- }
44
-
45
- function df_nrc_dragdrop(event) {
46
- // I am beginning to doubt if this event ever fires
47
- try {
48
- var ev=event||window.event;
49
- var targ=ev.srcElement||ev.target;
50
- ev.returnValue=false;
51
- if (ev.preventDefault) {
52
- ev.preventDefault();
53
- }
54
- ev.returnValue=false;
55
- df_nrc_inContext=false;
56
- return false;
57
- } catch (er) {
58
- //alert(er);
59
- }
60
- return true;
61
- }
62
-
63
- function df_nrc_context(event) {
64
- try {
65
- df_nrc_inContext=true;
66
- var ev=event||window.event;
67
- var targ=ev.srcElement||ev.target;
68
- df_nrc_replace(targ);
69
- ev.returnValue=false;
70
- if (ev.preventDefault) {
71
- ev.preventDefault();
72
- }
73
- ev.returnValue=false;
74
- df_nrc_targImg=targ;
75
- } catch (er) {
76
- //alert(er);
77
- }
78
- return false;
79
- }
80
-
81
- function df_nrc_contextAll(event) {
82
- try {
83
- if (df_nrc_targImg==null) {
84
- return true;
85
- }
86
- df_nrc_inContext=true;
87
- var ev=event||window.event;
88
- var targ=ev.srcElement||ev.target;
89
- if (targ.tagName.toUpperCase()=="IMG") {
90
- ev.returnValue=false;
91
- if (ev.preventDefault) {
92
- ev.preventDefault();
93
- }
94
- ev.returnValue=false;
95
- df_nrc_replace(targ);
96
- return false;
97
- }
98
- return true;
99
- } catch (er) {
100
- //alert(er);
101
- }
102
- return false;
103
- }
104
-
105
- function kpg_nrc1_mousedown(event) {
106
- try {
107
- df_nrc_inContext=false;
108
- var ev=event||window.event;
109
- var targ=ev.srcElement||ev.target;
110
- if (ev.button==2) {
111
- df_nrc_replace(targ);
112
- return false;
113
- }
114
- df_nrc_targImg=targ;
115
- if (df_nrc_drag=='Y') {
116
- if (ev.preventDefault) {
117
- ev.preventDefault();
118
- }
119
- }
120
- return true;
121
- } catch (er) {
122
- //alert(er);
123
- }
124
- return true;
125
- }
126
-
127
- function kpg_nrc1_mousedownAll(event) {
128
- try {
129
- df_nrc_inContext=false;
130
- var ev=event||window.event;
131
- var targ=ev.srcElement||ev.target;
132
- if (targ.style.backgroundImage!=''&&ev.button==2) {
133
- targ.oncontextmenu=function(event) { return false;} //iffy - might not work
134
- }
135
- if (targ.tagName.toUpperCase()=="IMG") {
136
- if (ev.button==2) {
137
- df_nrc_replace(targ);
138
- return false;
139
- }
140
- if (df_nrc_drag=='Y') {
141
- if (ev.preventDefault) {
142
- ev.preventDefault();
143
- }
144
- }
145
- df_nrc_targImg=targ;
146
- }
147
- return true;
148
- } catch (er) {
149
- //alert(er);
150
- }
151
- return true;
152
- }
153
-
154
- function df_nrc_replace(targ) {
155
- return false;
156
- if (df_nrc_targImg!=null && df_nrc_targImg.src==df_nrc_notimage.src) {
157
- // restore the old image before hiding this one
158
- df_nrc_targImg.src=df_nrc_targSrc;
159
- df_nrc_targImg=null;
160
- df_nrc_targSrc=null;
161
- }
162
- df_nrc_targImg=targ;
163
- if (df_nrc_extra!='Y') return;
164
- var w=targ.width+'';
165
- var h=targ.height+'';
166
- if (w.indexOf('px')<=0) w=w+'px';
167
- if (h.indexOf('px')<=0) h=h+'px';
168
- df_nrc_targSrc=targ.src;
169
- targ.src=df_nrc_notimage.src;
170
- targ.style.width=w;
171
- targ.style.height=h;
172
- df_nrc_limit=0;
173
- var t=setTimeout("df_nrc_restore()",500);
174
- return false;
175
- }
176
-
177
- function df_nrc_restore() {
178
- if (df_nrc_inContext) {
179
- if (df_nrc_limit<=20) {
180
- df_nrc_limit++;
181
- var t=setTimeout("df_nrc_restore()",500);
182
- return;
183
- }
184
- }
185
- df_nrc_limit=0;
186
- if (df_nrc_targImg==null) return;
187
- if (df_nrc_targSrc==null) return;
188
- df_nrc_targImg.src=df_nrc_targSrc;
189
- df_nrc_targImg=null;
190
- df_nrc_targSrc=null;
191
- return;
192
- }
193
-
194
- // sets the image onclick event
195
- // need to check for dblclick to see if there is a right double click in IE
196
- function df_nrc_action(event) {
197
- try {
198
- document.onmousedown=function(event) { return kpg_nrc1_mousedownAll(event);}
199
- document.oncontextmenu=function(event) { return df_nrc_contextAll(event);}
200
- document.oncopy=function(event) { return df_nrc_contextAll(event);}
201
- if (df_nrc_drag=='Y') document.ondragstart=function(event) { return df_nrc_dragdropAll(event);}
202
- var b=document.getElementsByTagName("IMG");
203
- for (var i = 0; i < b.length; i++) {
204
- b[i].oncontextmenu=function(event) { return df_nrc_context(event);}
205
- b[i].oncopy=function(event) { return df_nrc_context(event);}
206
- b[i].onmousedown=function(event) { return kpg_nrc1_mousedown(event);}
207
- if (df_nrc_drag=='Y') b[i].ondragstart=function(event) { return df_nrc_dragdrop(event);}
208
- }
209
- } catch (er) {
210
- return false;
211
- }
212
- }
213
-
214
- if (document.addEventListener) {
215
- document.addEventListener("DOMContentLoaded", function(event) { df_nrc_action(event); }, false);
216
- } else if (window.attachEvent) {
217
- window.attachEvent("onload", function(event) { df_nrc_action(event); });
218
- } else {
219
- var oldFunc = window.onload;
220
- window.onload = function() {
221
- if (oldFunc) {
222
- oldFunc();
223
- }
224
- df_nrc_action('load');
225
- };
226
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/no-right-click.js ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ This javascript is used by the no-right-click-images plugin for wordpress.
3
+ Version 2.2
4
+ Please give credit as no-right-click-images.js by Keith P. Graham
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
+ }
js/upload-manager-admin.js DELETED
@@ -1,71 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- watermarkFileUpload = {
3
- frame: function() {
4
- if ( this._frameWatermark )
5
- return this._frameWatermark;
6
-
7
- this._frameWatermark = wp.media({
8
- title: upload_manager_args.title,
9
- frame: upload_manager_args.frame,
10
- button: upload_manager_args.button,
11
- multiple: upload_manager_args.multiple,
12
- library: {
13
- type: 'image'
14
- }
15
- });
16
-
17
- this._frameWatermark.on('open', this.updateFrame).state('library').on('select', this.select);
18
- return this._frameWatermark;
19
- },
20
- select: function() {
21
- var attachment = this.frame.state().get('selection').first();
22
-
23
- if(jQuery.inArray(attachment.attributes.mime, ['image/gif', 'image/jpg', 'image/jpeg', 'image/png']) !== -1)
24
- {
25
- $('#upload_image').val(attachment.attributes.id);
26
-
27
- if($('div#previewImg_imageDiv img#previewImg_image').attr('src') !== '')
28
- {
29
- $('div#previewImg_imageDiv img#previewImg_image').replaceWith('<img id="previewImg_image" src="'+attachment.attributes.url+'" alt="" width="300" />');
30
- }
31
- else
32
- {
33
- $('div#previewImg_imageDiv img#previewImg_image').attr('src', attachment.attributes.url);
34
- }
35
-
36
- $('#turn_off_image_button').removeAttr('disabled');
37
- $('div#previewImg_imageDiv img#previewImg_image').show();
38
-
39
- var img = new Image();
40
- img.src = attachment.attributes.url;
41
-
42
- img.onload = function()
43
- {
44
- $('p#previewImageInfo').html(upload_manager_args.originalSize+': '+this.width+' px / '+this.height+' px');
45
- }
46
- }
47
- else
48
- {
49
- $('#turn_off_image_button').attr('disabled', 'true');
50
- $('#upload_image').val(0);
51
- $('div#previewImg_imageDiv img#previewImg_image').attr('src', '').hide();
52
- $('p#previewImageInfo').html('<strong>'+upload_manager_args.notAllowedImg+'</strong>');
53
- }
54
- },
55
- init: function() {
56
- $('#wpbody').on('click', 'input#upload_image_button', function(e) {
57
- e.preventDefault();
58
- watermarkFileUpload.frame().open();
59
- });
60
- }
61
- };
62
-
63
- watermarkFileUpload.init();
64
-
65
- $(document).on('click', '#turn_off_image_button', function(event) {
66
- $(this).attr('disabled', 'true');
67
- $('#upload_image').val(0);
68
- $('div#previewImg_imageDiv img#previewImg_image').attr('src', '').hide();
69
- $('p#previewImageInfo').html(upload_manager_args.noSelectedImg);
70
- });
71
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/image-watermark-pl_PL.mo CHANGED
Binary file
languages/image-watermark-pl_PL.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WordPress Watermark\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-02-14 11:41+0100\n"
6
- "PO-Revision-Date: 2014-02-14 11:45+0100\n"
7
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
8
  "Language-Team: Digital Factory <info@digitalfactory.pl>\n"
9
  "Language: pl_PL\n"
@@ -14,210 +14,226 @@ msgstr ""
14
  "esc_attr_e\n"
15
  "X-Poedit-Basepath: .\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Generator: Poedit 1.6.4\n"
18
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
21
- #: ../image-watermark.php:29
22
- msgid ""
23
- "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher."
24
- msgstr ""
25
- "Przykro nam, ale ta wtyczka wymaga PHP w wersji co najmniej 5.0 WordPressa w "
26
- "wersji 3.5 lub wyższej.."
27
-
28
- #: ../image-watermark.php:218
29
- msgid ""
30
- "Watermark could not be applied to selected files or no valid images (JPEG, "
31
- "PNG) were selected."
32
- msgstr ""
33
- "Znak wodny nie został został dodany do wybranych obrazków lub nie został "
34
- "wybrany prawidłowy typ pliku (JPEG, PNG)."
35
-
36
- #: ../image-watermark.php:218 ../image-watermark.php:222
37
- msgid "Skipped files"
38
- msgstr "Pominięte pliki"
39
-
40
- #: ../image-watermark.php:222
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] "Znak wodny został dodany do 1 obrazka."
45
- msgstr[1] "Znak wodny został dodany do %s obrazków."
46
-
47
- #: ../image-watermark.php:265
48
- msgid "Support"
49
- msgstr "Forum pomocy"
50
-
51
- #: ../image-watermark.php:287
52
- msgid "Settings"
53
- msgstr "Ustawienia"
54
-
55
- #: ../image-watermark.php:318
56
  msgid "Apply watermark"
57
  msgstr "Dodaj znak wodny"
58
 
59
- #: ../image-watermark.php:338
60
  msgid "Select watermark"
61
  msgstr "Wybierz znak wodny"
62
 
63
- #: ../image-watermark.php:339 ../image-watermark.php:834
64
  msgid "Original size"
65
  msgstr "Rozmiar oryginalny"
66
 
67
- #: ../image-watermark.php:340 ../image-watermark.php:828
68
  msgid "Watermak has not been selected yet."
69
  msgstr "Znak wodny nie został jeszcze wybrany."
70
 
71
- #: ../image-watermark.php:341
72
  msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
73
  msgstr "Ten rodzaj obrazka nie może być znakiem wodnym. Użyj JPEG, PNG or GIF."
74
 
75
- #: ../image-watermark.php:343
76
  msgid "Add watermark"
77
  msgstr "Dodaj znak wodny"
78
 
79
- #: ../image-watermark.php:360
80
  msgid "Are you sure you want to reset settings to defaults?"
81
  msgstr "Jesteś pewny, że chcesz zresetować ustawienia do domyślnych?"
82
 
83
- #: ../image-watermark.php:417
84
- msgid "Image Watermark Options"
85
- msgstr "Ustawienia znaku wodnego"
86
-
87
- #: ../image-watermark.php:418
88
- msgid "Watermark"
89
- msgstr "Znak wodny"
90
-
91
- #: ../image-watermark.php:444
92
- msgid "Image Watermark will not work properly without GD PHP extension."
93
  msgstr ""
94
- "Znak wodny nie może funkcjonować bez zainstalowanego rozszerzenia GD PHP."
95
-
96
- #: ../image-watermark.php:586
97
- msgid "Settings saved."
98
- msgstr "Ustawienia zostały zapisane."
99
-
100
- #: ../image-watermark.php:599
101
- msgid "Settings restored to defaults."
102
- msgstr "Ustawienia zostały przywrócone do domyślnych."
103
 
104
- #: ../image-watermark.php:619
105
- msgid "Watermark will not be applied when <b>watermark image is not set</b>."
 
 
106
  msgstr ""
107
- "Znak wodny nie zostanie dodany ponieważ <b>nie wybrano obrazka dla znaku "
108
- "wodnego</b>."
109
 
110
- #: ../image-watermark.php:622
111
- msgid "Watermark will not be applied when <b>no image sizes are selected</b>."
112
- msgstr ""
113
- "Znak wodny nie zostanie dodany ponieważ <b>nie wybrano wielkości obrazków</"
114
- "b>."
115
 
116
- #: ../image-watermark.php:628
117
- msgid ""
118
- "Watermark will not be applied while frontend image upload if <b>watermark "
119
- "image is not set</b>."
120
- msgstr ""
121
- "Znak wodny nie zostanie dodany w trakcie wczytywania na froncie strony jeśli "
122
- "<b>nie wybrano obrazka dla znaku wodnego</b>."
123
 
124
- #: ../image-watermark.php:631
125
- msgid ""
126
- "Watermark will not be applied while frontend image upload if <b>no image "
127
- "sizes are selected</b>."
128
- msgstr ""
129
- "Znak wodny nie zostanie dodany w trakcie wczytywania na froncie strony jeśli "
130
- "<b>nie wybrano wielkości obrazków</b>."
131
 
132
- #: ../image-watermark.php:638
133
- msgid "Image Watermark Settings"
134
  msgstr "Ustawienia znaku wodnego"
135
 
136
- #: ../image-watermark.php:642
 
 
 
 
137
  msgid "Image Watermark"
138
  msgstr "Znak wodny"
139
 
140
- #: ../image-watermark.php:644
141
  msgid "Need support?"
142
  msgstr "Potrzebujesz pomocy?"
143
 
144
- #: ../image-watermark.php:645
145
  msgid ""
146
  "If you are having problems with this plugin, please talk about them in the"
147
  msgstr "Jeśli masz jakiekolwiek problemy z tą wtyczką, powiedz o tym na"
148
 
149
- #: ../image-watermark.php:645
150
  msgid "Support forum"
151
  msgstr "Forum pomocy"
152
 
153
- #: ../image-watermark.php:647
154
  msgid "Do you like this plugin?"
155
  msgstr "Lubisz tę wtyczkę?"
156
 
157
- #: ../image-watermark.php:648
158
  msgid "Rate it 5"
159
  msgstr "Oceń ją na 5"
160
 
161
- #: ../image-watermark.php:648
162
  msgid "on WordPress.org"
163
  msgstr "na WordPress.org"
164
 
165
- #: ../image-watermark.php:649
166
  msgid "Blog about it & link to the"
167
  msgstr "Napisz o niej i dodaj link do"
168
 
169
- #: ../image-watermark.php:649
170
  msgid "plugin page"
171
  msgstr "strony wtyczki"
172
 
173
- #: ../image-watermark.php:650
174
  msgid "Check out our other"
175
  msgstr "Sprawdź inne"
176
 
177
- #: ../image-watermark.php:650
178
  msgid "WordPress plugins"
179
  msgstr "wtyczki do WordPressa"
180
 
181
- #: ../image-watermark.php:653
182
  msgid "Created by"
183
  msgstr "Stworzone przez"
184
 
185
- #: ../image-watermark.php:658
 
 
 
 
186
  msgid "General settings"
187
  msgstr "Ustawienia ogólne"
188
 
189
- #: ../image-watermark.php:661
190
  msgid "Automatic watermarking"
191
  msgstr "Automatyczne dodawanie znaku wodnego"
192
 
193
- #: ../image-watermark.php:665 ../image-watermark.php:681
194
- #: ../image-watermark.php:728 ../image-watermark.php:744
195
- msgid "on"
196
- msgstr "włączony"
197
-
198
- #: ../image-watermark.php:667 ../image-watermark.php:683
199
- #: ../image-watermark.php:730 ../image-watermark.php:746
200
- msgid "off"
201
- msgstr "wyłączony"
202
-
203
- #: ../image-watermark.php:670
204
- msgid "Enable or disable watermark for uploaded images."
205
- msgstr "Włącz lub wyłącz dodawanie znaku wodnego do wgrywanych obrazków."
206
-
207
- #: ../image-watermark.php:677
208
  msgid "Manual watermarking"
209
  msgstr "Ręczne dodawanie znaku wodnego"
210
 
211
- #: ../image-watermark.php:686
212
- msgid "Enable or disable Apply Watermark option for images in Media Library."
213
- msgstr ""
214
- "Włącz lub wyłącz dodawanie znaku wodnego do obrazków w Bibliotece mediów."
215
-
216
- #: ../image-watermark.php:693
217
  msgid "Enable watermark for"
218
  msgstr "Dodawaj znak wodny do"
219
 
220
- #: ../image-watermark.php:702
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  msgid ""
222
  "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
223
  "strong> checking full size is NOT recommended as it's the original image. "
@@ -232,15 +248,15 @@ msgstr ""
232
  "lub innych modyfikacji. Zaznacz ten rozmiar tylko wtedy, gdy naprawdę wiesz "
233
  "co robisz."
234
 
235
- #: ../image-watermark.php:708
236
  msgid "everywhere"
237
  msgstr "wszędzie"
238
 
239
- #: ../image-watermark.php:709
240
  msgid "on selected post types only"
241
  msgstr "na wybranych typach wpisów"
242
 
243
- #: ../image-watermark.php:717
244
  msgid ""
245
  "Check custom post types on which watermark should be applied to uploaded "
246
  "images."
@@ -248,122 +264,79 @@ msgstr ""
248
  "Zaznacz własne typy wpisów w których znak wodny będzie dodawany do "
249
  "wgrywanych obrazków."
250
 
251
- #: ../image-watermark.php:724
252
- msgid "Automatic frontend watermarking"
253
- msgstr "Znaku wodny na froncie strony"
 
 
 
 
 
254
 
255
- #: ../image-watermark.php:733
256
  msgid ""
257
- "Enable or disable watermark for frontend image uploading. (uploading script "
258
- "is not included, but you may use a plugin or custom code). <strong>Notice:</"
259
- "strong> This functionality works only if uploaded images are processed using "
260
- "WordPress native upload methods."
261
  msgstr ""
262
- "Włącz lub wyłącz dodawanie znaku wodnego wtrakcie wgrywania obrazków na "
263
- "froncie strony. (skrypt umożliwiający wczytywanie nie jest dostarczony, ale "
264
- "możesz użyć wtyczki lub własnego kodu). <strong>Uwaga:</strong> ta "
265
- "funkcjonalność działa tylko jeśli wgrywane obrazki są przetwarzane z "
266
- "wykorzystaniem domyślnych metod WordPressa."
267
-
268
- #: ../image-watermark.php:740
269
- msgid "Plugin deactivation"
270
- msgstr "Deaktywacja wtyczki"
271
 
272
- #: ../image-watermark.php:749
273
  msgid "Delete all database settings on plugin deactivation."
274
  msgstr "Usuń wszystkie dane wtyczki po jej deaktywacji."
275
 
276
- #: ../image-watermark.php:755
277
- msgid "Watermark position"
278
- msgstr "Pozycja znaku wodnego"
279
-
280
- #: ../image-watermark.php:758
281
- msgid "Watermark alignment"
282
- msgstr "Wyrównanie znaku wodnego"
283
-
284
- #: ../image-watermark.php:773
285
  msgid "Choose the position of watermark image."
286
  msgstr "Wybierz pozycję znaku wodnego na obrazkach"
287
 
288
- #: ../image-watermark.php:778
289
- msgid "Watermark offset"
290
- msgstr "Korekcja pozycji"
291
-
292
- #: ../image-watermark.php:781 ../image-watermark.php:861
293
  msgid "x:"
294
  msgstr "x:"
295
 
296
- #: ../image-watermark.php:781 ../image-watermark.php:783
297
- #: ../image-watermark.php:861 ../image-watermark.php:863
298
  msgid "px"
299
  msgstr "pikseli"
300
 
301
- #: ../image-watermark.php:783 ../image-watermark.php:863
302
  msgid "y:"
303
  msgstr "y:"
304
 
305
- #: ../image-watermark.php:799 ../image-watermark.php:803
306
- msgid "Watermark image"
307
- msgstr "Obrazek znaku wodnego"
308
-
309
- #: ../image-watermark.php:800
310
- msgid ""
311
- "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
312
- msgstr ""
313
- "Skonfiguruj obrazek znaku wodnego. Dozwolone formaty plików to: JPEG, PNG, "
314
- "GIF."
315
-
316
- #: ../image-watermark.php:806
317
  msgid "Select image"
318
  msgstr "Wybierz obrazek"
319
 
320
- #: ../image-watermark.php:807
321
- msgid "Turn off image"
322
- msgstr "Wyłącz obrazek"
323
 
324
- #: ../image-watermark.php:808
325
  msgid "You have to save changes after the selection or removal of the image."
326
  msgstr "Po zapisaniu zmian lub wybraniu obrazka powienieneś zapisać zmiany."
327
 
328
- #: ../image-watermark.php:812
329
- msgid "Watermark preview"
330
- msgstr "Podgląd obrazka"
331
-
332
- #: ../image-watermark.php:842
333
- msgid "Watermark size"
334
- msgstr "Wielkość znaku wodnego"
335
-
336
- #: ../image-watermark.php:846
337
  msgid "original"
338
  msgstr "oryginalna"
339
 
340
- #: ../image-watermark.php:848
341
  msgid "custom"
342
  msgstr "własna"
343
 
344
- #: ../image-watermark.php:850
345
  msgid "scaled"
346
  msgstr "skalowana"
347
 
348
- #: ../image-watermark.php:853
349
  msgid "Select method of aplying watermark size."
350
  msgstr "Wybierz sposób określania wielkości znaku wodnego."
351
 
352
- #: ../image-watermark.php:858
353
- msgid "Watermark custom size"
354
- msgstr "Własna wielkość"
355
-
356
- #: ../image-watermark.php:865
357
  msgid "Those dimensions will be used if \"custom\" method is selected above."
358
  msgstr ""
359
  "Te wymiary zostaną zastosowane, jeśli wybrałeś \"własną\" wielkość znaku "
360
  "wodnego. "
361
 
362
- #: ../image-watermark.php:869
363
- msgid "Scale of watermark in relation to image width"
364
- msgstr "Wielkość znaku wodnego w stosunku do szerokości obrazków"
365
-
366
- #: ../image-watermark.php:879
367
  msgid ""
368
  "This value will be used if \"scaled\" method if selected above. <br />Enter "
369
  "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
@@ -374,11 +347,7 @@ msgstr ""
374
  "że wielkość znaku wodnego będzie równa wielkości obrazka, do którego jest "
375
  "dodawany."
376
 
377
- #: ../image-watermark.php:883
378
- msgid "Watermark transparency / opacity"
379
- msgstr "Przezroczystość znaku wodnego"
380
-
381
- #: ../image-watermark.php:893
382
  msgid ""
383
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
384
  "transparent, 100 shows it as is."
@@ -386,53 +355,142 @@ msgstr ""
386
  "Wpisz liczbę z zakresu od 0 do 100. Wpisanie 0 spowoduje, że znak wodny "
387
  "będzie całkowicie przezroczysty, 100 że widoczny taki jak jest."
388
 
389
- #: ../image-watermark.php:897
390
- msgid "Image quality"
391
- msgstr "Jakość obrazka"
392
-
393
- #: ../image-watermark.php:907
394
  msgid "Set output image quality."
395
  msgstr "Wybierz jakość obrazka po nadaniu znaku wodnego"
396
 
397
- #: ../image-watermark.php:911
398
- msgid "Image format"
399
- msgstr "Format obrazka"
400
-
401
- #: ../image-watermark.php:915
402
  msgid "baseline"
403
  msgstr "baseline"
404
 
405
- #: ../image-watermark.php:917
406
  msgid "progressive"
407
  msgstr "progressive"
408
 
409
- #: ../image-watermark.php:921
410
  msgid "Select baseline or progressive image format."
411
  msgstr "Wybierz format obrazu."
412
 
413
- #: ../image-watermark.php:927
414
- msgid "Image protection"
415
- msgstr "Ochrona obrazków"
416
-
417
- #: ../image-watermark.php:930
418
  msgid "Disable right mouse click on images"
419
  msgstr "Wyłącz możliwość kliknięcia prawym przyciskiem myszy na obrazku"
420
 
421
- #: ../image-watermark.php:934
422
  msgid "Prevent drag and drop"
423
  msgstr "Wyłącz możliwość przeciągania i upuszczania obrazków"
424
 
425
- #: ../image-watermark.php:938
426
  msgid "Enable image protection for logged-in users also"
427
  msgstr "Włącz ochronę zdjęć także dla zalogowanych użytkowników"
428
 
429
- #: ../image-watermark.php:943
430
- msgid "Save Changes"
431
- msgstr "Zapisz zmiany"
432
 
433
- #: ../image-watermark.php:944
434
- msgid "Reset to defaults"
435
- msgstr "Przywróć domyślne"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
 
437
  #~ msgid ""
438
  #~ "Check image sizes on which watermark should appear. <b>Notice:</b> "
2
  msgstr ""
3
  "Project-Id-Version: WordPress Watermark\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-05-15 19:56+0100\n"
6
+ "PO-Revision-Date: 2015-05-15 20:44+0100\n"
7
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
8
  "Language-Team: Digital Factory <info@digitalfactory.pl>\n"
9
  "Language: pl_PL\n"
14
  "esc_attr_e\n"
15
  "X-Poedit-Basepath: .\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Generator: Poedit 1.7.5\n"
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 "Dodaj znak wodny"
24
 
25
+ #: ../image-watermark.php:222
26
  msgid "Select watermark"
27
  msgstr "Wybierz znak wodny"
28
 
29
+ #: ../image-watermark.php:223 ../image-watermark.php:705
30
  msgid "Original size"
31
  msgstr "Rozmiar oryginalny"
32
 
33
+ #: ../image-watermark.php:224 ../image-watermark.php:701
34
  msgid "Watermak has not been selected yet."
35
  msgstr "Znak wodny nie został jeszcze wybrany."
36
 
37
+ #: ../image-watermark.php:225
38
  msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
39
  msgstr "Ten rodzaj obrazka nie może być znakiem wodnym. Użyj JPEG, PNG or GIF."
40
 
41
+ #: ../image-watermark.php:227
42
  msgid "Add watermark"
43
  msgstr "Dodaj znak wodny"
44
 
45
+ #: ../image-watermark.php:240
46
  msgid "Are you sure you want to reset settings to defaults?"
47
  msgstr "Jesteś pewny, że chcesz zresetować ustawienia do domyślnych?"
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
+ "<strong>Znak wodny</strong> Masowe dodawania znaku wodnego dostępne jest "
57
+ "wyłącznie w tybie listy, w <em>Masowych działaniach</em>. <a href=\"%1$s"
58
+ "\">Przejdź do trybu listy</a> lub <a href=\"%2$s\">Ukryj ten komunikat</a>"
 
 
 
 
 
 
59
 
60
+ #: ../image-watermark.php:402
61
+ msgid ""
62
+ "Watermark could not be applied to selected files or no valid images (JPEG, "
63
+ "PNG) were selected."
64
  msgstr ""
65
+ "Znak wodny nie został został dodany do wybranych obrazków lub nie został "
66
+ "wybrany prawidłowy typ pliku (JPEG, PNG)."
67
 
68
+ #: ../image-watermark.php:402
69
+ msgid "Images skipped"
70
+ msgstr "Pominięte obrazki"
 
 
71
 
72
+ #: ../image-watermark.php:404
73
+ #, php-format
74
+ msgid "Watermark was succesfully applied to 1 image."
75
+ msgid_plural "Watermark was succesfully applied to %s images."
76
+ msgstr[0] "Znak wodny został dodany do 1 obrazka."
77
+ msgstr[1] "Znak wodny został dodany do %s obrazków."
 
78
 
79
+ #: ../image-watermark.php:404
80
+ msgid "Skipped files"
81
+ msgstr "Pominięte pliki"
 
 
 
 
82
 
83
+ #: ../image-watermark.php:417
84
+ msgid "Image Watermark Options"
85
  msgstr "Ustawienia znaku wodnego"
86
 
87
+ #: ../image-watermark.php:417
88
+ msgid "Watermark"
89
+ msgstr "Znak wodny"
90
+
91
+ #: ../image-watermark.php:431 ../image-watermark.php:437
92
  msgid "Image Watermark"
93
  msgstr "Znak wodny"
94
 
95
+ #: ../image-watermark.php:439
96
  msgid "Need support?"
97
  msgstr "Potrzebujesz pomocy?"
98
 
99
+ #: ../image-watermark.php:440
100
  msgid ""
101
  "If you are having problems with this plugin, please talk about them in the"
102
  msgstr "Jeśli masz jakiekolwiek problemy z tą wtyczką, powiedz o tym na"
103
 
104
+ #: ../image-watermark.php:440
105
  msgid "Support forum"
106
  msgstr "Forum pomocy"
107
 
108
+ #: ../image-watermark.php:442
109
  msgid "Do you like this plugin?"
110
  msgstr "Lubisz tę wtyczkę?"
111
 
112
+ #: ../image-watermark.php:449
113
  msgid "Rate it 5"
114
  msgstr "Oceń ją na 5"
115
 
116
+ #: ../image-watermark.php:449
117
  msgid "on WordPress.org"
118
  msgstr "na WordPress.org"
119
 
120
+ #: ../image-watermark.php:450
121
  msgid "Blog about it & link to the"
122
  msgstr "Napisz o niej i dodaj link do"
123
 
124
+ #: ../image-watermark.php:450
125
  msgid "plugin page"
126
  msgstr "strony wtyczki"
127
 
128
+ #: ../image-watermark.php:451
129
  msgid "Check out our other"
130
  msgstr "Sprawdź inne"
131
 
132
+ #: ../image-watermark.php:451
133
  msgid "WordPress plugins"
134
  msgstr "wtyczki do WordPressa"
135
 
136
+ #: ../image-watermark.php:454
137
  msgid "Created by"
138
  msgstr "Stworzone przez"
139
 
140
+ #: ../image-watermark.php:466
141
+ msgid "Reset to defaults"
142
+ msgstr "Przywróć domyślne"
143
+
144
+ #: ../image-watermark.php:481
145
  msgid "General settings"
146
  msgstr "Ustawienia ogólne"
147
 
148
+ #: ../image-watermark.php:482
149
  msgid "Automatic watermarking"
150
  msgstr "Automatyczne dodawanie znaku wodnego"
151
 
152
+ #: ../image-watermark.php:483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  msgid "Manual watermarking"
154
  msgstr "Ręczne dodawanie znaku wodnego"
155
 
156
+ #: ../image-watermark.php:484
 
 
 
 
 
157
  msgid "Enable watermark for"
158
  msgstr "Dodawaj znak wodny do"
159
 
160
+ #: ../image-watermark.php:485
161
+ msgid "Frontend watermarking"
162
+ msgstr "Dodawanie znaku wodnego na froncie"
163
+
164
+ #: ../image-watermark.php:486
165
+ msgid "Deactivation"
166
+ msgstr "Deaktywacja wtyczki"
167
+
168
+ #: ../image-watermark.php:488
169
+ msgid "Watermark position"
170
+ msgstr "Pozycja znaku wodnego"
171
+
172
+ #: ../image-watermark.php:489
173
+ msgid "Watermark alignment"
174
+ msgstr "Wyrównanie znaku wodnego"
175
+
176
+ #: ../image-watermark.php:490
177
+ msgid "Watermark offset"
178
+ msgstr "Korekcja pozycji"
179
+
180
+ #: ../image-watermark.php:492 ../image-watermark.php:493
181
+ msgid "Watermark image"
182
+ msgstr "Obrazek znaku wodnego"
183
+
184
+ #: ../image-watermark.php:494
185
+ msgid "Watermark preview"
186
+ msgstr "Podgląd obrazka"
187
+
188
+ #: ../image-watermark.php:495
189
+ msgid "Watermark size"
190
+ msgstr "Wielkość znaku wodnego"
191
+
192
+ #: ../image-watermark.php:496
193
+ msgid "Watermark custom size"
194
+ msgstr "Własna wielkość"
195
+
196
+ #: ../image-watermark.php:497
197
+ msgid "Scale of watermark in relation to image width"
198
+ msgstr "Wielkość znaku wodnego w stosunku do szerokości obrazków"
199
+
200
+ #: ../image-watermark.php:498
201
+ msgid "Watermark transparency / opacity"
202
+ msgstr "Przezroczystość znaku wodnego"
203
+
204
+ #: ../image-watermark.php:499
205
+ msgid "Image quality"
206
+ msgstr "Jakość obrazka"
207
+
208
+ #: ../image-watermark.php:500
209
+ msgid "Image format"
210
+ msgstr "Format obrazka"
211
+
212
+ #: ../image-watermark.php:502
213
+ msgid "Image protection"
214
+ msgstr "Ochrona obrazków"
215
+
216
+ #: ../image-watermark.php:503
217
+ msgid "Right click"
218
+ msgstr "Kliknięcie prawym przyciskiem"
219
+
220
+ #: ../image-watermark.php:504
221
+ msgid "Drag and drop"
222
+ msgstr "Przeciągnij i upuść"
223
+
224
+ #: ../image-watermark.php:505
225
+ msgid "Logged-in users"
226
+ msgstr "Zalogowani użytkownicy"
227
+
228
+ #: ../image-watermark.php:515
229
+ msgid "Enable watermark for uploaded images."
230
+ msgstr "Włącz dodawanie znaku wodnego do wgrywanych obrazków."
231
+
232
+ #: ../image-watermark.php:527
233
+ msgid "Enable Apply Watermark option for images in Media Library."
234
+ msgstr "Włącz opcję dodawania znaku wodnego dla obrazków w bibliotece mediów."
235
+
236
+ #: ../image-watermark.php:549
237
  msgid ""
238
  "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
239
  "strong> checking full size is NOT recommended as it's the original image. "
248
  "lub innych modyfikacji. Zaznacz ten rozmiar tylko wtedy, gdy naprawdę wiesz "
249
  "co robisz."
250
 
251
+ #: ../image-watermark.php:566
252
  msgid "everywhere"
253
  msgstr "wszędzie"
254
 
255
+ #: ../image-watermark.php:567
256
  msgid "on selected post types only"
257
  msgstr "na wybranych typach wpisów"
258
 
259
+ #: ../image-watermark.php:581
260
  msgid ""
261
  "Check custom post types on which watermark should be applied to uploaded "
262
  "images."
264
  "Zaznacz własne typy wpisów w których znak wodny będzie dodawany do "
265
  "wgrywanych obrazków."
266
 
267
+ #: ../image-watermark.php:593
268
+ msgid ""
269
+ "Enable frontend image uploading. (uploading script is not included, but you "
270
+ "may use a plugin or custom code)."
271
+ msgstr ""
272
+ "Włącz dodawanie znaku wodnego na froncie strony. (skrypt który by to "
273
+ "umożliwiał nie jest częścią wtyczki, ale możesz użyć własnego kodu lub "
274
+ "innego rozwiązania)."
275
 
276
+ #: ../image-watermark.php:595
277
  msgid ""
278
+ "<br /><strong>Notice:</strong> This functionality works only if uploaded "
279
+ "images are processed using WordPress native upload methods."
 
 
280
  msgstr ""
281
+ "<br /><strong>Uwaga:</strong> Ta funkcjonalność jest dostępna tylko jeśli "
282
+ "obrazki wgrywane za pomocą natywnych metod WordPressa."
 
 
 
 
 
 
 
283
 
284
+ #: ../image-watermark.php:606
285
  msgid "Delete all database settings on plugin deactivation."
286
  msgstr "Usuń wszystkie dane wtyczki po jej deaktywacji."
287
 
288
+ #: ../image-watermark.php:637
 
 
 
 
 
 
 
 
289
  msgid "Choose the position of watermark image."
290
  msgstr "Wybierz pozycję znaku wodnego na obrazkach"
291
 
292
+ #: ../image-watermark.php:648 ../image-watermark.php:738
 
 
 
 
293
  msgid "x:"
294
  msgstr "x:"
295
 
296
+ #: ../image-watermark.php:648 ../image-watermark.php:650
297
+ #: ../image-watermark.php:738 ../image-watermark.php:740
298
  msgid "px"
299
  msgstr "pikseli"
300
 
301
+ #: ../image-watermark.php:650 ../image-watermark.php:740
302
  msgid "y:"
303
  msgstr "y:"
304
 
305
+ #: ../image-watermark.php:668
 
 
 
 
 
 
 
 
 
 
 
306
  msgid "Select image"
307
  msgstr "Wybierz obrazek"
308
 
309
+ #: ../image-watermark.php:669
310
+ msgid "Remove image"
311
+ msgstr "Usuń obrazek"
312
 
313
+ #: ../image-watermark.php:670
314
  msgid "You have to save changes after the selection or removal of the image."
315
  msgstr "Po zapisaniu zmian lub wybraniu obrazka powienieneś zapisać zmiany."
316
 
317
+ #: ../image-watermark.php:720
 
 
 
 
 
 
 
 
318
  msgid "original"
319
  msgstr "oryginalna"
320
 
321
+ #: ../image-watermark.php:722
322
  msgid "custom"
323
  msgstr "własna"
324
 
325
+ #: ../image-watermark.php:724
326
  msgid "scaled"
327
  msgstr "skalowana"
328
 
329
+ #: ../image-watermark.php:727
330
  msgid "Select method of aplying watermark size."
331
  msgstr "Wybierz sposób określania wielkości znaku wodnego."
332
 
333
+ #: ../image-watermark.php:742
 
 
 
 
334
  msgid "Those dimensions will be used if \"custom\" method is selected above."
335
  msgstr ""
336
  "Te wymiary zostaną zastosowane, jeśli wybrałeś \"własną\" wielkość znaku "
337
  "wodnego. "
338
 
339
+ #: ../image-watermark.php:759
 
 
 
 
340
  msgid ""
341
  "This value will be used if \"scaled\" method if selected above. <br />Enter "
342
  "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
347
  "że wielkość znaku wodnego będzie równa wielkości obrazka, do którego jest "
348
  "dodawany."
349
 
350
+ #: ../image-watermark.php:776
 
 
 
 
351
  msgid ""
352
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
353
  "transparent, 100 shows it as is."
355
  "Wpisz liczbę z zakresu od 0 do 100. Wpisanie 0 spowoduje, że znak wodny "
356
  "będzie całkowicie przezroczysty, 100 że widoczny taki jak jest."
357
 
358
+ #: ../image-watermark.php:793
 
 
 
 
359
  msgid "Set output image quality."
360
  msgstr "Wybierz jakość obrazka po nadaniu znaku wodnego"
361
 
362
+ #: ../image-watermark.php:804
 
 
 
 
363
  msgid "baseline"
364
  msgstr "baseline"
365
 
366
+ #: ../image-watermark.php:806
367
  msgid "progressive"
368
  msgstr "progressive"
369
 
370
+ #: ../image-watermark.php:810
371
  msgid "Select baseline or progressive image format."
372
  msgstr "Wybierz format obrazu."
373
 
374
+ #: ../image-watermark.php:821
 
 
 
 
375
  msgid "Disable right mouse click on images"
376
  msgstr "Wyłącz możliwość kliknięcia prawym przyciskiem myszy na obrazku"
377
 
378
+ #: ../image-watermark.php:833
379
  msgid "Prevent drag and drop"
380
  msgstr "Wyłącz możliwość przeciągania i upuszczania obrazków"
381
 
382
+ #: ../image-watermark.php:845
383
  msgid "Enable image protection for logged-in users also"
384
  msgstr "Włącz ochronę zdjęć także dla zalogowanych użytkowników"
385
 
386
+ #: ../image-watermark.php:924
387
+ msgid "Settings saved."
388
+ msgstr "Ustawienia zostały zapisane."
389
 
390
+ #: ../image-watermark.php:929
391
+ msgid "Settings restored to defaults."
392
+ msgstr "Ustawienia zostały przywrócone do domyślnych."
393
+
394
+ #: ../image-watermark.php:934
395
+ msgid "Watermark will not be applied when watermark image is not set."
396
+ msgstr "Znak wodny nie zostanie dodany jeśli nie został wybrany obrazek."
397
+
398
+ #: ../image-watermark.php:937
399
+ msgid "Watermark will not be applied when no image sizes are selected."
400
+ msgstr ""
401
+ "Znak wodny nie zostanie dodany jeśli nie zostały określone wielkości plików."
402
+
403
+ #: ../image-watermark.php:1247
404
+ msgid "Support"
405
+ msgstr "Forum pomocy"
406
+
407
+ #: ../image-watermark.php:1270
408
+ msgid "Settings"
409
+ msgstr "Ustawienia"
410
+
411
+ #~ msgid ""
412
+ #~ "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or "
413
+ #~ "higher."
414
+ #~ msgstr ""
415
+ #~ "Przykro nam, ale ta wtyczka wymaga PHP w wersji co najmniej 5.0 "
416
+ #~ "WordPressa w wersji 3.5 lub wyższej.."
417
+
418
+ #~ msgid "Image Watermark will not work properly without GD PHP extension."
419
+ #~ msgstr ""
420
+ #~ "Znak wodny nie może funkcjonować bez zainstalowanego rozszerzenia GD PHP."
421
+
422
+ #~ msgid ""
423
+ #~ "Watermark will not be applied when <b>watermark image is not set</b>."
424
+ #~ msgstr ""
425
+ #~ "Znak wodny nie zostanie dodany ponieważ <b>nie wybrano obrazka dla znaku "
426
+ #~ "wodnego</b>."
427
+
428
+ #~ msgid ""
429
+ #~ "Watermark will not be applied when <b>no image sizes are selected</b>."
430
+ #~ msgstr ""
431
+ #~ "Znak wodny nie zostanie dodany ponieważ <b>nie wybrano wielkości "
432
+ #~ "obrazków</b>."
433
+
434
+ #~ msgid ""
435
+ #~ "Watermark will not be applied while frontend image upload if <b>watermark "
436
+ #~ "image is not set</b>."
437
+ #~ msgstr ""
438
+ #~ "Znak wodny nie zostanie dodany w trakcie wczytywania na froncie strony "
439
+ #~ "jeśli <b>nie wybrano obrazka dla znaku wodnego</b>."
440
+
441
+ #~ msgid ""
442
+ #~ "Watermark will not be applied while frontend image upload if <b>no image "
443
+ #~ "sizes are selected</b>."
444
+ #~ msgstr ""
445
+ #~ "Znak wodny nie zostanie dodany w trakcie wczytywania na froncie strony "
446
+ #~ "jeśli <b>nie wybrano wielkości obrazków</b>."
447
+
448
+ #~ msgid "Image Watermark Settings"
449
+ #~ msgstr "Ustawienia znaku wodnego"
450
+
451
+ #~ msgid "on"
452
+ #~ msgstr "włączony"
453
+
454
+ #~ msgid "off"
455
+ #~ msgstr "wyłączony"
456
+
457
+ #~ msgid "Enable or disable watermark for uploaded images."
458
+ #~ msgstr "Włącz lub wyłącz dodawanie znaku wodnego do wgrywanych obrazków."
459
+
460
+ #~ msgid ""
461
+ #~ "Enable or disable Apply Watermark option for images in Media Library."
462
+ #~ msgstr ""
463
+ #~ "Włącz lub wyłącz dodawanie znaku wodnego do obrazków w Bibliotece mediów."
464
+
465
+ #~ msgid "Automatic frontend watermarking"
466
+ #~ msgstr "Znaku wodny na froncie strony"
467
+
468
+ #~ msgid ""
469
+ #~ "Enable or disable watermark for frontend image uploading. (uploading "
470
+ #~ "script is not included, but you may use a plugin or custom code). "
471
+ #~ "<strong>Notice:</strong> This functionality works only if uploaded images "
472
+ #~ "are processed using WordPress native upload methods."
473
+ #~ msgstr ""
474
+ #~ "Włącz lub wyłącz dodawanie znaku wodnego wtrakcie wgrywania obrazków na "
475
+ #~ "froncie strony. (skrypt umożliwiający wczytywanie nie jest dostarczony, "
476
+ #~ "ale możesz użyć wtyczki lub własnego kodu). <strong>Uwaga:</strong> ta "
477
+ #~ "funkcjonalność działa tylko jeśli wgrywane obrazki są przetwarzane z "
478
+ #~ "wykorzystaniem domyślnych metod WordPressa."
479
+
480
+ #~ msgid "Plugin deactivation"
481
+ #~ msgstr "Deaktywacja wtyczki"
482
+
483
+ #~ msgid ""
484
+ #~ "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
485
+ #~ msgstr ""
486
+ #~ "Skonfiguruj obrazek znaku wodnego. Dozwolone formaty plików to: JPEG, "
487
+ #~ "PNG, GIF."
488
+
489
+ #~ msgid "Turn off image"
490
+ #~ msgstr "Wyłącz obrazek"
491
+
492
+ #~ msgid "Save Changes"
493
+ #~ msgstr "Zapisz zmiany"
494
 
495
  #~ msgid ""
496
  #~ "Check image sizes on which watermark should appear. <b>Notice:</b> "
languages/image-watermark.pot CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WordPress Watermark\n"
4
- "POT-Creation-Date: 2014-02-14 11:40+0100\n"
5
- "PO-Revision-Date: 2014-02-14 11:40+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.pl>\n"
8
  "Language: en\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.4\n"
13
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
  "_n:1,2\n"
15
  "X-Poedit-Basepath: .\n"
@@ -17,192 +17,217 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
- #: ../image-watermark.php:29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  msgid ""
22
- "Sorry, Image Watermark plugin requires at least PHP 5.0 and WP 3.5 or higher."
 
 
23
  msgstr ""
24
 
25
- #: ../image-watermark.php:218
26
  msgid ""
27
  "Watermark could not be applied to selected files or no valid images (JPEG, "
28
  "PNG) were selected."
29
  msgstr ""
30
 
31
- #: ../image-watermark.php:218 ../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] ""
40
  msgstr[1] ""
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 ../image-watermark.php:834
59
- msgid "Original size"
60
  msgstr ""
61
 
62
- #: ../image-watermark.php:340 ../image-watermark.php:828
63
- msgid "Watermak has not been selected yet."
 
64
  msgstr ""
65
 
66
- #: ../image-watermark.php:341
67
- msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
68
  msgstr ""
69
 
70
- #: ../image-watermark.php:343
71
- msgid "Add watermark"
72
  msgstr ""
73
 
74
- #: ../image-watermark.php:360
75
- msgid "Are you sure you want to reset settings to defaults?"
76
  msgstr ""
77
 
78
- #: ../image-watermark.php:417
79
- msgid "Image Watermark Options"
80
  msgstr ""
81
 
82
- #: ../image-watermark.php:418
83
- msgid "Watermark"
84
  msgstr ""
85
 
86
- #: ../image-watermark.php:444
87
- msgid "Image Watermark will not work properly without GD PHP extension."
88
  msgstr ""
89
 
90
- #: ../image-watermark.php:586
91
- msgid "Settings saved."
92
  msgstr ""
93
 
94
- #: ../image-watermark.php:599
95
- msgid "Settings restored to defaults."
96
  msgstr ""
97
 
98
- #: ../image-watermark.php:619
99
- msgid "Watermark will not be applied when <b>watermark image is not set</b>."
100
  msgstr ""
101
 
102
- #: ../image-watermark.php:622
103
- msgid "Watermark will not be applied when <b>no image sizes are selected</b>."
104
  msgstr ""
105
 
106
- #: ../image-watermark.php:628
107
- msgid ""
108
- "Watermark will not be applied while frontend image upload if <b>watermark "
109
- "image is not set</b>."
110
  msgstr ""
111
 
112
- #: ../image-watermark.php:631
113
- msgid ""
114
- "Watermark will not be applied while frontend image upload if <b>no image "
115
- "sizes are selected</b>."
116
  msgstr ""
117
 
118
- #: ../image-watermark.php:638
119
- msgid "Image Watermark Settings"
120
  msgstr ""
121
 
122
- #: ../image-watermark.php:642
123
- msgid "Image Watermark"
124
  msgstr ""
125
 
126
- #: ../image-watermark.php:644
127
- msgid "Need support?"
128
  msgstr ""
129
 
130
- #: ../image-watermark.php:645
131
- msgid ""
132
- "If you are having problems with this plugin, please talk about them in the"
133
  msgstr ""
134
 
135
- #: ../image-watermark.php:645
136
- msgid "Support forum"
137
  msgstr ""
138
 
139
- #: ../image-watermark.php:647
140
- msgid "Do you like this plugin?"
141
  msgstr ""
142
 
143
- #: ../image-watermark.php:648
144
- msgid "Rate it 5"
145
  msgstr ""
146
 
147
- #: ../image-watermark.php:648
148
- msgid "on WordPress.org"
149
  msgstr ""
150
 
151
- #: ../image-watermark.php:649
152
- msgid "Blog about it & link to the"
153
  msgstr ""
154
 
155
- #: ../image-watermark.php:649
156
- msgid "plugin page"
157
  msgstr ""
158
 
159
- #: ../image-watermark.php:650
160
- msgid "Check out our other"
161
  msgstr ""
162
 
163
- #: ../image-watermark.php:650
164
- msgid "WordPress plugins"
165
  msgstr ""
166
 
167
- #: ../image-watermark.php:653
168
- msgid "Created by"
169
  msgstr ""
170
 
171
- #: ../image-watermark.php:658
172
- msgid "General settings"
173
  msgstr ""
174
 
175
- #: ../image-watermark.php:661
176
- msgid "Automatic watermarking"
177
  msgstr ""
178
 
179
- #: ../image-watermark.php:665 ../image-watermark.php:681
180
- #: ../image-watermark.php:728 ../image-watermark.php:744
181
- msgid "on"
182
  msgstr ""
183
 
184
- #: ../image-watermark.php:667 ../image-watermark.php:683
185
- #: ../image-watermark.php:730 ../image-watermark.php:746
186
- msgid "off"
187
  msgstr ""
188
 
189
- #: ../image-watermark.php:670
190
- msgid "Enable or disable watermark for uploaded images."
191
  msgstr ""
192
 
193
- #: ../image-watermark.php:677
194
- msgid "Manual watermarking"
195
  msgstr ""
196
 
197
- #: ../image-watermark.php:686
198
- msgid "Enable or disable Apply Watermark option for images in Media Library."
199
  msgstr ""
200
 
201
- #: ../image-watermark.php:693
202
- msgid "Enable watermark for"
203
  msgstr ""
204
 
205
- #: ../image-watermark.php:702
206
  msgid ""
207
  "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
208
  "strong> checking full size is NOT recommended as it's the original image. "
@@ -211,187 +236,146 @@ msgid ""
211
  "you are doing."
212
  msgstr ""
213
 
214
- #: ../image-watermark.php:708
215
  msgid "everywhere"
216
  msgstr ""
217
 
218
- #: ../image-watermark.php:709
219
  msgid "on selected post types only"
220
  msgstr ""
221
 
222
- #: ../image-watermark.php:717
223
  msgid ""
224
  "Check custom post types on which watermark should be applied to uploaded "
225
  "images."
226
  msgstr ""
227
 
228
- #: ../image-watermark.php:724
229
- msgid "Automatic frontend watermarking"
230
- msgstr ""
231
-
232
- #: ../image-watermark.php:733
233
  msgid ""
234
- "Enable or disable watermark for frontend image uploading. (uploading script "
235
- "is not included, but you may use a plugin or custom code). <strong>Notice:</"
236
- "strong> This functionality works only if uploaded images are processed using "
237
- "WordPress native upload methods."
238
  msgstr ""
239
 
240
- #: ../image-watermark.php:740
241
- msgid "Plugin deactivation"
 
 
242
  msgstr ""
243
 
244
- #: ../image-watermark.php:749
245
  msgid "Delete all database settings on plugin deactivation."
246
  msgstr ""
247
 
248
- #: ../image-watermark.php:755
249
- msgid "Watermark position"
250
- msgstr ""
251
-
252
- #: ../image-watermark.php:758
253
- msgid "Watermark alignment"
254
- msgstr ""
255
-
256
- #: ../image-watermark.php:773
257
  msgid "Choose the position of watermark image."
258
  msgstr ""
259
 
260
- #: ../image-watermark.php:778
261
- msgid "Watermark offset"
262
- msgstr ""
263
-
264
- #: ../image-watermark.php:781 ../image-watermark.php:861
265
  msgid "x:"
266
  msgstr ""
267
 
268
- #: ../image-watermark.php:781 ../image-watermark.php:783
269
- #: ../image-watermark.php:861 ../image-watermark.php:863
270
  msgid "px"
271
  msgstr ""
272
 
273
- #: ../image-watermark.php:783 ../image-watermark.php:863
274
  msgid "y:"
275
  msgstr ""
276
 
277
- #: ../image-watermark.php:799 ../image-watermark.php:803
278
- msgid "Watermark image"
279
- msgstr ""
280
-
281
- #: ../image-watermark.php:800
282
- msgid ""
283
- "Configure your watermark image. Allowed file formats are: JPEG, PNG, GIF."
284
- msgstr ""
285
-
286
- #: ../image-watermark.php:806
287
  msgid "Select image"
288
  msgstr ""
289
 
290
- #: ../image-watermark.php:807
291
- msgid "Turn off image"
292
  msgstr ""
293
 
294
- #: ../image-watermark.php:808
295
  msgid "You have to save changes after the selection or removal of the image."
296
  msgstr ""
297
 
298
- #: ../image-watermark.php:812
299
- msgid "Watermark preview"
300
- msgstr ""
301
-
302
- #: ../image-watermark.php:842
303
- msgid "Watermark size"
304
- msgstr ""
305
-
306
- #: ../image-watermark.php:846
307
  msgid "original"
308
  msgstr ""
309
 
310
- #: ../image-watermark.php:848
311
  msgid "custom"
312
  msgstr ""
313
 
314
- #: ../image-watermark.php:850
315
  msgid "scaled"
316
  msgstr ""
317
 
318
- #: ../image-watermark.php:853
319
  msgid "Select method of aplying watermark size."
320
  msgstr ""
321
 
322
- #: ../image-watermark.php:858
323
- msgid "Watermark custom size"
324
- msgstr ""
325
-
326
- #: ../image-watermark.php:865
327
  msgid "Those dimensions will be used if \"custom\" method is selected above."
328
  msgstr ""
329
 
330
- #: ../image-watermark.php:869
331
- msgid "Scale of watermark in relation to image width"
332
- msgstr ""
333
-
334
- #: ../image-watermark.php:879
335
  msgid ""
336
  "This value will be used if \"scaled\" method if selected above. <br />Enter "
337
  "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
338
  "width of the image it is applied to."
339
  msgstr ""
340
 
341
- #: ../image-watermark.php:883
342
- msgid "Watermark transparency / opacity"
343
- msgstr ""
344
-
345
- #: ../image-watermark.php:893
346
  msgid ""
347
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
348
  "transparent, 100 shows it as is."
349
  msgstr ""
350
 
351
- #: ../image-watermark.php:897
352
- msgid "Image quality"
353
- msgstr ""
354
-
355
- #: ../image-watermark.php:907
356
  msgid "Set output image quality."
357
  msgstr ""
358
 
359
- #: ../image-watermark.php:911
360
- msgid "Image format"
361
- msgstr ""
362
-
363
- #: ../image-watermark.php:915
364
  msgid "baseline"
365
  msgstr ""
366
 
367
- #: ../image-watermark.php:917
368
  msgid "progressive"
369
  msgstr ""
370
 
371
- #: ../image-watermark.php:921
372
  msgid "Select baseline or progressive image format."
373
  msgstr ""
374
 
375
- #: ../image-watermark.php:927
376
- msgid "Image protection"
377
- msgstr ""
378
-
379
- #: ../image-watermark.php:930
380
  msgid "Disable right mouse click on images"
381
  msgstr ""
382
 
383
- #: ../image-watermark.php:934
384
  msgid "Prevent drag and drop"
385
  msgstr ""
386
 
387
- #: ../image-watermark.php:938
388
  msgid "Enable image protection for logged-in users also"
389
  msgstr ""
390
 
391
- #: ../image-watermark.php:943
392
- msgid "Save Changes"
393
  msgstr ""
394
 
395
- #: ../image-watermark.php:944
396
- msgid "Reset to defaults"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WordPress Watermark\n"
4
+ "POT-Creation-Date: 2015-05-15 19:55+0100\n"
5
+ "PO-Revision-Date: 2015-05-15 19:55+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.pl>\n"
8
  "Language: en\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.5\n"
13
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
  "_n:1,2\n"
15
  "X-Poedit-Basepath: .\n"
17
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
+ #: ../image-watermark.php:197 ../image-watermark.php:198
21
+ msgid "Apply watermark"
22
+ msgstr ""
23
+
24
+ #: ../image-watermark.php:222
25
+ msgid "Select watermark"
26
+ msgstr ""
27
+
28
+ #: ../image-watermark.php:223 ../image-watermark.php:705
29
+ msgid "Original size"
30
+ msgstr ""
31
+
32
+ #: ../image-watermark.php:224 ../image-watermark.php:701
33
+ msgid "Watermak has not been selected yet."
34
+ msgstr ""
35
+
36
+ #: ../image-watermark.php:225
37
+ msgid "This image is not supported as watermark. Use JPEG, PNG or GIF."
38
+ msgstr ""
39
+
40
+ #: ../image-watermark.php:227
41
+ msgid "Add watermark"
42
+ msgstr ""
43
+
44
+ #: ../image-watermark.php:240
45
+ msgid "Are you sure you want to reset settings to defaults?"
46
+ msgstr ""
47
+
48
+ #: ../image-watermark.php:393
49
+ #, php-format
50
  msgid ""
51
+ "<strong>Image Watermark:</strong> Bulk watermarking is available in list "
52
+ "mode only, under <em>Bulk Actions</em> dropdown. <a href=\"%1$s\">Got to "
53
+ "List Mode</a> or <a href=\"%2$s\">Hide this notice</a>"
54
  msgstr ""
55
 
56
+ #: ../image-watermark.php:402
57
  msgid ""
58
  "Watermark could not be applied to selected files or no valid images (JPEG, "
59
  "PNG) were selected."
60
  msgstr ""
61
 
62
+ #: ../image-watermark.php:402
63
+ msgid "Images skipped"
64
  msgstr ""
65
 
66
+ #: ../image-watermark.php:404
67
  #, php-format
68
  msgid "Watermark was succesfully applied to 1 image."
69
  msgid_plural "Watermark was succesfully applied to %s images."
70
  msgstr[0] ""
71
  msgstr[1] ""
72
 
73
+ #: ../image-watermark.php:404
74
+ msgid "Skipped files"
75
  msgstr ""
76
 
77
+ #: ../image-watermark.php:417
78
+ msgid "Image Watermark Options"
79
  msgstr ""
80
 
81
+ #: ../image-watermark.php:417
82
+ msgid "Watermark"
83
  msgstr ""
84
 
85
+ #: ../image-watermark.php:431 ../image-watermark.php:437
86
+ msgid "Image Watermark"
87
  msgstr ""
88
 
89
+ #: ../image-watermark.php:439
90
+ msgid "Need support?"
91
  msgstr ""
92
 
93
+ #: ../image-watermark.php:440
94
+ msgid ""
95
+ "If you are having problems with this plugin, please talk about them in the"
96
  msgstr ""
97
 
98
+ #: ../image-watermark.php:440
99
+ msgid "Support forum"
100
  msgstr ""
101
 
102
+ #: ../image-watermark.php:442
103
+ msgid "Do you like this plugin?"
104
  msgstr ""
105
 
106
+ #: ../image-watermark.php:449
107
+ msgid "Rate it 5"
108
  msgstr ""
109
 
110
+ #: ../image-watermark.php:449
111
+ msgid "on WordPress.org"
112
  msgstr ""
113
 
114
+ #: ../image-watermark.php:450
115
+ msgid "Blog about it & link to the"
116
  msgstr ""
117
 
118
+ #: ../image-watermark.php:450
119
+ msgid "plugin page"
120
  msgstr ""
121
 
122
+ #: ../image-watermark.php:451
123
+ msgid "Check out our other"
124
  msgstr ""
125
 
126
+ #: ../image-watermark.php:451
127
+ msgid "WordPress plugins"
128
  msgstr ""
129
 
130
+ #: ../image-watermark.php:454
131
+ msgid "Created by"
132
  msgstr ""
133
 
134
+ #: ../image-watermark.php:466
135
+ msgid "Reset to defaults"
136
  msgstr ""
137
 
138
+ #: ../image-watermark.php:481
139
+ msgid "General settings"
 
 
140
  msgstr ""
141
 
142
+ #: ../image-watermark.php:482
143
+ msgid "Automatic watermarking"
 
 
144
  msgstr ""
145
 
146
+ #: ../image-watermark.php:483
147
+ msgid "Manual watermarking"
148
  msgstr ""
149
 
150
+ #: ../image-watermark.php:484
151
+ msgid "Enable watermark for"
152
  msgstr ""
153
 
154
+ #: ../image-watermark.php:485
155
+ msgid "Frontend watermarking"
156
  msgstr ""
157
 
158
+ #: ../image-watermark.php:486
159
+ msgid "Deactivation"
 
160
  msgstr ""
161
 
162
+ #: ../image-watermark.php:488
163
+ msgid "Watermark position"
164
  msgstr ""
165
 
166
+ #: ../image-watermark.php:489
167
+ msgid "Watermark alignment"
168
  msgstr ""
169
 
170
+ #: ../image-watermark.php:490
171
+ msgid "Watermark offset"
172
  msgstr ""
173
 
174
+ #: ../image-watermark.php:492 ../image-watermark.php:493
175
+ msgid "Watermark image"
176
  msgstr ""
177
 
178
+ #: ../image-watermark.php:494
179
+ msgid "Watermark preview"
180
  msgstr ""
181
 
182
+ #: ../image-watermark.php:495
183
+ msgid "Watermark size"
184
  msgstr ""
185
 
186
+ #: ../image-watermark.php:496
187
+ msgid "Watermark custom size"
188
  msgstr ""
189
 
190
+ #: ../image-watermark.php:497
191
+ msgid "Scale of watermark in relation to image width"
192
  msgstr ""
193
 
194
+ #: ../image-watermark.php:498
195
+ msgid "Watermark transparency / opacity"
196
  msgstr ""
197
 
198
+ #: ../image-watermark.php:499
199
+ msgid "Image quality"
200
  msgstr ""
201
 
202
+ #: ../image-watermark.php:500
203
+ msgid "Image format"
204
  msgstr ""
205
 
206
+ #: ../image-watermark.php:502
207
+ msgid "Image protection"
 
208
  msgstr ""
209
 
210
+ #: ../image-watermark.php:503
211
+ msgid "Right click"
 
212
  msgstr ""
213
 
214
+ #: ../image-watermark.php:504
215
+ msgid "Drag and drop"
216
  msgstr ""
217
 
218
+ #: ../image-watermark.php:505
219
+ msgid "Logged-in users"
220
  msgstr ""
221
 
222
+ #: ../image-watermark.php:515
223
+ msgid "Enable watermark for uploaded images."
224
  msgstr ""
225
 
226
+ #: ../image-watermark.php:527
227
+ msgid "Enable Apply Watermark option for images in Media Library."
228
  msgstr ""
229
 
230
+ #: ../image-watermark.php:549
231
  msgid ""
232
  "Check image sizes on which watermark should appear.<br /><strong>IMPORTANT:</"
233
  "strong> checking full size is NOT recommended as it's the original image. "
236
  "you are doing."
237
  msgstr ""
238
 
239
+ #: ../image-watermark.php:566
240
  msgid "everywhere"
241
  msgstr ""
242
 
243
+ #: ../image-watermark.php:567
244
  msgid "on selected post types only"
245
  msgstr ""
246
 
247
+ #: ../image-watermark.php:581
248
  msgid ""
249
  "Check custom post types on which watermark should be applied to uploaded "
250
  "images."
251
  msgstr ""
252
 
253
+ #: ../image-watermark.php:593
 
 
 
 
254
  msgid ""
255
+ "Enable frontend image uploading. (uploading script is not included, but you "
256
+ "may use a plugin or custom code)."
 
 
257
  msgstr ""
258
 
259
+ #: ../image-watermark.php:595
260
+ msgid ""
261
+ "<br /><strong>Notice:</strong> This functionality works only if uploaded "
262
+ "images are processed using WordPress native upload methods."
263
  msgstr ""
264
 
265
+ #: ../image-watermark.php:606
266
  msgid "Delete all database settings on plugin deactivation."
267
  msgstr ""
268
 
269
+ #: ../image-watermark.php:637
 
 
 
 
 
 
 
 
270
  msgid "Choose the position of watermark image."
271
  msgstr ""
272
 
273
+ #: ../image-watermark.php:648 ../image-watermark.php:738
 
 
 
 
274
  msgid "x:"
275
  msgstr ""
276
 
277
+ #: ../image-watermark.php:648 ../image-watermark.php:650
278
+ #: ../image-watermark.php:738 ../image-watermark.php:740
279
  msgid "px"
280
  msgstr ""
281
 
282
+ #: ../image-watermark.php:650 ../image-watermark.php:740
283
  msgid "y:"
284
  msgstr ""
285
 
286
+ #: ../image-watermark.php:668
 
 
 
 
 
 
 
 
 
287
  msgid "Select image"
288
  msgstr ""
289
 
290
+ #: ../image-watermark.php:669
291
+ msgid "Remove image"
292
  msgstr ""
293
 
294
+ #: ../image-watermark.php:670
295
  msgid "You have to save changes after the selection or removal of the image."
296
  msgstr ""
297
 
298
+ #: ../image-watermark.php:720
 
 
 
 
 
 
 
 
299
  msgid "original"
300
  msgstr ""
301
 
302
+ #: ../image-watermark.php:722
303
  msgid "custom"
304
  msgstr ""
305
 
306
+ #: ../image-watermark.php:724
307
  msgid "scaled"
308
  msgstr ""
309
 
310
+ #: ../image-watermark.php:727
311
  msgid "Select method of aplying watermark size."
312
  msgstr ""
313
 
314
+ #: ../image-watermark.php:742
 
 
 
 
315
  msgid "Those dimensions will be used if \"custom\" method is selected above."
316
  msgstr ""
317
 
318
+ #: ../image-watermark.php:759
 
 
 
 
319
  msgid ""
320
  "This value will be used if \"scaled\" method if selected above. <br />Enter "
321
  "a number ranging from 0 to 100. 100 makes width of watermark image equal to "
322
  "width of the image it is applied to."
323
  msgstr ""
324
 
325
+ #: ../image-watermark.php:776
 
 
 
 
326
  msgid ""
327
  "Enter a number ranging from 0 to 100. 0 makes watermark image completely "
328
  "transparent, 100 shows it as is."
329
  msgstr ""
330
 
331
+ #: ../image-watermark.php:793
 
 
 
 
332
  msgid "Set output image quality."
333
  msgstr ""
334
 
335
+ #: ../image-watermark.php:804
 
 
 
 
336
  msgid "baseline"
337
  msgstr ""
338
 
339
+ #: ../image-watermark.php:806
340
  msgid "progressive"
341
  msgstr ""
342
 
343
+ #: ../image-watermark.php:810
344
  msgid "Select baseline or progressive image format."
345
  msgstr ""
346
 
347
+ #: ../image-watermark.php:821
 
 
 
 
348
  msgid "Disable right mouse click on images"
349
  msgstr ""
350
 
351
+ #: ../image-watermark.php:833
352
  msgid "Prevent drag and drop"
353
  msgstr ""
354
 
355
+ #: ../image-watermark.php:845
356
  msgid "Enable image protection for logged-in users also"
357
  msgstr ""
358
 
359
+ #: ../image-watermark.php:924
360
+ msgid "Settings saved."
361
  msgstr ""
362
 
363
+ #: ../image-watermark.php:929
364
+ msgid "Settings restored to defaults."
365
+ msgstr ""
366
+
367
+ #: ../image-watermark.php:934
368
+ msgid "Watermark will not be applied when watermark image is not set."
369
+ msgstr ""
370
+
371
+ #: ../image-watermark.php:937
372
+ msgid "Watermark will not be applied when no image sizes are selected."
373
+ msgstr ""
374
+
375
+ #: ../image-watermark.php:1247
376
+ msgid "Support"
377
+ msgstr ""
378
+
379
+ #: ../image-watermark.php:1270
380
+ msgid "Settings"
381
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.1
7
- Stable tag: 1.4.1
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -43,7 +43,6 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
43
  * Polish - by Bartosz Arendt
44
  * Russian - by [Sly](http://wpguru.ru)
45
 
46
-
47
  == Installation ==
48
 
49
  1. Install Image Watermark either via the WordPress.org plugin directory, or by uploading the files to your server
@@ -62,6 +61,11 @@ No questions yet.
62
 
63
  == Changelog ==
64
 
 
 
 
 
 
65
  = 1.4.1 =
66
  * New: Hungarian translation, thanks to Meszaros Tamas
67
 
@@ -139,5 +143,7 @@ Initial release
139
 
140
  == Upgrade Notice ==
141
 
142
- = 1.4.1 =
143
- * New: Hungarian translation, thanks to Meszaros Tamas
 
 
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.2.2
7
+ Stable tag: 1.5.0
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
43
  * Polish - by Bartosz Arendt
44
  * Russian - by [Sly](http://wpguru.ru)
45
 
 
46
  == Installation ==
47
 
48
  1. Install Image Watermark either via the WordPress.org plugin directory, or by uploading the files to your server
61
 
62
  == Changelog ==
63
 
64
+ = 1.5.0 =
65
+ * Tweak: Plugins setting adjusted to WP settings API
66
+ * Tweak: General code cleanup
67
+ * Tweak: Added Media Library bulk watermarking notice
68
+
69
  = 1.4.1 =
70
  * New: Hungarian translation, thanks to Meszaros Tamas
71
 
143
 
144
  == Upgrade Notice ==
145
 
146
+ = 1.5.0 =
147
+ * Tweak: Plugins setting adjusted to WP settings API
148
+ * Tweak: General code cleanup
149
+ * Tweak: Added Media Library bulk watermarking notice