Easy Watermark - Version 0.2.3

Version Description

  • added bulk action on media library page
Download this release

Release Info

Developer szaleq
Plugin Icon Easy Watermark
Version 0.2.3
Comparing to
See all releases

Code changes from version 0.2.2 to 0.2.3

EasyWatermarkPlugin.php CHANGED
@@ -10,22 +10,22 @@
10
  class EasyWatermarkPlugin extends ewPluginCore
11
  {
12
  /**
13
- * @var string plugin name
14
  */
15
  protected static $pluginName = 'Easy Watermark';
16
 
17
  /**
18
- * @var string plugin slug used in setting names etc.
19
  */
20
  protected static $pluginSlug = 'easy-watermark';
21
 
22
  /**
23
- * @var string plugin version
24
  */
25
- protected static $version = '0.2.2';
26
 
27
  /**
28
- * @var string plugin class name
29
  */
30
  protected static $className = 'EasyWatermarkPlugin';
31
 
@@ -33,6 +33,8 @@ class EasyWatermarkPlugin extends ewPluginCore
33
 
34
  private $messages = array();
35
 
 
 
36
  private $allowedMime = array('image/png', 'image/jpeg', 'image/gif');
37
 
38
  /**
@@ -47,48 +49,133 @@ class EasyWatermarkPlugin extends ewPluginCore
47
  ->add_action('admin_menu', 'add_media_page')
48
  ->add_filter('media_row_actions', 'add_media_row_action', 10, 3)
49
  ->add_filter('attachment_fields_to_edit', 'add_attachment_field', 10, 2)
50
- ->add_action('add_attachment', 'add_watermark_after_upload');
 
 
 
51
  }
52
 
 
 
 
 
 
53
  public function plugin_init(){
54
  new EasyWatermarkSettings($this);
55
 
56
- if(isset($_GET['page']) && $_GET['page'] == 'easy-watermark-settings' && isset($_GET['tp']) && $_GET['tp'] == 1){
57
- $ew = $this->getEasyWatermark();
58
- if($this->settings['general']['watermark_type'] == '1'){
59
- $settings = $this->settings['text'];
 
 
 
 
 
60
 
61
- $fontFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $settings['font'];
62
- if(file_exists($fontFile))
63
- $settings['font'] = $fontFile;
 
 
 
 
 
 
 
64
 
65
- $ew->textSet($settings);
66
- }
 
67
 
68
- if(isset($_GET['text']))
69
- $ew->textSet('text', $_GET['text']);
70
- if(isset($_GET['size']))
71
- $ew->textSet('size', $_GET['size']);
72
- if(isset($_GET['angle']))
73
- $ew->textSet('angle', $_GET['angle']);
74
- if(isset($_GET['color']))
75
- $ew->textSet('color', $_GET['color']);
76
- if(isset($_GET['opacity']))
77
- $ew->textSet('opacity', $_GET['opacity']);
78
-
79
- if(isset($_GET['font'])){
80
- $fontFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $_GET['font'];
81
- if(file_exists($fontFile))
82
- $ew->textSet('font', $fontFile);
83
- }
84
 
85
- $ew->printTextPreview();
86
- die();
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
 
 
 
88
  }
89
 
90
- public function setSettings($settings){
91
- $this->settings = $settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
 
94
  /**
@@ -100,15 +187,26 @@ class EasyWatermarkPlugin extends ewPluginCore
100
  add_media_page( 'Easy Watermark', 'Easy Watermark', 'upload_files', 'easy-watermark', array($this, 'easy_watermark'));
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
103
  /**
104
  * Creates 'Add watermark' link for each row in media library
105
  *
106
- * @return array
107
  */
108
  public function add_media_row_action($actions, $post, $detached){
109
  if($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/png' || $post->post_mime_type == 'image/gif'){
110
  // Add link if it's supported image type
111
- $actions['add_watermark'] = '<a href="' . wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post->ID)) . '">'.__('Add watermark', 'easy-watermark').'</a>';
112
  }
113
 
114
  return $actions;
@@ -117,14 +215,14 @@ class EasyWatermarkPlugin extends ewPluginCore
117
  /**
118
  * Creates 'Add watermark' button in media edit view
119
  *
120
- * @return array
121
  */
122
  public function add_attachment_field($form_fields, $post){
123
  if($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/png' || $post->post_mime_type == 'image/gif'){
124
  // Add link if it's supported image type
125
  $form_fields = array_reverse($form_fields);
126
  $form_fields['easy-watermark'] = array(
127
- 'label' => '<a href="'.wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post->ID)).'" class="button-secondary">'.__('Add watermark', 'easy-watermark').'</a>',
128
  'input' => 'html',
129
  'html' => ' '
130
  );
@@ -133,13 +231,51 @@ class EasyWatermarkPlugin extends ewPluginCore
133
  return array_reverse($form_fields);
134
  }
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  /**
137
  * Watermark image after it was uploaded.
138
  * In fact this method only mark that there is an image to watermark,
139
  * it's realy watermarked in wp_generate_attachment_metadata filter.
140
  * See wp_generate_attachment_metadata() method below.
141
  *
142
- * @return array
143
  */
