/** * Protected constructor to prevent creating a new instance of the * *Singleton* via the `new` operator from outside of this class. */ protected function __construct() { add_action( 'prefive_payments_withdraw_options', array( $this, 'show_request_withdraw_payments' ), 10, 2 ); add_filter( 'prefive_withdraw_method', array( $this, 'withdraw_method' ) ); } /* * Display Request Withdrawal Method for manual and automated payment withdraw in user's payment * This function is hooked to 'prefive_payments_withdraw_options' action, which is used to display Request Withdrawal Method for manual and automated payment withdraw in user's payment. */ function show_request_withdraw_payments( $uid, $prefive_currency_position ) { if ( get_option( 'prefive_enable_sample_withdraw' ) != "no" ) { if ( get_user_meta( $uid, 'sample_payment_email', true ) != '' ) { ?> <!-- Display Request Withdrawal Method for manual payment withdraw --> <div class="ui divider"></div> <div class="sixteen wide column"> <form class="ui form" method="post" enctype="application/x-www-form-urlencoded"> <div class="field"> <div class="three fields no-bottom-margin"> <input type="hidden" value="<?php echo current_time( 'timestamp', 1 ) ?>" name="tm_tm" /> <div class="eight wide field withdraw-column"> <div class="withdraw-title"> <?php _e( 'Sample', 'prefive-sample' ); ?> </div> </div> <div class="four wide field"> <div class="ui labeled input"> <label class="ui label"><?php echo prefive_get_currency_symbol( prefive_get_currency() ); ?></label> <input class="" value="<?php if ( isset( $_POST['amount4'] ) ) echo $_POST['amount4']; ?>" type="text" size="10" name="amount4" /> </div> <input value="<?php echo __( 'Sample Email', 'prefive-sample' ) . ': ' . get_user_meta( $uid, 'sample_payment_email', true ); ?>" type="hidden" size="30" name="paypal" /> </div> <div class="four wide field"> <input class="withpaypal ui button secondary nomargin fluid" data-alert-message="<?php echo __( 'Error', 'prefive-sample' ) ?>" type="submit" name="withdraw4" value="<?php _e( 'Withdraw', 'prefive-sample' ); ?>" /> </div> </div> </div> </form> </div> <?php } else { ?> <div class="ui divider"></div> <div class="eight wide column"><?php _e( 'Sample', 'prefive' ); ?></div> <div class="eight wide column"><?php echo sprintf( __( 'Please fill your Sample email <a href="%s" class="fill-payment-color">here</a>.', 'prefive' ), get_permalink( get_option( 'prefive_my_account_personal_info_page_id' ) ) . 'payments/#sample-payments' ); ?></div> <?php } } if ( get_option( 'prefive_enable_sample_withdraw_automatic' ) == "yes" ) { if ( get_user_meta( $uid, 'sample_automatic_payee_id', true ) != '' ) { ?> <!-- Display Request Withdrawal Method for automated payment withdraw --> <div class="ui divider"></div> <div class="sixteen wide column"> <form class="ui form" method="post" enctype="application/x-www-form-urlencoded"> <div class="field"> <div class="three fields no-bottom-margin"> <input type="hidden" value="<?php echo current_time( 'timestamp', 1 ) ?>" name="tm_tm" /> <div class="eight wide field withdraw-column"> <div class="withdraw-title"><?php _e( 'Automated Sample', 'prefive-sample' ); ?></div> </div> <div class="four wide field"> <div class="ui labeled input"> <label class="ui label"><?php echo prefive_get_currency_symbol( prefive_get_currency() ); ?></label> <input class="" value="<?php if ( isset( $_POST['amount5'] ) ) echo $_POST['amount5']; ?>" type="text" size="10" name="amount5" /> </div> <input value="<?php echo __( 'Sample Payee ID','prefive' ) . ': ' . get_user_meta( $uid, 'sample_automatic_payee_id', true ); ?>" type="hidden" size="30" name="paypal" /> </div> <div class="four wide field"> <input class="withpaypal ui button secondary nomargin fluid" data-alert-message="<?php echo __( 'Error', 'prefive-sample' ) ?>" type="submit" name="withdraw5" value="<?php _e( 'Withdraw', 'prefive-sample' ); ?>" /> </div> </div> </div> </form> </div> <?php } else { ?> <div class="ui divider"></div> <div class="eight wide column"><?php _e( 'Automated Sample', 'prefive-sample' ); ?></div> <div class="eight wide column"><?php echo sprintf( __( 'Please fill your Sample details <a href="%s" class="fill-payment-color">here</a>.', 'prefive' ), get_permalink( get_option( 'prefive_my_account_personal_info_page_id' ) ) . 'payments/#automated-sample-payments' ); ?></div> <?php } } } /* * Define the withdraw method for withdrawal orders * This function is filtering the withdraw method name in withdrawal orders admin. */ function withdraw_method( $method ) { if ( isset( $_POST['withdraw4'] ) ) { $method = __( "Sample", 'prefive-sample' ); } if ( isset( $_POST['withdraw5'] ) ) { $method = __( "Sample (automatic withdrawal)", 'prefive-sample' ); } return $method; }