Skip to content

Commit

Permalink
Merge branch 'release/1.0.11' into legacy_master
Browse files Browse the repository at this point in the history
  • Loading branch information
BracketSpaceWorker committed Mar 25, 2021
2 parents 8b6fcb0 + 803a56f commit fa004b7
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/legacy-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
options: '--exclude-from=".build-excludes"'
src: '.'
dest: 'build'
- name: Fix permissiong
- name: Fix permissions
run: sudo chown -R $USER:$USER ./
- name: Upload artifact
uses: actions/upload-artifact@v1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/legacy-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
options: '--exclude-from=".build-excludes"'
src: '.'
dest: 'build'
- name: Fix permissions
run: sudo chown -R $USER:$USER ./
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
Expand Down
9 changes: 0 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion easy-watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author URI: https://bracketspace.com/
* Text Domain: easy-watermark
* Domain Path: /languages
* Version: 1.0.10
* Version: 1.0.11
* License: GPLv3 or later
*
* @package easy-watermark
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=wojte
Tags: watermark, image, picture, photo, media, gallery, signature, transparent, upload, admin
Requires at least: 4.6
Requires PHP: 5.6
Tested up to: 5.6
Stable tag: 1.0.10
Tested up to: 5.7
Stable tag: 1.0.11
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: easy-watermark
Expand Down Expand Up @@ -118,6 +118,10 @@ All available placeholders are listed in a box titled 'Placeholders' displayed w

== Changelog ==

= 1.0.11 =
* [Fixed] Watermark preview url fixed to work with non-standard WordPress installations
* [Fixed] Error in Cache Busting feature.

= 1.0.10 =
* [Added] Role existence checks during plugin activation.
* [Added] Filter to prevent applying certain watermark.
Expand Down
2 changes: 1 addition & 1 deletion src/classes/AttachmentProcessor/AttachmentProcessorGD.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ private function apply_image_watermark( $watermark ) {
$watermark_size['width'] = $new_width;
$watermark_size['height'] = $new_height;

unset( $tmp_image, $new_width, $nwe_height );
unset( $tmp_image, $new_width, $new_height );
}

// Compute watermark offset.
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Dashboard/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function get_page_hook() {
}

/**
* Displats options page content
* Displays options page content
*
* @return void
*/
Expand Down
20 changes: 18 additions & 2 deletions src/classes/Features/CacheBusting.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ public function register_settings( $section ) {

}

/**
* Check if this feature is active
*
* @return boolean
*/
private function is_active() {
/**
* The SwitchField object should be always available by the time this method
* is used. Hovewer there has been an issue reported that the
* `wp_get_attachment_image_src` method caused a fatal error because
* $this->switch was null. Just for safety, check if the SwitchField object
* is created, if not return `true` - the default value.
*/
return $this->switch ? true === $this->switch->get_value() : true;
}

/**
* Adds attachment version to the URL
*
Expand Down Expand Up @@ -109,7 +125,7 @@ public function wp_get_attachment_image_src( $image, $attachment_id, $size, $ico
return false;
}

if ( true === $this->switch->get_value() ) {
if ( $this->is_active() ) {
if ( is_array( $image ) && ! empty( $image ) && is_string( $image[0] ) ) {
$image[0] = $this->add_attachment_version( $image[0], $attachment_id );
} elseif ( is_string( $image ) ) {
Expand All @@ -135,7 +151,7 @@ public function wp_get_attachment_image_src( $image, $attachment_id, $size, $ico
*/
public function wp_calculate_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ) {

if ( true === $this->switch->get_value() ) {
if ( $this->is_active() ) {
foreach ( $sources as &$source ) {
$source['url'] = $this->add_attachment_version( $source['url'], $attachment_id );
}
Expand Down
2 changes: 1 addition & 1 deletion src/classes/Features/WatermarkPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function get_url( $type, $watermark_id, $size = null ) {
}
}

return add_query_arg( $args, site_url( $base ) );
return add_query_arg( $args, home_url( $base ) );
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/classes/Placeholders/Abstracts/Placeholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public function reset() {

if ( $this->is_resetable() ) {
$this->value = null;
$this->data = [];
}

}
Expand Down

0 comments on commit fa004b7

Please sign in to comment.