144
  public function add_watermark_after_upload($id){
145
  if($this->settings['general']['auto_add']){
@@ -157,13 +293,13 @@ class EasyWatermarkPlugin extends ewPluginCore
157
  * that image was uploaded and then it's watermarked in this filter
158
  * which is called after resizing.
159
  *
160
- * @param array
161
- * @param integer
162
- * @return array
163
  */
164
  public function wp_generate_attachment_metadata($metadata, $id){
165
  if($this->watermark_uploaded && $this->uploaded_id == $id){
166
- $this->add_watermark($id);
167
 
168
  $this->watermark_uploaded = false;
169
  $this->uploaded_id = null;
@@ -172,13 +308,18 @@ class EasyWatermarkPlugin extends ewPluginCore
172
  return $metadata;
173
  }
174
 
175
- private function add_watermark($id, $checkMime = false){
 
 
 
 
 
 
176
  if($this->settings['image']['watermark_path'] != '' || $this->settings['text']['text'] != null){
177
  $post = get_post($id);
178
  $filepath = get_attached_file($id);
179
-
180
  if(!in_array($post->post_mime_type, $this->allowedMime)){
181
- $this->add_error('Invalid mime type.');
182
  return false;
183
  }
184
  if($checkMime && !in_array($post->post_mime_type, $this->settings['general']['image_types'])){
@@ -188,11 +329,17 @@ class EasyWatermarkPlugin extends ewPluginCore
188
  return $this->create_watermark($filepath, $post->post_mime_type);
189
  }
190
  else {
191
- $this->add_error('No watermark image selected and no watermark text set.');
192
  return false;
193
  }
194
  }
195
 
 
 
 
 
 
 
196
  private function watermark_all(){
197
  global $wpdb;
198
 
@@ -224,6 +371,13 @@ class EasyWatermarkPlugin extends ewPluginCore
224
  return $output;
225
  }
226
 
 
 
 
 
 
 
 
227
  private function create_watermark($imageFile, $imageType){
228
  if(empty($this->settings['image']['watermark_path']) || $this->settings['image']['watermark_path'] != $imageFile){
229
  $ew = $this->getEasyWatermark();
@@ -244,8 +398,16 @@ class EasyWatermarkPlugin extends ewPluginCore
244
  }
245
  }
246
 
 
 
 
247
  private $ew;
248
 
 
 
 
 
 
249
  public function getEasyWatermark(){
250
  if(!($ew instanceof EasyWatermark)){
251
  $imageSettings = $this->settings['image'];
@@ -266,31 +428,18 @@ class EasyWatermarkPlugin extends ewPluginCore
266
  return $ew;
267
  }
268
 
 
 
 
 
 
269
  public function easy_watermark(){
270
  ?>
271
  <div class="wrap easy-watermark">
272
  <h2><?php _e('Easy Watermark', 'easy-watermark'); ?></h2>
273
  <?php
274
  if(isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'])){
275
- if(isset($_GET['attachment_id'])){
276
- if($this->add_watermark($_GET['attachment_id'])) :
277
- ?>
278
- <div id="message" class="updated below-h2">
279
- <p><?php _e('Watermark successfully added.', 'easy-watermark'); ?> <a href="javascript:window.history.go(-1)"><?php _e('Go back', 'easy-watermark'); ?></a> <?php _e('or', 'easy-watermark'); ?> <a href="<?php echo get_edit_post_link($_GET['attachment_id']); ?>"><?php _e('go to edit page', 'easy-watermark'); ?></a></p>
280
- </div>
281
- <?php
282
- else :
283
- foreach($this->messages as $msg) :
284
- ?>
285
- <div id="message" class="<?php echo $msg[0]; ?> below-h2">
286
- <p><?php _e($msg[1], 'easy-watermark'); ?></p>
287
- </div>
288
- <a href="javascript:window.history.go(-1)"><?php _e('Go back', 'easy-watermark'); ?></a> or <a href="<?php echo get_edit_post_link($_GET['attachment_id']); ?>"><?php _e('go to edit page', 'easy-watermark'); ?></a>
289
- <?php
290
- endforeach;
291
- endif;
292
- }
293
- elseif(isset($_GET['watermark_all'])){
294
  if($output = $this->watermark_all()) :
295
  ?>
296
  <div id="message" class="updated below-h2">
@@ -304,16 +453,9 @@ class EasyWatermarkPlugin extends ewPluginCore
304
  else {
305
  ?>
306
  <br/>
307
- <div id="donation-link" style="float:right;">
308
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
309
- <input type="hidden" name="cmd" value="_s-xclick">
310
- <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA8xQGlvi8n1Z+gGML2vv7D6Yu7SDp5D9tEtuJbKkzhj4QFu2Pj/svKml7I2KqqtQ3fDt1EBbkMnpJKCo0REZvm1d8HHdIaYLKYb/tAFB+07yNHpijY6yh+UHHf6L3/bQDm0lpO6um42QQTw/2twhGDonzqegA3ib0nA/aILtaGKzELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIxDfGTrZ6yuiAgZi453vvqGLVVAnc5q9bSaEMsvctN4JOIQZdoYvPU/yGVp/oyEANNwHLC+8/d2EVqCCh/vq3PUINdF+ikfs3XmbqBgcwAXvslNWb/noSmmAWYZ+E3aRCHRqQ4kgIjoIBzkP1xCFW1RxCZ9rVrkkbEk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KoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEzMDQwMzE5MTg1M1owIwYJKoZIhvcNAQkEMRYEFDKku21WwSSpmTt3G1X/QPEw2JWIMA0GCSqGSIb3DQEBAQUABIGALNEoboh/1wsUWg5rX0IxqZrhuFOzeskmQUneuuPReMy7x6QJ6gBMeN4NY+c2ZIOkDwc2ZfuaEmrt56SKqDGakVqubcTLaXzPOfkFTN2V+yvsnur13vXND+BzeIiTiWtiGP47CupCHSRZoSMLP0YQloDFmSx0hpala2E/9Q09oZk=-----END PKCS7-----
311
- ">
312
- <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
313
- <img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
314
- </form>
315
- </div><!-- #donation-link -->
316
- <a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&watermark_all=1')); ?>"><?php _e('Add watermark to all images', 'easy-watermark'); ?></a><p class="description"><?php _e('Be carefull with that option. If some images alredy has watermark, it will be added though.'); ?></p>
317
  <?php
318
  }
319
  ?>
@@ -321,6 +463,11 @@ class EasyWatermarkPlugin extends ewPluginCore
321
  <?php
322
  }
323
 
 
 
 
 
 
324
  public static function install($settings = null){
325
  if(empty($settings)) $settings = EasyWatermarkSettings::getDefaults();
326
 
@@ -330,6 +477,11 @@ class EasyWatermarkPlugin extends ewPluginCore
330
  update_option(static::$pluginSlug.'-version', static::$version);
331
  }
332
 
 
 
 
 
 
333
  public static function uninstall(){
334
  $settings = EasyWatermarkSettings::getDefaults();
335
 
@@ -339,8 +491,18 @@ class EasyWatermarkPlugin extends ewPluginCore
339
  delete_option(static::$pluginSlug.'-version');
340
  }
341
 
342
- public static function upgrade($version){
343
- if($version == '0.2'){
 
 
 
 
 
 
 
 
 
 
344
  $settings['image'] = get_option(static::$pluginSlug.'-settings-image');
345
  $settings['text'] = get_option(static::$pluginSlug.'-settings-text');
346
  }
@@ -401,6 +563,13 @@ class EasyWatermarkPlugin extends ewPluginCore
401
  static::install($settings);
402
  }
403
 
 
 
 
 
 
 
 
404
  private static function getAlignment($x, $y){
405
  $a = false;
406
  switch($y){
@@ -466,4 +635,13 @@ class EasyWatermarkPlugin extends ewPluginCore
466
  private function add_info($msg){
467
  $this->messages[] = array('update', $msg);
468
  }
 
 
 
 
 
 
 
 
 
469
  }
10
  class EasyWatermarkPlugin extends ewPluginCore
11
  {
12
  /**
13
+ * @var string plugin name
14
  */
15
  protected static $pluginName = 'Easy Watermark';
16
 
17
  /**
18
+ * @var string plugin slug used in setting names etc.
19
  */
20
  protected static $pluginSlug = 'easy-watermark';
21
 
22
  /**
23
+ * @var string plugin version
24
  */
25
+ protected static $version = '0.2.3';
26
 
27
  /**
28
+ * @var string plugin class name
29
  */
30
  protected static $className = 'EasyWatermarkPlugin';
31
 
33
 
34
  private $messages = array();
35
 
36
+ private $error = false;
37
+
38
  private $allowedMime = array('image/png', 'image/jpeg', 'image/gif');
39
 
40
  /**
49
  ->add_action('admin_menu', 'add_media_page')
50
  ->add_filter('media_row_actions', 'add_media_row_action', 10, 3)
51
  ->add_filter('attachment_fields_to_edit', 'add_attachment_field', 10, 2)
52
+ ->add_action('add_attachment', 'add_watermark_after_upload')
53
+ ->add_action('admin_notices')
54
+ ->add_action('admin_head-upload.php', 'add_bulk_action_script')
55
+ ->add_action('admin_action_ew_add_watermark', 'bulk_action_handler');
56
  }
57
 
58
+ /**
59
+ * Performs some actions that need to run before anything else
60
+ *
61
+ * @return void
62
+ */
63
  public function plugin_init(){
64
  new EasyWatermarkSettings($this);
65
 
66
+ if(isset($_GET['page'])){
67
+ if($_GET['page'] == 'easy-watermark-settings' && isset($_GET['tp']) && $_GET['tp'] == 1){
68
+ $this->print_text_preview();
69
+ }
70
+ elseif($_GET['page'] == 'easy-watermark' && isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'])){
71
+ $this->add_watermark();
72
+ }
73
+ }
74
+ }
75
 
76
+ /**
77
+ * Returns generated jpeg image with text preview to the browser.
78
+ * Used for settings page
79
+ *
80
+ * @return void
81
+ */
82
+ private function print_text_preview(){
83
+ $ew = $this->getEasyWatermark();
84
+ if($this->settings['general']['watermark_type'] == '1'){
85
+ $settings = $this->settings['text'];
86
 
87
+ $fontFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $settings['font'];
88
+ if(file_exists($fontFile))
89
+ $settings['font'] = $fontFile;
90
 
91
+ $ew->textSet($settings);
92
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
+ if(isset($_GET['text']))
95
+ $ew->textSet('text', $_GET['text']);
96
+ if(isset($_GET['size']))
97
+ $ew->textSet('size', $_GET['size']);
98
+ if(isset($_GET['angle']))
99
+ $ew->textSet('angle', $_GET['angle']);
100
+ if(isset($_GET['color']))
101
+ $ew->textSet('color', $_GET['color']);
102
+ if(isset($_GET['opacity']))
103
+ $ew->textSet('opacity', $_GET['opacity']);
104
+
105
+ if(isset($_GET['font'])){
106
+ $fontFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $_GET['font'];
107
+ if(file_exists($fontFile))
108
+ $ew->textSet('font', $fontFile);
109
  }
110
+
111
+ $ew->printTextPreview();
112
+ exit;
113
  }
114
 
115
+ /**
116
+ * Performs watermarking the single image
117
+ *
118
+ * @return void
119
+ */
120
+ private function add_watermark(){
121
+ if(isset($_GET['attachment_id'])){
122
+ $url = false;
123
+ if($this->watermark_single($_GET['attachment_id'])){
124
+ switch($_GET['r']){
125
+ case 'library':
126
+ $url = admin_url('upload.php?watermarked=true');
127
+ break;
128
+ case 'post':
129
+ $url = admin_url('post.php?post='.$_GET['attachment_id'].'&action=edit&watermarked=1');
130
+ break;
131
+ }
132
+ }
133
+ else {
134
+ switch($_GET['r']){
135
+ case 'library':
136
+ $url = admin_url('upload.php?ew_error='.$this->error);
137
+ break;
138
+ case 'post':
139
+ $url = admin_url('post.php?post='.$_GET['attachment_id'].'&action=edit&ew_error='.$this->error);
140
+ break;
141
+ }
142
+ }
143
+ if($url){
144
+ wp_redirect($url);
145
+ exit;
146
+ }
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Prints admin notices
152
+ *
153
+ * @return void
154
+ */
155
+ public function admin_notices(){
156
+ if(isset($_GET['watermarked']) && $_GET['watermarked'] == 'true'):
157
+ ?>
158
+ <div class="updated">
159
+ <p><?php _e('Watermark successfully added.', 'easy-watermark'); ?></p>
160
+ </div>
161
+ <?php
162
+ elseif(isset($_GET['ew_error'])):
163
+ echo '<div class="error"><p>';
164
+ switch($_GET['ew_error']):
165
+ case '1':
166
+ _e('Invalid mime type.', 'easy-watermark');
167
+ break;
168
+ case '2':
169
+ _e('No watermark image selected and no watermark text set.', 'easy-watermark');
170
+ echo ' <a href="'.admin_url('options-general.php?page=easy-watermark-settings').'">';
171
+ _e('Go to settings page', 'easy-watermark');
172
+ echo '</a>';
173
+ break;
174
+ default:
175
+ _e('An error has occurred.', 'easy-watermark');
176
+ endswitch;
177
+ echo '</p></div>';
178
+ endif;
179
  }
180
 
181
  /**
187
  add_media_page( 'Easy Watermark', 'Easy Watermark', 'upload_files', 'easy-watermark', array($this, 'easy_watermark'));
188
  }
189
 
190
+ function add_bulk_action_script() {
191
+ ?>
192
+ <script type="text/javascript">
193
+ jQuery(document).ready(function() {
194
+ jQuery('<option>').val('ew_add_watermark').text('<?php _e('Add Watermark', 'easy-watermark')?>').appendTo("select[name='action']");
195
+ jQuery('<option>').val('ew_add_watermark').text('<?php _e('Add Watermark', 'easy-watermark')?>').appendTo("select[name='action2']");
196
+ });
197
+ </script>
198
+ <?php
199
+ }
200
+
201
  /**
202
  * Creates 'Add watermark' link for each row in media library
203
  *
204
+ * @return array
205
  */
206
  public function add_media_row_action($actions, $post, $detached){
207
  if($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/png' || $post->post_mime_type == 'image/gif'){
208
  // Add link if it's supported image type
209
+ $actions['add_watermark'] = '<a href="' . wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post->ID.'&r=library')) . '">'.__('Add watermark', 'easy-watermark').'</a>';
210
  }
211
 
212
  return $actions;
215
  /**
216
  * Creates 'Add watermark' button in media edit view
217
  *
218
+ * @return array
219
  */
220
  public function add_attachment_field($form_fields, $post){
221
  if($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/png' || $post->post_mime_type == 'image/gif'){
222
  // Add link if it's supported image type
223
  $form_fields = array_reverse($form_fields);
224
  $form_fields['easy-watermark'] = array(
225
+ 'label' => '<a href="'.wp_nonce_url(admin_url('upload.php?page=easy-watermark&attachment_id='.$post->ID.'&r=post')).'" class="button-secondary">'.__('Add watermark', 'easy-watermark').'</a>',
226
  'input' => 'html',
227
  'html' => ' '
228
  );
231
  return array_reverse($form_fields);
232
  }
233
 
234
+ /**
235
+ * Handles the ew_add_watermark bulk action
236
+ * Performs watermarking selected images
237
+ *
238
+ * @uses self::watermark_single
239
+ * @return void
240
+ */
241
+ public function bulk_action_handler(){
242
+
243
+ if(empty($_REQUEST['action']) || ($_REQUEST['action'] != 'ew_add_watermark' && $_REQUEST['action2'] != 'ew_add_watermark')){
244
+ return;
245
+ }
246
+
247
+ if(empty($_REQUEST['media']) || !is_array($_REQUEST['media'])){
248
+ return;
249
+ }
250
+
251
+ check_admin_referer('bulk-media');
252
+ $result = true;
253
+ foreach($_REQUEST['media'] as $entry){
254
+ if(!$this->watermark_single((int) $entry))
255
+ $result = false;
256
+ }
257
+
258
+ if(isset($_GET['_wp_http_referer'])){
259
+ $referer = $_GET['_wp_http_referer'];
260
+ if(strpos($referer, '?'))
261
+ $referer .= '&';
262
+ else
263
+ $referer .= '?';
264
+
265
+ $referer .= $result ? 'watermarked=true' : 'ew_error=2';
266
+
267
+ wp_redirect($referer);
268
+ exit;
269
+ }
270
+ }
271
+
272
  /**
273
  * Watermark image after it was uploaded.
274
  * In fact this method only mark that there is an image to watermark,
275
  * it's realy watermarked in wp_generate_attachment_metadata filter.
276
  * See wp_generate_attachment_metadata() method below.
277
  *
278
+ * @return array
279
  */
280
  public function add_watermark_after_upload($id){
281
  if($this->settings['general']['auto_add']){
293
  * that image was uploaded and then it's watermarked in this filter
294
  * which is called after resizing.
295
  *
296
+ * @param array
297
+ * @param integer
298
+ * @return array
299
  */
300
  public function wp_generate_attachment_metadata($metadata, $id){
301
  if($this->watermark_uploaded && $this->uploaded_id == $id){
302
+ $this->watermark_single($id, true);
303
 
304
  $this->watermark_uploaded = false;
305
  $this->uploaded_id = null;
308
  return $metadata;
309
  }
310
 
311
+ /**
312
+ * Performs the action of a single image watermarking
313
+ *
314
+ * @uses self::create_watermark
315
+ * @return boolean
316
+ */
317
+ private function watermark_single($id, $checkMime = false){
318
  if($this->settings['image']['watermark_path'] != '' || $this->settings['text']['text'] != null){
319
  $post = get_post($id);
320
  $filepath = get_attached_file($id);
 
321
  if(!in_array($post->post_mime_type, $this->allowedMime)){
322
+ $this->error = 1;
323
  return false;
324
  }
325
  if($checkMime && !in_array($post->post_mime_type, $this->settings['general']['image_types'])){
329
  return $this->create_watermark($filepath, $post->post_mime_type);
330
  }
331
  else {
332
+ $this->error = 2;
333
  return false;
334
  }
335
  }
336
 
337
+ /**
338
+ * Performs the action of watermarking all images from library
339
+ *
340
+ * @uses self::create_watermark
341
+ * @return boolean
342
+ */
343
  private function watermark_all(){
344
  global $wpdb;
345
 
371
  return $output;
372
  }
373
 
374
+ /**
375
+ * Applies the watermark to the given image
376
+ *
377
+ * @param string path to image file
378
+ * @param string image mime type
379
+ * @return boolean
380
+ */
381
  private function create_watermark($imageFile, $imageType){
382
  if(empty($this->settings['image']['watermark_path']) || $this->settings['image']['watermark_path'] != $imageFile){
383
  $ew = $this->getEasyWatermark();
398
  }
399
  }
400
 
401
+ /**
402
+ * @var object stores EasyWatermark object
403
+ */
404
  private $ew;
405
 
406
+ /**
407
+ * Returns configured EasyWatermark object
408
+ *
409
+ * @return object
410
+ */
411
  public function getEasyWatermark(){
412
  if(!($ew instanceof EasyWatermark)){
413
  $imageSettings = $this->settings['image'];
428
  return $ew;
429
  }
430
 
431
+ /**
432
+ * Prints Easy Watermark page
433
+ *
434
+ * @return void
435
+ */
436
  public function easy_watermark(){
437
  ?>
438
  <div class="wrap easy-watermark">
439
  <h2><?php _e('Easy Watermark', 'easy-watermark'); ?></h2>
440
  <?php
441
  if(isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'])){
442
+ if(isset($_GET['watermark_all'])){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
  if($output = $this->watermark_all()) :
444
  ?>
445
  <div id="message" class="updated below-h2">
453
  else {
454
  ?>
455
  <br/>
456
+ <?php require_once dirname(__FILE__) . '/donation.php';
457
+ ewDonation::showButton(); ?>
458
+ <a class="button-primary" href="<?php echo wp_nonce_url(admin_url('/upload.php?page=easy-watermark&watermark_all=1')); ?>"><?php _e('Add watermark to all images', 'easy-watermark'); ?></a><p class="description"><?php _e('Be carefull with that option. If some images alredy has watermark, it will be added though.', 'easy-watermark'); ?></p>
 
 
 
 
 
 
 
459
  <?php
460
  }
461
  ?>
463
  <?php
464
  }
465
 
466
+ /**
467
+ * Method run when activating plugin
468
+ *
469
+ * @return void
470
+ */
471
  public static function install($settings = null){
472
  if(empty($settings)) $settings = EasyWatermarkSettings::getDefaults();
473
 
477
  update_option(static::$pluginSlug.'-version', static::$version);
478
  }
479
 
480
+ /**
481
+ * Method run when removing plugin
482
+ *
483
+ * @return void
484
+ */
485
  public static function uninstall(){
486
  $settings = EasyWatermarkSettings::getDefaults();
487
 
491
  delete_option(static::$pluginSlug.'-version');
492
  }
493
 
494
+ /**
495
+ * Method run when plugin version stored in WP options
496
+ * is lower than current version.
497
+ *
498
+ * @param string previously installed version
499
+ * @return void
500
+ */
501
+ protected static function upgrade($version){
502
+ if($version == '0.2.2'){
503
+ return;
504
+ }
505
+ elseif($version == '0.2' || $version == '0.2.1'){
506
  $settings['image'] = get_option(static::$pluginSlug.'-settings-image');
507
  $settings['text'] = get_option(static::$pluginSlug.'-settings-text');
508
  }
563
  static::install($settings);
564
  }
565
 
566
+ /**
567
+ * Computes alignment number based on position_x and position_y
568
+ *
569
+ * @param int
570
+ * @param int
571
+ * @return int
572
+ */
573
  private static function getAlignment($x, $y){
574
  $a = false;
575
  switch($y){
635
  private function add_info($msg){
636
  $this->messages[] = array('update', $msg);
637
  }
638
+
639
+ /**
640
+ * Sets settings array.
641
+ *
642
+ * @return void
643
+ */
644
+ public function setSettings($settings){
645
+ $this->settings = $settings;
646
+ }
647
  }
EasyWatermarkSettings.php CHANGED
@@ -9,7 +9,7 @@ class EasyWatermarkSettings
9
  private static $defaults = array(
10
  'general' => array(
11
  'auto_add' => '1',
12
- 'image_types' => array('jpeg', 'png', 'gif'),
13
  'watermark_type' => 3
14
  ),
15
  'image' => array(
@@ -39,11 +39,7 @@ class EasyWatermarkSettings
39
  )
40
  );
41
 
42
- private $tabs = array(
43
- 'general' => 'General',
44
- 'image' => 'Image',
45
- 'text' => 'Text',
46
- );
47
 
48
  private $fonts = array(
49
  'Arial.ttf' => 'Arial',
@@ -67,6 +63,13 @@ class EasyWatermarkSettings
67
  add_action('admin_menu', array($this, 'add_options_page'));
68
  add_action('admin_init', array($this, 'register_settings'));
69
  add_filter('plugin_action_links', array($this, 'settings_link'), 10, 2);
 
 
 
 
 
 
 
70
 
71
  foreach($this->tabs as $name => $caption){
72
  $section = get_option($plugin->getSlug() . '-settings-' . $name);
@@ -249,9 +252,23 @@ class EasyWatermarkSettings
249
  $this_plugin = plugin_basename(dirname(__FILE__) . '/index.php');
250
  }
251
  if ($file == $this_plugin) {
252
- $settings_link = '<a href="options-general.php?page=easy-watermark-settings">'.__('Settings').'</a>';
253
  array_unshift($links, $settings_link);
254
  }
255
  return $links;
256
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
9
  private static $defaults = array(
10
  'general' => array(
11
  'auto_add' => '1',
12
+ 'image_types' => array('image/jpeg', 'image/png', 'image/gif'),
13
  'watermark_type' => 3
14
  ),
15
  'image' => array(
39
  )
40
  );
41
 
42
+ private $tabs;
 
 
 
 
43
 
44
  private $fonts = array(
45
  'Arial.ttf' => 'Arial',
63
  add_action('admin_menu', array($this, 'add_options_page'));
64
  add_action('admin_init', array($this, 'register_settings'));
65
  add_filter('plugin_action_links', array($this, 'settings_link'), 10, 2);
66
+ add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
67
+
68
+ $this->tabs = array(
69
+ 'general' => __('General', 'easy-watermark'),
70
+ 'image' => __('Image', 'easy-watermark'),
71
+ 'text' => __('Text', 'easy-watermark'),
72
+ );
73
 
74
  foreach($this->tabs as $name => $caption){
75
  $section = get_option($plugin->getSlug() . '-settings-' . $name);
252
  $this_plugin = plugin_basename(dirname(__FILE__) . '/index.php');
253
  }
254
  if ($file == $this_plugin) {
255
+ $settings_link = '<a href="options-general.php?page=easy-watermark-settings">'.__('Settings').'</a>';
256
  array_unshift($links, $settings_link);
257
  }
258
  return $links;
259
  }
260
+
261
+ function plugin_row_meta($links, $file){
262
+ static $this_plugin;
263
+
264
+ if (!$this_plugin) {
265
+ $this_plugin = plugin_basename(dirname(__FILE__) . '/index.php');
266
+ }
267
+ if ($file == $this_plugin) {
268
+ require_once dirname(__FILE__) . '/donation.php';
269
+ $donate_link = '<a href="'.ewDonation::getUrl().'">'.__('Donate', 'easy-watermark').'</a>';
270
+ array_push($links, $donate_link);
271
+ }
272
+ return $links;
273
+ }
274
  }
donation-link.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php defined('EASY_WATERMARK') or die(); ?>
2
+
3
+ <div id="donation-link" style="float:right;">
4
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
5
+ <input type="hidden" name="cmd" value="_s-xclick">
6
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYB7znZd3zLKG5bG9H9RFF2XN/7XsLDajXvBKUIzXo2tSHRTY3ZClHniLkQObPwj71Mwyei9bYlZ85MniUm9L2Kr6UJksFKAJWJ5H74pWxZkw5aplUgScjZOnephIw6brsTRAlVMaz4ltfcqLn5CJDD6MNWA0tRaCs3cxW7NETy2bTELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIQumQ6XNe+eGAgaAX8nrBZVxMk/tMmSaOWzdzPTJxEHFU0Mewy/9dJ0g6m6Q3ri4jXBbk0sgW5EbX3jgJ1Rqmne6JJfLiZbqbPBgiAKA1IiJhFTTgSGqES/Q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xHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTMwNDA2MTE0ODAwWjAjBgkqhkiG9w0BCQQxFgQUW+V1uzxDDFQihq2KMVC1GmIA1tUwDQYJKoZIhvcNAQEBBQAEgYCNWeiUNrPpGu5P9XoWa1alW+rED6+aDcNpZADy3BQcqbmsWUC2XqeHE33GOVkMM0/jAvY5ALcAvLulKy7O0/h7B9npb1vWTOCxWGKuWbPhWBmWr8iKNjqH/YT9n3JeHn2lH+LmwfR28ud0IMvSiYT+nn6tzNm2iWJf1yfHfWic6g==-----END PKCS7-----
7
+ ">
8
+ <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
9
+ <img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
10
+ </form>
11
+ </div><!-- #donation-link -->
donation.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php defined('EASY_WATERMARK') or die();
2
+
3
+ class ewDonation
4
+ {
5
+ public static function showButton(){
6
+ ?>
7
+ <div id="donation-link" style="float:right;">
8
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
9
+ <input type="hidden" name="cmd" value="_s-xclick">
10
+ <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYB7znZd3zLKG5bG9H9RFF2XN/7XsLDajXvBKUIzXo2tSHRTY3ZClHniLkQObPwj71Mwyei9bYlZ85MniUm9L2Kr6UJksFKAJWJ5H74pWxZkw5aplUgScjZOnephIw6brsTRAlVMaz4ltfcqLn5CJDD6MNWA0tRaCs3cxW7NETy2bTELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIQumQ6XNe+eGAgaAX8nrBZVxMk/tMmSaOWzdzPTJxEHFU0Mewy/9dJ0g6m6Q3ri4jXBbk0sgW5EbX3jgJ1Rqmne6JJfLiZbqbPBgiAKA1IiJhFTTgSGqES/QNaGrb1q5Afz/aZ8y0tRg3kbUII8hq57i/BgEkfbkkEIbWi4v3erWwuLrZf07bgy4JPN+c4ouE74Kt4kc9B8Qms6TEjG2r5ZBm60uD0dFBKvxKoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF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VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTMwNDA2MTE0ODAwWjAjBgkqhkiG9w0BCQQxFgQUW+V1uzxDDFQihq2KMVC1GmIA1tUwDQYJKoZIhvcNAQEBBQAEgYCNWeiUNrPpGu5P9XoWa1alW+rED6+aDcNpZADy3BQcqbmsWUC2XqeHE33GOVkMM0/jAvY5ALcAvLulKy7O0/h7B9npb1vWTOCxWGKuWbPhWBmWr8iKNjqH/YT9n3JeHn2lH+LmwfR28ud0IMvSiYT+nn6tzNm2iWJf1yfHfWic6g==-----END PKCS7-----
11
+ ">
12
+ <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
13
+ <img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
14
+ </form>
15
+ </div><!-- #donation-link -->
16
+ <?
17
+ }
18
+
19
+ public static function getUrl(){
20
+ return 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojtek%40szalkiewicz%2epl&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted';
21
+ }
22
+ }
index.php CHANGED
@@ -2,18 +2,24 @@
2
  /*
3
  Plugin Name: Easy Watermark
4
  Description: This plugin can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark image can be a png, gif (alpha channel supported in both cases) or jpg. It's also possibile to set watermark opacity (doesn't apply to png with alpha channel). For text watermark you can select font, set color, size, angel and opacity.
5
- Version: 0.2.2
6
  Author: Wojtek Szałkiewicz
7
  Author URI: http://szalkiewicz.pl/
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
 
12
- require_once dirname(__FILE__) . '/plugin.php';
13
- require_once dirname(__FILE__) . '/EasyWatermark.php';
14
- require_once dirname(__FILE__) . '/EasyWatermarkPlugin.php';
15
- require_once dirname(__FILE__) . '/EasyWatermarkSettings.php';
16
 
17
- if(is_admin())
18
- // init plugin only in admin panel
 
 
 
 
 
19
  EasyWatermarkPlugin::init();
 
2
  /*
3
  Plugin Name: Easy Watermark
4
  Description: This plugin can automatically add image and text watermark to pictures as they are uploaded to wordpress media library. You can also watermark existing images manually (all at once or an every single image). Watermark image can be a png, gif (alpha channel supported in both cases) or jpg. It's also possibile to set watermark opacity (doesn't apply to png with alpha channel). For text watermark you can select font, set color, size, angel and opacity.
5
+ Version: 0.2.3
6
  Author: Wojtek Szałkiewicz
7
  Author URI: http://szalkiewicz.pl/
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
 
12
+ // load plugin only in admin panel
13
+ if(is_admin()){
14
+ // Define flag, that we have plugin loaded
15
+ define('EASY_WATERMARK', true);
16
 
17
+ // Require all needed files
18
+ require_once dirname(__FILE__) . '/plugin.php';
19
+ require_once dirname(__FILE__) . '/EasyWatermark.php';
20
+ require_once dirname(__FILE__) . '/EasyWatermarkPlugin.php';
21
+ require_once dirname(__FILE__) . '/EasyWatermarkSettings.php';
22
+
23
+ // Initiate plugin
24
  EasyWatermarkPlugin::init();
25
+ }
languages/easy-watermark-pl_PL.mo CHANGED
Binary file
languages/easy-watermark-pl_PL.po CHANGED
@@ -1,75 +1,97 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Easy Watermark 0.2.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-04-04 00:18+0100\n"
6
- "PO-Revision-Date: 2013-04-04 00:19+0100\n"
7
  "Last-Translator: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
8
  "Language-Team: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
9
  "Language: Polish\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-KeywordsList: __;_e\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-Language: Polish\n"
16
- "X-Poedit-SearchPath-0: /media/szaleq/Data/easy-watermark/trunk\n"
17
 
18
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:111
19
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  msgid "Add watermark"
21
  msgstr "Dodaj znak wodny"
22
 
23
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:211
24
  #, php-format
25
  msgid "Not supported mime type of %s. Skipping..."
26
  msgstr "Nieobsługiwany typ pliku %s. Omijanie..."
27
 
28
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:216
29
  #, php-format
30
  msgid "Watermark successfully added to %s"
31
  msgstr "Znak wodny dodany do %s"
32
 
33
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:272
34
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:86
35
  msgid "Easy Watermark"
36
  msgstr ""
37
 
38
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
39
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:297
40
- msgid "Watermark successfully added."
41
- msgstr "Znak wodny został dodany."
42
-
43
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
44
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:288
45
- msgid "Go back"
46
- msgstr "Wróć"
47
-
48
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
49
- msgid "or"
50
- msgstr "lub"
51
-
52
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
53
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:288
54
- msgid "go to edit page"
55
- msgstr "idź na stronę edycji"
56
-
57
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:297
58
  msgid "Go to Media Library"
59
  msgstr "Idź do biblioteki mediów"
60
 
61
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:306
62
  msgid "Add watermark to all images"
63
  msgstr "Dodaj znak wodny do wszystkich obrazów"
64
 
65
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:306
66
  msgid "Be carefull with that option. If some images alredy has watermark, it will be added though."
67
  msgstr "Bądź ostrożny używając tej opcji. Jeśli któreś zdjęcia posiadają już znak wodny, zostanie on dodany po raz drugi."
68
 
69
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  msgid "Settings"
71
  msgstr "Ustawienia"
72
 
 
 
 
 
73
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:3
74
  msgid "Auto watermark"
75
  msgstr "Automatyczne dodawanie"
@@ -90,15 +112,6 @@ msgstr "Zaznacz typy obrazów, które mają być oznaczane znakiem wodnym"
90
  msgid "Watermark Type"
91
  msgstr "Typ znaku wodnego"
92
 
93
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:16
94
- msgid "Image"
95
- msgstr "Obraz"
96
-
97
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:17
98
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form-text.php:3
99
- msgid "Text"
100
- msgstr "Tekst"
101
-
102
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:18
103
  msgid "Image + Text"
104
  msgstr "Obraz i tekst"
@@ -207,14 +220,20 @@ msgstr "Kąt obrotu tekstu"
207
  msgid "Easy Watermark Settings"
208
  msgstr "Ustawienia Easy Watermark"
209
 
210
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:12
211
  msgid "Go to Easy Watermark Tool"
212
  msgstr "Przejdź do Easy Watermark"
213
 
214
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:28
215
  msgid "Save Changes"
216
  msgstr "Zapisz zmiany"
217
 
 
 
 
 
 
 
218
  #~ msgid "Text position"
219
  #~ msgstr "Pozycja tekstu"
220
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Easy Watermark 0.2.3\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-04-06 23:53+0100\n"
6
+ "PO-Revision-Date: 2013-04-06 23:53+0100\n"
7
  "Last-Translator: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
8
  "Language-Team: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
9
  "Language: Polish\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
 
 
 
 
13
 
14
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:159
15
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:446
16
+ msgid "Watermark successfully added."
17
+ msgstr "Znak wodny został dodany."
18
+
19
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:166
20
+ msgid "Invalid mime type."
21
+ msgstr "Błędny typ mime."
22
+
23
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:169
24
+ msgid "No watermark image selected and no watermark text set."
25
+ msgstr "Nie ustawiono obrazu ani tekstu znaku wodnego."
26
+
27
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:171
28
+ msgid "Go to settings page"
29
+ msgstr "Przejdź do ustawień"
30
+
31
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:175
32
+ msgid "An error has occurred."
33
+ msgstr "Wystąpił błąd."
34
+
35
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:194
36
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:195
37
+ msgid "Add Watermark"
38
+ msgstr "Dodaj znak wodny"
39
+
40
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:209
41
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:225
42
  msgid "Add watermark"
43
  msgstr "Dodaj znak wodny"
44
 
45
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:358
46
  #, php-format
47
  msgid "Not supported mime type of %s. Skipping..."
48
  msgstr "Nieobsługiwany typ pliku %s. Omijanie..."
49
 
50
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:363
51
  #, php-format
52
  msgid "Watermark successfully added to %s"
53
  msgstr "Znak wodny dodany do %s"
54
 
55
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:439
56
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:89
57
  msgid "Easy Watermark"
58
  msgstr ""
59
 
60
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  msgid "Go to Media Library"
62
  msgstr "Idź do biblioteki mediów"
63
 
64
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:458
65
  msgid "Add watermark to all images"
66
  msgstr "Dodaj znak wodny do wszystkich obrazów"
67
 
68
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:458
69
  msgid "Be carefull with that option. If some images alredy has watermark, it will be added though."
70
  msgstr "Bądź ostrożny używając tej opcji. Jeśli któreś zdjęcia posiadają już znak wodny, zostanie on dodany po raz drugi."
71
 
72
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:74
73
+ msgid "General"
74
+ msgstr "Ogólne"
75
+
76
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:75
77
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:16
78
+ msgid "Image"
79
+ msgstr "Obraz"
80
+
81
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:76
82
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:17
83
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form-text.php:3
84
+ msgid "Text"
85
+ msgstr "Tekst"
86
+
87
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:255
88
  msgid "Settings"
89
  msgstr "Ustawienia"
90
 
91
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:269
92
+ msgid "Donate"
93
+ msgstr "Przekaż dotację"
94
+
95
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:3
96
  msgid "Auto watermark"
97
  msgstr "Automatyczne dodawanie"
112
  msgid "Watermark Type"
113
  msgstr "Typ znaku wodnego"
114
 
 
 
 
 
 
 
 
 
 
115
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:18
116
  msgid "Image + Text"
117
  msgstr "Obraz i tekst"
220
  msgid "Easy Watermark Settings"
221
  msgstr "Ustawienia Easy Watermark"
222
 
223
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:5
224
  msgid "Go to Easy Watermark Tool"
225
  msgstr "Przejdź do Easy Watermark"
226
 
227
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:21
228
  msgid "Save Changes"
229
  msgstr "Zapisz zmiany"
230
 
231
+ #~ msgid "Go back"
232
+ #~ msgstr "Wróć"
233
+
234
+ #~ msgid "or"
235
+ #~ msgstr "lub"
236
+
237
  #~ msgid "Text position"
238
  #~ msgstr "Pozycja tekstu"
239
 
languages/easy-watermark.pot CHANGED
@@ -1,73 +1,95 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Easy Watermark 0.2.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-04-04 00:19+0100\n"
6
- "PO-Revision-Date: 2013-04-04 00:19+0100\n"
7
  "Last-Translator: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
8
  "Language-Team: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
9
  "Language: \n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-Language: English\n"
14
- "X-Poedit-KeywordsList: __;_e\n"
15
- "X-Poedit-Basepath: .\n"
16
- "X-Poedit-SearchPath-0: /media/szaleq/Data/easy-watermark/trunk\n"
17
 
18
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:111
19
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  msgid "Add watermark"
21
  msgstr ""
22
 
23
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:211
24
  #, php-format
25
  msgid "Not supported mime type of %s. Skipping..."
26
  msgstr ""
27
 
28
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:216
29
  #, php-format
30
  msgid "Watermark successfully added to %s"
31
  msgstr ""
32
 
33
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:272
34
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:86
35
  msgid "Easy Watermark"
36
  msgstr ""
37
 
38
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
39
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:297
40
- msgid "Watermark successfully added."
41
  msgstr ""
42
 
43
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
44
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:288
45
- msgid "Go back"
46
  msgstr ""
47
 
48
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
49
- msgid "or"
50
  msgstr ""
51
 
52
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:279
53
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:288
54
- msgid "go to edit page"
55
  msgstr ""
56
 
57
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:297
58
- msgid "Go to Media Library"
 
59
  msgstr ""
60
 
61
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:306
62
- msgid "Add watermark to all images"
 
 
63
  msgstr ""
64
 
65
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:306
66
- msgid "Be carefull with that option. If some images alredy has watermark, it will be added though."
67
  msgstr ""
68
 
69
- #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:252
70
- msgid "Settings"
71
  msgstr ""
72
 
73
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:3
@@ -90,15 +112,6 @@ msgstr ""
90
  msgid "Watermark Type"
91
  msgstr ""
92
 
93
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:16
94
- msgid "Image"
95
- msgstr ""
96
-
97
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:17
98
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form-text.php:3
99
- msgid "Text"
100
- msgstr ""
101
-
102
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:18
103
  msgid "Image + Text"
104
  msgstr ""
@@ -207,11 +220,11 @@ msgstr ""
207
  msgid "Easy Watermark Settings"
208
  msgstr ""
209
 
210
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:12
211
  msgid "Go to Easy Watermark Tool"
212
  msgstr ""
213
 
214
- #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:28
215
  msgid "Save Changes"
216
  msgstr ""
217
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Easy Watermark 0.2.3\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-04-06 23:52+0100\n"
6
+ "PO-Revision-Date: 2013-04-06 23:52+0100\n"
7
  "Last-Translator: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
8
  "Language-Team: Wojtek Szałkiewicz <wojtek@szalkiewicz.pl>\n"
9
  "Language: \n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
 
 
 
 
13
 
14
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:159
15
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:446
16
+ msgid "Watermark successfully added."
17
+ msgstr ""
18
+
19
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:166
20
+ msgid "Invalid mime type."
21
+ msgstr ""
22
+
23
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:169
24
+ msgid "No watermark image selected and no watermark text set."
25
+ msgstr ""
26
+
27
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:171
28
+ msgid "Go to settings page"
29
+ msgstr ""
30
+
31
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:175
32
+ msgid "An error has occurred."
33
+ msgstr ""
34
+
35
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:194
36
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:195
37
+ msgid "Add Watermark"
38
+ msgstr ""
39
+
40
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:209
41
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:225
42
  msgid "Add watermark"
43
  msgstr ""
44
 
45
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:358
46
  #, php-format
47
  msgid "Not supported mime type of %s. Skipping..."
48
  msgstr ""
49
 
50
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:363
51
  #, php-format
52
  msgid "Watermark successfully added to %s"
53
  msgstr ""
54
 
55
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:439
56
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:89
57
  msgid "Easy Watermark"
58
  msgstr ""
59
 
60
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:446
61
+ msgid "Go to Media Library"
 
62
  msgstr ""
63
 
64
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:458
65
+ msgid "Add watermark to all images"
 
66
  msgstr ""
67
 
68
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkPlugin.php:458
69
+ msgid "Be carefull with that option. If some images alredy has watermark, it will be added though."
70
  msgstr ""
71
 
72
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:74
73
+ msgid "General"
 
74
  msgstr ""
75
 
76
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:75
77
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:16
78
+ msgid "Image"
79
  msgstr ""
80
 
81
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:76
82
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:17
83
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form-text.php:3
84
+ msgid "Text"
85
  msgstr ""
86
 
87
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:255
88
+ msgid "Settings"
89
  msgstr ""
90
 
91
+ #: /media/szaleq/Data/easy-watermark/trunk/EasyWatermarkSettings.php:269
92
+ msgid "Donate"
93
  msgstr ""
94
 
95
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:3
112
  msgid "Watermark Type"
113
  msgstr ""
114
 
 
 
 
 
 
 
 
 
 
115
  #: /media/szaleq/Data/easy-watermark/trunk/settings-form-general.php:18
116
  msgid "Image + Text"
117
  msgstr ""
220
  msgid "Easy Watermark Settings"
221
  msgstr ""
222
 
223
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:5
224
  msgid "Go to Easy Watermark Tool"
225
  msgstr ""
226
 
227
+ #: /media/szaleq/Data/easy-watermark/trunk/settings-form.php:21
228
  msgid "Save Changes"
229
  msgstr ""
230
 
plugin.php CHANGED
@@ -142,7 +142,8 @@ class ewPluginCore
142
  * Method run when plugin version stored in WP options
143
  * is lower than current version.
144
  *
 
145
  * @return void
146
  */
147
- public static function upgrade($version){}
148
  }
142
  * Method run when plugin version stored in WP options
143
  * is lower than current version.
144
  *
145
+ * @param string previously installed version
146
  * @return void
147
  */
148
+ protected static function upgrade($version){}
149
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Easy Watermark ===
2
  Contributors: szaleq
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5MCXMBU3ETUDY&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=PLN&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
4
  Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
  Requires at least: 3.3
6
  Tested up to: 3.5.1
7
- Stable tag: 0.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -55,6 +55,9 @@ If you have any other questions, please contact me.
55
 
56
  == Changelog ==
57
 
 
 
 
58
  = 0.2.2 =
59
  * added live text preview on the settings page
60
 
1
  === Easy Watermark ===
2
  Contributors: szaleq
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojtek%40szalkiewicz%2epl&lc=GB&item_name=Easy%20Watermark%20Wordpress%20Plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
4
  Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
5
  Requires at least: 3.3
6
  Tested up to: 3.5.1
7
+ Stable tag: 0.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
55
 
56
  == Changelog ==
57
 
58
+ = 0.2.3 =
59
+ * added bulk action on media library page
60
+
61
  = 0.2.2 =
62
  * added live text preview on the settings page
63
 
settings-form-general.php CHANGED
@@ -5,9 +5,9 @@
5
  </tr>
6
  <tr valign="top" class="auto-add-options" style="display:none;"><th scope="row"><?php _e('Image types', 'easy-watermark'); ?></th>
7
  <td>
8
- <label for="image-type-jpg"><input id="image-type-jpg" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="jpeg" <?php checked('1', in_array('jpeg', $image_types)); ?> /> jpg/jpeg</label><br/></fieldset>
9
- <label for="image-type-png"><input id="image-type-png" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="png" <?php checked('1', in_array('png', $image_types)); ?> /> png</label><br/>
10
- <label for="image-type-gif"><input id="image-type-gif" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="gif" <?php checked('1', in_array('gif', $image_types)); ?> /> gif</label><p class="description"><?php _e('Select image types which should be watermarked', 'easy-watermark'); ?></p></td>
11
  </tr>
12
  <tr><th scope="row">
13
  <?php _e('Watermark Type', 'easy-watermark'); ?>
5
  </tr>
6
  <tr valign="top" class="auto-add-options" style="display:none;"><th scope="row"><?php _e('Image types', 'easy-watermark'); ?></th>
7
  <td>
8
+ <label for="image-type-jpg"><input id="image-type-jpg" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/jpeg" <?php checked('1', in_array('image/jpeg', $image_types)); ?> /> jpg/jpeg</label><br/></fieldset>
9
+ <label for="image-type-png"><input id="image-type-png" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/png" <?php checked('1', in_array('image/png', $image_types)); ?> /> png</label><br/>
10
+ <label for="image-type-gif"><input id="image-type-gif" type="checkbox" name="easy-watermark-settings-general[image_types][]" value="image/gif" <?php checked('1', in_array('image/gif', $image_types)); ?> /> gif</label><p class="description"><?php _e('Select image types which should be watermarked', 'easy-watermark'); ?></p></td>
11
  </tr>
12
  <tr><th scope="row">
13
  <?php _e('Watermark Type', 'easy-watermark'); ?>
settings-form.php CHANGED
@@ -1,20 +1,13 @@
1
  <div class="wrap easy-watermark">
2
  <h2><?php _e('Easy Watermark Settings', 'easy-watermark'); ?></h2>
3
- <div id="donation-link">
4
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
5
- <input type="hidden" name="cmd" value="_s-xclick">
6
- <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA8xQGlvi8n1Z+gGML2vv7D6Yu7SDp5D9tEtuJbKkzhj4QFu2Pj/svKml7I2KqqtQ3fDt1EBbkMnpJKCo0REZvm1d8HHdIaYLKYb/tAFB+07yNHpijY6yh+UHHf6L3/bQDm0lpO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p98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTEzMDQwMzE5MTg1M1owIwYJKoZIhvcNAQkEMRYEFDKku21WwSSpmTt3G1X/QPEw2JWIMA0GCSqGSIb3DQEBAQUABIGALNEoboh/1wsUWg5rX0IxqZrhuFOzeskmQUneuuPReMy7x6QJ6gBMeN4NY+c2ZIOkDwc2ZfuaEmrt56SKqDGakVqubcTLaXzPOfkFTN2V+yvsnur13vXND+BzeIiTiWtiGP47CupCHSRZoSMLP0YQloDFmSx0hpala2E/9Q09oZk=-----END PKCS7-----
7
- ">
8
- <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
9
- <img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
10
- </form>
11
- </div><!-- #donation-link -->
12
  <a href="<?php echo admin_url('/upload.php?page=easy-watermark'); ?>"><?php _e('Go to Easy Watermark Tool', 'easy-watermark'); ?></a>
13
  <h3 class="nav-tab-wrapper">
14
  <?php
15
  foreach ( $this->tabs as $name => $caption ) {
16
  $active = $current_tab == $name ? 'nav-tab-active' : '';
17
- echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin->getSlug() . '-settings&tab=' . $name . '">' . __($caption, 'easy-watermark') . '</a>';
18
  }
19
  ?></h3>
20
  <form method="post" action="options.php" id="easy-watermark-settings-form">
1
  <div class="wrap easy-watermark">
2
  <h2><?php _e('Easy Watermark Settings', 'easy-watermark'); ?></h2>
3
+ <?php require_once dirname(__FILE__) . '/donation.php';
4
+ ewDonation::showButton(); ?>
 
 
 
 
 
 
 
5
  <a href="<?php echo admin_url('/upload.php?page=easy-watermark'); ?>"><?php _e('Go to Easy Watermark Tool', 'easy-watermark'); ?></a>
6
  <h3 class="nav-tab-wrapper">
7
  <?php
8
  foreach ( $this->tabs as $name => $caption ) {
9
  $active = $current_tab == $name ? 'nav-tab-active' : '';
10
+ echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->plugin->getSlug() . '-settings&tab=' . $name . '">' . $caption . '</a>';
11
  }
12
  ?></h3>
13
  <form method="post" action="options.php" id="easy-watermark-settings-form">