Version Description
- Fix: Determine AJAX frontend or backend request
- Tweak: Remove Polish and Russian translations, in favor of GlotPress
Download this release
Release Info
Developer | dfactory |
Plugin | Image Watermark |
Version | 1.5.5 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.5.5
- image-watermark.php +34 -15
- includes/class-settings.php +1 -1
- readme.txt +7 -12
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.5.
|
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-
|
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 |
|
@@ -32,7 +32,7 @@ define( 'IMAGE_WATERMARK_PATH', plugin_dir_path( __FILE__ ) );
|
|
32 |
* Image Watermark class.
|
33 |
*
|
34 |
* @class Image_Watermark
|
35 |
-
* @version 1.5.
|
36 |
*/
|
37 |
final class Image_Watermark {
|
38 |
|
@@ -76,7 +76,7 @@ final class Image_Watermark {
|
|
76 |
'forlogged' => 0,
|
77 |
),
|
78 |
),
|
79 |
-
'version' => '1.5.
|
80 |
);
|
81 |
public $options = array();
|
82 |
|
@@ -280,21 +280,40 @@ final class Image_Watermark {
|
|
280 |
public function handle_upload_files( $file ) {
|
281 |
// is extension available?
|
282 |
if ( $this->extension ) {
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
-
|
|
|
289 |
if ( $this->options['watermark_image']['plugin_off'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
|
290 |
add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
|
291 |
-
}
|
|
|
292 |
} else {
|
293 |
-
|
294 |
-
// frontend
|
295 |
-
$this->is_admin = false;
|
296 |
-
|
297 |
-
// apply watermark if frontend is active and watermark image is set
|
298 |
if ( $this->options['watermark_image']['frontend_active'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
|
299 |
add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
|
300 |
}
|
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.5
|
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-2016, Digital Factory - info@digitalfactory.pl
|
16 |
|
17 |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
18 |
|
32 |
* Image Watermark class.
|
33 |
*
|
34 |
* @class Image_Watermark
|
35 |
+
* @version 1.5.5
|
36 |
*/
|
37 |
final class Image_Watermark {
|
38 |
|
76 |
'forlogged' => 0,
|
77 |
),
|
78 |
),
|
79 |
+
'version' => '1.5.5'
|
80 |
);
|
81 |
public $options = array();
|
82 |
|
280 |
public function handle_upload_files( $file ) {
|
281 |
// is extension available?
|
282 |
if ( $this->extension ) {
|
283 |
+
|
284 |
+
// determine ajax frontend or backend request
|
285 |
+
$script_filename = isset( $_SERVER['SCRIPT_FILENAME'] ) ? $_SERVER['SCRIPT_FILENAME'] : '';
|
286 |
+
|
287 |
+
// try to figure out if frontend AJAX request... if we are DOING_AJAX; let's look closer
|
288 |
+
if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
289 |
+
// from wp-includes/functions.php, wp_get_referer() function.
|
290 |
+
// required to fix: https://core.trac.wordpress.org/ticket/25294
|
291 |
+
$ref = '';
|
292 |
+
if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
|
293 |
+
$ref = wp_unslash( $_REQUEST['_wp_http_referer'] );
|
294 |
+
elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) )
|
295 |
+
$ref = wp_unslash( $_SERVER['HTTP_REFERER'] );
|
296 |
+
|
297 |
+
// if referer does not contain admin URL and we are using the admin-ajax.php endpoint, this is likely a frontend AJAX request
|
298 |
+
if ( ( ( strpos( $ref, admin_url() ) === false ) && ( basename( $script_filename ) === 'admin-ajax.php' ) ) )
|
299 |
+
$this->is_admin = false;
|
300 |
+
else
|
301 |
+
$this->is_admin = true;
|
302 |
+
// not an AJAX request, simple here
|
303 |
+
} else {
|
304 |
+
if ( is_admin() )
|
305 |
+
$this->is_admin = true;
|
306 |
+
else
|
307 |
+
$this->is_admin = false;
|
308 |
+
}
|
309 |
|
310 |
+
// admin
|
311 |
+
if ( $this->is_admin === true ) {
|
312 |
if ( $this->options['watermark_image']['plugin_off'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
|
313 |
add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
|
314 |
+
}
|
315 |
+
// frontend
|
316 |
} else {
|
|
|
|
|
|
|
|
|
|
|
317 |
if ( $this->options['watermark_image']['frontend_active'] == 1 && $this->options['watermark_image']['url'] != 0 && in_array( $file['type'], $this->allowed_mime_types ) ) {
|
318 |
add_filter( 'wp_generate_attachment_metadata', array( $this, 'apply_watermark' ), 10, 2 );
|
319 |
}
|
includes/class-settings.php
CHANGED
@@ -120,7 +120,7 @@ class Image_Watermark_Settings {
|
|
120 |
__( '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>
|
121 |
</p>
|
122 |
<hr />
|
123 |
-
<p class="df-link inner">' . __( 'Created by', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . plugins_url( '
|
124 |
</div>
|
125 |
</div>
|
126 |
<form action="options.php" method="post">';
|
120 |
__( '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>
|
121 |
</p>
|
122 |
<hr />
|
123 |
+
<p class="df-link inner">' . __( 'Created by', 'image-watermark' ) . ' <a href="http://www.dfactory.eu/?utm_source=image-watermark-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="' . plugins_url( '../images/logo-dfactory.png', __FILE__ ) . '" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
|
124 |
</div>
|
125 |
</div>
|
126 |
<form action="options.php" method="post">';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.5.1
|
7 |
-
Stable tag: 1.5.
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -35,15 +35,6 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
|
|
35 |
* Disable image protection for logged-in users
|
36 |
* .pot file for translations included
|
37 |
|
38 |
-
= Translations: =
|
39 |
-
|
40 |
-
* Arabic - by Hassan Hisham
|
41 |
-
* Chinese - by [xiaoyaole](http://www.luoxiao123.cn/)
|
42 |
-
* German - by Matthias Siebler
|
43 |
-
* Hungarian - by Meszaros Tamas
|
44 |
-
* Polish - by Bartosz Arendt
|
45 |
-
* Russian - by [Sly](http://wpguru.ru)
|
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 +53,10 @@ No questions yet.
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
65 |
= 1.5.4 =
|
66 |
* Fix: Use of undefined constant DOING_AJAX
|
67 |
|
@@ -157,5 +152,5 @@ Initial release
|
|
157 |
|
158 |
== Upgrade Notice ==
|
159 |
|
160 |
-
= 1.5.
|
161 |
-
* Fix:
|
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.5.1
|
7 |
+
Stable tag: 1.5.5
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
35 |
* Disable image protection for logged-in users
|
36 |
* .pot file for translations included
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
== Installation ==
|
39 |
|
40 |
1. Install Image Watermark either via the WordPress.org plugin directory, or by uploading the files to your server
|
53 |
|
54 |
== Changelog ==
|
55 |
|
56 |
+
= 1.5.5 =
|
57 |
+
* Fix: Determine AJAX frontend or backend request
|
58 |
+
* Tweak: Remove Polish and Russian translations, in favor of GlotPress
|
59 |
+
|
60 |
= 1.5.4 =
|
61 |
* Fix: Use of undefined constant DOING_AJAX
|
62 |
|
152 |
|
153 |
== Upgrade Notice ==
|
154 |
|
155 |
+
= 1.5.5 =
|
156 |
+
* Fix: Determine AJAX frontend or backend request
|