Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq1988 committed Jul 18, 2024
1 parent 2f16541 commit 33ad415
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions includes/Admin/Litespeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function handle_enable_disable() {
return;
}

if ( isset( $_GET['_wpnonce'] ) && ! wp_verify_nonce( $_GET['_wpnonce'], 'flywp-litespeed-nonce' ) ) {
if ( isset( $_GET['_wpnonce'] ) && ! wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), 'flywp-litespeed-nonce' ) ) {

Check failure on line 50 in includes/Admin/Litespeed.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Detected usage of a non-sanitized input variable: $_GET['_wpnonce']
return;
}

Expand All @@ -56,13 +56,13 @@ public function handle_enable_disable() {
}

$valid_types = [ 'enable', 'disable' ];
$type = isset( $_GET['type'] ) && in_array( $_GET['type'], $valid_types ) ? $_GET['type'] : 'enable';
$type = isset( $_GET['type'] ) && in_array( wp_unslash( $_GET['type'] ), $valid_types, true ) ? wp_unslash( $_GET['type'] ) : 'enable';

Check failure on line 59 in includes/Admin/Litespeed.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Detected usage of a non-sanitized input variable: $_GET['type']
$status = $type === 'enable' ? '1' : '0';
$notice = $type === 'enable' ? 'lscache-enabled' : 'lscache-disabled';

update_option( FlyWPLiteSpeed::OPTION_KEY, $status );

flywp()->flyapi->cache_toggle( $type, 'litespeed' );
flywp()->flyapi->cache_toggle( $type, 'lscache' );

wp_safe_redirect( admin_url( 'index.php?page=flywp&fly-notice=' . $notice ) );
exit;
Expand Down
4 changes: 1 addition & 3 deletions views/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

<div class="fw-flex -fw-mb-px fw-gap-2">
<?php foreach ( $tabs as $key => $label ) { ?>
<a href="<?php echo esc_url( add_query_arg( [
'tab' => $key,
], $this->page_url() ) ); ?>" class="fw-block fw-px-4 fw-py-3 fw-text-sm -m fw-text-gray-800 fw-no-underline fw-outline-none focus:fw-outline-none <?php echo $key === $active_tab ? 'fw-border-b-2 fw-border-indigo-500 fw-font-semibold' : ''; ?>"><?php echo $label; ?></a>
<a href="<?php echo esc_url( add_query_arg( ['tab' => $key ], $this->page_url() ) ); ?>" class="fw-block fw-px-4 fw-py-3 fw-text-sm -m fw-text-gray-800 fw-no-underline fw-outline-none focus:fw-outline-none <?php echo $key === $active_tab ? 'fw-border-b-2 fw-border-indigo-500 fw-font-semibold' : ''; ?>"><?php echo $label; ?></a>

Check failure on line 21 in views/admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Missing space after array opener.
<?php } ?>
</div>
</div>
Expand Down

0 comments on commit 33ad415

Please sign in to comment.