name = __( 'Paypal', 'appointments' ); } public function get_defaults() { return array( 'item_name' => array( 'type' => 'text', 'name' => __( 'Item Name', 'appointments' ), 'value' => __( 'Payment for SERVICE', 'appointments' ), 'help' => __( 'Item name that will be seen on Paypal. Default: "Payment for SERVICE" if deposit is not asked, "Deposit for SERVICE" if deposit is asked', 'appointments' ), ), 'button_text' => array( 'type' => 'text', 'name' => __( 'Button Text', 'appointments' ), 'value' => __( 'Please confirm PRICE CURRENCY payment for SERVICE', 'appointments' ), 'help' => __( 'Text that will be displayed on Paypal button. Default: "Please confirm PRICE CURRENCY payment for SERVICE"', 'appointments' ), ), ); } public function get_usage_info() { return '' . __( 'Inserts PayPal Pay button and form.', 'appointments' ) . '
' . __( 'For the shortcode parameters, you can use SERVICE, PRICE, CURRENCY placeholders which will be replaced by their real values.', 'appointments' ) . ''; } public function process_shortcode( $args = array(), $content = '' ) { extract( wp_parse_args( $args, $this->_defaults_to_args() ) ); global $post, $current_user, $appointments; if ( 'Payment for SERVICE' == $item_name && ( ( isset( $appointments->options["percent_deposit"] ) && $appointments->options["percent_deposit"] ) || ( isset( $appointments->options["fixed_deposit"] ) && $appointments->options["fixed_deposit"] ) ) ) { $item_name = __( 'Deposit for SERVICE', 'appointments' ); } $item_name = apply_filters( 'app_paypal_item_name', $item_name ); // Let's be on the safe side and select the default currency if ( empty( $appointments->options['currency'] ) ) { $appointments->options['currency'] = 'USD'; } if ( ! isset( $appointments->options["return"] ) || ! $return = get_permalink( $appointments->options["return"] ) ) { $return = get_permalink( $post->ID ); } // Never let an undefined page, just in case if ( ! $return ) { $return = home_url(); } $return = apply_filters( 'app_paypal_return', $return ); $cancel_return = apply_filters( 'app_paypal_cancel_return', get_option( 'home' ) ); $form = ''; $form .= '
'; if ( $appointments->options['mode'] == 'live' ) { $form .= '
'; } else { $form .= ''; } $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; $form .= ''; // They say Paypal uses this for tracking. I would prefer to remove it if it is not mandatory. $form .= ''; $form = apply_filters( 'app_paypal_additional_fields', $form, $appointments->location, $appointments->service, $appointments->worker ); $form .= '
'; $form .= '
'; return $form; } } }