@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // MUST have WordPress. |
10 | -if ( ! defined( 'WPINC' ) ) { |
|
10 | +if (!defined('WPINC')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | private static $instance; |
16 | 16 | |
17 | 17 | public static function run() { |
18 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPInv_Admin_Users ) ) { |
|
18 | + if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Admin_Users)) { |
|
19 | 19 | self::$instance = new WPInv_Admin_Users(); |
20 | 20 | } |
21 | 21 | |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | public function __construct() { |
26 | - add_filter( 'manage_users_columns', array( $this, 'wpinv_add_user_column' ) ); |
|
27 | - add_filter( 'manage_users_custom_column', array( $this, 'wpinv_user_column_content' ), 10, 3 ); |
|
26 | + add_filter('manage_users_columns', array($this, 'wpinv_add_user_column')); |
|
27 | + add_filter('manage_users_custom_column', array($this, 'wpinv_user_column_content'), 10, 3); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return mixed |
36 | 36 | */ |
37 | - public function wpinv_add_user_column( $column ) { |
|
38 | - $column['wpinvoicing'] = __( 'Invoicing', 'invoicing' ); |
|
37 | + public function wpinv_add_user_column($column) { |
|
38 | + $column['wpinvoicing'] = __('Invoicing', 'invoicing'); |
|
39 | 39 | return $column; |
40 | 40 | } |
41 | 41 | |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public function wpinv_user_column_content( $val, $column_name, $user_id ) { |
|
52 | - switch ( $column_name ) { |
|
51 | + public function wpinv_user_column_content($val, $column_name, $user_id) { |
|
52 | + switch ($column_name) { |
|
53 | 53 | case 'wpinvoicing': |
54 | - return $this->get_user_invoices( $user_id ); |
|
54 | + return $this->get_user_invoices($user_id); |
|
55 | 55 | break; |
56 | 56 | default: |
57 | 57 | } |
@@ -65,30 +65,30 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return string |
67 | 67 | */ |
68 | - public function get_user_invoices( $user_id ) { |
|
68 | + public function get_user_invoices($user_id) { |
|
69 | 69 | $output = ''; |
70 | 70 | $wp_query_args = array( |
71 | 71 | 'post_type' => 'wpi_invoice', |
72 | - 'post_status' => array( 'wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold', 'wpi-refunded', 'wpi-cancelled', 'wpi-failed', 'wpi-renewal' ), |
|
72 | + 'post_status' => array('wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold', 'wpi-refunded', 'wpi-cancelled', 'wpi-failed', 'wpi-renewal'), |
|
73 | 73 | 'posts_per_page' => -1, |
74 | 74 | 'fields' => 'ids', |
75 | 75 | 'author' => $user_id, |
76 | 76 | ); |
77 | 77 | |
78 | - $wp_query_args = apply_filters( 'wpinv_get_user_invoices_args', $wp_query_args, $user_id ); |
|
78 | + $wp_query_args = apply_filters('wpinv_get_user_invoices_args', $wp_query_args, $user_id); |
|
79 | 79 | |
80 | - $invoices = new WP_Query( $wp_query_args ); |
|
81 | - $count = absint( $invoices->found_posts ); |
|
80 | + $invoices = new WP_Query($wp_query_args); |
|
81 | + $count = absint($invoices->found_posts); |
|
82 | 82 | |
83 | - if ( empty( $count ) ) { |
|
84 | - $output .= __( 'No Invoice(s)', 'invoicing' ); |
|
83 | + if (empty($count)) { |
|
84 | + $output .= __('No Invoice(s)', 'invoicing'); |
|
85 | 85 | } else { |
86 | - $link_url = admin_url( 'edit.php?post_type=wpi_invoice&author=' . absint( $user_id ) ); |
|
87 | - $link_text = sprintf( __( 'Invoices ( %d )', 'invoicing' ), $count ); |
|
86 | + $link_url = admin_url('edit.php?post_type=wpi_invoice&author=' . absint($user_id)); |
|
87 | + $link_text = sprintf(__('Invoices ( %d )', 'invoicing'), $count); |
|
88 | 88 | $output .= "<a href='$link_url' >$link_text</a>"; |
89 | 89 | } |
90 | 90 | |
91 | - return apply_filters( 'wpinv_user_invoice_content', $output, $user_id ); |
|
91 | + return apply_filters('wpinv_user_invoice_content', $output, $user_id); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | } |
@@ -7,81 +7,81 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // MUST have WordPress. |
10 | -if ( ! defined( 'WPINC' ) ) { |
|
10 | +if (!defined('WPINC')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | -function wpinv_bulk_actions( $actions ) { |
|
15 | - if ( isset( $actions['edit'] ) ) { |
|
16 | - unset( $actions['edit'] ); |
|
14 | +function wpinv_bulk_actions($actions) { |
|
15 | + if (isset($actions['edit'])) { |
|
16 | + unset($actions['edit']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | return $actions; |
20 | 20 | } |
21 | -add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' ); |
|
22 | -add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' ); |
|
21 | +add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions'); |
|
22 | +add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions'); |
|
23 | 23 | |
24 | -function wpinv_admin_post_id( $id = 0 ) { |
|
24 | +function wpinv_admin_post_id($id = 0) { |
|
25 | 25 | global $post; |
26 | 26 | |
27 | - if ( isset( $id ) && ! empty( $id ) ) { |
|
28 | - return (int)$id; |
|
29 | - } elseif ( get_the_ID() ) { |
|
27 | + if (isset($id) && !empty($id)) { |
|
28 | + return (int) $id; |
|
29 | + } elseif (get_the_ID()) { |
|
30 | 30 | return (int) get_the_ID(); |
31 | - } elseif ( isset( $post->ID ) && ! empty( $post->ID ) ) { |
|
31 | + } elseif (isset($post->ID) && !empty($post->ID)) { |
|
32 | 32 | return (int) $post->ID; |
33 | - } elseif ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) { |
|
33 | + } elseif (isset($_GET['post']) && !empty($_GET['post'])) { |
|
34 | 34 | return (int) $_GET['post']; |
35 | - } elseif ( isset( $_GET['id'] ) && ! empty( $_GET['id'] ) ) { |
|
35 | + } elseif (isset($_GET['id']) && !empty($_GET['id'])) { |
|
36 | 36 | return (int) $_GET['id']; |
37 | - } elseif ( isset( $_POST['id'] ) && ! empty( $_POST['id'] ) ) { |
|
37 | + } elseif (isset($_POST['id']) && !empty($_POST['id'])) { |
|
38 | 38 | return (int) $_POST['id']; |
39 | 39 | } |
40 | 40 | |
41 | 41 | return null; |
42 | 42 | } |
43 | 43 | |
44 | -function wpinv_admin_post_type( $id = 0 ) { |
|
45 | - if ( ! $id ) { |
|
44 | +function wpinv_admin_post_type($id = 0) { |
|
45 | + if (!$id) { |
|
46 | 46 | $id = wpinv_admin_post_id(); |
47 | 47 | } |
48 | 48 | |
49 | - $type = get_post_type( $id ); |
|
49 | + $type = get_post_type($id); |
|
50 | 50 | |
51 | - if ( ! $type ) { |
|
52 | - $type = isset( $_GET['post_type'] ) && ! empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : null; |
|
51 | + if (!$type) { |
|
52 | + $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : null; |
|
53 | 53 | } |
54 | 54 | |
55 | - return apply_filters( 'wpinv_admin_post_type', $type, $id ); |
|
55 | + return apply_filters('wpinv_admin_post_type', $type, $id); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | function wpinv_admin_messages() { |
59 | - settings_errors( 'wpinv-notices' ); |
|
59 | + settings_errors('wpinv-notices'); |
|
60 | 60 | } |
61 | -add_action( 'admin_notices', 'wpinv_admin_messages' ); |
|
61 | +add_action('admin_notices', 'wpinv_admin_messages'); |
|
62 | 62 | |
63 | -add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' ); |
|
63 | +add_action('admin_init', 'wpinv_show_test_payment_gateway_notice'); |
|
64 | 64 | function wpinv_show_test_payment_gateway_notice() { |
65 | - add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' ); |
|
65 | + add_action('admin_notices', 'wpinv_test_payment_gateway_messages'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | function wpinv_test_payment_gateway_messages() { |
69 | 69 | $gateways = wpinv_get_enabled_payment_gateways(); |
70 | 70 | $name = array(); $test_gateways = ''; |
71 | - if ( $gateways ) { |
|
72 | - foreach ( $gateways as $id => $gateway ) { |
|
73 | - if ( wpinv_is_test_mode( $id ) ) { |
|
71 | + if ($gateways) { |
|
72 | + foreach ($gateways as $id => $gateway) { |
|
73 | + if (wpinv_is_test_mode($id)) { |
|
74 | 74 | $name[] = $gateway['checkout_label']; |
75 | 75 | } |
76 | 76 | } |
77 | - $test_gateways = implode( ', ', $name ); |
|
77 | + $test_gateways = implode(', ', $name); |
|
78 | 78 | } |
79 | - if ( isset( $test_gateways ) && ! empty( $test_gateways ) && wpinv_current_user_can_manage_invoicing() ) { |
|
80 | - $link = admin_url( 'admin.php?page=wpinv-settings&tab=gateways' ); |
|
81 | - $notice = wp_sprintf( __( '<strong>Important:</strong> Payment Gateway(s) %1$s are in testing mode and will not receive real payments. Go to <a href="%2$s"> Gateway Settings</a>.', 'invoicing' ), $test_gateways, $link ); |
|
79 | + if (isset($test_gateways) && !empty($test_gateways) && wpinv_current_user_can_manage_invoicing()) { |
|
80 | + $link = admin_url('admin.php?page=wpinv-settings&tab=gateways'); |
|
81 | + $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %1$s are in testing mode and will not receive real payments. Go to <a href="%2$s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link); |
|
82 | 82 | ?> |
83 | 83 | <div class="notice notice-warning is-dismissible"> |
84 | - <p><?php echo wp_kses_post( $notice ); ?></p> |
|
84 | + <p><?php echo wp_kses_post($notice); ?></p> |
|
85 | 85 | </div> |
86 | 86 | <?php |
87 | 87 | } |
@@ -95,37 +95,37 @@ discard block |
||
95 | 95 | global $wpdb; |
96 | 96 | |
97 | 97 | // Only do this on our settings page. |
98 | - if ( empty( $_GET['page'] ) || 'wpinv-settings' !== $_GET['page'] ) { |
|
98 | + if (empty($_GET['page']) || 'wpinv-settings' !== $_GET['page']) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Check tables. |
103 | - $tables = array( |
|
103 | + $tables = array( |
|
104 | 104 | "{$wpdb->prefix}wpinv_subscriptions", |
105 | 105 | "{$wpdb->prefix}getpaid_invoices", |
106 | 106 | "{$wpdb->prefix}getpaid_invoice_items", |
107 | 107 | ); |
108 | 108 | |
109 | - foreach ( $tables as $table ) { |
|
110 | - if ( $table != $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) { |
|
109 | + foreach ($tables as $table) { |
|
110 | + if ($table != $wpdb->get_var("SHOW TABLES LIKE '$table'")) { |
|
111 | 111 | |
112 | - $url = wp_nonce_url( |
|
113 | - add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ), |
|
112 | + $url = wp_nonce_url( |
|
113 | + add_query_arg('getpaid-admin-action', 'create_missing_tables'), |
|
114 | 114 | 'getpaid-nonce', |
115 | 115 | 'getpaid-nonce' |
116 | 116 | ); |
117 | - $message = __( 'Some GetPaid database tables are missing. To use GetPaid without any issues, click on the button below to create the missing tables.', 'invoicing' ); |
|
118 | - $message2 = __( 'Create Tables', 'invoicing' ); |
|
119 | - echo wp_kses_post( "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>" ); |
|
117 | + $message = __('Some GetPaid database tables are missing. To use GetPaid without any issues, click on the button below to create the missing tables.', 'invoicing'); |
|
118 | + $message2 = __('Create Tables', 'invoicing'); |
|
119 | + echo wp_kses_post("<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>"); |
|
120 | 120 | break; |
121 | 121 | |
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | 125 | } |
126 | -add_action( 'admin_notices', 'wpinv_check_for_missing_tables' ); |
|
126 | +add_action('admin_notices', 'wpinv_check_for_missing_tables'); |
|
127 | 127 | |
128 | -add_action( 'admin_init', 'wpinv_admin_search_by_invoice' ); |
|
128 | +add_action('admin_init', 'wpinv_admin_search_by_invoice'); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * hook the posts search if we're on the admin page for our type |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | function wpinv_admin_search_by_invoice() { |
134 | 134 | global $typenow; |
135 | 135 | |
136 | - if ( $typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) { |
|
137 | - add_filter( 'posts_search', 'wpinv_posts_search_example_type', 10, 2 ); |
|
136 | + if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') { |
|
137 | + add_filter('posts_search', 'wpinv_posts_search_example_type', 10, 2); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | * @param WP_Query $query |
145 | 145 | * @return string |
146 | 146 | */ |
147 | -function wpinv_posts_search_example_type( $search, $query ) { |
|
147 | +function wpinv_posts_search_example_type($search, $query) { |
|
148 | 148 | global $wpdb; |
149 | 149 | |
150 | - if ( $query->is_main_query() && ! empty( $query->query['s'] ) ) { |
|
151 | - $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )"; |
|
152 | - if ( ! empty( $search ) ) { |
|
153 | - $search = preg_replace( '/^ AND /', '', $search ); |
|
150 | + if ($query->is_main_query() && !empty($query->query['s'])) { |
|
151 | + $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )"; |
|
152 | + if (!empty($search)) { |
|
153 | + $search = preg_replace('/^ AND /', '', $search); |
|
154 | 154 | $search = " AND ( {$search} OR ( {$conditions_str} ) )"; |
155 | 155 | } else { |
156 | 156 | $search = " AND ( {$conditions_str} )"; |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | * Resets invoice counts. |
165 | 165 | */ |
166 | 166 | function wpinv_reset_invoice_count() { |
167 | - if ( ! empty( $_GET['reset_invoice_count'] ) && isset( $_GET['_nonce'] ) && wp_verify_nonce( sanitize_text_field( $_GET['_nonce'] ), 'reset_invoice_count' ) ) { |
|
168 | - wpinv_update_option( 'invoice_sequence_start', 1 ); |
|
169 | - delete_option( 'wpinv_last_invoice_number' ); |
|
170 | - getpaid_admin()->show_success( __( 'Invoice number sequence reset successfully.', 'invoicing' ) ); |
|
171 | - $url = remove_query_arg( array( 'reset_invoice_count', '_nonce' ) ); |
|
172 | - wp_redirect( $url ); |
|
167 | + if (!empty($_GET['reset_invoice_count']) && isset($_GET['_nonce']) && wp_verify_nonce(sanitize_text_field($_GET['_nonce']), 'reset_invoice_count')) { |
|
168 | + wpinv_update_option('invoice_sequence_start', 1); |
|
169 | + delete_option('wpinv_last_invoice_number'); |
|
170 | + getpaid_admin()->show_success(__('Invoice number sequence reset successfully.', 'invoicing')); |
|
171 | + $url = remove_query_arg(array('reset_invoice_count', '_nonce')); |
|
172 | + wp_redirect($url); |
|
173 | 173 | exit(); |
174 | 174 | } |
175 | 175 | } |
176 | -add_action( 'admin_init', 'wpinv_reset_invoice_count' ); |
|
176 | +add_action('admin_init', 'wpinv_reset_invoice_count'); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Displays line items on the invoice edit page. |
@@ -182,29 +182,29 @@ discard block |
||
182 | 182 | * @param array $columns |
183 | 183 | * @return string |
184 | 184 | */ |
185 | -function wpinv_admin_get_line_items( $invoice, $columns ) { |
|
185 | +function wpinv_admin_get_line_items($invoice, $columns) { |
|
186 | 186 | |
187 | 187 | ob_start(); |
188 | 188 | |
189 | - do_action( 'getpaid_admin_before_line_items', $invoice ); |
|
189 | + do_action('getpaid_admin_before_line_items', $invoice); |
|
190 | 190 | |
191 | 191 | $count = 0; |
192 | - foreach ( $invoice->get_items() as $item ) { |
|
192 | + foreach ($invoice->get_items() as $item) { |
|
193 | 193 | |
194 | - $item_price = wpinv_price( $item->get_price(), $invoice->get_currency() ); |
|
194 | + $item_price = wpinv_price($item->get_price(), $invoice->get_currency()); |
|
195 | 195 | $quantity = (int) $item->get_quantity(); |
196 | - $item_subtotal = wpinv_price( $item->get_sub_total(), $invoice->get_currency() ); |
|
197 | - $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice ); |
|
196 | + $item_subtotal = wpinv_price($item->get_sub_total(), $invoice->get_currency()); |
|
197 | + $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice); |
|
198 | 198 | $item_tax = $item->item_tax; |
199 | - $tax_rate = wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2, true ) . '%'; |
|
200 | - $tax_rate = empty( $tax_rate ) ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : ''; |
|
199 | + $tax_rate = wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2, true) . '%'; |
|
200 | + $tax_rate = empty($tax_rate) ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : ''; |
|
201 | 201 | $line_item_tax = $item_tax . $tax_rate; |
202 | - $line_item = '<tr class="item item-' . ( ($count % 2 == 0) ? 'even' : 'odd' ) . '" data-item-id="' . esc_attr( $item->get_id() ) . '">'; |
|
202 | + $line_item = '<tr class="item item-' . (($count % 2 == 0) ? 'even' : 'odd') . '" data-item-id="' . esc_attr($item->get_id()) . '">'; |
|
203 | 203 | $line_item .= '<td class="id">' . (int) $item->get_id() . '</td>'; |
204 | - $line_item .= '<td class="title"><a href="' . get_edit_post_link( $item->get_id() ) . '" target="_blank">' . $item->get_name() . '</a>'; |
|
204 | + $line_item .= '<td class="title"><a href="' . get_edit_post_link($item->get_id()) . '" target="_blank">' . $item->get_name() . '</a>'; |
|
205 | 205 | |
206 | - if ( $summary !== '' ) { |
|
207 | - $line_item .= '<span class="meta">' . wp_kses_post( wpautop( $summary ) ) . '</span>'; |
|
206 | + if ($summary !== '') { |
|
207 | + $line_item .= '<span class="meta">' . wp_kses_post(wpautop($summary)) . '</span>'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | $line_item .= '</td>'; |
@@ -212,23 +212,23 @@ discard block |
||
212 | 212 | $line_item .= '<td class="qty" data-quantity="' . $quantity . '"> × ' . $quantity . '</td>'; |
213 | 213 | $line_item .= '<td class="total">' . $item_subtotal . '</td>'; |
214 | 214 | |
215 | - if ( wpinv_use_taxes() && $invoice->is_taxable() ) { |
|
215 | + if (wpinv_use_taxes() && $invoice->is_taxable()) { |
|
216 | 216 | $line_item .= '<td class="tax">' . $line_item_tax . '</td>'; |
217 | 217 | } |
218 | 218 | |
219 | 219 | $line_item .= '<td class="action">'; |
220 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
220 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
221 | 221 | $line_item .= '<i class="fa fa-remove wpinv-item-remove"></i>'; |
222 | 222 | } |
223 | 223 | $line_item .= '</td>'; |
224 | 224 | $line_item .= '</tr>'; |
225 | 225 | |
226 | - echo wp_kses_post( apply_filters( 'getpaid_admin_line_item', $line_item, $item, $invoice ) ); |
|
226 | + echo wp_kses_post(apply_filters('getpaid_admin_line_item', $line_item, $item, $invoice)); |
|
227 | 227 | |
228 | 228 | $count++; |
229 | 229 | } |
230 | 230 | |
231 | - do_action( 'getpaid_admin_after_line_items', $invoice ); |
|
231 | + do_action('getpaid_admin_after_line_items', $invoice); |
|
232 | 232 | |
233 | 233 | return ob_get_clean(); |
234 | 234 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
28 | - $customer = $invoice->exists() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(); |
|
29 | - $customer = new WP_User( $customer ); |
|
30 | - $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email ); |
|
31 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | + $customer = $invoice->exists() ? $invoice->get_user_id('edit') : get_current_user_id(); |
|
29 | + $customer = new WP_User($customer); |
|
30 | + $display = sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email); |
|
31 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
32 | 32 | |
33 | 33 | ?> |
34 | 34 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | <div class="col-12 col-sm-6"> |
44 | 44 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
45 | 45 | <div> |
46 | - <label for="post_author_override"><?php esc_html_e( 'Customer', 'invoicing' ); ?></label> |
|
46 | + <label for="post_author_override"><?php esc_html_e('Customer', 'invoicing'); ?></label> |
|
47 | 47 | </div> |
48 | 48 | <div> |
49 | - <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e( 'Search for a customer by email or name', 'invoicing' ); ?>"> |
|
50 | - <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html( $display ); ?> </option>) |
|
49 | + <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e('Search for a customer by email or name', 'invoicing'); ?>"> |
|
50 | + <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html($display); ?> </option>) |
|
51 | 51 | </select> |
52 | 52 | </div> |
53 | 53 | </div> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'type' => 'text', |
61 | 61 | 'id' => 'getpaid-invoice-new-user-email', |
62 | 62 | 'name' => 'wpinv_email', |
63 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
63 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
64 | 64 | 'label_type' => 'vertical', |
65 | 65 | 'placeholder' => '[email protected]', |
66 | 66 | 'class' => 'form-control-sm', |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | </div> |
72 | 72 | </div> |
73 | 73 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
74 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
74 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
75 | 75 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
76 | 76 | <i aria-hidden="true" class="fa fa-refresh"></i> |
77 | - <?php esc_html_e( 'Fill User Details', 'invoicing' ); ?> |
|
77 | + <?php esc_html_e('Fill User Details', 'invoicing'); ?> |
|
78 | 78 | </a> |
79 | 79 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
80 | 80 | <i aria-hidden="true" class="fa fa-plus"></i> |
81 | - <?php esc_html_e( 'Add New User', 'invoicing' ); ?> |
|
81 | + <?php esc_html_e('Add New User', 'invoicing'); ?> |
|
82 | 82 | </a> |
83 | 83 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
84 | 84 | <i aria-hidden="true" class="fa fa-close"></i> |
85 | - <?php esc_html_e( 'Cancel', 'invoicing' ); ?> |
|
85 | + <?php esc_html_e('Cancel', 'invoicing'); ?> |
|
86 | 86 | </a> |
87 | 87 | <?php endif; ?> |
88 | 88 | </div> |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | 'type' => 'text', |
96 | 96 | 'id' => 'wpinv_first_name', |
97 | 97 | 'name' => 'wpinv_first_name', |
98 | - 'label' => __( 'First Name', 'invoicing' ), |
|
98 | + 'label' => __('First Name', 'invoicing'), |
|
99 | 99 | 'label_type' => 'vertical', |
100 | 100 | 'placeholder' => '', |
101 | 101 | 'class' => 'form-control-sm', |
102 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
102 | + 'value' => $invoice->get_first_name('edit'), |
|
103 | 103 | ), |
104 | 104 | true |
105 | 105 | ); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | 'type' => 'text', |
113 | 113 | 'id' => 'wpinv_last_name', |
114 | 114 | 'name' => 'wpinv_last_name', |
115 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
115 | + 'label' => __('Last Name', 'invoicing'), |
|
116 | 116 | 'label_type' => 'vertical', |
117 | 117 | 'placeholder' => '', |
118 | 118 | 'class' => 'form-control-sm', |
119 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
119 | + 'value' => $invoice->get_last_name('edit'), |
|
120 | 120 | ), |
121 | 121 | true |
122 | 122 | ); |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | 'type' => 'text', |
133 | 133 | 'id' => 'wpinv_company', |
134 | 134 | 'name' => 'wpinv_company', |
135 | - 'label' => __( 'Company', 'invoicing' ), |
|
135 | + 'label' => __('Company', 'invoicing'), |
|
136 | 136 | 'label_type' => 'vertical', |
137 | 137 | 'placeholder' => '', |
138 | 138 | 'class' => 'form-control-sm', |
139 | - 'value' => $invoice->get_company( 'edit' ), |
|
139 | + 'value' => $invoice->get_company('edit'), |
|
140 | 140 | ), |
141 | 141 | true |
142 | 142 | ); |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | 'type' => 'text', |
150 | 150 | 'id' => 'wpinv_vat_number', |
151 | 151 | 'name' => 'wpinv_vat_number', |
152 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
152 | + 'label' => __('Vat Number', 'invoicing'), |
|
153 | 153 | 'label_type' => 'vertical', |
154 | 154 | 'placeholder' => '', |
155 | 155 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
156 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
156 | + 'value' => $invoice->get_vat_number('edit'), |
|
157 | 157 | ), |
158 | 158 | true |
159 | 159 | ); |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | 'type' => 'text', |
170 | 170 | 'id' => 'wpinv_address', |
171 | 171 | 'name' => 'wpinv_address', |
172 | - 'label' => __( 'Address', 'invoicing' ), |
|
172 | + 'label' => __('Address', 'invoicing'), |
|
173 | 173 | 'label_type' => 'vertical', |
174 | 174 | 'placeholder' => '', |
175 | 175 | 'class' => 'form-control-sm', |
176 | - 'value' => $invoice->get_address( 'edit' ), |
|
176 | + 'value' => $invoice->get_address('edit'), |
|
177 | 177 | ), |
178 | 178 | true |
179 | 179 | ); |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | 'type' => 'text', |
187 | 187 | 'id' => 'wpinv_city', |
188 | 188 | 'name' => 'wpinv_city', |
189 | - 'label' => __( 'City', 'invoicing' ), |
|
189 | + 'label' => __('City', 'invoicing'), |
|
190 | 190 | 'label_type' => 'vertical', |
191 | 191 | 'placeholder' => '', |
192 | 192 | 'class' => 'form-control-sm', |
193 | - 'value' => $invoice->get_city( 'edit' ), |
|
193 | + 'value' => $invoice->get_city('edit'), |
|
194 | 194 | ), |
195 | 195 | true |
196 | 196 | ); |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | array( |
206 | 206 | 'id' => 'wpinv_country', |
207 | 207 | 'name' => 'wpinv_country', |
208 | - 'label' => __( 'Country', 'invoicing' ), |
|
208 | + 'label' => __('Country', 'invoicing'), |
|
209 | 209 | 'label_type' => 'vertical', |
210 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
210 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
211 | 211 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
212 | - 'value' => $invoice->get_country( 'edit' ), |
|
212 | + 'value' => $invoice->get_country('edit'), |
|
213 | 213 | 'options' => wpinv_get_country_list(), |
214 | 214 | 'data-allow-clear' => 'false', |
215 | 215 | 'select2' => true, |
@@ -221,20 +221,20 @@ discard block |
||
221 | 221 | <div class="col-12 col-sm-6"> |
222 | 222 | <?php |
223 | 223 | |
224 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
224 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
225 | 225 | |
226 | - if ( empty( $states ) ) { |
|
226 | + if (empty($states)) { |
|
227 | 227 | |
228 | 228 | aui()->input( |
229 | 229 | array( |
230 | 230 | 'type' => 'text', |
231 | 231 | 'id' => 'wpinv_state', |
232 | 232 | 'name' => 'wpinv_state', |
233 | - 'label' => __( 'State', 'invoicing' ), |
|
233 | + 'label' => __('State', 'invoicing'), |
|
234 | 234 | 'label_type' => 'vertical', |
235 | 235 | 'placeholder' => '', |
236 | 236 | 'class' => 'form-control-sm', |
237 | - 'value' => $invoice->get_state( 'edit' ), |
|
237 | + 'value' => $invoice->get_state('edit'), |
|
238 | 238 | ), |
239 | 239 | true |
240 | 240 | ); |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | array( |
246 | 246 | 'id' => 'wpinv_state', |
247 | 247 | 'name' => 'wpinv_state', |
248 | - 'label' => __( 'State', 'invoicing' ), |
|
248 | + 'label' => __('State', 'invoicing'), |
|
249 | 249 | 'label_type' => 'vertical', |
250 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
250 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
251 | 251 | 'class' => 'form-control-sm', |
252 | - 'value' => $invoice->get_state( 'edit' ), |
|
252 | + 'value' => $invoice->get_state('edit'), |
|
253 | 253 | 'options' => $states, |
254 | 254 | 'data-allow-clear' => 'false', |
255 | 255 | 'select2' => true, |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | 'type' => 'text', |
272 | 272 | 'id' => 'wpinv_zip', |
273 | 273 | 'name' => 'wpinv_zip', |
274 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
274 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
275 | 275 | 'label_type' => 'vertical', |
276 | 276 | 'placeholder' => '', |
277 | 277 | 'class' => 'form-control-sm', |
278 | - 'value' => $invoice->get_zip( 'edit' ), |
|
278 | + 'value' => $invoice->get_zip('edit'), |
|
279 | 279 | ), |
280 | 280 | true |
281 | 281 | ); |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | 'type' => 'text', |
289 | 289 | 'id' => 'wpinv_phone', |
290 | 290 | 'name' => 'wpinv_phone', |
291 | - 'label' => __( 'Phone', 'invoicing' ), |
|
291 | + 'label' => __('Phone', 'invoicing'), |
|
292 | 292 | 'label_type' => 'vertical', |
293 | 293 | 'placeholder' => '', |
294 | 294 | 'class' => 'form-control-sm', |
295 | - 'value' => $invoice->get_phone( 'edit' ), |
|
295 | + 'value' => $invoice->get_phone('edit'), |
|
296 | 296 | ), |
297 | 297 | true |
298 | 298 | ); |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | </div> |
301 | 301 | </div> |
302 | 302 | |
303 | - <?php if ( ! apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) : ?> |
|
304 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
303 | + <?php if (!apply_filters('getpaid_use_new_invoice_items_metabox', false)) : ?> |
|
304 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
305 | 305 | |
306 | 306 | <div class="row"> |
307 | 307 | <div class="col-12 col-sm-6"> |
@@ -310,14 +310,14 @@ discard block |
||
310 | 310 | array( |
311 | 311 | 'id' => 'wpinv_template', |
312 | 312 | 'name' => 'wpinv_template', |
313 | - 'label' => __( 'Template', 'invoicing' ), |
|
313 | + 'label' => __('Template', 'invoicing'), |
|
314 | 314 | 'label_type' => 'vertical', |
315 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
315 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
316 | 316 | 'class' => 'form-control-sm', |
317 | - 'value' => $invoice->get_template( 'edit' ), |
|
317 | + 'value' => $invoice->get_template('edit'), |
|
318 | 318 | 'options' => array( |
319 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
320 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
319 | + 'quantity' => __('Quantity', 'invoicing'), |
|
320 | + 'hours' => __('Hours', 'invoicing'), |
|
321 | 321 | //'amount' => __( 'Amount Only', 'invoicing' ), |
322 | 322 | ), |
323 | 323 | 'data-allow-clear' => 'false', |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | array( |
336 | 336 | 'id' => 'wpinv_currency', |
337 | 337 | 'name' => 'wpinv_currency', |
338 | - 'label' => __( 'Currency', 'invoicing' ), |
|
338 | + 'label' => __('Currency', 'invoicing'), |
|
339 | 339 | 'label_type' => 'vertical', |
340 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
340 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
341 | 341 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
342 | - 'value' => $invoice->get_currency( 'edit' ), |
|
342 | + 'value' => $invoice->get_currency('edit'), |
|
343 | 343 | 'required' => false, |
344 | 344 | 'data-allow-clear' => 'false', |
345 | 345 | 'select2' => true, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | </div> |
353 | 353 | </div> |
354 | 354 | |
355 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
355 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
356 | 356 | <?php endif; ?> |
357 | 357 | |
358 | 358 | <div class="row"> |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | 'type' => 'text', |
364 | 364 | 'id' => 'wpinv_company_id', |
365 | 365 | 'name' => 'wpinv_company_id', |
366 | - 'label' => __( 'Company ID', 'invoicing' ), |
|
366 | + 'label' => __('Company ID', 'invoicing'), |
|
367 | 367 | 'label_type' => 'vertical', |
368 | 368 | 'placeholder' => '', |
369 | 369 | 'class' => 'form-control-sm', |
370 | - 'value' => $invoice->get_company_id( 'edit' ), |
|
370 | + 'value' => $invoice->get_company_id('edit'), |
|
371 | 371 | ), |
372 | 372 | true |
373 | 373 | ); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | </div> |
376 | 376 | </div> |
377 | 377 | |
378 | - <?php do_action( 'getpaid_after_metabox_invoice_address', $invoice ); ?> |
|
378 | + <?php do_action('getpaid_after_metabox_invoice_address', $invoice); ?> |
|
379 | 379 | </div> |
380 | 380 | <?php |
381 | 381 | } |
@@ -385,51 +385,51 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @param int $post_id |
387 | 387 | */ |
388 | - public static function save( $post_id ) { |
|
388 | + public static function save($post_id) { |
|
389 | 389 | |
390 | 390 | // Prepare the invoice. |
391 | - $invoice = new WPInv_Invoice( $post_id ); |
|
391 | + $invoice = new WPInv_Invoice($post_id); |
|
392 | 392 | |
393 | 393 | // Load new data. |
394 | 394 | $invoice->set_props( |
395 | 395 | array( |
396 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
397 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
398 | - 'disable_taxes' => ! empty( $_POST['disable_taxes'] ), |
|
399 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
400 | - 'gateway' => ( $invoice->needs_payment() && isset( $_POST['wpinv_gateway'] ) ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
401 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
402 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
403 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
404 | - 'company_id' => isset( $_POST['wpinv_company_id'] ) ? wpinv_clean( $_POST['wpinv_company_id'] ) : null, |
|
405 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
406 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
407 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
408 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
409 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
410 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
411 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
412 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
413 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
414 | - 'date_completed' => isset( $_POST['wpinv_date_completed'] ) ? wpinv_clean( $_POST['wpinv_date_completed'] ) : null, |
|
415 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
416 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
417 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
396 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
397 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
398 | + 'disable_taxes' => !empty($_POST['disable_taxes']), |
|
399 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
400 | + 'gateway' => ($invoice->needs_payment() && isset($_POST['wpinv_gateway'])) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
401 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
402 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
403 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
404 | + 'company_id' => isset($_POST['wpinv_company_id']) ? wpinv_clean($_POST['wpinv_company_id']) : null, |
|
405 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
406 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
407 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
408 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
409 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
410 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
411 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
412 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
413 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
414 | + 'date_completed' => isset($_POST['wpinv_date_completed']) ? wpinv_clean($_POST['wpinv_date_completed']) : null, |
|
415 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
416 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
417 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
418 | 418 | ) |
419 | 419 | ); |
420 | 420 | |
421 | 421 | // Discount code. |
422 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
422 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
423 | 423 | |
424 | - if ( isset( $_POST['wpinv_discount_code'] ) ) { |
|
425 | - $invoice->set_discount_code( wpinv_clean( $_POST['wpinv_discount_code'] ) ); |
|
424 | + if (isset($_POST['wpinv_discount_code'])) { |
|
425 | + $invoice->set_discount_code(wpinv_clean($_POST['wpinv_discount_code'])); |
|
426 | 426 | } |
427 | 427 | |
428 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
429 | - if ( $discount->exists() ) { |
|
430 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
428 | + $discount = new WPInv_Discount($invoice->get_discount_code()); |
|
429 | + if ($discount->exists()) { |
|
430 | + $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount)); |
|
431 | 431 | } else { |
432 | - $invoice->remove_discount( 'discount_code' ); |
|
432 | + $invoice->remove_discount('discount_code'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | // Recalculate totals. |
@@ -438,16 +438,16 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | // If we're creating a new user... |
441 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( stripslashes( $_POST['wpinv_email'] ) ) ) { |
|
441 | + if (!empty($_POST['wpinv_new_user']) && is_email(stripslashes($_POST['wpinv_email']))) { |
|
442 | 442 | |
443 | 443 | // Attempt to create the user. |
444 | - $user = wpinv_create_user( sanitize_email( stripslashes( $_POST['wpinv_email'] ) ) ); |
|
444 | + $user = wpinv_create_user(sanitize_email(stripslashes($_POST['wpinv_email']))); |
|
445 | 445 | |
446 | 446 | // If successful, update the invoice author. |
447 | - if ( is_numeric( $user ) ) { |
|
448 | - $invoice->set_author( $user ); |
|
447 | + if (is_numeric($user)) { |
|
448 | + $invoice->set_author($user); |
|
449 | 449 | } else { |
450 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
450 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
@@ -461,16 +461,16 @@ discard block |
||
461 | 461 | $GLOBALS['wpinv_skip_invoice_notification'] = false; |
462 | 462 | |
463 | 463 | // (Maybe) send new user notification. |
464 | - $should_send_notification = wpinv_get_option( 'disable_new_user_emails' ); |
|
465 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ) ) ) { |
|
466 | - wp_send_new_user_notifications( $user, 'user' ); |
|
464 | + $should_send_notification = wpinv_get_option('disable_new_user_emails'); |
|
465 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', empty($should_send_notification))) { |
|
466 | + wp_send_new_user_notifications($user, 'user'); |
|
467 | 467 | } |
468 | 468 | |
469 | - if ( ! empty( $_POST['send_to_customer'] ) && ! $invoice->is_draft() ) { |
|
470 | - getpaid()->get( 'invoice_emails' )->user_invoice( $invoice, true ); |
|
469 | + if (!empty($_POST['send_to_customer']) && !$invoice->is_draft()) { |
|
470 | + getpaid()->get('invoice_emails')->user_invoice($invoice, true); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | // Fires after an invoice is saved. |
474 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
474 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
475 | 475 | } |
476 | 476 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,24 +21,24 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the discount. |
27 | - $discount = new WPInv_Discount( $post ); |
|
27 | + $discount = new WPInv_Discount($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
31 | 31 | |
32 | - do_action( 'wpinv_discount_form_top', $discount ); |
|
32 | + do_action('wpinv_discount_form_top', $discount); |
|
33 | 33 | |
34 | 34 | // Set the currency position. |
35 | 35 | $position = wpinv_currency_position(); |
36 | 36 | |
37 | - if ( $position == 'left_space' ) { |
|
37 | + if ($position == 'left_space') { |
|
38 | 38 | $position = 'left'; |
39 | 39 | } |
40 | 40 | |
41 | - if ( $position == 'right_space' ) { |
|
41 | + if ($position == 'right_space') { |
|
42 | 42 | $position = 'right'; |
43 | 43 | } |
44 | 44 | |
@@ -52,68 +52,68 @@ discard block |
||
52 | 52 | </style> |
53 | 53 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
54 | 54 | |
55 | - <?php do_action( 'wpinv_discount_form_first', $discount ); ?> |
|
55 | + <?php do_action('wpinv_discount_form_first', $discount); ?> |
|
56 | 56 | |
57 | - <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?> |
|
57 | + <?php do_action('wpinv_discount_form_before_code', $discount); ?> |
|
58 | 58 | <div class="form-group row"> |
59 | 59 | <label for="wpinv_discount_code" class="col-sm-3 col-form-label"> |
60 | - <?php esc_html_e( 'Discount Code', 'invoicing' ); ?> |
|
60 | + <?php esc_html_e('Discount Code', 'invoicing'); ?> |
|
61 | 61 | </label> |
62 | 62 | <div class="col-sm-8"> |
63 | 63 | <div class="row"> |
64 | 64 | <div class="col-sm-12 form-group"> |
65 | - <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
65 | + <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
66 | 66 | </div> |
67 | 67 | <div class="col-sm-12"> |
68 | 68 | <?php |
69 | - do_action( 'wpinv_discount_form_before_single_use', $discount ); |
|
69 | + do_action('wpinv_discount_form_before_single_use', $discount); |
|
70 | 70 | |
71 | 71 | aui()->input( |
72 | 72 | array( |
73 | 73 | 'id' => 'wpinv_discount_single_use', |
74 | 74 | 'name' => 'wpinv_discount_single_use', |
75 | 75 | 'type' => 'checkbox', |
76 | - 'label' => __( 'Each customer can only use this discount once', 'invoicing' ), |
|
76 | + 'label' => __('Each customer can only use this discount once', 'invoicing'), |
|
77 | 77 | 'value' => '1', |
78 | 78 | 'checked' => $discount->is_single_use(), |
79 | 79 | ), |
80 | 80 | true |
81 | 81 | ); |
82 | 82 | |
83 | - do_action( 'wpinv_discount_form_single_use', $discount ); |
|
83 | + do_action('wpinv_discount_form_single_use', $discount); |
|
84 | 84 | ?> |
85 | 85 | </div> |
86 | 86 | <div class="col-sm-12"> |
87 | 87 | <?php |
88 | - do_action( 'wpinv_discount_form_before_recurring', $discount ); |
|
88 | + do_action('wpinv_discount_form_before_recurring', $discount); |
|
89 | 89 | |
90 | 90 | aui()->input( |
91 | 91 | array( |
92 | 92 | 'id' => 'wpinv_discount_recurring', |
93 | 93 | 'name' => 'wpinv_discount_recurring', |
94 | 94 | 'type' => 'checkbox', |
95 | - 'label' => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ), |
|
95 | + 'label' => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'), |
|
96 | 96 | 'value' => '1', |
97 | 97 | 'checked' => $discount->is_recurring(), |
98 | 98 | ), |
99 | 99 | true |
100 | 100 | ); |
101 | 101 | |
102 | - do_action( 'wpinv_discount_form_recurring', $discount ); |
|
102 | + do_action('wpinv_discount_form_recurring', $discount); |
|
103 | 103 | ?> |
104 | 104 | </div> |
105 | 105 | </div> |
106 | 106 | </div> |
107 | 107 | <div class="col-sm-1 pt-2 pl-0"> |
108 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span> |
|
108 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span> |
|
109 | 109 | </div> |
110 | 110 | </div> |
111 | - <?php do_action( 'wpinv_discount_form_code', $discount ); ?> |
|
111 | + <?php do_action('wpinv_discount_form_code', $discount); ?> |
|
112 | 112 | |
113 | - <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?> |
|
113 | + <?php do_action('wpinv_discount_form_before_type', $discount); ?> |
|
114 | 114 | <div class="form-group row"> |
115 | 115 | <label for="wpinv_discount_type" class="col-sm-3 col-form-label"> |
116 | - <?php esc_html_e( 'Discount Type', 'invoicing' ); ?> |
|
116 | + <?php esc_html_e('Discount Type', 'invoicing'); ?> |
|
117 | 117 | </label> |
118 | 118 | <div class="col-sm-8"> |
119 | 119 | <?php |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | array( |
122 | 122 | 'id' => 'wpinv_discount_type', |
123 | 123 | 'name' => 'wpinv_discount_type', |
124 | - 'label' => __( 'Discount Type', 'invoicing' ), |
|
125 | - 'placeholder' => __( 'Select Discount Type', 'invoicing' ), |
|
126 | - 'value' => $discount->get_type( 'edit' ), |
|
124 | + 'label' => __('Discount Type', 'invoicing'), |
|
125 | + 'placeholder' => __('Select Discount Type', 'invoicing'), |
|
126 | + 'value' => $discount->get_type('edit'), |
|
127 | 127 | 'select2' => true, |
128 | 128 | 'data-allow-clear' => 'false', |
129 | 129 | 'options' => wpinv_get_discount_types(), |
@@ -133,32 +133,32 @@ discard block |
||
133 | 133 | ?> |
134 | 134 | </div> |
135 | 135 | <div class="col-sm-1 pt-2 pl-0"> |
136 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span> |
|
136 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span> |
|
137 | 137 | </div> |
138 | 138 | </div> |
139 | - <?php do_action( 'wpinv_discount_form_type', $discount ); ?> |
|
139 | + <?php do_action('wpinv_discount_form_type', $discount); ?> |
|
140 | 140 | |
141 | - <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?> |
|
142 | - <div class="form-group row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap"> |
|
141 | + <?php do_action('wpinv_discount_form_before_amount', $discount); ?> |
|
142 | + <div class="form-group row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap"> |
|
143 | 143 | <label for="wpinv_discount_amount" class="col-sm-3 col-form-label"> |
144 | - <?php esc_html_e( 'Discount Amount', 'invoicing' ); ?> |
|
144 | + <?php esc_html_e('Discount Amount', 'invoicing'); ?> |
|
145 | 145 | </label> |
146 | 146 | <div class="col-sm-8"> |
147 | 147 | <div class="input-group input-group-sm"> |
148 | - <?php if ( 'left' == $position ) : ?> |
|
148 | + <?php if ('left' == $position) : ?> |
|
149 | 149 | <div class="input-group-prepend left wpinv-if-flat"> |
150 | 150 | <span class="input-group-text"> |
151 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
151 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
152 | 152 | </span> |
153 | 153 | </div> |
154 | 154 | <?php endif; ?> |
155 | 155 | |
156 | - <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control"> |
|
156 | + <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control"> |
|
157 | 157 | |
158 | - <?php if ( 'right' == $position ) : ?> |
|
158 | + <?php if ('right' == $position) : ?> |
|
159 | 159 | <div class="input-group-prepend left wpinv-if-flat"> |
160 | 160 | <span class="input-group-text"> |
161 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
161 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
162 | 162 | </span> |
163 | 163 | </div> |
164 | 164 | <?php endif; ?> |
@@ -168,15 +168,15 @@ discard block |
||
168 | 168 | </div> |
169 | 169 | </div> |
170 | 170 | <div class="col-sm-1 pt-2 pl-0"> |
171 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span> |
|
171 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span> |
|
172 | 172 | </div> |
173 | 173 | </div> |
174 | - <?php do_action( 'wpinv_discount_form_amount', $discount ); ?> |
|
174 | + <?php do_action('wpinv_discount_form_amount', $discount); ?> |
|
175 | 175 | |
176 | - <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?> |
|
176 | + <?php do_action('wpinv_discount_form_before_items', $discount); ?> |
|
177 | 177 | <div class="form-group row"> |
178 | 178 | <label for="wpinv_discount_items" class="col-sm-3 col-form-label"> |
179 | - <?php esc_html_e( 'Items', 'invoicing' ); ?> |
|
179 | + <?php esc_html_e('Items', 'invoicing'); ?> |
|
180 | 180 | </label> |
181 | 181 | <div class="col-sm-8"> |
182 | 182 | <?php |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | array( |
185 | 185 | 'id' => 'wpinv_discount_items', |
186 | 186 | 'name' => 'wpinv_discount_items[]', |
187 | - 'label' => __( 'Items', 'invoicing' ), |
|
188 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
189 | - 'value' => $discount->get_items( 'edit' ), |
|
187 | + 'label' => __('Items', 'invoicing'), |
|
188 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
189 | + 'value' => $discount->get_items('edit'), |
|
190 | 190 | 'select2' => true, |
191 | 191 | 'multiple' => true, |
192 | 192 | 'data-allow-clear' => 'false', |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | ?> |
198 | 198 | </div> |
199 | 199 | <div class="col-sm-1 pt-2 pl-0"> |
200 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span> |
|
200 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span> |
|
201 | 201 | </div> |
202 | 202 | </div> |
203 | - <?php do_action( 'wpinv_discount_form_items', $discount ); ?> |
|
203 | + <?php do_action('wpinv_discount_form_items', $discount); ?> |
|
204 | 204 | |
205 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?> |
|
205 | + <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?> |
|
206 | 206 | <div class="form-group row"> |
207 | 207 | <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label"> |
208 | - <?php esc_html_e( 'Excluded Items', 'invoicing' ); ?> |
|
208 | + <?php esc_html_e('Excluded Items', 'invoicing'); ?> |
|
209 | 209 | </label> |
210 | 210 | <div class="col-sm-8"> |
211 | 211 | <?php |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | array( |
214 | 214 | 'id' => 'wpinv_discount_excluded_items', |
215 | 215 | 'name' => 'wpinv_discount_excluded_items[]', |
216 | - 'label' => __( 'Excluded Items', 'invoicing' ), |
|
217 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
218 | - 'value' => $discount->get_excluded_items( 'edit' ), |
|
216 | + 'label' => __('Excluded Items', 'invoicing'), |
|
217 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
218 | + 'value' => $discount->get_excluded_items('edit'), |
|
219 | 219 | 'select2' => true, |
220 | 220 | 'multiple' => true, |
221 | 221 | 'data-allow-clear' => 'false', |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | ?> |
227 | 227 | </div> |
228 | 228 | <div class="col-sm-1 pt-2 pl-0"> |
229 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span> |
|
229 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span> |
|
230 | 230 | </div> |
231 | 231 | </div> |
232 | - <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?> |
|
232 | + <?php do_action('wpinv_discount_form_excluded_items', $discount); ?> |
|
233 | 233 | |
234 | - <?php do_action( 'wpinv_discount_form_before_required_items', $discount ); ?> |
|
234 | + <?php do_action('wpinv_discount_form_before_required_items', $discount); ?> |
|
235 | 235 | <div class="form-group row"> |
236 | 236 | <label for="wpinv_discount_required_items" class="col-sm-3 col-form-label"> |
237 | - <?php esc_html_e( 'Required Items', 'invoicing' ); ?> |
|
237 | + <?php esc_html_e('Required Items', 'invoicing'); ?> |
|
238 | 238 | </label> |
239 | 239 | <div class="col-sm-8"> |
240 | 240 | <?php |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | array( |
243 | 243 | 'id' => 'wpinv_discount_required_items', |
244 | 244 | 'name' => 'wpinv_discount_required_items[]', |
245 | - 'label' => __( 'Required Items', 'invoicing' ), |
|
246 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
247 | - 'value' => $discount->get_required_items( 'edit' ), |
|
245 | + 'label' => __('Required Items', 'invoicing'), |
|
246 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
247 | + 'value' => $discount->get_required_items('edit'), |
|
248 | 248 | 'select2' => true, |
249 | 249 | 'multiple' => true, |
250 | 250 | 'data-allow-clear' => 'false', |
@@ -255,15 +255,15 @@ discard block |
||
255 | 255 | ?> |
256 | 256 | </div> |
257 | 257 | <div class="col-sm-1 pt-2 pl-0"> |
258 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are required to be in the cart before using this discount.', 'invoicing' ); ?>"></span> |
|
258 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are required to be in the cart before using this discount.', 'invoicing'); ?>"></span> |
|
259 | 259 | </div> |
260 | 260 | </div> |
261 | - <?php do_action( 'wpinv_discount_form_required_items', $discount ); ?> |
|
261 | + <?php do_action('wpinv_discount_form_required_items', $discount); ?> |
|
262 | 262 | |
263 | - <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?> |
|
263 | + <?php do_action('wpinv_discount_form_before_start', $discount); ?> |
|
264 | 264 | <div class="form-group row"> |
265 | 265 | <label for="wpinv_discount_start" class="col-sm-3 col-form-label"> |
266 | - <?php esc_html_e( 'Start Date', 'invoicing' ); ?> |
|
266 | + <?php esc_html_e('Start Date', 'invoicing'); ?> |
|
267 | 267 | </label> |
268 | 268 | <div class="col-sm-8"> |
269 | 269 | <?php |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | 'type' => 'datepicker', |
273 | 273 | 'id' => 'wpinv_discount_start', |
274 | 274 | 'name' => 'wpinv_discount_start', |
275 | - 'label' => __( 'Start Date', 'invoicing' ), |
|
275 | + 'label' => __('Start Date', 'invoicing'), |
|
276 | 276 | 'placeholder' => 'YYYY-MM-DD 00:00', |
277 | 277 | 'class' => 'form-control-sm', |
278 | - 'value' => $discount->get_start_date( 'edit' ), |
|
278 | + 'value' => $discount->get_start_date('edit'), |
|
279 | 279 | 'extra_attributes' => array( |
280 | 280 | 'data-enable-time' => 'true', |
281 | 281 | 'data-time_24hr' => 'true', |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | ?> |
288 | 288 | </div> |
289 | 289 | <div class="col-sm-1 pt-2 pl-0"> |
290 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span> |
|
290 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span> |
|
291 | 291 | </div> |
292 | 292 | </div> |
293 | - <?php do_action( 'wpinv_discount_form_start', $discount ); ?> |
|
293 | + <?php do_action('wpinv_discount_form_start', $discount); ?> |
|
294 | 294 | |
295 | - <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?> |
|
295 | + <?php do_action('wpinv_discount_form_before_expiration', $discount); ?> |
|
296 | 296 | <div class="form-group row"> |
297 | 297 | <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label"> |
298 | - <?php esc_html_e( 'Expiration Date', 'invoicing' ); ?> |
|
298 | + <?php esc_html_e('Expiration Date', 'invoicing'); ?> |
|
299 | 299 | </label> |
300 | 300 | <div class="col-sm-8"> |
301 | 301 | <?php |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | 'type' => 'datepicker', |
305 | 305 | 'id' => 'wpinv_discount_expiration', |
306 | 306 | 'name' => 'wpinv_discount_expiration', |
307 | - 'label' => __( 'Expiration Date', 'invoicing' ), |
|
307 | + 'label' => __('Expiration Date', 'invoicing'), |
|
308 | 308 | 'placeholder' => 'YYYY-MM-DD 00:00', |
309 | 309 | 'class' => 'form-control-sm', |
310 | - 'value' => $discount->get_end_date( 'edit' ), |
|
310 | + 'value' => $discount->get_end_date('edit'), |
|
311 | 311 | 'extra_attributes' => array( |
312 | 312 | 'data-enable-time' => 'true', |
313 | 313 | 'data-time_24hr' => 'true', |
@@ -321,86 +321,86 @@ discard block |
||
321 | 321 | ?> |
322 | 322 | </div> |
323 | 323 | <div class="col-sm-1 pt-2 pl-0"> |
324 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span> |
|
324 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span> |
|
325 | 325 | </div> |
326 | 326 | </div> |
327 | - <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?> |
|
327 | + <?php do_action('wpinv_discount_form_expiration', $discount); ?> |
|
328 | 328 | |
329 | - <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?> |
|
329 | + <?php do_action('wpinv_discount_form_before_min_total', $discount); ?> |
|
330 | 330 | <div class="form-group row"> |
331 | 331 | <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label"> |
332 | - <?php esc_html_e( 'Minimum Amount', 'invoicing' ); ?> |
|
332 | + <?php esc_html_e('Minimum Amount', 'invoicing'); ?> |
|
333 | 333 | </label> |
334 | 334 | <div class="col-sm-8"> |
335 | 335 | <div class="input-group input-group-sm"> |
336 | - <?php if ( 'left' == $position ) : ?> |
|
336 | + <?php if ('left' == $position) : ?> |
|
337 | 337 | <div class="input-group-prepend"> |
338 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
338 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
339 | 339 | </div> |
340 | 340 | <?php endif; ?> |
341 | 341 | |
342 | - <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control"> |
|
342 | + <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control"> |
|
343 | 343 | |
344 | - <?php if ( 'left' != $position ) : ?> |
|
344 | + <?php if ('left' != $position) : ?> |
|
345 | 345 | <div class="input-group-append"> |
346 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
346 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
347 | 347 | </div> |
348 | 348 | <?php endif; ?> |
349 | 349 | </div> |
350 | 350 | </div> |
351 | 351 | <div class="col-sm-1 pt-2 pl-0"> |
352 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span> |
|
352 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span> |
|
353 | 353 | </div> |
354 | 354 | </div> |
355 | - <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?> |
|
355 | + <?php do_action('wpinv_discount_form_min_total', $discount); ?> |
|
356 | 356 | |
357 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
357 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
358 | 358 | <div class="form-group row"> |
359 | 359 | <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label"> |
360 | - <?php esc_html_e( 'Maximum Amount', 'invoicing' ); ?> |
|
360 | + <?php esc_html_e('Maximum Amount', 'invoicing'); ?> |
|
361 | 361 | </label> |
362 | 362 | <div class="col-sm-8"> |
363 | 363 | <div class="input-group input-group-sm"> |
364 | - <?php if ( 'left' == $position ) : ?> |
|
364 | + <?php if ('left' == $position) : ?> |
|
365 | 365 | <div class="input-group-prepend"> |
366 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
366 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
367 | 367 | </div> |
368 | 368 | <?php endif; ?> |
369 | 369 | |
370 | - <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control"> |
|
370 | + <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control"> |
|
371 | 371 | |
372 | - <?php if ( 'left' != $position ) : ?> |
|
372 | + <?php if ('left' != $position) : ?> |
|
373 | 373 | <div class="input-group-append"> |
374 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
374 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
375 | 375 | </div> |
376 | 376 | <?php endif; ?> |
377 | 377 | </div> |
378 | 378 | </div> |
379 | 379 | <div class="col-sm-1 pt-2 pl-0"> |
380 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span> |
|
380 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span> |
|
381 | 381 | </div> |
382 | 382 | </div> |
383 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
383 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
384 | 384 | |
385 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?> |
|
385 | + <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?> |
|
386 | 386 | <div class="form-group row"> |
387 | 387 | <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label"> |
388 | - <?php esc_html_e( 'Maximum Uses', 'invoicing' ); ?> |
|
388 | + <?php esc_html_e('Maximum Uses', 'invoicing'); ?> |
|
389 | 389 | </label> |
390 | 390 | <div class="col-sm-8"> |
391 | - <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
391 | + <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
392 | 392 | </div> |
393 | 393 | <div class="col-sm-1 pt-2 pl-0"> |
394 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span> |
|
394 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span> |
|
395 | 395 | </div> |
396 | 396 | </div> |
397 | - <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?> |
|
397 | + <?php do_action('wpinv_discount_form_max_uses', $discount); ?> |
|
398 | 398 | |
399 | - <?php do_action( 'wpinv_discount_form_last', $discount ); ?> |
|
399 | + <?php do_action('wpinv_discount_form_last', $discount); ?> |
|
400 | 400 | |
401 | 401 | </div> |
402 | 402 | <?php |
403 | - do_action( 'wpinv_discount_form_bottom', $post ); |
|
403 | + do_action('wpinv_discount_form_bottom', $post); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | /** |
@@ -408,31 +408,31 @@ discard block |
||
408 | 408 | * |
409 | 409 | * @param int $post_id |
410 | 410 | */ |
411 | - public static function save( $post_id ) { |
|
411 | + public static function save($post_id) { |
|
412 | 412 | |
413 | 413 | // Prepare the discount. |
414 | - $discount = new WPInv_Discount( $post_id ); |
|
414 | + $discount = new WPInv_Discount($post_id); |
|
415 | 415 | |
416 | 416 | // Load new data. |
417 | 417 | $discount->set_props( |
418 | 418 | array( |
419 | - 'code' => isset( $_POST['wpinv_discount_code'] ) ? wpinv_clean( $_POST['wpinv_discount_code'] ) : null, |
|
420 | - 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? floatval( $_POST['wpinv_discount_amount'] ) : null, |
|
421 | - 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
422 | - 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
423 | - 'is_single_use' => ! empty( $_POST['wpinv_discount_single_use'] ), |
|
424 | - 'type' => isset( $_POST['wpinv_discount_type'] ) ? wpinv_clean( $_POST['wpinv_discount_type'] ) : null, |
|
425 | - 'is_recurring' => ! empty( $_POST['wpinv_discount_recurring'] ), |
|
426 | - 'items' => isset( $_POST['wpinv_discount_items'] ) ? wpinv_clean( $_POST['wpinv_discount_items'] ) : array(), |
|
427 | - 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? wpinv_clean( $_POST['wpinv_discount_excluded_items'] ) : array(), |
|
428 | - 'required_items' => isset( $_POST['wpinv_discount_required_items'] ) ? wpinv_clean( $_POST['wpinv_discount_required_items'] ) : array(), |
|
429 | - 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? intval( $_POST['wpinv_discount_max_uses'] ) : null, |
|
430 | - 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? floatval( $_POST['wpinv_discount_min_total'] ) : null, |
|
431 | - 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? floatval( $_POST['wpinv_discount_max_total'] ) : null, |
|
419 | + 'code' => isset($_POST['wpinv_discount_code']) ? wpinv_clean($_POST['wpinv_discount_code']) : null, |
|
420 | + 'amount' => isset($_POST['wpinv_discount_amount']) ? floatval($_POST['wpinv_discount_amount']) : null, |
|
421 | + 'start' => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null, |
|
422 | + 'expiration' => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null, |
|
423 | + 'is_single_use' => !empty($_POST['wpinv_discount_single_use']), |
|
424 | + 'type' => isset($_POST['wpinv_discount_type']) ? wpinv_clean($_POST['wpinv_discount_type']) : null, |
|
425 | + 'is_recurring' => !empty($_POST['wpinv_discount_recurring']), |
|
426 | + 'items' => isset($_POST['wpinv_discount_items']) ? wpinv_clean($_POST['wpinv_discount_items']) : array(), |
|
427 | + 'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? wpinv_clean($_POST['wpinv_discount_excluded_items']) : array(), |
|
428 | + 'required_items' => isset($_POST['wpinv_discount_required_items']) ? wpinv_clean($_POST['wpinv_discount_required_items']) : array(), |
|
429 | + 'max_uses' => isset($_POST['wpinv_discount_max_uses']) ? intval($_POST['wpinv_discount_max_uses']) : null, |
|
430 | + 'min_total' => isset($_POST['wpinv_discount_min_total']) ? floatval($_POST['wpinv_discount_min_total']) : null, |
|
431 | + 'max_total' => isset($_POST['wpinv_discount_max_total']) ? floatval($_POST['wpinv_discount_max_total']) : null, |
|
432 | 432 | ) |
433 | 433 | ); |
434 | 434 | |
435 | 435 | $discount->save(); |
436 | - do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
436 | + do_action('getpaid_discount_metabox_save', $post_id, $discount); |
|
437 | 437 | } |
438 | 438 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @var array $tax_rate |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | ?> |
12 | 12 | |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | aui()->select( |
19 | 19 | array( |
20 | 20 | 'options' => array_merge( |
21 | - array( '' => __( 'All Countries', 'invoicing' ) ), |
|
21 | + array('' => __('All Countries', 'invoicing')), |
|
22 | 22 | wpinv_get_country_list() |
23 | 23 | ), |
24 | 24 | 'name' => "tax_rates[$key][country]", |
25 | - 'id' => uniqid( 'tax_rate_country' ), |
|
26 | - 'value' => esc_html( $tax_rate['country'] ), |
|
27 | - 'label' => __( 'Country', 'invoicing' ), |
|
25 | + 'id' => uniqid('tax_rate_country'), |
|
26 | + 'value' => esc_html($tax_rate['country']), |
|
27 | + 'label' => __('Country', 'invoicing'), |
|
28 | 28 | 'class' => 'wpinv_country', |
29 | 29 | 'no_wrap' => true, |
30 | 30 | ), |
@@ -37,35 +37,35 @@ discard block |
||
37 | 37 | <td class="wpinv_tax_state"> |
38 | 38 | |
39 | 39 | <label class="w-100"> |
40 | - <span class="screen-reader-text"><?php esc_html_e( 'States', 'invoicing' ); ?></span> |
|
41 | - <input type="text" placeholder="<?php esc_attr_e( 'Apply to whole country', 'invoicing' ); ?>" name="tax_rates[<?php echo esc_attr( $key ); ?>][state]" value="<?php echo empty( $tax_rate['global'] ) ? esc_attr( $tax_rate['state'] ) : ''; ?>"/> |
|
40 | + <span class="screen-reader-text"><?php esc_html_e('States', 'invoicing'); ?></span> |
|
41 | + <input type="text" placeholder="<?php esc_attr_e('Apply to whole country', 'invoicing'); ?>" name="tax_rates[<?php echo esc_attr($key); ?>][state]" value="<?php echo empty($tax_rate['global']) ? esc_attr($tax_rate['state']) : ''; ?>"/> |
|
42 | 42 | </label> |
43 | 43 | |
44 | 44 | </td> |
45 | 45 | |
46 | 46 | <td class="wpinv_standard_rate"> |
47 | 47 | <label class="w-100"> |
48 | - <span class="screen-reader-text"><?php esc_html_e( 'Standard Rate', 'invoicing' ); ?></span> |
|
49 | - <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ); ?>][rate]" value="<?php echo esc_attr( $tax_rate['rate'] ); ?>"/> |
|
48 | + <span class="screen-reader-text"><?php esc_html_e('Standard Rate', 'invoicing'); ?></span> |
|
49 | + <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key); ?>][rate]" value="<?php echo esc_attr($tax_rate['rate']); ?>"/> |
|
50 | 50 | </label> |
51 | 51 | </td> |
52 | 52 | |
53 | 53 | <td class="wpinv_reduced_rate"> |
54 | 54 | <label class="w-100"> |
55 | - <span class="screen-reader-text"><?php esc_html_e( 'Reduced Rate', 'invoicing' ); ?></span> |
|
56 | - <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ); ?>][reduced_rate]" value="<?php echo esc_attr( $tax_rate['reduced_rate'] ); ?>"/> |
|
55 | + <span class="screen-reader-text"><?php esc_html_e('Reduced Rate', 'invoicing'); ?></span> |
|
56 | + <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key); ?>][reduced_rate]" value="<?php echo esc_attr($tax_rate['reduced_rate']); ?>"/> |
|
57 | 57 | </label> |
58 | 58 | </td> |
59 | 59 | |
60 | 60 | <td class="wpinv_tax_name"> |
61 | 61 | <label class="w-100"> |
62 | - <span class="screen-reader-text"><?php esc_html_e( 'Tax Name', 'invoicing' ); ?></span> |
|
63 | - <input type="text" name="tax_rates[<?php echo esc_attr( $key ); ?>][name]" value="<?php echo esc_attr( $tax_rate['name'] ); ?>"/> |
|
62 | + <span class="screen-reader-text"><?php esc_html_e('Tax Name', 'invoicing'); ?></span> |
|
63 | + <input type="text" name="tax_rates[<?php echo esc_attr($key); ?>][name]" value="<?php echo esc_attr($tax_rate['name']); ?>"/> |
|
64 | 64 | </label> |
65 | 65 | </td> |
66 | 66 | |
67 | 67 | <td class="wpinv_tax_remove"> |
68 | - <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>" title="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>"> |
|
68 | + <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e('Delete', 'invoicing'); ?>" title="<?php esc_attr_e('Delete', 'invoicing'); ?>"> |
|
69 | 69 | <span aria-hidden="true">×</span> |
70 | 70 | </button> |
71 | 71 | </td> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | $aui_settings = AyeCode_UI_Settings::instance(); |
10 | 10 | $aui_settings->enqueue_scripts(); |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | <head> |
18 | 18 | <meta name="viewport" content="width=device-width"/> |
19 | 19 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
20 | - <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
|
20 | + <title><?php esc_html_e('GetPaid › Setup Wizard', 'invoicing'); ?></title> |
|
21 | 21 | <?php |
22 | 22 | getpaid_admin()->enqeue_scripts(); |
23 | - wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
24 | - wp_print_styles( 'select2' ); |
|
25 | - wp_print_scripts( 'select2' ); |
|
26 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
27 | - do_action( 'admin_print_styles' ); |
|
28 | - do_action( 'admin_head' ); |
|
23 | + wp_enqueue_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0'); |
|
24 | + wp_print_styles('select2'); |
|
25 | + wp_print_scripts('select2'); |
|
26 | + wp_print_scripts('wpinv-admin-script'); |
|
27 | + do_action('admin_print_styles'); |
|
28 | + do_action('admin_head'); |
|
29 | 29 | ?> |
30 | 30 | <style> |
31 | 31 | body, p{ |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | font-weight: 500; |
38 | 38 | margin-bottom: .1rem; |
39 | 39 | } |
40 | - <?php echo esc_html( $aui_settings::css_primary( '#009874', true ) ); ?> |
|
40 | + <?php echo esc_html($aui_settings::css_primary('#009874', true)); ?> |
|
41 | 41 | </style> |
42 | 42 | </head> |
43 | 43 | |
44 | 44 | <body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;"> |
45 | 45 | |
46 | - <?php if ( isset( $_REQUEST['step'] ) ) : ?> |
|
46 | + <?php if (isset($_REQUEST['step'])) : ?> |
|
47 | 47 | <ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center"> |
48 | - <?php foreach ( $steps as $step => $data ) : ?> |
|
48 | + <?php foreach ($steps as $step => $data) : ?> |
|
49 | 49 | <li class="list-group-item flex-fill rounded-0 |
50 | 50 | <?php |
51 | 51 | echo $step == $current ? 'active' : 'd-none d-md-block'; |
52 | - echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? ' done' : ''; |
|
52 | + echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? ' done' : ''; |
|
53 | 53 | ?> |
54 | 54 | "> |
55 | - <i class="far fa-check-circle <?php echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? 'text-success' : ''; ?>"></i> |
|
56 | - <?php echo esc_html( $data['name'] ); ?> |
|
55 | + <i class="far fa-check-circle <?php echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? 'text-success' : ''; ?>"></i> |
|
56 | + <?php echo esc_html($data['name']); ?> |
|
57 | 57 | </li> |
58 | 58 | <?php endforeach; ?> |
59 | 59 | </ol> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <div class="text-center pb-3 mt-5"> |
65 | 65 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
66 | 66 | <span class="text-black-50"> |
67 | - <img class="ml-n3x" src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png' ); ?>" /> |
|
67 | + <img class="ml-n3x" src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'); ?>" /> |
|
68 | 68 | </span> |
69 | 69 | </a> |
70 | 70 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | $tax_rates = GetPaid_Tax::get_all_tax_rates(); |
10 | 10 | $dummy_rate = array( |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | 'global' => true, |
14 | 14 | 'rate' => wpinv_get_default_tax_rate(), |
15 | 15 | 'reduced_rate' => 5, |
16 | - 'name' => __( 'VAT', 'invoicing' ), |
|
16 | + 'name' => __('VAT', 'invoicing'), |
|
17 | 17 | ); |
18 | 18 | |
19 | 19 | $reset_url = wp_nonce_url( |
20 | - add_query_arg( 'getpaid-admin-action', 'reset_tax_rates' ), |
|
20 | + add_query_arg('getpaid-admin-action', 'reset_tax_rates'), |
|
21 | 21 | 'getpaid-nonce', |
22 | 22 | 'getpaid-nonce' |
23 | 23 | ); |
@@ -25,34 +25,34 @@ discard block |
||
25 | 25 | ?> |
26 | 26 | <div class="table-responsive"> |
27 | 27 | <table id="wpinv_tax_rates" class="widefat fixed table"> |
28 | - <caption><?php echo esc_html_e( 'Enter tax rates for specific regions.', 'invoicing' ); ?></caption> |
|
28 | + <caption><?php echo esc_html_e('Enter tax rates for specific regions.', 'invoicing'); ?></caption> |
|
29 | 29 | |
30 | 30 | <thead> |
31 | 31 | <tr class="table-light"> |
32 | 32 | |
33 | 33 | <th scope="col" class="border-bottom border-top"> |
34 | - <?php esc_html_e( 'Country', 'invoicing' ); ?> |
|
35 | - <?php getpaid_get_help_tip( __( 'Optionally limit this tax rate to a specific country.', 'invoicing' ), 'position-static', true ); ?> |
|
34 | + <?php esc_html_e('Country', 'invoicing'); ?> |
|
35 | + <?php getpaid_get_help_tip(__('Optionally limit this tax rate to a specific country.', 'invoicing'), 'position-static', true); ?> |
|
36 | 36 | </th> |
37 | 37 | |
38 | 38 | <th scope="col" class="border-bottom border-top"> |
39 | - <?php esc_html_e( 'State', 'invoicing' ); ?> |
|
40 | - <?php getpaid_get_help_tip( __( 'Separate state codes using a comma or leave blank to apply country wide.', 'invoicing' ), 'position-static', true ); ?> |
|
39 | + <?php esc_html_e('State', 'invoicing'); ?> |
|
40 | + <?php getpaid_get_help_tip(__('Separate state codes using a comma or leave blank to apply country wide.', 'invoicing'), 'position-static', true); ?> |
|
41 | 41 | </th> |
42 | 42 | |
43 | 43 | <th scope="col" class="border-bottom border-top"> |
44 | - <?php esc_html_e( 'Standard Rate %', 'invoicing' ); ?> |
|
45 | - <?php getpaid_get_help_tip( __( 'The tax rate (percentage) to charge on items that use the "Standard rate" tax class.', 'invoicing' ), 'position-static', true ); ?> |
|
44 | + <?php esc_html_e('Standard Rate %', 'invoicing'); ?> |
|
45 | + <?php getpaid_get_help_tip(__('The tax rate (percentage) to charge on items that use the "Standard rate" tax class.', 'invoicing'), 'position-static', true); ?> |
|
46 | 46 | </th> |
47 | 47 | |
48 | 48 | <th scope="col" class="border-bottom border-top"> |
49 | - <?php esc_html_e( 'Reduced Rate %', 'invoicing' ); ?> |
|
50 | - <?php getpaid_get_help_tip( __( 'The tax rate (percentage) to charge on items that use the "Reduced rate" tax class.', 'invoicing' ), 'position-static', true ); ?> |
|
49 | + <?php esc_html_e('Reduced Rate %', 'invoicing'); ?> |
|
50 | + <?php getpaid_get_help_tip(__('The tax rate (percentage) to charge on items that use the "Reduced rate" tax class.', 'invoicing'), 'position-static', true); ?> |
|
51 | 51 | </th> |
52 | 52 | |
53 | 53 | <th scope="col" class="border-bottom border-top"> |
54 | - <?php esc_html_e( 'Tax Name', 'invoicing' ); ?> |
|
55 | - <?php getpaid_get_help_tip( __( 'The name of this tax, e.g VAT.', 'invoicing' ), 'position-static', true ); ?> |
|
54 | + <?php esc_html_e('Tax Name', 'invoicing'); ?> |
|
55 | + <?php getpaid_get_help_tip(__('The name of this tax, e.g VAT.', 'invoicing'), 'position-static', true); ?> |
|
56 | 56 | </th> |
57 | 57 | |
58 | 58 | <th scope="col" class="border-bottom border-top" style="width:32px"> </th> |
@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | </thead> |
62 | 62 | |
63 | 63 | <tbody> |
64 | - <?php array_walk( $tax_rates, 'wpinv_tax_rate_callback' ); ?> |
|
64 | + <?php array_walk($tax_rates, 'wpinv_tax_rate_callback'); ?> |
|
65 | 65 | </tbody> |
66 | 66 | |
67 | 67 | <tfoot> |
68 | 68 | <tr class="table-light"> |
69 | 69 | <td colspan="6" class="border-top"> |
70 | 70 | |
71 | - <button type="button" class="button button-secondary wpinv_add_tax_rate" aria-label="<?php esc_attr_e( 'Add Tax Rate', 'invoicing' ); ?>"> |
|
72 | - <span><?php esc_html_e( 'Add Tax Rate', 'invoicing' ); ?></span> |
|
71 | + <button type="button" class="button button-secondary wpinv_add_tax_rate" aria-label="<?php esc_attr_e('Add Tax Rate', 'invoicing'); ?>"> |
|
72 | + <span><?php esc_html_e('Add Tax Rate', 'invoicing'); ?></span> |
|
73 | 73 | </button> |
74 | 74 | |
75 | - <a href="<?php echo esc_url( $reset_url ); ?>" class="button button-secondary wpinv_reset_tax_rates" aria-label="<?php esc_attr_e( 'Reset Tax Rates', 'invoicing' ); ?>"> |
|
76 | - <span><?php esc_html_e( 'Reset Tax Rates', 'invoicing' ); ?></span> |
|
75 | + <a href="<?php echo esc_url($reset_url); ?>" class="button button-secondary wpinv_reset_tax_rates" aria-label="<?php esc_attr_e('Reset Tax Rates', 'invoicing'); ?>"> |
|
76 | + <span><?php esc_html_e('Reset Tax Rates', 'invoicing'); ?></span> |
|
77 | 77 | </a> |
78 | 78 | </td> |
79 | 79 | </tr> |
@@ -82,6 +82,6 @@ discard block |
||
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <script type="text/html" id="tmpl-wpinv-tax-rate-row"> |
85 | - <?php wpinv_tax_rate_callback( $dummy_rate, 0, true ); ?> |
|
85 | + <?php wpinv_tax_rate_callback($dummy_rate, 0, true); ?> |
|
86 | 86 | </script> |
87 | 87 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GetPaid |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Generates a users select dropdown. |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param array $args |
17 | 17 | * @see wp_dropdown_users |
18 | 18 | */ |
19 | -function wpinv_dropdown_users( $args = '' ) { |
|
19 | +function wpinv_dropdown_users($args = '') { |
|
20 | 20 | |
21 | - if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) { |
|
21 | + if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) { |
|
22 | 22 | $args['show'] = 'display_name_with_login'; |
23 | 23 | } |
24 | 24 | |
25 | - return wp_dropdown_users( $args ); |
|
25 | + return wp_dropdown_users($args); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @return string capability to check against |
33 | 33 | * @param string $capalibilty Optional. The alternative capability to check against. |
34 | 34 | */ |
35 | -function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
|
35 | +function wpinv_get_capability($capalibilty = 'manage_invoicing') { |
|
36 | 36 | |
37 | - if ( current_user_can( 'manage_options' ) ) { |
|
37 | + if (current_user_can('manage_options')) { |
|
38 | 38 | return 'manage_options'; |
39 | 39 | }; |
40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return bool |
49 | 49 | */ |
50 | 50 | function wpinv_current_user_can_manage_invoicing() { |
51 | - return current_user_can( wpinv_get_capability() ); |
|
51 | + return current_user_can(wpinv_get_capability()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | * @since 1.0.19 |
58 | 58 | * @return int|WP_Error |
59 | 59 | */ |
60 | -function wpinv_create_user( $email, $prefix = '' ) { |
|
60 | +function wpinv_create_user($email, $prefix = '') { |
|
61 | 61 | |
62 | 62 | // Prepare user values. |
63 | - $prefix = preg_replace( '/\s+/', '', $prefix ); |
|
64 | - $prefix = empty( $prefix ) ? $email : $prefix; |
|
65 | - $args = array( |
|
66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
63 | + $prefix = preg_replace('/\s+/', '', $prefix); |
|
64 | + $prefix = empty($prefix) ? $email : $prefix; |
|
65 | + $args = array( |
|
66 | + 'user_login' => wpinv_generate_user_name($prefix), |
|
67 | 67 | 'user_pass' => wp_generate_password(), |
68 | 68 | 'user_email' => $email, |
69 | 69 | 'role' => 'subscriber', |
70 | 70 | ); |
71 | 71 | |
72 | - return wp_insert_user( $args ); |
|
72 | + return wp_insert_user($args); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -79,26 +79,26 @@ discard block |
||
79 | 79 | * @since 1.0.19 |
80 | 80 | * @return bool|WP_User |
81 | 81 | */ |
82 | -function wpinv_generate_user_name( $prefix = '' ) { |
|
82 | +function wpinv_generate_user_name($prefix = '') { |
|
83 | 83 | |
84 | 84 | // If prefix is an email, retrieve the part before the email. |
85 | - $prefix = strtok( $prefix, '@' ); |
|
86 | - $prefix = trim( $prefix, '.' ); |
|
85 | + $prefix = strtok($prefix, '@'); |
|
86 | + $prefix = trim($prefix, '.'); |
|
87 | 87 | |
88 | 88 | // Sanitize the username. |
89 | - $prefix = sanitize_user( $prefix, true ); |
|
89 | + $prefix = sanitize_user($prefix, true); |
|
90 | 90 | |
91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
91 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
92 | + if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) { |
|
93 | + $prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $username = $prefix; |
97 | 97 | $postfix = 2; |
98 | 98 | |
99 | - while ( username_exists( $username ) ) { |
|
99 | + while (username_exists($username)) { |
|
100 | 100 | $username = $prefix + $postfix; |
101 | - $postfix ++; |
|
101 | + $postfix++; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $username; |
@@ -115,31 +115,31 @@ discard block |
||
115 | 115 | $tabs = array( |
116 | 116 | |
117 | 117 | 'gp-invoices' => array( |
118 | - 'label' => __( 'Invoices', 'invoicing' ), // Name of the tab. |
|
118 | + 'label' => __('Invoices', 'invoicing'), // Name of the tab. |
|
119 | 119 | 'content' => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead. |
120 | 120 | 'icon' => 'fas fa-file-invoice', // Shown on some profile plugins. |
121 | 121 | ), |
122 | 122 | |
123 | 123 | 'gp-subscriptions' => array( |
124 | - 'label' => __( 'Subscriptions', 'invoicing' ), |
|
124 | + 'label' => __('Subscriptions', 'invoicing'), |
|
125 | 125 | 'content' => '[wpinv_subscriptions]', |
126 | 126 | 'icon' => 'fas fa-redo', |
127 | 127 | ), |
128 | 128 | |
129 | 129 | 'gp-edit-address' => array( |
130 | - 'label' => __( 'Billing Address', 'invoicing' ), |
|
130 | + 'label' => __('Billing Address', 'invoicing'), |
|
131 | 131 | 'callback' => 'getpaid_display_address_edit_tab', |
132 | 132 | 'icon' => 'fas fa-credit-card', |
133 | 133 | ), |
134 | 134 | |
135 | 135 | ); |
136 | 136 | |
137 | - $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs ); |
|
137 | + $tabs = apply_filters('getpaid_user_content_tabs', $tabs); |
|
138 | 138 | |
139 | 139 | // Make sure address editing is last on the list. |
140 | - if ( isset( $tabs['gp-edit-address'] ) ) { |
|
140 | + if (isset($tabs['gp-edit-address'])) { |
|
141 | 141 | $address = $tabs['gp-edit-address']; |
142 | - unset( $tabs['gp-edit-address'] ); |
|
142 | + unset($tabs['gp-edit-address']); |
|
143 | 143 | $tabs['gp-edit-address'] = $address; |
144 | 144 | } |
145 | 145 | |
@@ -153,19 +153,19 @@ discard block |
||
153 | 153 | * @param array $tab |
154 | 154 | * @return array |
155 | 155 | */ |
156 | -function getpaid_prepare_user_content_tab( $tab ) { |
|
156 | +function getpaid_prepare_user_content_tab($tab) { |
|
157 | 157 | |
158 | - if ( ! empty( $tab['callback'] ) ) { |
|
159 | - return call_user_func( $tab['callback'] ); |
|
158 | + if (!empty($tab['callback'])) { |
|
159 | + return call_user_func($tab['callback']); |
|
160 | 160 | } |
161 | 161 | |
162 | - if ( ! empty( $tab['content'] ) ) { |
|
163 | - return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) ); |
|
162 | + if (!empty($tab['content'])) { |
|
163 | + return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content'])))))))); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $notice = aui()->alert( |
167 | 167 | array( |
168 | - 'content' => __( 'This tab has no content or content callback.', 'invoicing' ), |
|
168 | + 'content' => __('This tab has no content or content callback.', 'invoicing'), |
|
169 | 169 | 'type' => 'error', |
170 | 170 | ) |
171 | 171 | ); |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | * @param string $default |
182 | 182 | * @return array |
183 | 183 | */ |
184 | -function getpaid_get_tab_url( $tab, $default ) { |
|
184 | +function getpaid_get_tab_url($tab, $default) { |
|
185 | 185 | global $getpaid_tab_url; |
186 | 186 | |
187 | - if ( empty( $getpaid_tab_url ) ) { |
|
187 | + if (empty($getpaid_tab_url)) { |
|
188 | 188 | return $default; |
189 | 189 | } |
190 | 190 | |
191 | - return sprintf( $getpaid_tab_url, $tab ); |
|
191 | + return sprintf($getpaid_tab_url, $tab); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | */ |
201 | 201 | function getpaid_display_address_edit_tab() { |
202 | 202 | |
203 | - if ( 0 === get_current_user_id() ) { |
|
203 | + if (0 === get_current_user_id()) { |
|
204 | 204 | return '<div class="bsui">' . aui()->alert( |
205 | 205 | array( |
206 | 206 | 'type' => 'error', |
207 | - 'content' => __( 'Your must be logged in to view this section', 'invoicing' ), |
|
207 | + 'content' => __('Your must be logged in to view this section', 'invoicing'), |
|
208 | 208 | 'dismissible' => false, |
209 | 209 | ) |
210 | 210 | ) . '</div>'; |
@@ -218,19 +218,19 @@ discard block |
||
218 | 218 | |
219 | 219 | <?php |
220 | 220 | |
221 | - foreach ( getpaid_user_address_fields() as $key => $label ) { |
|
221 | + foreach (getpaid_user_address_fields() as $key => $label) { |
|
222 | 222 | |
223 | 223 | // Display the country. |
224 | - if ( 'country' == $key ) { |
|
224 | + if ('country' == $key) { |
|
225 | 225 | |
226 | 226 | aui()->select( |
227 | 227 | array( |
228 | 228 | 'options' => wpinv_get_country_list(), |
229 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
230 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
231 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
229 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
230 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
231 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
232 | 232 | 'placeholder' => $label, |
233 | - 'label' => wp_kses_post( $label ), |
|
233 | + 'label' => wp_kses_post($label), |
|
234 | 234 | 'label_type' => 'vertical', |
235 | 235 | 'class' => 'getpaid-address-field', |
236 | 236 | ), |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // Display the state. |
243 | - elseif ( 'state' == $key ) { |
|
243 | + elseif ('state' == $key) { |
|
244 | 244 | |
245 | 245 | getpaid_get_states_select_markup( |
246 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
247 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
246 | + getpaid_get_user_address_field(get_current_user_id(), 'country'), |
|
247 | + getpaid_get_user_address_field(get_current_user_id(), 'state'), |
|
248 | 248 | $label, |
249 | 249 | $label, |
250 | 250 | '', |
251 | 251 | false, |
252 | 252 | '', |
253 | - 'getpaid_address[' . esc_attr( $key ) . ']', |
|
253 | + 'getpaid_address[' . esc_attr($key) . ']', |
|
254 | 254 | true |
255 | 255 | ); |
256 | 256 | |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | |
259 | 259 | aui()->input( |
260 | 260 | array( |
261 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
262 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
261 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
262 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
263 | 263 | 'placeholder' => $label, |
264 | - 'label' => wp_kses_post( $label ), |
|
264 | + 'label' => wp_kses_post($label), |
|
265 | 265 | 'label_type' => 'vertical', |
266 | 266 | 'type' => 'text', |
267 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
267 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
268 | 268 | 'class' => 'getpaid-address-field', |
269 | 269 | ), |
270 | 270 | true |
@@ -278,32 +278,32 @@ discard block |
||
278 | 278 | 'name' => 'getpaid_address[email_cc]', |
279 | 279 | 'id' => 'wpinv-email_cc', |
280 | 280 | 'placeholder' => '[email protected], [email protected]', |
281 | - 'label' => __( 'Other email addresses', 'invoicing' ), |
|
281 | + 'label' => __('Other email addresses', 'invoicing'), |
|
282 | 282 | 'label_type' => 'vertical', |
283 | 283 | 'type' => 'text', |
284 | - 'value' => sanitize_text_field( get_user_meta( get_current_user_id(), '_wpinv_email_cc', true ) ), |
|
284 | + 'value' => sanitize_text_field(get_user_meta(get_current_user_id(), '_wpinv_email_cc', true)), |
|
285 | 285 | 'class' => 'getpaid-address-field', |
286 | - 'help_text' => __( 'Optionally provide other email addresses where we should send payment notifications', 'invoicing' ), |
|
286 | + 'help_text' => __('Optionally provide other email addresses where we should send payment notifications', 'invoicing'), |
|
287 | 287 | ), |
288 | 288 | true |
289 | 289 | ); |
290 | 290 | |
291 | - do_action( 'getpaid_display_address_edit_tab' ); |
|
291 | + do_action('getpaid_display_address_edit_tab'); |
|
292 | 292 | |
293 | 293 | aui()->input( |
294 | 294 | array( |
295 | 295 | 'name' => 'getpaid_profile_edit_submit_button', |
296 | 296 | 'id' => 'getpaid_profile_edit_submit_button', |
297 | - 'value' => __( 'Save Address', 'invoicing' ), |
|
298 | - 'help_text' => __( 'New invoices will use this address as the billing address.', 'invoicing' ), |
|
297 | + 'value' => __('Save Address', 'invoicing'), |
|
298 | + 'help_text' => __('New invoices will use this address as the billing address.', 'invoicing'), |
|
299 | 299 | 'type' => 'submit', |
300 | 300 | 'class' => 'btn btn-primary btn-block submit-button', |
301 | 301 | ), |
302 | 302 | true |
303 | 303 | ); |
304 | 304 | |
305 | - wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); |
|
306 | - getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' ); |
|
305 | + wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); |
|
306 | + getpaid_hidden_field('getpaid-action', 'edit_billing_details'); |
|
307 | 307 | ?> |
308 | 308 | |
309 | 309 | </form> |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | return ob_get_clean(); |
315 | 315 | } |
316 | -add_shortcode( 'getpaid_edit_address', 'getpaid_display_address_edit_tab' ); |
|
316 | +add_shortcode('getpaid_edit_address', 'getpaid_display_address_edit_tab'); |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Saves the billing address edit tab. |
@@ -321,30 +321,30 @@ discard block |
||
321 | 321 | * @since 2.1.4 |
322 | 322 | * @param array $data |
323 | 323 | */ |
324 | -function getpaid_save_address_edit_tab( $data ) { |
|
324 | +function getpaid_save_address_edit_tab($data) { |
|
325 | 325 | |
326 | - if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) { |
|
326 | + if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) { |
|
327 | 327 | return; |
328 | 328 | } |
329 | 329 | |
330 | 330 | $data = $data['getpaid_address']; |
331 | 331 | $user_id = get_current_user_id(); |
332 | 332 | |
333 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
333 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
334 | 334 | |
335 | - if ( isset( $data[ $field ] ) ) { |
|
336 | - $value = sanitize_text_field( $data[ $field ] ); |
|
337 | - update_user_meta( $user_id, '_wpinv_' . $field, $value ); |
|
335 | + if (isset($data[$field])) { |
|
336 | + $value = sanitize_text_field($data[$field]); |
|
337 | + update_user_meta($user_id, '_wpinv_' . $field, $value); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | - if ( isset( $data['email_cc'] ) ) { |
|
342 | - update_user_meta( $user_id, '_wpinv_email_cc', sanitize_text_field( $data['email_cc'] ) ); |
|
341 | + if (isset($data['email_cc'])) { |
|
342 | + update_user_meta($user_id, '_wpinv_email_cc', sanitize_text_field($data['email_cc'])); |
|
343 | 343 | } |
344 | 344 | |
345 | - wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success' ); |
|
345 | + wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success'); |
|
346 | 346 | } |
347 | -add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' ); |
|
347 | +add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab'); |
|
348 | 348 | |
349 | 349 | |
350 | 350 | /* |
@@ -362,27 +362,27 @@ discard block |
||
362 | 362 | * @param array $tabs |
363 | 363 | * @return array |
364 | 364 | */ |
365 | -function getpaid_filter_userswp_account_tabs( $tabs ) { |
|
365 | +function getpaid_filter_userswp_account_tabs($tabs) { |
|
366 | 366 | |
367 | 367 | // Abort if the integration is inactive. |
368 | - if ( ! getpaid_is_userswp_integration_active() ) { |
|
368 | + if (!getpaid_is_userswp_integration_active()) { |
|
369 | 369 | return $tabs; |
370 | 370 | } |
371 | 371 | |
372 | - $new_tabs = array(); |
|
372 | + $new_tabs = array(); |
|
373 | 373 | |
374 | - foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) { |
|
374 | + foreach (getpaid_get_user_content_tabs() as $slug => $tab) { |
|
375 | 375 | |
376 | - $new_tabs[ $slug ] = array( |
|
376 | + $new_tabs[$slug] = array( |
|
377 | 377 | 'title' => $tab['label'], |
378 | 378 | 'icon' => $tab['icon'], |
379 | 379 | ); |
380 | 380 | |
381 | 381 | } |
382 | 382 | |
383 | - return array_merge( $tabs, $new_tabs ); |
|
383 | + return array_merge($tabs, $new_tabs); |
|
384 | 384 | } |
385 | -add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' ); |
|
385 | +add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs'); |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Display our UsersWP account tabs. |
@@ -391,21 +391,21 @@ discard block |
||
391 | 391 | * @param array $tabs |
392 | 392 | * @return array |
393 | 393 | */ |
394 | -function getpaid_display_userswp_account_tabs( $tab ) { |
|
394 | +function getpaid_display_userswp_account_tabs($tab) { |
|
395 | 395 | global $getpaid_tab_url; |
396 | 396 | |
397 | 397 | $our_tabs = getpaid_get_user_content_tabs(); |
398 | 398 | |
399 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
400 | - $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() ); |
|
401 | - echo wp_kses( getpaid_prepare_user_content_tab( $our_tabs[ $tab ] ), getpaid_allowed_html() ); |
|
399 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
400 | + $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url()); |
|
401 | + echo wp_kses(getpaid_prepare_user_content_tab($our_tabs[$tab]), getpaid_allowed_html()); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | } |
405 | -add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' ); |
|
405 | +add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs'); |
|
406 | 406 | |
407 | 407 | function getpaid_allowed_html() { |
408 | - $allowed_html = wp_kses_allowed_html( 'post' ); |
|
408 | + $allowed_html = wp_kses_allowed_html('post'); |
|
409 | 409 | |
410 | 410 | // form fields |
411 | 411 | $allowed_html['form'] = array( |
@@ -453,17 +453,17 @@ discard block |
||
453 | 453 | * @param string $tab Current tab. |
454 | 454 | * @return string Title. |
455 | 455 | */ |
456 | -function getpaid_filter_userswp_account_title( $title, $tab ) { |
|
456 | +function getpaid_filter_userswp_account_title($title, $tab) { |
|
457 | 457 | |
458 | - $our_tabs = getpaid_get_user_content_tabs(); |
|
458 | + $our_tabs = getpaid_get_user_content_tabs(); |
|
459 | 459 | |
460 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
461 | - return $our_tabs[ $tab ]['label']; |
|
460 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
461 | + return $our_tabs[$tab]['label']; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | return $title; |
465 | 465 | } |
466 | -add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 ); |
|
466 | +add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2); |
|
467 | 467 | |
468 | 468 | /** |
469 | 469 | * Registers the UsersWP integration settings. |
@@ -472,26 +472,26 @@ discard block |
||
472 | 472 | * @param array $settings An array of integration settings. |
473 | 473 | * @return array |
474 | 474 | */ |
475 | -function getpaid_register_userswp_settings( $settings ) { |
|
475 | +function getpaid_register_userswp_settings($settings) { |
|
476 | 476 | |
477 | - if ( defined( 'USERSWP_PLUGIN_FILE' ) ) { |
|
477 | + if (defined('USERSWP_PLUGIN_FILE')) { |
|
478 | 478 | |
479 | 479 | $settings[] = array( |
480 | 480 | |
481 | 481 | 'id' => 'userswp', |
482 | - 'label' => __( 'UsersWP', 'invoicing' ), |
|
482 | + 'label' => __('UsersWP', 'invoicing'), |
|
483 | 483 | 'settings' => array( |
484 | 484 | |
485 | 485 | 'userswp_settings' => array( |
486 | 486 | 'id' => 'userswp_settings', |
487 | - 'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>', |
|
487 | + 'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>', |
|
488 | 488 | 'type' => 'header', |
489 | 489 | ), |
490 | 490 | |
491 | 491 | 'enable_userswp' => array( |
492 | 492 | 'id' => 'enable_userswp', |
493 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
494 | - 'desc' => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ), |
|
493 | + 'name' => __('Enable Integration', 'invoicing'), |
|
494 | + 'desc' => __('Display GetPaid items on UsersWP account page.', 'invoicing'), |
|
495 | 495 | 'type' => 'checkbox', |
496 | 496 | 'std' => 1, |
497 | 497 | ), |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | return $settings; |
506 | 506 | } |
507 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' ); |
|
507 | +add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings'); |
|
508 | 508 | |
509 | 509 | /** |
510 | 510 | * Ovewrites the invoices history page to UsersWP. |
@@ -512,18 +512,18 @@ discard block |
||
512 | 512 | * @since 2.3.1 |
513 | 513 | * @return bool |
514 | 514 | */ |
515 | -function getpaid_userswp_overwrite_invoice_history_page( $url, $post_type ) { |
|
515 | +function getpaid_userswp_overwrite_invoice_history_page($url, $post_type) { |
|
516 | 516 | |
517 | 517 | $our_tabs = getpaid_get_user_content_tabs(); |
518 | 518 | $tab = "gp-{$post_type}s"; |
519 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
520 | - return add_query_arg( 'type', $tab, uwp_get_account_page_url() ); |
|
519 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
520 | + return add_query_arg('type', $tab, uwp_get_account_page_url()); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | return $url; |
524 | 524 | |
525 | 525 | } |
526 | -add_filter( 'wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2 ); |
|
526 | +add_filter('wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2); |
|
527 | 527 | |
528 | 528 | /** |
529 | 529 | * Checks if the integration is enabled. |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | * @return bool |
533 | 533 | */ |
534 | 534 | function getpaid_is_userswp_integration_active() { |
535 | - $enabled = wpinv_get_option( 'enable_userswp', 1 ); |
|
536 | - return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled ); |
|
535 | + $enabled = wpinv_get_option('enable_userswp', 1); |
|
536 | + return defined('USERSWP_PLUGIN_FILE') && !empty($enabled); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /* |
@@ -551,26 +551,26 @@ discard block |
||
551 | 551 | * @param array $settings An array of integration settings. |
552 | 552 | * @return array |
553 | 553 | */ |
554 | -function getpaid_register_buddypress_settings( $settings ) { |
|
554 | +function getpaid_register_buddypress_settings($settings) { |
|
555 | 555 | |
556 | - if ( class_exists( 'BuddyPress' ) ) { |
|
556 | + if (class_exists('BuddyPress')) { |
|
557 | 557 | |
558 | 558 | $settings[] = array( |
559 | 559 | |
560 | 560 | 'id' => 'buddypress', |
561 | - 'label' => __( 'BuddyPress', 'invoicing' ), |
|
561 | + 'label' => __('BuddyPress', 'invoicing'), |
|
562 | 562 | 'settings' => array( |
563 | 563 | |
564 | 564 | 'buddypress_settings' => array( |
565 | 565 | 'id' => 'buddypress_settings', |
566 | - 'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>', |
|
566 | + 'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>', |
|
567 | 567 | 'type' => 'header', |
568 | 568 | ), |
569 | 569 | |
570 | 570 | 'enable_buddypress' => array( |
571 | 571 | 'id' => 'enable_buddypress', |
572 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
573 | - 'desc' => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ), |
|
572 | + 'name' => __('Enable Integration', 'invoicing'), |
|
573 | + 'desc' => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'), |
|
574 | 574 | 'type' => 'checkbox', |
575 | 575 | 'std' => 1, |
576 | 576 | ), |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | |
584 | 584 | return $settings; |
585 | 585 | } |
586 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' ); |
|
586 | +add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings'); |
|
587 | 587 | |
588 | 588 | /** |
589 | 589 | * Checks if the integration is enabled. |
@@ -592,8 +592,8 @@ discard block |
||
592 | 592 | * @return bool |
593 | 593 | */ |
594 | 594 | function getpaid_is_buddypress_integration_active() { |
595 | - $enabled = wpinv_get_option( 'enable_buddypress', 1 ); |
|
596 | - return class_exists( 'BuddyPress' ) && ! empty( $enabled ); |
|
595 | + $enabled = wpinv_get_option('enable_buddypress', 1); |
|
596 | + return class_exists('BuddyPress') && !empty($enabled); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -604,10 +604,10 @@ discard block |
||
604 | 604 | */ |
605 | 605 | function getpaid_setup_buddypress_integration() { |
606 | 606 | |
607 | - if ( getpaid_is_buddypress_integration_active() ) { |
|
607 | + if (getpaid_is_buddypress_integration_active()) { |
|
608 | 608 | require_once WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php'; |
609 | 609 | buddypress()->getpaid = new BP_GetPaid_Component(); |
610 | 610 | } |
611 | 611 | |
612 | 612 | } |
613 | -add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' ); |
|
613 | +add_action('bp_setup_components', 'getpaid_setup_buddypress_integration'); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; // Exit if accessed directly |
4 | 4 | } |
5 | 5 | |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | * Hook in methods. |
15 | 15 | */ |
16 | 16 | public static function init() { |
17 | - add_action( 'init', array( __CLASS__, 'init_hooks' ), 0 ); |
|
18 | - add_action( 'admin_notices', array( __CLASS__, 'notices' ) ); |
|
17 | + add_action('init', array(__CLASS__, 'init_hooks'), 0); |
|
18 | + add_action('admin_notices', array(__CLASS__, 'notices')); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function init_hooks() { |
22 | - if ( false === ( $page_uris = get_transient( 'wpinv_cache_excluded_uris' ) ) ) { |
|
23 | - $checkout_page = wpinv_get_option( 'checkout_page', '' ); |
|
24 | - $success_page = wpinv_get_option( 'success_page', '' ); |
|
25 | - $failure_page = wpinv_get_option( 'failure_page', '' ); |
|
26 | - $history_page = wpinv_get_option( 'invoice_history_page', '' ); |
|
27 | - $subscr_page = wpinv_get_option( 'invoice_subscription_page', '' ); |
|
28 | - if ( empty( $checkout_page ) || empty( $success_page ) || empty( $failure_page ) || empty( $history_page ) || empty( $subscr_page ) ) { |
|
22 | + if (false === ($page_uris = get_transient('wpinv_cache_excluded_uris'))) { |
|
23 | + $checkout_page = wpinv_get_option('checkout_page', ''); |
|
24 | + $success_page = wpinv_get_option('success_page', ''); |
|
25 | + $failure_page = wpinv_get_option('failure_page', ''); |
|
26 | + $history_page = wpinv_get_option('invoice_history_page', ''); |
|
27 | + $subscr_page = wpinv_get_option('invoice_subscription_page', ''); |
|
28 | + if (empty($checkout_page) || empty($success_page) || empty($failure_page) || empty($history_page) || empty($subscr_page)) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -39,34 +39,34 @@ discard block |
||
39 | 39 | $page_uris[] = 'p=' . $subscr_page; |
40 | 40 | |
41 | 41 | // Exclude permalinks |
42 | - $checkout_page = get_post( $checkout_page ); |
|
43 | - $success_page = get_post( $success_page ); |
|
44 | - $failure_page = get_post( $failure_page ); |
|
45 | - $history_page = get_post( $history_page ); |
|
46 | - $subscr_page = get_post( $subscr_page ); |
|
42 | + $checkout_page = get_post($checkout_page); |
|
43 | + $success_page = get_post($success_page); |
|
44 | + $failure_page = get_post($failure_page); |
|
45 | + $history_page = get_post($history_page); |
|
46 | + $subscr_page = get_post($subscr_page); |
|
47 | 47 | |
48 | - if ( ! is_null( $checkout_page ) ) { |
|
48 | + if (!is_null($checkout_page)) { |
|
49 | 49 | $page_uris[] = '/' . $checkout_page->post_name; |
50 | 50 | } |
51 | - if ( ! is_null( $success_page ) ) { |
|
51 | + if (!is_null($success_page)) { |
|
52 | 52 | $page_uris[] = '/' . $success_page->post_name; |
53 | 53 | } |
54 | - if ( ! is_null( $failure_page ) ) { |
|
54 | + if (!is_null($failure_page)) { |
|
55 | 55 | $page_uris[] = '/' . $failure_page->post_name; |
56 | 56 | } |
57 | - if ( ! is_null( $history_page ) ) { |
|
57 | + if (!is_null($history_page)) { |
|
58 | 58 | $page_uris[] = '/' . $history_page->post_name; |
59 | 59 | } |
60 | - if ( ! is_null( $subscr_page ) ) { |
|
60 | + if (!is_null($subscr_page)) { |
|
61 | 61 | $page_uris[] = '/' . $subscr_page->post_name; |
62 | 62 | } |
63 | 63 | |
64 | - set_transient( 'wpinv_cache_excluded_uris', $page_uris ); |
|
64 | + set_transient('wpinv_cache_excluded_uris', $page_uris); |
|
65 | 65 | } |
66 | 66 | |
67 | - if ( is_array( $page_uris ) ) { |
|
68 | - foreach ( $page_uris as $uri ) { |
|
69 | - if ( strstr( $_SERVER['REQUEST_URI'], $uri ) ) { |
|
67 | + if (is_array($page_uris)) { |
|
68 | + foreach ($page_uris as $uri) { |
|
69 | + if (strstr($_SERVER['REQUEST_URI'], $uri)) { |
|
70 | 70 | self::nocache(); |
71 | 71 | break; |
72 | 72 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * @access private |
80 | 80 | */ |
81 | 81 | private static function nocache() { |
82 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
83 | - define( 'DONOTCACHEPAGE', true ); |
|
82 | + if (!defined('DONOTCACHEPAGE')) { |
|
83 | + define('DONOTCACHEPAGE', true); |
|
84 | 84 | } |
85 | - if ( ! defined( 'DONOTCACHEOBJECT' ) ) { |
|
86 | - define( 'DONOTCACHEOBJECT', true ); |
|
85 | + if (!defined('DONOTCACHEOBJECT')) { |
|
86 | + define('DONOTCACHEOBJECT', true); |
|
87 | 87 | } |
88 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
89 | - define( 'DONOTCACHEDB', true ); |
|
88 | + if (!defined('DONOTCACHEDB')) { |
|
89 | + define('DONOTCACHEDB', true); |
|
90 | 90 | } |
91 | 91 | nocache_headers(); |
92 | 92 | } |
@@ -95,18 +95,18 @@ discard block |
||
95 | 95 | * notices function. |
96 | 96 | */ |
97 | 97 | public static function notices() { |
98 | - if ( ! function_exists( 'w3tc_pgcache_flush' ) || ! function_exists( 'w3_instance' ) ) { |
|
98 | + if (!function_exists('w3tc_pgcache_flush') || !function_exists('w3_instance')) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - $config = w3_instance( 'W3_Config' ); |
|
103 | - $enabled = $config->get_integer( 'dbcache.enabled' ); |
|
104 | - $settings = array_map( 'trim', $config->get_array( 'dbcache.reject.sql' ) ); |
|
102 | + $config = w3_instance('W3_Config'); |
|
103 | + $enabled = $config->get_integer('dbcache.enabled'); |
|
104 | + $settings = array_map('trim', $config->get_array('dbcache.reject.sql')); |
|
105 | 105 | |
106 | - if ( $enabled && ! in_array( '_wp_session_', $settings ) ) { |
|
106 | + if ($enabled && !in_array('_wp_session_', $settings)) { |
|
107 | 107 | ?> |
108 | 108 | <div class="error"> |
109 | - <p><?php printf( wp_kses_post( __( 'In order for <strong>database caching</strong> to work with Invoicing you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'invoicing' ) ), '<code>_wp_session_</code>', esc_url( admin_url( 'admin.php?page=w3tc_dbcache' ) ) ); ?></p> |
|
109 | + <p><?php printf(wp_kses_post(__('In order for <strong>database caching</strong> to work with Invoicing you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'invoicing')), '<code>_wp_session_</code>', esc_url(admin_url('admin.php?page=w3tc_dbcache'))); ?></p> |
|
110 | 110 | </div> |
111 | 111 | <?php |
112 | 112 | } |