public function paypalprobtn($atts, $content)
 {
     global $WishListMemberInstance;
     $this->load_popup();
     $products = $WishListMemberInstance->GetOption('paypalproproducts');
     $wpm_levels = $WishListMemberInstance->GetOption('wpm_levels');
     $atts = extract(shortcode_atts(array('sku' => null), $atts));
     $product = $products[$sku];
     $settings = $WishListMemberInstance->GetOption('paypalprothankyou_url');
     $paypalprothankyou = $WishListMemberInstance->GetOption('paypalprothankyou');
     $wpm_scregister = get_bloginfo('url') . '/index.php/register/';
     $paypalprothankyou_url = $wpm_scregister . $paypalprothankyou;
     if ($product['checkout_type'] == 'direct-charge') {
         include $WishListMemberInstance->pluginDir . '/extlib/wlm_paypal/form_new_fields.php';
         $this->forms[$sku] = wlm_build_payment_form($data);
         return sprintf('<a id="go-regform-%s" class="go-regform" href="#regform-%s">%s</a>', $sku, $sku, $content);
     } else {
         return sprintf('<a id="" href="%s?action=purchase-express&id=%s">%s</a>', $paypalprothankyou_url, $sku, $content);
     }
     return sprintf('<a href="%s?action=purchase&id=%s">BUY</a>', $paypalprothankyou_url, $sku);
 }
    public function wlm_twoco_api_btn($atts, $content)
    {
        global $WishListMemberInstance;
        global $current_user;
        global $current_user;
        $class = empty($regform_cust_id) ? 'regform-form' : null;
        $regform_cust_id = 0;
        global $WishListMemberInstance;
        $twocheckoutapisettings = $WishListMemberInstance->GetOption('twocheckoutapisettings');
        $this->load_popup();
        extract(shortcode_atts(array('sku' => null), $atts));
        if (empty($sku)) {
            return null;
        }
        echo '
<script type="text/javascript">

 var skutouse = "";

  function successCallback(data) {
 var skutouse = document.getElementById("hiddensku").value;
    var myForm = document.getElementById("myCCForm-"+skutouse);
    myForm.token.value = data.response.token.token;
    myForm.submit();        
  }

  function errorCallback(data) {
	 var skutouse = document.getElementById("hiddensku").value;
	 var myForm = document.getElementById("myCCForm-"+skutouse);
	 myForm.submit();        
  }

  function retrieveToken(skutouse) {
	var hiddensku = document.getElementById("hiddensku");
	hiddensku.value = skutouse;
    TCO.requestToken(successCallback, errorCallback, "myCCForm-"+skutouse);
  }

</script>
';
        $wpm_levels = $WishListMemberInstance->GetOption('wpm_levels');
        $twoco_apisettings = $WishListMemberInstance->GetOption('twocheckoutapisettings');
        $twoco_apisettings['skip_cvc'] = true;
        extract($twoco_apisettings);
        $ppp_level = $WishListMemberInstance->IsPPPLevel($sku);
        $level_name = $wpm_levels[$sku]['name'];
        if ($ppp_level) {
            $level_name = $ppp_level->post_title;
        }
        $btn_label = empty($buttonlabel) ? "Join %level" : $buttonlabel;
        $btn_label = str_replace('%level', $level_name, $btn_label);
        $panel_btn_label = empty($twoco_apisettings['panelbuttonlabel']) ? "Pay" : $twoco_apisettings['panelbuttonlabel'];
        $panel_btn_label = str_replace('%level', $level_name, $panel_btn_label);
        $settings = $connections[$sku];
        $amt = $settings['rebill_init_amount'];
        $currency = empty($twoco_apisettings['currency']) ? 'USD' : $twoco_apisettings['currency'];
        $wpm_scregister = get_site_url() . '/index.php/register/';
        $thankyouurl = $wpm_scregister . $WishListMemberInstance->GetOption('twocheckoutapithankyouurl');
        ob_start();
        ?>
		<?php 
        if (empty($content)) {
            ?>
			<button class="regform-button go-regform" style="width: auto" id="go-regform-<?php 
            echo $sku;
            ?>
" class="" href="#regform-<?php 
            echo $sku;
            ?>
"><?php 
            echo $btn_label;
            ?>
</button>
		<?php 
        } else {
            ?>
			<a id="go-regform-<?php 
            echo $sku;
            ?>
" class="go-regform" href="#regform-<?php 
            echo $sku;
            ?>
"><?php 
            echo $content;
            ?>
</a>
		<?php 
        }
        ?>

		<input type="hidden" id="hiddensku" value="">	
			
		<?php 
        $btn = ob_get_clean();
        ob_start();
        ?>


		<?php 
        if (!is_user_logged_in()) {
            //retrieve fields
            $path = sprintf($WishListMemberInstance->pluginDir . '/extlib/' . $this->folder . '/form_new_fields.php');
            include $path;
            $this->forms[$sku] = wlm_build_payment_form($data);
        } else {
            global $current_user;
            $path = sprintf($WishListMemberInstance->pluginDir . '/extlib/' . $this->folder . '/form_existing_fields.php');
            include $path;
            $this->forms[$sku] = wlm_build_payment_form($data);
        }
        //include $this->get_view_path('form_css');
        ?>

		<?php 
        return $btn;
    }
        public function generate_stripe_form($atts, $content)
        {
            global $WishListMemberInstance;
            $this->load_popup();
            add_action('wp_footer', array($this, 'footer'), 100);
            global $current_user;
            extract(shortcode_atts(array('sku' => null), $atts));
            if (empty($sku)) {
                return null;
            }
            $stripeapikey = $WishListMemberInstance->GetOption('stripeapikey');
            $stripeconnections = $WishListMemberInstance->GetOption('stripeconnections');
            $stripethankyou = $WishListMemberInstance->GetOption('stripethankyou');
            $wpm_scregister = get_site_url() . '/index.php/register/';
            $stripethankyou_url = $wpm_scregister . $stripethankyou;
            $stripesettings = $WishListMemberInstance->GetOption('stripesettings');
            $wpm_levels = $WishListMemberInstance->GetOption('wpm_levels');
            $WishListMemberInstance->InjectPPPSettings($wpm_levels);
            $settings = $stripeconnections[$sku];
            $amt = $settings['amount'];
            $currency = empty($stripesettings['currency']) ? 'USD' : $stripesettings['currency'];
            if ($settings['subscription']) {
                try {
                    Stripe::setApiKey($stripeapikey);
                    $plan = Stripe_Plan::retrieve($settings['plan']);
                    $amt = number_format($plan->amount / 100, 2);
                } catch (Exception $e) {
                    $msg = __("Error %s");
                    return sprintf($msg, $e->getMessage());
                }
            }
            $ppp_level = $WishListMemberInstance->IsPPPLevel($sku);
            $level_name = $wpm_levels[$sku]['name'];
            if ($ppp_level) {
                $level_name = $ppp_level->post_title;
            }
            $heading = empty($stripesettings['formheading']) ? "Register to %level" : $stripesettings['formheading'];
            $heading = str_replace('%level', $level_name, $heading);
            $btn_label = empty($stripesettings['buttonlabel']) ? "Join %level" : $stripesettings['buttonlabel'];
            $btn_label = str_replace('%level', $level_name, $btn_label);
            $panel_btn_label = empty($stripesettings['panelbuttonlabel']) ? "Pay" : $stripesettings['panelbuttonlabel'];
            $panel_btn_label = str_replace('%level', $level_name, $panel_btn_label);
            $logo = $stripesettings['logo'];
            $logo = str_replace('%level', $level_name, $stripesettings['logo']);
            $content = trim($content);
            ob_start();
            ?>

			<?php 
            if (empty($content)) {
                ?>
				<button class="regform-button go-regform" style="width: auto" id="go-regform-<?php 
                echo $sku;
                ?>
" class="" href="#regform-<?php 
                echo $sku;
                ?>
"><?php 
                echo $btn_label;
                ?>
</button>
			<?php 
            } else {
                ?>
				<a id="go-regform-<?php 
                echo $sku;
                ?>
" class="go-regform" href="#regform-<?php 
                echo $sku;
                ?>
"><?php 
                echo $content;
                ?>
</a>
			<?php 
            }
            ?>

			<?php 
            $btn = ob_get_clean();
            ?>

			<?php 
            if (!is_user_logged_in()) {
                $path = sprintf($WishListMemberInstance->pluginDir . '/extlib/wlm_stripe/form_new_fields.php');
                include $path;
                $this->forms[$sku] = wlm_build_payment_form($data);
            } else {
                $stripe_cust_id = $WishListMemberInstance->Get_UserMeta($current_user->ID, 'stripe_cust_id');
                $path = sprintf($WishListMemberInstance->pluginDir . '/extlib/wlm_stripe/form_existing_fields.php');
                include $path;
                $this->forms[$sku] = wlm_build_payment_form($data);
            }
            return $btn;
        }
    public function wlm_eway_btn($atts, $content)
    {
        global $WishListMemberInstance;
        global $current_user;
        $this->load_popup();
        extract(shortcode_atts(array('sku' => null), $atts));
        if (empty($sku)) {
            return null;
        }
        $wpm_levels = $WishListMemberInstance->GetOption('wpm_levels');
        $ewaysettings = $WishListMemberInstance->GetOption('ewaysettings');
        $ewaysettings['skip_cvc'] = true;
        extract($ewaysettings);
        $ppp_level = $WishListMemberInstance->IsPPPLevel($sku);
        $level_name = $wpm_levels[$sku]['name'];
        if ($ppp_level) {
            $level_name = $ppp_level->post_title;
        }
        $btn_label = empty($buttonlabel) ? "Join %level" : $buttonlabel;
        $btn_label = str_replace('%level', $level_name, $btn_label);
        $panel_btn_label = empty($ewaysettings['panelbuttonlabel']) ? "Pay" : $ewaysettings['panelbuttonlabel'];
        $panel_btn_label = str_replace('%level', $level_name, $panel_btn_label);
        $settings = $connections[$sku];
        $amt = $settings['rebill_init_amount'];
        $currency = empty($ewaysettings['currency']) ? 'USD' : $ewaysettings['currency'];
        $wpm_scregister = get_site_url() . '/index.php/register/';
        $thankyouurl = $wpm_scregister . $WishListMemberInstance->GetOption('ewaythankyouurl');
        ob_start();
        ?>
		<?php 
        if (empty($content)) {
            ?>
			<button class="regform-button go-regform" style="width: auto" id="go-regform-<?php 
            echo $sku;
            ?>
" class="" href="#regform-<?php 
            echo $sku;
            ?>
"><?php 
            echo $btn_label;
            ?>
</button>
		<?php 
        } else {
            ?>
			<a id="go-regform-<?php 
            echo $sku;
            ?>
" class="go-regform" href="#regform-<?php 
            echo $sku;
            ?>
"><?php 
            echo $content;
            ?>
</a>
		<?php 
        }
        ?>

		<?php 
        $btn = ob_get_clean();
        ob_start();
        ?>


		<?php 
        if (!is_user_logged_in()) {
            //retrieve fields
            $path = sprintf($WishListMemberInstance->pluginDir . '/extlib/' . $this->folder . '/form_new_fields.php');
            include $path;
            $this->forms[$sku] = wlm_build_payment_form($data);
        } else {
            global $current_user;
            $path = sprintf($WishListMemberInstance->pluginDir . '/extlib/' . $this->folder . '/form_existing_fields.php');
            include $path;
            $this->forms[$sku] = wlm_build_payment_form($data);
        }
        ?>

		<?php 
        return $btn;
    }
 public function anet_arb_btn($atts, $content)
 {
     $this->load_js();
     $subscriptions = $this->wlm->GetOption('anetarbsubscriptions');
     $wpm_levels = $this->wlm->GetOption('wpm_levels');
     $atts = extract(shortcode_atts(array('sku' => null), $atts));
     $subscription = $subscriptions[$sku];
     $settings = $this->wlm->GetOption('anetarbthankyou_url');
     $anetarbthankyou = $this->wlm->GetOption('anetarbthankyou');
     $wpm_scregister = get_bloginfo('url') . '/index.php/register/';
     $anetarbthankyou_url = $wpm_scregister . $anetarbthankyou;
     include $this->wlm->pluginDir . '/extlib/wlm_authorizenet_arb/form_new_field.php';
     $this->forms[$sku] = wlm_build_payment_form($data);
     return sprintf('<a id="go-regform-%s" class="go-regform" href="#regform-%s">%s</a>', $sku, $sku, $content);
 }