@@ -9,41 +9,41 @@ discard block |
||
| 9 | 9 | * @version 1.0.19 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | 14 | return array( |
| 15 | 15 | |
| 16 | 16 | array( |
| 17 | 17 | 'type' => 'heading', |
| 18 | - 'name' => __( 'Heading', 'invoicing' ), |
|
| 18 | + 'name' => __('Heading', 'invoicing'), |
|
| 19 | 19 | 'defaults' => array( |
| 20 | 20 | 'level' => 'h2', |
| 21 | - 'text' => __( 'Heading', 'invoicing' ), |
|
| 21 | + 'text' => __('Heading', 'invoicing'), |
|
| 22 | 22 | ) |
| 23 | 23 | ), |
| 24 | 24 | |
| 25 | 25 | array( |
| 26 | 26 | 'type' => 'paragraph', |
| 27 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
| 27 | + 'name' => __('Paragraph', 'invoicing'), |
|
| 28 | 28 | 'defaults' => array( |
| 29 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
| 29 | + 'text' => __('Paragraph text', 'invoicing'), |
|
| 30 | 30 | ) |
| 31 | 31 | ), |
| 32 | 32 | |
| 33 | 33 | array( |
| 34 | 34 | 'type' => 'alert', |
| 35 | - 'name' => __( 'Alert', 'invoicing' ), |
|
| 35 | + 'name' => __('Alert', 'invoicing'), |
|
| 36 | 36 | 'defaults' => array( |
| 37 | 37 | 'value' => '', |
| 38 | 38 | 'class' => 'alert-warning', |
| 39 | - 'text' => __( 'Alert', 'invoicing' ), |
|
| 39 | + 'text' => __('Alert', 'invoicing'), |
|
| 40 | 40 | 'dismissible' => false, |
| 41 | 41 | ) |
| 42 | 42 | ), |
| 43 | 43 | |
| 44 | 44 | array( |
| 45 | 45 | 'type' => 'separator', |
| 46 | - 'name' => __( 'Separator', 'invoicing' ), |
|
| 46 | + 'name' => __('Separator', 'invoicing'), |
|
| 47 | 47 | 'defaults' => array( |
| 48 | 48 | 'value' => '', |
| 49 | 49 | ), |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | array( |
| 53 | 53 | 'type' => 'text', |
| 54 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
| 54 | + 'name' => __('Text Input', 'invoicing'), |
|
| 55 | 55 | 'defaults' => array( |
| 56 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
| 56 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
| 57 | 57 | 'value' => '', |
| 58 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
| 58 | + 'label' => __('Field Label', 'invoicing'), |
|
| 59 | 59 | 'description' => '', |
| 60 | 60 | 'required' => false, |
| 61 | 61 | ) |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | array( |
| 65 | 65 | 'type' => 'textarea', |
| 66 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
| 66 | + 'name' => __('Textarea', 'invoicing'), |
|
| 67 | 67 | 'defaults' => array( |
| 68 | - 'placeholder' => __( 'Enter your text hear', 'invoicing' ), |
|
| 68 | + 'placeholder' => __('Enter your text hear', 'invoicing'), |
|
| 69 | 69 | 'value' => '', |
| 70 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
| 70 | + 'label' => __('Textarea Label', 'invoicing'), |
|
| 71 | 71 | 'description' => '', |
| 72 | 72 | 'required' => false, |
| 73 | 73 | ) |
@@ -75,27 +75,27 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | array( |
| 77 | 77 | 'type' => 'select', |
| 78 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
| 78 | + 'name' => __('Dropdown', 'invoicing'), |
|
| 79 | 79 | 'defaults' => array( |
| 80 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
| 80 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
| 81 | 81 | 'value' => '', |
| 82 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
| 82 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
| 83 | 83 | 'description' => '', |
| 84 | 84 | 'required' => false, |
| 85 | 85 | 'options' => array( |
| 86 | - esc_attr__( 'Option One', 'invoicing' ), |
|
| 87 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
| 88 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
| 86 | + esc_attr__('Option One', 'invoicing'), |
|
| 87 | + esc_attr__('Option Two', 'invoicing'), |
|
| 88 | + esc_attr__('Option Three', 'invoicing') |
|
| 89 | 89 | ), |
| 90 | 90 | ) |
| 91 | 91 | ), |
| 92 | 92 | |
| 93 | 93 | array( |
| 94 | 94 | 'type' => 'checkbox', |
| 95 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
| 95 | + 'name' => __('Checkbox', 'invoicing'), |
|
| 96 | 96 | 'defaults' => array( |
| 97 | 97 | 'value' => '', |
| 98 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
| 98 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
| 99 | 99 | 'description' => '', |
| 100 | 100 | 'required' => false, |
| 101 | 101 | ) |
@@ -103,23 +103,23 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | array( |
| 105 | 105 | 'type' => 'radio', |
| 106 | - 'name' => __( 'Radio', 'invoicing' ), |
|
| 106 | + 'name' => __('Radio', 'invoicing'), |
|
| 107 | 107 | 'defaults' => array( |
| 108 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
| 108 | + 'label' => __('Select one choice', 'invoicing'), |
|
| 109 | 109 | 'options' => array( |
| 110 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
| 111 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
| 112 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
| 110 | + esc_attr__('Choice One', 'invoicing'), |
|
| 111 | + esc_attr__('Choice Two', 'invoicing'), |
|
| 112 | + esc_attr__('Choice Three', 'invoicing') |
|
| 113 | 113 | ), |
| 114 | 114 | ) |
| 115 | 115 | ), |
| 116 | 116 | |
| 117 | 117 | array( |
| 118 | 118 | 'type' => 'date', |
| 119 | - 'name' => __( 'Date', 'invoicing' ), |
|
| 119 | + 'name' => __('Date', 'invoicing'), |
|
| 120 | 120 | 'defaults' => array( |
| 121 | 121 | 'value' => '', |
| 122 | - 'label' => __( 'Date', 'invoicing' ), |
|
| 122 | + 'label' => __('Date', 'invoicing'), |
|
| 123 | 123 | 'description' => '', |
| 124 | 124 | 'required' => false, |
| 125 | 125 | ) |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | array( |
| 129 | 129 | 'type' => 'time', |
| 130 | - 'name' => __( 'Time', 'invoicing' ), |
|
| 130 | + 'name' => __('Time', 'invoicing'), |
|
| 131 | 131 | 'defaults' => array( |
| 132 | 132 | 'value' => '', |
| 133 | - 'label' => __( 'Time', 'invoicing' ), |
|
| 133 | + 'label' => __('Time', 'invoicing'), |
|
| 134 | 134 | 'description' => '', |
| 135 | 135 | 'required' => false, |
| 136 | 136 | ) |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | array( |
| 140 | 140 | 'type' => 'number', |
| 141 | - 'name' => __( 'Number', 'invoicing' ), |
|
| 141 | + 'name' => __('Number', 'invoicing'), |
|
| 142 | 142 | 'defaults' => array( |
| 143 | 143 | 'placeholder' => '', |
| 144 | 144 | 'value' => '', |
| 145 | - 'label' => __( 'Number', 'invoicing' ), |
|
| 145 | + 'label' => __('Number', 'invoicing'), |
|
| 146 | 146 | 'description' => '', |
| 147 | 147 | 'required' => false, |
| 148 | 148 | ) |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | array( |
| 152 | 152 | 'type' => 'website', |
| 153 | - 'name' => __( 'Website', 'invoicing' ), |
|
| 153 | + 'name' => __('Website', 'invoicing'), |
|
| 154 | 154 | 'defaults' => array( |
| 155 | 155 | 'placeholder' => 'http://example.com', |
| 156 | 156 | 'value' => '', |
| 157 | - 'label' => __( 'Website', 'invoicing' ), |
|
| 157 | + 'label' => __('Website', 'invoicing'), |
|
| 158 | 158 | 'description' => '', |
| 159 | 159 | 'required' => false, |
| 160 | 160 | ) |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | array( |
| 164 | 164 | 'type' => 'email', |
| 165 | - 'name' => __( 'Email', 'invoicing' ), |
|
| 165 | + 'name' => __('Email', 'invoicing'), |
|
| 166 | 166 | 'defaults' => array( |
| 167 | 167 | 'placeholder' => '[email protected]', |
| 168 | 168 | 'value' => '', |
| 169 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
| 169 | + 'label' => __('Email Address', 'invoicing'), |
|
| 170 | 170 | 'description' => '', |
| 171 | 171 | 'required' => false, |
| 172 | 172 | ) |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | array( |
| 176 | 176 | 'type' => 'address', |
| 177 | - 'name' => __( 'Address', 'invoicing' ), |
|
| 177 | + 'name' => __('Address', 'invoicing'), |
|
| 178 | 178 | 'defaults' => array( |
| 179 | 179 | |
| 180 | 180 | 'fields' => array( |
| 181 | 181 | array( |
| 182 | 182 | 'placeholder' => 'Jon', |
| 183 | 183 | 'value' => '', |
| 184 | - 'label' => __( 'First Name', 'invoicing' ), |
|
| 184 | + 'label' => __('First Name', 'invoicing'), |
|
| 185 | 185 | 'description' => '', |
| 186 | 186 | 'required' => false, |
| 187 | 187 | 'visible' => true, |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | array( |
| 192 | 192 | 'placeholder' => 'Snow', |
| 193 | 193 | 'value' => '', |
| 194 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
| 194 | + 'label' => __('Last Name', 'invoicing'), |
|
| 195 | 195 | 'description' => '', |
| 196 | 196 | 'required' => false, |
| 197 | 197 | 'visible' => true, |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | array( |
| 202 | 202 | 'placeholder' => '', |
| 203 | 203 | 'value' => '', |
| 204 | - 'label' => __( 'Address', 'invoicing' ), |
|
| 204 | + 'label' => __('Address', 'invoicing'), |
|
| 205 | 205 | 'description' => '', |
| 206 | 206 | 'required' => false, |
| 207 | 207 | 'visible' => true, |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | array( |
| 212 | 212 | 'placeholder' => '', |
| 213 | 213 | 'value' => '', |
| 214 | - 'label' => __( 'City', 'invoicing' ), |
|
| 214 | + 'label' => __('City', 'invoicing'), |
|
| 215 | 215 | 'description' => '', |
| 216 | 216 | 'required' => false, |
| 217 | 217 | 'visible' => true, |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | ), |
| 220 | 220 | |
| 221 | 221 | array( |
| 222 | - 'placeholder' => __( 'Select your country' ), |
|
| 222 | + 'placeholder' => __('Select your country'), |
|
| 223 | 223 | 'value' => '', |
| 224 | - 'label' => __( 'Country', 'invoicing' ), |
|
| 224 | + 'label' => __('Country', 'invoicing'), |
|
| 225 | 225 | 'description' => '', |
| 226 | 226 | 'required' => false, |
| 227 | 227 | 'visible' => true, |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | ), |
| 230 | 230 | |
| 231 | 231 | array( |
| 232 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
| 232 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
| 233 | 233 | 'value' => '', |
| 234 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
| 234 | + 'label' => __('State / Province', 'invoicing'), |
|
| 235 | 235 | 'description' => '', |
| 236 | 236 | 'required' => false, |
| 237 | 237 | 'visible' => true, |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | array( |
| 242 | 242 | 'placeholder' => '', |
| 243 | 243 | 'value' => '', |
| 244 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
| 244 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
| 245 | 245 | 'description' => '', |
| 246 | 246 | 'required' => false, |
| 247 | 247 | 'visible' => true, |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | array( |
| 252 | 252 | 'placeholder' => '', |
| 253 | 253 | 'value' => '', |
| 254 | - 'label' => __( 'Phone', 'invoicing' ), |
|
| 254 | + 'label' => __('Phone', 'invoicing'), |
|
| 255 | 255 | 'description' => '', |
| 256 | 256 | 'required' => false, |
| 257 | 257 | 'visible' => true, |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | array( |
| 262 | 262 | 'placeholder' => '', |
| 263 | 263 | 'value' => '', |
| 264 | - 'label' => __( 'Company', 'invoicing' ), |
|
| 264 | + 'label' => __('Company', 'invoicing'), |
|
| 265 | 265 | 'description' => '', |
| 266 | 266 | 'required' => false, |
| 267 | 267 | 'visible' => false, |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | array( |
| 272 | 272 | 'placeholder' => '', |
| 273 | 273 | 'value' => '', |
| 274 | - 'label' => __( 'VAT Number', 'invoicing' ), |
|
| 274 | + 'label' => __('VAT Number', 'invoicing'), |
|
| 275 | 275 | 'description' => '', |
| 276 | 276 | 'required' => false, |
| 277 | 277 | 'visible' => false, |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | array( |
| 285 | 285 | 'type' => 'billing_email', |
| 286 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
| 286 | + 'name' => __('Billing Email', 'invoicing'), |
|
| 287 | 287 | 'defaults' => array( |
| 288 | 288 | 'placeholder' => '[email protected]', |
| 289 | 289 | 'value' => '', |
| 290 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
| 290 | + 'label' => __('Billing Email', 'invoicing'), |
|
| 291 | 291 | 'description' => '', |
| 292 | 292 | 'premade' => true, |
| 293 | 293 | ) |
@@ -295,18 +295,18 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | array( |
| 297 | 297 | 'type' => 'discount', |
| 298 | - 'name' => __( 'Discount Input', 'invoicing' ), |
|
| 298 | + 'name' => __('Discount Input', 'invoicing'), |
|
| 299 | 299 | 'defaults' => array( |
| 300 | 300 | 'value' => '', |
| 301 | - 'input_label' => __( 'Coupon Code', 'invoicing' ), |
|
| 302 | - 'button_label' => __( 'Apply Coupon', 'invoicing' ), |
|
| 303 | - 'description' => __( 'Have a discount code? Enter it above.', 'invoicing' ), |
|
| 301 | + 'input_label' => __('Coupon Code', 'invoicing'), |
|
| 302 | + 'button_label' => __('Apply Coupon', 'invoicing'), |
|
| 303 | + 'description' => __('Have a discount code? Enter it above.', 'invoicing'), |
|
| 304 | 304 | ) |
| 305 | 305 | ), |
| 306 | 306 | |
| 307 | 307 | array( |
| 308 | 308 | 'type' => 'items', |
| 309 | - 'name' => __( 'Items', 'invoicing' ), |
|
| 309 | + 'name' => __('Items', 'invoicing'), |
|
| 310 | 310 | 'defaults' => array( |
| 311 | 311 | 'value' => '', |
| 312 | 312 | 'items_type' => 'total', |
@@ -318,22 +318,22 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | array( |
| 320 | 320 | 'type' => 'price_input', |
| 321 | - 'name' => __( 'Price Input', 'invoicing' ), |
|
| 321 | + 'name' => __('Price Input', 'invoicing'), |
|
| 322 | 322 | 'defaults' => array( |
| 323 | 323 | 'placeholder' => wpinv_format_amount(0), |
| 324 | 324 | 'value' => wpinv_format_amount(0), |
| 325 | 325 | 'minimum' => wpinv_format_amount(0), |
| 326 | - 'label' => __( 'Enter Amount', 'invoicing' ), |
|
| 326 | + 'label' => __('Enter Amount', 'invoicing'), |
|
| 327 | 327 | 'description' => '', |
| 328 | 328 | ) |
| 329 | 329 | ), |
| 330 | 330 | |
| 331 | 331 | array( |
| 332 | 332 | 'type' => 'price_select', |
| 333 | - 'name' => __( 'Price Select', 'invoicing' ), |
|
| 333 | + 'name' => __('Price Select', 'invoicing'), |
|
| 334 | 334 | 'defaults' => array( |
| 335 | 335 | 'description' => '', |
| 336 | - 'label' => __( 'Select Amount', 'invoicing' ), |
|
| 336 | + 'label' => __('Select Amount', 'invoicing'), |
|
| 337 | 337 | 'options' => 'Option 1|10, Option 2|20', |
| 338 | 338 | 'placeholder' => '', |
| 339 | 339 | 'select_type' => 'select', |
@@ -342,39 +342,39 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | array( |
| 344 | 344 | 'type' => 'pay_button', |
| 345 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
| 345 | + 'name' => __('Payment Button', 'invoicing'), |
|
| 346 | 346 | 'defaults' => array( |
| 347 | 347 | 'value' => '', |
| 348 | 348 | 'class' => 'btn-primary', |
| 349 | - 'label' => __( 'Pay %price% »', 'invoicing' ), |
|
| 350 | - 'free' => __( 'Continue »', 'invoicing' ), |
|
| 351 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
| 349 | + 'label' => __('Pay %price% »', 'invoicing'), |
|
| 350 | + 'free' => __('Continue »', 'invoicing'), |
|
| 351 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
| 352 | 352 | 'premade' => true, |
| 353 | 353 | ) |
| 354 | 354 | ), |
| 355 | 355 | |
| 356 | 356 | array( |
| 357 | 357 | 'type' => 'gateway_select', |
| 358 | - 'name' => __( 'Gateway Select', 'invoicing' ), |
|
| 358 | + 'name' => __('Gateway Select', 'invoicing'), |
|
| 359 | 359 | 'defaults' => array( |
| 360 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
| 360 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
| 361 | 361 | 'premade' => true, |
| 362 | 362 | ) |
| 363 | 363 | ), |
| 364 | 364 | |
| 365 | 365 | array( |
| 366 | 366 | 'type' => 'total_payable', |
| 367 | - 'name' => __( 'Total Payable', 'invoicing' ), |
|
| 367 | + 'name' => __('Total Payable', 'invoicing'), |
|
| 368 | 368 | 'defaults' => array( |
| 369 | - 'text' => __( 'Total to pay:', 'invoicing' ), |
|
| 369 | + 'text' => __('Total to pay:', 'invoicing'), |
|
| 370 | 370 | ) |
| 371 | 371 | ), |
| 372 | 372 | |
| 373 | 373 | array( |
| 374 | 374 | 'type' => 'ip_address', |
| 375 | - 'name' => __( 'IP Address', 'invoicing' ), |
|
| 375 | + 'name' => __('IP Address', 'invoicing'), |
|
| 376 | 376 | 'defaults' => array( |
| 377 | - 'text' => __( 'Your IP address is:', 'invoicing' ), |
|
| 377 | + 'text' => __('Your IP address is:', 'invoicing'), |
|
| 378 | 378 | ) |
| 379 | 379 | ) |
| 380 | 380 | ); |
@@ -12,217 +12,217 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class GetPaid_Payment_Form_Submission_Refresh_Prices { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Contains the response for refreshing prices. |
|
| 17 | - * @var array |
|
| 18 | - */ |
|
| 19 | - public $response = array(); |
|
| 15 | + /** |
|
| 16 | + * Contains the response for refreshing prices. |
|
| 17 | + * @var array |
|
| 18 | + */ |
|
| 19 | + public $response = array(); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * Class constructor |
|
| 23 | - * |
|
| 24 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 25 | - */ |
|
| 26 | - public function __construct( $submission ) { |
|
| 27 | - |
|
| 28 | - $this->response = array( |
|
| 29 | - 'submission_id' => $submission->id, |
|
| 22 | + * Class constructor |
|
| 23 | + * |
|
| 24 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 25 | + */ |
|
| 26 | + public function __construct( $submission ) { |
|
| 27 | + |
|
| 28 | + $this->response = array( |
|
| 29 | + 'submission_id' => $submission->id, |
|
| 30 | 30 | 'has_recurring' => $submission->has_recurring, |
| 31 | 31 | 'is_free' => ! $submission->should_collect_payment_details(), |
| 32 | - ); |
|
| 33 | - |
|
| 34 | - $this->add_totals( $submission ); |
|
| 35 | - $this->add_texts( $submission ); |
|
| 36 | - $this->add_items( $submission ); |
|
| 37 | - $this->add_fees( $submission ); |
|
| 38 | - $this->add_discounts( $submission ); |
|
| 39 | - $this->add_taxes( $submission ); |
|
| 40 | - $this->add_gateways( $submission ); |
|
| 41 | - |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Adds totals to a response for submission refresh prices. |
|
| 46 | - * |
|
| 47 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 48 | - */ |
|
| 49 | - public function add_totals( $submission ) { |
|
| 50 | - |
|
| 51 | - $this->response = array_merge( |
|
| 52 | - $this->response, |
|
| 53 | - array( |
|
| 54 | - |
|
| 55 | - 'totals' => array( |
|
| 56 | - 'subtotal' => $submission->format_amount( $submission->get_subtotal() ), |
|
| 57 | - 'discount' => $submission->format_amount( $submission->get_discount() ), |
|
| 58 | - 'fees' => $submission->format_amount( $submission->get_fee() ), |
|
| 59 | - 'tax' => $submission->format_amount( $submission->get_tax() ), |
|
| 60 | - 'total' => $submission->format_amount( $submission->get_total() ), |
|
| 61 | - 'raw_total' => html_entity_decode( sanitize_text_field( $submission->format_amount( $submission->get_total() ) ), ENT_QUOTES ), |
|
| 62 | - ), |
|
| 63 | - |
|
| 64 | - 'recurring' => array( |
|
| 65 | - 'subtotal' => $submission->format_amount( $submission->get_recurring_subtotal() ), |
|
| 66 | - 'discount' => $submission->format_amount( $submission->get_recurring_discount() ), |
|
| 67 | - 'fees' => $submission->format_amount( $submission->get_recurring_fee() ), |
|
| 68 | - 'tax' => $submission->format_amount( $submission->get_recurring_tax() ), |
|
| 69 | - 'total' => $submission->format_amount( $submission->get_recurring_total() ), |
|
| 70 | - ), |
|
| 71 | - |
|
| 72 | - ) |
|
| 73 | - ); |
|
| 74 | - |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Adds texts to a response for submission refresh prices. |
|
| 79 | - * |
|
| 80 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 81 | - */ |
|
| 82 | - public function add_texts( $submission ) { |
|
| 83 | - |
|
| 84 | - $payable = $submission->format_amount( $submission->get_total() ); |
|
| 85 | - |
|
| 86 | - if ( $submission->has_recurring != 0 ) { |
|
| 87 | - |
|
| 88 | - $recurring = new WPInv_Item( $submission->has_recurring ); |
|
| 89 | - $period = getpaid_get_subscription_period_label( $recurring->get_recurring_period( true ), $recurring->get_recurring_interval(), '' ); |
|
| 90 | - |
|
| 91 | - if ( $submission->get_total() == $submission->get_recurring_total() ) { |
|
| 92 | - $payable = "$payable / $period"; |
|
| 93 | - } else { |
|
| 94 | - $payable = sprintf( |
|
| 95 | - __( '%1$s (renews at %2$s / %3$s)'), |
|
| 96 | - $submission->format_amount( $submission->get_total() ), |
|
| 97 | - $submission->format_amount( $submission->get_recurring_total() ), |
|
| 98 | - $period |
|
| 99 | - ); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $texts = array( |
|
| 105 | - '.getpaid-checkout-total-payable' => $payable, |
|
| 106 | - ); |
|
| 107 | - |
|
| 108 | - foreach ( $submission->get_items() as $item_id => $item ) { |
|
| 109 | - $texts[".item-$item_id .getpaid-item-initial-price"] = $submission->format_amount( $item->get_sub_total() ); |
|
| 110 | - $texts[".item-$item_id .getpaid-item-recurring-price"] = $submission->format_amount( $item->get_recurring_sub_total() ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - $this->response = array_merge( $this->response, array( 'texts' => $texts ) ); |
|
| 114 | - |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Adds items to a response for submission refresh prices. |
|
| 119 | - * |
|
| 120 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 121 | - */ |
|
| 122 | - public function add_items( $submission ) { |
|
| 123 | - |
|
| 124 | - // Add items. |
|
| 125 | - $items = array(); |
|
| 32 | + ); |
|
| 33 | + |
|
| 34 | + $this->add_totals( $submission ); |
|
| 35 | + $this->add_texts( $submission ); |
|
| 36 | + $this->add_items( $submission ); |
|
| 37 | + $this->add_fees( $submission ); |
|
| 38 | + $this->add_discounts( $submission ); |
|
| 39 | + $this->add_taxes( $submission ); |
|
| 40 | + $this->add_gateways( $submission ); |
|
| 41 | + |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Adds totals to a response for submission refresh prices. |
|
| 46 | + * |
|
| 47 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 48 | + */ |
|
| 49 | + public function add_totals( $submission ) { |
|
| 50 | + |
|
| 51 | + $this->response = array_merge( |
|
| 52 | + $this->response, |
|
| 53 | + array( |
|
| 54 | + |
|
| 55 | + 'totals' => array( |
|
| 56 | + 'subtotal' => $submission->format_amount( $submission->get_subtotal() ), |
|
| 57 | + 'discount' => $submission->format_amount( $submission->get_discount() ), |
|
| 58 | + 'fees' => $submission->format_amount( $submission->get_fee() ), |
|
| 59 | + 'tax' => $submission->format_amount( $submission->get_tax() ), |
|
| 60 | + 'total' => $submission->format_amount( $submission->get_total() ), |
|
| 61 | + 'raw_total' => html_entity_decode( sanitize_text_field( $submission->format_amount( $submission->get_total() ) ), ENT_QUOTES ), |
|
| 62 | + ), |
|
| 63 | + |
|
| 64 | + 'recurring' => array( |
|
| 65 | + 'subtotal' => $submission->format_amount( $submission->get_recurring_subtotal() ), |
|
| 66 | + 'discount' => $submission->format_amount( $submission->get_recurring_discount() ), |
|
| 67 | + 'fees' => $submission->format_amount( $submission->get_recurring_fee() ), |
|
| 68 | + 'tax' => $submission->format_amount( $submission->get_recurring_tax() ), |
|
| 69 | + 'total' => $submission->format_amount( $submission->get_recurring_total() ), |
|
| 70 | + ), |
|
| 71 | + |
|
| 72 | + ) |
|
| 73 | + ); |
|
| 74 | + |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Adds texts to a response for submission refresh prices. |
|
| 79 | + * |
|
| 80 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 81 | + */ |
|
| 82 | + public function add_texts( $submission ) { |
|
| 83 | + |
|
| 84 | + $payable = $submission->format_amount( $submission->get_total() ); |
|
| 85 | + |
|
| 86 | + if ( $submission->has_recurring != 0 ) { |
|
| 87 | + |
|
| 88 | + $recurring = new WPInv_Item( $submission->has_recurring ); |
|
| 89 | + $period = getpaid_get_subscription_period_label( $recurring->get_recurring_period( true ), $recurring->get_recurring_interval(), '' ); |
|
| 90 | + |
|
| 91 | + if ( $submission->get_total() == $submission->get_recurring_total() ) { |
|
| 92 | + $payable = "$payable / $period"; |
|
| 93 | + } else { |
|
| 94 | + $payable = sprintf( |
|
| 95 | + __( '%1$s (renews at %2$s / %3$s)'), |
|
| 96 | + $submission->format_amount( $submission->get_total() ), |
|
| 97 | + $submission->format_amount( $submission->get_recurring_total() ), |
|
| 98 | + $period |
|
| 99 | + ); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $texts = array( |
|
| 105 | + '.getpaid-checkout-total-payable' => $payable, |
|
| 106 | + ); |
|
| 107 | + |
|
| 108 | + foreach ( $submission->get_items() as $item_id => $item ) { |
|
| 109 | + $texts[".item-$item_id .getpaid-item-initial-price"] = $submission->format_amount( $item->get_sub_total() ); |
|
| 110 | + $texts[".item-$item_id .getpaid-item-recurring-price"] = $submission->format_amount( $item->get_recurring_sub_total() ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + $this->response = array_merge( $this->response, array( 'texts' => $texts ) ); |
|
| 114 | + |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Adds items to a response for submission refresh prices. |
|
| 119 | + * |
|
| 120 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 121 | + */ |
|
| 122 | + public function add_items( $submission ) { |
|
| 123 | + |
|
| 124 | + // Add items. |
|
| 125 | + $items = array(); |
|
| 126 | 126 | |
| 127 | 127 | foreach ( $submission->get_items() as $item_id => $item ) { |
| 128 | - $items["$item_id"] = $submission->format_amount( $item->get_sub_total() ); |
|
| 129 | - } |
|
| 128 | + $items["$item_id"] = $submission->format_amount( $item->get_sub_total() ); |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - $this->response = array_merge( |
|
| 132 | - $this->response, |
|
| 133 | - array( 'items' => $items ) |
|
| 134 | - ); |
|
| 131 | + $this->response = array_merge( |
|
| 132 | + $this->response, |
|
| 133 | + array( 'items' => $items ) |
|
| 134 | + ); |
|
| 135 | 135 | |
| 136 | - } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * Adds fees to a response for submission refresh prices. |
|
| 140 | - * |
|
| 141 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 142 | - */ |
|
| 143 | - public function add_fees( $submission ) { |
|
| 138 | + /** |
|
| 139 | + * Adds fees to a response for submission refresh prices. |
|
| 140 | + * |
|
| 141 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 142 | + */ |
|
| 143 | + public function add_fees( $submission ) { |
|
| 144 | 144 | |
| 145 | - $fees = array(); |
|
| 145 | + $fees = array(); |
|
| 146 | 146 | |
| 147 | 147 | foreach ( $submission->get_fees() as $name => $data ) { |
| 148 | - $fees[$name] = $submission->format_amount( $data['initial_fee'] ); |
|
| 149 | - } |
|
| 148 | + $fees[$name] = $submission->format_amount( $data['initial_fee'] ); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - $this->response = array_merge( |
|
| 152 | - $this->response, |
|
| 153 | - array( 'fees' => $fees ) |
|
| 154 | - ); |
|
| 151 | + $this->response = array_merge( |
|
| 152 | + $this->response, |
|
| 153 | + array( 'fees' => $fees ) |
|
| 154 | + ); |
|
| 155 | 155 | |
| 156 | - } |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * Adds discounts to a response for submission refresh prices. |
|
| 160 | - * |
|
| 161 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 162 | - */ |
|
| 163 | - public function add_discounts( $submission ) { |
|
| 158 | + /** |
|
| 159 | + * Adds discounts to a response for submission refresh prices. |
|
| 160 | + * |
|
| 161 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 162 | + */ |
|
| 163 | + public function add_discounts( $submission ) { |
|
| 164 | 164 | |
| 165 | - $discounts = array(); |
|
| 165 | + $discounts = array(); |
|
| 166 | 166 | |
| 167 | 167 | foreach ( $submission->get_discounts() as $name => $data ) { |
| 168 | - $discounts[$name] = $submission->format_amount( $data['initial_discount'] ); |
|
| 169 | - } |
|
| 168 | + $discounts[$name] = $submission->format_amount( $data['initial_discount'] ); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - $this->response = array_merge( |
|
| 172 | - $this->response, |
|
| 173 | - array( 'discounts' => $discounts ) |
|
| 174 | - ); |
|
| 171 | + $this->response = array_merge( |
|
| 172 | + $this->response, |
|
| 173 | + array( 'discounts' => $discounts ) |
|
| 174 | + ); |
|
| 175 | 175 | |
| 176 | - } |
|
| 176 | + } |
|
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Adds taxes to a response for submission refresh prices. |
|
| 180 | - * |
|
| 181 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 182 | - */ |
|
| 183 | - public function add_taxes( $submission ) { |
|
| 178 | + /** |
|
| 179 | + * Adds taxes to a response for submission refresh prices. |
|
| 180 | + * |
|
| 181 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 182 | + */ |
|
| 183 | + public function add_taxes( $submission ) { |
|
| 184 | 184 | |
| 185 | - $taxes = array(); |
|
| 185 | + $taxes = array(); |
|
| 186 | 186 | |
| 187 | 187 | foreach ( $submission->get_taxes() as $name => $data ) { |
| 188 | - $taxes[$name] = $submission->format_amount( $data['initial_tax'] ); |
|
| 189 | - } |
|
| 188 | + $taxes[$name] = $submission->format_amount( $data['initial_tax'] ); |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - $this->response = array_merge( |
|
| 192 | - $this->response, |
|
| 193 | - array( 'taxes' => $taxes ) |
|
| 194 | - ); |
|
| 191 | + $this->response = array_merge( |
|
| 192 | + $this->response, |
|
| 193 | + array( 'taxes' => $taxes ) |
|
| 194 | + ); |
|
| 195 | 195 | |
| 196 | - } |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Adds gateways to a response for submission refresh prices. |
|
| 200 | - * |
|
| 201 | - * @param GetPaid_Payment_Form_Submission $submission |
|
| 202 | - */ |
|
| 203 | - public function add_gateways( $submission ) { |
|
| 198 | + /** |
|
| 199 | + * Adds gateways to a response for submission refresh prices. |
|
| 200 | + * |
|
| 201 | + * @param GetPaid_Payment_Form_Submission $submission |
|
| 202 | + */ |
|
| 203 | + public function add_gateways( $submission ) { |
|
| 204 | 204 | |
| 205 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 205 | + $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 206 | 206 | |
| 207 | - if ( $this->response['has_recurring'] ) { |
|
| 207 | + if ( $this->response['has_recurring'] ) { |
|
| 208 | 208 | |
| 209 | - foreach ( $gateways as $i => $gateway ) { |
|
| 209 | + foreach ( $gateways as $i => $gateway ) { |
|
| 210 | 210 | |
| 211 | - if ( ! wpinv_gateway_support_subscription( $gateway ) ) { |
|
| 212 | - unset( $gateways[ $i ] ); |
|
| 213 | - } |
|
| 211 | + if ( ! wpinv_gateway_support_subscription( $gateway ) ) { |
|
| 212 | + unset( $gateways[ $i ] ); |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - } |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | - $gateways = apply_filters( 'getpaid_submission_gateways', $gateways, $submission ); |
|
| 221 | - $this->response = array_merge( |
|
| 222 | - $this->response, |
|
| 223 | - array( 'gateways' => $gateways ) |
|
| 224 | - ); |
|
| 220 | + $gateways = apply_filters( 'getpaid_submission_gateways', $gateways, $submission ); |
|
| 221 | + $this->response = array_merge( |
|
| 222 | + $this->response, |
|
| 223 | + array( 'gateways' => $gateways ) |
|
| 224 | + ); |
|
| 225 | 225 | |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Payment form submission refresh prices class |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @param GetPaid_Payment_Form_Submission $submission |
| 25 | 25 | */ |
| 26 | - public function __construct( $submission ) { |
|
| 26 | + public function __construct($submission) { |
|
| 27 | 27 | |
| 28 | 28 | $this->response = array( |
| 29 | 29 | 'submission_id' => $submission->id, |
| 30 | 30 | 'has_recurring' => $submission->has_recurring, |
| 31 | - 'is_free' => ! $submission->should_collect_payment_details(), |
|
| 31 | + 'is_free' => !$submission->should_collect_payment_details(), |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - $this->add_totals( $submission ); |
|
| 35 | - $this->add_texts( $submission ); |
|
| 36 | - $this->add_items( $submission ); |
|
| 37 | - $this->add_fees( $submission ); |
|
| 38 | - $this->add_discounts( $submission ); |
|
| 39 | - $this->add_taxes( $submission ); |
|
| 40 | - $this->add_gateways( $submission ); |
|
| 34 | + $this->add_totals($submission); |
|
| 35 | + $this->add_texts($submission); |
|
| 36 | + $this->add_items($submission); |
|
| 37 | + $this->add_fees($submission); |
|
| 38 | + $this->add_discounts($submission); |
|
| 39 | + $this->add_taxes($submission); |
|
| 40 | + $this->add_gateways($submission); |
|
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
@@ -46,27 +46,27 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @param GetPaid_Payment_Form_Submission $submission |
| 48 | 48 | */ |
| 49 | - public function add_totals( $submission ) { |
|
| 49 | + public function add_totals($submission) { |
|
| 50 | 50 | |
| 51 | 51 | $this->response = array_merge( |
| 52 | 52 | $this->response, |
| 53 | 53 | array( |
| 54 | 54 | |
| 55 | 55 | 'totals' => array( |
| 56 | - 'subtotal' => $submission->format_amount( $submission->get_subtotal() ), |
|
| 57 | - 'discount' => $submission->format_amount( $submission->get_discount() ), |
|
| 58 | - 'fees' => $submission->format_amount( $submission->get_fee() ), |
|
| 59 | - 'tax' => $submission->format_amount( $submission->get_tax() ), |
|
| 60 | - 'total' => $submission->format_amount( $submission->get_total() ), |
|
| 61 | - 'raw_total' => html_entity_decode( sanitize_text_field( $submission->format_amount( $submission->get_total() ) ), ENT_QUOTES ), |
|
| 56 | + 'subtotal' => $submission->format_amount($submission->get_subtotal()), |
|
| 57 | + 'discount' => $submission->format_amount($submission->get_discount()), |
|
| 58 | + 'fees' => $submission->format_amount($submission->get_fee()), |
|
| 59 | + 'tax' => $submission->format_amount($submission->get_tax()), |
|
| 60 | + 'total' => $submission->format_amount($submission->get_total()), |
|
| 61 | + 'raw_total' => html_entity_decode(sanitize_text_field($submission->format_amount($submission->get_total())), ENT_QUOTES), |
|
| 62 | 62 | ), |
| 63 | 63 | |
| 64 | 64 | 'recurring' => array( |
| 65 | - 'subtotal' => $submission->format_amount( $submission->get_recurring_subtotal() ), |
|
| 66 | - 'discount' => $submission->format_amount( $submission->get_recurring_discount() ), |
|
| 67 | - 'fees' => $submission->format_amount( $submission->get_recurring_fee() ), |
|
| 68 | - 'tax' => $submission->format_amount( $submission->get_recurring_tax() ), |
|
| 69 | - 'total' => $submission->format_amount( $submission->get_recurring_total() ), |
|
| 65 | + 'subtotal' => $submission->format_amount($submission->get_recurring_subtotal()), |
|
| 66 | + 'discount' => $submission->format_amount($submission->get_recurring_discount()), |
|
| 67 | + 'fees' => $submission->format_amount($submission->get_recurring_fee()), |
|
| 68 | + 'tax' => $submission->format_amount($submission->get_recurring_tax()), |
|
| 69 | + 'total' => $submission->format_amount($submission->get_recurring_total()), |
|
| 70 | 70 | ), |
| 71 | 71 | |
| 72 | 72 | ) |
@@ -79,22 +79,22 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param GetPaid_Payment_Form_Submission $submission |
| 81 | 81 | */ |
| 82 | - public function add_texts( $submission ) { |
|
| 82 | + public function add_texts($submission) { |
|
| 83 | 83 | |
| 84 | - $payable = $submission->format_amount( $submission->get_total() ); |
|
| 84 | + $payable = $submission->format_amount($submission->get_total()); |
|
| 85 | 85 | |
| 86 | - if ( $submission->has_recurring != 0 ) { |
|
| 86 | + if ($submission->has_recurring != 0) { |
|
| 87 | 87 | |
| 88 | - $recurring = new WPInv_Item( $submission->has_recurring ); |
|
| 89 | - $period = getpaid_get_subscription_period_label( $recurring->get_recurring_period( true ), $recurring->get_recurring_interval(), '' ); |
|
| 88 | + $recurring = new WPInv_Item($submission->has_recurring); |
|
| 89 | + $period = getpaid_get_subscription_period_label($recurring->get_recurring_period(true), $recurring->get_recurring_interval(), ''); |
|
| 90 | 90 | |
| 91 | - if ( $submission->get_total() == $submission->get_recurring_total() ) { |
|
| 91 | + if ($submission->get_total() == $submission->get_recurring_total()) { |
|
| 92 | 92 | $payable = "$payable / $period"; |
| 93 | 93 | } else { |
| 94 | 94 | $payable = sprintf( |
| 95 | - __( '%1$s (renews at %2$s / %3$s)'), |
|
| 96 | - $submission->format_amount( $submission->get_total() ), |
|
| 97 | - $submission->format_amount( $submission->get_recurring_total() ), |
|
| 95 | + __('%1$s (renews at %2$s / %3$s)'), |
|
| 96 | + $submission->format_amount($submission->get_total()), |
|
| 97 | + $submission->format_amount($submission->get_recurring_total()), |
|
| 98 | 98 | $period |
| 99 | 99 | ); |
| 100 | 100 | } |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | '.getpaid-checkout-total-payable' => $payable, |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - foreach ( $submission->get_items() as $item_id => $item ) { |
|
| 109 | - $texts[".item-$item_id .getpaid-item-initial-price"] = $submission->format_amount( $item->get_sub_total() ); |
|
| 110 | - $texts[".item-$item_id .getpaid-item-recurring-price"] = $submission->format_amount( $item->get_recurring_sub_total() ); |
|
| 108 | + foreach ($submission->get_items() as $item_id => $item) { |
|
| 109 | + $texts[".item-$item_id .getpaid-item-initial-price"] = $submission->format_amount($item->get_sub_total()); |
|
| 110 | + $texts[".item-$item_id .getpaid-item-recurring-price"] = $submission->format_amount($item->get_recurring_sub_total()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $this->response = array_merge( $this->response, array( 'texts' => $texts ) ); |
|
| 113 | + $this->response = array_merge($this->response, array('texts' => $texts)); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @param GetPaid_Payment_Form_Submission $submission |
| 121 | 121 | */ |
| 122 | - public function add_items( $submission ) { |
|
| 122 | + public function add_items($submission) { |
|
| 123 | 123 | |
| 124 | 124 | // Add items. |
| 125 | 125 | $items = array(); |
| 126 | 126 | |
| 127 | - foreach ( $submission->get_items() as $item_id => $item ) { |
|
| 128 | - $items["$item_id"] = $submission->format_amount( $item->get_sub_total() ); |
|
| 127 | + foreach ($submission->get_items() as $item_id => $item) { |
|
| 128 | + $items["$item_id"] = $submission->format_amount($item->get_sub_total()); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $this->response = array_merge( |
| 132 | 132 | $this->response, |
| 133 | - array( 'items' => $items ) |
|
| 133 | + array('items' => $items) |
|
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | 136 | } |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @param GetPaid_Payment_Form_Submission $submission |
| 142 | 142 | */ |
| 143 | - public function add_fees( $submission ) { |
|
| 143 | + public function add_fees($submission) { |
|
| 144 | 144 | |
| 145 | 145 | $fees = array(); |
| 146 | 146 | |
| 147 | - foreach ( $submission->get_fees() as $name => $data ) { |
|
| 148 | - $fees[$name] = $submission->format_amount( $data['initial_fee'] ); |
|
| 147 | + foreach ($submission->get_fees() as $name => $data) { |
|
| 148 | + $fees[$name] = $submission->format_amount($data['initial_fee']); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $this->response = array_merge( |
| 152 | 152 | $this->response, |
| 153 | - array( 'fees' => $fees ) |
|
| 153 | + array('fees' => $fees) |
|
| 154 | 154 | ); |
| 155 | 155 | |
| 156 | 156 | } |
@@ -160,17 +160,17 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @param GetPaid_Payment_Form_Submission $submission |
| 162 | 162 | */ |
| 163 | - public function add_discounts( $submission ) { |
|
| 163 | + public function add_discounts($submission) { |
|
| 164 | 164 | |
| 165 | 165 | $discounts = array(); |
| 166 | 166 | |
| 167 | - foreach ( $submission->get_discounts() as $name => $data ) { |
|
| 168 | - $discounts[$name] = $submission->format_amount( $data['initial_discount'] ); |
|
| 167 | + foreach ($submission->get_discounts() as $name => $data) { |
|
| 168 | + $discounts[$name] = $submission->format_amount($data['initial_discount']); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $this->response = array_merge( |
| 172 | 172 | $this->response, |
| 173 | - array( 'discounts' => $discounts ) |
|
| 173 | + array('discounts' => $discounts) |
|
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | 176 | } |
@@ -180,17 +180,17 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @param GetPaid_Payment_Form_Submission $submission |
| 182 | 182 | */ |
| 183 | - public function add_taxes( $submission ) { |
|
| 183 | + public function add_taxes($submission) { |
|
| 184 | 184 | |
| 185 | 185 | $taxes = array(); |
| 186 | 186 | |
| 187 | - foreach ( $submission->get_taxes() as $name => $data ) { |
|
| 188 | - $taxes[$name] = $submission->format_amount( $data['initial_tax'] ); |
|
| 187 | + foreach ($submission->get_taxes() as $name => $data) { |
|
| 188 | + $taxes[$name] = $submission->format_amount($data['initial_tax']); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $this->response = array_merge( |
| 192 | 192 | $this->response, |
| 193 | - array( 'taxes' => $taxes ) |
|
| 193 | + array('taxes' => $taxes) |
|
| 194 | 194 | ); |
| 195 | 195 | |
| 196 | 196 | } |
@@ -200,16 +200,16 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @param GetPaid_Payment_Form_Submission $submission |
| 202 | 202 | */ |
| 203 | - public function add_gateways( $submission ) { |
|
| 203 | + public function add_gateways($submission) { |
|
| 204 | 204 | |
| 205 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 205 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
| 206 | 206 | |
| 207 | - if ( $this->response['has_recurring'] ) { |
|
| 207 | + if ($this->response['has_recurring']) { |
|
| 208 | 208 | |
| 209 | - foreach ( $gateways as $i => $gateway ) { |
|
| 209 | + foreach ($gateways as $i => $gateway) { |
|
| 210 | 210 | |
| 211 | - if ( ! wpinv_gateway_support_subscription( $gateway ) ) { |
|
| 212 | - unset( $gateways[ $i ] ); |
|
| 211 | + if (!wpinv_gateway_support_subscription($gateway)) { |
|
| 212 | + unset($gateways[$i]); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | } |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
| 220 | - $gateways = apply_filters( 'getpaid_submission_gateways', $gateways, $submission ); |
|
| 220 | + $gateways = apply_filters('getpaid_submission_gateways', $gateways, $submission); |
|
| 221 | 221 | $this->response = array_merge( |
| 222 | 222 | $this->response, |
| 223 | - array( 'gateways' => $gateways ) |
|
| 223 | + array('gateways' => $gateways) |
|
| 224 | 224 | ); |
| 225 | 225 | |
| 226 | 226 | } |
@@ -7,44 +7,44 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class='form-group'> |
| 15 | 15 | <label class="d-block"> |
| 16 | - <span><?php esc_html_e( 'Button Text', 'invoicing' ); ?></span> |
|
| 16 | + <span><?php esc_html_e('Button Text', 'invoicing'); ?></span> |
|
| 17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
| 18 | - <small class="form-text text-muted"><?php _e( '%price% will be replaced by the total payable amount', 'invoicing' ); ?></small> |
|
| 18 | + <small class="form-text text-muted"><?php _e('%price% will be replaced by the total payable amount', 'invoicing'); ?></small> |
|
| 19 | 19 | </label> |
| 20 | 20 | </div> |
| 21 | 21 | |
| 22 | 22 | <div class='form-group'> |
| 23 | 23 | <label class="d-block"> |
| 24 | - <span><?php esc_html_e( 'Free Checkout Text', 'invoicing' ); ?></span> |
|
| 24 | + <span><?php esc_html_e('Free Checkout Text', 'invoicing'); ?></span> |
|
| 25 | 25 | <input v-model='active_form_element.free' class='form-control' type="text"/> |
| 26 | - <small class="form-text text-muted"><?php _e( 'The text to display if the total payable amount is zero', 'invoicing' ); ?></small> |
|
| 26 | + <small class="form-text text-muted"><?php _e('The text to display if the total payable amount is zero', 'invoicing'); ?></small> |
|
| 27 | 27 | </label> |
| 28 | 28 | </div> |
| 29 | 29 | |
| 30 | 30 | <div class='form-group'> |
| 31 | 31 | <label class="d-block"> |
| 32 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
| 33 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
| 32 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
| 33 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
| 34 | 34 | </label> |
| 35 | 35 | </div> |
| 36 | 36 | |
| 37 | 37 | <div class='form-group'> |
| 38 | - <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e( 'Button Type', 'invoicing' ) ?></label> |
|
| 38 | + <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e('Button Type', 'invoicing') ?></label> |
|
| 39 | 39 | <select class='form-control custom-select' :id="active_form_element.id + '_edit_type'" v-model='active_form_element.class'> |
| 40 | - <option value='btn-primary'><?php esc_html_e( 'Primary', 'invoicing' ); ?></option> |
|
| 41 | - <option value='btn-secondary'><?php esc_html_e( 'Secondary', 'invoicing' ); ?></option> |
|
| 42 | - <option value='btn-success'><?php esc_html_e( 'Success', 'invoicing' ); ?></option> |
|
| 43 | - <option value='btn-danger'><?php esc_html_e( 'Danger', 'invoicing' ); ?></option> |
|
| 44 | - <option value='btn-warning'><?php esc_html_e( 'Warning', 'invoicing' ); ?></option> |
|
| 45 | - <option value='btn-info'><?php esc_html_e( 'Info', 'invoicing' ); ?></option> |
|
| 46 | - <option value='btn-light'><?php esc_html_e( 'Light', 'invoicing' ); ?></option> |
|
| 47 | - <option value='btn-dark'><?php esc_html_e( 'Dark', 'invoicing' ); ?></option> |
|
| 48 | - <option value='btn-link'><?php esc_html_e( 'Link', 'invoicing' ); ?></option> |
|
| 40 | + <option value='btn-primary'><?php esc_html_e('Primary', 'invoicing'); ?></option> |
|
| 41 | + <option value='btn-secondary'><?php esc_html_e('Secondary', 'invoicing'); ?></option> |
|
| 42 | + <option value='btn-success'><?php esc_html_e('Success', 'invoicing'); ?></option> |
|
| 43 | + <option value='btn-danger'><?php esc_html_e('Danger', 'invoicing'); ?></option> |
|
| 44 | + <option value='btn-warning'><?php esc_html_e('Warning', 'invoicing'); ?></option> |
|
| 45 | + <option value='btn-info'><?php esc_html_e('Info', 'invoicing'); ?></option> |
|
| 46 | + <option value='btn-light'><?php esc_html_e('Light', 'invoicing'); ?></option> |
|
| 47 | + <option value='btn-dark'><?php esc_html_e('Dark', 'invoicing'); ?></option> |
|
| 48 | + <option value='btn-link'><?php esc_html_e('Link', 'invoicing'); ?></option> |
|
| 49 | 49 | </select> |
| 50 | 50 | </div> |
@@ -7,18 +7,18 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class ); |
|
| 13 | -$label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label ); |
|
| 14 | -$free = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free ); |
|
| 12 | +$class = empty($class) ? 'btn-primary' : sanitize_html_class($class); |
|
| 13 | +$label = empty($label) ? esc_attr__('Pay %price% »', 'invoicing') : esc_attr($label); |
|
| 14 | +$free = empty($free) ? esc_attr__('Continue »', 'invoicing') : esc_attr($free); |
|
| 15 | 15 | |
| 16 | 16 | echo aui()->input( |
| 17 | 17 | array( |
| 18 | - 'name' => esc_attr( $id ), |
|
| 19 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 18 | + 'name' => esc_attr($id), |
|
| 19 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 20 | 20 | 'value' => $label, |
| 21 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 21 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 22 | 22 | 'type' => 'submit', |
| 23 | 23 | 'class' => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class, |
| 24 | 24 | 'extra_attributes' => array( |