| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} // Exit if accessed directly |
| 5 |
|
| 6 |
$wdm_auction_listing_nonce = wp_create_nonce( 'wdm_auction_listing_nonce' ); |
| 7 |
$default = array( |
| 8 |
array( |
| 9 |
'slug' => 'paypal', |
| 10 |
'label' => __( |
| 11 |
'PayPal', |
| 12 |
'wdm-ultimate-auction' |
| 13 |
), |
| 14 |
), |
| 15 |
array( |
| 16 |
'slug' => 'wire_transfer', |
| 17 |
'label' => __( |
| 18 |
'Wire Transfer', |
| 19 |
'wdm-ultimate-auction' |
| 20 |
), |
| 21 |
), |
| 22 |
array( |
| 23 |
'slug' => 'mailing_address', |
| 24 |
'label' => __( |
| 25 |
'Cheque', |
| 26 |
'wdm-ultimate-auction' |
| 27 |
), |
| 28 |
), |
| 29 |
array( |
| 30 |
'slug' => 'cash', |
| 31 |
'label' => __( 'Cash', 'wdm-ultimate-auction' ), |
| 32 |
), |
| 33 |
); |
| 34 |
?> |
| 35 |
<ul class="subsubsub"> |
| 36 |
<?php |
| 37 |
|
| 38 |
$link = ''; |
| 39 |
|
| 40 |
$methods = apply_filters( 'ua_add_payment_header_link', $default ); |
| 41 |
if ( ! isset( $wdm_auction_listing_nonce ) || ! wp_verify_nonce( $wdm_auction_listing_nonce, 'wdm_auction_listing_nonce' ) ) { |
| 42 |
wp_die( esc_html__( 'Nonce verification failed', 'wdm-ultimate-auction' ) ); |
| 43 |
} |
| 44 |
if ( isset( $_GET['method'] ) ) { |
| 45 |
$link = esc_attr( $_GET['method'] ); |
| 46 |
} |
| 47 |
|
| 48 |
foreach ( $methods as $list ) { |
| 49 |
if ( empty( $link ) ) { |
| 50 |
$link = 'paypal'; |
| 51 |
} |
| 52 |
|
| 53 |
?> |
| 54 |
<li> |
| 55 |
<a href="<?php echo esc_url( add_query_arg( 'method', $list['slug'], '?page=payment' ) ); ?>" class="<?php echo esc_attr( $link == $list['slug'] ? 'current' : '' ); ?>"> |
| 56 |
<?php echo esc_html( $list['label'] ); ?> |
| 57 |
</a>| |
| 58 |
</li> |
| 59 |
|
| 60 |
<?php |
| 61 |
} |
| 62 |
?> |
| 63 |
</ul> |
| 64 |
<p class="clear"> |
| 65 |
|
| 66 |
<?php |
| 67 |
if ( ! isset( $_GET['method'] ) || empty( $_GET['method'] ) || $_GET['method'] == 'paypal' ) { |
| 68 |
|
| 69 |
if ( isset( $_POST['wdm_paypal_address'] ) ) { |
| 70 |
update_option( 'wdm_paypal_address', esc_attr( $_POST['wdm_paypal_address'] ) ); |
| 71 |
} |
| 72 |
|
| 73 |
if ( isset( $_POST['wdm_account_mode'] ) ) { |
| 74 |
update_option( 'wdm_account_mode', esc_attr( $_POST['wdm_account_mode'] ) ); |
| 75 |
} |
| 76 |
|
| 77 |
do_action( 'ua_payment_update_settings_paypal', $_POST ); |
| 78 |
|
| 79 |
?> |
| 80 |
<form id="wdm-payment-form" class="auction_settings_section_style" action="" method="POST"> |
| 81 |
<?php echo '<h3>' . esc_html__( 'PayPal', 'wdm-ultimate-auction' ) . '</h3>'; ?> |
| 82 |
<table class="form-table"> |
| 83 |
<tr valign="top"> |
| 84 |
<th scope="row"> |
| 85 |
<label for="wdm_paypal_id"><?php esc_html_e( 'PayPal Email Address', 'wdm-ultimate-auction' ); ?></label> |
| 86 |
</th> |
| 87 |
<td> |
| 88 |
<input class="wdm_settings_input email" type="text" id="wdm_paypal_id" name="wdm_paypal_address" value="<?php echo esc_attr( get_option( 'wdm_paypal_address' ) ); ?>" /> |
| 89 |
|
| 90 |
<?php //echo wp_kses_post( paypal_auto_return_url_notes() ); ?> |
| 91 |
|
| 92 |
<?php |
| 93 |
|
| 94 |
$allowed_html = wp_kses_allowed_html('post') + array( 'script' => array( 'type' => true ) ); |
| 95 |
echo wp_kses( paypal_auto_return_url_notes(), $allowed_html ); |
| 96 |
|
| 97 |
//echo paypal_auto_return_url_notes(); |
| 98 |
|
| 99 |
?> |
| 100 |
|
| 101 |
|
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
<tr valign="top"> |
| 105 |
<th scope="row"> |
| 106 |
<label for="wdm_account_mode_id"><?php esc_html_e( 'PayPal Account Type', 'wdm-ultimate-auction' ); ?></label> |
| 107 |
</th> |
| 108 |
<td> |
| 109 |
<?php |
| 110 |
$options = array( 'Live', 'Sandbox' ); |
| 111 |
add_option( 'wdm_account_mode', 'Live' ); |
| 112 |
foreach ( $options as $option ) { |
| 113 |
$checked = ( get_option( 'wdm_account_mode' ) == $option ) ? ' checked="checked" ' : ''; |
| 114 |
echo '<input ' . esc_attr( $checked ) . ' value="' . esc_attr( $option ) . '" name="wdm_account_mode" type="radio" /> ' . esc_html( $option ) . ' <br />'; |
| 115 |
} |
| 116 |
|
| 117 |
/* translators: %s is sandbox paypal */ |
| 118 |
printf( "<div class='ult-auc-settings-tip'>" . esc_html__( "Select 'Sandbox' option when testing with your %s email address.", 'wdm-ultimate-auction' ) . '</div>', 'sandbox PayPal' ); |
| 119 |
|
| 120 |
|
| 121 |
?> |
| 122 |
</td> |
| 123 |
</tr> |
| 124 |
</table> |
| 125 |
<?php |
| 126 |
do_action( 'ua_payment_register_settings_paypal' ); |
| 127 |
submit_button( __( 'Save Changes', 'wdm-ultimate-auction' ) ); |
| 128 |
?> |
| 129 |
</form> |
| 130 |
<?php |
| 131 |
} elseif ( isset( $_GET['method'] ) && ( $_GET['method'] == 'wire_transfer' ) ) { |
| 132 |
if ( isset( $_POST['wdm_wire_transfer'] ) ) { |
| 133 |
update_option( 'wdm_wire_transfer', esc_attr( $_POST['wdm_wire_transfer'] ) ); |
| 134 |
} |
| 135 |
|
| 136 |
?> |
| 137 |
<form id="wdm-payment-form" class="auction_settings_section_style" action="" method="POST"> |
| 138 |
<?php echo '<h3>' . esc_html__( 'Wire Transfer', 'wdm-ultimate-auction' ) . '</h3>'; ?> |
| 139 |
<table class="form-table"> |
| 140 |
<tr valign="top"> |
| 141 |
<th scope="row"> |
| 142 |
<label for="wdm_wire_transfer_id"><?php esc_html_e( 'Wire Transfer Details', 'wdm-ultimate-auction' ); ?></label> |
| 143 |
</th> |
| 144 |
<td> |
| 145 |
<textarea class="wdm_settings_input" id="wdm_wire_transfer_id" name="wdm_wire_transfer"><?php echo esc_attr( get_option( 'wdm_wire_transfer' ) ); ?></textarea> |
| 146 |
<br /> |
| 147 |
<div class="ult-auc-settings-tip"><?php esc_html_e( 'Enter your wire transfer details. This will be sent to the highest bidder.', 'wdm-ultimate-auction' ); ?></div> |
| 148 |
</td> |
| 149 |
</tr> |
| 150 |
</table> |
| 151 |
<?php submit_button( esc_html__( 'Save Changes', 'wdm-ultimate-auction' ) ); ?> |
| 152 |
</form> |
| 153 |
<?php |
| 154 |
} elseif ( isset( $_GET['method'] ) && ( $_GET['method'] == 'mailing_address' ) ) { |
| 155 |
if ( isset( $_POST['wdm_mailing_address'] ) ) { |
| 156 |
update_option( 'wdm_mailing_address', esc_attr( $_POST['wdm_mailing_address'] ) ); |
| 157 |
} |
| 158 |
|
| 159 |
?> |
| 160 |
<form id="wdm-payment-form" class="auction_settings_section_style" action="" method="POST"> |
| 161 |
<?php echo '<h3>' . esc_html__( 'Cheque', 'wdm-ultimate-auction' ) . '</h3>'; ?> |
| 162 |
<table class="form-table"> |
| 163 |
<tr valign="top"> |
| 164 |
<th scope="row"> |
| 165 |
<label for="wdm_mailing_id"><?php esc_html_e( 'Mailing Address & Cheque Details', 'wdm-ultimate-auction' ); ?></label> |
| 166 |
</th> |
| 167 |
<td> |
| 168 |
<textarea class="wdm_settings_input" id="wdm_mailing_id" name="wdm_mailing_address"><?php echo esc_attr( get_option( 'wdm_mailing_address' ) ); ?></textarea> |
| 169 |
<div class="ult-auc-settings-tip"><?php esc_html_e( 'Enter your mailing address where you want to receive checks by mail. This will be sent to the highest bidder.', 'wdm-ultimate-auction' ); ?></div> |
| 170 |
</td> |
| 171 |
</tr> |
| 172 |
</table> |
| 173 |
<?php submit_button( esc_html__( 'Save Changes', 'wdm-ultimate-auction' ) ); ?> |
| 174 |
</form> |
| 175 |
<?php |
| 176 |
} elseif ( isset( $_GET['method'] ) && ( $_GET['method'] == 'cash' ) ) { |
| 177 |
|
| 178 |
if ( isset( $_POST['wdm_cash'] ) ) { |
| 179 |
update_option( 'wdm_cash', esc_attr( $_POST['wdm_cash'] ) ); |
| 180 |
} |
| 181 |
?> |
| 182 |
<form id="wdm-payment-form" class="auction_settings_section_style" action="" method="POST"> |
| 183 |
<?php echo '<h3>' . esc_html__( 'Cash', 'wdm-ultimate-auction' ) . '</h3>'; ?> |
| 184 |
<table class="form-table"> |
| 185 |
<tr valign="top"> |
| 186 |
<th scope="row"> |
| 187 |
<label for="wdm_cash_id"><?php esc_html_e( 'Customer Message (optional)', 'wdm-ultimate-auction' ); ?></label> |
| 188 |
</th> |
| 189 |
<td> |
| 190 |
<textarea class="wdm_settings_input" id="wdm_cash_id" name="wdm_cash"><?php echo esc_attr( get_option( 'wdm_cash' ) ); ?></textarea> |
| 191 |
<div class="ult-auc-settings-tip"><?php esc_html_e( 'By choosing this payment method, PRO would send a congratulatory email mentioning that final bidder should pay in cash the final bidding amount to auctioneer for the auctioned item.', 'wdm-ultimate-auction' ); ?></div> |
| 192 |
</td> |
| 193 |
</tr> |
| 194 |
</table> |
| 195 |
<?php submit_button( esc_html__( 'Save Changes', 'wdm-ultimate-auction' ) ); ?> |
| 196 |
</form> |
| 197 |
<?php |
| 198 |
} elseif ( isset( $_GET['method'] ) ) { |
| 199 |
do_action( 'ua_payment_register_settings', esc_attr( $_GET['method'] ) ); |
| 200 |
} |
| 201 |
|
| 202 |
|