@@ -512,7 +512,7 @@ |
||
512 | 512 | |
513 | 513 | $response['success'] = true; |
514 | 514 | $response['msg'] = __( 'Discount has been applied successfully.', 'invoicing' ); |
515 | - } else { |
|
515 | + } else { |
|
516 | 516 | $errors = wpinv_get_errors(); |
517 | 517 | if ( !empty( $errors['wpinv-discount-error'] ) ) { |
518 | 518 | $response['msg'] = $errors['wpinv-discount-error']; |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly. |
3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | /** |
6 | 8 | * The Subscriptions DB Class |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | abstract class Wpinv_DB { |
7 | 9 |
@@ -8,7 +8,9 @@ |
||
8 | 8 | |
9 | 9 | |
10 | 10 | // Exit if accessed directly |
11 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
11 | +if ( ! defined( 'ABSPATH' ) ) { |
|
12 | + exit; |
|
13 | +} |
|
12 | 14 | |
13 | 15 | |
14 | 16 | // Load WP_List_Table if not loaded |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly. |
3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | function wpinv_subscription_init() { |
6 | 8 | return WPInv_Subscriptions::instance(); |
@@ -1010,10 +1010,11 @@ discard block |
||
1010 | 1010 | |
1011 | 1011 | $checked = false; |
1012 | 1012 | |
1013 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
1014 | - $checked = true; |
|
1015 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
1016 | - $checked = true; |
|
1013 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) { |
|
1014 | + $checked = true; |
|
1015 | + } elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) { |
|
1016 | + $checked = true; |
|
1017 | + } |
|
1017 | 1018 | |
1018 | 1019 | echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
1019 | 1020 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
@@ -1030,10 +1031,11 @@ discard block |
||
1030 | 1031 | foreach ( $args['options'] as $key => $option ) : |
1031 | 1032 | $sanitize_key = wpinv_sanitize_key( $key ); |
1032 | 1033 | |
1033 | - if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
|
1034 | - $enabled = '1'; |
|
1035 | - else |
|
1036 | - $enabled = null; |
|
1034 | + if ( isset( $wpinv_options['gateways'][ $key ] ) ) { |
|
1035 | + $enabled = '1'; |
|
1036 | + } else { |
|
1037 | + $enabled = null; |
|
1038 | + } |
|
1037 | 1039 | |
1038 | 1040 | echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
1039 | 1041 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
@@ -1393,7 +1395,8 @@ discard block |
||
1393 | 1395 | <td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
1394 | 1396 | </tr> |
1395 | 1397 | <?php endforeach; ?> |
1396 | - <?php else : ?> |
|
1398 | + <?php else { |
|
1399 | + : ?> |
|
1397 | 1400 | <tr> |
1398 | 1401 | <td class="wpinv_tax_country"> |
1399 | 1402 | <?php |
@@ -1404,7 +1407,9 @@ discard block |
||
1404 | 1407 | 'show_option_none' => false, |
1405 | 1408 | 'class' => 'wpinv-tax-country', |
1406 | 1409 | 'placeholder' => __( 'Choose a country', 'invoicing' ) |
1407 | - ) ); ?> |
|
1410 | + ) ); |
|
1411 | +} |
|
1412 | +?> |
|
1408 | 1413 | </td> |
1409 | 1414 | <td class="wpinv_tax_state"> |
1410 | 1415 | <?php echo wpinv_html_text( array( |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | function wpinv_get_users_invoices( $user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC' ) { |
6 | 8 | if ( empty( $user ) ) { |
@@ -159,8 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | // Setup possible parts |
161 | 161 | $templates = array(); |
162 | - if ( isset( $name ) ) |
|
163 | - $templates[] = $slug . '-' . $name . '.php'; |
|
162 | + if ( isset( $name ) ) { |
|
163 | + $templates[] = $slug . '-' . $name . '.php'; |
|
164 | + } |
|
164 | 165 | $templates[] = $slug . '.php'; |
165 | 166 | |
166 | 167 | // Allow template parts to be filtered |
@@ -178,8 +179,9 @@ discard block |
||
178 | 179 | foreach ( (array)$template_names as $template_name ) { |
179 | 180 | |
180 | 181 | // Continue if template is empty |
181 | - if ( empty( $template_name ) ) |
|
182 | - continue; |
|
182 | + if ( empty( $template_name ) ) { |
|
183 | + continue; |
|
184 | + } |
|
183 | 185 | |
184 | 186 | // Trim off any slashes from the template name |
185 | 187 | $template_name = ltrim( $template_name, '/' ); |
@@ -198,8 +200,9 @@ discard block |
||
198 | 200 | } |
199 | 201 | } |
200 | 202 | |
201 | - if ( ( true == $load ) && ! empty( $located ) ) |
|
202 | - load_template( $located, $require_once ); |
|
203 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
204 | + load_template( $located, $require_once ); |
|
205 | + } |
|
203 | 206 | |
204 | 207 | return $located; |
205 | 208 | } |
@@ -281,8 +284,9 @@ discard block |
||
281 | 284 | function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) { |
282 | 285 | $args = array( 'nopaging' => true ); |
283 | 286 | |
284 | - if ( ! empty( $status ) ) |
|
285 | - $args['post_status'] = $status; |
|
287 | + if ( ! empty( $status ) ) { |
|
288 | + $args['post_status'] = $status; |
|
289 | + } |
|
286 | 290 | |
287 | 291 | $discounts = wpinv_get_discounts( $args ); |
288 | 292 | $options = array(); |
@@ -1423,17 +1427,19 @@ discard block |
||
1423 | 1427 | add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' ); |
1424 | 1428 | |
1425 | 1429 | function wpinv_save_cart_button() { |
1426 | - if ( wpinv_is_cart_saving_disabled() ) |
|
1427 | - return; |
|
1428 | -?> |
|
1430 | + if ( wpinv_is_cart_saving_disabled() ) { |
|
1431 | + return; |
|
1432 | + } |
|
1433 | + ?> |
|
1429 | 1434 | <a class="wpinv-cart-saving-button wpinv-submit button" id="wpinv-save-cart-button" href="<?php echo esc_url( add_query_arg( 'wpi_action', 'save_cart' ) ); ?>"><?php _e( 'Save Cart', 'invoicing' ); ?></a> |
1430 | 1435 | <?php |
1431 | 1436 | } |
1432 | 1437 | |
1433 | 1438 | function wpinv_update_cart_button() { |
1434 | - if ( !wpinv_item_quantities_enabled() ) |
|
1435 | - return; |
|
1436 | -?> |
|
1439 | + if ( !wpinv_item_quantities_enabled() ) { |
|
1440 | + return; |
|
1441 | + } |
|
1442 | + ?> |
|
1437 | 1443 | <input type="submit" name="wpinv_update_cart_submit" class="wpinv-submit wpinv-no-js button" value="<?php _e( 'Update Cart', 'invoicing' ); ?>"/> |
1438 | 1444 | <input type="hidden" name="wpi_action" value="update_cart"/> |
1439 | 1445 | <?php |
@@ -180,8 +180,11 @@ discard block |
||
180 | 180 | <label for="tablecell"> |
181 | 181 | <?php if( 'trialling' == $sub->status ) : ?> |
182 | 182 | <?php _e( 'Trialling Until:', 'invoicing' ); ?> |
183 | - <?php else: ?> |
|
184 | - <?php _e( 'Expiration Date:', 'invoicing' ); ?> |
|
183 | + <?php else { |
|
184 | + : ?> |
|
185 | + <?php _e( 'Expiration Date:', 'invoicing' ); |
|
186 | +} |
|
187 | +?> |
|
185 | 188 | <?php endif; ?> |
186 | 189 | </label> |
187 | 190 | </td> |
@@ -251,7 +254,10 @@ discard block |
||
251 | 254 | </thead> |
252 | 255 | <tbody> |
253 | 256 | <?php if ( ! empty( $payments ) ) : ?> |
254 | - <?php foreach ( $payments as $payment ) : $invoice = wpinv_get_invoice( $payment->ID ); if ( empty( $invoice->ID ) ) continue; ?> |
|
257 | + <?php foreach ( $payments as $payment ) : $invoice = wpinv_get_invoice( $payment->ID ); if ( empty( $invoice->ID ) ) { |
|
258 | + continue; |
|
259 | +} |
|
260 | +?> |
|
255 | 261 | <tr> |
256 | 262 | <td><?php echo $payment->ID; ?></td> |
257 | 263 | <td><?php echo $invoice->get_total( true ); ?></td> |
@@ -268,9 +274,12 @@ discard block |
||
268 | 274 | </td> |
269 | 275 | </tr> |
270 | 276 | <?php endforeach; ?> |
271 | - <?php else: ?> |
|
277 | + <?php else { |
|
278 | + : ?> |
|
272 | 279 | <tr> |
273 | - <td colspan="5"><?php _e( 'No Invoices Found.', 'invoicing' ); ?></td> |
|
280 | + <td colspan="5"><?php _e( 'No Invoices Found.', 'invoicing' ); |
|
281 | +} |
|
282 | +?></td> |
|
274 | 283 | </tr> |
275 | 284 | <?php endif; ?> |
276 | 285 | </tbody> |