| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | class FrmTransLiteAction extends FrmFormAction { |
| 7 | 7 | |
| 8 | 8 | public function __construct() { |
| 9 | 9 | $action_ops = array( |
| 10 | - 'classes' => 'frm_stripe_icon frm_credit_card_alt_icon frm_icon_font', | |
| 10 | + 'classes' => 'frm_stripe_icon frm_credit_card_alt_icon frmfont', | |
| 11 | 11 | // This is 99 in the Payments submodule but Stripe Lite only supports a single action. |
| 12 | 12 | 'limit' => 1, |
| 13 | 13 | 'active' => true, |
| 14 | 14 | // After user registration. |
| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | 'active' => true, |
| 14 | 14 | // After user registration. |
| 15 | 15 | 'priority' => 45, |
| 16 | 16 | 'event' => array( 'create' ), |
| 17 | - 'color' => 'var(--green)', | |
| 17 | + 'color' => '#3fac25', | |
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | 20 | $this->FrmFormAction( 'payment', __( 'Collect a Payment', 'formidable' ), $action_ops ); |
| 21 | 21 | } |
| @@ -51,8 +51,9 @@ | ||
| 51 | 51 | * |
| 52 | 52 | * @since 6.5 |
| 53 | 53 | * |
| 54 | 54 | * @param string $selected_gateway The selected gateway for the given payment action. |
| 55 | + * | |
| 55 | 56 | * @return void |
| 56 | 57 | */ |
| 57 | 58 | public function echo_capture_payment_upsell( $selected_gateway = 'stripe' ) { |
| 58 | 59 | // Add an upsell placeholder for the capture payment setting. |
| @@ -57,8 +58,9 @@ | ||
| 57 | 58 | public function echo_capture_payment_upsell( $selected_gateway = 'stripe' ) { |
| 58 | 59 | // Add an upsell placeholder for the capture payment setting. |
| 59 | 60 | $upgrading = FrmAddonsController::install_link( 'stripe' ); |
| 60 | 61 | $upgrade_params = array(); |
| 62 | + | |
| 61 | 63 | if ( isset( $upgrading['url'] ) ) { |
| 62 | 64 | $upgrade_params['data-oneclick'] = json_encode( $upgrading ); |
| 63 | 65 | } else { |
| 64 | 66 | $upgrade_params['data-requires'] = FrmAddonsController::get_addon_required_plan( 28136428 ); |
| @@ -84,8 +86,14 @@ | ||
| 84 | 86 | 'gateway' => array(), |
| 85 | 87 | 'credit_card' => '', |
| 86 | 88 | 'billing_first_name' => '', |
| 87 | 89 | 'billing_last_name' => '', |
| 90 | + 'billing_address' => '', | |
| 91 | + 'shipping_email' => '', | |
| 92 | + 'shipping_first_name' => '', | |
| 93 | + 'shipping_last_name' => '', | |
| 94 | + 'shipping_address' => '', | |
| 95 | + 'entry_data_sync' => 'overwrite', | |
| 88 | 96 | ); |
| 89 | 97 | return (array) apply_filters( 'frm_pay_action_defaults', $defaults ); |
| 90 | 98 | } |
| 91 | 99 | |
| @@ -96,8 +104,9 @@ | ||
| 96 | 104 | */ |
| 97 | 105 | private function default_currency() { |
| 98 | 106 | $frm_settings = FrmAppHelper::get_settings(); |
| 99 | 107 | $currency = trim( $frm_settings->currency ); |
| 108 | + | |
| 100 | 109 | if ( ! $currency ) { |
| 101 | 110 | $currency = 'USD'; |
| 102 | 111 | } |
| 103 | 112 | |
| @@ -105,12 +114,12 @@ | ||
| 105 | 114 | } |
| 106 | 115 | |
| 107 | 116 | /** |
| 108 | 117 | * @param mixed $form_id |
| 118 | + * | |
| 109 | 119 | * @return array |
| 110 | 120 | */ |
| 111 | 121 | public function get_field_options( $form_id ) { |
| 112 | - | |
| 113 | 122 | $form_id = absint( $form_id ); |
| 114 | 123 | $form_ids = $form_id; |
| 115 | 124 | |
| 116 | 125 | /** |
| @@ -122,9 +131,9 @@ | ||
| 122 | 131 | * @param int $form_id |
| 123 | 132 | */ |
| 124 | 133 | $form_ids = apply_filters( 'frm_trans_action_get_field_options_form_id', $form_ids, $form_id ); |
| 125 | 134 | |
| 126 | - $form_fields = FrmField::getAll( | |
| 135 | + return FrmField::getAll( | |
| 127 | 136 | array( |
| 128 | 137 | 'fi.form_id' => $form_ids, |
| 129 | 138 | 'fi.type not' => array( 'divider', 'end_divider', 'html', 'break', 'captcha', 'rte', 'form' ), |
| 130 | 139 | ), |
| @@ -129,10 +138,8 @@ | ||
| 129 | 138 | 'fi.type not' => array( 'divider', 'end_divider', 'html', 'break', 'captcha', 'rte', 'form' ), |
| 130 | 139 | ), |
| 131 | 140 | 'field_order' |
| 132 | 141 | ); |
| 133 | - | |
| 134 | - return $form_fields; | |
| 135 | 142 | } |
| 136 | 143 | |
| 137 | 144 | /** |
| 138 | 145 | * Get the ID of the credit card field. |
| @@ -139,8 +146,9 @@ | ||
| 139 | 146 | * We assume there is only a single credit card field in Stripe Lite. |
| 140 | 147 | * This is saved as part of the Stripe payment action. |
| 141 | 148 | * |
| 142 | 149 | * @param array $form_atts |
| 150 | + * | |
| 143 | 151 | * @return int |
| 144 | 152 | */ |
| 145 | 153 | public function get_credit_card_field_id( $form_atts ) { |
| 146 | 154 | $field_id = 0; |
| @@ -162,8 +170,9 @@ | ||
| 162 | 170 | * @since 6.18 The `$field_atts` might contain `skipped_fields`. By default, the submit field is skipped. |
| 163 | 171 | * |
| 164 | 172 | * @param array $form_atts |
| 165 | 173 | * @param array $field_atts |
| 174 | + * | |
| 166 | 175 | * @return void |
| 167 | 176 | */ |
| 168 | 177 | public function show_fields_dropdown( $form_atts, $field_atts ) { |
| 169 | 178 | if ( ! isset( $field_atts['allowed_fields'] ) ) { |
| @@ -174,9 +183,11 @@ | ||
| 174 | 183 | $field_atts['skipped_fields'] = array( FrmSubmitHelper::FIELD_TYPE ); |
| 175 | 184 | } |
| 176 | 185 | |
| 177 | 186 | $has_field = false; |
| 187 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 178 | 188 | ?> |
| 189 | + <?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 179 | 190 | <select class="frm_with_left_label" name="<?php echo esc_attr( $this->get_field_name( $field_atts['name'] ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( $field_atts['name'] ) ); ?>"> |
| 180 | 191 | <option value=""><?php esc_html_e( '— Select —' ); ?></option> |
| 181 | 192 | <?php |
| 182 | 193 | foreach ( $form_atts['form_fields'] as $field ) { |
| @@ -192,15 +203,17 @@ | ||
| 192 | 203 | |
| 193 | 204 | $has_field = true; |
| 194 | 205 | $key_exists = array_key_exists( $field_atts['name'], $form_atts['form_action']->post_content ); |
| 195 | 206 | ?> |
| 207 | + <?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 196 | 208 | <option value="<?php echo esc_attr( $field->id ); ?>" <?php selected( $key_exists ? $form_atts['form_action']->post_content[ $field_atts['name'] ] : 0, $field->id ); ?>> |
| 197 | 209 | <?php |
| 198 | - echo esc_attr( FrmAppHelper::truncate( $field->name, 50, 1 ) ); | |
| 210 | + echo esc_html( FrmAppHelper::truncate( $field->name, 50, 1 ) ); | |
| 199 | 211 | |
| 200 | 212 | if ( 'name' === $field->type && isset( $field_atts['name'] ) ) { |
| 201 | 213 | switch ( $field_atts['name'] ) { |
| 202 | 214 | case 'billing_first_name': |
| 215 | + case 'shipping_first_name': | |
| 203 | 216 | echo ' ('; |
| 204 | 217 | esc_html_e( 'First', 'formidable' ); |
| 205 | 218 | echo ')'; |
| 206 | 219 | break; |
| @@ -205,8 +218,9 @@ | ||
| 205 | 218 | echo ')'; |
| 206 | 219 | break; |
| 207 | 220 | |
| 208 | 221 | case 'billing_last_name': |
| 222 | + case 'shipping_last_name': | |
| 209 | 223 | echo ' ('; |
| 210 | 224 | esc_html_e( 'Last', 'formidable' ); |
| 211 | 225 | echo ')'; |
| 212 | 226 | break; |
| @@ -231,8 +245,9 @@ | ||
| 231 | 245 | } |
| 232 | 246 | ?> |
| 233 | 247 | </select> |
| 234 | 248 | <?php |
| 249 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 235 | 250 | } |
| 236 | 251 | |
| 237 | 252 | public static function get_single_action_type( $action_id, $type = '' ) { |
| 238 | 253 | /** |