PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.2.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.2.0
2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 All 65 releases
← All changes | includes/Illuminate/Helper.php +2 -30 2.3.0 → 2.2.0 View file →
@@ -89,22 +89,8 @@
89 89 return isset( $statuses[ $status ] ) ? $statuses[ $status ] : '';
90 90 }
91 91
92 92 /**
93 - * Whether a subscription in this status still has a payment ahead.
94 - *
95 - * Cancelling or expiring keeps `_subscrpt_next_date` (the cancellation sweep
96 - * and reactivation read it), so views check the status before showing it.
97 - *
98 - * @param string $status Status.
99 - *
100 - * @return bool
101 - */
102 - public static function has_next_payment( $status ) {
103 - return ! in_array( $status, array( 'cancelled', 'expired' ), true );
104 - }
105 -
106 - /**
107 93 * Generate start date
108 94 *
109 95 * @param null|string $trial Trial.
110 96 *
@@ -1012,9 +998,9 @@
1012 998 array(
1013 999 'trial_status' => ! is_null( $cart_subscription['trial'] ),
1014 1000 'start_date' => self::start_date( $cart_subscription['trial'] ),
1015 1001 'next_date' => self::next_date( ( $cart_subscription['time'] ?? 1 ) . ' ' . $cart_subscription['type'], $cart_subscription['trial'] ),
1016 - 'can_user_cancel' => self::can_user_cancel( $cart_item['data']->get_meta( '_subscrpt_user_cancel' ) ) ? 'yes' : 'no',
1002 + 'can_user_cancel' => $cart_item['data']->get_meta( '_subscrpt_user_cancel' ),
1017 1003 'max_no_payment' => ! empty( $cart_item['subscrpt_max_no_payment'] )
1018 1004 ? (int) $cart_item['subscrpt_max_no_payment']
1019 1005 : $cart_item['data']->get_meta( '_subscrpt_max_no_payment' ),
1020 1006 // Exact plan total for split items (the entered price the split is
@@ -1403,22 +1389,8 @@
1403 1389 update_comment_meta( $comment_id, '_subscrpt_activity_type', 'renewal_order' );
1404 1390 }
1405 1391
1406 1392 /**
1407 - * Whether a stored `_subscrpt_user_cancel` value lets the customer cancel.
1408 - *
1409 - * Only an explicit "no" forbids it. An empty value means the option was never
1410 - * saved - plan-connected products never store it - and the product form shows
1411 - * "Yes" for that case, so the answer here has to be yes too.
1412 - *
1413 - * @param mixed $value Stored meta value.
1414 - * @return bool
1415 - */
1416 - public static function can_user_cancel( $value ): bool {
1417 - return 'no' !== $value;
1418 - }
1419 -
1420 - /**
1421 1393 * Get a subscription data.
1422 1394 *
1423 1395 * @param int $subscription_id Subscription ID.
1424 1396 * @return array|null
@@ -1447,9 +1419,9 @@
1447 1419
1448 1420 $order_id = get_post_meta( $subscription_id, '_subscrpt_order_id', true );
1449 1421 $order_item_id = get_post_meta( $subscription_id, '_subscrpt_order_item_id', true );
1450 1422
1451 - $can_user_cancel = self::can_user_cancel( get_post_meta( $subscription_id, '_subscrpt_user_cancel', true ) );
1423 + $can_user_cancel = in_array( get_post_meta( $subscription_id, '_subscrpt_user_cancel', true ), array( 1, '1', 'true', 'yes' ), true );
1452 1424
1453 1425 $start_datetime = (int) get_post_meta( $subscription_id, '_subscrpt_start_date', true );
1454 1426 $start_date = ! empty( $start_datetime ) ? gmdate( DATE_RFC2822, $start_datetime ) : null;
1455 1427