示例#1
0
				</td>
				<td>
					Space ID <strong><?php 
        echo $entry['space_id'];
        ?>
</strong><br>
					Ad ID / Order ID <strong><?php 
        echo $entry['id'];
        ?>
</strong><br>
					Billing Model <strong><?php 
        echo strtoupper($entry['ad_model']);
        ?>
</strong><br>
					Cost <strong><?php 
        echo $before . bsa_number_format($entry['cost']) . $after;
        ?>
</strong><br>
					<?php 
        if ($entry['paid'] == 1) {
            ?>
						<span class="bsaColorGreen">Paid</span>
					<?php 
        } elseif ($entry['paid'] == 2) {
            ?>
						<span class="bsaColorGreen">Added via Admin Panel</span>
					<?php 
        } else {
            ?>
						<span class="bsaColorRed">Not paid</span>
					<?php 
示例#2
0
    echo get_current_user_id();
    ?>
" name="orderId">
		<table class="bsaAdminTable form-table">
			<tbody class="bsaTbody">
			<tr>
				<th scope="row"><label><?php 
    echo bsa_get_trans('affiliate_program', 'earnings');
    ?>
</label></th>
				<td>
					<?php 
    echo $before;
    ?>
<input name="amount" type="number" class="regular-text" placeholder="" maxlength="255" value="<?php 
    echo bsa_number_format($model->getAffiliateBalance());
    ?>
" disabled><?php 
    echo $after;
    ?>
				</td>
			</tr>
			<tr>
				<th scope="row"><label for="bsa_pro_payment_account"><?php 
    echo bsa_get_trans('affiliate_program', 'payment');
    ?>
</label></th>
				<td>
					<input id="bsa_pro_payment_account" name="payment_account" type="email" class="regular-text" maxlength="255" value="">
				</td>
			</tr>
示例#3
0
    do_action('bsa-pro-addcontract', 'cpm');
    ?>
					</div>

					<div class="billing-col">
						<h3>CPD - Cost per Days</h3>

						<label for="bsa_pro_cpd_price" class="billing-label"><strong>CPD Price</strong> (contract 1st)</label>
						<?php 
    if (get_option('bsa_pro_plugin_' . 'symbol_position') == 'before') {
        echo get_option('bsa_pro_plugin_' . 'currency_symbol');
    }
    ?>
						<input type="text" class="regular-text code billing-input" id="bsa_pro_cpd_price" name="cpd_price"
							   maxlength="10" value="<?php 
    echo getSpaceValue('cpd_price') >= 0 ? bsa_number_format(getSpaceValue('cpd_price')) : getSpaceValue('cpd_price');
    ?>
" placeholder="1.00">
						<?php 
    if (get_option('bsa_pro_plugin_' . 'symbol_position') == 'after') {
        echo get_option('bsa_pro_plugin_' . 'currency_symbol');
    }
    ?>
						<br>

						<label for="bsa_pro_cpd_contract_1" class="billing-label"><strong>Contract 1st</strong> (target days)</label>
						<input type="number" class="regular-text code billing-input" id="bsa_pro_cpd_contract_1" name="cpd_contract_1"
							   maxlength="10" value="<?php 
    echo getSpaceValue('cpd_contract_1');
    ?>
" placeholder="30"> days
示例#4
0
 public function notifyAction($type = NULL)
 {
     if (empty($_POST)) {
         return;
     }
     $paymentId = isset($_GET['oid']) ? $_GET['oid'] : null;
     if (isset($_POST) && !isset($_POST['stripeToken'])) {
         // PayPal Verify
         $payment_crc = $_POST['custom'];
         try {
             $timestamp = time();
             $data = json_encode($_POST);
             $this->wpdb->update($this->getTableName('ads'), array('p_time' => $timestamp, 'p_data' => $data), array('id' => $paymentId));
             if ($payment_crc != md5($_POST['item_number'] . bsa_number_format($_POST['mc_gross']))) {
                 throw new \Exception('price changed');
             }
             if ($_POST['payment_status'] == 'Pending') {
                 throw new \Exception('payment is pending');
             }
             if ($_POST['payment_status'] == 'Denied') {
                 throw new \Exception('payment is denied');
             }
         } catch (\Exception $e) {
             $error = $e->getMessage();
         }
         if (isset($error)) {
             $this->wpdb->update($this->getTableName('ads'), array('paid' => 0, 'p_error' => $error), array('id' => $paymentId));
         }
         if (isset($_POST) && isset($_POST['payment_status']) && $_POST['payment_status'] == 'Completed' && !isset($error)) {
             // change status
             $this->wpdb->update($this->getTableName('ads'), array('paid' => 1, 'status' => (get_option('bsa_pro_plugin_auto_accept') == 'no' or $type == 'agency') ? 'pending' : 'active'), array('id' => $paymentId));
             // change affiliate status
             if ($this->validReferral($paymentId)) {
                 $this->wpdb->update($this->getTableName('referrals'), array('order_status' => 'paid'), array('order_id' => $paymentId));
             }
         }
         // reset cache sessions
         unset($_SESSION['bsa_ad_' . $paymentId]);
     }
     if (isset($_POST) && isset($_POST['stripeToken'])) {
         // Stripe Verify
         if (isset($_POST['stripeToken']) && isset($_GET['oid'])) {
             require_once 'Stripe/init.php';
             // Set your API key
             \Stripe\Stripe::setApiKey(get_option('bsa_pro_plugin_secret_key'));
             try {
                 \Stripe\Charge::create(array('amount' => number_format(bsa_ad($_GET['oid'], 'cost'), 2, '', ''), 'currency' => 'usd', 'card' => $_POST['stripeToken'], 'description' => bsa_ad($_GET['oid'], 'buyer_email') . ' (' . number_format(bsa_ad($_GET['oid'], 'cost'), 2, '', '') . ')'));
                 $timestamp = time();
                 $this->wpdb->update($this->getTableName('ads'), array('paid' => 1, 'p_time' => $timestamp, 'p_data' => $_POST['stripeToken'], 'status' => (get_option('bsa_pro_plugin_auto_accept') == 'no' or $type == 'agency') ? 'pending' : 'active'), array('id' => $paymentId));
                 // change affiliate status
                 if ($this->validReferral($paymentId)) {
                     $this->wpdb->update($this->getTableName('referrals'), array('order_status' => 'paid'), array('order_id' => $paymentId));
                 }
                 echo 'TRUE';
             } catch (\Stripe\Error\Card $e) {
                 // The card has been declined
                 //					$error = $e->getMessage();
                 //					$this->wpdb->update(
                 //						$this->getTableName('ads'),
                 //						array(
                 //							'paid' => 0,
                 //							'p_error' => $error
                 //						),
                 //						array('id' => $paymentId)
                 //					);
                 //					echo 'FALSE';
             }
         }
         // change status to pending if pending cron task
         if ($this->getPendingTask($paymentId, 'ad')) {
             $this->wpdb->update($this->getTableName('ads'), array('status' => 'pending'), array('id' => $paymentId));
         }
         // reset cache sessions
         unset($_SESSION['bsa_ad_' . $paymentId]);
     }
     if (isset($error)) {
         echo FALSE;
     } else {
         // email sender
         $sender = get_option('bsa_pro_plugin_trans_email_sender');
         $email = get_option('bsa_pro_plugin_trans_email_address');
         // buyer sender
         $paymentEmail = bsa_ad($paymentId, 'buyer_email');
         $subject = get_option('bsa_pro_plugin_trans_buyer_subject');
         $message = get_option('bsa_pro_plugin_trans_buyer_message');
         $search = '[STATS_URL]';
         if ($type == 'agency') {
             $replace = get_option('bsa_pro_plugin_agency_ordering_form_url') . (strpos(get_option('bsa_pro_plugin_agency_ordering_form_url'), '?') == TRUE ? '&' : '?') . "bsa_pro_stats=1&bsa_pro_email=" . str_replace('@', '%40', $paymentEmail) . "&bsa_pro_id=" . $paymentId . "#bsaStats\r\n";
         } else {
             $replace = get_option('bsa_pro_plugin_ordering_form_url') . (strpos(get_option('bsa_pro_plugin_ordering_form_url'), '?') == TRUE ? '&' : '?') . "bsa_pro_stats=1&bsa_pro_email=" . str_replace('@', '%40', $paymentEmail) . "&bsa_pro_id=" . $paymentId . "#bsaStats\r\n";
         }
         $message = str_replace($search, $replace, $message);
         $headers = 'From: ' . $sender . ' <' . $email . '>' . "\r\n";
         wp_mail($paymentEmail, $subject, $message, $headers);
         if ($type == 'agency') {
             // seller sender
             $sellerSubject = get_option('bsa_pro_plugin_trans_seller_subject');
             $sellerMessage = get_option('bsa_pro_plugin_trans_seller_message');
             $sellerHeaders = 'From: ' . $sender . ' <' . $email . '>' . "\r\n";
             $getUserId = bsa_site(bsa_space(bsa_ad($paymentId, 'space_id'), 'site_id'), 'user_id');
             $userInfo = get_userdata($getUserId);
             $userEmail = $userInfo->user_email;
             wp_mail($userEmail, $sellerSubject, $sellerMessage, $sellerHeaders);
         }
         if (!isset($_POST['stripeToken'])) {
             echo TRUE;
         }
     }
 }
                echo $userEmail;
                ?>
">
									<input type="hidden" name="item_number" value="<?php 
                echo $orderId;
                ?>
">
									<input type="hidden" name="tax" value="0">
									<input type="hidden" name="no_note" value="1">
									<input type="hidden" name="no_shipping" value="1">
									<input type="hidden" name="amount" value="<?php 
                echo bsa_number_format($amount);
                ?>
">
									<input type="hidden" name="custom" value="<?php 
                echo md5($orderId . bsa_number_format($amount));
                ?>
">
									<input type="hidden" name="currency_code" value="<?php 
                echo get_option("bsa_pro_plugin_currency_code");
                ?>
">
									<input type="hidden" name="return" value="http://<?php 
                echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . $checkGET;
                ?>
bsa_pro_notice=success">
									<input type="hidden" name="cancel_return" value="http://<?php 
                echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . $checkGET;
                ?>
bsa_pro_notice=failed">
									<input type="hidden" name="notify_url" value="http://<?php 
function bsa_get_billing_models_callback()
{
    if (get_option('bsa_pro_plugin_symbol_position') == 'before') {
        $before = get_option('bsa_pro_plugin_currency_symbol');
    } else {
        $before = '';
    }
    if (get_option('bsa_pro_plugin_symbol_position') != 'before') {
        $after = get_option('bsa_pro_plugin_currency_symbol');
    } else {
        $after = '';
    }
    if ($_POST && $_POST['bsa_space_id']) {
        $sid = $_POST['bsa_space_id'];
        $admin = isset($_POST['bsa_pro_admin']) ? $_POST['bsa_pro_admin'] : null;
        // if admin panel
        echo '<div class="bsaProInputsGroup bsaProInputsBillingModel">';
        if (bsa_space($sid, 'cpc_price') != NULL && bsa_space($sid, 'cpc_price') != 0.0 || $admin == 1 && bsa_space($sid, 'cpc_price') == 0.0 && bsa_role() == 'admin') {
            echo '
				<div class="bsaProInput">
					<div class="bsaInputInner bsaInputInnerModel">
						<input id="bsa_pro_cpc_model" type="radio" name="ad_model" value="cpc" onchange="selectBillingModel()">
						<label for="bsa_pro_cpc_model">' . get_option("bsa_pro_plugin_trans_" . "form_right_cpc_name") . '</label>
					</div>
				</div>';
        }
        if (bsa_space($sid, 'cpm_price') != NULL && bsa_space($sid, 'cpm_price') != 0.0 || $admin == 1 && bsa_space($sid, 'cpm_price') == 0.0 && bsa_role() == 'admin') {
            echo '
				<div class="bsaProInput">
					<div class="bsaInputInner bsaInputInnerModel">
						<input id="bsa_pro_cpm_model" type="radio" name="ad_model" value="cpm" onchange="selectBillingModel()">
						<label for="bsa_pro_cpm_model">' . get_option("bsa_pro_plugin_trans_" . "form_right_cpm_name") . '</label>
					</div>
				</div>';
        }
        if (bsa_space($sid, 'cpd_price') != NULL && bsa_space($sid, 'cpd_price') != 0.0 || $admin == 1 && bsa_space($sid, 'cpd_price') == 0.0 && bsa_role() == 'admin') {
            echo '
				<div class="bsaProInput">
					<div class="bsaInputInner bsaInputInnerModel">
						<input id="bsa_pro_cpd_model" type="radio" name="ad_model" value="cpd" onchange="selectBillingModel()">
						<label for="bsa_pro_cpd_model">' . get_option("bsa_pro_plugin_trans_" . "form_right_cpd_name") . '</label>
					</div>
				</div>';
        }
        do_action('bsa-pro-billing-models-callback', $sid);
        echo '</div>';
        if (bsa_space($sid, 'cpc_price') != NULL && bsa_space($sid, 'cpc_price') != 0.0 || $admin == 1 && bsa_space($sid, 'cpc_price') == 0.0 && bsa_role() == 'admin') {
            echo '<div class="bsaProInputsGroup bsaProInputsValues bsaProInputsValuesCPC" style="display: none;">';
            do_action('bsa-pro-billing-models-before', $sid, 'cpc', $before, $after);
            if (bsa_space($sid, 'cpc_contract_1') != NULL && bsa_space($sid, 'cpc_contract_1') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpc_1" type="radio" name="ad_limit_cpc" value="' . bsa_space($sid, 'cpc_contract_1') . '">
						<label for="bsa_pro_ad_limit_cpc_1">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpc_contract_1') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_clicks") . '</span>
							';
                if (isset($_POST['bsa_order'])) {
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format(bsa_space($sid, 'cpc_price')) . $after . '</span>';
                }
                echo '
						</label>
					</div>
				</div>';
            } elseif ($admin == 1 && bsa_space($sid, 'cpc_price') == 0.0 && bsa_role() == 'admin') {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<label for="bsa_pro_ad_limit_cpc_1">Display Limit (clicks)</label>
						<input id="bsa_pro_ad_limit_cpc_1" type="number" name="ad_limit_cpc" value="" style="margin-top:10px;width: 100%;">
					</div>
				</div>';
            }
            if (bsa_space($sid, 'cpc_contract_2') != NULL && bsa_space($sid, 'cpc_contract_2') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpc_2" type="radio" name="ad_limit_cpc" value="' . bsa_space($sid, 'cpc_contract_2') . '">
						<label for="bsa_pro_ad_limit_cpc_2">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpc_contract_2') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_clicks") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    $cpc_2 = bsa_space($sid, 'cpc_price') * (bsa_space($sid, 'cpc_contract_2') / bsa_space($sid, 'cpc_contract_1'));
                    $d_cpc_2 = bsa_space($sid, 'discount_2') > 0 ? $cpc_2 * (bsa_space($sid, 'discount_2') / 100) : 0;
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format($cpc_2 - $d_cpc_2) . $after . '</span>';
                    if (bsa_space($sid, 'discount_2') > 0) {
                        echo '<span class="bsaProDiscount">(-' . bsa_space($sid, 'discount_2') . '%)</span>';
                    }
                }
                echo '
						</label>
					</div>
				</div>';
            }
            if (bsa_space($sid, 'cpc_contract_3') != NULL && bsa_space($sid, 'cpc_contract_3') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpc_3" type="radio" name="ad_limit_cpc" value="' . bsa_space($sid, 'cpc_contract_3') . '">
						<label for="bsa_pro_ad_limit_cpc_3">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpc_contract_3') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_clicks") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    $cpc_3 = bsa_space($sid, 'cpc_price') * (bsa_space($sid, 'cpc_contract_3') / bsa_space($sid, 'cpc_contract_1'));
                    $d_cpc_3 = bsa_space($sid, 'discount_3') > 0 ? $cpc_3 * (bsa_space($sid, 'discount_3') / 100) : 0;
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format($cpc_3 - $d_cpc_3) . $after . '</span>';
                    if (bsa_space($sid, 'discount_3') > 0) {
                        echo '<span class="bsaProDiscount">(-' . bsa_space($sid, 'discount_3') . '%)</span>';
                    }
                }
                echo '
						</label>
					</div>
				</div>';
            }
            echo '</div>';
        }
        if (bsa_space($sid, 'cpm_price') != NULL && bsa_space($sid, 'cpm_price') != 0.0 || $admin == 1 && bsa_space($sid, 'cpm_price') == 0.0 && bsa_role() == 'admin') {
            echo '<div class="bsaProInputsGroup bsaProInputsValues bsaProInputsValuesCPM" style="display: none;">';
            do_action('bsa-pro-billing-models-before', $sid, 'cpm', $before, $after);
            if (bsa_space($sid, 'cpm_contract_1') != NULL && bsa_space($sid, 'cpm_contract_1') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpm_1" type="radio" name="ad_limit_cpm" value="' . bsa_space($sid, 'cpm_contract_1') . '">
						<label for="bsa_pro_ad_limit_cpm_1">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpm_contract_1') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_views") . '</span>
							';
                if (isset($_POST['bsa_order'])) {
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format(bsa_space($sid, 'cpm_price')) . $after . '</span>';
                }
                echo '
						</label>
					</div>
				</div>';
            } elseif ($admin == 1 && bsa_space($sid, 'cpm_price') == 0.0 && bsa_role() == 'admin') {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<label for="bsa_pro_ad_limit_cpm_1">Display Limit (views)</label>
						<input id="bsa_pro_ad_limit_cpm_1" type="number" name="ad_limit_cpm" value="" style="margin-top:10px;width: 100%;">
					</div>
				</div>';
            }
            if (bsa_space($sid, 'cpm_contract_2') != NULL && bsa_space($sid, 'cpm_contract_2') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpm_2" type="radio" name="ad_limit_cpm" value="' . bsa_space($sid, 'cpm_contract_2') . '">
						<label for="bsa_pro_ad_limit_cpm_2">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpm_contract_2') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_views") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    $cpm_2 = bsa_space($sid, 'cpm_price') * (bsa_space($sid, 'cpm_contract_2') / bsa_space($sid, 'cpm_contract_1'));
                    $d_cpm_2 = bsa_space($sid, 'discount_2') > 0 ? $cpm_2 * (bsa_space($sid, 'discount_2') / 100) : 0;
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format($cpm_2 - $d_cpm_2) . $after . '</span>';
                    if (bsa_space($sid, 'discount_2') > 0) {
                        echo '<span class="bsaProDiscount">(-' . bsa_space($sid, 'discount_2') . '%)</span>';
                    }
                }
                echo '
						</label>
					</div>
				</div>';
            }
            if (bsa_space($sid, 'cpm_contract_3') != NULL && bsa_space($sid, 'cpm_contract_3') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpm_3" type="radio" name="ad_limit_cpm" value="' . bsa_space($sid, 'cpm_contract_3') . '">
						<label for="bsa_pro_ad_limit_cpm_3">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpm_contract_3') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_views") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    $cpm_3 = bsa_space($sid, 'cpm_price') * (bsa_space($sid, 'cpm_contract_3') / bsa_space($sid, 'cpm_contract_1'));
                    $d_cpm_3 = bsa_space($sid, 'discount_3') > 0 ? $cpm_3 * (bsa_space($sid, 'discount_3') / 100) : 0;
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format($cpm_3 - $d_cpm_3) . $after . '</span>';
                    if (bsa_space($sid, 'discount_3') > 0) {
                        echo '<span class="bsaProDiscount">(-' . bsa_space($sid, 'discount_3') . '%)</span>';
                    }
                }
                echo '
						</label>
					</div>
				</div>';
            }
            echo '</div>';
        }
        if (bsa_space($sid, 'cpd_price') != NULL && bsa_space($sid, 'cpd_price') != 0.0 || $admin == 1 && bsa_space($sid, 'cpd_price') == 0.0 && bsa_role() == 'admin') {
            echo '<div class="bsaProInputsGroup bsaProInputsValues bsaProInputsValuesCPD" style="display: none;">';
            do_action('bsa-pro-billing-models-before', $sid, 'cpd', $before, $after);
            if (bsa_space($sid, 'cpd_contract_1') != NULL && bsa_space($sid, 'cpd_contract_1') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpd_1" type="radio" name="ad_limit_cpd" value="' . bsa_space($sid, 'cpd_contract_1') . '">
						<label for="bsa_pro_ad_limit_cpd_1">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpd_contract_1') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_days") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format(bsa_space($sid, 'cpd_price')) . $after . '</span>';
                }
                echo '
						</label>
					</div>
				</div>';
            } elseif ($admin == 1 && bsa_space($sid, 'cpd_price') == 0.0 && bsa_role() == 'admin') {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<label for="bsa_pro_ad_limit_cpd_1">Display Limit (days)</label>
						<input id="bsa_pro_ad_limit_cpd_1" type="number" name="ad_limit_cpd" value="" style="margin-top:10px;width: 100%;">
					</div>
				</div>';
            }
            if (bsa_space($sid, 'cpd_contract_2') != NULL && bsa_space($sid, 'cpd_contract_2') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpd_2" type="radio" name="ad_limit_cpd" value="' . bsa_space($sid, 'cpd_contract_2') . '">
						<label for="bsa_pro_ad_limit_cpd_2">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpd_contract_2') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_days") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    $cpd_2 = bsa_space($sid, 'cpd_price') * (bsa_space($sid, 'cpd_contract_2') / bsa_space($sid, 'cpd_contract_1'));
                    $d_cpd_2 = bsa_space($sid, 'discount_2') > 0 ? $cpd_2 * (bsa_space($sid, 'discount_2') / 100) : 0;
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format($cpd_2 - $d_cpd_2) . $after . '</span>';
                    if (bsa_space($sid, 'discount_2') > 0) {
                        echo '<span class="bsaProDiscount">(-' . bsa_space($sid, 'discount_2') . '%)</span>';
                    }
                }
                echo '
						</label>
					</div>
				</div>';
            }
            if (bsa_space($sid, 'cpd_contract_3') != NULL && bsa_space($sid, 'cpd_contract_3') != 0) {
                echo '
				<div class="bsaProInput">
					<div class="bsaInputInner">
						<input id="bsa_pro_ad_limit_cpd_3" type="radio" name="ad_limit_cpd" value="' . bsa_space($sid, 'cpd_contract_3') . '">
						<label for="bsa_pro_ad_limit_cpd_3">
							<span class="bsaProExpiration">' . bsa_space($sid, 'cpd_contract_3') . ' ' . get_option("bsa_pro_plugin_trans_" . "form_right_days") . '</span>';
                if (isset($_POST['bsa_order'])) {
                    $cpd_3 = bsa_space($sid, 'cpd_price') * (bsa_space($sid, 'cpd_contract_3') / bsa_space($sid, 'cpd_contract_1'));
                    $d_cpd_3 = bsa_space($sid, 'discount_3') > 0 ? $cpd_3 * (bsa_space($sid, 'discount_3') / 100) : 0;
                    echo '<span class="bsaProPrice">' . $before . bsa_number_format($cpd_3 - $d_cpd_3) . $after . '</span>';
                    if (bsa_space($sid, 'discount_3') > 0) {
                        echo '<span class="bsaProDiscount">(-' . bsa_space($sid, 'discount_3') . '%)</span>';
                    }
                }
                echo '
						</label>
					</div>
				</div>';
            }
            echo '</div>';
        }
        if (isset($_POST['bsa_order'])) {
            do_action('bsa-pro-billing-models-callback-sub', $sid, $_POST['bsa_order'], $before, $after);
        }
    } else {
        echo 'Spaces can not be download.';
    }
    die;
}