PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.1.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.1.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 +4 -34 2.4.0 → 2.1.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
@@ -1137,13 +1123,11 @@
1137 1123 $new_order->calculate_totals();
1138 1124 $new_order->save();
1139 1125
1140 1126 if ( ! is_admin() && function_exists( 'wc_add_notice' ) && WC()->session ) {
1141 - /* translators: %d: renewal order ID. */
1142 - $message = sprintf( __( 'Renewal order #%d created.', 'subscription' ), $new_order->get_id() );
1127 + $message = 'Renewal Order(#' . $new_order->get_id() . ') Created.';
1143 1128 if ( $new_order->has_status( 'pending' ) ) {
1144 - /* translators: %s: URL of the order payment page. */
1145 - $message .= ' ' . sprintf( __( 'Please <a href="%s">pay now</a>.', 'subscription' ), esc_url( $new_order->get_checkout_payment_url() ) );
1129 + $message .= 'Please <a href="' . $new_order->get_checkout_payment_url() . '">Pay now</a>';
1146 1130 }
1147 1131 wc_add_notice( $message, 'success' );
1148 1132 }
1149 1133
@@ -1405,22 +1389,8 @@
1405 1389 update_comment_meta( $comment_id, '_subscrpt_activity_type', 'renewal_order' );
1406 1390 }
1407 1391
1408 1392 /**
1409 - * Whether a stored `_subscrpt_user_cancel` value lets the customer cancel.
1410 - *
1411 - * Only an explicit "no" forbids it. An empty value means the option was never
1412 - * saved - plan-connected products never store it - and the product form shows
1413 - * "Yes" for that case, so the answer here has to be yes too.
1414 - *
1415 - * @param mixed $value Stored meta value.
1416 - * @return bool
1417 - */
1418 - public static function can_user_cancel( $value ): bool {
1419 - return 'no' !== $value;
1420 - }
1421 -
1422 - /**
1423 1393 * Get a subscription data.
1424 1394 *
1425 1395 * @param int $subscription_id Subscription ID.
1426 1396 * @return array|null
@@ -1449,9 +1419,9 @@
1449 1419
1450 1420 $order_id = get_post_meta( $subscription_id, '_subscrpt_order_id', true );
1451 1421 $order_item_id = get_post_meta( $subscription_id, '_subscrpt_order_item_id', true );
1452 1422
1453 - $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 );
1454 1424
1455 1425 $start_datetime = (int) get_post_meta( $subscription_id, '_subscrpt_start_date', true );
1456 1426 $start_date = ! empty( $start_datetime ) ? gmdate( DATE_RFC2822, $start_datetime ) : null;
1457 1427