Skip to content

Commit

Permalink
Add logic to conditionally hide (or show) rapidload on CSS settings p…
Browse files Browse the repository at this point in the history
…age (based on the service availability json).
  • Loading branch information
futtta committed Jun 30, 2024
1 parent 1e85428 commit 1592dd1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion classes/autoptimizeConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,19 @@ public function show_config()
?>
</label></td>
</tr>
<?php if ( false === autoptimizeUtils::is_plugin_active( 'unusedcss/unusedcss.php' ) ) { ?>
<?php
$_availabilities = autoptimizeOptionWrapper::get_option( 'autoptimize_service_availablity' );
if ( empty( $_availabilities ) || ! is_array( $_availabilities ) || ! array_key_exists( 'rapidload', $_availabilities ) || ! array_key_exists( 'status', $_availabilities['rapidload'] ) ) {
$rapidload_true = true;
} else if ( $_availabilities['rapidload']['status'] === 'up' ) {
$rapidload_true = true;
} else if ( $_availabilities['rapidload']['status'] !== 'up' ) {
$rapidload_true = false;
} else {
$rapidload_true = false;
}
?>
<?php if ( $rapidload_true && false === autoptimizeUtils::is_plugin_active( 'unusedcss/unusedcss.php' ) ) { ?>
<tr valign="top">
<th scope="row"><?php esc_html_e( 'Remove Unused CSS?', 'autoptimize' ); ?></th>
<?php
Expand Down

0 comments on commit 1592dd1

Please sign in to comment.