Skip to content

Commit

Permalink
Merge branch 'branch-1.9.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
Screenfeed committed Oct 8, 2019
2 parents 37ed22f + 2836608 commit 4d0ae3c
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 18 deletions.
2 changes: 1 addition & 1 deletion classes/Traits/InstanceGetterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* This is temporary, until we get a DI container.
*
* @since 1.9
* @since 1.9.4 Renamed FakeSingletonTrait into InstanceGetterTrait.
* @since 1.9.4 Renamed into InstanceGetterTrait.
* @author Grégory Viguier
*/
trait InstanceGetterTrait {
Expand Down
4 changes: 2 additions & 2 deletions imagify.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Imagify
* Plugin URI: https://wordpress.org/plugins/imagify/
* Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
* Version: 1.9.6
* Version: 1.9.7
* Requires PHP: 5.4
* Author: WP Media
* Author URI: https://wp-media.me/
Expand All @@ -20,7 +20,7 @@
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );

// Imagify defines.
define( 'IMAGIFY_VERSION', '1.9.6' );
define( 'IMAGIFY_VERSION', '1.9.7' );
define( 'IMAGIFY_SLUG', 'imagify' );
define( 'IMAGIFY_FILE', __FILE__ );
define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
Expand Down
15 changes: 10 additions & 5 deletions inc/3rd-party/wp-rocket/classes/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Main {
* @author Grégory Viguier
*/
public function init() {
add_action( 'imagify_assets_enqueued', [ $this, 'dequeue_sweetalert' ] );
add_filter( 'imagify_cdn_source', [ $this, 'set_cdn_source' ] );
add_action( 'admin_init', [ $this, 'dequeue_sweetalert' ] );
add_filter( 'imagify_cdn_source', [ $this, 'set_cdn_source' ] );
}


Expand All @@ -30,22 +30,27 @@ public function init() {
/** ----------------------------------------------------------------------------------------- */

/**
* Don't load Imagify CSS & JS files on WP Rocket options screen to avoid conflict with older version of SweetAlert.
* Remove all Imagify admin notices + CSS & JS files on WP Rocket (< 3.0) options screen to avoid conflict with older version of SweetAlert.
*
* @since 1.9.3
* @access public
* @author Grégory Viguier
*/
public function dequeue_sweetalert() {
if ( ! defined( 'WP_ROCKET_PLUGIN_SLUG' ) ) {
if ( ! defined( 'WP_ROCKET_VERSION' ) || ! defined( 'WP_ROCKET_PLUGIN_SLUG' ) ) {
return;
}

if ( version_compare( WP_ROCKET_VERSION, '3.0' ) >= 0 ) {
return;
}

if ( ! imagify_is_screen( 'settings_page_' . WP_ROCKET_PLUGIN_SLUG ) && ! imagify_is_screen( 'settings_page_' . WP_ROCKET_PLUGIN_SLUG . '-network' ) ) {
return;
}

\Imagify_Assets::get_instance()->dequeue_script( array( 'sweetalert-core', 'sweetalert', 'notices' ) );
remove_action( 'all_admin_notices', [ \Imagify_Notices::get_instance(), 'render_notices' ] );
remove_action( 'admin_enqueue_scripts', [ \Imagify_Assets::get_instance(), 'enqueue_styles_and_scripts' ], IMAGIFY_INT_MAX );
}

/**
Expand Down
7 changes: 7 additions & 0 deletions inc/classes/class-imagify-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ public function include_files() {
require_once $this->plugin_path . 'vendor/autoload.php';
}

$instance_getter_path = $this->plugin_path . 'classes/Traits/InstanceGetterTrait.php';

if ( file_exists( $instance_getter_path . '.suspected' ) && ! file_exists( $instance_getter_path ) ) {
// Trolling greedy antiviruses.
require_once $instance_getter_path . '.suspected';
}

$inc_path = $this->plugin_path . 'inc/';

require_once $inc_path . 'deprecated/deprecated.php';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "imagify",
"description": "Imagify Image Optimizer. Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth.",
"version": "1.9.6",
"version": "1.9.7",
"homepage": "https://wordpress.org/plugins/imagify/",
"license": "GPL-2.0",
"private": true,
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: wp_media, GregLone
Tags: optimize images, images, optimize, performance, webp
Requires at least: 4.0.0
Tested up to: 5.2.2
Stable tag: 1.9.6
Stable tag: 1.9.7

Optimize images in one click: reduce image file sizes, convert WebP, keep your images beautiful… and boost your loading time and your SEO!

Expand Down Expand Up @@ -153,6 +153,11 @@ When the plugin is disabled, your existing images remain optimized. Backups of t
4. Other Media Page

== Changelog ==
= 1.9.7 - 2019/10/08 =
* Improvement: prevent greedy antiviruses from crashing the website by renaming our highly dangerous php file with a ".suspected" suffix.
* Improvement: on the settings page, display the "Save & Go to Bulk Optimizer" button only if the user has the ability to bulk optimize.
* Fix: display the "Welcome" banner correctly when it is shown on the WP Rocket’s settings page.

= 1.9.6 - 2019/07/22 =
* Improvement: now images that are "already optimized" can also get webp versions.
* Fix: progress bar height in the admin bar for Chrome and Safari.
Expand Down
20 changes: 12 additions & 8 deletions views/part-settings-footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
submit_button();

if ( Imagify_Requirements::is_api_key_valid() ) {
// Submit and go to bulk page.
submit_button(
esc_html__( 'Save & Go to Bulk Optimizer', 'imagify' ),
'secondary imagify-button-secondary', // Type/classes.
'submit-goto-bulk', // Name (id).
true, // Wrap.
array() // Other attributes.
);
$user_can = imagify_get_context( 'wp' )->current_user_can( 'bulk-optimize' ) || imagify_get_context( 'custom-folders' )->current_user_can( 'bulk-optimize' );

if ( $user_can ) {
// Submit and go to bulk page.
submit_button(
esc_html__( 'Save & Go to Bulk Optimizer', 'imagify' ),
'secondary imagify-button-secondary', // Type/classes.
'submit-goto-bulk', // Name (id).
true, // Wrap.
array() // Other attributes.
);
}
}
?>
</div>
Expand Down

0 comments on commit 4d0ae3c

Please sign in to comment.