-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from newfold-labs/enhance/coming-soon-logic
Re-enabled exits and enhance the logic for the coming soon.
- Loading branch information
Showing
10 changed files
with
112 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
namespace NewfoldLabs\WP\Module\Onboarding\Services; | ||
|
||
use NewfoldLabs\WP\Module\Onboarding\Data\Options; | ||
use NewfoldLabs\WP\Module\Onboarding\WP_Admin; | ||
|
||
/** | ||
* Tracks the Status of Onboarding. | ||
*/ | ||
class StatusService { | ||
|
||
/** | ||
* Handle Onboarding started event. | ||
* | ||
* @return void | ||
*/ | ||
public static function handle_started() { | ||
if ( 'started' !== get_option( Options::get_option_name( 'status' ) ) ) { | ||
update_option( Options::get_option_name( 'status' ), 'started' ); | ||
do_action( 'newfold/onboarding/started' ); | ||
} | ||
} | ||
|
||
/** | ||
* Handles Onboarding completed event. | ||
* | ||
* @return void | ||
*/ | ||
public static function handle_completed() { | ||
if ( 'started' === get_option( Options::get_option_name( 'status' ) ) ) { | ||
update_option( Options::get_option_name( 'status' ), 'completed' ); | ||
do_action( 'newfold/onboarding/completed' ); | ||
} | ||
} | ||
|
||
/** | ||
* Begin tracking the Onboarding status in an option. | ||
* | ||
* @return void | ||
*/ | ||
public static function track() { | ||
global $pagenow; | ||
|
||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { | ||
return; | ||
} | ||
|
||
switch ( $pagenow ) { | ||
case 'index.php': | ||
// If the page is not nfd-onboarding. | ||
//phpcs:ignore | ||
if ( ! isset( $_GET['page'] ) || WP_Admin::$slug !== \sanitize_text_field( $_GET['page'] ) ) { | ||
self::handle_completed(); | ||
} | ||
break; | ||
default: | ||
self::handle_completed(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.