Skip to content

Commit 3683101

Browse files
Merge branch 'master' of github.com:wcreateweb/wordpress-plugin into task/format-conversion
2 parents 70c1df1 + 1fe8255 commit 3683101

File tree

9 files changed

+145
-21
lines changed

9 files changed

+145
-21
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- { wp: 60, php: 73 }
2222
- { wp: 63, php: 80 }
2323
- { wp: 67, php: 82 }
24-
- { wp: 67, php: 83 }
24+
- { wp: 68, php: 83 }
2525
steps:
2626
- name: Checkout code
2727
uses: actions/checkout@v4

.vscode/launch.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"name": "Listen for XDebug",
9-
"type": "php",
10-
"request": "launch",
11-
"port": 9003
12-
}
13-
]
14-
}
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Listen for XDebug",
9+
"type": "php",
10+
"request": "launch",
11+
"port": 9003
12+
}
13+
]
14+
}

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: TinyPNG
33
Donate link: https://tinypng.com/
44
Tags: compress images, compression, image size, page speed, performance
55
Requires at least: 4.0
6-
Tested up to: 6.7
7-
Stable tag: 3.5.0
6+
Tested up to: 6.8
7+
Stable tag: 3.5.1
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -127,6 +127,9 @@ A: Yes! After installing the plugin, go to *Media > Bulk Optimization*, and clic
127127
A: You can upgrade to a paid account by adding your *Payment details* on your [account dashboard](https://tinypng.com/dashboard/api). Additional compressions above 500 will then be charged at the end of each month as a one-time fee.
128128

129129
== Changelog ==
130+
= 3.5.1 =
131+
* Will only check local file removal if AS3CF is active
132+
130133
= 3.5.0 =
131134
* Support files uploaded through the WordPress REST API
132135
* Removed notification on WooCommerce incompatibility

src/class-tiny-plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1919
*/
2020
class Tiny_Plugin extends Tiny_WP_Base {
21-
const VERSION = '3.5.0';
21+
const VERSION = '3.5.1';
2222
const MEDIA_COLUMN = self::NAME;
2323
const DATETIME_FORMAT = 'Y-m-d G:i:s';
2424

src/compatibility/as3cf/class-tiny-as3cf.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ public static function is_active() {
5252
}
5353

5454
public static function remove_local_files_setting_enabled() {
55+
if ( ! Tiny_AS3CF::is_active() ) {
56+
return false;
57+
}
5558
$settings = get_option( 'tantan_wordpress_s3' );
59+
if ( ! is_array( $settings ) ) {
60+
return false;
61+
}
5662
return array_key_exists( 'remove-local-file', $settings ) && $settings['remove-local-file'];
5763
}
5864

test/helpers/wordpress.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public function __construct( $vfs ) {
7777
$this->addMethod( 'current_user_can' );
7878
$this->addMethod( 'wp_get_attachment_metadata' );
7979
$this->addMethod( 'is_admin' );
80+
$this->addMethod( 'is_plugin_active' );
8081
$this->defaults();
8182
$this->create_filesystem();
8283
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
3+
require_once dirname(__FILE__) . '/../TinyTestCase.php';
4+
require_once dirname(__FILE__) . '/../../../src/compatibility/as3cf/class-tiny-as3cf.php';
5+
6+
class Tiny_AC3SF_Test extends Tiny_TestCase
7+
{
8+
public function set_up()
9+
{
10+
parent::set_up();
11+
}
12+
13+
/**
14+
* Stub is_plugin_active to return true for the pro plugin
15+
* is_plugin_active will only work in admin area (after admin_init);
16+
*/
17+
public function test_is_active_when_pro_is_enabled()
18+
{
19+
$this->wp->stub(
20+
'is_plugin_active',
21+
function ($plugin_name) {
22+
return $plugin_name === 'amazon-s3-and-cloudfront-pro/amazon-s3-and-cloudfront-pro.php';
23+
}
24+
);
25+
26+
$tiny_settings = new Tiny_Settings();
27+
$tiny_ac3sf = new Tiny_AS3CF($tiny_settings);
28+
29+
$this->assertTrue(Tiny_AS3CF::is_active());
30+
}
31+
32+
public function test_is_active_when_lite_is_enabled()
33+
{
34+
$this->wp->stub(
35+
'is_plugin_active',
36+
function ($plugin_name) {
37+
return $plugin_name === 'amazon-s3-and-cloudfront/wordpress-s3.php';
38+
}
39+
);
40+
41+
42+
$this->assertTrue(Tiny_AS3CF::is_active());
43+
}
44+
45+
public function test_is_not_active()
46+
{
47+
$this->wp->stub(
48+
'is_plugin_active',
49+
function ($plugin_name) {
50+
return false;
51+
}
52+
);
53+
54+
55+
$this->assertFalse(Tiny_AS3CF::is_active());
56+
}
57+
58+
public function test_remove_local_enabled_is_false_when_plugin_inactive()
59+
{
60+
$this->wp->stub(
61+
'is_plugin_active',
62+
function ($plugin_name) {
63+
return false;
64+
}
65+
);
66+
67+
$this->assertFalse(Tiny_AS3CF::remove_local_files_setting_enabled());
68+
}
69+
70+
public function test_remove_local_false_when_option_not_exists()
71+
{
72+
$this->wp->stub(
73+
'is_plugin_active',
74+
function ($plugin_name) {
75+
return true;
76+
}
77+
);
78+
79+
$this->assertFalse(Tiny_AS3CF::remove_local_files_setting_enabled());
80+
}
81+
82+
public function test_remove_local_false_when_option_is_false()
83+
{
84+
$this->wp->stub(
85+
'is_plugin_active',
86+
function ($plugin_name) {
87+
return true;
88+
}
89+
);
90+
91+
$this->wp->addOption('tantan_wordpress_s3', array(
92+
'remove-local-file' => false,
93+
));
94+
95+
$this->assertFalse(Tiny_AS3CF::remove_local_files_setting_enabled());
96+
}
97+
98+
public function test_remove_local_true_when_option_is_true()
99+
{
100+
$this->wp->stub(
101+
'is_plugin_active',
102+
function ($plugin_name) {
103+
return true;
104+
}
105+
);
106+
107+
$this->wp->addOption('tantan_wordpress_s3', array(
108+
'remove-local-file' => true,
109+
));
110+
111+
$this->assertTrue(Tiny_AS3CF::remove_local_files_setting_enabled());
112+
}
113+
}

tiny-compress-images.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: TinyPNG - JPEG, PNG & WebP image compression
44
* Description: Speed up your website. Optimize your JPEG, PNG, and WebP images automatically with TinyPNG.
5-
* Version: 3.5.0
5+
* Version: 3.5.1
66
* Author: TinyPNG
77
* Author URI: https://tinypng.com
88
* Text Domain: tiny-compress-images

0 commit comments

Comments
 (0)