get_initial_order() ) ) ) { continue; } $lifespan = $plan->get_lifespan(); $bylling_cycle = $plan->get_billing_cycle(); if ( ! empty( $lifespan ) ) { $period = RP_SUB_Time::get_period_from_period_length( $lifespan ); $length = RP_SUB_Time::get_length_from_period_length( $lifespan ); $value = RP_SUB_Time::get_formatted_time_period_string( $length, $period ); } if ( ! empty( $bylling_cycle ) && empty( $lifespan ) ) { $period = RP_SUB_Time::get_period_from_period_length( $bylling_cycle ); $length = RP_SUB_Time::get_length_from_period_length( $bylling_cycle ); $value = RP_SUB_Time::get_formatted_time_period_string( $length, $period ); } $currentDateTime = new DateTime(); $modifiedDateTime = $currentDateTime->modify( '+' . $value ); $formattedDateTime = $modifiedDateTime->format( get_option( 'date_format', 'm/d/Y' ) . ' ' . get_option( 'time_format', 'H:i' ) ); $stm_status = ( class_exists( 'Subscriptio_User' ) ) ? $plan->status : $plan->get_status(); if ( class_exists( 'Subscriptio_User' ) ) { $subs_id = $plan->id; $plan_name = ( ! empty( $plan->products_multiple ) ) ? $plan->products_multiple[0]['product_name'] : $plan->product_name; $product_id = $plan->product_id; $expires = $plan->payment_due_readable; $used_quota = \MotorsVehiclesListing\Features\MultiplePlan::getUsedQuota( $subs_id ); if ( empty( $product_id ) && ! empty( $plan->products_multiple ) && is_array( $plan->products_multiple ) ) { $products = $plan->products_multiple; if ( ! empty( $products[0] ) && ! empty( $products[0]['product_id'] ) ) { $product_id = $products[0]['product_id']; } } } else { $initial_order = $plan->get_initial_order()->get_data(); $key = key( $initial_order['line_items'] ); $order_data = $initial_order['line_items'][ $key ]->get_data(); $subs_id = $plan->get_id(); $plan_name = $order_data['name']; $product_id = $order_data['product_id']; if ( ! empty( $plan->get_scheduled_subscription_expire() ) && in_array( $stm_status, array( 'active', 'trial' ), true ) ) { $expires = $plan->get_scheduled_subscription_expire()->format( get_option( 'date_format', 'm/d/Y' ) . ' ' . get_option( 'time_format', 'H:i' ) ); } elseif ( empty( $lifespan ) ) { $expires = esc_html__( 'Infinite', 'motors' ); } else { $expires = false; } $renew = false; $date_expires = strtotime( $expires ); $date_now = time(); $date_diff = ( $date_expires - $date_now ) / ( 60 * 60 * 24 ); if ( 0 !== $renewal_day && $date_diff <= 0 ) { $renew = true; } $used_quota = \MotorsVehiclesListing\Features\MultiplePlan::getUsedQuota( $plan->get_id() ); } $post_limit = intval( get_post_meta( $product_id, 'stm_price_plan_quota', true ) ); $plan_unique_id = 'stm-start-countdown-plan-' . wp_rand( 1, 99999 ); ?>
  • /
  • get_previous_status(), array( 'trial', 'paused', 'pending' ), true ) ) : ?>