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["Subscription"]}
$name
{$text['amount']}
$agree
{$text["Subscribed_items"]}
close
EOT; return $html; } public function member_form($user, $member_login_error, $dictionary){ $user_login = ""; $user_email = ""; if(isset($user['user_login']) && isset($user['user_email'])){ $user_login = $user['user_login']; $user_email = $user['user_email']; } $hidden_panel = ""; if($this->visitorSubscriptionForStripe != 1){ $hidden_panel = "hidden_panel"; } $permalink = get_permalink(); $text = array( 'Sign Up' => __("Sign Up", 'booking-package'), 'Username' => __("Username", 'booking-package'), 'Email' => __("Email", 'booking-package'), 'Password' => __("Password", 'booking-package'), 'Registration confirmation will be emailed to you.' => '', 'Register' => __("Register", 'booking-package'), 'Return' => __("Return", 'booking-package'), 'Profile' => __("Profile", 'booking-package'), 'Status' => __("Status", 'booking-package'), 'Approved' => __("Approved", 'booking-package'), 'Change Password' => __("Change Password", 'booking-package'), 'Update Profile' => __("Update Profile", 'booking-package'), 'Delete' => __("Delete", 'booking-package'), 'Subscribed items' => __("Subscribed items", 'booking-package'), ); if (empty($dictionary) === false) { $text['Sign Up'] = $dictionary['Sign Up']; $text['Register'] = $dictionary['Register']; } if (isset($user['check_email_for_member']) && intval($user['check_email_for_member']) == 0) { $text['Registration confirmation will be emailed to you.'] = ''; } $addUserPanel = '
'; $addUserPanel .= '
'; $addUserPanel .= '
'; $addUserPanel .= '
' . $text["Sign Up"] . '
'; $addUserPanel .= '
close
'; $addUserPanel .= '
'; $addUserPanel .= '
'; /** if ($this->managementUsersV2 === 0) { $addUserPanel .= '
'; $addUserPanel .= '
'; $addUserPanel .= '
'; } **/ $addUserPanel .= '
'; $addUserPanel .= '
' . $text["Registration confirmation will be emailed to you."] . '
'; $addUserPanel .= ' '; $addUserPanel .= ' '; $addUserPanel .= '
'; $addUserPanel .= '
'; $editUserPanel = '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
' . $text["Profile"] . '
'; $editUserPanel .= '
close
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= ' '; $editUserPanel .= '
'; $editUserPanel .= '
abc
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= ' '; $editUserPanel .= ' '; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= ' '; $editUserPanel .= ' '; $editUserPanel .= ' '; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= ' '; $editUserPanel .= ' '; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= '
'; $editUserPanel .= ''; $html = ''; if (is_string($member_login_error)) { $html .= '
'.$member_login_error.'
'; } $html .= $addUserPanel; $html .= $editUserPanel; $html .= <<< EOT EOT; return $html; } public function cancelBookingDetailsForVisitor_panel($dictionary) { $text = array( 'Booking Details' => $dictionary["Booking Details"], 'Return to Calendar' => __("Return to Calendar", 'booking-package'), 'Cancel Booking' => $dictionary["Cancel Booking"], ); $html = <<< EOT
{$text["Booking Details"]}
EOT; return $html; } public function myBookingHistory_panel($dictionary) { $text = array( 'Booking History' => $dictionary['Booking History'], 'Return to Calendar' => __("Return to Calendar", 'booking-package'), 'Cancel Booking' => __("Cancel Booking", 'booking-package'), 'ID' => __("ID", 'booking-package'), "Booking Date" => $dictionary['Booking Date'], "Calendar" => $dictionary['Calendar'], "Status" => $dictionary['Status'], ); $html = <<< EOT
{$text["Booking History"]}
close
{$text["ID"]} {$text["Booking Date"]} {$text["Calendar"]} {$text["Status"]}
EOT; return $html; } public function myBookingDetails_panel($dictionary) { $text = array( 'Booking History' => $dictionary["Booking History"], 'Return to Calendar' => __("Return to Calendar", 'booking-package'), 'Cancel Booking' => $dictionary["Cancel Booking"], 'Booking Details' => $dictionary["Booking Details"], 'ID' => __("ID", 'booking-package'), "Booking Date" => __("Booking Date", 'booking-package'), "Status" => __("Status", 'booking-package'), "Return" => $dictionary["Return"], ); $html = <<< EOT
{$text["Booking Details"]}
close
EOT; return $html; } } ?>