PluginProbe
Property Hive / 2.4.0
Property Hive v2.4.0
2.4.0 2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 All 262 releases
← All changes | includes/class-ph-licenses.php +50 -1 2.3.0 → 2.4.0 View file →
@@ -150,8 +150,13 @@
150 150 $product_id_and_package = PH()->license->get_pro_license_product_id_and_package();
151 151
152 152 if ( isset($product_id_and_package['success']) && $product_id_and_package['success'] === true )
153 153 {
154 + if ( ( $product_id_and_package['is_trial'] ?? null ) !== false )
155 + {
156 + return false;
157 + }
158 +
154 159 if (
155 160 isset($feature['plans']) &&
156 161 isset($product_id_and_package['package']) &&
157 162 in_array($product_id_and_package['package'], $feature['plans'])
@@ -437,8 +442,46 @@
437 442
438 443 wp_reset_postdata();
439 444 }
440 445
446 + // Onboarding wizard step
447 + $onboarding_state = get_option( 'propertyhive_onboarding', false );
448 +
449 + if ( is_array( $onboarding_state ) && ! empty( $onboarding_state ) )
450 + {
451 + $onboarding_status = isset( $onboarding_state['status'] )
452 + ? sanitize_key( $onboarding_state['status'] )
453 + : 'not_started';
454 +
455 + $onboarding_step = isset( $onboarding_state['last_step'] )
456 + ? sanitize_key( $onboarding_state['last_step'] )
457 + : '';
458 +
459 + // When skipped, last_step is the exact step on which Skip was clicked.
460 + // Otherwise, use the most recently viewed step so abandonment is captured.
461 + if (
462 + $onboarding_status !== 'skipped' &&
463 + ! empty( $onboarding_state['events'] ) &&
464 + is_array( $onboarding_state['events'] )
465 + )
466 + {
467 + foreach ( array_reverse( $onboarding_state['events'] ) as $event )
468 + {
469 + if (
470 + isset( $event['event'], $event['data']['step'] ) &&
471 + $event['event'] === 'step_viewed'
472 + )
473 + {
474 + $onboarding_step = sanitize_key( $event['data']['step'] );
475 + break;
476 + }
477 + }
478 + }
479 +
480 + $data['onboarding_status'] = $onboarding_status;
481 + $data['onboarding_step'] = $onboarding_step;
482 + }
483 +
441 484 $data = apply_filters( 'propertyhive_license_check_data', $data );
442 485 }
443 486
444 487 return $data;
@@ -826,8 +869,9 @@
826 869 if ( isset($body['data']['product_list']['wc_subs_resources']) && !empty($body['data']['product_list']['wc_subs_resources']) )
827 870 {
828 871 $package = false;
829 872 $product_id = '';
873 + $is_trial = null;
830 874
831 875 foreach ( $body['data']['product_list']['wc_subs_resources'] as $resource )
832 876 {
833 877 if ( isset($resource['product_id']) )
@@ -840,8 +884,12 @@
840 884 {
841 885 $package = 'complete';
842 886 }
843 887 $product_id = $resource['product_id'];
888 + $is_trial = isset( $resource['is_trial'] )
889 + && is_bool( $resource['is_trial'] )
890 + ? $resource['is_trial']
891 + : null;
844 892 }
845 893 }
846 894
847 895 if ( $package !== FALSE )
@@ -848,9 +896,10 @@
848 896 {
849 897 $return = array(
850 898 'success' => true,
851 899 'package' => $package,
852 - 'product_id' => $product_id
900 + 'product_id' => $product_id,
901 + 'is_trial' => $is_trial,
853 902 );
854 903 }
855 904 else
856 905 {