@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if ( !defined('ABSPATH') ) { |
|
4 | 4 | die('-1'); |
5 | +} |
|
5 | 6 | |
6 | 7 | do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
7 | 8 |
@@ -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> |
@@ -79,7 +79,7 @@ |
||
79 | 79 | |
80 | 80 | if(empty($count)){ |
81 | 81 | $output .= __('No Invoice(s)','invoicing'); |
82 | - }else{ |
|
82 | + } else{ |
|
83 | 83 | $link_url = admin_url( "edit.php?post_type=wpi_invoice&author=".absint($user_id) ); |
84 | 84 | $link_text = sprintf( __('Invoices ( %d )', 'invoicing'), $count ); |
85 | 85 | $output .= "<a href='$link_url' >$link_text</a>"; |
@@ -1100,10 +1100,11 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | $checked = false; |
1102 | 1102 | |
1103 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
1104 | - $checked = true; |
|
1105 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
1106 | - $checked = true; |
|
1103 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) { |
|
1104 | + $checked = true; |
|
1105 | + } elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) { |
|
1106 | + $checked = true; |
|
1107 | + } |
|
1107 | 1108 | |
1108 | 1109 | echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
1109 | 1110 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
@@ -1120,10 +1121,11 @@ discard block |
||
1120 | 1121 | foreach ( $args['options'] as $key => $option ) : |
1121 | 1122 | $sanitize_key = wpinv_sanitize_key( $key ); |
1122 | 1123 | |
1123 | - if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
|
1124 | - $enabled = '1'; |
|
1125 | - else |
|
1126 | - $enabled = null; |
|
1124 | + if ( isset( $wpinv_options['gateways'][ $key ] ) ) { |
|
1125 | + $enabled = '1'; |
|
1126 | + } else { |
|
1127 | + $enabled = null; |
|
1128 | + } |
|
1127 | 1129 | |
1128 | 1130 | 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) . '/> '; |
1129 | 1131 | echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
@@ -1487,7 +1489,8 @@ discard block |
||
1487 | 1489 | <td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td> |
1488 | 1490 | </tr> |
1489 | 1491 | <?php endforeach; ?> |
1490 | - <?php else : ?> |
|
1492 | + <?php else { |
|
1493 | + : ?> |
|
1491 | 1494 | <tr> |
1492 | 1495 | <td class="wpinv_tax_country"> |
1493 | 1496 | <?php |
@@ -1498,7 +1501,9 @@ discard block |
||
1498 | 1501 | 'show_option_none' => false, |
1499 | 1502 | 'class' => 'wpinv-tax-country wpi_select2', |
1500 | 1503 | 'placeholder' => __( 'Choose a country', 'invoicing' ) |
1501 | - ) ); ?> |
|
1504 | + ) ); |
|
1505 | +} |
|
1506 | +?> |
|
1502 | 1507 | </td> |
1503 | 1508 | <td class="wpinv_tax_state"> |
1504 | 1509 | <?php echo wpinv_html_text( array( |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | <?php |
537 | 537 | if(! empty( $insert_shortcode_function )){ |
538 | 538 | echo $insert_shortcode_function; |
539 | - }else{ |
|
539 | + } else{ |
|
540 | 540 | |
541 | 541 | /** |
542 | 542 | * Function for super duper insert shortcode. |
@@ -1275,8 +1275,7 @@ discard block |
||
1275 | 1275 | $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
1276 | 1276 | if($args['type']=='checkbox' && $argument_values[ $key ] == ''){ |
1277 | 1277 | // don't set default for an empty checkbox |
1278 | - } |
|
1279 | - elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1278 | + } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
1280 | 1279 | $argument_values[ $key ] = $args['default']; |
1281 | 1280 | } |
1282 | 1281 | } |
@@ -1649,7 +1648,7 @@ discard block |
||
1649 | 1648 | // If the user sets block-output array then build it |
1650 | 1649 | if ( ! empty( $this->options['block-output'] ) ) { |
1651 | 1650 | $this->block_element( $this->options['block-output'] ); |
1652 | - }else{ |
|
1651 | + } else{ |
|
1653 | 1652 | // if no block-output is set then we try and get the shortcode html output via ajax. |
1654 | 1653 | ?> |
1655 | 1654 | el('div', { |