@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if (!defined('ABSPATH')) { |
|
| 4 | 4 | exit; // Exit if accessed directly |
| 5 | 5 | } |
| 6 | 6 | |
@@ -13,19 +13,19 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct() { |
| 15 | 15 | |
| 16 | - foreach( $this->get_elements() as $element ) { |
|
| 16 | + foreach ($this->get_elements() as $element) { |
|
| 17 | 17 | $element = $element['type']; |
| 18 | 18 | |
| 19 | - if ( method_exists( $this, "render_{$element}_template" ) ) { |
|
| 20 | - add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 ); |
|
| 19 | + if (method_exists($this, "render_{$element}_template")) { |
|
| 20 | + add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if ( method_exists( $this, "edit_{$element}_template" ) ) { |
|
| 24 | - add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 ); |
|
| 23 | + if (method_exists($this, "edit_{$element}_template")) { |
|
| 24 | + add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if ( method_exists( $this, "frontend_render_{$element}_template" ) ) { |
|
| 28 | - add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 ); |
|
| 27 | + if (method_exists($this, "frontend_render_{$element}_template")) { |
|
| 28 | + add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function get_elements() { |
| 39 | 39 | |
| 40 | - if ( ! empty( $this->elements ) ) { |
|
| 40 | + if (!empty($this->elements)) { |
|
| 41 | 41 | return $this->elements; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,28 +45,28 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | array( |
| 47 | 47 | 'type' => 'heading', |
| 48 | - 'name' => __( 'Heading', 'invoicing' ), |
|
| 48 | + 'name' => __('Heading', 'invoicing'), |
|
| 49 | 49 | 'defaults' => array( |
| 50 | 50 | 'level' => 'h2', |
| 51 | - 'text' => __( 'Heading', 'invoicing' ), |
|
| 51 | + 'text' => __('Heading', 'invoicing'), |
|
| 52 | 52 | ) |
| 53 | 53 | ), |
| 54 | 54 | |
| 55 | 55 | array( |
| 56 | 56 | 'type' => 'paragraph', |
| 57 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
| 57 | + 'name' => __('Paragraph', 'invoicing'), |
|
| 58 | 58 | 'defaults' => array( |
| 59 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
| 59 | + 'text' => __('Paragraph text', 'invoicing'), |
|
| 60 | 60 | ) |
| 61 | 61 | ), |
| 62 | 62 | |
| 63 | 63 | array( |
| 64 | 64 | 'type' => 'alert', |
| 65 | - 'name' => __( 'Alert', 'invoicing' ), |
|
| 65 | + 'name' => __('Alert', 'invoicing'), |
|
| 66 | 66 | 'defaults' => array( |
| 67 | 67 | 'value' => '', |
| 68 | 68 | 'class' => 'alert-warning', |
| 69 | - 'text' => __( 'Alert', 'invoicing' ), |
|
| 69 | + 'text' => __('Alert', 'invoicing'), |
|
| 70 | 70 | 'dismissible' => false, |
| 71 | 71 | ) |
| 72 | 72 | ), |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | array( |
| 84 | 84 | 'type' => 'text', |
| 85 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
| 85 | + 'name' => __('Text Input', 'invoicing'), |
|
| 86 | 86 | 'defaults' => array( |
| 87 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
| 87 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
| 88 | 88 | 'value' => '', |
| 89 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
| 89 | + 'label' => __('Field Label', 'invoicing'), |
|
| 90 | 90 | 'description' => '', |
| 91 | 91 | 'required' => false, |
| 92 | 92 | ) |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | array( |
| 96 | 96 | 'type' => 'textarea', |
| 97 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
| 97 | + 'name' => __('Textarea', 'invoicing'), |
|
| 98 | 98 | 'defaults' => array( |
| 99 | - 'placeholder' => __( 'Enter your text hear', 'invoicing' ), |
|
| 99 | + 'placeholder' => __('Enter your text hear', 'invoicing'), |
|
| 100 | 100 | 'value' => '', |
| 101 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
| 101 | + 'label' => __('Textarea Label', 'invoicing'), |
|
| 102 | 102 | 'description' => '', |
| 103 | 103 | 'required' => false, |
| 104 | 104 | ) |
@@ -106,27 +106,27 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | array( |
| 108 | 108 | 'type' => 'select', |
| 109 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
| 109 | + 'name' => __('Dropdown', 'invoicing'), |
|
| 110 | 110 | 'defaults' => array( |
| 111 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
| 111 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
| 112 | 112 | 'value' => '', |
| 113 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
| 113 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
| 114 | 114 | 'description' => '', |
| 115 | 115 | 'required' => false, |
| 116 | 116 | 'options' => array( |
| 117 | - esc_attr__( 'Option One', 'invoicing' ), |
|
| 118 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
| 119 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
| 117 | + esc_attr__('Option One', 'invoicing'), |
|
| 118 | + esc_attr__('Option Two', 'invoicing'), |
|
| 119 | + esc_attr__('Option Three', 'invoicing') |
|
| 120 | 120 | ), |
| 121 | 121 | ) |
| 122 | 122 | ), |
| 123 | 123 | |
| 124 | 124 | array( |
| 125 | 125 | 'type' => 'checkbox', |
| 126 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
| 126 | + 'name' => __('Checkbox', 'invoicing'), |
|
| 127 | 127 | 'defaults' => array( |
| 128 | 128 | 'value' => '', |
| 129 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
| 129 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
| 130 | 130 | 'description' => '', |
| 131 | 131 | 'required' => false, |
| 132 | 132 | ) |
@@ -134,23 +134,23 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | array( |
| 136 | 136 | 'type' => 'radio', |
| 137 | - 'name' => __( 'Multiple Choice', 'invoicing' ), |
|
| 137 | + 'name' => __('Multiple Choice', 'invoicing'), |
|
| 138 | 138 | 'defaults' => array( |
| 139 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
| 139 | + 'label' => __('Select one choice', 'invoicing'), |
|
| 140 | 140 | 'options' => array( |
| 141 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
| 142 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
| 143 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
| 141 | + esc_attr__('Choice One', 'invoicing'), |
|
| 142 | + esc_attr__('Choice Two', 'invoicing'), |
|
| 143 | + esc_attr__('Choice Three', 'invoicing') |
|
| 144 | 144 | ), |
| 145 | 145 | ) |
| 146 | 146 | ), |
| 147 | 147 | |
| 148 | 148 | array( |
| 149 | 149 | 'type' => 'date', |
| 150 | - 'name' => __( 'Date', 'invoicing' ), |
|
| 150 | + 'name' => __('Date', 'invoicing'), |
|
| 151 | 151 | 'defaults' => array( |
| 152 | 152 | 'value' => '', |
| 153 | - 'label' => __( 'Date', 'invoicing' ), |
|
| 153 | + 'label' => __('Date', 'invoicing'), |
|
| 154 | 154 | 'description' => '', |
| 155 | 155 | 'required' => false, |
| 156 | 156 | ) |
@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | array( |
| 160 | 160 | 'type' => 'time', |
| 161 | - 'name' => __( 'Time', 'invoicing' ), |
|
| 161 | + 'name' => __('Time', 'invoicing'), |
|
| 162 | 162 | 'defaults' => array( |
| 163 | 163 | 'value' => '', |
| 164 | - 'label' => __( 'Time', 'invoicing' ), |
|
| 164 | + 'label' => __('Time', 'invoicing'), |
|
| 165 | 165 | 'description' => '', |
| 166 | 166 | 'required' => false, |
| 167 | 167 | ) |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | array( |
| 171 | 171 | 'type' => 'number', |
| 172 | - 'name' => __( 'Number', 'invoicing' ), |
|
| 172 | + 'name' => __('Number', 'invoicing'), |
|
| 173 | 173 | 'defaults' => array( |
| 174 | 174 | 'placeholder' => '', |
| 175 | 175 | 'value' => '', |
| 176 | - 'label' => __( 'Number', 'invoicing' ), |
|
| 176 | + 'label' => __('Number', 'invoicing'), |
|
| 177 | 177 | 'description' => '', |
| 178 | 178 | 'required' => false, |
| 179 | 179 | ) |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | array( |
| 183 | 183 | 'type' => 'website', |
| 184 | - 'name' => __( 'Website', 'invoicing' ), |
|
| 184 | + 'name' => __('Website', 'invoicing'), |
|
| 185 | 185 | 'defaults' => array( |
| 186 | 186 | 'placeholder' => 'http://example.com', |
| 187 | 187 | 'value' => '', |
| 188 | - 'label' => __( 'Website', 'invoicing' ), |
|
| 188 | + 'label' => __('Website', 'invoicing'), |
|
| 189 | 189 | 'description' => '', |
| 190 | 190 | 'required' => false, |
| 191 | 191 | ) |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | array( |
| 195 | 195 | 'type' => 'email', |
| 196 | - 'name' => __( 'Email', 'invoicing' ), |
|
| 196 | + 'name' => __('Email', 'invoicing'), |
|
| 197 | 197 | 'defaults' => array( |
| 198 | 198 | 'placeholder' => '[email protected]', |
| 199 | 199 | 'value' => '', |
| 200 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
| 200 | + 'label' => __('Email Address', 'invoicing'), |
|
| 201 | 201 | 'description' => '', |
| 202 | 202 | 'required' => false, |
| 203 | 203 | ) |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | array( |
| 207 | 207 | 'type' => 'address', |
| 208 | - 'name' => __( 'Address', 'invoicing' ), |
|
| 208 | + 'name' => __('Address', 'invoicing'), |
|
| 209 | 209 | 'defaults' => array( |
| 210 | 210 | |
| 211 | 211 | 'fields' => array( |
| 212 | 212 | array( |
| 213 | 213 | 'placeholder' => 'Jon', |
| 214 | 214 | 'value' => '', |
| 215 | - 'label' => __( 'First Name', 'invoicing' ), |
|
| 215 | + 'label' => __('First Name', 'invoicing'), |
|
| 216 | 216 | 'description' => '', |
| 217 | 217 | 'required' => false, |
| 218 | 218 | 'visible' => true, |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | array( |
| 223 | 223 | 'placeholder' => 'Snow', |
| 224 | 224 | 'value' => '', |
| 225 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
| 225 | + 'label' => __('Last Name', 'invoicing'), |
|
| 226 | 226 | 'description' => '', |
| 227 | 227 | 'required' => false, |
| 228 | 228 | 'visible' => true, |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | array( |
| 233 | 233 | 'placeholder' => '', |
| 234 | 234 | 'value' => '', |
| 235 | - 'label' => __( 'Address', 'invoicing' ), |
|
| 235 | + 'label' => __('Address', 'invoicing'), |
|
| 236 | 236 | 'description' => '', |
| 237 | 237 | 'required' => false, |
| 238 | 238 | 'visible' => true, |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | array( |
| 243 | 243 | 'placeholder' => '', |
| 244 | 244 | 'value' => '', |
| 245 | - 'label' => __( 'City', 'invoicing' ), |
|
| 245 | + 'label' => __('City', 'invoicing'), |
|
| 246 | 246 | 'description' => '', |
| 247 | 247 | 'required' => false, |
| 248 | 248 | 'visible' => true, |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | ), |
| 251 | 251 | |
| 252 | 252 | array( |
| 253 | - 'placeholder' => __( 'Select your country' ), |
|
| 253 | + 'placeholder' => __('Select your country'), |
|
| 254 | 254 | 'value' => '', |
| 255 | - 'label' => __( 'Country', 'invoicing' ), |
|
| 255 | + 'label' => __('Country', 'invoicing'), |
|
| 256 | 256 | 'description' => '', |
| 257 | 257 | 'required' => false, |
| 258 | 258 | 'visible' => true, |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | ), |
| 261 | 261 | |
| 262 | 262 | array( |
| 263 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
| 263 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
| 264 | 264 | 'value' => '', |
| 265 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
| 265 | + 'label' => __('State / Province', 'invoicing'), |
|
| 266 | 266 | 'description' => '', |
| 267 | 267 | 'required' => false, |
| 268 | 268 | 'visible' => true, |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | array( |
| 273 | 273 | 'placeholder' => '', |
| 274 | 274 | 'value' => '', |
| 275 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
| 275 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
| 276 | 276 | 'description' => '', |
| 277 | 277 | 'required' => false, |
| 278 | 278 | 'visible' => true, |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | array( |
| 283 | 283 | 'placeholder' => '', |
| 284 | 284 | 'value' => '', |
| 285 | - 'label' => __( 'Phone', 'invoicing' ), |
|
| 285 | + 'label' => __('Phone', 'invoicing'), |
|
| 286 | 286 | 'description' => '', |
| 287 | 287 | 'required' => false, |
| 288 | 288 | 'visible' => true, |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | array( |
| 296 | 296 | 'type' => 'billing_email', |
| 297 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
| 297 | + 'name' => __('Billing Email', 'invoicing'), |
|
| 298 | 298 | 'defaults' => array( |
| 299 | 299 | 'placeholder' => '[email protected]', |
| 300 | 300 | 'value' => '', |
| 301 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
| 301 | + 'label' => __('Billing Email', 'invoicing'), |
|
| 302 | 302 | 'description' => '', |
| 303 | 303 | 'premade' => true, |
| 304 | 304 | ) |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | array( |
| 319 | 319 | 'type' => 'items', |
| 320 | - 'name' => __( 'Items', 'invoicing' ), |
|
| 320 | + 'name' => __('Items', 'invoicing'), |
|
| 321 | 321 | 'defaults' => array( |
| 322 | 322 | 'value' => '', |
| 323 | 323 | 'items_type' => 'total', |
@@ -328,25 +328,25 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | array( |
| 330 | 330 | 'type' => 'pay_button', |
| 331 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
| 331 | + 'name' => __('Payment Button', 'invoicing'), |
|
| 332 | 332 | 'defaults' => array( |
| 333 | 333 | 'value' => '', |
| 334 | 334 | 'class' => 'btn-primary', |
| 335 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
| 336 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
| 335 | + 'label' => __('Pay Now »', 'invoicing'), |
|
| 336 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
| 337 | 337 | 'premade' => true, |
| 338 | 338 | ) |
| 339 | 339 | ) |
| 340 | 340 | ); |
| 341 | 341 | |
| 342 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
| 342 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
| 343 | 343 | return $this->elements; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * Returns the restrict markup. |
| 348 | 348 | */ |
| 349 | - public function get_restrict_markup( $field, $field_type ) { |
|
| 349 | + public function get_restrict_markup($field, $field_type) { |
|
| 350 | 350 | $restrict = "$field.type=='$field_type'"; |
| 351 | 351 | return "v-if=\"$restrict\""; |
| 352 | 352 | } |
@@ -354,15 +354,15 @@ discard block |
||
| 354 | 354 | /** |
| 355 | 355 | * Renders the title element template. |
| 356 | 356 | */ |
| 357 | - public function render_heading_template( $field ) { |
|
| 358 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
| 357 | + public function render_heading_template($field) { |
|
| 358 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
| 359 | 359 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | 363 | * Renders the title element on the frontend. |
| 364 | 364 | */ |
| 365 | - public function frontend_render_heading_template( $field ) { |
|
| 365 | + public function frontend_render_heading_template($field) { |
|
| 366 | 366 | $tag = $field['level']; |
| 367 | 367 | echo "<$tag>{$field['text']}</$tag>"; |
| 368 | 368 | } |
@@ -370,10 +370,10 @@ discard block |
||
| 370 | 370 | /** |
| 371 | 371 | * Renders the edit title element template. |
| 372 | 372 | */ |
| 373 | - public function edit_heading_template( $field ) { |
|
| 374 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
| 375 | - $label = __( 'Heading', 'invoicing' ); |
|
| 376 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
| 373 | + public function edit_heading_template($field) { |
|
| 374 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
| 375 | + $label = __('Heading', 'invoicing'); |
|
| 376 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
| 377 | 377 | $id = $field . '.id + "_edit"'; |
| 378 | 378 | $id2 = $field . '.id + "_edit2"'; |
| 379 | 379 | |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | /** |
| 406 | 406 | * Renders a paragraph element template. |
| 407 | 407 | */ |
| 408 | - public function render_paragraph_template( $field ) { |
|
| 409 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
| 408 | + public function render_paragraph_template($field) { |
|
| 409 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
| 410 | 410 | $label = "$field.text"; |
| 411 | 411 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
| 412 | 412 | } |
@@ -414,16 +414,16 @@ discard block |
||
| 414 | 414 | /** |
| 415 | 415 | * Renders the paragraph element on the frontend. |
| 416 | 416 | */ |
| 417 | - public function frontend_render_paragraph_template( $field ) { |
|
| 417 | + public function frontend_render_paragraph_template($field) { |
|
| 418 | 418 | echo "<p>{$field['text']}</p>"; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | 422 | * Renders the edit paragraph element template. |
| 423 | 423 | */ |
| 424 | - public function edit_paragraph_template( $field ) { |
|
| 425 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
| 426 | - $label = __( 'Enter your text', 'invoicing' ); |
|
| 424 | + public function edit_paragraph_template($field) { |
|
| 425 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
| 426 | + $label = __('Enter your text', 'invoicing'); |
|
| 427 | 427 | $id = $field . '.id + "_edit"'; |
| 428 | 428 | echo " |
| 429 | 429 | <div $restrict> |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | /** |
| 440 | 440 | * Renders the text element template. |
| 441 | 441 | */ |
| 442 | - public function render_text_template( $field ) { |
|
| 443 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
| 442 | + public function render_text_template($field) { |
|
| 443 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
| 444 | 444 | $label = "$field.label"; |
| 445 | 445 | echo " |
| 446 | 446 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -455,23 +455,23 @@ discard block |
||
| 455 | 455 | /** |
| 456 | 456 | * Renders the text element on the frontend. |
| 457 | 457 | */ |
| 458 | - public function frontend_render_text_template( $field ) { |
|
| 458 | + public function frontend_render_text_template($field) { |
|
| 459 | 459 | |
| 460 | 460 | echo "<div class='form-group'>"; |
| 461 | 461 | |
| 462 | 462 | echo aui()->input( |
| 463 | 463 | array( |
| 464 | - 'name' => esc_attr( $field['id'] ), |
|
| 465 | - 'id' => esc_attr( $field['id'] ), |
|
| 466 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
| 464 | + 'name' => esc_attr($field['id']), |
|
| 465 | + 'id' => esc_attr($field['id']), |
|
| 466 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
| 467 | 467 | 'required' => (bool) $field['required'], |
| 468 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 468 | + 'label' => wp_kses_post($field['label']), |
|
| 469 | 469 | 'no_wrap' => true, |
| 470 | 470 | ) |
| 471 | 471 | ); |
| 472 | 472 | |
| 473 | - if ( ! empty( $field['description'] ) ) { |
|
| 474 | - $description = wp_kses_post( $field['description'] ); |
|
| 473 | + if (!empty($field['description'])) { |
|
| 474 | + $description = wp_kses_post($field['description']); |
|
| 475 | 475 | echo "<small class='form-text text-muted'>$description</small>"; |
| 476 | 476 | } |
| 477 | 477 | |
@@ -482,16 +482,16 @@ discard block |
||
| 482 | 482 | /** |
| 483 | 483 | * Renders the edit text element template. |
| 484 | 484 | */ |
| 485 | - public function edit_text_template( $field ) { |
|
| 486 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
| 487 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 485 | + public function edit_text_template($field) { |
|
| 486 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
| 487 | + $label = __('Field Label', 'invoicing'); |
|
| 488 | 488 | $id = $field . '.id + "_edit"'; |
| 489 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 489 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 490 | 490 | $id2 = $field . '.id + "_edit2"'; |
| 491 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 492 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 491 | + $label3 = __('Help text', 'invoicing'); |
|
| 492 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 493 | 493 | $id3 = $field . '.id + "_edit3"'; |
| 494 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 494 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 495 | 495 | $id4 = $field . '.id + "_edit4"'; |
| 496 | 496 | echo " |
| 497 | 497 | <div $restrict> |
@@ -519,8 +519,8 @@ discard block |
||
| 519 | 519 | /** |
| 520 | 520 | * Renders the textarea element template. |
| 521 | 521 | */ |
| 522 | - public function render_textarea_template( $field ) { |
|
| 523 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
| 522 | + public function render_textarea_template($field) { |
|
| 523 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
| 524 | 524 | $label = "$field.label"; |
| 525 | 525 | echo " |
| 526 | 526 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -535,24 +535,24 @@ discard block |
||
| 535 | 535 | /** |
| 536 | 536 | * Renders the textarea element on the frontend. |
| 537 | 537 | */ |
| 538 | - public function frontend_render_textarea_template( $field ) { |
|
| 538 | + public function frontend_render_textarea_template($field) { |
|
| 539 | 539 | |
| 540 | 540 | echo "<div class='form-group'>"; |
| 541 | 541 | |
| 542 | 542 | echo aui()->textarea( |
| 543 | 543 | array( |
| 544 | - 'name' => esc_attr( $field['id'] ), |
|
| 545 | - 'id' => esc_attr( $field['id'] ), |
|
| 546 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
| 544 | + 'name' => esc_attr($field['id']), |
|
| 545 | + 'id' => esc_attr($field['id']), |
|
| 546 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
| 547 | 547 | 'required' => (bool) $field['required'], |
| 548 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 548 | + 'label' => wp_kses_post($field['label']), |
|
| 549 | 549 | 'no_wrap' => true, |
| 550 | 550 | 'rows' => 3, |
| 551 | 551 | ) |
| 552 | 552 | ); |
| 553 | 553 | |
| 554 | - if ( ! empty( $field['description'] ) ) { |
|
| 555 | - $description = wp_kses_post( $field['description'] ); |
|
| 554 | + if (!empty($field['description'])) { |
|
| 555 | + $description = wp_kses_post($field['description']); |
|
| 556 | 556 | echo "<small class='form-text text-muted'>$description</small>"; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -563,16 +563,16 @@ discard block |
||
| 563 | 563 | /** |
| 564 | 564 | * Renders the edit textarea element template. |
| 565 | 565 | */ |
| 566 | - public function edit_textarea_template( $field ) { |
|
| 567 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
| 568 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 566 | + public function edit_textarea_template($field) { |
|
| 567 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
| 568 | + $label = __('Field Label', 'invoicing'); |
|
| 569 | 569 | $id = $field . '.id + "_edit"'; |
| 570 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 570 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 571 | 571 | $id2 = $field . '.id + "_edit2"'; |
| 572 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 573 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 572 | + $label3 = __('Help text', 'invoicing'); |
|
| 573 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 574 | 574 | $id3 = $field . '.id + "_edit3"'; |
| 575 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 575 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 576 | 576 | $id4 = $field . '.id + "_edit4"'; |
| 577 | 577 | echo " |
| 578 | 578 | <div $restrict> |
@@ -600,8 +600,8 @@ discard block |
||
| 600 | 600 | /** |
| 601 | 601 | * Renders the select element template. |
| 602 | 602 | */ |
| 603 | - public function render_select_template( $field ) { |
|
| 604 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
| 603 | + public function render_select_template($field) { |
|
| 604 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
| 605 | 605 | $label = "$field.label"; |
| 606 | 606 | $placeholder = "$field.placeholder"; |
| 607 | 607 | $id = $field . '.id'; |
@@ -621,24 +621,24 @@ discard block |
||
| 621 | 621 | /** |
| 622 | 622 | * Renders the select element on the frontend. |
| 623 | 623 | */ |
| 624 | - public function frontend_render_select_template( $field ) { |
|
| 624 | + public function frontend_render_select_template($field) { |
|
| 625 | 625 | |
| 626 | 626 | echo "<div class='form-group'>"; |
| 627 | 627 | |
| 628 | 628 | echo aui()->select( |
| 629 | 629 | array( |
| 630 | - 'name' => esc_attr( $field['id'] ), |
|
| 631 | - 'id' => esc_attr( $field['id'] ), |
|
| 632 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
| 630 | + 'name' => esc_attr($field['id']), |
|
| 631 | + 'id' => esc_attr($field['id']), |
|
| 632 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
| 633 | 633 | 'required' => (bool) $field['required'], |
| 634 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 634 | + 'label' => wp_kses_post($field['label']), |
|
| 635 | 635 | 'no_wrap' => true, |
| 636 | - 'options' => array_combine( $field['options'], $field['options'] ), |
|
| 636 | + 'options' => array_combine($field['options'], $field['options']), |
|
| 637 | 637 | ) |
| 638 | 638 | ); |
| 639 | 639 | |
| 640 | - if ( ! empty( $field['description'] ) ) { |
|
| 641 | - $description = wp_kses_post( $field['description'] ); |
|
| 640 | + if (!empty($field['description'])) { |
|
| 641 | + $description = wp_kses_post($field['description']); |
|
| 642 | 642 | echo "<small class='form-text text-muted'>$description</small>"; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -649,18 +649,18 @@ discard block |
||
| 649 | 649 | /** |
| 650 | 650 | * Renders the edit select element template. |
| 651 | 651 | */ |
| 652 | - public function edit_select_template( $field ) { |
|
| 653 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
| 654 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 652 | + public function edit_select_template($field) { |
|
| 653 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
| 654 | + $label = __('Field Label', 'invoicing'); |
|
| 655 | 655 | $id = $field . '.id + "_edit"'; |
| 656 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 656 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 657 | 657 | $id2 = $field . '.id + "_edit2"'; |
| 658 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 659 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 658 | + $label3 = __('Help text', 'invoicing'); |
|
| 659 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 660 | 660 | $id3 = $field . '.id + "_edit3"'; |
| 661 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 661 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 662 | 662 | $id4 = $field . '.id + "_edit4"'; |
| 663 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
| 663 | + $label6 = __('Available Options', 'invoicing'); |
|
| 664 | 664 | echo " |
| 665 | 665 | <div $restrict> |
| 666 | 666 | <div class='form-group'> |
@@ -698,8 +698,8 @@ discard block |
||
| 698 | 698 | /** |
| 699 | 699 | * Renders the checkbox element template. |
| 700 | 700 | */ |
| 701 | - public function render_checkbox_template( $field ) { |
|
| 702 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
| 701 | + public function render_checkbox_template($field) { |
|
| 702 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
| 703 | 703 | $label = "$field.label"; |
| 704 | 704 | echo " |
| 705 | 705 | <div class='form-check' $restrict> |
@@ -714,24 +714,24 @@ discard block |
||
| 714 | 714 | /** |
| 715 | 715 | * Renders the checkbox element on the frontend. |
| 716 | 716 | */ |
| 717 | - public function frontend_render_checkbox_template( $field ) { |
|
| 717 | + public function frontend_render_checkbox_template($field) { |
|
| 718 | 718 | |
| 719 | 719 | echo "<div class='form-group'>"; |
| 720 | 720 | |
| 721 | 721 | echo aui()->input( |
| 722 | 722 | array( |
| 723 | - 'name' => esc_attr( $field['id'] ), |
|
| 724 | - 'id' => esc_attr( $field['id'] ), |
|
| 723 | + 'name' => esc_attr($field['id']), |
|
| 724 | + 'id' => esc_attr($field['id']), |
|
| 725 | 725 | 'required' => (bool) $field['required'], |
| 726 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 726 | + 'label' => wp_kses_post($field['label']), |
|
| 727 | 727 | 'no_wrap' => true, |
| 728 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
| 728 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
| 729 | 729 | 'type' => 'checkbox', |
| 730 | 730 | ) |
| 731 | 731 | ); |
| 732 | 732 | |
| 733 | - if ( ! empty( $field['description'] ) ) { |
|
| 734 | - $description = wp_kses_post( $field['description'] ); |
|
| 733 | + if (!empty($field['description'])) { |
|
| 734 | + $description = wp_kses_post($field['description']); |
|
| 735 | 735 | echo "<small class='form-text text-muted'>$description</small>"; |
| 736 | 736 | } |
| 737 | 737 | |
@@ -742,14 +742,14 @@ discard block |
||
| 742 | 742 | /** |
| 743 | 743 | * Renders the edit checkbox element template. |
| 744 | 744 | */ |
| 745 | - public function edit_checkbox_template( $field ) { |
|
| 746 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
| 747 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 745 | + public function edit_checkbox_template($field) { |
|
| 746 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
| 747 | + $label = __('Field Label', 'invoicing'); |
|
| 748 | 748 | $id = $field . '.id + "_edit"'; |
| 749 | - $label2 = __( 'Help text', 'invoicing' ); |
|
| 750 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 749 | + $label2 = __('Help text', 'invoicing'); |
|
| 750 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 751 | 751 | $id2 = $field . '.id + "_edit2"'; |
| 752 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
| 752 | + $label4 = __('Is this field required?', 'invoicing'); |
|
| 753 | 753 | $id3 = $field . '.id + "_edit3"'; |
| 754 | 754 | echo " |
| 755 | 755 | <div $restrict> |
@@ -773,8 +773,8 @@ discard block |
||
| 773 | 773 | /** |
| 774 | 774 | * Renders the radio element template. |
| 775 | 775 | */ |
| 776 | - public function render_radio_template( $field ) { |
|
| 777 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
| 776 | + public function render_radio_template($field) { |
|
| 777 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
| 778 | 778 | $label = "$field.label"; |
| 779 | 779 | $id = $field . '.id'; |
| 780 | 780 | echo " |
@@ -793,20 +793,20 @@ discard block |
||
| 793 | 793 | /** |
| 794 | 794 | * Renders the radio element on the frontend. |
| 795 | 795 | */ |
| 796 | - public function frontend_render_radio_template( $field ) { |
|
| 796 | + public function frontend_render_radio_template($field) { |
|
| 797 | 797 | |
| 798 | 798 | echo "<div class='form-group'>"; |
| 799 | 799 | |
| 800 | - if ( ! empty( $field['label'] ) ) { |
|
| 801 | - $label = wp_kses_post( $field['label'] ); |
|
| 800 | + if (!empty($field['label'])) { |
|
| 801 | + $label = wp_kses_post($field['label']); |
|
| 802 | 802 | echo "<legend class='col-form-label'>$label</legend>"; |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | - foreach( $field['options'] as $index => $option ) { |
|
| 805 | + foreach ($field['options'] as $index => $option) { |
|
| 806 | 806 | $id = $field['id'] . $index; |
| 807 | 807 | $name = $field['id']; |
| 808 | - $value = esc_attr( $option ); |
|
| 809 | - $label = wp_kses_post( $option ); |
|
| 808 | + $value = esc_attr($option); |
|
| 809 | + $label = wp_kses_post($option); |
|
| 810 | 810 | |
| 811 | 811 | echo " |
| 812 | 812 | <div class='form-check'> |
@@ -816,8 +816,8 @@ discard block |
||
| 816 | 816 | "; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | - if ( ! empty( $field['description'] ) ) { |
|
| 820 | - $description = wp_kses_post( $field['description'] ); |
|
| 819 | + if (!empty($field['description'])) { |
|
| 820 | + $description = wp_kses_post($field['description']); |
|
| 821 | 821 | echo "<small class='form-text text-muted'>$description</small>"; |
| 822 | 822 | } |
| 823 | 823 | |
@@ -828,16 +828,16 @@ discard block |
||
| 828 | 828 | /** |
| 829 | 829 | * Renders the edit radio element template. |
| 830 | 830 | */ |
| 831 | - public function edit_radio_template( $field ) { |
|
| 832 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
| 833 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 831 | + public function edit_radio_template($field) { |
|
| 832 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
| 833 | + $label = __('Field Label', 'invoicing'); |
|
| 834 | 834 | $id = $field . '.id + "_edit"'; |
| 835 | - $label2 = __( 'Help text', 'invoicing' ); |
|
| 836 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 835 | + $label2 = __('Help text', 'invoicing'); |
|
| 836 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 837 | 837 | $id2 = $field . '.id + "_edit3"'; |
| 838 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
| 838 | + $label4 = __('Is this field required?', 'invoicing'); |
|
| 839 | 839 | $id3 = $field . '.id + "_edit4"'; |
| 840 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
| 840 | + $label5 = __('Available Options', 'invoicing'); |
|
| 841 | 841 | echo " |
| 842 | 842 | <div $restrict> |
| 843 | 843 | <div class='form-group'> |
@@ -871,8 +871,8 @@ discard block |
||
| 871 | 871 | /** |
| 872 | 872 | * Renders the address element template. |
| 873 | 873 | */ |
| 874 | - public function render_address_template( $field ) { |
|
| 875 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
| 874 | + public function render_address_template($field) { |
|
| 875 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
| 876 | 876 | |
| 877 | 877 | echo " |
| 878 | 878 | <div class='wpinv-address-wrapper' $restrict> |
@@ -894,55 +894,55 @@ discard block |
||
| 894 | 894 | /** |
| 895 | 895 | * Renders the address element on the frontend. |
| 896 | 896 | */ |
| 897 | - public function frontend_render_address_template( $field ) { |
|
| 897 | + public function frontend_render_address_template($field) { |
|
| 898 | 898 | |
| 899 | 899 | echo "<div class='wpinv-address-fields'>"; |
| 900 | 900 | |
| 901 | - foreach( $field['fields'] as $address_field ) { |
|
| 901 | + foreach ($field['fields'] as $address_field) { |
|
| 902 | 902 | |
| 903 | - if ( empty( $address_field['visible'] ) ) { |
|
| 903 | + if (empty($address_field['visible'])) { |
|
| 904 | 904 | continue; |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | - $class = esc_attr( $address_field['name'] ); |
|
| 907 | + $class = esc_attr($address_field['name']); |
|
| 908 | 908 | echo "<div class='form-group $class'>"; |
| 909 | 909 | |
| 910 | 910 | $label = $address_field['label']; |
| 911 | 911 | |
| 912 | - if ( ! empty( $address_field['required'] ) ) { |
|
| 912 | + if (!empty($address_field['required'])) { |
|
| 913 | 913 | $label .= "<span class='text-danger'> *</span>"; |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
| 916 | + if ('wpinv_country' == $address_field['name']) { |
|
| 917 | 917 | |
| 918 | - echo aui()->select( array( |
|
| 918 | + echo aui()->select(array( |
|
| 919 | 919 | 'options' => wpinv_get_country_list(), |
| 920 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 921 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 920 | + 'name' => esc_attr($address_field['name']), |
|
| 921 | + 'id' => esc_attr($address_field['name']), |
|
| 922 | 922 | 'value' => wpinv_get_default_country(), |
| 923 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
| 923 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
| 924 | 924 | 'required' => (bool) $address_field['required'], |
| 925 | 925 | 'no_wrap' => true, |
| 926 | - 'label' => wp_kses_post( $label ), |
|
| 926 | + 'label' => wp_kses_post($label), |
|
| 927 | 927 | 'select2' => false, |
| 928 | 928 | )); |
| 929 | 929 | |
| 930 | - } else if ( 'wpinv_state' == $address_field['name'] ) { |
|
| 930 | + } else if ('wpinv_state' == $address_field['name']) { |
|
| 931 | 931 | |
| 932 | - $states = wpinv_get_country_states( wpinv_get_default_country() ); |
|
| 932 | + $states = wpinv_get_country_states(wpinv_get_default_country()); |
|
| 933 | 933 | $state = wpinv_get_default_state(); |
| 934 | 934 | |
| 935 | - if ( ! empty( $states ) ) { |
|
| 935 | + if (!empty($states)) { |
|
| 936 | 936 | |
| 937 | - echo aui()->select( array( |
|
| 937 | + echo aui()->select(array( |
|
| 938 | 938 | 'options' => $states, |
| 939 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 940 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 939 | + 'name' => esc_attr($address_field['name']), |
|
| 940 | + 'id' => esc_attr($address_field['name']), |
|
| 941 | 941 | 'value' => $state, |
| 942 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
| 942 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
| 943 | 943 | 'required' => (bool) $address_field['required'], |
| 944 | 944 | 'no_wrap' => true, |
| 945 | - 'label' => wp_kses_post( $label ), |
|
| 945 | + 'label' => wp_kses_post($label), |
|
| 946 | 946 | 'select2' => false, |
| 947 | 947 | )); |
| 948 | 948 | |
@@ -950,10 +950,10 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | echo aui()->input( |
| 952 | 952 | array( |
| 953 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 954 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 953 | + 'name' => esc_attr($address_field['name']), |
|
| 954 | + 'id' => esc_attr($address_field['name']), |
|
| 955 | 955 | 'required' => (bool) $address_field['required'], |
| 956 | - 'label' => wp_kses_post( $label ), |
|
| 956 | + 'label' => wp_kses_post($label), |
|
| 957 | 957 | 'no_wrap' => true, |
| 958 | 958 | 'type' => 'text', |
| 959 | 959 | ) |
@@ -965,12 +965,12 @@ discard block |
||
| 965 | 965 | |
| 966 | 966 | echo aui()->input( |
| 967 | 967 | array( |
| 968 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 969 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 968 | + 'name' => esc_attr($address_field['name']), |
|
| 969 | + 'id' => esc_attr($address_field['name']), |
|
| 970 | 970 | 'required' => (bool) $address_field['required'], |
| 971 | - 'label' => wp_kses_post( $label ), |
|
| 971 | + 'label' => wp_kses_post($label), |
|
| 972 | 972 | 'no_wrap' => true, |
| 973 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
| 973 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
| 974 | 974 | 'type' => 'text', |
| 975 | 975 | ) |
| 976 | 976 | ); |
@@ -978,8 +978,8 @@ discard block |
||
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | |
| 981 | - if ( ! empty( $address_field['description'] ) ) { |
|
| 982 | - $description = wp_kses_post( $address_field['description'] ); |
|
| 981 | + if (!empty($address_field['description'])) { |
|
| 982 | + $description = wp_kses_post($address_field['description']); |
|
| 983 | 983 | echo "<small class='form-text text-muted'>$description</small>"; |
| 984 | 984 | } |
| 985 | 985 | |
@@ -994,13 +994,13 @@ discard block |
||
| 994 | 994 | /** |
| 995 | 995 | * Renders the edit address element template. |
| 996 | 996 | */ |
| 997 | - public function edit_address_template( $field ) { |
|
| 998 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
| 999 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1000 | - $label2 = __( 'Placeholder', 'invoicing' ); |
|
| 1001 | - $label3 = __( 'Description', 'invoicing' ); |
|
| 1002 | - $label4 = __( 'Is required', 'invoicing' ); |
|
| 1003 | - $label5 = __( 'Is visible', 'invoicing' ); |
|
| 997 | + public function edit_address_template($field) { |
|
| 998 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
| 999 | + $label = __('Field Label', 'invoicing'); |
|
| 1000 | + $label2 = __('Placeholder', 'invoicing'); |
|
| 1001 | + $label3 = __('Description', 'invoicing'); |
|
| 1002 | + $label4 = __('Is required', 'invoicing'); |
|
| 1003 | + $label5 = __('Is visible', 'invoicing'); |
|
| 1004 | 1004 | $id = $field . '.id + "_edit_label"'; |
| 1005 | 1005 | $id2 = $field . '.id + "_edit_placeholder"'; |
| 1006 | 1006 | $id3 = $field . '.id + "_edit_description"'; |
@@ -1068,8 +1068,8 @@ discard block |
||
| 1068 | 1068 | /** |
| 1069 | 1069 | * Renders the email element template. |
| 1070 | 1070 | */ |
| 1071 | - public function render_email_template( $field ) { |
|
| 1072 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
| 1071 | + public function render_email_template($field) { |
|
| 1072 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
| 1073 | 1073 | $label = "$field.label"; |
| 1074 | 1074 | echo " |
| 1075 | 1075 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1084,8 +1084,8 @@ discard block |
||
| 1084 | 1084 | /** |
| 1085 | 1085 | * Renders the billing_email element template. |
| 1086 | 1086 | */ |
| 1087 | - public function render_billing_email_template( $field ) { |
|
| 1088 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
| 1087 | + public function render_billing_email_template($field) { |
|
| 1088 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
| 1089 | 1089 | $label = "$field.label"; |
| 1090 | 1090 | echo " |
| 1091 | 1091 | <div $restrict> |
@@ -1099,24 +1099,24 @@ discard block |
||
| 1099 | 1099 | /** |
| 1100 | 1100 | * Renders the email element on the frontend. |
| 1101 | 1101 | */ |
| 1102 | - public function frontend_render_email_template( $field ) { |
|
| 1102 | + public function frontend_render_email_template($field) { |
|
| 1103 | 1103 | |
| 1104 | 1104 | echo "<div class='form-group'>"; |
| 1105 | 1105 | |
| 1106 | 1106 | echo aui()->input( |
| 1107 | 1107 | array( |
| 1108 | - 'name' => esc_attr( $field['id'] ), |
|
| 1109 | - 'id' => esc_attr( $field['id'] ), |
|
| 1108 | + 'name' => esc_attr($field['id']), |
|
| 1109 | + 'id' => esc_attr($field['id']), |
|
| 1110 | 1110 | 'required' => (bool) $field['required'], |
| 1111 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1111 | + 'label' => wp_kses_post($field['label']), |
|
| 1112 | 1112 | 'no_wrap' => true, |
| 1113 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1113 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1114 | 1114 | 'type' => 'email', |
| 1115 | 1115 | ) |
| 1116 | 1116 | ); |
| 1117 | 1117 | |
| 1118 | - if ( ! empty( $field['description'] ) ) { |
|
| 1119 | - $description = wp_kses_post( $field['description'] ); |
|
| 1118 | + if (!empty($field['description'])) { |
|
| 1119 | + $description = wp_kses_post($field['description']); |
|
| 1120 | 1120 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1121 | 1121 | } |
| 1122 | 1122 | |
@@ -1127,30 +1127,30 @@ discard block |
||
| 1127 | 1127 | /** |
| 1128 | 1128 | * Renders the billing email element on the frontend. |
| 1129 | 1129 | */ |
| 1130 | - public function frontend_render_billing_email_template( $field ) { |
|
| 1130 | + public function frontend_render_billing_email_template($field) { |
|
| 1131 | 1131 | |
| 1132 | 1132 | echo "<div class='form-group'>"; |
| 1133 | 1133 | $value = ''; |
| 1134 | 1134 | |
| 1135 | - if ( is_user_logged_in() ) { |
|
| 1135 | + if (is_user_logged_in()) { |
|
| 1136 | 1136 | $user = wp_get_current_user(); |
| 1137 | - $value = sanitize_email( $user->user_email ); |
|
| 1137 | + $value = sanitize_email($user->user_email); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | echo aui()->input( |
| 1140 | 1140 | array( |
| 1141 | 1141 | 'name' => 'billing_email', |
| 1142 | 1142 | 'value' => $value, |
| 1143 | - 'id' => esc_attr( $field['id'] ), |
|
| 1143 | + 'id' => esc_attr($field['id']), |
|
| 1144 | 1144 | 'required' => true, |
| 1145 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1145 | + 'label' => wp_kses_post($field['label']), |
|
| 1146 | 1146 | 'no_wrap' => true, |
| 1147 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1147 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1148 | 1148 | 'type' => 'email', |
| 1149 | 1149 | ) |
| 1150 | 1150 | ); |
| 1151 | 1151 | |
| 1152 | - if ( ! empty( $field['description'] ) ) { |
|
| 1153 | - $description = wp_kses_post( $field['description'] ); |
|
| 1152 | + if (!empty($field['description'])) { |
|
| 1153 | + $description = wp_kses_post($field['description']); |
|
| 1154 | 1154 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1155 | 1155 | } |
| 1156 | 1156 | |
@@ -1161,16 +1161,16 @@ discard block |
||
| 1161 | 1161 | /** |
| 1162 | 1162 | * Renders the edit email element template. |
| 1163 | 1163 | */ |
| 1164 | - public function edit_email_template( $field ) { |
|
| 1165 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
| 1166 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1164 | + public function edit_email_template($field) { |
|
| 1165 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
| 1166 | + $label = __('Field Label', 'invoicing'); |
|
| 1167 | 1167 | $id = $field . '.id + "_edit"'; |
| 1168 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1168 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1169 | 1169 | $id2 = $field . '.id + "_edit2"'; |
| 1170 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1171 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1170 | + $label3 = __('Help text', 'invoicing'); |
|
| 1171 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1172 | 1172 | $id3 = $field . '.id + "_edit3"'; |
| 1173 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1173 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1174 | 1174 | $id4 = $field . '.id + "_edit4"'; |
| 1175 | 1175 | echo " |
| 1176 | 1176 | <div $restrict> |
@@ -1198,16 +1198,16 @@ discard block |
||
| 1198 | 1198 | /** |
| 1199 | 1199 | * Renders the edit billing_email element template. |
| 1200 | 1200 | */ |
| 1201 | - public function edit_billing_email_template( $field ) { |
|
| 1202 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
| 1203 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1201 | + public function edit_billing_email_template($field) { |
|
| 1202 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
| 1203 | + $label = __('Field Label', 'invoicing'); |
|
| 1204 | 1204 | $id = $field . '.id + "_edit"'; |
| 1205 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1205 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1206 | 1206 | $id2 = $field . '.id + "_edit2"'; |
| 1207 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1208 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1207 | + $label3 = __('Help text', 'invoicing'); |
|
| 1208 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1209 | 1209 | $id3 = $field . '.id + "_edit3"'; |
| 1210 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1210 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1211 | 1211 | $id4 = $field . '.id + "_edit4"'; |
| 1212 | 1212 | echo " |
| 1213 | 1213 | <div $restrict> |
@@ -1231,8 +1231,8 @@ discard block |
||
| 1231 | 1231 | /** |
| 1232 | 1232 | * Renders the website element template. |
| 1233 | 1233 | */ |
| 1234 | - public function render_website_template( $field ) { |
|
| 1235 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
| 1234 | + public function render_website_template($field) { |
|
| 1235 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
| 1236 | 1236 | $label = "$field.label"; |
| 1237 | 1237 | echo " |
| 1238 | 1238 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1247,24 +1247,24 @@ discard block |
||
| 1247 | 1247 | /** |
| 1248 | 1248 | * Renders the website element on the frontend. |
| 1249 | 1249 | */ |
| 1250 | - public function frontend_render_website_template( $field ) { |
|
| 1250 | + public function frontend_render_website_template($field) { |
|
| 1251 | 1251 | |
| 1252 | 1252 | echo "<div class='form-group'>"; |
| 1253 | 1253 | |
| 1254 | 1254 | echo aui()->input( |
| 1255 | 1255 | array( |
| 1256 | - 'name' => esc_attr( $field['id'] ), |
|
| 1257 | - 'id' => esc_attr( $field['id'] ), |
|
| 1256 | + 'name' => esc_attr($field['id']), |
|
| 1257 | + 'id' => esc_attr($field['id']), |
|
| 1258 | 1258 | 'required' => (bool) $field['required'], |
| 1259 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1259 | + 'label' => wp_kses_post($field['label']), |
|
| 1260 | 1260 | 'no_wrap' => true, |
| 1261 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1261 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1262 | 1262 | 'type' => 'url', |
| 1263 | 1263 | ) |
| 1264 | 1264 | ); |
| 1265 | 1265 | |
| 1266 | - if ( ! empty( $field['description'] ) ) { |
|
| 1267 | - $description = wp_kses_post( $field['description'] ); |
|
| 1266 | + if (!empty($field['description'])) { |
|
| 1267 | + $description = wp_kses_post($field['description']); |
|
| 1268 | 1268 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1269 | 1269 | } |
| 1270 | 1270 | |
@@ -1275,16 +1275,16 @@ discard block |
||
| 1275 | 1275 | /** |
| 1276 | 1276 | * Renders the edit website element template. |
| 1277 | 1277 | */ |
| 1278 | - public function edit_website_template( $field ) { |
|
| 1279 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
| 1280 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1278 | + public function edit_website_template($field) { |
|
| 1279 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
| 1280 | + $label = __('Field Label', 'invoicing'); |
|
| 1281 | 1281 | $id = $field . '.id + "_edit"'; |
| 1282 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1282 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1283 | 1283 | $id2 = $field . '.id + "_edit2"'; |
| 1284 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1285 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1284 | + $label3 = __('Help text', 'invoicing'); |
|
| 1285 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1286 | 1286 | $id3 = $field . '.id + "_edit3"'; |
| 1287 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1287 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1288 | 1288 | $id4 = $field . '.id + "_edit4"'; |
| 1289 | 1289 | echo " |
| 1290 | 1290 | <div $restrict> |
@@ -1312,8 +1312,8 @@ discard block |
||
| 1312 | 1312 | /** |
| 1313 | 1313 | * Renders the date element template. |
| 1314 | 1314 | */ |
| 1315 | - public function render_date_template( $field ) { |
|
| 1316 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
| 1315 | + public function render_date_template($field) { |
|
| 1316 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
| 1317 | 1317 | $label = "$field.label"; |
| 1318 | 1318 | echo " |
| 1319 | 1319 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1328,23 +1328,23 @@ discard block |
||
| 1328 | 1328 | /** |
| 1329 | 1329 | * Renders the date element on the frontend. |
| 1330 | 1330 | */ |
| 1331 | - public function frontend_render_date_template( $field ) { |
|
| 1331 | + public function frontend_render_date_template($field) { |
|
| 1332 | 1332 | |
| 1333 | 1333 | echo "<div class='form-group'>"; |
| 1334 | 1334 | |
| 1335 | 1335 | echo aui()->input( |
| 1336 | 1336 | array( |
| 1337 | - 'name' => esc_attr( $field['id'] ), |
|
| 1338 | - 'id' => esc_attr( $field['id'] ), |
|
| 1337 | + 'name' => esc_attr($field['id']), |
|
| 1338 | + 'id' => esc_attr($field['id']), |
|
| 1339 | 1339 | 'required' => (bool) $field['required'], |
| 1340 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1340 | + 'label' => wp_kses_post($field['label']), |
|
| 1341 | 1341 | 'no_wrap' => true, |
| 1342 | 1342 | 'type' => 'date', |
| 1343 | 1343 | ) |
| 1344 | 1344 | ); |
| 1345 | 1345 | |
| 1346 | - if ( ! empty( $field['description'] ) ) { |
|
| 1347 | - $description = wp_kses_post( $field['description'] ); |
|
| 1346 | + if (!empty($field['description'])) { |
|
| 1347 | + $description = wp_kses_post($field['description']); |
|
| 1348 | 1348 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1349 | 1349 | } |
| 1350 | 1350 | |
@@ -1355,14 +1355,14 @@ discard block |
||
| 1355 | 1355 | /** |
| 1356 | 1356 | * Renders the edit date element template. |
| 1357 | 1357 | */ |
| 1358 | - public function edit_date_template( $field ) { |
|
| 1359 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
| 1360 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1358 | + public function edit_date_template($field) { |
|
| 1359 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
| 1360 | + $label = __('Field Label', 'invoicing'); |
|
| 1361 | 1361 | $id = $field . '.id + "_edit"'; |
| 1362 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1363 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1362 | + $label3 = __('Help text', 'invoicing'); |
|
| 1363 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1364 | 1364 | $id3 = $field . '.id + "_edit3"'; |
| 1365 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1365 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1366 | 1366 | $id4 = $field . '.id + "_edit4"'; |
| 1367 | 1367 | echo " |
| 1368 | 1368 | <div $restrict> |
@@ -1386,8 +1386,8 @@ discard block |
||
| 1386 | 1386 | /** |
| 1387 | 1387 | * Renders the time element template. |
| 1388 | 1388 | */ |
| 1389 | - public function render_time_template( $field ) { |
|
| 1390 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
| 1389 | + public function render_time_template($field) { |
|
| 1390 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
| 1391 | 1391 | $label = "$field.label"; |
| 1392 | 1392 | echo " |
| 1393 | 1393 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1402,23 +1402,23 @@ discard block |
||
| 1402 | 1402 | /** |
| 1403 | 1403 | * Renders the time element on the frontend. |
| 1404 | 1404 | */ |
| 1405 | - public function frontend_render_time_template( $field ) { |
|
| 1405 | + public function frontend_render_time_template($field) { |
|
| 1406 | 1406 | |
| 1407 | 1407 | echo "<div class='form-group'>"; |
| 1408 | 1408 | |
| 1409 | 1409 | echo aui()->input( |
| 1410 | 1410 | array( |
| 1411 | - 'name' => esc_attr( $field['id'] ), |
|
| 1412 | - 'id' => esc_attr( $field['id'] ), |
|
| 1411 | + 'name' => esc_attr($field['id']), |
|
| 1412 | + 'id' => esc_attr($field['id']), |
|
| 1413 | 1413 | 'required' => (bool) $field['required'], |
| 1414 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1414 | + 'label' => wp_kses_post($field['label']), |
|
| 1415 | 1415 | 'no_wrap' => true, |
| 1416 | 1416 | 'type' => 'time', |
| 1417 | 1417 | ) |
| 1418 | 1418 | ); |
| 1419 | 1419 | |
| 1420 | - if ( ! empty( $field['description'] ) ) { |
|
| 1421 | - $description = wp_kses_post( $field['description'] ); |
|
| 1420 | + if (!empty($field['description'])) { |
|
| 1421 | + $description = wp_kses_post($field['description']); |
|
| 1422 | 1422 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
@@ -1429,14 +1429,14 @@ discard block |
||
| 1429 | 1429 | /** |
| 1430 | 1430 | * Renders the edit time element template. |
| 1431 | 1431 | */ |
| 1432 | - public function edit_time_template( $field ) { |
|
| 1433 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
| 1434 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1432 | + public function edit_time_template($field) { |
|
| 1433 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
| 1434 | + $label = __('Field Label', 'invoicing'); |
|
| 1435 | 1435 | $id = $field . '.id + "_edit"'; |
| 1436 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1437 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1436 | + $label3 = __('Help text', 'invoicing'); |
|
| 1437 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1438 | 1438 | $id3 = $field . '.id + "_edit3"'; |
| 1439 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1439 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1440 | 1440 | $id4 = $field . '.id + "_edit4"'; |
| 1441 | 1441 | echo " |
| 1442 | 1442 | <div $restrict> |
@@ -1460,8 +1460,8 @@ discard block |
||
| 1460 | 1460 | /** |
| 1461 | 1461 | * Renders the number element template. |
| 1462 | 1462 | */ |
| 1463 | - public function render_number_template( $field ) { |
|
| 1464 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
| 1463 | + public function render_number_template($field) { |
|
| 1464 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
| 1465 | 1465 | $label = "$field.label"; |
| 1466 | 1466 | echo " |
| 1467 | 1467 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1476,24 +1476,24 @@ discard block |
||
| 1476 | 1476 | /** |
| 1477 | 1477 | * Renders the number element on the frontend. |
| 1478 | 1478 | */ |
| 1479 | - public function frontend_render_number_template( $field ) { |
|
| 1479 | + public function frontend_render_number_template($field) { |
|
| 1480 | 1480 | |
| 1481 | 1481 | echo "<div class='form-group'>"; |
| 1482 | 1482 | |
| 1483 | 1483 | echo aui()->input( |
| 1484 | 1484 | array( |
| 1485 | - 'name' => esc_attr( $field['id'] ), |
|
| 1486 | - 'id' => esc_attr( $field['id'] ), |
|
| 1485 | + 'name' => esc_attr($field['id']), |
|
| 1486 | + 'id' => esc_attr($field['id']), |
|
| 1487 | 1487 | 'required' => (bool) $field['required'], |
| 1488 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1489 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1488 | + 'label' => wp_kses_post($field['label']), |
|
| 1489 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1490 | 1490 | 'no_wrap' => true, |
| 1491 | 1491 | 'type' => 'number', |
| 1492 | 1492 | ) |
| 1493 | 1493 | ); |
| 1494 | 1494 | |
| 1495 | - if ( ! empty( $field['description'] ) ) { |
|
| 1496 | - $description = wp_kses_post( $field['description'] ); |
|
| 1495 | + if (!empty($field['description'])) { |
|
| 1496 | + $description = wp_kses_post($field['description']); |
|
| 1497 | 1497 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1498 | 1498 | } |
| 1499 | 1499 | |
@@ -1504,16 +1504,16 @@ discard block |
||
| 1504 | 1504 | /** |
| 1505 | 1505 | * Renders the edit number element template. |
| 1506 | 1506 | */ |
| 1507 | - public function edit_number_template( $field ) { |
|
| 1508 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
| 1509 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1507 | + public function edit_number_template($field) { |
|
| 1508 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
| 1509 | + $label = __('Field Label', 'invoicing'); |
|
| 1510 | 1510 | $id = $field . '.id + "_edit"'; |
| 1511 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1511 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1512 | 1512 | $id2 = $field . '.id + "_edit2"'; |
| 1513 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1514 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1513 | + $label3 = __('Help text', 'invoicing'); |
|
| 1514 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1515 | 1515 | $id3 = $field . '.id + "_edit3"'; |
| 1516 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1516 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1517 | 1517 | $id4 = $field . '.id + "_edit4"'; |
| 1518 | 1518 | echo " |
| 1519 | 1519 | <div $restrict> |
@@ -1541,23 +1541,23 @@ discard block |
||
| 1541 | 1541 | /** |
| 1542 | 1542 | * Renders the separator element template. |
| 1543 | 1543 | */ |
| 1544 | - public function render_separator_template( $field ) { |
|
| 1545 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
| 1544 | + public function render_separator_template($field) { |
|
| 1545 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
| 1546 | 1546 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
| 1547 | 1547 | } |
| 1548 | 1548 | |
| 1549 | 1549 | /** |
| 1550 | 1550 | * Renders the separator element on the frontend. |
| 1551 | 1551 | */ |
| 1552 | - public function frontend_render_separator_template( $field ) { |
|
| 1552 | + public function frontend_render_separator_template($field) { |
|
| 1553 | 1553 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | /** |
| 1557 | 1557 | * Renders the pay button element template. |
| 1558 | 1558 | */ |
| 1559 | - public function render_pay_button_template( $field ) { |
|
| 1560 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
| 1559 | + public function render_pay_button_template($field) { |
|
| 1560 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
| 1561 | 1561 | $label = "$field.label"; |
| 1562 | 1562 | echo " |
| 1563 | 1563 | <div $restrict> |
@@ -1570,28 +1570,28 @@ discard block |
||
| 1570 | 1570 | /** |
| 1571 | 1571 | * Renders the pay_button element on the frontend. |
| 1572 | 1572 | */ |
| 1573 | - public function frontend_render_pay_button_template( $field ) { |
|
| 1573 | + public function frontend_render_pay_button_template($field) { |
|
| 1574 | 1574 | |
| 1575 | 1575 | echo "<div class='mt-4 mb-4'>"; |
| 1576 | - do_action( 'wpinv_payment_mode_select' ); |
|
| 1576 | + do_action('wpinv_payment_mode_select'); |
|
| 1577 | 1577 | echo "</div>"; |
| 1578 | 1578 | |
| 1579 | 1579 | echo "<div class='form-group'>"; |
| 1580 | 1580 | |
| 1581 | - $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
| 1581 | + $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
| 1582 | 1582 | echo aui()->input( |
| 1583 | 1583 | array( |
| 1584 | - 'name' => esc_attr( $field['id'] ), |
|
| 1585 | - 'id' => esc_attr( $field['id'] ), |
|
| 1586 | - 'value' => esc_attr( $field['label'] ), |
|
| 1584 | + 'name' => esc_attr($field['id']), |
|
| 1585 | + 'id' => esc_attr($field['id']), |
|
| 1586 | + 'value' => esc_attr($field['label']), |
|
| 1587 | 1587 | 'no_wrap' => true, |
| 1588 | 1588 | 'type' => 'submit', |
| 1589 | 1589 | 'class' => $class, |
| 1590 | 1590 | ) |
| 1591 | 1591 | ); |
| 1592 | 1592 | |
| 1593 | - if ( ! empty( $field['description'] ) ) { |
|
| 1594 | - $description = wp_kses_post( $field['description'] ); |
|
| 1593 | + if (!empty($field['description'])) { |
|
| 1594 | + $description = wp_kses_post($field['description']); |
|
| 1595 | 1595 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1596 | 1596 | } |
| 1597 | 1597 | |
@@ -1602,14 +1602,14 @@ discard block |
||
| 1602 | 1602 | /** |
| 1603 | 1603 | * Renders the pay button element template. |
| 1604 | 1604 | */ |
| 1605 | - public function edit_pay_button_template( $field ) { |
|
| 1606 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
| 1607 | - $label = __( 'Button Text', 'invoicing' ); |
|
| 1605 | + public function edit_pay_button_template($field) { |
|
| 1606 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
| 1607 | + $label = __('Button Text', 'invoicing'); |
|
| 1608 | 1608 | $id = $field . '.id + "_edit"'; |
| 1609 | - $label2 = __( 'Help text', 'invoicing' ); |
|
| 1610 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1609 | + $label2 = __('Help text', 'invoicing'); |
|
| 1610 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1611 | 1611 | $id2 = $field . '.id + "_edit2"'; |
| 1612 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
| 1612 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
| 1613 | 1613 | $id3 = $field . '.id + "_edit3"'; |
| 1614 | 1614 | echo " |
| 1615 | 1615 | <div $restrict> |
@@ -1625,15 +1625,15 @@ discard block |
||
| 1625 | 1625 | <label :for='$id3'>$label4</label> |
| 1626 | 1626 | |
| 1627 | 1627 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
| 1628 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
| 1629 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
| 1630 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
| 1631 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
| 1632 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
| 1633 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
| 1634 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
| 1635 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
| 1636 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
| 1628 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
| 1629 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
| 1630 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
| 1631 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
| 1632 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
| 1633 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
| 1634 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
| 1635 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
| 1636 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
| 1637 | 1637 | </select> |
| 1638 | 1638 | </div> |
| 1639 | 1639 | </div> |
@@ -1644,8 +1644,8 @@ discard block |
||
| 1644 | 1644 | /** |
| 1645 | 1645 | * Renders the alert element template. |
| 1646 | 1646 | */ |
| 1647 | - public function render_alert_template( $field ) { |
|
| 1648 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
| 1647 | + public function render_alert_template($field) { |
|
| 1648 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
| 1649 | 1649 | $text = "$field.text"; |
| 1650 | 1650 | echo " |
| 1651 | 1651 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1660,15 +1660,15 @@ discard block |
||
| 1660 | 1660 | /** |
| 1661 | 1661 | * Renders the alert element on the frontend. |
| 1662 | 1662 | */ |
| 1663 | - public function frontend_render_alert_template( $field ) { |
|
| 1663 | + public function frontend_render_alert_template($field) { |
|
| 1664 | 1664 | |
| 1665 | 1665 | echo "<div class='form-group'>"; |
| 1666 | 1666 | |
| 1667 | 1667 | echo aui()->alert( |
| 1668 | 1668 | array( |
| 1669 | - 'content' => wp_kses_post( $field['text'] ), |
|
| 1669 | + 'content' => wp_kses_post($field['text']), |
|
| 1670 | 1670 | 'dismissible' => $field['dismissible'], |
| 1671 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
| 1671 | + 'type' => str_replace('alert-', '', $field['class']), |
|
| 1672 | 1672 | ) |
| 1673 | 1673 | ); |
| 1674 | 1674 | |
@@ -1679,14 +1679,14 @@ discard block |
||
| 1679 | 1679 | /** |
| 1680 | 1680 | * Renders the alert element template. |
| 1681 | 1681 | */ |
| 1682 | - public function edit_alert_template( $field ) { |
|
| 1683 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
| 1684 | - $label = __( 'Alert Text', 'invoicing' ); |
|
| 1685 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
| 1682 | + public function edit_alert_template($field) { |
|
| 1683 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
| 1684 | + $label = __('Alert Text', 'invoicing'); |
|
| 1685 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
| 1686 | 1686 | $id = $field . '.id + "_edit"'; |
| 1687 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
| 1687 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
| 1688 | 1688 | $id2 = $field . '.id + "_edit2"'; |
| 1689 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
| 1689 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
| 1690 | 1690 | $id3 = $field . '.id + "_edit3"'; |
| 1691 | 1691 | echo " |
| 1692 | 1692 | <div $restrict> |
@@ -1702,14 +1702,14 @@ discard block |
||
| 1702 | 1702 | <label :for='$id3'>$label4</label> |
| 1703 | 1703 | |
| 1704 | 1704 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
| 1705 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
| 1706 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
| 1707 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
| 1708 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
| 1709 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
| 1710 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
| 1711 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
| 1712 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
| 1705 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
| 1706 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
| 1707 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
| 1708 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
| 1709 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
| 1710 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
| 1711 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
| 1712 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
| 1713 | 1713 | </select> |
| 1714 | 1714 | </div> |
| 1715 | 1715 | </div> |
@@ -1720,8 +1720,8 @@ discard block |
||
| 1720 | 1720 | /** |
| 1721 | 1721 | * Renders the discount element template. |
| 1722 | 1722 | */ |
| 1723 | - public function render_discount_template( $field ) { |
|
| 1724 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
| 1723 | + public function render_discount_template($field) { |
|
| 1724 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
| 1725 | 1725 | ?> |
| 1726 | 1726 | |
| 1727 | 1727 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1738,13 +1738,13 @@ discard block |
||
| 1738 | 1738 | /** |
| 1739 | 1739 | * Renders the discount element on the frontend. |
| 1740 | 1740 | */ |
| 1741 | - public function frontend_render_discount_template( $field ) { |
|
| 1741 | + public function frontend_render_discount_template($field) { |
|
| 1742 | 1742 | |
| 1743 | - $placeholder = esc_attr( $field['input_label'] ); |
|
| 1744 | - $label = sanitize_text_field( $field['button_label'] ); |
|
| 1743 | + $placeholder = esc_attr($field['input_label']); |
|
| 1744 | + $label = sanitize_text_field($field['button_label']); |
|
| 1745 | 1745 | $description = ''; |
| 1746 | 1746 | |
| 1747 | - if ( ! empty( $field['description'] ) ) { |
|
| 1747 | + if (!empty($field['description'])) { |
|
| 1748 | 1748 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
| 1749 | 1749 | } |
| 1750 | 1750 | ?> |
@@ -1765,12 +1765,12 @@ discard block |
||
| 1765 | 1765 | /** |
| 1766 | 1766 | * Renders the discount element template. |
| 1767 | 1767 | */ |
| 1768 | - public function edit_discount_template( $field ) { |
|
| 1769 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
| 1770 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
| 1771 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
| 1772 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1773 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
| 1768 | + public function edit_discount_template($field) { |
|
| 1769 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
| 1770 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
| 1771 | + $label2 = __('Help Text', 'invoicing'); |
|
| 1772 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1773 | + $label4 = __('Button Text', 'invoicing'); |
|
| 1774 | 1774 | $id = $field . '.id + "_edit"'; |
| 1775 | 1775 | $id2 = $field . '.id + "_edit2"'; |
| 1776 | 1776 | $id3 = $field . '.id + "_edit3"'; |
@@ -1799,11 +1799,11 @@ discard block |
||
| 1799 | 1799 | /** |
| 1800 | 1800 | * Renders the items element template. |
| 1801 | 1801 | */ |
| 1802 | - public function render_items_template( $field ) { |
|
| 1803 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
| 1804 | - $label = __( 'Item totals will appear here. Click to set items.', 'invoicing' ); |
|
| 1805 | - $label2 = __( 'Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing' ); |
|
| 1806 | - $label2 .= ' ' . __( 'To prevent this, limit customers to selecting a single item.', 'invoicing' ); |
|
| 1802 | + public function render_items_template($field) { |
|
| 1803 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
| 1804 | + $label = __('Item totals will appear here. Click to set items.', 'invoicing'); |
|
| 1805 | + $label2 = __('Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing'); |
|
| 1806 | + $label2 .= ' ' . __('To prevent this, limit customers to selecting a single item.', 'invoicing'); |
|
| 1807 | 1807 | echo " |
| 1808 | 1808 | <div $restrict class='item_totals text-center'> |
| 1809 | 1809 | <div v-if='canCheckoutSeveralSubscriptions($field)' class='p-4 bg-danger text-light'>$label2</div> |
@@ -1815,12 +1815,12 @@ discard block |
||
| 1815 | 1815 | /** |
| 1816 | 1816 | * Renders the items element on the frontend. |
| 1817 | 1817 | */ |
| 1818 | - public function frontend_render_items_template( $field, $items ) { |
|
| 1818 | + public function frontend_render_items_template($field, $items) { |
|
| 1819 | 1819 | |
| 1820 | 1820 | echo "<div class='form-group item_totals'>"; |
| 1821 | 1821 | |
| 1822 | - $id = esc_attr( $field['id'] ); |
|
| 1823 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
| 1822 | + $id = esc_attr($field['id']); |
|
| 1823 | + if ('total' == $field['items_type']) { |
|
| 1824 | 1824 | $total = 0; |
| 1825 | 1825 | $tax = 0; |
| 1826 | 1826 | $sub_total = 0; |
@@ -1829,16 +1829,16 @@ discard block |
||
| 1829 | 1829 | <div class="border item_totals_type_total"> |
| 1830 | 1830 | |
| 1831 | 1831 | <?php |
| 1832 | - foreach( $items as $item ) { |
|
| 1832 | + foreach ($items as $item) { |
|
| 1833 | 1833 | |
| 1834 | - $amount = floatval( $item['price'] ); |
|
| 1834 | + $amount = floatval($item['price']); |
|
| 1835 | 1835 | |
| 1836 | - if ( wpinv_use_taxes() ) { |
|
| 1836 | + if (wpinv_use_taxes()) { |
|
| 1837 | 1837 | |
| 1838 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 1838 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 1839 | 1839 | |
| 1840 | - if ( wpinv_prices_include_tax() ) { |
|
| 1841 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 1840 | + if (wpinv_prices_include_tax()) { |
|
| 1841 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 1842 | 1842 | $item_tax = $amount - $pre_tax; |
| 1843 | 1843 | } else { |
| 1844 | 1844 | $pre_tax = $amount; |
@@ -1850,27 +1850,27 @@ discard block |
||
| 1850 | 1850 | $total = $sub_total + $tax; |
| 1851 | 1851 | |
| 1852 | 1852 | } else { |
| 1853 | - $total = $total + $amount; |
|
| 1853 | + $total = $total + $amount; |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | $class = 'col-8'; |
| 1857 | 1857 | $class2 = ''; |
| 1858 | 1858 | |
| 1859 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 1859 | + if (!empty($item['allow_quantities'])) { |
|
| 1860 | 1860 | $class = 'col-6 pt-2'; |
| 1861 | 1861 | $class2 = 'pt-2'; |
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 1864 | + if (!empty($item['custom_price'])) { |
|
| 1865 | 1865 | $class .= ' pt-2'; |
| 1866 | 1866 | } |
| 1867 | 1867 | |
| 1868 | 1868 | ?> |
| 1869 | 1869 | <div class="item_totals_item"> |
| 1870 | 1870 | <div class='row pl-2 pr-2 pt-2'> |
| 1871 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 1871 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 1872 | 1872 | |
| 1873 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 1873 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 1874 | 1874 | |
| 1875 | 1875 | <div class='col-2'> |
| 1876 | 1876 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -1878,11 +1878,11 @@ discard block |
||
| 1878 | 1878 | |
| 1879 | 1879 | <?php } else { ?> |
| 1880 | 1880 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 1881 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 1881 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 1882 | 1882 | |
| 1883 | 1883 | <div class='col-4 <?php echo $class2; ?>'> |
| 1884 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 1885 | - <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 1884 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 1885 | + <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 1886 | 1886 | </div> |
| 1887 | 1887 | |
| 1888 | 1888 | <?php } else {?> |
@@ -1890,15 +1890,15 @@ discard block |
||
| 1890 | 1890 | <div class='col-4'> |
| 1891 | 1891 | <div class='input-group'> |
| 1892 | 1892 | |
| 1893 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 1893 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 1894 | 1894 | <div class='input-group-prepend'> |
| 1895 | 1895 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 1896 | 1896 | </div> |
| 1897 | 1897 | <?php } ?> |
| 1898 | 1898 | |
| 1899 | - <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
| 1899 | + <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
| 1900 | 1900 | |
| 1901 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 1901 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 1902 | 1902 | <div class='input-group-append'> |
| 1903 | 1903 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 1904 | 1904 | </div> |
@@ -1909,28 +1909,28 @@ discard block |
||
| 1909 | 1909 | <?php } ?> |
| 1910 | 1910 | |
| 1911 | 1911 | </div> |
| 1912 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 1913 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 1912 | + <?php if (!empty($item['description'])) { ?> |
|
| 1913 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 1914 | 1914 | <?php } ?> |
| 1915 | 1915 | </div> |
| 1916 | 1916 | <?php } ?> |
| 1917 | 1917 | |
| 1918 | 1918 | <div class='mt-4 border-top item_totals_total p-2'> |
| 1919 | 1919 | |
| 1920 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 1920 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 1921 | 1921 | <div class='row'> |
| 1922 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 1923 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 1922 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 1923 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 1924 | 1924 | </div> |
| 1925 | 1925 | <div class='row'> |
| 1926 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 1927 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 1926 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 1927 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 1928 | 1928 | </div> |
| 1929 | 1929 | <?php } ?> |
| 1930 | 1930 | |
| 1931 | 1931 | <div class='row'> |
| 1932 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 1933 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
| 1932 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 1933 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
| 1934 | 1934 | </div> |
| 1935 | 1935 | |
| 1936 | 1936 | </div> |
@@ -1938,22 +1938,22 @@ discard block |
||
| 1938 | 1938 | </div> |
| 1939 | 1939 | <?php } ?> |
| 1940 | 1940 | |
| 1941 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
| 1941 | + <?php if ('radio' == $field['items_type']) { ?> |
|
| 1942 | 1942 | <div class="item_totals_type_radio"> |
| 1943 | 1943 | |
| 1944 | 1944 | <?php |
| 1945 | - foreach( $items as $index => $item ) { |
|
| 1945 | + foreach ($items as $index => $item) { |
|
| 1946 | 1946 | |
| 1947 | - if ( ! empty( $item['required'] ) ) { |
|
| 1947 | + if (!empty($item['required'])) { |
|
| 1948 | 1948 | continue; |
| 1949 | 1949 | } |
| 1950 | 1950 | ?> |
| 1951 | 1951 | <div class="form-check"> |
| 1952 | - <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
| 1953 | - <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?> <strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); ?></strong></label> |
|
| 1952 | + <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
| 1953 | + <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?> <strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label> |
|
| 1954 | 1954 | </div> |
| 1955 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 1956 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 1955 | + <?php if (!empty($item['description'])) { ?> |
|
| 1956 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 1957 | 1957 | <?php } ?> |
| 1958 | 1958 | <?php } ?> |
| 1959 | 1959 | |
@@ -1965,32 +1965,32 @@ discard block |
||
| 1965 | 1965 | $tax = 0; |
| 1966 | 1966 | $sub_total = 0; |
| 1967 | 1967 | |
| 1968 | - foreach ( $items as $item ) { |
|
| 1968 | + foreach ($items as $item) { |
|
| 1969 | 1969 | |
| 1970 | 1970 | $class = 'col-8'; |
| 1971 | 1971 | $class2 = ''; |
| 1972 | 1972 | |
| 1973 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 1973 | + if (!empty($item['allow_quantities'])) { |
|
| 1974 | 1974 | $class = 'col-6 pt-2'; |
| 1975 | 1975 | $class2 = 'pt-2'; |
| 1976 | 1976 | } |
| 1977 | 1977 | |
| 1978 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 1978 | + if (!empty($item['custom_price'])) { |
|
| 1979 | 1979 | $class .= ' pt-2'; |
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | 1982 | $class3 = 'd-none'; |
| 1983 | 1983 | $name = ''; |
| 1984 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) { |
|
| 1984 | + if (!empty($item['required']) || !isset($totals_selected_radio_item)) { |
|
| 1985 | 1985 | |
| 1986 | - $amount = floatval( $item['price'] ); |
|
| 1986 | + $amount = floatval($item['price']); |
|
| 1987 | 1987 | |
| 1988 | - if ( wpinv_use_taxes() ) { |
|
| 1988 | + if (wpinv_use_taxes()) { |
|
| 1989 | 1989 | |
| 1990 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 1990 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 1991 | 1991 | |
| 1992 | - if ( wpinv_prices_include_tax() ) { |
|
| 1993 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 1992 | + if (wpinv_prices_include_tax()) { |
|
| 1993 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 1994 | 1994 | $item_tax = $amount - $pre_tax; |
| 1995 | 1995 | } else { |
| 1996 | 1996 | $pre_tax = $amount; |
@@ -2002,13 +2002,13 @@ discard block |
||
| 2002 | 2002 | $total = $sub_total + $tax; |
| 2003 | 2003 | |
| 2004 | 2004 | } else { |
| 2005 | - $total = $total + $amount; |
|
| 2005 | + $total = $total + $amount; |
|
| 2006 | 2006 | } |
| 2007 | 2007 | |
| 2008 | 2008 | $class3 = ''; |
| 2009 | 2009 | $name = "wpinv-items[{$item['id']}]"; |
| 2010 | 2010 | |
| 2011 | - if ( empty( $item['required'] ) ) { |
|
| 2011 | + if (empty($item['required'])) { |
|
| 2012 | 2012 | $totals_selected_radio_item = 1; |
| 2013 | 2013 | } |
| 2014 | 2014 | |
@@ -2020,9 +2020,9 @@ discard block |
||
| 2020 | 2020 | |
| 2021 | 2021 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2022 | 2022 | <div class='row pl-2 pr-2 pt-2'> |
| 2023 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2023 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2024 | 2024 | |
| 2025 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2025 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2026 | 2026 | |
| 2027 | 2027 | <div class='col-2'> |
| 2028 | 2028 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2030,11 +2030,11 @@ discard block |
||
| 2030 | 2030 | |
| 2031 | 2031 | <?php } else { ?> |
| 2032 | 2032 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2033 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2033 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2034 | 2034 | |
| 2035 | 2035 | <div class='col-4 <?php echo $class2; ?>'> |
| 2036 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2037 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2036 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2037 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2038 | 2038 | </div> |
| 2039 | 2039 | |
| 2040 | 2040 | <?php } else {?> |
@@ -2042,15 +2042,15 @@ discard block |
||
| 2042 | 2042 | <div class='col-4'> |
| 2043 | 2043 | <div class='input-group'> |
| 2044 | 2044 | |
| 2045 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2045 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2046 | 2046 | <div class='input-group-prepend'> |
| 2047 | 2047 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2048 | 2048 | </div> |
| 2049 | 2049 | <?php } ?> |
| 2050 | 2050 | |
| 2051 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
| 2051 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
| 2052 | 2052 | |
| 2053 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2053 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2054 | 2054 | <div class='input-group-append'> |
| 2055 | 2055 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2056 | 2056 | </div> |
@@ -2061,27 +2061,27 @@ discard block |
||
| 2061 | 2061 | <?php } ?> |
| 2062 | 2062 | |
| 2063 | 2063 | </div> |
| 2064 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2065 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2064 | + <?php if (!empty($item['description'])) { ?> |
|
| 2065 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2066 | 2066 | <?php } ?> |
| 2067 | 2067 | </div> |
| 2068 | 2068 | <?php } ?> |
| 2069 | 2069 | |
| 2070 | 2070 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2071 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2071 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2072 | 2072 | <div class='row'> |
| 2073 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2074 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2073 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2074 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2075 | 2075 | </div> |
| 2076 | 2076 | <div class='row'> |
| 2077 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2078 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2077 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2078 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2079 | 2079 | </div> |
| 2080 | 2080 | <?php } ?> |
| 2081 | 2081 | |
| 2082 | 2082 | <div class='row'> |
| 2083 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2084 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
| 2083 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2084 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
| 2085 | 2085 | </div> |
| 2086 | 2086 | </div> |
| 2087 | 2087 | |
@@ -2089,22 +2089,22 @@ discard block |
||
| 2089 | 2089 | </div> |
| 2090 | 2090 | <?php } ?> |
| 2091 | 2091 | |
| 2092 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
| 2092 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
| 2093 | 2093 | |
| 2094 | 2094 | <div class="item_totals_type_checkbox"> |
| 2095 | 2095 | |
| 2096 | 2096 | <?php |
| 2097 | - foreach ( $items as $index => $item ) { |
|
| 2097 | + foreach ($items as $index => $item) { |
|
| 2098 | 2098 | |
| 2099 | - if ( ! empty( $item['required'] ) ) { |
|
| 2099 | + if (!empty($item['required'])) { |
|
| 2100 | 2100 | continue; |
| 2101 | 2101 | } |
| 2102 | 2102 | |
| 2103 | - $title = sanitize_text_field( $item['title'] ); |
|
| 2104 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
| 2105 | - $item_id = esc_attr( $id . "_$index" ); |
|
| 2106 | - $value = esc_attr( $item['id'] ); |
|
| 2107 | - $checked = checked( ! isset( $selected_checkbox_item ), true, false ); |
|
| 2103 | + $title = sanitize_text_field($item['title']); |
|
| 2104 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
| 2105 | + $item_id = esc_attr($id . "_$index"); |
|
| 2106 | + $value = esc_attr($item['id']); |
|
| 2107 | + $checked = checked(!isset($selected_checkbox_item), true, false); |
|
| 2108 | 2108 | $selected_checkbox_item = 1; |
| 2109 | 2109 | |
| 2110 | 2110 | echo " |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | <label for='$item_id' class='custom-control-label'>$title ($price)</label> |
| 2114 | 2114 | </div>"; |
| 2115 | 2115 | |
| 2116 | - if ( ! empty( $item['description'] ) ) { |
|
| 2116 | + if (!empty($item['description'])) { |
|
| 2117 | 2117 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
| 2118 | 2118 | } |
| 2119 | 2119 | } |
@@ -2127,31 +2127,31 @@ discard block |
||
| 2127 | 2127 | $tax = 0; |
| 2128 | 2128 | $sub_total = 0; |
| 2129 | 2129 | |
| 2130 | - foreach ( $items as $item ) { |
|
| 2130 | + foreach ($items as $item) { |
|
| 2131 | 2131 | |
| 2132 | 2132 | $class = 'col-8'; |
| 2133 | 2133 | $class2 = ''; |
| 2134 | 2134 | |
| 2135 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 2135 | + if (!empty($item['allow_quantities'])) { |
|
| 2136 | 2136 | $class = 'col-6 pt-2'; |
| 2137 | 2137 | $class2 = 'pt-2'; |
| 2138 | 2138 | } |
| 2139 | 2139 | |
| 2140 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 2140 | + if (!empty($item['custom_price'])) { |
|
| 2141 | 2141 | $class .= ' pt-2'; |
| 2142 | 2142 | } |
| 2143 | 2143 | |
| 2144 | 2144 | $class3 = 'd-none'; |
| 2145 | - $name = ''; |
|
| 2146 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) { |
|
| 2145 | + $name = ''; |
|
| 2146 | + if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) { |
|
| 2147 | 2147 | |
| 2148 | - $amount = floatval( $item['price'] ); |
|
| 2149 | - if ( wpinv_use_taxes() ) { |
|
| 2148 | + $amount = floatval($item['price']); |
|
| 2149 | + if (wpinv_use_taxes()) { |
|
| 2150 | 2150 | |
| 2151 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 2151 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 2152 | 2152 | |
| 2153 | - if ( wpinv_prices_include_tax() ) { |
|
| 2154 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 2153 | + if (wpinv_prices_include_tax()) { |
|
| 2154 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 2155 | 2155 | $item_tax = $amount - $pre_tax; |
| 2156 | 2156 | } else { |
| 2157 | 2157 | $pre_tax = $amount; |
@@ -2163,13 +2163,13 @@ discard block |
||
| 2163 | 2163 | $total = $sub_total + $tax; |
| 2164 | 2164 | |
| 2165 | 2165 | } else { |
| 2166 | - $total = $total + $amount; |
|
| 2166 | + $total = $total + $amount; |
|
| 2167 | 2167 | } |
| 2168 | 2168 | |
| 2169 | 2169 | $class3 = ''; |
| 2170 | - $name = "wpinv-items[{$item['id']}]"; |
|
| 2170 | + $name = "wpinv-items[{$item['id']}]"; |
|
| 2171 | 2171 | |
| 2172 | - if ( empty( $item['required'] ) ) { |
|
| 2172 | + if (empty($item['required'])) { |
|
| 2173 | 2173 | $totals_selected_checkbox_item = 1; |
| 2174 | 2174 | } |
| 2175 | 2175 | |
@@ -2181,9 +2181,9 @@ discard block |
||
| 2181 | 2181 | |
| 2182 | 2182 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2183 | 2183 | <div class='row pl-2 pr-2 pt-2'> |
| 2184 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2184 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2185 | 2185 | |
| 2186 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2186 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2187 | 2187 | |
| 2188 | 2188 | <div class='col-2'> |
| 2189 | 2189 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2191,11 +2191,11 @@ discard block |
||
| 2191 | 2191 | |
| 2192 | 2192 | <?php } else { ?> |
| 2193 | 2193 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2194 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2194 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2195 | 2195 | |
| 2196 | 2196 | <div class='col-4 <?php echo $class2; ?>'> |
| 2197 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2198 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2197 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2198 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2199 | 2199 | </div> |
| 2200 | 2200 | |
| 2201 | 2201 | <?php } else {?> |
@@ -2203,15 +2203,15 @@ discard block |
||
| 2203 | 2203 | <div class='col-4'> |
| 2204 | 2204 | <div class='input-group'> |
| 2205 | 2205 | |
| 2206 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2206 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2207 | 2207 | <div class='input-group-prepend'> |
| 2208 | 2208 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2209 | 2209 | </div> |
| 2210 | 2210 | <?php } ?> |
| 2211 | 2211 | |
| 2212 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
| 2212 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
| 2213 | 2213 | |
| 2214 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2214 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2215 | 2215 | <div class='input-group-append'> |
| 2216 | 2216 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2217 | 2217 | </div> |
@@ -2222,35 +2222,35 @@ discard block |
||
| 2222 | 2222 | <?php } ?> |
| 2223 | 2223 | |
| 2224 | 2224 | </div> |
| 2225 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2226 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2225 | + <?php if (!empty($item['description'])) { ?> |
|
| 2226 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2227 | 2227 | <?php } ?> |
| 2228 | 2228 | </div> |
| 2229 | 2229 | <?php } ?> |
| 2230 | 2230 | |
| 2231 | 2231 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2232 | 2232 | |
| 2233 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2233 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2234 | 2234 | <div class='row'> |
| 2235 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2236 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2235 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2236 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2237 | 2237 | </div> |
| 2238 | 2238 | <div class='row'> |
| 2239 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2240 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2239 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2240 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2241 | 2241 | </div> |
| 2242 | 2242 | <?php } ?> |
| 2243 | 2243 | |
| 2244 | 2244 | <div class='row'> |
| 2245 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2246 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
| 2245 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2246 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
| 2247 | 2247 | </div> |
| 2248 | 2248 | </div> |
| 2249 | 2249 | </div> |
| 2250 | 2250 | </div> |
| 2251 | 2251 | <?php } ?> |
| 2252 | 2252 | |
| 2253 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
| 2253 | + <?php if ('select' == $field['items_type']) { ?> |
|
| 2254 | 2254 | |
| 2255 | 2255 | <div class="item_totals_type_select"> |
| 2256 | 2256 | |
@@ -2258,17 +2258,17 @@ discard block |
||
| 2258 | 2258 | |
| 2259 | 2259 | $options = array(); |
| 2260 | 2260 | $selected = ''; |
| 2261 | - foreach ( $items as $index => $item ) { |
|
| 2261 | + foreach ($items as $index => $item) { |
|
| 2262 | 2262 | |
| 2263 | - if ( ! empty( $item['required'] ) ) { |
|
| 2263 | + if (!empty($item['required'])) { |
|
| 2264 | 2264 | continue; |
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | - $title = sanitize_text_field( $item['title'] ); |
|
| 2268 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
| 2269 | - $options[ $item['id'] ] = "$title ($price)"; |
|
| 2267 | + $title = sanitize_text_field($item['title']); |
|
| 2268 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
| 2269 | + $options[$item['id']] = "$title ($price)"; |
|
| 2270 | 2270 | |
| 2271 | - if ( ! isset( $selected_item ) ) { |
|
| 2271 | + if (!isset($selected_item)) { |
|
| 2272 | 2272 | $selected = $item['id']; |
| 2273 | 2273 | $selected_item = 1; |
| 2274 | 2274 | } |
@@ -2279,7 +2279,7 @@ discard block |
||
| 2279 | 2279 | array( |
| 2280 | 2280 | 'name' => 'payment-form-items', |
| 2281 | 2281 | 'id' => $id, |
| 2282 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
| 2282 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
| 2283 | 2283 | 'no_wrap' => true, |
| 2284 | 2284 | 'options' => $options, |
| 2285 | 2285 | 'class' => 'wpi_select2 wpinv-items-select-selector', |
@@ -2296,31 +2296,31 @@ discard block |
||
| 2296 | 2296 | $tax = 0; |
| 2297 | 2297 | $sub_total = 0; |
| 2298 | 2298 | |
| 2299 | - foreach ( $items as $item ) { |
|
| 2299 | + foreach ($items as $item) { |
|
| 2300 | 2300 | |
| 2301 | 2301 | $class = 'col-8'; |
| 2302 | 2302 | $class2 = ''; |
| 2303 | 2303 | |
| 2304 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 2304 | + if (!empty($item['allow_quantities'])) { |
|
| 2305 | 2305 | $class = 'col-6 pt-2'; |
| 2306 | 2306 | $class2 = 'pt-2'; |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 2309 | + if (!empty($item['custom_price'])) { |
|
| 2310 | 2310 | $class .= ' pt-2'; |
| 2311 | 2311 | } |
| 2312 | 2312 | |
| 2313 | 2313 | $class3 = 'd-none'; |
| 2314 | - $name = ''; |
|
| 2315 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
| 2314 | + $name = ''; |
|
| 2315 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
| 2316 | 2316 | |
| 2317 | - $amount = floatval( $item['price'] ); |
|
| 2318 | - if ( wpinv_use_taxes() ) { |
|
| 2317 | + $amount = floatval($item['price']); |
|
| 2318 | + if (wpinv_use_taxes()) { |
|
| 2319 | 2319 | |
| 2320 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 2320 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 2321 | 2321 | |
| 2322 | - if ( wpinv_prices_include_tax() ) { |
|
| 2323 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 2322 | + if (wpinv_prices_include_tax()) { |
|
| 2323 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 2324 | 2324 | $item_tax = $amount - $pre_tax; |
| 2325 | 2325 | } else { |
| 2326 | 2326 | $pre_tax = $amount; |
@@ -2332,13 +2332,13 @@ discard block |
||
| 2332 | 2332 | $total = $sub_total + $tax; |
| 2333 | 2333 | |
| 2334 | 2334 | } else { |
| 2335 | - $total = $total + $amount; |
|
| 2335 | + $total = $total + $amount; |
|
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | $class3 = ''; |
| 2339 | - $name = "wpinv-items[{$item['id']}]"; |
|
| 2339 | + $name = "wpinv-items[{$item['id']}]"; |
|
| 2340 | 2340 | |
| 2341 | - if ( empty( $item['required'] ) ) { |
|
| 2341 | + if (empty($item['required'])) { |
|
| 2342 | 2342 | $totals_selected_select_item = 1; |
| 2343 | 2343 | } |
| 2344 | 2344 | |
@@ -2350,9 +2350,9 @@ discard block |
||
| 2350 | 2350 | |
| 2351 | 2351 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2352 | 2352 | <div class='row pl-2 pr-2 pt-2'> |
| 2353 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2353 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2354 | 2354 | |
| 2355 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2355 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2356 | 2356 | |
| 2357 | 2357 | <div class='col-2'> |
| 2358 | 2358 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2360,11 +2360,11 @@ discard block |
||
| 2360 | 2360 | |
| 2361 | 2361 | <?php } else { ?> |
| 2362 | 2362 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2363 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2363 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2364 | 2364 | |
| 2365 | 2365 | <div class='col-4 <?php echo $class2; ?>'> |
| 2366 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2367 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2366 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2367 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2368 | 2368 | </div> |
| 2369 | 2369 | |
| 2370 | 2370 | <?php } else {?> |
@@ -2372,15 +2372,15 @@ discard block |
||
| 2372 | 2372 | <div class='col-4'> |
| 2373 | 2373 | <div class='input-group'> |
| 2374 | 2374 | |
| 2375 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2375 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2376 | 2376 | <div class='input-group-prepend'> |
| 2377 | 2377 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2378 | 2378 | </div> |
| 2379 | 2379 | <?php } ?> |
| 2380 | 2380 | |
| 2381 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
| 2381 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
| 2382 | 2382 | |
| 2383 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2383 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2384 | 2384 | <div class='input-group-append'> |
| 2385 | 2385 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2386 | 2386 | </div> |
@@ -2391,34 +2391,34 @@ discard block |
||
| 2391 | 2391 | <?php } ?> |
| 2392 | 2392 | |
| 2393 | 2393 | </div> |
| 2394 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2395 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2394 | + <?php if (!empty($item['description'])) { ?> |
|
| 2395 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2396 | 2396 | <?php } ?> |
| 2397 | 2397 | </div> |
| 2398 | 2398 | <?php } ?> |
| 2399 | 2399 | |
| 2400 | 2400 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2401 | 2401 | |
| 2402 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2402 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2403 | 2403 | <div class='row'> |
| 2404 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2405 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2404 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2405 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2406 | 2406 | </div> |
| 2407 | 2407 | <div class='row'> |
| 2408 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2409 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2408 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2409 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2410 | 2410 | </div> |
| 2411 | 2411 | <?php } ?> |
| 2412 | 2412 | <div class='row'> |
| 2413 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2414 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
| 2413 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2414 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
| 2415 | 2415 | </div> |
| 2416 | 2416 | </div> |
| 2417 | 2417 | |
| 2418 | 2418 | </div> |
| 2419 | 2419 | <?php } ?> |
| 2420 | 2420 | |
| 2421 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
| 2421 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
| 2422 | 2422 | |
| 2423 | 2423 | <div class="item_totals_type_multi_select"> |
| 2424 | 2424 | |
@@ -2427,18 +2427,18 @@ discard block |
||
| 2427 | 2427 | $options = array(); |
| 2428 | 2428 | $selected = array(); |
| 2429 | 2429 | |
| 2430 | - foreach ( $items as $index => $item ) { |
|
| 2430 | + foreach ($items as $index => $item) { |
|
| 2431 | 2431 | |
| 2432 | - if ( ! empty( $item['required'] ) ) { |
|
| 2432 | + if (!empty($item['required'])) { |
|
| 2433 | 2433 | continue; |
| 2434 | 2434 | } |
| 2435 | 2435 | |
| 2436 | - $title = sanitize_text_field( $item['title'] ); |
|
| 2437 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
| 2438 | - $options[ $item['id'] ] = "$title ($price)"; |
|
| 2436 | + $title = sanitize_text_field($item['title']); |
|
| 2437 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
| 2438 | + $options[$item['id']] = "$title ($price)"; |
|
| 2439 | 2439 | |
| 2440 | - if ( ! isset( $selected_item ) ) { |
|
| 2441 | - $selected = array( $item['id'] ); |
|
| 2440 | + if (!isset($selected_item)) { |
|
| 2441 | + $selected = array($item['id']); |
|
| 2442 | 2442 | $selected_item = 1; |
| 2443 | 2443 | } |
| 2444 | 2444 | |
@@ -2465,31 +2465,31 @@ discard block |
||
| 2465 | 2465 | $tax = 0; |
| 2466 | 2466 | $sub_total = 0; |
| 2467 | 2467 | |
| 2468 | - foreach ( $items as $item ) { |
|
| 2468 | + foreach ($items as $item) { |
|
| 2469 | 2469 | |
| 2470 | 2470 | $class = 'col-8'; |
| 2471 | 2471 | $class2 = ''; |
| 2472 | 2472 | |
| 2473 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 2473 | + if (!empty($item['allow_quantities'])) { |
|
| 2474 | 2474 | $class = 'col-6 pt-2'; |
| 2475 | 2475 | $class2 = 'pt-2'; |
| 2476 | 2476 | } |
| 2477 | 2477 | |
| 2478 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 2478 | + if (!empty($item['custom_price'])) { |
|
| 2479 | 2479 | $class .= ' pt-2'; |
| 2480 | 2480 | } |
| 2481 | 2481 | |
| 2482 | 2482 | $class3 = 'd-none'; |
| 2483 | - $name = ''; |
|
| 2484 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
| 2483 | + $name = ''; |
|
| 2484 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
| 2485 | 2485 | |
| 2486 | - $amount = floatval( $item['price'] ); |
|
| 2487 | - if ( wpinv_use_taxes() ) { |
|
| 2486 | + $amount = floatval($item['price']); |
|
| 2487 | + if (wpinv_use_taxes()) { |
|
| 2488 | 2488 | |
| 2489 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 2489 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 2490 | 2490 | |
| 2491 | - if ( wpinv_prices_include_tax() ) { |
|
| 2492 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 2491 | + if (wpinv_prices_include_tax()) { |
|
| 2492 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 2493 | 2493 | $item_tax = $amount - $pre_tax; |
| 2494 | 2494 | } else { |
| 2495 | 2495 | $pre_tax = $amount; |
@@ -2501,13 +2501,13 @@ discard block |
||
| 2501 | 2501 | $total = $sub_total + $tax; |
| 2502 | 2502 | |
| 2503 | 2503 | } else { |
| 2504 | - $total = $total + $amount; |
|
| 2504 | + $total = $total + $amount; |
|
| 2505 | 2505 | } |
| 2506 | 2506 | |
| 2507 | 2507 | $class3 = ''; |
| 2508 | - $name = "wpinv-items[{$item['id']}]"; |
|
| 2508 | + $name = "wpinv-items[{$item['id']}]"; |
|
| 2509 | 2509 | |
| 2510 | - if ( empty( $item['required'] ) ) { |
|
| 2510 | + if (empty($item['required'])) { |
|
| 2511 | 2511 | $totals_selected_select_item = 1; |
| 2512 | 2512 | } |
| 2513 | 2513 | |
@@ -2519,9 +2519,9 @@ discard block |
||
| 2519 | 2519 | |
| 2520 | 2520 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2521 | 2521 | <div class='row pl-2 pr-2 pt-2'> |
| 2522 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2522 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2523 | 2523 | |
| 2524 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2524 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2525 | 2525 | |
| 2526 | 2526 | <div class='col-2'> |
| 2527 | 2527 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2529,11 +2529,11 @@ discard block |
||
| 2529 | 2529 | |
| 2530 | 2530 | <?php } else { ?> |
| 2531 | 2531 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2532 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2532 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2533 | 2533 | |
| 2534 | 2534 | <div class='col-4 <?php echo $class2; ?>'> |
| 2535 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2536 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2535 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2536 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2537 | 2537 | </div> |
| 2538 | 2538 | |
| 2539 | 2539 | <?php } else {?> |
@@ -2541,15 +2541,15 @@ discard block |
||
| 2541 | 2541 | <div class='col-4'> |
| 2542 | 2542 | <div class='input-group'> |
| 2543 | 2543 | |
| 2544 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2544 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2545 | 2545 | <div class='input-group-prepend'> |
| 2546 | 2546 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2547 | 2547 | </div> |
| 2548 | 2548 | <?php } ?> |
| 2549 | 2549 | |
| 2550 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
| 2550 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
| 2551 | 2551 | |
| 2552 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2552 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2553 | 2553 | <div class='input-group-append'> |
| 2554 | 2554 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2555 | 2555 | </div> |
@@ -2560,35 +2560,35 @@ discard block |
||
| 2560 | 2560 | <?php } ?> |
| 2561 | 2561 | |
| 2562 | 2562 | </div> |
| 2563 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2564 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2563 | + <?php if (!empty($item['description'])) { ?> |
|
| 2564 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2565 | 2565 | <?php } ?> |
| 2566 | 2566 | </div> |
| 2567 | 2567 | <?php } ?> |
| 2568 | 2568 | |
| 2569 | 2569 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2570 | 2570 | |
| 2571 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2571 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2572 | 2572 | <div class='row'> |
| 2573 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2574 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2573 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2574 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2575 | 2575 | </div> |
| 2576 | 2576 | <div class='row'> |
| 2577 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2578 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2577 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2578 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2579 | 2579 | </div> |
| 2580 | 2580 | <?php } ?> |
| 2581 | 2581 | |
| 2582 | 2582 | <div class='row'> |
| 2583 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2584 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
| 2583 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2584 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
| 2585 | 2585 | </div> |
| 2586 | 2586 | </div> |
| 2587 | 2587 | |
| 2588 | 2588 | </div> |
| 2589 | 2589 | <?php } ?> |
| 2590 | - <?php if ( ! empty( $field[ 'description' ] ) ) { ?> |
|
| 2591 | - <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small> |
|
| 2590 | + <?php if (!empty($field['description'])) { ?> |
|
| 2591 | + <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small> |
|
| 2592 | 2592 | <?php } ?> |
| 2593 | 2593 | </div> |
| 2594 | 2594 | <?php |
@@ -2597,20 +2597,20 @@ discard block |
||
| 2597 | 2597 | /** |
| 2598 | 2598 | * Renders the items element template. |
| 2599 | 2599 | */ |
| 2600 | - public function edit_items_template( $field ) { |
|
| 2601 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
| 2602 | - $label = __( 'Let customers...', 'invoicing' ); |
|
| 2603 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
| 2604 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
| 2600 | + public function edit_items_template($field) { |
|
| 2601 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
| 2602 | + $label = __('Let customers...', 'invoicing'); |
|
| 2603 | + $label2 = __('Available Items', 'invoicing'); |
|
| 2604 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
| 2605 | 2605 | $id = $field . '.id + "_edit"'; |
| 2606 | 2606 | $id2 = $field . '.id + "_edit2"'; |
| 2607 | 2607 | $id3 = $field . '.id + "_edit3"'; |
| 2608 | 2608 | $id4 = $field . '.id + "_edit4"'; |
| 2609 | - $label4 = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' ); |
|
| 2610 | - $label5 = esc_attr__( 'Allow users to pay what they want', 'invoicing' ); |
|
| 2611 | - $label6 = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' ); |
|
| 2612 | - $label7 = esc_attr__( 'Allow users to buy several quantities', 'invoicing' ); |
|
| 2613 | - $label8 = esc_attr__( 'This item is required', 'invoicing' ); |
|
| 2609 | + $label4 = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing'); |
|
| 2610 | + $label5 = esc_attr__('Allow users to pay what they want', 'invoicing'); |
|
| 2611 | + $label6 = esc_attr__('Enter the minimum price that a user can pay', 'invoicing'); |
|
| 2612 | + $label7 = esc_attr__('Allow users to buy several quantities', 'invoicing'); |
|
| 2613 | + $label8 = esc_attr__('This item is required', 'invoicing'); |
|
| 2614 | 2614 | echo "<div $restrict> |
| 2615 | 2615 | |
| 2616 | 2616 | <label>$label2</label> |
@@ -2680,7 +2680,7 @@ discard block |
||
| 2680 | 2680 | <div class='form-group mt-2'> |
| 2681 | 2681 | |
| 2682 | 2682 | <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'> |
| 2683 | - <option value=''>" . __( 'Add an existing item to the form', 'invoicing' ) ."</option> |
|
| 2683 | + <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option> |
|
| 2684 | 2684 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
| 2685 | 2685 | </select> |
| 2686 | 2686 | |
@@ -2695,11 +2695,11 @@ discard block |
||
| 2695 | 2695 | <label :for='$id2'>$label</label> |
| 2696 | 2696 | |
| 2697 | 2697 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
| 2698 | - <option value='total' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
| 2699 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
| 2700 | - <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
| 2701 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
| 2702 | - <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
| 2698 | + <option value='total' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
| 2699 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
| 2700 | + <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
| 2701 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
| 2702 | + <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
| 2703 | 2703 | </select> |
| 2704 | 2704 | |
| 2705 | 2705 | </div> |
@@ -2724,7 +2724,7 @@ discard block |
||
| 2724 | 2724 | 'orderby' => 'title', |
| 2725 | 2725 | 'order' => 'ASC', |
| 2726 | 2726 | 'posts_per_page' => -1, |
| 2727 | - 'post_status' => array( 'publish' ), |
|
| 2727 | + 'post_status' => array('publish'), |
|
| 2728 | 2728 | 'meta_query' => array( |
| 2729 | 2729 | array( |
| 2730 | 2730 | 'key' => '_wpinv_type', |
@@ -2734,24 +2734,24 @@ discard block |
||
| 2734 | 2734 | ) |
| 2735 | 2735 | ); |
| 2736 | 2736 | |
| 2737 | - $items = get_posts( apply_filters( 'wpinv_payment_form_item_dropdown_query_args', $item_args ) ); |
|
| 2737 | + $items = get_posts(apply_filters('wpinv_payment_form_item_dropdown_query_args', $item_args)); |
|
| 2738 | 2738 | |
| 2739 | - if ( empty( $items ) ) { |
|
| 2739 | + if (empty($items)) { |
|
| 2740 | 2740 | return array(); |
| 2741 | 2741 | } |
| 2742 | 2742 | |
| 2743 | - $options = array(); |
|
| 2744 | - foreach ( $items as $item ) { |
|
| 2745 | - $title = esc_html( $item->post_title ); |
|
| 2746 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
| 2747 | - $id = absint( $item->ID ); |
|
| 2748 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
| 2749 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
| 2743 | + $options = array(); |
|
| 2744 | + foreach ($items as $item) { |
|
| 2745 | + $title = esc_html($item->post_title); |
|
| 2746 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
| 2747 | + $id = absint($item->ID); |
|
| 2748 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
| 2749 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
| 2750 | 2750 | $description = $item->post_excerpt; |
| 2751 | - $custom_price = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true ); |
|
| 2752 | - $minimum_price = (float) get_post_meta( $id, '_minimum_price', true ); |
|
| 2751 | + $custom_price = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true); |
|
| 2752 | + $minimum_price = (float) get_post_meta($id, '_minimum_price', true); |
|
| 2753 | 2753 | $allow_quantities = false; |
| 2754 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' ); |
|
| 2754 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities'); |
|
| 2755 | 2755 | |
| 2756 | 2756 | } |
| 2757 | 2757 | return $options; |
@@ -2761,47 +2761,47 @@ discard block |
||
| 2761 | 2761 | /** |
| 2762 | 2762 | * Returns an array of items for the currently being edited form. |
| 2763 | 2763 | */ |
| 2764 | - public function get_form_items( $id = false ) { |
|
| 2764 | + public function get_form_items($id = false) { |
|
| 2765 | 2765 | |
| 2766 | - if ( empty( $id ) ) { |
|
| 2767 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
| 2766 | + if (empty($id)) { |
|
| 2767 | + return wpinv_get_data('sample-payment-form-items'); |
|
| 2768 | 2768 | } |
| 2769 | 2769 | |
| 2770 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
| 2770 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
| 2771 | 2771 | |
| 2772 | - if ( is_array( $form_elements ) ) { |
|
| 2772 | + if (is_array($form_elements)) { |
|
| 2773 | 2773 | return $form_elements; |
| 2774 | 2774 | } |
| 2775 | 2775 | |
| 2776 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
| 2776 | + return wpinv_get_data('sample-payment-form-items'); |
|
| 2777 | 2777 | |
| 2778 | 2778 | } |
| 2779 | 2779 | |
| 2780 | 2780 | /** |
| 2781 | 2781 | * Returns an array of elements for the currently being edited form. |
| 2782 | 2782 | */ |
| 2783 | - public function get_form_elements( $id = false ) { |
|
| 2783 | + public function get_form_elements($id = false) { |
|
| 2784 | 2784 | |
| 2785 | - if ( empty( $id ) ) { |
|
| 2786 | - return wpinv_get_data( 'sample-payment-form' ); |
|
| 2785 | + if (empty($id)) { |
|
| 2786 | + return wpinv_get_data('sample-payment-form'); |
|
| 2787 | 2787 | } |
| 2788 | 2788 | |
| 2789 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
| 2789 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
| 2790 | 2790 | |
| 2791 | - if ( is_array( $form_elements ) ) { |
|
| 2791 | + if (is_array($form_elements)) { |
|
| 2792 | 2792 | return $form_elements; |
| 2793 | 2793 | } |
| 2794 | 2794 | |
| 2795 | - return wpinv_get_data( 'sample-payment-form' ); |
|
| 2795 | + return wpinv_get_data('sample-payment-form'); |
|
| 2796 | 2796 | } |
| 2797 | 2797 | |
| 2798 | 2798 | /** |
| 2799 | 2799 | * Sends a redrect response to payment details. |
| 2800 | 2800 | * |
| 2801 | 2801 | */ |
| 2802 | - public function send_redirect_response( $url ) { |
|
| 2803 | - $url = urlencode( $url ); |
|
| 2804 | - wp_send_json_success( $url ); |
|
| 2802 | + public function send_redirect_response($url) { |
|
| 2803 | + $url = urlencode($url); |
|
| 2804 | + wp_send_json_success($url); |
|
| 2805 | 2805 | } |
| 2806 | 2806 | |
| 2807 | 2807 | /** |
@@ -2812,12 +2812,12 @@ discard block |
||
| 2812 | 2812 | |
| 2813 | 2813 | $errors = wpinv_get_errors(); |
| 2814 | 2814 | |
| 2815 | - if ( ! empty( $errors ) ) { |
|
| 2815 | + if (!empty($errors)) { |
|
| 2816 | 2816 | wpinv_print_errors(); |
| 2817 | 2817 | exit; |
| 2818 | 2818 | } |
| 2819 | 2819 | |
| 2820 | - wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) ); |
|
| 2820 | + wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing')); |
|
| 2821 | 2821 | exit; |
| 2822 | 2822 | |
| 2823 | 2823 | } |