@@ -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 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Contains gateway functions. |
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | -defined( 'ABSPATH' ) || exit; |
|
| 6 | +defined('ABSPATH') || exit; |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Returns an array of payment gateways. |
@@ -11,30 +11,30 @@ discard block |
||
| 11 | 11 | * @return array |
| 12 | 12 | */ |
| 13 | 13 | function wpinv_get_payment_gateways() { |
| 14 | - return apply_filters( 'wpinv_payment_gateways', array() ); |
|
| 14 | + return apply_filters('wpinv_payment_gateways', array()); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -function wpinv_payment_gateway_titles( $all_gateways ) { |
|
| 17 | +function wpinv_payment_gateway_titles($all_gateways) { |
|
| 18 | 18 | |
| 19 | 19 | $options = wpinv_get_options(); |
| 20 | 20 | $gateways = array(); |
| 21 | - foreach ( $all_gateways as $key => $gateway ) { |
|
| 22 | - if ( ! empty( $options[ $key . '_title' ] ) ) { |
|
| 23 | - $all_gateways[ $key ]['checkout_label'] = __( $options[ $key . '_title' ], 'invoicing' ); |
|
| 21 | + foreach ($all_gateways as $key => $gateway) { |
|
| 22 | + if (!empty($options[$key . '_title'])) { |
|
| 23 | + $all_gateways[$key]['checkout_label'] = __($options[$key . '_title'], 'invoicing'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $gateways[ $key ] = isset( $options[ $key . '_ordering' ] ) ? $options[ $key . '_ordering' ] : ( isset( $gateway['ordering'] ) ? $gateway['ordering'] : '' ); |
|
| 26 | + $gateways[$key] = isset($options[$key . '_ordering']) ? $options[$key . '_ordering'] : (isset($gateway['ordering']) ? $gateway['ordering'] : ''); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - asort( $gateways ); |
|
| 29 | + asort($gateways); |
|
| 30 | 30 | |
| 31 | - foreach ( $gateways as $gateway => $key ) { |
|
| 32 | - $gateways[ $gateway ] = $all_gateways[ $gateway ]; |
|
| 31 | + foreach ($gateways as $gateway => $key) { |
|
| 32 | + $gateways[$gateway] = $all_gateways[$gateway]; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | return $gateways; |
| 36 | 36 | } |
| 37 | -add_filter( 'wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1 ); |
|
| 37 | +add_filter('wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Returns an array of enabled gateways. |
@@ -42,36 +42,36 @@ discard block |
||
| 42 | 42 | * @param bool $sort |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | -function wpinv_get_enabled_payment_gateways( $sort = false ) { |
|
| 45 | +function wpinv_get_enabled_payment_gateways($sort = false) { |
|
| 46 | 46 | |
| 47 | 47 | $enabled = array(); |
| 48 | 48 | |
| 49 | - foreach ( wpinv_get_payment_gateways() as $gateway => $data ) { |
|
| 49 | + foreach (wpinv_get_payment_gateways() as $gateway => $data) { |
|
| 50 | 50 | |
| 51 | - if ( (int) wpinv_get_option( "{$gateway}_active", $gateway === 'manual' ) === 1 ) { |
|
| 52 | - $enabled[ $gateway ] = $data; |
|
| 51 | + if ((int) wpinv_get_option("{$gateway}_active", $gateway === 'manual') === 1) { |
|
| 52 | + $enabled[$gateway] = $data; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if ( true === $sort ) { |
|
| 57 | - uasort( $enabled, 'wpinv_sort_gateway_order' ); |
|
| 56 | + if (true === $sort) { |
|
| 57 | + uasort($enabled, 'wpinv_sort_gateway_order'); |
|
| 58 | 58 | |
| 59 | 59 | // Reorder our gateways so the default is first |
| 60 | 60 | $default_gateway_id = wpinv_get_default_gateway(); |
| 61 | - if ( isset( $enabled[ $default_gateway_id ] ) ) { |
|
| 61 | + if (isset($enabled[$default_gateway_id])) { |
|
| 62 | 62 | $default_gateway = array( |
| 63 | - $default_gateway_id => $enabled[ $default_gateway_id ], |
|
| 63 | + $default_gateway_id => $enabled[$default_gateway_id], |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - unset( $enabled[ $default_gateway_id ] ); |
|
| 67 | - $enabled = array_merge( $default_gateway, $enabled ); |
|
| 66 | + unset($enabled[$default_gateway_id]); |
|
| 67 | + $enabled = array_merge($default_gateway, $enabled); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - return apply_filters( 'wpinv_enabled_payment_gateways', $enabled ); |
|
| 71 | + return apply_filters('wpinv_enabled_payment_gateways', $enabled); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | -function wpinv_sort_gateway_order( $a, $b ) { |
|
| 74 | +function wpinv_sort_gateway_order($a, $b) { |
|
| 75 | 75 | return $a['ordering'] - $b['ordering']; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | * @param string $gateway |
| 82 | 82 | * @return bool |
| 83 | 83 | */ |
| 84 | -function wpinv_is_gateway_active( $gateway ) { |
|
| 85 | - $is_active = (int) wpinv_get_option( "{$gateway}_active", $gateway === 'manual' ) === 1; |
|
| 86 | - return apply_filters( 'wpinv_is_gateway_active', $is_active, $gateway ); |
|
| 84 | +function wpinv_is_gateway_active($gateway) { |
|
| 85 | + $is_active = (int) wpinv_get_option("{$gateway}_active", $gateway === 'manual') === 1; |
|
| 86 | + return apply_filters('wpinv_is_gateway_active', $is_active, $gateway); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | * @return string|false |
| 93 | 93 | */ |
| 94 | 94 | function wpinv_get_default_gateway() { |
| 95 | - $default = wpinv_get_option( 'default_gateway' ); |
|
| 95 | + $default = wpinv_get_option('default_gateway'); |
|
| 96 | 96 | $gateways = wpinv_get_enabled_payment_gateways(); |
| 97 | - $default = ! empty( $default ) && isset( $gateways[ $default ] ) ? $default : false; |
|
| 97 | + $default = !empty($default) && isset($gateways[$default]) ? $default : false; |
|
| 98 | 98 | |
| 99 | - return apply_filters( 'wpinv_default_gateway', $default ); |
|
| 99 | + return apply_filters('wpinv_default_gateway', $default); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | * @param string $gateway The gateway to key. |
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | -function wpinv_get_gateway_admin_label( $gateway ) { |
|
| 108 | +function wpinv_get_gateway_admin_label($gateway) { |
|
| 109 | 109 | |
| 110 | - if ( empty( $gateway ) || 'none' == $gateway ) { |
|
| 111 | - return esc_html__( 'No Gateway', 'invoicing' ); |
|
| 110 | + if (empty($gateway) || 'none' == $gateway) { |
|
| 111 | + return esc_html__('No Gateway', 'invoicing'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $gateways = wpinv_get_payment_gateways(); |
| 115 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
| 116 | - $gateway = apply_filters( 'wpinv_gateway_admin_label', $label, $gateway ); |
|
| 115 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
| 116 | + $gateway = apply_filters('wpinv_gateway_admin_label', $label, $gateway); |
|
| 117 | 117 | |
| 118 | - return wpinv_clean( $gateway ); |
|
| 118 | + return wpinv_clean($gateway); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -123,48 +123,48 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @param string $gateway |
| 125 | 125 | */ |
| 126 | -function wpinv_get_gateway_description( $gateway ) { |
|
| 126 | +function wpinv_get_gateway_description($gateway) { |
|
| 127 | 127 | |
| 128 | 128 | $options = wpinv_get_options(); |
| 129 | - $description = ! empty( $options[ $gateway . '_desc' ] ) ? $options[ $gateway . '_desc' ] : ''; |
|
| 129 | + $description = !empty($options[$gateway . '_desc']) ? $options[$gateway . '_desc'] : ''; |
|
| 130 | 130 | |
| 131 | - return apply_filters( 'wpinv_gateway_description', $description, $gateway ); |
|
| 131 | + return apply_filters('wpinv_gateway_description', $description, $gateway); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -function wpinv_get_gateway_button_label( $gateway ) { |
|
| 135 | - return apply_filters( 'wpinv_gateway_' . $gateway . '_button_label', '' ); |
|
| 134 | +function wpinv_get_gateway_button_label($gateway) { |
|
| 135 | + return apply_filters('wpinv_gateway_' . $gateway . '_button_label', ''); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | -function wpinv_get_gateway_checkout_label( $gateway ) { |
|
| 138 | +function wpinv_get_gateway_checkout_label($gateway) { |
|
| 139 | 139 | $gateways = wpinv_get_payment_gateways(); |
| 140 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
| 140 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
| 141 | 141 | |
| 142 | - if ( $gateway == 'none' ) { |
|
| 143 | - $label = __( 'None', 'invoicing' ); |
|
| 142 | + if ($gateway == 'none') { |
|
| 143 | + $label = __('None', 'invoicing'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - return apply_filters( 'wpinv_gateway_checkout_label', ucfirst( $label ), $gateway ); |
|
| 146 | + return apply_filters('wpinv_gateway_checkout_label', ucfirst($label), $gateway); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | -function wpinv_settings_sections_gateways( $settings ) { |
|
| 149 | +function wpinv_settings_sections_gateways($settings) { |
|
| 150 | 150 | $gateways = wpinv_get_payment_gateways(); |
| 151 | - ksort( $gateways ); |
|
| 151 | + ksort($gateways); |
|
| 152 | 152 | |
| 153 | - foreach ( $gateways as $key => $gateway ) { |
|
| 154 | - $settings[ $key ] = $gateway['admin_label']; |
|
| 153 | + foreach ($gateways as $key => $gateway) { |
|
| 154 | + $settings[$key] = $gateway['admin_label']; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | return $settings; |
| 158 | 158 | } |
| 159 | -add_filter( 'wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1 ); |
|
| 159 | +add_filter('wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1); |
|
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * Adds GateWay settings. |
| 163 | 163 | */ |
| 164 | -function wpinv_settings_gateways( $settings ) { |
|
| 164 | +function wpinv_settings_gateways($settings) { |
|
| 165 | 165 | |
| 166 | 166 | // Loop through each gateway. |
| 167 | - foreach ( wpinv_get_payment_gateways() as $key => $gateway ) { |
|
| 167 | + foreach (wpinv_get_payment_gateways() as $key => $gateway) { |
|
| 168 | 168 | |
| 169 | 169 | $gateway_settings = array( |
| 170 | 170 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | "{$key}_header" => array( |
| 173 | 173 | |
| 174 | 174 | 'id' => "{$key}_gateway_header", |
| 175 | - 'name' => '<h3>' . wp_sprintf( __( '%s Settings', 'invoicing' ), $gateway['admin_label'] ) . '</h3>', |
|
| 175 | + 'name' => '<h3>' . wp_sprintf(__('%s Settings', 'invoicing'), $gateway['admin_label']) . '</h3>', |
|
| 176 | 176 | 'custom' => $key, |
| 177 | 177 | 'type' => 'gateway_header', |
| 178 | 178 | |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | // Activate/Deactivate a gateway. |
| 182 | 182 | "{$key}_active" => array( |
| 183 | 183 | 'id' => $key . '_active', |
| 184 | - 'name' => __( 'Activate', 'invoicing' ), |
|
| 185 | - 'desc' => wp_sprintf( __( 'Enable %s', 'invoicing' ), $gateway['admin_label'] ), |
|
| 184 | + 'name' => __('Activate', 'invoicing'), |
|
| 185 | + 'desc' => wp_sprintf(__('Enable %s', 'invoicing'), $gateway['admin_label']), |
|
| 186 | 186 | 'type' => 'checkbox', |
| 187 | 187 | 'std' => $key === 'manual' ? '1' : '0', |
| 188 | 188 | ), |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | // Activate/Deactivate sandbox. |
| 191 | 191 | "{$key}_sandbox" => array( |
| 192 | 192 | 'id' => $key . '_sandbox', |
| 193 | - 'name' => __( 'Sandbox', 'invoicing' ), |
|
| 194 | - 'desc' => __( 'Enable sandbox to test payments', 'invoicing' ), |
|
| 193 | + 'name' => __('Sandbox', 'invoicing'), |
|
| 194 | + 'desc' => __('Enable sandbox to test payments', 'invoicing'), |
|
| 195 | 195 | 'type' => 'checkbox', |
| 196 | 196 | 'std' => '1', |
| 197 | 197 | ), |
@@ -199,51 +199,51 @@ discard block |
||
| 199 | 199 | // Checkout title. |
| 200 | 200 | "{$key}_title" => array( |
| 201 | 201 | 'id' => $key . '_title', |
| 202 | - 'name' => __( 'Checkout Title', 'invoicing' ), |
|
| 203 | - 'std' => isset( $gateway['checkout_label'] ) ? $gateway['checkout_label'] : '', |
|
| 202 | + 'name' => __('Checkout Title', 'invoicing'), |
|
| 203 | + 'std' => isset($gateway['checkout_label']) ? $gateway['checkout_label'] : '', |
|
| 204 | 204 | 'type' => 'text', |
| 205 | 205 | ), |
| 206 | 206 | |
| 207 | 207 | // Checkout description. |
| 208 | 208 | "{$key}_desc" => array( |
| 209 | 209 | 'id' => $key . '_desc', |
| 210 | - 'name' => __( 'Checkout Description', 'invoicing' ), |
|
| 211 | - 'std' => apply_filters( "getpaid_default_{$key}_checkout_description", '' ), |
|
| 210 | + 'name' => __('Checkout Description', 'invoicing'), |
|
| 211 | + 'std' => apply_filters("getpaid_default_{$key}_checkout_description", ''), |
|
| 212 | 212 | 'type' => 'text', |
| 213 | 213 | ), |
| 214 | 214 | |
| 215 | 215 | // Checkout order. |
| 216 | 216 | "{$key}_ordering" => array( |
| 217 | 217 | 'id' => $key . '_ordering', |
| 218 | - 'name' => __( 'Priority', 'invoicing' ), |
|
| 219 | - 'std' => apply_filters( "getpaid_default_{$key}_checkout_description", '' ), |
|
| 218 | + 'name' => __('Priority', 'invoicing'), |
|
| 219 | + 'std' => apply_filters("getpaid_default_{$key}_checkout_description", ''), |
|
| 220 | 220 | 'type' => 'number', |
| 221 | 221 | 'step' => '1', |
| 222 | 222 | 'min' => '0', |
| 223 | 223 | 'max' => '100000', |
| 224 | - 'std' => isset( $gateway['ordering'] ) ? $gateway['ordering'] : '10', |
|
| 224 | + 'std' => isset($gateway['ordering']) ? $gateway['ordering'] : '10', |
|
| 225 | 225 | ), |
| 226 | 226 | |
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | 229 | // Maybe remove the sandbox. |
| 230 | - if ( ! getpaid_payment_gateway_supports( $key, 'sandbox' ) ) { |
|
| 231 | - unset( $gateway_settings[ "{$key}_sandbox" ] ); |
|
| 230 | + if (!getpaid_payment_gateway_supports($key, 'sandbox')) { |
|
| 231 | + unset($gateway_settings["{$key}_sandbox"]); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $gateway_settings = apply_filters( 'wpinv_gateway_settings', $gateway_settings, $key, $gateway ); |
|
| 235 | - $gateway_settings = apply_filters( 'wpinv_gateway_settings_' . $key, $gateway_settings, $gateway ); |
|
| 234 | + $gateway_settings = apply_filters('wpinv_gateway_settings', $gateway_settings, $key, $gateway); |
|
| 235 | + $gateway_settings = apply_filters('wpinv_gateway_settings_' . $key, $gateway_settings, $gateway); |
|
| 236 | 236 | |
| 237 | - $settings[ $key ] = $gateway_settings; |
|
| 237 | + $settings[$key] = $gateway_settings; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $settings; |
| 241 | 241 | |
| 242 | 242 | } |
| 243 | -add_filter( 'wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1 ); |
|
| 243 | +add_filter('wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1); |
|
| 244 | 244 | |
| 245 | -function wpinv_gateway_header_callback( $args ) { |
|
| 246 | - echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr( $args['custom'] ) . '" />'; |
|
| 245 | +function wpinv_gateway_header_callback($args) { |
|
| 246 | + echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr($args['custom']) . '" />'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -254,60 +254,60 @@ discard block |
||
| 254 | 254 | * @return bool |
| 255 | 255 | * @since 2.3.0 |
| 256 | 256 | */ |
| 257 | -function getpaid_payment_gateway_supports( $gateway, $feature ) { |
|
| 257 | +function getpaid_payment_gateway_supports($gateway, $feature) { |
|
| 258 | 258 | |
| 259 | 259 | $supports = false; |
| 260 | 260 | |
| 261 | - $supports = apply_filters( "getpaid_{$gateway}_supports_{$feature}", false ); |
|
| 261 | + $supports = apply_filters("getpaid_{$gateway}_supports_{$feature}", false); |
|
| 262 | 262 | |
| 263 | 263 | // Backwards compatibility. |
| 264 | - $supports = apply_filters( "wpinv_{$gateway}_supports_{$feature}", $supports ); |
|
| 265 | - $supports = apply_filters( "wpinv_{$gateway}_support_{$feature}", $supports ); |
|
| 264 | + $supports = apply_filters("wpinv_{$gateway}_supports_{$feature}", $supports); |
|
| 265 | + $supports = apply_filters("wpinv_{$gateway}_support_{$feature}", $supports); |
|
| 266 | 266 | |
| 267 | - $supports = apply_filters( "getpaid_gateway_supports_{$feature}", $supports, $gateway ); |
|
| 268 | - $supports = apply_filters( 'getpaid_payment_gateway_supports', $supports, $feature, $gateway ); |
|
| 267 | + $supports = apply_filters("getpaid_gateway_supports_{$feature}", $supports, $gateway); |
|
| 268 | + $supports = apply_filters('getpaid_payment_gateway_supports', $supports, $feature, $gateway); |
|
| 269 | 269 | |
| 270 | 270 | return $supports; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | -function wpinv_get_chosen_gateway( $invoice_id = 0 ) { |
|
| 274 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 273 | +function wpinv_get_chosen_gateway($invoice_id = 0) { |
|
| 274 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
| 275 | 275 | |
| 276 | 276 | $chosen = false; |
| 277 | - if ( $invoice_id > 0 && $invoice = wpinv_get_invoice( $invoice_id ) ) { |
|
| 277 | + if ($invoice_id > 0 && $invoice = wpinv_get_invoice($invoice_id)) { |
|
| 278 | 278 | $chosen = $invoice->get_gateway(); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $chosen = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen; |
|
| 281 | + $chosen = isset($_REQUEST['payment-mode']) ? sanitize_text_field($_REQUEST['payment-mode']) : $chosen; |
|
| 282 | 282 | |
| 283 | - if ( false !== $chosen ) { |
|
| 284 | - $chosen = preg_replace( '/[^a-zA-Z0-9-_]+/', '', $chosen ); |
|
| 283 | + if (false !== $chosen) { |
|
| 284 | + $chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if ( ! empty( $chosen ) ) { |
|
| 288 | - $enabled_gateway = urldecode( $chosen ); |
|
| 289 | - } elseif ( ! empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) { |
|
| 287 | + if (!empty($chosen)) { |
|
| 288 | + $enabled_gateway = urldecode($chosen); |
|
| 289 | + } elseif (!empty($invoice) && (float) $invoice->get_subtotal() <= 0) { |
|
| 290 | 290 | $enabled_gateway = 'manual'; |
| 291 | 291 | } else { |
| 292 | 292 | $enabled_gateway = wpinv_get_default_gateway(); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if ( ! wpinv_is_gateway_active( $enabled_gateway ) && ! empty( $gateways ) ) { |
|
| 296 | - if ( wpinv_is_gateway_active( wpinv_get_default_gateway() ) ) { |
|
| 295 | + if (!wpinv_is_gateway_active($enabled_gateway) && !empty($gateways)) { |
|
| 296 | + if (wpinv_is_gateway_active(wpinv_get_default_gateway())) { |
|
| 297 | 297 | $enabled_gateway = wpinv_get_default_gateway(); |
| 298 | 298 | } else { |
| 299 | 299 | $enabled_gateway = $gateways[0]; |
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway ); |
|
| 303 | + return apply_filters('wpinv_chosen_gateway', $enabled_gateway); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | -function wpinv_record_gateway_error( $title = '', $message = '' ) { |
|
| 307 | - return wpinv_error_log( $message, $title ); |
|
| 306 | +function wpinv_record_gateway_error($title = '', $message = '') { |
|
| 307 | + return wpinv_error_log($message, $title); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | -function wpinv_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
| 310 | +function wpinv_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
| 311 | 311 | $ret = 0; |
| 312 | 312 | $args = array( |
| 313 | 313 | 'meta_key' => '_wpinv_gateway', |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | 'fields' => 'ids', |
| 319 | 319 | ); |
| 320 | 320 | |
| 321 | - $payments = new WP_Query( $args ); |
|
| 321 | + $payments = new WP_Query($args); |
|
| 322 | 322 | |
| 323 | - if ( $payments ) { |
|
| 323 | + if ($payments) { |
|
| 324 | 324 | $ret = $payments->post_count; |
| 325 | 325 | } |
| 326 | 326 | return $ret; |
@@ -329,11 +329,11 @@ discard block |
||
| 329 | 329 | /** |
| 330 | 330 | * Displays the ipn url field. |
| 331 | 331 | */ |
| 332 | -function wpinv_ipn_url_callback( $args ) { |
|
| 333 | - $sanitize_id = esc_attr( wpinv_sanitize_key( $args['id'] ) ); |
|
| 332 | +function wpinv_ipn_url_callback($args) { |
|
| 333 | + $sanitize_id = esc_attr(wpinv_sanitize_key($args['id'])); |
|
| 334 | 334 | |
| 335 | - echo '<input class="regular-text" type="text" ' . ( $args['readonly'] ? ' readonly' : '' ) . ' value="' . esc_attr( $args['std'] ) . '" name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" onClick="this.select()">'; |
|
| 336 | - echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']">' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 335 | + echo '<input class="regular-text" type="text" ' . ($args['readonly'] ? ' readonly' : '') . ' value="' . esc_attr($args['std']) . '" name="wpinv_settings[' . esc_attr($sanitize_id) . ']" id="wpinv_settings[' . esc_attr($sanitize_id) . ']" onClick="this.select()">'; |
|
| 336 | + echo '<label for="wpinv_settings[' . esc_attr($sanitize_id) . ']">' . wp_kses_post($args['desc']) . '</label>'; |
|
| 337 | 337 | |
| 338 | 338 | } |
| 339 | 339 | |
@@ -344,10 +344,10 @@ discard block |
||
| 344 | 344 | * |
| 345 | 345 | * @return bool |
| 346 | 346 | */ |
| 347 | -function wpinv_is_test_mode( $gateway = '' ) { |
|
| 348 | - $sandbox = empty( $gateway ) ? false : wpinv_get_option( "{$gateway}_sandbox", true ); |
|
| 349 | - $supports = getpaid_payment_gateway_supports( $gateway, 'sandbox' ); |
|
| 350 | - return apply_filters( 'wpinv_is_test_mode', $sandbox && $supports, $gateway ); |
|
| 347 | +function wpinv_is_test_mode($gateway = '') { |
|
| 348 | + $sandbox = empty($gateway) ? false : wpinv_get_option("{$gateway}_sandbox", true); |
|
| 349 | + $supports = getpaid_payment_gateway_supports($gateway, 'sandbox'); |
|
| 350 | + return apply_filters('wpinv_is_test_mode', $sandbox && $supports, $gateway); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @return string |
| 360 | 360 | */ |
| 361 | -function wpinv_get_ipn_url( $gateway = false, $args = array() ) { |
|
| 361 | +function wpinv_get_ipn_url($gateway = false, $args = array()) { |
|
| 362 | 362 | $args = wp_parse_args( |
| 363 | 363 | array( |
| 364 | 364 | 'wpi-listener' => 'IPN', |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $args |
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - return apply_filters( 'wpinv_ipn_url', add_query_arg( $args, home_url( 'index.php' ) ), $gateway, $args ); |
|
| 370 | + return apply_filters('wpinv_ipn_url', add_query_arg($args, home_url('index.php')), $gateway, $args); |
|
| 371 | 371 | |
| 372 | 372 | } |
| 373 | 373 | |
@@ -378,34 +378,34 @@ discard block |
||
| 378 | 378 | * |
| 379 | 379 | * @return string |
| 380 | 380 | */ |
| 381 | -function getpaid_get_non_query_string_ipn_url( $gateway ) { |
|
| 382 | - $gateway = wpinv_sanitize_key( $gateway ); |
|
| 383 | - return home_url( "getpaid-ipn/$gateway" ); |
|
| 381 | +function getpaid_get_non_query_string_ipn_url($gateway) { |
|
| 382 | + $gateway = wpinv_sanitize_key($gateway); |
|
| 383 | + return home_url("getpaid-ipn/$gateway"); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
| 387 | 387 | /** |
| 388 | 388 | * Retrieves request data with slashes removed slashes. |
| 389 | 389 | */ |
| 390 | -function wpinv_get_post_data( $method = 'request' ) { |
|
| 390 | +function wpinv_get_post_data($method = 'request') { |
|
| 391 | 391 | |
| 392 | - if ( $method == 'post' ) { |
|
| 393 | - return wp_kses_post_deep( wp_unslash( $_POST ) ); |
|
| 392 | + if ($method == 'post') { |
|
| 393 | + return wp_kses_post_deep(wp_unslash($_POST)); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - if ( $method == 'get' ) { |
|
| 397 | - return wp_kses_post_deep( wp_unslash( $_GET ) ); |
|
| 396 | + if ($method == 'get') { |
|
| 397 | + return wp_kses_post_deep(wp_unslash($_GET)); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - return wp_kses_post_deep( wp_unslash( $_REQUEST ) ); |
|
| 400 | + return wp_kses_post_deep(wp_unslash($_REQUEST)); |
|
| 401 | 401 | |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /** |
| 405 | 405 | * Checks if a given gateway supports subscription payments. |
| 406 | 406 | */ |
| 407 | -function wpinv_gateway_support_subscription( $gateway ) { |
|
| 408 | - return getpaid_payment_gateway_supports( $gateway, 'subscription' ); |
|
| 407 | +function wpinv_gateway_support_subscription($gateway) { |
|
| 408 | + return getpaid_payment_gateway_supports($gateway, 'subscription'); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -414,18 +414,18 @@ discard block |
||
| 414 | 414 | * @param array $gateways an array of gateways. |
| 415 | 415 | * @param GetPaid_Payment_Form $form payment form. |
| 416 | 416 | */ |
| 417 | -function wpinv_payment_gateways_on_cart( $gateways, $form ) { |
|
| 417 | +function wpinv_payment_gateways_on_cart($gateways, $form) { |
|
| 418 | 418 | |
| 419 | - if ( $form->is_recurring() ) { |
|
| 419 | + if ($form->is_recurring()) { |
|
| 420 | 420 | |
| 421 | - foreach ( array_keys( $gateways ) as $gateway ) { |
|
| 421 | + foreach (array_keys($gateways) as $gateway) { |
|
| 422 | 422 | |
| 423 | - if ( ! wpinv_gateway_support_subscription( $gateway ) ) { |
|
| 424 | - unset( $gateways[ $gateway ] ); |
|
| 423 | + if (!wpinv_gateway_support_subscription($gateway)) { |
|
| 424 | + unset($gateways[$gateway]); |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | return $gateways; |
| 430 | 430 | } |
| 431 | -add_filter( 'getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2 ); |
|
| 431 | +add_filter('getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2); |
|
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * Please use GetPaid_Notification_Email_Sender |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |-------------------------------------------------------------------------- |
@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Generates the email header. |
| 19 | 19 | */ |
| 20 | -function wpinv_email_header( $email_heading ) { |
|
| 21 | - wpinv_get_template( 'emails/wpinv-email-header.php', compact( 'email_heading' ) ); |
|
| 20 | +function wpinv_email_header($email_heading) { |
|
| 21 | + wpinv_get_template('emails/wpinv-email-header.php', compact('email_heading')); |
|
| 22 | 22 | } |
| 23 | -add_action( 'wpinv_email_header', 'wpinv_email_header' ); |
|
| 23 | +add_action('wpinv_email_header', 'wpinv_email_header'); |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Generates the email footer. |
| 28 | 28 | */ |
| 29 | 29 | function wpinv_email_footer() { |
| 30 | - wpinv_get_template( 'emails/wpinv-email-footer.php' ); |
|
| 30 | + wpinv_get_template('emails/wpinv-email-footer.php'); |
|
| 31 | 31 | } |
| 32 | -add_action( 'wpinv_email_footer', 'wpinv_email_footer' ); |
|
| 32 | +add_action('wpinv_email_footer', 'wpinv_email_footer'); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | * @param string $email_type |
| 40 | 40 | * @param bool $sent_to_admin |
| 41 | 41 | */ |
| 42 | -function wpinv_email_invoice_details( $invoice, $email_type, $sent_to_admin ) { |
|
| 42 | +function wpinv_email_invoice_details($invoice, $email_type, $sent_to_admin) { |
|
| 43 | 43 | |
| 44 | - $args = compact( 'invoice', 'email_type', 'sent_to_admin' ); |
|
| 45 | - wpinv_get_template( 'emails/invoice-details.php', $args ); |
|
| 44 | + $args = compact('invoice', 'email_type', 'sent_to_admin'); |
|
| 45 | + wpinv_get_template('emails/invoice-details.php', $args); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | -add_action( 'wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3 ); |
|
| 48 | +add_action('wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Display line items in emails. |
@@ -54,17 +54,17 @@ discard block |
||
| 54 | 54 | * @param string $email_type |
| 55 | 55 | * @param bool $sent_to_admin |
| 56 | 56 | */ |
| 57 | -function wpinv_email_invoice_items( $invoice, $email_type, $sent_to_admin ) { |
|
| 57 | +function wpinv_email_invoice_items($invoice, $email_type, $sent_to_admin) { |
|
| 58 | 58 | |
| 59 | 59 | // Prepare line items. |
| 60 | - $columns = getpaid_invoice_item_columns( $invoice ); |
|
| 61 | - $columns = apply_filters( 'getpaid_invoice_line_items_table_columns', $columns, $invoice ); |
|
| 60 | + $columns = getpaid_invoice_item_columns($invoice); |
|
| 61 | + $columns = apply_filters('getpaid_invoice_line_items_table_columns', $columns, $invoice); |
|
| 62 | 62 | |
| 63 | 63 | // Load the template. |
| 64 | - wpinv_get_template( 'emails/invoice-items.php', compact( 'invoice', 'columns', 'email_type', 'sent_to_admin' ) ); |
|
| 64 | + wpinv_get_template('emails/invoice-items.php', compact('invoice', 'columns', 'email_type', 'sent_to_admin')); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | -add_action( 'wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3 ); |
|
| 67 | +add_action('wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | * @param string $email_type |
| 75 | 75 | * @param bool $sent_to_admin |
| 76 | 76 | */ |
| 77 | -function wpinv_email_billing_details( $invoice, $email_type, $sent_to_admin ) { |
|
| 77 | +function wpinv_email_billing_details($invoice, $email_type, $sent_to_admin) { |
|
| 78 | 78 | |
| 79 | - $args = compact( 'invoice', 'email_type', 'sent_to_admin' ); |
|
| 80 | - wpinv_get_template( 'emails/wpinv-email-billing-details.php', $args ); |
|
| 79 | + $args = compact('invoice', 'email_type', 'sent_to_admin'); |
|
| 80 | + wpinv_get_template('emails/wpinv-email-billing-details.php', $args); |
|
| 81 | 81 | |
| 82 | 82 | } |
| 83 | -add_action( 'wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3 ); |
|
| 83 | +add_action('wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Returns email css. |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | function getpaid_get_email_css() { |
| 90 | 90 | |
| 91 | - $css = wpinv_get_template_html( 'emails/wpinv-email-styles.php' ); |
|
| 92 | - return apply_filters( 'wpinv_email_styles', $css ); |
|
| 91 | + $css = wpinv_get_template_html('emails/wpinv-email-styles.php'); |
|
| 92 | + return apply_filters('wpinv_email_styles', $css); |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -100,26 +100,26 @@ discard block |
||
| 100 | 100 | * @return string |
| 101 | 101 | * |
| 102 | 102 | */ |
| 103 | -function wpinv_email_style_body( $content ) { |
|
| 103 | +function wpinv_email_style_body($content) { |
|
| 104 | 104 | |
| 105 | - if ( ! class_exists( 'DOMDocument' ) ) { |
|
| 105 | + if (!class_exists('DOMDocument')) { |
|
| 106 | 106 | return $content; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $css = getpaid_get_email_css(); |
| 110 | 110 | |
| 111 | 111 | // include css inliner |
| 112 | - if ( ! class_exists( 'Emogrifier' ) ) { |
|
| 112 | + if (!class_exists('Emogrifier')) { |
|
| 113 | 113 | include_once WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php'; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Inline the css. |
| 117 | 117 | try { |
| 118 | - $emogrifier = new Emogrifier( $content, $css ); |
|
| 118 | + $emogrifier = new Emogrifier($content, $css); |
|
| 119 | 119 | $_content = $emogrifier->emogrify(); |
| 120 | 120 | $content = $_content; |
| 121 | - } catch ( Exception $e ) { |
|
| 122 | - wpinv_error_log( $e->getMessage(), 'emogrifier' ); |
|
| 121 | + } catch (Exception $e) { |
|
| 122 | + wpinv_error_log($e->getMessage(), 'emogrifier'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $content; |
@@ -128,37 +128,37 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // Backwards compatibility. |
| 130 | 130 | function wpinv_init_transactional_emails() { |
| 131 | - foreach ( apply_filters( 'wpinv_email_actions', array() ) as $action ) { |
|
| 132 | - add_action( $action, 'wpinv_send_transactional_email', 10, 10 ); |
|
| 131 | + foreach (apply_filters('wpinv_email_actions', array()) as $action) { |
|
| 132 | + add_action($action, 'wpinv_send_transactional_email', 10, 10); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | -add_action( 'init', 'wpinv_init_transactional_emails' ); |
|
| 135 | +add_action('init', 'wpinv_init_transactional_emails'); |
|
| 136 | 136 | |
| 137 | 137 | function wpinv_send_transactional_email() { |
| 138 | 138 | $args = func_get_args(); |
| 139 | 139 | $function = current_filter() . '_notification'; |
| 140 | - do_action_ref_array( $function, $args ); |
|
| 140 | + do_action_ref_array($function, $args); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | function wpinv_mail_get_from_address() { |
| 144 | - $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from', get_option( 'admin_email' ) ) ); |
|
| 145 | - return sanitize_email( $from_address ); |
|
| 144 | + $from_address = apply_filters('wpinv_mail_from_address', wpinv_get_option('email_from', get_option('admin_email'))); |
|
| 145 | + return sanitize_email($from_address); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | function wpinv_mail_get_from_name() { |
| 149 | - $from_name = apply_filters( 'wpinv_mail_from_name', wpinv_get_option( 'email_from_name', get_bloginfo( 'name', 'display' ) ) ); |
|
| 150 | - return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES ); |
|
| 149 | + $from_name = apply_filters('wpinv_mail_from_name', wpinv_get_option('email_from_name', get_bloginfo('name', 'display'))); |
|
| 150 | + return wp_specialchars_decode(esc_html($from_name), ENT_QUOTES); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | -function wpinv_mail_admin_bcc_active( $mail_type = '' ) { |
|
| 154 | - $active = apply_filters( 'wpinv_mail_admin_bcc_active', wpinv_get_option( 'email_' . $mail_type . '_admin_bcc' ) ); |
|
| 155 | - return ( $active ? true : false ); |
|
| 153 | +function wpinv_mail_admin_bcc_active($mail_type = '') { |
|
| 154 | + $active = apply_filters('wpinv_mail_admin_bcc_active', wpinv_get_option('email_' . $mail_type . '_admin_bcc')); |
|
| 155 | + return ($active ? true : false); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | -function wpinv_mail_get_content_type( $content_type = 'text/html', $email_type = 'html' ) { |
|
| 159 | - $email_type = apply_filters( 'wpinv_mail_content_type', $email_type ); |
|
| 158 | +function wpinv_mail_get_content_type($content_type = 'text/html', $email_type = 'html') { |
|
| 159 | + $email_type = apply_filters('wpinv_mail_content_type', $email_type); |
|
| 160 | 160 | |
| 161 | - switch ( $email_type ) { |
|
| 161 | + switch ($email_type) { |
|
| 162 | 162 | case 'html': |
| 163 | 163 | $content_type = 'text/html'; |
| 164 | 164 | break; |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | * @param array $attachments Any files to attach to the email. |
| 184 | 184 | * @param string|array $cc An email or array of extra emails to send a copy of the email to. |
| 185 | 185 | */ |
| 186 | -function wpinv_mail_send( $to, $subject, $message, $deprecated, $attachments = array(), $cc = array() ) { |
|
| 186 | +function wpinv_mail_send($to, $subject, $message, $deprecated, $attachments = array(), $cc = array()) { |
|
| 187 | 187 | |
| 188 | 188 | $mailer = new GetPaid_Notification_Email_Sender(); |
| 189 | - $message = wpinv_email_style_body( $message ); |
|
| 190 | - $to = array_merge( wpinv_parse_list( $to ), wpinv_parse_list( $cc ) ); |
|
| 189 | + $message = wpinv_email_style_body($message); |
|
| 190 | + $to = array_merge(wpinv_parse_list($to), wpinv_parse_list($cc)); |
|
| 191 | 191 | |
| 192 | 192 | return $mailer->send( |
| 193 | 193 | $to, |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return array |
| 205 | 205 | */ |
| 206 | 206 | function wpinv_get_emails() { |
| 207 | - return apply_filters( 'wpinv_get_emails', wpinv_get_data( 'email-settings' ) ); |
|
| 207 | + return apply_filters('wpinv_get_emails', wpinv_get_data('email-settings')); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -213,172 +213,172 @@ discard block |
||
| 213 | 213 | * @param array $settings |
| 214 | 214 | * @return array |
| 215 | 215 | */ |
| 216 | -function wpinv_settings_emails( $settings = array() ) { |
|
| 217 | - $settings = array_merge( $settings, wpinv_get_emails() ); |
|
| 218 | - return apply_filters( 'wpinv_settings_get_emails', $settings ); |
|
| 216 | +function wpinv_settings_emails($settings = array()) { |
|
| 217 | + $settings = array_merge($settings, wpinv_get_emails()); |
|
| 218 | + return apply_filters('wpinv_settings_get_emails', $settings); |
|
| 219 | 219 | } |
| 220 | -add_filter( 'wpinv_settings_emails', 'wpinv_settings_emails', 10, 1 ); |
|
| 220 | +add_filter('wpinv_settings_emails', 'wpinv_settings_emails', 10, 1); |
|
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Filter email section names. |
| 224 | 224 | * |
| 225 | 225 | */ |
| 226 | -function wpinv_settings_sections_emails( $settings ) { |
|
| 227 | - foreach ( wpinv_get_emails() as $key => $email ) { |
|
| 228 | - $settings[ $key ] = ! empty( $email[ 'email_' . $key . '_header' ]['name'] ) ? strip_tags( $email[ 'email_' . $key . '_header' ]['name'] ) : strip_tags( $key ); |
|
| 226 | +function wpinv_settings_sections_emails($settings) { |
|
| 227 | + foreach (wpinv_get_emails() as $key => $email) { |
|
| 228 | + $settings[$key] = !empty($email['email_' . $key . '_header']['name']) ? strip_tags($email['email_' . $key . '_header']['name']) : strip_tags($key); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | return $settings; |
| 232 | 232 | } |
| 233 | -add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
|
| 233 | +add_filter('wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1); |
|
| 234 | 234 | |
| 235 | -function wpinv_email_is_enabled( $email_type ) { |
|
| 235 | +function wpinv_email_is_enabled($email_type) { |
|
| 236 | 236 | $emails = wpinv_get_emails(); |
| 237 | - $enabled = isset( $emails[ $email_type ] ) && wpinv_get_option( 'email_' . $email_type . '_active', 0 ) ? true : false; |
|
| 237 | + $enabled = isset($emails[$email_type]) && wpinv_get_option('email_' . $email_type . '_active', 0) ? true : false; |
|
| 238 | 238 | |
| 239 | - return apply_filters( 'wpinv_email_is_enabled', $enabled, $email_type ); |
|
| 239 | + return apply_filters('wpinv_email_is_enabled', $enabled, $email_type); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | -function wpinv_email_get_recipient( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 243 | - switch ( $email_type ) { |
|
| 242 | +function wpinv_email_get_recipient($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 243 | + switch ($email_type) { |
|
| 244 | 244 | case 'new_invoice': |
| 245 | 245 | case 'cancelled_invoice': |
| 246 | 246 | case 'failed_invoice': |
| 247 | 247 | $recipient = wpinv_get_admin_email(); |
| 248 | 248 | break; |
| 249 | 249 | default: |
| 250 | - $invoice = ! empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : null ); |
|
| 251 | - $recipient = ! empty( $invoice ) ? $invoice->get_email() : ''; |
|
| 250 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : null); |
|
| 251 | + $recipient = !empty($invoice) ? $invoice->get_email() : ''; |
|
| 252 | 252 | break; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - return apply_filters( 'wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice ); |
|
| 255 | + return apply_filters('wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Returns invoice CC recipients |
| 260 | 260 | */ |
| 261 | -function wpinv_email_get_cc_recipients( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 262 | - switch ( $email_type ) { |
|
| 261 | +function wpinv_email_get_cc_recipients($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 262 | + switch ($email_type) { |
|
| 263 | 263 | case 'new_invoice': |
| 264 | 264 | case 'cancelled_invoice': |
| 265 | 265 | case 'failed_invoice': |
| 266 | 266 | return array(); |
| 267 | 267 | break; |
| 268 | 268 | default: |
| 269 | - $invoice = ! empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : null ); |
|
| 270 | - $recipient = empty( $invoice ) ? '' : get_post_meta( $invoice->ID, 'wpinv_email_cc', true ); |
|
| 271 | - if ( empty( $recipient ) ) { |
|
| 269 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : null); |
|
| 270 | + $recipient = empty($invoice) ? '' : get_post_meta($invoice->ID, 'wpinv_email_cc', true); |
|
| 271 | + if (empty($recipient)) { |
|
| 272 | 272 | return array(); |
| 273 | 273 | } |
| 274 | - return array_filter( array_map( 'trim', explode( ',', $recipient ) ) ); |
|
| 274 | + return array_filter(array_map('trim', explode(',', $recipient))); |
|
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | -function wpinv_email_get_subject( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 281 | - $subject = wpinv_get_option( 'email_' . $email_type . '_subject' ); |
|
| 282 | - $subject = __( $subject, 'invoicing' ); |
|
| 280 | +function wpinv_email_get_subject($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 281 | + $subject = wpinv_get_option('email_' . $email_type . '_subject'); |
|
| 282 | + $subject = __($subject, 'invoicing'); |
|
| 283 | 283 | |
| 284 | - $subject = wpinv_email_format_text( $subject, $invoice ); |
|
| 284 | + $subject = wpinv_email_format_text($subject, $invoice); |
|
| 285 | 285 | |
| 286 | - return apply_filters( 'wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice ); |
|
| 286 | + return apply_filters('wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | -function wpinv_email_get_heading( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 290 | - $email_heading = wpinv_get_option( 'email_' . $email_type . '_heading' ); |
|
| 291 | - $email_heading = __( $email_heading, 'invoicing' ); |
|
| 289 | +function wpinv_email_get_heading($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 290 | + $email_heading = wpinv_get_option('email_' . $email_type . '_heading'); |
|
| 291 | + $email_heading = __($email_heading, 'invoicing'); |
|
| 292 | 292 | |
| 293 | - $email_heading = wpinv_email_format_text( $email_heading, $invoice ); |
|
| 293 | + $email_heading = wpinv_email_format_text($email_heading, $invoice); |
|
| 294 | 294 | |
| 295 | - return apply_filters( 'wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice ); |
|
| 295 | + return apply_filters('wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | -function wpinv_email_get_content( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 299 | - $content = wpinv_get_option( 'email_' . $email_type . '_body' ); |
|
| 300 | - $content = __( $content, 'invoicing' ); |
|
| 298 | +function wpinv_email_get_content($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 299 | + $content = wpinv_get_option('email_' . $email_type . '_body'); |
|
| 300 | + $content = __($content, 'invoicing'); |
|
| 301 | 301 | |
| 302 | - $content = wpinv_email_format_text( $content, $invoice ); |
|
| 302 | + $content = wpinv_email_format_text($content, $invoice); |
|
| 303 | 303 | |
| 304 | - return apply_filters( 'wpinv_email_content', $content, $email_type, $invoice_id, $invoice ); |
|
| 304 | + return apply_filters('wpinv_email_content', $content, $email_type, $invoice_id, $invoice); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | -function wpinv_email_get_headers( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 307 | +function wpinv_email_get_headers($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 308 | 308 | $from_name = wpinv_mail_get_from_address(); |
| 309 | 309 | $from_email = wpinv_mail_get_from_address(); |
| 310 | 310 | |
| 311 | - $invoice = ! empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : null ); |
|
| 311 | + $invoice = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : null); |
|
| 312 | 312 | |
| 313 | - $headers = 'From: ' . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
| 313 | + $headers = 'From: ' . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <$from_email>\r\n"; |
|
| 314 | 314 | $headers .= 'Reply-To: ' . $from_email . "\r\n"; |
| 315 | 315 | $headers .= 'Content-Type: ' . wpinv_mail_get_content_type() . "\r\n"; |
| 316 | 316 | |
| 317 | - return apply_filters( 'wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice ); |
|
| 317 | + return apply_filters('wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | -function wpinv_email_get_attachments( $email_type = '', $invoice_id = 0, $invoice = array() ) { |
|
| 320 | +function wpinv_email_get_attachments($email_type = '', $invoice_id = 0, $invoice = array()) { |
|
| 321 | 321 | $attachments = array(); |
| 322 | 322 | |
| 323 | - return apply_filters( 'wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice ); |
|
| 323 | + return apply_filters('wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
| 327 | 327 | * Searches for and replaces certain placeholders in an email. |
| 328 | 328 | */ |
| 329 | -function wpinv_email_format_text( $content, $invoice ) { |
|
| 329 | +function wpinv_email_format_text($content, $invoice) { |
|
| 330 | 330 | |
| 331 | 331 | $replace_array = array( |
| 332 | 332 | '{site_title}' => wpinv_get_blogname(), |
| 333 | - '{date}' => getpaid_format_date( current_time( 'mysql' ) ), |
|
| 333 | + '{date}' => getpaid_format_date(current_time('mysql')), |
|
| 334 | 334 | ); |
| 335 | 335 | |
| 336 | - $invoice = new WPInv_Invoice( $invoice ); |
|
| 336 | + $invoice = new WPInv_Invoice($invoice); |
|
| 337 | 337 | |
| 338 | - if ( $invoice->get_id() ) { |
|
| 338 | + if ($invoice->get_id()) { |
|
| 339 | 339 | |
| 340 | 340 | $replace_array = array_merge( |
| 341 | 341 | $replace_array, |
| 342 | 342 | array( |
| 343 | - '{name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
| 344 | - '{full_name}' => sanitize_text_field( $invoice->get_user_full_name() ), |
|
| 345 | - '{first_name}' => sanitize_text_field( $invoice->get_first_name() ), |
|
| 346 | - '{last_name}' => sanitize_text_field( $invoice->get_last_name() ), |
|
| 347 | - '{email}' => sanitize_email( $invoice->get_email() ), |
|
| 348 | - '{invoice_number}' => sanitize_text_field( $invoice->get_number() ), |
|
| 349 | - '{invoice_total}' => sanitize_text_field( wpinv_price( $invoice->get_total( true ), $invoice->get_currency() ) ), |
|
| 350 | - '{invoice_link}' => esc_url( $invoice->get_view_url() ), |
|
| 351 | - '{invoice_pay_link}' => esc_url( $invoice->get_checkout_payment_url() ), |
|
| 352 | - '{invoice_date}' => date( get_option( 'date_format' ), strtotime( $invoice->get_date_created(), current_time( 'timestamp' ) ) ), |
|
| 353 | - '{invoice_due_date}' => date( get_option( 'date_format' ), strtotime( $invoice->get_due_date(), current_time( 'timestamp' ) ) ), |
|
| 354 | - '{invoice_quote}' => sanitize_text_field( $invoice->get_invoice_quote_type() ), |
|
| 355 | - '{invoice_label}' => sanitize_text_field( ucfirst( $invoice->get_invoice_quote_type() ) ), |
|
| 356 | - '{is_was}' => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ), |
|
| 343 | + '{name}' => sanitize_text_field($invoice->get_user_full_name()), |
|
| 344 | + '{full_name}' => sanitize_text_field($invoice->get_user_full_name()), |
|
| 345 | + '{first_name}' => sanitize_text_field($invoice->get_first_name()), |
|
| 346 | + '{last_name}' => sanitize_text_field($invoice->get_last_name()), |
|
| 347 | + '{email}' => sanitize_email($invoice->get_email()), |
|
| 348 | + '{invoice_number}' => sanitize_text_field($invoice->get_number()), |
|
| 349 | + '{invoice_total}' => sanitize_text_field(wpinv_price($invoice->get_total(true), $invoice->get_currency())), |
|
| 350 | + '{invoice_link}' => esc_url($invoice->get_view_url()), |
|
| 351 | + '{invoice_pay_link}' => esc_url($invoice->get_checkout_payment_url()), |
|
| 352 | + '{invoice_date}' => date(get_option('date_format'), strtotime($invoice->get_date_created(), current_time('timestamp'))), |
|
| 353 | + '{invoice_due_date}' => date(get_option('date_format'), strtotime($invoice->get_due_date(), current_time('timestamp'))), |
|
| 354 | + '{invoice_quote}' => sanitize_text_field($invoice->get_invoice_quote_type()), |
|
| 355 | + '{invoice_label}' => sanitize_text_field(ucfirst($invoice->get_invoice_quote_type())), |
|
| 356 | + '{is_was}' => strtotime($invoice->get_due_date()) < current_time('timestamp') ? __('was', 'invoicing') : __('is', 'invoicing'), |
|
| 357 | 357 | ) |
| 358 | 358 | ); |
| 359 | 359 | |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | // Let third party plugins filter the arra. |
| 363 | - $replace_array = apply_filters( 'wpinv_email_format_text', $replace_array, $content, $invoice ); |
|
| 363 | + $replace_array = apply_filters('wpinv_email_format_text', $replace_array, $content, $invoice); |
|
| 364 | 364 | |
| 365 | - foreach ( $replace_array as $key => $value ) { |
|
| 366 | - $content = str_replace( $key, $value, $content ); |
|
| 365 | + foreach ($replace_array as $key => $value) { |
|
| 366 | + $content = str_replace($key, $value, $content); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - return apply_filters( 'wpinv_email_content_replace', $content ); |
|
| 369 | + return apply_filters('wpinv_email_content_replace', $content); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | |
| 373 | -function wpinv_email_wrap_message( $message ) { |
|
| 373 | +function wpinv_email_wrap_message($message) { |
|
| 374 | 374 | // Buffer |
| 375 | 375 | ob_start(); |
| 376 | 376 | |
| 377 | - do_action( 'wpinv_email_header' ); |
|
| 377 | + do_action('wpinv_email_header'); |
|
| 378 | 378 | |
| 379 | - echo wp_kses_post( wpautop( wptexturize( $message ) ) ); |
|
| 379 | + echo wp_kses_post(wpautop(wptexturize($message))); |
|
| 380 | 380 | |
| 381 | - do_action( 'wpinv_email_footer' ); |
|
| 381 | + do_action('wpinv_email_footer'); |
|
| 382 | 382 | |
| 383 | 383 | // Get contents |
| 384 | 384 | $message = ob_get_clean(); |
@@ -386,21 +386,21 @@ discard block |
||
| 386 | 386 | return $message; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | -function wpinv_add_notes_to_invoice_email( $invoice, $email_type ) { |
|
| 390 | - if ( ! empty( $invoice ) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes( $invoice->get_id(), true ) ) { |
|
| 391 | - $date_format = get_option( 'date_format' ); |
|
| 392 | - $time_format = get_option( 'time_format' ); |
|
| 389 | +function wpinv_add_notes_to_invoice_email($invoice, $email_type) { |
|
| 390 | + if (!empty($invoice) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes($invoice->get_id(), true)) { |
|
| 391 | + $date_format = get_option('date_format'); |
|
| 392 | + $time_format = get_option('time_format'); |
|
| 393 | 393 | ?> |
| 394 | 394 | <div id="wpinv-email-notes"> |
| 395 | - <h3 class="wpinv-notes-t"><?php echo esc_html( apply_filters( 'wpinv_email_invoice_notes_title', __( 'Invoice Notes', 'invoicing' ) ) ); ?></h3> |
|
| 395 | + <h3 class="wpinv-notes-t"><?php echo esc_html(apply_filters('wpinv_email_invoice_notes_title', __('Invoice Notes', 'invoicing'))); ?></h3> |
|
| 396 | 396 | <ol class="wpinv-notes-lists"> |
| 397 | 397 | <?php |
| 398 | - foreach ( $invoice_notes as $note ) { |
|
| 399 | - $note_time = strtotime( $note->comment_date ); |
|
| 398 | + foreach ($invoice_notes as $note) { |
|
| 399 | + $note_time = strtotime($note->comment_date); |
|
| 400 | 400 | ?> |
| 401 | 401 | <li class="comment wpinv-note"> |
| 402 | - <p class="wpinv-note-date meta"><?php printf( esc_html__( '%2$s at %3$s', 'invoicing' ), esc_html( $note->comment_author ), esc_html( date_i18n( $date_format, $note_time ) ), esc_html( date_i18n( $time_format, $note_time ) ), esc_html( $note_time ) ); ?></p> |
|
| 403 | - <div class="wpinv-note-desc description"><?php echo wp_kses_post( wpautop( wptexturize( $note->comment_content ) ) ); ?></div> |
|
| 402 | + <p class="wpinv-note-date meta"><?php printf(esc_html__('%2$s at %3$s', 'invoicing'), esc_html($note->comment_author), esc_html(date_i18n($date_format, $note_time)), esc_html(date_i18n($time_format, $note_time)), esc_html($note_time)); ?></p> |
|
| 403 | + <div class="wpinv-note-desc description"><?php echo wp_kses_post(wpautop(wptexturize($note->comment_content))); ?></div> |
|
| 404 | 404 | </li> |
| 405 | 405 | <?php |
| 406 | 406 | } |
@@ -410,4 +410,4 @@ discard block |
||
| 410 | 410 | <?php |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | -add_action( 'wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3 ); |
|
| 413 | +add_action('wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3); |
|
@@ -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,13 +21,13 @@ 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 ); |
|
| 27 | + $invoice = new WPInv_Invoice($post); |
|
| 28 | 28 | |
| 29 | 29 | // Nonce field. |
| 30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ; |
|
| 30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | ?> |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | <div class="bsui" style="margin-top: 1.5rem"> |
| 48 | 48 | |
| 49 | - <?php do_action( 'getpaid_invoice_edit_before_viewed_by_customer', $invoice ); ?> |
|
| 50 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
| 49 | + <?php do_action('getpaid_invoice_edit_before_viewed_by_customer', $invoice); ?> |
|
| 50 | + <?php if (!$invoice->is_draft()) : ?> |
|
| 51 | 51 | <div class="form-group"> |
| 52 | - <strong><?php esc_html_e( 'Viewed by Customer:', 'invoicing' );?></strong> |
|
| 53 | - <?php ( $invoice->get_is_viewed() ) ? esc_html_e( 'Yes', 'invoicing' ) : esc_html_e( 'No', 'invoicing' ); ?> |
|
| 52 | + <strong><?php esc_html_e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
| 53 | + <?php ($invoice->get_is_viewed()) ? esc_html_e('Yes', 'invoicing') : esc_html_e('No', 'invoicing'); ?> |
|
| 54 | 54 | </div> |
| 55 | 55 | <?php endif; ?> |
| 56 | 56 | |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // Date created. |
| 60 | 60 | $label = sprintf( |
| 61 | - __( '%s Date:', 'invoicing' ), |
|
| 62 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 61 | + __('%s Date:', 'invoicing'), |
|
| 62 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 63 | 63 | ); |
| 64 | 64 | |
| 65 | - $info = sprintf( |
|
| 66 | - __( 'The date this %s was created.', 'invoicing' ), |
|
| 67 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
| 65 | + $info = sprintf( |
|
| 66 | + __('The date this %s was created.', 'invoicing'), |
|
| 67 | + strtolower($invoice->get_invoice_quote_type()) |
|
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | 70 | aui()->input( |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | 'type' => 'datepicker', |
| 73 | 73 | 'id' => 'wpinv_date_created', |
| 74 | 74 | 'name' => 'date_created', |
| 75 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
| 75 | + 'label' => $label . getpaid_get_help_tip($info), |
|
| 76 | 76 | 'label_type' => 'vertical', |
| 77 | 77 | 'placeholder' => 'YYYY-MM-DD 00:00', |
| 78 | 78 | 'class' => 'form-control-sm', |
| 79 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
| 79 | + 'value' => $invoice->get_date_created('edit'), |
|
| 80 | 80 | 'extra_attributes' => array( |
| 81 | 81 | 'data-enable-time' => 'true', |
| 82 | 82 | 'data-time_24hr' => 'true', |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | // Date paid. |
| 91 | - $date_paid = $invoice->get_date_completed( 'edit' ); |
|
| 92 | - if ( ! empty( $date_paid ) && $invoice->is_paid() ) { |
|
| 91 | + $date_paid = $invoice->get_date_completed('edit'); |
|
| 92 | + if (!empty($date_paid) && $invoice->is_paid()) { |
|
| 93 | 93 | |
| 94 | 94 | aui()->input( |
| 95 | 95 | array( |
| 96 | 96 | 'type' => 'text', |
| 97 | 97 | 'id' => 'wpinv_date_completed', |
| 98 | 98 | 'name' => 'wpinv_date_completed', |
| 99 | - 'label' => __( 'Date Completed:', 'invoicing' ), |
|
| 99 | + 'label' => __('Date Completed:', 'invoicing'), |
|
| 100 | 100 | 'label_type' => 'vertical', |
| 101 | 101 | 'class' => 'form-control-sm', |
| 102 | 102 | 'value' => $date_paid, |
@@ -107,18 +107,18 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Due date. |
| 110 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( ! $invoice->is_paid() || $invoice->is_draft() ) ) { |
|
| 110 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && (!$invoice->is_paid() || $invoice->is_draft())) { |
|
| 111 | 111 | |
| 112 | 112 | aui()->input( |
| 113 | 113 | array( |
| 114 | 114 | 'type' => 'datepicker', |
| 115 | 115 | 'id' => 'wpinv_due_date', |
| 116 | 116 | 'name' => 'wpinv_due_date', |
| 117 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
| 117 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
| 118 | 118 | 'label_type' => 'vertical', |
| 119 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
| 119 | + 'placeholder' => __('No due date', 'invoicing'), |
|
| 120 | 120 | 'class' => 'form-control-sm', |
| 121 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
| 121 | + 'value' => $invoice->get_due_date('edit'), |
|
| 122 | 122 | 'extra_attributes' => array( |
| 123 | 123 | 'data-enable-time' => 'true', |
| 124 | 124 | 'data-time_24hr' => 'true', |
@@ -131,40 +131,40 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
| 135 | - do_action( 'getpaid_metabox_after_due_date', $invoice ); |
|
| 134 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
| 135 | + do_action('getpaid_metabox_after_due_date', $invoice); |
|
| 136 | 136 | |
| 137 | 137 | // Status. |
| 138 | 138 | $label = sprintf( |
| 139 | - __( '%s Status:', 'invoicing' ), |
|
| 140 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 139 | + __('%s Status:', 'invoicing'), |
|
| 140 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $status = $invoice->get_status( 'edit' ); |
|
| 143 | + $status = $invoice->get_status('edit'); |
|
| 144 | 144 | aui()->select( |
| 145 | 145 | array( |
| 146 | 146 | 'id' => 'wpinv_status', |
| 147 | 147 | 'name' => 'wpinv_status', |
| 148 | 148 | 'label' => $label, |
| 149 | 149 | 'label_type' => 'vertical', |
| 150 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
| 151 | - 'value' => array_key_exists( $status, $invoice->get_all_statuses() ) ? $status : $invoice->get_default_status(), |
|
| 150 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
| 151 | + 'value' => array_key_exists($status, $invoice->get_all_statuses()) ? $status : $invoice->get_default_status(), |
|
| 152 | 152 | 'select2' => true, |
| 153 | 153 | 'data-allow-clear' => 'false', |
| 154 | - 'options' => wpinv_get_invoice_statuses( true, false, $invoice ) |
|
| 154 | + 'options' => wpinv_get_invoice_statuses(true, false, $invoice) |
|
| 155 | 155 | ), |
| 156 | 156 | true |
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | // Invoice number. |
| 160 | 160 | $label = sprintf( |
| 161 | - __( '%s Number:', 'invoicing' ), |
|
| 162 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 161 | + __('%s Number:', 'invoicing'), |
|
| 162 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - $info = sprintf( |
|
| 166 | - __( 'Each %s number must be unique.', 'invoicing' ), |
|
| 167 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
| 165 | + $info = sprintf( |
|
| 166 | + __('Each %s number must be unique.', 'invoicing'), |
|
| 167 | + strtolower($invoice->get_invoice_quote_type()) |
|
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | 170 | aui()->input( |
@@ -172,11 +172,11 @@ discard block |
||
| 172 | 172 | 'type' => 'text', |
| 173 | 173 | 'id' => 'wpinv_number', |
| 174 | 174 | 'name' => 'wpinv_number', |
| 175 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
| 175 | + 'label' => $label . getpaid_get_help_tip($info), |
|
| 176 | 176 | 'label_type' => 'vertical', |
| 177 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
| 177 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
| 178 | 178 | 'class' => 'form-control-sm', |
| 179 | - 'value' => $invoice->get_number( 'edit' ), |
|
| 179 | + 'value' => $invoice->get_number('edit'), |
|
| 180 | 180 | ), |
| 181 | 181 | true |
| 182 | 182 | ); |
@@ -187,16 +187,16 @@ discard block |
||
| 187 | 187 | 'type' => 'text', |
| 188 | 188 | 'id' => 'wpinv_cc', |
| 189 | 189 | 'name' => 'wpinv_cc', |
| 190 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
| 190 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
| 191 | 191 | 'label_type' => 'vertical', |
| 192 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
| 192 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
| 193 | 193 | 'class' => 'form-control-sm', |
| 194 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
| 194 | + 'value' => $invoice->get_email_cc('edit'), |
|
| 195 | 195 | ), |
| 196 | 196 | true |
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
| 199 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
| 200 | 200 | |
| 201 | 201 | // Apply a discount. |
| 202 | 202 | aui()->input( |
@@ -204,26 +204,26 @@ discard block |
||
| 204 | 204 | 'type' => 'text', |
| 205 | 205 | 'id' => 'wpinv_discount_code', |
| 206 | 206 | 'name' => 'wpinv_discount_code', |
| 207 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
| 208 | - 'placeholder' => __( 'Apply Discount', 'invoicing' ), |
|
| 207 | + 'label' => __('Discount Code:', 'invoicing'), |
|
| 208 | + 'placeholder' => __('Apply Discount', 'invoicing'), |
|
| 209 | 209 | 'label_type' => 'vertical', |
| 210 | 210 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
| 211 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
| 211 | + 'value' => $invoice->get_discount_code('edit'), |
|
| 212 | 212 | ), |
| 213 | 213 | true |
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | - } else if ( $invoice->get_discount_code( 'edit' ) ) { |
|
| 216 | + } else if ($invoice->get_discount_code('edit')) { |
|
| 217 | 217 | |
| 218 | 218 | aui()->input( |
| 219 | 219 | array( |
| 220 | 220 | 'type' => 'text', |
| 221 | 221 | 'id' => 'wpinv_discount_code', |
| 222 | 222 | 'name' => 'wpinv_discount_code', |
| 223 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
| 223 | + 'label' => __('Discount Code:', 'invoicing'), |
|
| 224 | 224 | 'label_type' => 'vertical', |
| 225 | 225 | 'class' => 'form-control-sm', |
| 226 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
| 226 | + 'value' => $invoice->get_discount_code('edit'), |
|
| 227 | 227 | 'extra_attributes' => array( |
| 228 | 228 | 'onclick' => 'this.select();', |
| 229 | 229 | 'readonly' => 'true', |
@@ -234,17 +234,17 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
| 237 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
| 238 | 238 | |
| 239 | 239 | // Disable taxes. |
| 240 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
| 240 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
| 241 | 241 | |
| 242 | 242 | aui()->input( |
| 243 | 243 | array( |
| 244 | 244 | 'id' => 'wpinv_taxable', |
| 245 | 245 | 'name' => 'disable_taxes', |
| 246 | 246 | 'type' => 'checkbox', |
| 247 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
| 247 | + 'label' => __('Disable taxes', 'invoicing'), |
|
| 248 | 248 | 'value' => '1', |
| 249 | 249 | 'checked' => (bool) $invoice->get_disable_taxes(), |
| 250 | 250 | 'class' => 'getpaid-recalculate-prices-on-change', |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - if ( $invoice->is_type( 'invoice' ) ) { |
|
| 257 | + if ($invoice->is_type('invoice')) { |
|
| 258 | 258 | |
| 259 | 259 | // Send to customer. |
| 260 | 260 | aui()->input( |
@@ -262,16 +262,16 @@ discard block |
||
| 262 | 262 | 'id' => 'wpinv_send_to_customer', |
| 263 | 263 | 'name' => 'send_to_customer', |
| 264 | 264 | 'type' => 'checkbox', |
| 265 | - 'label' => __( 'Send invoice to customer after saving', 'invoicing' ), |
|
| 265 | + 'label' => __('Send invoice to customer after saving', 'invoicing'), |
|
| 266 | 266 | 'value' => '1', |
| 267 | - 'checked' => $invoice->is_draft() && (bool) wpinv_get_option( 'email_user_invoice_active', true ), |
|
| 267 | + 'checked' => $invoice->is_draft() && (bool) wpinv_get_option('email_user_invoice_active', true), |
|
| 268 | 268 | ), |
| 269 | 269 | true |
| 270 | 270 | ); |
| 271 | 271 | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - do_action( 'getpaid_metabox_after_invoice_details', $invoice ); |
|
| 274 | + do_action('getpaid_metabox_after_invoice_details', $invoice); |
|
| 275 | 275 | |
| 276 | 276 | ?> |
| 277 | 277 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if (!defined('ABSPATH')) { |
|
| 10 | 10 | exit; // Exit if accessed directly |
| 11 | 11 | } |
| 12 | 12 | |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @param WP_Post $post |
| 22 | 22 | */ |
| 23 | - public static function output( $post ) { |
|
| 23 | + public static function output($post) { |
|
| 24 | 24 | |
| 25 | 25 | // Retrieve shipping address. |
| 26 | - $shipping_address = get_post_meta( $post->ID, 'shipping_address', true ); |
|
| 26 | + $shipping_address = get_post_meta($post->ID, 'shipping_address', true); |
|
| 27 | 27 | |
| 28 | 28 | // Abort if it is invalid. |
| 29 | - if ( ! is_array( $shipping_address ) ) { |
|
| 29 | + if (!is_array($shipping_address)) { |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -34,29 +34,29 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | <div class="bsui"> |
| 36 | 36 | |
| 37 | - <?php if ( ! empty( $shipping_address['method'] ) ) : ?> |
|
| 37 | + <?php if (!empty($shipping_address['method'])) : ?> |
|
| 38 | 38 | |
| 39 | 39 | <div class="form-group form-row" style="color: green;"> |
| 40 | 40 | <div class="col"> |
| 41 | - <span style="font-weight: 600"><?php esc_html_e( 'Shipping Method', 'invoicing' ); ?>:</span> |
|
| 41 | + <span style="font-weight: 600"><?php esc_html_e('Shipping Method', 'invoicing'); ?>:</span> |
|
| 42 | 42 | </div> |
| 43 | 43 | <div class="col"> |
| 44 | - <?php echo wp_kses_post( $shipping_address['method'] ); ?> |
|
| 44 | + <?php echo wp_kses_post($shipping_address['method']); ?> |
|
| 45 | 45 | </div> |
| 46 | 46 | </div> |
| 47 | 47 | |
| 48 | 48 | <?php endif; ?> |
| 49 | 49 | |
| 50 | - <?php foreach ( getpaid_user_address_fields() as $key => $label ) : ?> |
|
| 50 | + <?php foreach (getpaid_user_address_fields() as $key => $label) : ?> |
|
| 51 | 51 | |
| 52 | - <?php if ( ! empty( $shipping_address[ $key ] ) ) : ?> |
|
| 52 | + <?php if (!empty($shipping_address[$key])) : ?> |
|
| 53 | 53 | |
| 54 | 54 | <div class="form-group form-row"> |
| 55 | 55 | <div class="col"> |
| 56 | - <span style="font-weight: 600"><?php echo esc_html( $label ); ?>:</span> |
|
| 56 | + <span style="font-weight: 600"><?php echo esc_html($label); ?>:</span> |
|
| 57 | 57 | </div> |
| 58 | 58 | <div class="col"> |
| 59 | - <?php echo esc_html( self::prepare_for_display( $shipping_address, $key ) ); ?> |
|
| 59 | + <?php echo esc_html(self::prepare_for_display($shipping_address, $key)); ?> |
|
| 60 | 60 | </div> |
| 61 | 61 | </div> |
| 62 | 62 | |
@@ -77,21 +77,21 @@ discard block |
||
| 77 | 77 | * @param string $key |
| 78 | 78 | * @return string |
| 79 | 79 | */ |
| 80 | - public static function prepare_for_display( $address, $key ) { |
|
| 80 | + public static function prepare_for_display($address, $key) { |
|
| 81 | 81 | |
| 82 | 82 | // Prepare the value. |
| 83 | - $value = $address[ $key ]; |
|
| 83 | + $value = $address[$key]; |
|
| 84 | 84 | |
| 85 | - if ( $key == 'country' ) { |
|
| 86 | - $value = wpinv_country_name( $value ); |
|
| 85 | + if ($key == 'country') { |
|
| 86 | + $value = wpinv_country_name($value); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if ( $key == 'state' ) { |
|
| 90 | - $country = isset( $address['country'] ) ? $address['country'] : wpinv_get_default_country(); |
|
| 91 | - $value = wpinv_state_name( $value, $country ); |
|
| 89 | + if ($key == 'state') { |
|
| 90 | + $country = isset($address['country']) ? $address['country'] : wpinv_get_default_country(); |
|
| 91 | + $value = wpinv_state_name($value, $country); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - return esc_html( $value ); |
|
| 94 | + return esc_html($value); |
|
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
@@ -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,27 +21,27 @@ 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 item. |
| 27 | - $item = new WPInv_Item( $post ); |
|
| 27 | + $item = new WPInv_Item($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 | 32 | // Set the currency position. |
| 33 | 33 | $position = wpinv_currency_position(); |
| 34 | 34 | |
| 35 | - if ( $position == 'left_space' ) { |
|
| 35 | + if ($position == 'left_space') { |
|
| 36 | 36 | $position = 'left'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ( $position == 'right_space' ) { |
|
| 39 | + if ($position == 'right_space') { |
|
| 40 | 40 | $position = 'right'; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | ?> |
| 44 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
| 44 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
| 45 | 45 | <style> |
| 46 | 46 | #poststuff .input-group-text, |
| 47 | 47 | #poststuff .form-control { |
@@ -55,23 +55,23 @@ discard block |
||
| 55 | 55 | </style> |
| 56 | 56 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
| 57 | 57 | |
| 58 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
| 58 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
| 59 | 59 | <div class="form-group row"> |
| 60 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e( 'Item Price', 'invoicing' ); ?></span></label> |
|
| 60 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e('Item Price', 'invoicing'); ?></span></label> |
|
| 61 | 61 | <div class="col-sm-8"> |
| 62 | 62 | <div class="row"> |
| 63 | 63 | <div class="col-sm-4 getpaid-price-input"> |
| 64 | 64 | <div class="input-group input-group-sm"> |
| 65 | - <?php if ( 'left' == $position ) : ?> |
|
| 65 | + <?php if ('left' == $position) : ?> |
|
| 66 | 66 | <div class="input-group-prepend"> |
| 67 | - <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 67 | + <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 68 | 68 | </div> |
| 69 | 69 | <?php endif; ?> |
| 70 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
| 70 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
| 71 | 71 | |
| 72 | - <?php if ( 'left' != $position ) : ?> |
|
| 72 | + <?php if ('left' != $position) : ?> |
|
| 73 | 73 | <div class="input-group-append"> |
| 74 | - <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 74 | + <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 75 | 75 | </div> |
| 76 | 76 | <?php endif; ?> |
| 77 | 77 | </div> |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | </div> |
| 80 | 80 | <div class="col-sm-4 wpinv_show_if_recurring"> |
| 81 | 81 | <?php |
| 82 | - esc_html_e( 'every' ); |
|
| 82 | + esc_html_e('every'); |
|
| 83 | 83 | echo ' '; |
| 84 | 84 | ?> |
| 85 | - <input type="number" style="max-width: 60px;" value="<?php echo esc_attr( $item->get_recurring_interval( 'edit' ) ); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" /> |
|
| 85 | + <input type="number" style="max-width: 60px;" value="<?php echo esc_attr($item->get_recurring_interval('edit')); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" /> |
|
| 86 | 86 | </div> |
| 87 | 87 | <div class="col-sm-4 wpinv_show_if_recurring"> |
| 88 | 88 | <?php |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | array( |
| 91 | 91 | 'id' => 'wpinv_recurring_period', |
| 92 | 92 | 'name' => 'wpinv_recurring_period', |
| 93 | - 'label' => __( 'Period', 'invoicing' ), |
|
| 94 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
| 95 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
| 93 | + 'label' => __('Period', 'invoicing'), |
|
| 94 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
| 95 | + 'value' => $item->get_recurring_period('edit'), |
|
| 96 | 96 | 'select2' => true, |
| 97 | 97 | 'data-allow-clear' => 'false', |
| 98 | 98 | 'options' => array( |
| 99 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
| 100 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
| 101 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
| 102 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
| 99 | + 'D' => __('day(s)', 'invoicing'), |
|
| 100 | + 'W' => __('week(s)', 'invoicing'), |
|
| 101 | + 'M' => __('month(s)', 'invoicing'), |
|
| 102 | + 'Y' => __('year(s)', 'invoicing'), |
|
| 103 | 103 | ), |
| 104 | 104 | ), |
| 105 | 105 | true |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | <?php |
| 113 | 113 | |
| 114 | 114 | // Dynamic pricing. |
| 115 | - if ( $item->supports_dynamic_pricing() ) { |
|
| 115 | + if ($item->supports_dynamic_pricing()) { |
|
| 116 | 116 | |
| 117 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
| 117 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
| 118 | 118 | |
| 119 | 119 | // NYP toggle. |
| 120 | 120 | aui()->input( |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'id' => 'wpinv_name_your_price', |
| 123 | 123 | 'name' => 'wpinv_name_your_price', |
| 124 | 124 | 'type' => 'checkbox', |
| 125 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
| 125 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
| 126 | 126 | 'value' => '1', |
| 127 | 127 | 'checked' => $item->user_can_set_their_price(), |
| 128 | 128 | 'no_wrap' => true, |
@@ -130,105 +130,105 @@ discard block |
||
| 130 | 130 | true |
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
| 133 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // Subscriptions. |
| 138 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
| 138 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
| 139 | 139 | aui()->input( |
| 140 | 140 | array( |
| 141 | 141 | 'id' => 'wpinv_is_recurring', |
| 142 | 142 | 'name' => 'wpinv_is_recurring', |
| 143 | 143 | 'type' => 'checkbox', |
| 144 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
| 144 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
| 145 | 145 | 'value' => '1', |
| 146 | 146 | 'checked' => $item->is_recurring(), |
| 147 | 147 | 'no_wrap' => true, |
| 148 | 148 | ), |
| 149 | 149 | true |
| 150 | 150 | ); |
| 151 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
| 151 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
| 152 | 152 | |
| 153 | 153 | ?> |
| 154 | 154 | <div class="wpinv_show_if_recurring"> |
| 155 | - <em><?php echo wp_kses_post( wpinv_get_recurring_gateways_text() ); ?></em> |
|
| 155 | + <em><?php echo wp_kses_post(wpinv_get_recurring_gateways_text()); ?></em> |
|
| 156 | 156 | </div> |
| 157 | 157 | </div> |
| 158 | 158 | </div> |
| 159 | 159 | </div> |
| 160 | 160 | <div class="col-sm-1 pt-2 pl-0"> |
| 161 | - <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> |
|
| 161 | + <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span> |
|
| 162 | 162 | </div> |
| 163 | 163 | </div> |
| 164 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
| 164 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
| 165 | 165 | |
| 166 | - <?php if ( $item->supports_dynamic_pricing() ) : ?> |
|
| 167 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
| 166 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
| 167 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
| 168 | 168 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
| 169 | 169 | |
| 170 | 170 | <div class="form-group row"> |
| 171 | 171 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
| 172 | - <?php esc_html_e( 'Minimum Price', 'invoicing' ); ?> |
|
| 172 | + <?php esc_html_e('Minimum Price', 'invoicing'); ?> |
|
| 173 | 173 | </label> |
| 174 | 174 | <div class="col-sm-8"> |
| 175 | 175 | <div class="input-group input-group-sm"> |
| 176 | - <?php if ( 'left' == $position ) : ?> |
|
| 176 | + <?php if ('left' == $position) : ?> |
|
| 177 | 177 | <div class="input-group-prepend"> |
| 178 | - <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 178 | + <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 179 | 179 | </div> |
| 180 | 180 | <?php endif; ?> |
| 181 | 181 | |
| 182 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
| 182 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
| 183 | 183 | |
| 184 | - <?php if ( 'left' != $position ) : ?> |
|
| 184 | + <?php if ('left' != $position) : ?> |
|
| 185 | 185 | <div class="input-group-append"> |
| 186 | - <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 186 | + <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 187 | 187 | </div> |
| 188 | 188 | <?php endif; ?> |
| 189 | 189 | </div> |
| 190 | 190 | </div> |
| 191 | 191 | |
| 192 | 192 | <div class="col-sm-1 pt-2 pl-0"> |
| 193 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> |
|
| 193 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span> |
|
| 194 | 194 | </div> |
| 195 | 195 | </div> |
| 196 | 196 | |
| 197 | 197 | </div> |
| 198 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
| 198 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
| 199 | 199 | <?php endif; ?> |
| 200 | 200 | |
| 201 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
| 201 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
| 202 | 202 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
| 203 | 203 | |
| 204 | 204 | <div class="form-group row"> |
| 205 | 205 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
| 206 | - <?php esc_html_e( 'Maximum Renewals', 'invoicing' ); ?> |
|
| 206 | + <?php esc_html_e('Maximum Renewals', 'invoicing'); ?> |
|
| 207 | 207 | </label> |
| 208 | 208 | <div class="col-sm-8"> |
| 209 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
| 209 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
| 210 | 210 | </div> |
| 211 | 211 | <div class="col-sm-1 pt-2 pl-0"> |
| 212 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> |
|
| 212 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span> |
|
| 213 | 213 | </div> |
| 214 | 214 | </div> |
| 215 | 215 | |
| 216 | 216 | </div> |
| 217 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
| 217 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
| 218 | 218 | |
| 219 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
| 219 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
| 220 | 220 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
| 221 | 221 | |
| 222 | 222 | <div class="form-group row"> |
| 223 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined( 'GETPAID_PAID_TRIALS_VERSION' ) ? esc_html_e( 'Free/Paid Trial', 'invoicing' ) : esc_html_e( 'Free Trial', 'invoicing' ); ?></label> |
|
| 223 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined('GETPAID_PAID_TRIALS_VERSION') ? esc_html_e('Free/Paid Trial', 'invoicing') : esc_html_e('Free Trial', 'invoicing'); ?></label> |
|
| 224 | 224 | |
| 225 | 225 | <div class="col-sm-8"> |
| 226 | 226 | <div class="row"> |
| 227 | 227 | <div class="col-sm-6"> |
| 228 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0; ?> |
|
| 228 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
| 229 | 229 | |
| 230 | 230 | <div> |
| 231 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
| 231 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
| 232 | 232 | </div> |
| 233 | 233 | </div> |
| 234 | 234 | <div class="col-sm-6"> |
@@ -237,17 +237,17 @@ discard block |
||
| 237 | 237 | array( |
| 238 | 238 | 'id' => 'wpinv_trial_period', |
| 239 | 239 | 'name' => 'wpinv_trial_period', |
| 240 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
| 241 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
| 242 | - 'value' => $item->get_trial_period( 'edit' ), |
|
| 240 | + 'label' => __('Trial Period', 'invoicing'), |
|
| 241 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
| 242 | + 'value' => $item->get_trial_period('edit'), |
|
| 243 | 243 | 'select2' => true, |
| 244 | 244 | 'data-allow-clear' => 'false', |
| 245 | 245 | 'no_wrap' => true, |
| 246 | 246 | 'options' => array( |
| 247 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
| 248 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
| 249 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
| 250 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
| 247 | + 'D' => __('day(s)', 'invoicing'), |
|
| 248 | + 'W' => __('week(s)', 'invoicing'), |
|
| 249 | + 'M' => __('month(s)', 'invoicing'), |
|
| 250 | + 'Y' => __('year(s)', 'invoicing'), |
|
| 251 | 251 | ), |
| 252 | 252 | ), |
| 253 | 253 | true |
@@ -259,15 +259,15 @@ discard block |
||
| 259 | 259 | </div> |
| 260 | 260 | |
| 261 | 261 | <div class="col-sm-1 pt-2 pl-0"> |
| 262 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> |
|
| 262 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span> |
|
| 263 | 263 | </div> |
| 264 | 264 | |
| 265 | 265 | </div> |
| 266 | 266 | |
| 267 | 267 | </div> |
| 268 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
| 268 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
| 269 | 269 | |
| 270 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
| 270 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
| 271 | 271 | </div> |
| 272 | 272 | <?php |
| 273 | 273 | |
@@ -278,31 +278,31 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param int $post_id |
| 280 | 280 | */ |
| 281 | - public static function save( $post_id ) { |
|
| 281 | + public static function save($post_id) { |
|
| 282 | 282 | |
| 283 | 283 | // Prepare the item. |
| 284 | - $item = new WPInv_Item( $post_id ); |
|
| 284 | + $item = new WPInv_Item($post_id); |
|
| 285 | 285 | |
| 286 | 286 | // Load new data. |
| 287 | 287 | $item->set_props( |
| 288 | 288 | array( |
| 289 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
| 290 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
| 291 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
| 292 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
| 293 | - 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
| 294 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, |
|
| 295 | - 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
| 296 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
| 297 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
| 298 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 299 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
| 300 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
| 301 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 289 | + 'price' => isset($_POST['wpinv_item_price']) ? getpaid_standardize_amount($_POST['wpinv_item_price']) : null, |
|
| 290 | + 'vat_rule' => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null, |
|
| 291 | + 'vat_class' => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null, |
|
| 292 | + 'type' => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null, |
|
| 293 | + 'is_dynamic_pricing' => !empty($_POST['wpinv_name_your_price']), |
|
| 294 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? getpaid_standardize_amount($_POST['wpinv_minimum_price']) : null, |
|
| 295 | + 'is_recurring' => !empty($_POST['wpinv_is_recurring']), |
|
| 296 | + 'recurring_period' => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null, |
|
| 297 | + 'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
| 298 | + 'recurring_limit' => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 299 | + 'is_free_trial' => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null, |
|
| 300 | + 'trial_period' => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null, |
|
| 301 | + 'trial_interval' => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 302 | 302 | ) |
| 303 | 303 | ); |
| 304 | 304 | |
| 305 | 305 | $item->save(); |
| 306 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
| 306 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
| 307 | 307 | } |
| 308 | 308 | } |
@@ -1,38 +1,38 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // MUST have WordPress. |
| 3 | -if ( ! defined( 'WPINC' ) ) { |
|
| 3 | +if (!defined('WPINC')) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | class WPInv_Meta_Box_Notes { |
| 8 | - public static function output( $post ) { |
|
| 8 | + public static function output($post) { |
|
| 9 | 9 | global $post; |
| 10 | 10 | |
| 11 | - $notes = wpinv_get_invoice_notes( $post->ID ); |
|
| 11 | + $notes = wpinv_get_invoice_notes($post->ID); |
|
| 12 | 12 | |
| 13 | 13 | echo '<ul class="invoice_notes">'; |
| 14 | 14 | |
| 15 | - if ( $notes ) { |
|
| 16 | - foreach ( $notes as $note ) { |
|
| 17 | - wpinv_get_invoice_note_line_item( $note ); |
|
| 15 | + if ($notes) { |
|
| 16 | + foreach ($notes as $note) { |
|
| 17 | + wpinv_get_invoice_note_line_item($note); |
|
| 18 | 18 | } |
| 19 | 19 | } else { |
| 20 | - echo '<li>' . esc_html__( 'There are no notes yet.', 'invoicing' ) . '</li>'; |
|
| 20 | + echo '<li>' . esc_html__('There are no notes yet.', 'invoicing') . '</li>'; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | echo '</ul>'; |
| 24 | 24 | ?> |
| 25 | 25 | <div class="add_note"> |
| 26 | - <h4><?php esc_html_e( 'Add note', 'invoicing' ); ?></h4> |
|
| 26 | + <h4><?php esc_html_e('Add note', 'invoicing'); ?></h4> |
|
| 27 | 27 | <p> |
| 28 | 28 | <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea> |
| 29 | 29 | </p> |
| 30 | 30 | <p> |
| 31 | 31 | <select name="invoice_note_type" id="invoice_note_type" class="regular-text"> |
| 32 | - <option value=""><?php esc_html_e( 'Private note', 'invoicing' ); ?></option> |
|
| 33 | - <option value="customer"><?php esc_html_e( 'Note to customer', 'invoicing' ); ?></option> |
|
| 32 | + <option value=""><?php esc_html_e('Private note', 'invoicing'); ?></option> |
|
| 33 | + <option value="customer"><?php esc_html_e('Note to customer', 'invoicing'); ?></option> |
|
| 34 | 34 | </select> |
| 35 | - <a href="#" class="add_note button"><?php esc_html_e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php esc_html_e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span> |
|
| 35 | + <a href="#" class="add_note button"><?php esc_html_e('Add', 'invoicing'); ?></a> <span class="description"><?php esc_html_e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span> |
|
| 36 | 36 | </p> |
| 37 | 37 | </div> |
| 38 | 38 | <?php |