Skip to content

Commit 2aa2216

Browse files
format code
1 parent 3132583 commit 2aa2216

File tree

1 file changed

+103
-103
lines changed

1 file changed

+103
-103
lines changed

public/class-paystack-forms-public.php

Lines changed: 103 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,118 +2023,118 @@ function kkd_pff_paystack_form_shortcode($atts) {
20232023
</div>';
20242024

20252025
// Amount selection with consideration for variable amounts, minimum payments, and recurring plans
2026-
echo '<div class="span12 unit">
2027-
<label class="label">Amount (' . esc_html($currency);
2028-
if ($minimum == 0 && $amount != 0 && $usequantity == 'yes') {
2029-
echo ' ' . esc_html(number_format($amount));
2030-
}
2031-
echo ') <span>*</span></label>
2032-
<div class="input">';
2026+
echo '<div class="span12 unit">
2027+
<label class="label">Amount (' . esc_html($currency);
2028+
if ($minimum == 0 && $amount != 0 && $usequantity == 'yes') {
2029+
echo ' ' . esc_html(number_format($amount));
2030+
}
2031+
echo ') <span>*</span></label>
2032+
<div class="input">';
20332033

2034-
if ($usevariableamount == 0) {
2035-
if ($minimum == 1) {
2036-
echo '<small> Minimum payable amount <b style="font-size:87% !important;">' . esc_html($currency) . ' ' . esc_html(number_format($amount)) . '</b></small>';
2037-
}
2038-
if ($recur == 'plan') {
2039-
if ($showbtn) {
2040-
echo '<input type="text" name="pf-amount" value="' . esc_attr($planamount) . '" id="pf-amount" readonly required />';
2041-
} else {
2042-
echo '<div class="span12 unit">
2043-
<label class="label" style="font-size:18px;font-weight:600;line-height: 20px;">' . esc_html($planerrorcode) . '</label>
2044-
</div>';
2045-
}
2046-
} elseif ($recur == 'optional') {
2047-
echo '<input type="text" name="pf-amount" class="pf-number" id="pf-amount" value="0" required />';
2048-
} else {
2049-
echo '<input type="text" name="pf-amount" class="pf-number" value="' . esc_attr($amount == 0 ? "0" : $amount) . '" id="pf-amount" ' . ($amount != 0 && $minimum != 1 ? 'readonly' : '') . ' required />';
2050-
}
2051-
} else {
2052-
if ($usevariableamount == "") {
2053-
echo "Form Error, set variable amount string";
2054-
} else {
2055-
if (count($paymentoptions) > 0) {
2056-
echo '<div class="select">
2057-
<input type="hidden" id="pf-vname" name="pf-vname" />
2058-
<input type="hidden" id="pf-amount" />
2059-
<select class="form-control" id="pf-vamount" name="pf-amount">';
2060-
foreach ($paymentoptions as $option) {
2061-
list($optionName, $optionValue) = explode(':', $option);
2062-
echo '<option value="' . esc_attr($optionValue) . '">' . esc_html($optionName) . '(' . esc_html(number_format($optionValue)) . ')</option>';
2063-
}
2064-
echo '</select> <i></i> </div>';
2065-
}
2066-
}
2067-
}
2034+
if ($usevariableamount == 0) {
2035+
if ($minimum == 1) {
2036+
echo '<small> Minimum payable amount <b style="font-size:87% !important;">' . esc_html($currency) . ' ' . esc_html(number_format($amount)) . '</b></small>';
2037+
}
2038+
if ($recur == 'plan') {
2039+
if ($showbtn) {
2040+
echo '<input type="text" name="pf-amount" value="' . esc_attr($planamount) . '" id="pf-amount" readonly required />';
2041+
} else {
2042+
echo '<div class="span12 unit">
2043+
<label class="label" style="font-size:18px;font-weight:600;line-height: 20px;">' . esc_html($planerrorcode) . '</label>
2044+
</div>';
2045+
}
2046+
} elseif ($recur == 'optional') {
2047+
echo '<input type="text" name="pf-amount" class="pf-number" id="pf-amount" value="0" required />';
2048+
} else {
2049+
echo '<input type="text" name="pf-amount" class="pf-number" value="' . esc_attr($amount == 0 ? "0" : $amount) . '" id="pf-amount" ' . ($amount != 0 && $minimum != 1 ? 'readonly' : '') . ' required />';
2050+
}
2051+
} else {
2052+
if ($usevariableamount == "") {
2053+
echo "Form Error, set variable amount string";
2054+
} else {
2055+
if (count($paymentoptions) > 0) {
2056+
echo '<div class="select">
2057+
<input type="hidden" id="pf-vname" name="pf-vname" />
2058+
<input type="hidden" id="pf-amount" />
2059+
<select class="form-control" id="pf-vamount" name="pf-amount">';
2060+
foreach ($paymentoptions as $option) {
2061+
list($optionName, $optionValue) = explode(':', $option);
2062+
echo '<option value="' . esc_attr($optionValue) . '">' . esc_html($optionName) . '(' . esc_html(number_format($optionValue)) . ')</option>';
2063+
}
2064+
echo '</select> <i></i> </div>';
2065+
}
2066+
}
2067+
}
20682068

2069-
// Transaction charge notice
2070-
if ($txncharge != 'merchant' && $recur != 'plan') {
2071-
echo '<small>Transaction Charge: <b class="pf-txncharge"></b>, Total:<b class="pf-txntotal"></b></small>';
2072-
}
2069+
// Transaction charge notice
2070+
if ($txncharge != 'merchant' && $recur != 'plan') {
2071+
echo '<small>Transaction Charge: <b class="pf-txncharge"></b>, Total:<b class="pf-txntotal"></b></small>';
2072+
}
20732073

2074-
echo '</div></div>';
2075-
2076-
// Quantity selection
2077-
if ($recur == 'no' && $usequantity == 'yes' && ($usevariableamount == 1 || $amount != 0)) {
2078-
echo '<div class="span12 unit">
2079-
<label class="label">Quantity</label>
2080-
<div class="select">
2081-
<input type="hidden" value="' . esc_attr($amount) . '" id="pf-qamount"/>
2082-
<select class="form-control" id="pf-quantity" name="pf-quantity">';
2083-
for ($i = 1; $i <= $quantity; $i++) {
2084-
echo '<option value="' . esc_attr($i) . '">' . esc_html($i) . '</option>';
2085-
}
2086-
echo '</select> <i></i> </div></div>';
2087-
}
2074+
echo '</div></div>';
20882075

2089-
// Recurring payment options
2090-
if ($recur == 'optional') {
2091-
echo '<div class="span12 unit">
2092-
<label class="label">Recurring Payment</label>
2093-
<div class="select">
2094-
<select class="form-control" name="pf-interval">';
2095-
$intervals = ['no' => 'None', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly', 'biannually' => 'Biannually', 'annually' => 'Annually'];
2096-
foreach ($intervals as $intervalValue => $intervalName) {
2097-
echo '<option value="' . esc_attr($intervalValue) . '">' . esc_html($intervalName) . '</option>';
2098-
}
2099-
echo '</select> <i></i> </div></div>';
2100-
}
2076+
// Quantity selection
2077+
if ($recur == 'no' && $usequantity == 'yes' && ($usevariableamount == 1 || $amount != 0)) {
2078+
echo '<div class="span12 unit">
2079+
<label class="label">Quantity</label>
2080+
<div class="select">
2081+
<input type="hidden" value="' . esc_attr($amount) . '" id="pf-qamount"/>
2082+
<select class="form-control" id="pf-quantity" name="pf-quantity">';
2083+
for ($i = 1; $i <= $quantity; $i++) {
2084+
echo '<option value="' . esc_attr($i) . '">' . esc_html($i) . '</option>';
2085+
}
2086+
echo '</select> <i></i> </div></div>';
2087+
}
21012088

2102-
// Plan details for recurring payments
2103-
if ($recur == 'plan' && $showbtn) {
2104-
echo '<input type="hidden" name="pf-plancode" value="' . esc_attr($recurplan) . '" />';
2105-
echo '<div class="span12 unit">
2106-
<label class="label" style="font-size:18px;font-weight:600;line-height: 20px;">' . esc_html($plan->data->name) . ' ' . esc_html($plan->data->interval) . ' recurring payment - ' . esc_html($plan->data->currency) . ' ' . esc_html(number_format($planamount)) . '</label>
2107-
</div>';
2108-
}
2109-
echo(do_shortcode($obj->post_content));
2110-
2111-
// Agreement terms
2112-
if ($useagreement == 'yes') {
2113-
echo '<div class="span12 unit">
2114-
<label class="checkbox">
2115-
<input type="checkbox" name="agreement" id="pf-agreement" required value="yes">
2116-
<i></i>
2117-
Accept terms <a target="_blank" href="' . esc_url($agreementlink) . '">Link</a>
2118-
</label>
2119-
</div><br>';
2120-
}
2089+
// Recurring payment options
2090+
if ($recur == 'optional') {
2091+
echo '<div class="span12 unit">
2092+
<label class="label">Recurring Payment</label>
2093+
<div class="select">
2094+
<select class="form-control" name="pf-interval">';
2095+
$intervals = ['no' => 'None', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly', 'biannually' => 'Biannually', 'annually' => 'Annually'];
2096+
foreach ($intervals as $intervalValue => $intervalName) {
2097+
echo '<option value="' . esc_attr($intervalValue) . '">' . esc_html($intervalName) . '</option>';
2098+
}
2099+
echo '</select> <i></i> </div></div>';
2100+
}
2101+
2102+
// Plan details for recurring payments
2103+
if ($recur == 'plan' && $showbtn) {
2104+
echo '<input type="hidden" name="pf-plancode" value="' . esc_attr($recurplan) . '" />';
2105+
echo '<div class="span12 unit">
2106+
<label class="label" style="font-size:18px;font-weight:600;line-height: 20px;">' . esc_html($plan->data->name) . ' ' . esc_html($plan->data->interval) . ' recurring payment - ' . esc_html($plan->data->currency) . ' ' . esc_html(number_format($planamount)) . '</label>
2107+
</div>';
2108+
}
2109+
echo(do_shortcode($obj->post_content));
21212110

2111+
// Agreement terms
2112+
if ($useagreement == 'yes') {
2113+
echo '<div class="span12 unit">
2114+
<label class="checkbox">
2115+
<input type="checkbox" name="agreement" id="pf-agreement" required value="yes">
2116+
<i></i>
2117+
Accept terms <a target="_blank" href="' . esc_url($agreementlink) . '">Link</a>
2118+
</label>
2119+
</div><br>';
2120+
}
21222121

2123-
// Form submission controls
2124-
echo '<div class="span12 unit">
2125-
<small><span style="color: red;">*</span> are compulsory</small><br />
2126-
<img src="' . esc_url(plugins_url('../images/[email protected]', __FILE__)) . '" alt="cardlogos" class="paystack-cardlogos size-full wp-image-1096" />
2127-
<button type="reset" class="secondary-btn">Reset</button>';
2128-
if ($showbtn) {
2129-
echo '<button type="submit" class="primary-btn">' . esc_html($paybtn) . '</button>';
2130-
}
2131-
echo '</div></div></form>';
2132-
} else {
2133-
echo "<h5>You must be logged in to make a payment.</h5>";
2134-
}
2122+
2123+
// Form submission controls
2124+
echo '<div class="span12 unit">
2125+
<small><span style="color: red;">*</span> are compulsory</small><br />
2126+
<img src="' . esc_url(plugins_url('../images/[email protected]', __FILE__)) . '" alt="cardlogos" class="paystack-cardlogos size-full wp-image-1096" />
2127+
<button type="reset" class="secondary-btn">Reset</button>';
2128+
if ($showbtn) {
2129+
echo '<button type="submit" class="primary-btn">' . esc_html($paybtn) . '</button>';
2130+
}
2131+
echo '</div></div></form>';
21352132
} else {
2136-
echo "<h5>Invalid Paystack form ID or the form does not exist.</h5>";
2133+
echo "<h5>You must be logged in to make a payment.</h5>";
21372134
}
2135+
} else {
2136+
echo "<h5>Invalid Paystack form ID or the form does not exist.</h5>";
2137+
}
21382138
} else {
21392139
echo "<h5>No Paystack form ID provided.</h5>";
21402140
}

0 commit comments

Comments
 (0)