Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wpalani committed Nov 8, 2024
1 parent 31198a1 commit b8d9bd0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
9 changes: 7 additions & 2 deletions includes/AdminBarSiteStatusBadge.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class AdminBarSiteStatusBadge {

/**
* Constructor.
*
* @param Container $container Container.
*/
public function __construct( Container $container ) {
// Bail if WooCommerce is active.
Expand Down Expand Up @@ -92,7 +94,7 @@ private function site_status_badge_class( $is_coming_soon ): string {
* Output CSS for site status badge.
*/
public function site_status_badge_styles(): void {
if( is_admin_bar_showing() ) {
if ( is_admin_bar_showing() ) {
?>
<style>
#wpadminbar .quicklinks #wp-admin-bar-nfd-site-visibility-badge a.ab-item {
Expand Down Expand Up @@ -128,12 +130,15 @@ public function site_status_badge_styles(): void {
display: none;
}
</style>
<?php
<?php
}
}

/**
* Set 10 minutes transient timer for site status badge when coming soon is turned off.
*
* @param bool $old_value The old option value.
* @param bool $new_value The new option value.
*/
public static function site_status_badge_timer( $old_value, $new_value ): void {
$value = wp_validate_boolean( $new_value );
Expand Down
14 changes: 7 additions & 7 deletions includes/WooCommerceOptionsSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,26 @@ public function __construct() {
* @param string $option_name The option name.
*/
public static function sync_options( $old_value, $new_value, $option_name ): void {
// Prevent infinite loops
// Prevent infinite loops.
if ( self::$syncing ) {
return;
}

self::$syncing = true;

if ( $option_name === 'nfd_coming_soon' ) {
// Update WooCommerce options to match nfd_coming_soon
if ( 'nfd_coming_soon' === $option_name ) {
// Update WooCommerce options to match nfd_coming_soon.
self::sync_woocommerce_coming_soon_option( $new_value );
self::sync_nfd_woocommerce_pages_only_option();
}

if ( $option_name === 'woocommerce_coming_soon' ) {
// Update brand plugin's option to match woocommerce_coming_soon
if ( 'woocommerce_coming_soon' === $option_name ) {
// Update brand plugin's option to match woocommerce_coming_soon.
self::sync_nfd_coming_soon_option( $new_value, $option_name );
}

if ( $option_name === 'woocommerce_store_pages_only' ) {
// Update brand plugin's option to match woocommerce_store_pages_only
if ( 'woocommerce_store_pages_only' === $option_name ) {
// Update brand plugin's option to match woocommerce_store_pages_only.
self::sync_nfd_coming_soon_option( $new_value, $option_name );
}

Expand Down
4 changes: 2 additions & 2 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ function isComingSoonActive(): bool {
* Check if WooCommerce is activated
*/
function isWoocommerceActive(): bool {
return class_exists('woocommerce');
}
return class_exists( 'woocommerce' );
}
4 changes: 1 addition & 3 deletions tests/cypress/integration/coming-soon-woo.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// disable eslint for this file
/* eslint-disable */
// <reference types="Cypress" />

describe( 'Coming Soon with WooCommerce', function () {

before( () => {
// Set coming soon option to true to start with
cy.exec( `npx wp-env run cli wp option update mm_coming_soon true` );
Expand Down

0 comments on commit b8d9bd0

Please sign in to comment.