Collaboration
2 weeks ago
Apps.php
2 weeks ago
Collection.php
1 month ago
Comments.php
2 months ago
DynamicContent.php
1 month ago
ExportImport.php
2 weeks ago
Form.php
2 weeks ago
Media.php
2 weeks ago
Page.php
2 weeks ago
PageSettings.php
2 weeks ago
RBAC.php
2 weeks ago
Symbol.php
2 weeks ago
Taxonomy.php
2 months ago
TemplateExportImport.php
2 months ago
UserData.php
2 weeks ago
Users.php
2 months ago
Walkthrough.php
2 months ago
WordpressData.php
2 months ago
WpAdmin.php
2 months ago
Walkthrough.php
55 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Walkthrough or onboarding |
| 4 | * |
| 5 | * @package kirki |
| 6 | */ |
| 7 | |
| 8 | namespace Kirki\Ajax; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; // Exit if accessed directly. |
| 12 | } |
| 13 | use Kirki\HelperFunctions; |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * Walkthrough API Class |
| 18 | */ |
| 19 | class Walkthrough { |
| 20 | |
| 21 | /** |
| 22 | * Get walkthrough state |
| 23 | * |
| 24 | * @return void wp_send_json. |
| 25 | */ |
| 26 | public static function get_walkthrough_state() { |
| 27 | $user_id = get_current_user_id(); |
| 28 | $user_meta = get_user_meta( $user_id, KIRKI_USER_WALKTHROUGH_SHOWN_META_KEY, true ); |
| 29 | |
| 30 | if ( $user_meta ) { |
| 31 | wp_send_json( true ); |
| 32 | } else { |
| 33 | wp_send_json( false ); |
| 34 | } |
| 35 | |
| 36 | die(); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Set walkthrough state |
| 41 | * |
| 42 | * @return void wp_send_json. |
| 43 | */ |
| 44 | public static function set_walkthrough_state() { |
| 45 | //phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 46 | $walkthrough_state = HelperFunctions::sanitize_text( isset( $_POST['walkthrough-shown-state'] ) ? $_POST['walkthrough-shown-state'] : null ); |
| 47 | $user_id = get_current_user_id(); |
| 48 | update_user_meta( $user_id, KIRKI_USER_WALKTHROUGH_SHOWN_META_KEY, $walkthrough_state ); |
| 49 | |
| 50 | wp_send_json( true ); |
| 51 | |
| 52 | die(); |
| 53 | } |
| 54 | } |
| 55 |