Skip to content

Commit c59e9c3

Browse files
committed
rename optimizer class
1 parent fd3c2be commit c59e9c3

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
use function ImageOptimizerPro\Utils\is_local_site;
1515

1616
/**
17-
* Class ImageOptimizer
17+
* Class Optimizer
1818
*/
19-
class ImageOptimizer {
19+
class Optimizer {
2020
/**
2121
* Singleton.
2222
*
@@ -55,8 +55,8 @@ class ImageOptimizer {
5555
* @return object
5656
*/
5757
public static function factory() {
58-
if ( ! is_a( self::$instance, 'ImageOptimizer' ) ) {
59-
self::$instance = new ImageOptimizer();
58+
if ( ! is_a( self::$instance, 'Optimizer' ) ) {
59+
self::$instance = new Optimizer();
6060
self::$instance->setup();
6161
}
6262

@@ -102,6 +102,11 @@ private function setup() {
102102
return;
103103
}
104104

105+
// Skip integration for Block Editor requests.
106+
if ( isset( $_SERVER['HTTP_X_WP_NONCE'] ) && wp_is_json_request() ) {
107+
return true;
108+
}
109+
105110
// skip photonized urls when image optimizer active
106111
add_filter( 'jetpack_photon_skip_for_url', '__return_true' );
107112
add_filter( 'wp_resource_hints', [ $this, 'add_dns_prefetch' ], 10, 2 );
@@ -1641,7 +1646,7 @@ public function maybe_delayed_js_skip( $is_delay_skipped, $script ) {
16411646
* @since 1.0
16421647
*/
16431648
public function start_buffer() {
1644-
ob_start( [ '\ImageOptimizerPro\ImageOptimizer', 'end_buffering' ] );
1649+
ob_start( [ '\ImageOptimizerPro\Optimizer', 'end_buffering' ] );
16451650
}
16461651

16471652

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function ( $class ) {
109109
}
110110

111111
Admin\Dashboard::factory();
112-
ImageOptimizer::factory();
112+
Optimizer::factory();
113113
\ImageOptimizerPro\Core\setup();
114114

115115
register_activation_hook( __FILE__, '\ImageOptimizerPro\Core\activate' );

0 commit comments

Comments
 (0)