array( 'success', __( 'All set. Nodebook is ready for your business; you can change any of this under Settings and Modules.', 'nodebook' ) ), ); } public static function save() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You are not allowed to do this.', 'nodebook' ), 403 ); } check_admin_referer( 'nodebook_welcome' ); // phpcs:disable WordPress.Security.NonceVerification.Missing -- verified just above. $key = static function ( $k ) { return isset( $_POST[ $k ] ) ? sanitize_key( wp_unslash( $_POST[ $k ] ) ) : ''; }; $features = array(); foreach ( array( 'deals', 'gatherings', 'growth', 'abilities' ) as $f ) { if ( isset( $_POST['f_seen'][ $f ] ) ) { $features[ $f ] = ! empty( $_POST['f'][ $f ] ); } } $in = array( 'niche' => $key( 'niche' ), 'team_size' => $key( 'team_size' ), 'woo_capture' => $key( 'woo_capture' ), 'personality' => $key( 'personality' ), 'morning' => ! empty( $_POST['morning'] ), 'fields' => ! empty( $_POST['fields'] ), 'features' => $features, ); // phpcs:enable Nodebook_Presets::apply( $in ); Nodebook_Admin::redirect( Nodebook_Admin::url( 'nodebook-today' ), 'welcome' ); } public static function page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $presets = Nodebook_Presets::all(); $niche = Nodebook_Niche::current(); $detected = Nodebook_Niche::detect(); $again = Nodebook_Presets::done(); $features = Nodebook_Presets::current_features(); $s = Nodebook_Settings::all(); $woo = Nodebook_Woocommerce::active(); $ai = Nodebook_Modules::get( 'abilities' ) && '' === Nodebook_Modules::problem( 'abilities' ); $name = Nodebook_Node::user_first( get_current_user_id() ); $defaults = array(); foreach ( $presets as $k => $p ) { $defaults[ $k ] = $p['features']; } echo '
' . esc_html( $lead ) . '