prefix = $prefix; $this->plugin_name = $pluginName; $this->currencies = $currencies; $this->visitorSubscriptionForStripe = 1; } public function setManagementUsersV2($managementUsersV2) { $this->managementUsersV2 = $managementUsersV2; } public function setVisitorSubscriptionForStripe($visitorSubscriptionForStripe){ $this->visitorSubscriptionForStripe = $visitorSubscriptionForStripe; } public function subscription_form($calendarAccount, $memberSetting){ global $wpdb; $pluginName = $this->plugin_name; $stripe_active = intval(get_option($this->prefix."stripe_active", 0)); if($stripe_active == 0 || intval($calendarAccount['enableSubscriptionForStripe']) == 0){ #wp_localize_script('booking_app_js', $this->prefix.'subscriptions', array('status' => 0)); $html = '' . "\n"; return $html; } $product = $calendarAccount["subscriptionIdForStripe"]; $secret = get_option($this->prefix."stripe_secret_key", 0); $schedule = new booking_package_schedule($this->prefix, $this->plugin_name, $this->currencies); #$subscription = $schedule->getProductForStripe($secret, $product); $subscription = $schedule->getProductForStripe($secret, explode(",", $product)); $items = array(); if (isset($memberSetting['subscription_list'])) { $items = $memberSetting['subscription_list']; } foreach ((array) $items as $key => $value) { $item = $items[$key]; if($subscription['product'] == $key && $subscription['product'] == $product){ $plans = $item['items']; for($i = 0; $i < count($plans); $i++){ if(array_search($plans[$i]['id'], $subscription['planKeys']) !== false){ $subscription['subscribed'] = 1; break; } } } } $name = null; $amount = null; if(is_array($subscription)){ $name = $subscription['name']; $amount = $subscription['amount']; #wp_localize_script('booking_app_js', $this->prefix.'subscriptions', $subscription); echo '' . "\n"; }else{ #wp_localize_script('booking_app_js', $this->prefix.'subscriptions', array('status' => 0)); echo '' . "\n"; } $text = array( "Subscription" => 'Subscription', "Subscribed_items" => 'Subscribed items', "agreeToOur1" => 'By proceeding you agree to our %s.', "agreeToOur2" => 'By proceeding you agree to our %s and %s.', "termsOfService" => 'Terms of Service', "privacyPolicy" => 'Privacy Policy', "amount" => '%s per month', "Return" => 'Return', ); $agree = ""; if(intval($calendarAccount['enableTermsOfServiceForSubscription']) == 1 && intval($calendarAccount['enablePrivacyPolicyForSubscription']) == 0){ $termsOfService = ''.$text['termsOfService'].''; $agree = sprintf($text['agreeToOur1'], $termsOfService); }else if(intval($calendarAccount['enableTermsOfServiceForSubscription']) == 0 && intval($calendarAccount['enablePrivacyPolicyForSubscription']) == 1){ $privacyPolicy = ''.$text['privacyPolicy'].''; $agree = sprintf($text['agreeToOur1'], $privacyPolicy); }else if(intval($calendarAccount['enableTermsOfServiceForSubscription']) == 1 && intval($calendarAccount['enablePrivacyPolicyForSubscription']) == 1){ $termsOfService = ''.$text['termsOfService'].''; $privacyPolicy = ''.$text['privacyPolicy'].''; $agree = sprintf($text['agreeToOur2'], $termsOfService, $privacyPolicy); } $html .= <<< EOT
| {$text["ID"]} | {$text["Booking Date"]} | {$text["Calendar"]} | {$text["Status"]} |
|---|