Skip to content

Commit 5302ccc

Browse files
authored
release: v3.12.2
### Bug Fixes - **Optimization Exclusions Fix**: Resolved an issue where some pages were excluded from optimization due to AJAX requests exclusions. ### Enhancements - **Lazyloading Menu Item**: Ensure that turning off lazyloading now disables the lazyloading settings menu item in the plugin dashboard. - **Lazyload Support for Group Blocks**: Added lazyload support for group blocks background for improved performance. - **Cap Offloading Log**: Capped offloading log read lines to 10,000 for better performance and manageability.
2 parents f592992 + 369acaa commit 5302ccc

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
lines changed

assets/src/dashboard/parts/connected/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function convertToCategory( number, scale = 1 ) {
5050
return 30;
5151
} else if ( 30 < normalizedNumber && 90 > normalizedNumber ) {
5252
return 90;
53-
} else if ( 90 > normalizedNumber ) {
53+
} else if ( 90 < normalizedNumber ) {
5454
return 91;
5555
}
5656
}

assets/src/dashboard/parts/connected/settings/Menu.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ const menuItems = [
5555
const SubMenu = ({
5656
children,
5757
tab,
58+
settings,
5859
setTab
5960
}) => {
6061
return (
6162
<ul className="flex flex-col gap-1 m-0 mt-1">
6263
{children.map( item => {
6364
const { value, label } = item;
65+
if ( 'lazyload' === item.value && 'disabled' === settings.lazyload ) {
66+
return;
67+
}
6468
const classes = classnames(
6569
{
6670
'bg-light-blue hover:text-purple-gray': tab === value,
@@ -82,13 +86,16 @@ const SubMenu = ({
8286

8387
const Menu = ({
8488
tab,
89+
settings,
8590
setTab
8691
}) => {
8792
return (
8893
<div className="basis-1/5">
8994
<ul className="grid m-0 gap-1">
9095
{menuItems.map( item => {
9196
const isActive = tab === item.value || ( item.children && item.children.some( child => child.value === tab ) );
97+
98+
9299
const buttonClasses = classnames({ '!text-info': isActive }, 'w-full bg-transparent border-0 flex items-center appearance-none not-italic font-semibold text-base text-purple-gray cursor-pointer hover:text-info py-2' );
93100
return (
94101
<li key={item.value} className='m-0'>
@@ -110,6 +117,7 @@ const Menu = ({
110117
<SubMenu
111118
children={item.children}
112119
tab={tab}
120+
settings={settings}
113121
setTab={setTab}
114122
/>
115123
)}

assets/src/dashboard/parts/connected/settings/Resize.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const Resize = ({
108108

109109
<hr className="my-8 border-grayish-blue"/>
110110

111-
<ToggleControl
111+
{ 'disabled' !== settings.lazyload && ( <> <ToggleControl
112112
label={ optimoleDashboardApp.strings.options_strings.enable_retina_title }
113113
help={ () => <p dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.options_strings.enable_retina_desc } } /> }
114114
checked={ isRetinaEnabled }
@@ -119,9 +119,9 @@ const Resize = ({
119119
}
120120
) }
121121
onChange={ value => updateOption( 'retina_images', value ) }
122-
/>
122+
/> <hr className="my-8 border-grayish-blue"/> </> )
123+
}
123124

124-
<hr className="my-8 border-grayish-blue"/>
125125

126126
<ToggleControl
127127
label={ optimoleDashboardApp.strings.options_strings.enable_limit_dimensions_title }

assets/src/dashboard/parts/connected/settings/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const Settings = ({
8585
<Menu
8686
tab={ tab }
8787
setTab={ setTab }
88+
settings={ settings }
8889
/>
8990

9091
<div className="basis-4/5">

inc/filters.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public static function should_do_page( $contains_flags, $match_flags ) {
2626
}
2727

2828
$check_against = [ $_SERVER['REQUEST_URI'] ];
29-
if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
29+
// This code is designed to handle ajax requests on pages that are excluded.
30+
// For ajax requests, the referer is set to the page URL and they use a POST method.
31+
// If an ajax request uses a GET method, it can be managed using the available exclusion rules.
32+
if ( isset( $_SERVER['HTTP_REFERER'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
3033
$check_against[] = $_SERVER['HTTP_REFERER'];
3134
}
3235
foreach ( $check_against as $check ) {

inc/lazyload_replacer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public static function get_background_lazyload_selectors() {
119119
'.elementor-section[data-settings*="background_background"]',
120120
'.elementor-section > .elementor-background-overlay',
121121
'[class*="wp-block-cover"][style*="background-image"]',
122+
'[class*="wp-block-group"][style*="background-image"]',
122123
];
123124

124125
$saved_watchers = self::instance()->settings->get_watchers();

inc/logger.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private function tailCustom( $filepath, $lines = 1, $adaptive = true, $separator
184184

185185
$buffer = min( $buffer * 2, 4096 );
186186
}
187-
187+
$pos = -1;
188188
if ( ! empty( $separator ) && $separator_found ) {
189189
$pos = strrpos( $output, $separator );
190190
if ( $pos !== false ) {
@@ -197,7 +197,10 @@ private function tailCustom( $filepath, $lines = 1, $adaptive = true, $separator
197197
if ( empty( $separator ) || ! $separator_found ) {
198198
$output = implode( "\n", array_slice( $output_lines, -$lines ) ); // fetch last n lines
199199
} else {
200-
$output = implode( "\n", array_slice( $output_lines, 0, $lines ) ); // fetch from separator
200+
// Calculate the start position for slicing
201+
$start_pos = max( $pos + 1, count( $output_lines ) - $lines );
202+
203+
$output = implode( "\n", array_slice( $output_lines, $start_pos, $lines ) ); // fetch from separator
201204
}
202205

203206
fclose( $f );

0 commit comments

Comments
 (0)