@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Invoicing |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * WPInv_Ajax class. |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * Hook in ajax handlers. |
| 18 | 18 | */ |
| 19 | 19 | public static function init() { |
| 20 | - add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 ); |
|
| 21 | - add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 ); |
|
| 20 | + add_action('init', array(__CLASS__, 'define_ajax'), 0); |
|
| 21 | + add_action('template_redirect', array(__CLASS__, 'do_wpinv_ajax'), 0); |
|
| 22 | 22 | self::add_ajax_events(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public static function define_ajax() { |
| 29 | 29 | |
| 30 | - if ( ! empty( $_GET['wpinv-ajax'] ) ) { |
|
| 31 | - getpaid_maybe_define_constant( 'DOING_AJAX', true ); |
|
| 32 | - getpaid_maybe_define_constant( 'WPInv_DOING_AJAX', true ); |
|
| 33 | - if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) { |
|
| 34 | - /** @scrutinizer ignore-unhandled */ @ini_set( 'display_errors', 0 ); |
|
| 30 | + if (!empty($_GET['wpinv-ajax'])) { |
|
| 31 | + getpaid_maybe_define_constant('DOING_AJAX', true); |
|
| 32 | + getpaid_maybe_define_constant('WPInv_DOING_AJAX', true); |
|
| 33 | + if (!WP_DEBUG || (WP_DEBUG && !WP_DEBUG_DISPLAY)) { |
|
| 34 | + /** @scrutinizer ignore-unhandled */ @ini_set('display_errors', 0); |
|
| 35 | 35 | } |
| 36 | 36 | $GLOBALS['wpdb']->hide_errors(); |
| 37 | 37 | } |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | * @since 1.0.18 |
| 45 | 45 | */ |
| 46 | 46 | private static function wpinv_ajax_headers() { |
| 47 | - if ( ! headers_sent() ) { |
|
| 47 | + if (!headers_sent()) { |
|
| 48 | 48 | send_origin_headers(); |
| 49 | 49 | send_nosniff_header(); |
| 50 | 50 | nocache_headers(); |
| 51 | - header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); |
|
| 52 | - header( 'X-Robots-Tag: noindex' ); |
|
| 53 | - status_header( 200 ); |
|
| 51 | + header('Content-Type: text/html; charset=' . get_option('blog_charset')); |
|
| 52 | + header('X-Robots-Tag: noindex'); |
|
| 53 | + status_header(200); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | public static function do_wpinv_ajax() { |
| 61 | 61 | global $wp_query; |
| 62 | 62 | |
| 63 | - if ( ! empty( $_GET['wpinv-ajax'] ) ) { |
|
| 64 | - $wp_query->set( 'wpinv-ajax', sanitize_text_field( wp_unslash( $_GET['wpinv-ajax'] ) ) ); |
|
| 63 | + if (!empty($_GET['wpinv-ajax'])) { |
|
| 64 | + $wp_query->set('wpinv-ajax', sanitize_text_field(wp_unslash($_GET['wpinv-ajax']))); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $action = $wp_query->get( 'wpinv-ajax' ); |
|
| 67 | + $action = $wp_query->get('wpinv-ajax'); |
|
| 68 | 68 | |
| 69 | - if ( $action ) { |
|
| 69 | + if ($action) { |
|
| 70 | 70 | self::wpinv_ajax_headers(); |
| 71 | - $action = sanitize_text_field( $action ); |
|
| 72 | - do_action( 'wpinv_ajax_' . $action ); |
|
| 71 | + $action = sanitize_text_field($action); |
|
| 72 | + do_action('wpinv_ajax_' . $action); |
|
| 73 | 73 | wp_die(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -103,36 +103,36 @@ discard block |
||
| 103 | 103 | 'payment_form_refresh_prices' => true, |
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | - foreach ( $ajax_events as $ajax_event => $nopriv ) { |
|
| 107 | - add_action( 'wp_ajax_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
| 108 | - add_action( 'wp_ajax_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
| 106 | + foreach ($ajax_events as $ajax_event => $nopriv) { |
|
| 107 | + add_action('wp_ajax_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
| 108 | + add_action('wp_ajax_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
| 109 | 109 | |
| 110 | - if ( $nopriv ) { |
|
| 111 | - add_action( 'wp_ajax_nopriv_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
| 112 | - add_action( 'wp_ajax_nopriv_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
| 113 | - add_action( 'wpinv_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
| 110 | + if ($nopriv) { |
|
| 111 | + add_action('wp_ajax_nopriv_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
| 112 | + add_action('wp_ajax_nopriv_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
| 113 | + add_action('wpinv_ajax_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public static function add_note() { |
| 119 | - check_ajax_referer( 'add-invoice-note', '_nonce' ); |
|
| 119 | + check_ajax_referer('add-invoice-note', '_nonce'); |
|
| 120 | 120 | |
| 121 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 121 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 122 | 122 | die(-1); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $post_id = absint( $_POST['post_id'] ); |
|
| 126 | - $note = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) ); |
|
| 127 | - $note_type = sanitize_text_field( $_POST['note_type'] ); |
|
| 125 | + $post_id = absint($_POST['post_id']); |
|
| 126 | + $note = wp_kses_post(trim(stripslashes($_POST['note']))); |
|
| 127 | + $note_type = sanitize_text_field($_POST['note_type']); |
|
| 128 | 128 | |
| 129 | 129 | $is_customer_note = $note_type == 'customer' ? 1 : 0; |
| 130 | 130 | |
| 131 | - if ( $post_id > 0 ) { |
|
| 132 | - $note_id = wpinv_insert_payment_note( $post_id, $note, $is_customer_note ); |
|
| 131 | + if ($post_id > 0) { |
|
| 132 | + $note_id = wpinv_insert_payment_note($post_id, $note, $is_customer_note); |
|
| 133 | 133 | |
| 134 | - if ( $note_id > 0 && !is_wp_error( $note_id ) ) { |
|
| 135 | - wpinv_get_invoice_note_line_item( $note_id ); |
|
| 134 | + if ($note_id > 0 && !is_wp_error($note_id)) { |
|
| 135 | + wpinv_get_invoice_note_line_item($note_id); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
@@ -140,16 +140,16 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public static function delete_note() { |
| 143 | - check_ajax_referer( 'delete-invoice-note', '_nonce' ); |
|
| 143 | + check_ajax_referer('delete-invoice-note', '_nonce'); |
|
| 144 | 144 | |
| 145 | - if ( !wpinv_current_user_can_manage_invoicing() ) { |
|
| 145 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 146 | 146 | die(-1); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $note_id = (int)$_POST['note_id']; |
|
| 149 | + $note_id = (int) $_POST['note_id']; |
|
| 150 | 150 | |
| 151 | - if ( $note_id > 0 ) { |
|
| 152 | - wp_delete_comment( $note_id, true ); |
|
| 151 | + if ($note_id > 0) { |
|
| 152 | + wp_delete_comment($note_id, true); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | die(); |
@@ -167,34 +167,34 @@ discard block |
||
| 167 | 167 | public static function get_billing_details() { |
| 168 | 168 | |
| 169 | 169 | // Verify nonce. |
| 170 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 170 | + check_ajax_referer('wpinv-nonce'); |
|
| 171 | 171 | |
| 172 | 172 | // Can the user manage the plugin? |
| 173 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 173 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 174 | 174 | die(-1); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | // Do we have a user id? |
| 178 | 178 | $user_id = $_GET['user_id']; |
| 179 | 179 | |
| 180 | - if ( empty( $user_id ) || ! is_numeric( $user_id ) ) { |
|
| 180 | + if (empty($user_id) || !is_numeric($user_id)) { |
|
| 181 | 181 | die(-1); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Fetch the billing details. |
| 185 | - $billing_details = wpinv_get_user_address( $user_id ); |
|
| 186 | - $billing_details = apply_filters( 'wpinv_ajax_billing_details', $billing_details, $user_id ); |
|
| 185 | + $billing_details = wpinv_get_user_address($user_id); |
|
| 186 | + $billing_details = apply_filters('wpinv_ajax_billing_details', $billing_details, $user_id); |
|
| 187 | 187 | |
| 188 | 188 | // unset the user id and email. |
| 189 | - $to_ignore = array( 'user_id', 'email' ); |
|
| 189 | + $to_ignore = array('user_id', 'email'); |
|
| 190 | 190 | |
| 191 | - foreach ( $to_ignore as $key ) { |
|
| 192 | - if ( isset( $billing_details[ $key ] ) ) { |
|
| 193 | - unset( $billing_details[ $key ] ); |
|
| 191 | + foreach ($to_ignore as $key) { |
|
| 192 | + if (isset($billing_details[$key])) { |
|
| 193 | + unset($billing_details[$key]); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - wp_send_json_success( $billing_details ); |
|
| 197 | + wp_send_json_success($billing_details); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | |
@@ -204,47 +204,47 @@ discard block |
||
| 204 | 204 | public static function check_new_user_email() { |
| 205 | 205 | |
| 206 | 206 | // Verify nonce. |
| 207 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 207 | + check_ajax_referer('wpinv-nonce'); |
|
| 208 | 208 | |
| 209 | 209 | // Can the user manage the plugin? |
| 210 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 210 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 211 | 211 | die(-1); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // We need an email address. |
| 215 | - if ( empty( $_GET['email'] ) ) { |
|
| 216 | - _e( "Provide the new user's email address", 'invoicing' ); |
|
| 215 | + if (empty($_GET['email'])) { |
|
| 216 | + _e("Provide the new user's email address", 'invoicing'); |
|
| 217 | 217 | exit; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Ensure the email is valid. |
| 221 | - $email = sanitize_text_field( $_GET['email'] ); |
|
| 222 | - if ( ! is_email( $email ) ) { |
|
| 223 | - _e( 'Invalid email address', 'invoicing' ); |
|
| 221 | + $email = sanitize_text_field($_GET['email']); |
|
| 222 | + if (!is_email($email)) { |
|
| 223 | + _e('Invalid email address', 'invoicing'); |
|
| 224 | 224 | exit; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // And it does not exist. |
| 228 | - $id = email_exists( $email ); |
|
| 229 | - if ( $id ) { |
|
| 230 | - wp_send_json_success( compact( 'id' ) ); |
|
| 228 | + $id = email_exists($email); |
|
| 229 | + if ($id) { |
|
| 230 | + wp_send_json_success(compact('id')); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - wp_send_json_success( true ); |
|
| 233 | + wp_send_json_success(true); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | public static function run_tool() { |
| 237 | - check_ajax_referer( 'wpinv-nonce', '_nonce' ); |
|
| 238 | - if ( !wpinv_current_user_can_manage_invoicing() ) { |
|
| 237 | + check_ajax_referer('wpinv-nonce', '_nonce'); |
|
| 238 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 239 | 239 | die(-1); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $tool = sanitize_text_field( $_POST['tool'] ); |
|
| 242 | + $tool = sanitize_text_field($_POST['tool']); |
|
| 243 | 243 | |
| 244 | - do_action( 'wpinv_run_tool' ); |
|
| 244 | + do_action('wpinv_run_tool'); |
|
| 245 | 245 | |
| 246 | - if ( !empty( $tool ) ) { |
|
| 247 | - do_action( 'wpinv_tool_' . $tool ); |
|
| 246 | + if (!empty($tool)) { |
|
| 247 | + do_action('wpinv_tool_' . $tool); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -254,27 +254,27 @@ discard block |
||
| 254 | 254 | public static function get_payment_form() { |
| 255 | 255 | |
| 256 | 256 | // Check nonce. |
| 257 | - check_ajax_referer( 'getpaid_form_nonce' ); |
|
| 257 | + check_ajax_referer('getpaid_form_nonce'); |
|
| 258 | 258 | |
| 259 | 259 | // Is the request set up correctly? |
| 260 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 260 | + if (empty($_GET['form']) && empty($_GET['item'])) { |
|
| 261 | 261 | echo aui()->alert( |
| 262 | 262 | array( |
| 263 | 263 | 'type' => 'warning', |
| 264 | - 'content' => __( 'No payment form or item provided', 'invoicing' ), |
|
| 264 | + 'content' => __('No payment form or item provided', 'invoicing'), |
|
| 265 | 265 | ) |
| 266 | 266 | ); |
| 267 | 267 | exit; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Payment form or button? |
| 271 | - if ( ! empty( $_GET['form'] ) ) { |
|
| 272 | - getpaid_display_payment_form( urldecode( $_GET['form'] ) ); |
|
| 273 | - } else if( ! empty( $_GET['invoice'] ) ) { |
|
| 274 | - getpaid_display_invoice_payment_form( urldecode( $_GET['invoice'] ) ); |
|
| 271 | + if (!empty($_GET['form'])) { |
|
| 272 | + getpaid_display_payment_form(urldecode($_GET['form'])); |
|
| 273 | + } else if (!empty($_GET['invoice'])) { |
|
| 274 | + getpaid_display_invoice_payment_form(urldecode($_GET['invoice'])); |
|
| 275 | 275 | } else { |
| 276 | - $items = getpaid_convert_items_to_array( urldecode( $_GET['item'] ) ); |
|
| 277 | - getpaid_display_item_payment_form( $items ); |
|
| 276 | + $items = getpaid_convert_items_to_array(urldecode($_GET['item'])); |
|
| 277 | + getpaid_display_item_payment_form($items); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | exit; |
@@ -289,17 +289,17 @@ discard block |
||
| 289 | 289 | public static function payment_form() { |
| 290 | 290 | |
| 291 | 291 | // Check nonce. |
| 292 | - check_ajax_referer( 'getpaid_form_nonce' ); |
|
| 292 | + check_ajax_referer('getpaid_form_nonce'); |
|
| 293 | 293 | |
| 294 | 294 | // ... form fields... |
| 295 | - if ( empty( $_POST['getpaid_payment_form_submission'] ) ) { |
|
| 296 | - _e( 'Error: Reload the page and try again.', 'invoicing' ); |
|
| 295 | + if (empty($_POST['getpaid_payment_form_submission'])) { |
|
| 296 | + _e('Error: Reload the page and try again.', 'invoicing'); |
|
| 297 | 297 | exit; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // Process the payment form. |
| 301 | - $checkout_class = apply_filters( 'getpaid_checkout_class', 'GetPaid_Checkout' ); |
|
| 302 | - $checkout = new $checkout_class( new GetPaid_Payment_Form_Submission() ); |
|
| 301 | + $checkout_class = apply_filters('getpaid_checkout_class', 'GetPaid_Checkout'); |
|
| 302 | + $checkout = new $checkout_class(new GetPaid_Payment_Form_Submission()); |
|
| 303 | 303 | $checkout->process_checkout(); |
| 304 | 304 | |
| 305 | 305 | exit; |
@@ -312,55 +312,55 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public static function get_payment_form_states_field() { |
| 314 | 314 | |
| 315 | - if ( empty( $_GET['country'] ) || empty( $_GET['form'] ) ) { |
|
| 315 | + if (empty($_GET['country']) || empty($_GET['form'])) { |
|
| 316 | 316 | exit; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - $elements = getpaid_get_payment_form_elements( $_GET['form'] ); |
|
| 319 | + $elements = getpaid_get_payment_form_elements($_GET['form']); |
|
| 320 | 320 | |
| 321 | - if ( empty( $elements ) ) { |
|
| 321 | + if (empty($elements)) { |
|
| 322 | 322 | exit; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | $address_fields = array(); |
| 326 | - foreach ( $elements as $element ) { |
|
| 327 | - if ( 'address' === $element['type'] ) { |
|
| 326 | + foreach ($elements as $element) { |
|
| 327 | + if ('address' === $element['type']) { |
|
| 328 | 328 | $address_fields = $element; |
| 329 | 329 | break; |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ( empty( $address_fields ) ) { |
|
| 333 | + if (empty($address_fields)) { |
|
| 334 | 334 | exit; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - foreach ( $address_fields['fields'] as $address_field ) { |
|
| 337 | + foreach ($address_fields['fields'] as $address_field) { |
|
| 338 | 338 | |
| 339 | - if ( 'wpinv_state' == $address_field['name'] ) { |
|
| 339 | + if ('wpinv_state' == $address_field['name']) { |
|
| 340 | 340 | |
| 341 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
| 342 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
| 343 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
| 344 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
| 345 | - $value = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_wpinv_state', true ) : ''; |
|
| 346 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
| 341 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
| 342 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
| 343 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
| 344 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
| 345 | + $value = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_wpinv_state', true) : ''; |
|
| 346 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
| 347 | 347 | |
| 348 | - if ( ! empty( $address_field['required'] ) ) { |
|
| 348 | + if (!empty($address_field['required'])) { |
|
| 349 | 349 | $label .= "<span class='text-danger'> *</span>"; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - $html = getpaid_get_states_select_markup ( |
|
| 353 | - sanitize_text_field( $_GET['country'] ), |
|
| 352 | + $html = getpaid_get_states_select_markup( |
|
| 353 | + sanitize_text_field($_GET['country']), |
|
| 354 | 354 | $value, |
| 355 | 355 | $placeholder, |
| 356 | 356 | $label, |
| 357 | 357 | $description, |
| 358 | - ! empty( $address_field['required'] ), |
|
| 358 | + !empty($address_field['required']), |
|
| 359 | 359 | $wrap_class, |
| 360 | - wpinv_clean( $_GET['name'] ) |
|
| 360 | + wpinv_clean($_GET['name']) |
|
| 361 | 361 | ); |
| 362 | 362 | |
| 363 | - wp_send_json_success( $html ); |
|
| 363 | + wp_send_json_success($html); |
|
| 364 | 364 | exit; |
| 365 | 365 | |
| 366 | 366 | } |
@@ -376,66 +376,66 @@ discard block |
||
| 376 | 376 | public static function recalculate_invoice_totals() { |
| 377 | 377 | |
| 378 | 378 | // Verify nonce. |
| 379 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 379 | + check_ajax_referer('wpinv-nonce'); |
|
| 380 | 380 | |
| 381 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 381 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 382 | 382 | exit; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // We need an invoice. |
| 386 | - if ( empty( $_POST['post_id'] ) ) { |
|
| 386 | + if (empty($_POST['post_id'])) { |
|
| 387 | 387 | exit; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // Fetch the invoice. |
| 391 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
| 391 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
| 392 | 392 | |
| 393 | 393 | // Ensure it exists. |
| 394 | - if ( ! $invoice->get_id() ) { |
|
| 394 | + if (!$invoice->get_id()) { |
|
| 395 | 395 | exit; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // Maybe set the country, state, currency. |
| 399 | - foreach ( array( 'country', 'state', 'currency', 'vat_number', 'discount_code' ) as $key ) { |
|
| 400 | - if ( isset( $_POST[ $key ] ) ) { |
|
| 399 | + foreach (array('country', 'state', 'currency', 'vat_number', 'discount_code') as $key) { |
|
| 400 | + if (isset($_POST[$key])) { |
|
| 401 | 401 | $method = "set_$key"; |
| 402 | - $invoice->$method( sanitize_text_field( $_POST[ $key ] ) ); |
|
| 402 | + $invoice->$method(sanitize_text_field($_POST[$key])); |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | // Maybe disable taxes. |
| 407 | - $invoice->set_disable_taxes( ! empty( $_POST['taxes'] ) ); |
|
| 407 | + $invoice->set_disable_taxes(!empty($_POST['taxes'])); |
|
| 408 | 408 | |
| 409 | 409 | // Discount code. |
| 410 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
| 411 | - $discount = new WPInv_Discount( $invoice->get_discount_code() ); |
|
| 412 | - if ( $discount->exists() ) { |
|
| 413 | - $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) ); |
|
| 410 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
| 411 | + $discount = new WPInv_Discount($invoice->get_discount_code()); |
|
| 412 | + if ($discount->exists()) { |
|
| 413 | + $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount)); |
|
| 414 | 414 | } else { |
| 415 | - $invoice->remove_discount( 'discount_code' ); |
|
| 415 | + $invoice->remove_discount('discount_code'); |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // Recalculate totals. |
| 420 | 420 | $invoice->recalculate_total(); |
| 421 | 421 | |
| 422 | - $total = wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
| 423 | - $suscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
| 424 | - if ( is_a( $suscriptions, 'WPInv_Subscription' ) && $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total() ) { |
|
| 425 | - $recurring_total = wpinv_price( $invoice->get_recurring_total(), $invoice->get_currency() ); |
|
| 426 | - $total .= '<small class="form-text text-muted">' . sprintf( __( 'Recurring Price: %s', 'invoicing' ), $recurring_total ) . '</small>'; |
|
| 422 | + $total = wpinv_price($invoice->get_total(), $invoice->get_currency()); |
|
| 423 | + $suscriptions = getpaid_get_invoice_subscriptions($invoice); |
|
| 424 | + if (is_a($suscriptions, 'WPInv_Subscription') && $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total()) { |
|
| 425 | + $recurring_total = wpinv_price($invoice->get_recurring_total(), $invoice->get_currency()); |
|
| 426 | + $total .= '<small class="form-text text-muted">' . sprintf(__('Recurring Price: %s', 'invoicing'), $recurring_total) . '</small>'; |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | $totals = array( |
| 430 | - 'subtotal' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ), |
|
| 431 | - 'discount' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ), |
|
| 432 | - 'tax' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ), |
|
| 430 | + 'subtotal' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()), |
|
| 431 | + 'discount' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()), |
|
| 432 | + 'tax' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()), |
|
| 433 | 433 | 'total' => $total, |
| 434 | 434 | ); |
| 435 | 435 | |
| 436 | - $totals = apply_filters( 'getpaid_invoice_totals', $totals, $invoice ); |
|
| 436 | + $totals = apply_filters('getpaid_invoice_totals', $totals, $invoice); |
|
| 437 | 437 | |
| 438 | - wp_send_json_success( compact( 'totals' ) ); |
|
| 438 | + wp_send_json_success(compact('totals')); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -444,33 +444,33 @@ discard block |
||
| 444 | 444 | public static function get_invoice_items() { |
| 445 | 445 | |
| 446 | 446 | // Verify nonce. |
| 447 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 447 | + check_ajax_referer('wpinv-nonce'); |
|
| 448 | 448 | |
| 449 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 449 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 450 | 450 | exit; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | // We need an invoice and items. |
| 454 | - if ( empty( $_POST['post_id'] ) ) { |
|
| 454 | + if (empty($_POST['post_id'])) { |
|
| 455 | 455 | exit; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | // Fetch the invoice. |
| 459 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
| 459 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
| 460 | 460 | |
| 461 | 461 | // Ensure it exists. |
| 462 | - if ( ! $invoice->get_id() ) { |
|
| 462 | + if (!$invoice->get_id()) { |
|
| 463 | 463 | exit; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | // Return an array of invoice items. |
| 467 | 467 | $items = array(); |
| 468 | 468 | |
| 469 | - foreach ( $invoice->get_items() as $item ) { |
|
| 470 | - $items[] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency(), $invoice->is_renewal() ); |
|
| 469 | + foreach ($invoice->get_items() as $item) { |
|
| 470 | + $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency(), $invoice->is_renewal()); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - wp_send_json_success( compact( 'items' ) ); |
|
| 473 | + wp_send_json_success(compact('items')); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -479,50 +479,50 @@ discard block |
||
| 479 | 479 | public static function edit_invoice_item() { |
| 480 | 480 | |
| 481 | 481 | // Verify nonce. |
| 482 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 482 | + check_ajax_referer('wpinv-nonce'); |
|
| 483 | 483 | |
| 484 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 484 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 485 | 485 | exit; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | // We need an invoice and item details. |
| 489 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['data'] ) ) { |
|
| 489 | + if (empty($_POST['post_id']) || empty($_POST['data'])) { |
|
| 490 | 490 | exit; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // Fetch the invoice. |
| 494 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
| 494 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
| 495 | 495 | |
| 496 | 496 | // Ensure it exists and its not been paid for. |
| 497 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
| 497 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
| 498 | 498 | exit; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | // Format the data. |
| 502 | - $data = wp_unslash( wp_list_pluck( $_POST['data'], 'value', 'field' ) ); |
|
| 502 | + $data = wp_unslash(wp_list_pluck($_POST['data'], 'value', 'field')); |
|
| 503 | 503 | |
| 504 | 504 | // Ensure that we have an item id. |
| 505 | - if ( empty( $data['id'] ) ) { |
|
| 505 | + if (empty($data['id'])) { |
|
| 506 | 506 | exit; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | // Abort if the invoice does not have the specified item. |
| 510 | - $item = $invoice->get_item( (int) $data['id'] ); |
|
| 510 | + $item = $invoice->get_item((int) $data['id']); |
|
| 511 | 511 | |
| 512 | - if ( empty( $item ) ) { |
|
| 512 | + if (empty($item)) { |
|
| 513 | 513 | exit; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | // Update the item. |
| 517 | - $item->set_price( floatval( $data['price'] ) ); |
|
| 518 | - $item->set_name( sanitize_text_field( $data['name'] ) ); |
|
| 519 | - $item->set_description( wp_kses_post( $data['description'] ) ); |
|
| 520 | - $item->set_quantity( floatval( $data['quantity'] ) ); |
|
| 517 | + $item->set_price(floatval($data['price'])); |
|
| 518 | + $item->set_name(sanitize_text_field($data['name'])); |
|
| 519 | + $item->set_description(wp_kses_post($data['description'])); |
|
| 520 | + $item->set_quantity(floatval($data['quantity'])); |
|
| 521 | 521 | |
| 522 | 522 | // Add it to the invoice. |
| 523 | - $error = $invoice->add_item( $item ); |
|
| 523 | + $error = $invoice->add_item($item); |
|
| 524 | 524 | $alert = false; |
| 525 | - if ( is_wp_error( $error ) ) { |
|
| 525 | + if (is_wp_error($error)) { |
|
| 526 | 526 | $alert = $error->get_error_message(); |
| 527 | 527 | } |
| 528 | 528 | |
@@ -535,11 +535,11 @@ discard block |
||
| 535 | 535 | // Return an array of invoice items. |
| 536 | 536 | $items = array(); |
| 537 | 537 | |
| 538 | - foreach ( $invoice->get_items() as $item ) { |
|
| 539 | - $items[] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
| 538 | + foreach ($invoice->get_items() as $item) { |
|
| 539 | + $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - wp_send_json_success( compact( 'items', 'alert' ) ); |
|
| 542 | + wp_send_json_success(compact('items', 'alert')); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
@@ -548,45 +548,45 @@ discard block |
||
| 548 | 548 | public static function create_invoice_item() { |
| 549 | 549 | |
| 550 | 550 | // Verify nonce. |
| 551 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 551 | + check_ajax_referer('wpinv-nonce'); |
|
| 552 | 552 | |
| 553 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 553 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 554 | 554 | exit; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | // We need an invoice and item details. |
| 558 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['data'] ) ) { |
|
| 558 | + if (empty($_POST['post_id']) || empty($_POST['data'])) { |
|
| 559 | 559 | exit; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | // Fetch the invoice. |
| 563 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
| 563 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
| 564 | 564 | |
| 565 | 565 | // Ensure it exists and its not been paid for. |
| 566 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
| 566 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
| 567 | 567 | exit; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | // Format the data. |
| 571 | - $data = wp_unslash( wp_list_pluck( $_POST['data'], 'value', 'field' ) ); |
|
| 571 | + $data = wp_unslash(wp_list_pluck($_POST['data'], 'value', 'field')); |
|
| 572 | 572 | |
| 573 | 573 | $item = new WPInv_Item(); |
| 574 | - $item->set_price( floatval( $data['price'] ) ); |
|
| 575 | - $item->set_name( sanitize_text_field( $data['name'] ) ); |
|
| 576 | - $item->set_description( wp_kses_post( $data['description'] ) ); |
|
| 577 | - $item->set_status( 'publish' ); |
|
| 574 | + $item->set_price(floatval($data['price'])); |
|
| 575 | + $item->set_name(sanitize_text_field($data['name'])); |
|
| 576 | + $item->set_description(wp_kses_post($data['description'])); |
|
| 577 | + $item->set_status('publish'); |
|
| 578 | 578 | $item->save(); |
| 579 | 579 | |
| 580 | - if ( ! $item->exists() ) { |
|
| 581 | - $alert = __( 'Could not create invoice item. Please try again.', 'invoicing' ); |
|
| 580 | + if (!$item->exists()) { |
|
| 581 | + $alert = __('Could not create invoice item. Please try again.', 'invoicing'); |
|
| 582 | 582 | } else { |
| 583 | - $item = new GetPaid_Form_Item( $item->get_id() ); |
|
| 584 | - $item->set_quantity( floatval( $data['quantity'] ) ); |
|
| 583 | + $item = new GetPaid_Form_Item($item->get_id()); |
|
| 584 | + $item->set_quantity(floatval($data['quantity'])); |
|
| 585 | 585 | |
| 586 | 586 | // Add it to the invoice. |
| 587 | - $error = $invoice->add_item( $item ); |
|
| 587 | + $error = $invoice->add_item($item); |
|
| 588 | 588 | $alert = false; |
| 589 | - if ( is_wp_error( $error ) ) { |
|
| 589 | + if (is_wp_error($error)) { |
|
| 590 | 590 | $alert = $error->get_error_message(); |
| 591 | 591 | } |
| 592 | 592 | |
@@ -601,11 +601,11 @@ discard block |
||
| 601 | 601 | // Return an array of invoice items. |
| 602 | 602 | $items = array(); |
| 603 | 603 | |
| 604 | - foreach ( $invoice->get_items() as $item ) { |
|
| 605 | - $items[] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
| 604 | + foreach ($invoice->get_items() as $item) { |
|
| 605 | + $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - wp_send_json_success( compact( 'items', 'alert' ) ); |
|
| 608 | + wp_send_json_success(compact('items', 'alert')); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -614,33 +614,33 @@ discard block |
||
| 614 | 614 | public static function remove_invoice_item() { |
| 615 | 615 | |
| 616 | 616 | // Verify nonce. |
| 617 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 617 | + check_ajax_referer('wpinv-nonce'); |
|
| 618 | 618 | |
| 619 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 619 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 620 | 620 | exit; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | // We need an invoice and an item. |
| 624 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['item_id'] ) ) { |
|
| 624 | + if (empty($_POST['post_id']) || empty($_POST['item_id'])) { |
|
| 625 | 625 | exit; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // Fetch the invoice. |
| 629 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
| 629 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
| 630 | 630 | |
| 631 | 631 | // Ensure it exists and its not been paid for. |
| 632 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
| 632 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
| 633 | 633 | exit; |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | // Abort if the invoice does not have the specified item. |
| 637 | - $item = $invoice->get_item( (int) $_POST['item_id'] ); |
|
| 637 | + $item = $invoice->get_item((int) $_POST['item_id']); |
|
| 638 | 638 | |
| 639 | - if ( empty( $item ) ) { |
|
| 639 | + if (empty($item)) { |
|
| 640 | 640 | exit; |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - $invoice->remove_item( (int) $_POST['item_id'] ); |
|
| 643 | + $invoice->remove_item((int) $_POST['item_id']); |
|
| 644 | 644 | |
| 645 | 645 | // Update totals. |
| 646 | 646 | $invoice->recalculate_total(); |
@@ -651,11 +651,11 @@ discard block |
||
| 651 | 651 | // Return an array of invoice items. |
| 652 | 652 | $items = array(); |
| 653 | 653 | |
| 654 | - foreach ( $invoice->get_items() as $item ) { |
|
| 655 | - $items[] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
| 654 | + foreach ($invoice->get_items() as $item) { |
|
| 655 | + $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - wp_send_json_success( compact( 'items' ) ); |
|
| 658 | + wp_send_json_success(compact('items')); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | /** |
@@ -664,39 +664,39 @@ discard block |
||
| 664 | 664 | public static function add_invoice_items() { |
| 665 | 665 | |
| 666 | 666 | // Verify nonce. |
| 667 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 667 | + check_ajax_referer('wpinv-nonce'); |
|
| 668 | 668 | |
| 669 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 669 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 670 | 670 | exit; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | // We need an invoice and items. |
| 674 | - if ( empty( $_POST['post_id'] ) || empty( $_POST['items'] ) ) { |
|
| 674 | + if (empty($_POST['post_id']) || empty($_POST['items'])) { |
|
| 675 | 675 | exit; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // Fetch the invoice. |
| 679 | - $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) ); |
|
| 679 | + $invoice = new WPInv_Invoice(trim($_POST['post_id'])); |
|
| 680 | 680 | $alert = false; |
| 681 | 681 | |
| 682 | 682 | // Ensure it exists and its not been paid for. |
| 683 | - if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) { |
|
| 683 | + if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) { |
|
| 684 | 684 | exit; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | // Add the items. |
| 688 | - foreach ( $_POST['items'] as $data ) { |
|
| 688 | + foreach ($_POST['items'] as $data) { |
|
| 689 | 689 | |
| 690 | - $item = new GetPaid_Form_Item( $data[ 'id' ] ); |
|
| 690 | + $item = new GetPaid_Form_Item($data['id']); |
|
| 691 | 691 | |
| 692 | - if ( is_numeric( $data[ 'qty' ] ) && (float) $data[ 'qty' ] > 0 ) { |
|
| 693 | - $item->set_quantity( $data[ 'qty' ] ); |
|
| 692 | + if (is_numeric($data['qty']) && (float) $data['qty'] > 0) { |
|
| 693 | + $item->set_quantity($data['qty']); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - if ( $item->get_id() > 0 ) { |
|
| 697 | - $error = $invoice->add_item( $item ); |
|
| 696 | + if ($item->get_id() > 0) { |
|
| 697 | + $error = $invoice->add_item($item); |
|
| 698 | 698 | |
| 699 | - if ( is_wp_error( $error ) ) { |
|
| 699 | + if (is_wp_error($error)) { |
|
| 700 | 700 | $alert = $error->get_error_message(); |
| 701 | 701 | } |
| 702 | 702 | |
@@ -711,11 +711,11 @@ discard block |
||
| 711 | 711 | // Return an array of invoice items. |
| 712 | 712 | $items = array(); |
| 713 | 713 | |
| 714 | - foreach ( $invoice->get_items() as $item ) { |
|
| 715 | - $items[] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() ); |
|
| 714 | + foreach ($invoice->get_items() as $item) { |
|
| 715 | + $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency()); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - wp_send_json_success( compact( 'items', 'alert' ) ); |
|
| 718 | + wp_send_json_success(compact('items', 'alert')); |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | /** |
@@ -724,15 +724,15 @@ discard block |
||
| 724 | 724 | public static function get_invoicing_items() { |
| 725 | 725 | |
| 726 | 726 | // Verify nonce. |
| 727 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 727 | + check_ajax_referer('wpinv-nonce'); |
|
| 728 | 728 | |
| 729 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 729 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 730 | 730 | exit; |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | // We need a search term. |
| 734 | - if ( empty( $_GET['search'] ) ) { |
|
| 735 | - wp_send_json_success( array() ); |
|
| 734 | + if (empty($_GET['search'])) { |
|
| 735 | + wp_send_json_success(array()); |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | // Retrieve items. |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | 'orderby' => 'title', |
| 742 | 742 | 'order' => 'ASC', |
| 743 | 743 | 'posts_per_page' => -1, |
| 744 | - 'post_status' => array( 'publish' ), |
|
| 745 | - 's' => trim( $_GET['search'] ), |
|
| 744 | + 'post_status' => array('publish'), |
|
| 745 | + 's' => trim($_GET['search']), |
|
| 746 | 746 | 'meta_query' => array( |
| 747 | 747 | array( |
| 748 | 748 | 'key' => '_wpinv_type', |
@@ -752,21 +752,21 @@ discard block |
||
| 752 | 752 | ) |
| 753 | 753 | ); |
| 754 | 754 | |
| 755 | - $items = get_posts( apply_filters( 'getpaid_ajax_invoice_items_query_args', $item_args ) ); |
|
| 755 | + $items = get_posts(apply_filters('getpaid_ajax_invoice_items_query_args', $item_args)); |
|
| 756 | 756 | $data = array(); |
| 757 | 757 | |
| 758 | - $is_payment_form = ( ! empty( $_GET['post_id'] ) && 'wpi_payment_form' == get_post_type( $_GET['post_id'] ) ); |
|
| 758 | + $is_payment_form = (!empty($_GET['post_id']) && 'wpi_payment_form' == get_post_type($_GET['post_id'])); |
|
| 759 | 759 | |
| 760 | - foreach ( $items as $item ) { |
|
| 761 | - $item = new GetPaid_Form_Item( $item ); |
|
| 760 | + foreach ($items as $item) { |
|
| 761 | + $item = new GetPaid_Form_Item($item); |
|
| 762 | 762 | $data[] = array( |
| 763 | 763 | 'id' => (int) $item->get_id(), |
| 764 | - 'text' => strip_tags( $item->get_name() ), |
|
| 765 | - 'form_data' => $is_payment_form ? $item->prepare_data_for_use( false ) : '', |
|
| 764 | + 'text' => strip_tags($item->get_name()), |
|
| 765 | + 'form_data' => $is_payment_form ? $item->prepare_data_for_use(false) : '', |
|
| 766 | 766 | ); |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - wp_send_json_success( $data ); |
|
| 769 | + wp_send_json_success($data); |
|
| 770 | 770 | |
| 771 | 771 | } |
| 772 | 772 | |
@@ -776,37 +776,37 @@ discard block |
||
| 776 | 776 | public static function get_customers() { |
| 777 | 777 | |
| 778 | 778 | // Verify nonce. |
| 779 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 779 | + check_ajax_referer('wpinv-nonce'); |
|
| 780 | 780 | |
| 781 | - if ( ! wpinv_current_user_can_manage_invoicing() ) { |
|
| 781 | + if (!wpinv_current_user_can_manage_invoicing()) { |
|
| 782 | 782 | exit; |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | // We need a search term. |
| 786 | - if ( empty( $_GET['search'] ) ) { |
|
| 787 | - wp_send_json_success( array() ); |
|
| 786 | + if (empty($_GET['search'])) { |
|
| 787 | + wp_send_json_success(array()); |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // Retrieve customers. |
| 791 | 791 | |
| 792 | 792 | $customer_args = array( |
| 793 | - 'fields' => array( 'ID', 'user_email', 'display_name' ), |
|
| 793 | + 'fields' => array('ID', 'user_email', 'display_name'), |
|
| 794 | 794 | 'orderby' => 'display_name', |
| 795 | - 'search' => '*' . sanitize_text_field( $_GET['search'] ) . '*', |
|
| 796 | - 'search_columns' => array( 'user_login', 'user_email', 'display_name' ), |
|
| 795 | + 'search' => '*' . sanitize_text_field($_GET['search']) . '*', |
|
| 796 | + 'search_columns' => array('user_login', 'user_email', 'display_name'), |
|
| 797 | 797 | ); |
| 798 | 798 | |
| 799 | - $customers = get_users( apply_filters( 'getpaid_ajax_invoice_customers_query_args', $customer_args ) ); |
|
| 799 | + $customers = get_users(apply_filters('getpaid_ajax_invoice_customers_query_args', $customer_args)); |
|
| 800 | 800 | $data = array(); |
| 801 | 801 | |
| 802 | - foreach ( $customers as $customer ) { |
|
| 802 | + foreach ($customers as $customer) { |
|
| 803 | 803 | $data[] = array( |
| 804 | 804 | 'id' => (int) $customer->ID, |
| 805 | - 'text' => strip_tags( sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email ) ), |
|
| 805 | + 'text' => strip_tags(sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email)), |
|
| 806 | 806 | ); |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - wp_send_json_success( $data ); |
|
| 809 | + wp_send_json_success($data); |
|
| 810 | 810 | |
| 811 | 811 | } |
| 812 | 812 | |
@@ -816,28 +816,28 @@ discard block |
||
| 816 | 816 | public static function get_aui_states_field() { |
| 817 | 817 | |
| 818 | 818 | // Verify nonce. |
| 819 | - check_ajax_referer( 'wpinv-nonce' ); |
|
| 819 | + check_ajax_referer('wpinv-nonce'); |
|
| 820 | 820 | |
| 821 | 821 | // We need a country. |
| 822 | - if ( empty( $_GET['country'] ) ) { |
|
| 822 | + if (empty($_GET['country'])) { |
|
| 823 | 823 | exit; |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | - $states = wpinv_get_country_states( sanitize_text_field( $_GET['country'] ) ); |
|
| 827 | - $state = isset( $_GET['state'] ) ? sanitize_text_field( $_GET['state'] ) : wpinv_get_default_state(); |
|
| 828 | - $name = isset( $_GET['name'] ) ? sanitize_text_field( $_GET['name'] ) : 'wpinv_state'; |
|
| 829 | - $class = isset( $_GET['class'] ) ? sanitize_text_field( $_GET['class'] ) : 'form-control-sm'; |
|
| 826 | + $states = wpinv_get_country_states(sanitize_text_field($_GET['country'])); |
|
| 827 | + $state = isset($_GET['state']) ? sanitize_text_field($_GET['state']) : wpinv_get_default_state(); |
|
| 828 | + $name = isset($_GET['name']) ? sanitize_text_field($_GET['name']) : 'wpinv_state'; |
|
| 829 | + $class = isset($_GET['class']) ? sanitize_text_field($_GET['class']) : 'form-control-sm'; |
|
| 830 | 830 | |
| 831 | - if ( empty( $states ) ) { |
|
| 831 | + if (empty($states)) { |
|
| 832 | 832 | |
| 833 | 833 | $html = aui()->input( |
| 834 | 834 | array( |
| 835 | 835 | 'type' => 'text', |
| 836 | 836 | 'id' => 'wpinv_state', |
| 837 | 837 | 'name' => $name, |
| 838 | - 'label' => __( 'State', 'invoicing' ), |
|
| 838 | + 'label' => __('State', 'invoicing'), |
|
| 839 | 839 | 'label_type' => 'vertical', |
| 840 | - 'placeholder' => __( 'State', 'invoicing' ), |
|
| 840 | + 'placeholder' => __('State', 'invoicing'), |
|
| 841 | 841 | 'class' => $class, |
| 842 | 842 | 'value' => $state, |
| 843 | 843 | ) |
@@ -849,9 +849,9 @@ discard block |
||
| 849 | 849 | array( |
| 850 | 850 | 'id' => 'wpinv_state', |
| 851 | 851 | 'name' => $name, |
| 852 | - 'label' => __( 'State', 'invoicing' ), |
|
| 852 | + 'label' => __('State', 'invoicing'), |
|
| 853 | 853 | 'label_type' => 'vertical', |
| 854 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
| 854 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
| 855 | 855 | 'class' => $class, |
| 856 | 856 | 'value' => $state, |
| 857 | 857 | 'options' => $states, |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | wp_send_json_success( |
| 866 | 866 | array( |
| 867 | 867 | 'html' => $html, |
| 868 | - 'select' => ! empty ( $states ) |
|
| 868 | + 'select' => !empty ($states) |
|
| 869 | 869 | ) |
| 870 | 870 | ); |
| 871 | 871 | |
@@ -879,11 +879,11 @@ discard block |
||
| 879 | 879 | public static function payment_form_refresh_prices() { |
| 880 | 880 | |
| 881 | 881 | // Check nonce. |
| 882 | - check_ajax_referer( 'getpaid_form_nonce' ); |
|
| 882 | + check_ajax_referer('getpaid_form_nonce'); |
|
| 883 | 883 | |
| 884 | 884 | // ... form fields... |
| 885 | - if ( empty( $_POST['getpaid_payment_form_submission'] ) ) { |
|
| 886 | - _e( 'Error: Reload the page and try again.', 'invoicing' ); |
|
| 885 | + if (empty($_POST['getpaid_payment_form_submission'])) { |
|
| 886 | + _e('Error: Reload the page and try again.', 'invoicing'); |
|
| 887 | 887 | exit; |
| 888 | 888 | } |
| 889 | 889 | |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | $submission = new GetPaid_Payment_Form_Submission(); |
| 892 | 892 | |
| 893 | 893 | // Do we have an error? |
| 894 | - if ( ! empty( $submission->last_error ) ) { |
|
| 894 | + if (!empty($submission->last_error)) { |
|
| 895 | 895 | wp_send_json_error( |
| 896 | 896 | array( |
| 897 | 897 | 'code' => $submission->last_error_code, |
@@ -901,12 +901,12 @@ discard block |
||
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | // Prepare the response. |
| 904 | - $response = new GetPaid_Payment_Form_Submission_Refresh_Prices( $submission ); |
|
| 904 | + $response = new GetPaid_Payment_Form_Submission_Refresh_Prices($submission); |
|
| 905 | 905 | |
| 906 | 906 | // Filter the response. |
| 907 | - $response = apply_filters( 'getpaid_payment_form_ajax_refresh_prices', $response->response, $submission ); |
|
| 907 | + $response = apply_filters('getpaid_payment_form_ajax_refresh_prices', $response->response, $submission); |
|
| 908 | 908 | |
| 909 | - wp_send_json_success( $response ); |
|
| 909 | + wp_send_json_success($response); |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | } |
@@ -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,10 +21,10 @@ 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 | // Invoice items. |
| 30 | 30 | $items = $invoice->get_items(); |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | $totals = array( |
| 33 | 33 | |
| 34 | 34 | 'subtotal' => array( |
| 35 | - 'label' => __( 'Items Subtotal', 'invoicing' ), |
|
| 36 | - 'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ), |
|
| 35 | + 'label' => __('Items Subtotal', 'invoicing'), |
|
| 36 | + 'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()), |
|
| 37 | 37 | ), |
| 38 | 38 | |
| 39 | 39 | 'discount' => array( |
| 40 | - 'label' => __( 'Total Discount', 'invoicing' ), |
|
| 41 | - 'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ), |
|
| 40 | + 'label' => __('Total Discount', 'invoicing'), |
|
| 41 | + 'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()), |
|
| 42 | 42 | ), |
| 43 | 43 | |
| 44 | 44 | 'tax' => array( |
| 45 | - 'label' => __( 'Total Tax', 'invoicing' ), |
|
| 46 | - 'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ), |
|
| 45 | + 'label' => __('Total Tax', 'invoicing'), |
|
| 46 | + 'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()), |
|
| 47 | 47 | ), |
| 48 | 48 | |
| 49 | 49 | 'total' => array( |
| 50 | - 'label' => __( 'Invoice Total', 'invoicing' ), |
|
| 51 | - 'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ), |
|
| 50 | + 'label' => __('Invoice Total', 'invoicing'), |
|
| 51 | + 'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()), |
|
| 52 | 52 | ) |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - if ( ! wpinv_use_taxes() ) { |
|
| 56 | - unset( $totals['tax'] ); |
|
| 55 | + if (!wpinv_use_taxes()) { |
|
| 56 | + unset($totals['tax']); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $item_args = array( |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'orderby' => 'title', |
| 62 | 62 | 'order' => 'ASC', |
| 63 | 63 | 'posts_per_page' => -1, |
| 64 | - 'post_status' => array( 'publish' ), |
|
| 64 | + 'post_status' => array('publish'), |
|
| 65 | 65 | 'meta_query' => array( |
| 66 | 66 | array( |
| 67 | 67 | 'key' => '_wpinv_type', |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | </style> |
| 87 | 87 | |
| 88 | - <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class( $invoice->get_template( 'edit' ) ); ?> <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem"> |
|
| 88 | + <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class($invoice->get_template('edit')); ?> <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem"> |
|
| 89 | 89 | |
| 90 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
| 91 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
| 90 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
| 91 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
| 92 | 92 | |
| 93 | 93 | <div class="row"> |
| 94 | 94 | <div class="col-12 col-sm-6"> |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | array( |
| 98 | 98 | 'id' => 'wpinv_template', |
| 99 | 99 | 'name' => 'wpinv_template', |
| 100 | - 'label' => __( 'Template', 'invoicing' ), |
|
| 100 | + 'label' => __('Template', 'invoicing'), |
|
| 101 | 101 | 'label_type' => 'vertical', |
| 102 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
| 102 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
| 103 | 103 | 'class' => 'form-control-sm', |
| 104 | - 'value' => $invoice->get_template( 'edit' ), |
|
| 104 | + 'value' => $invoice->get_template('edit'), |
|
| 105 | 105 | 'options' => array( |
| 106 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
| 107 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
| 108 | - 'amount' => __( 'Amount Only', 'invoicing' ), |
|
| 106 | + 'quantity' => __('Quantity', 'invoicing'), |
|
| 107 | + 'hours' => __('Hours', 'invoicing'), |
|
| 108 | + 'amount' => __('Amount Only', 'invoicing'), |
|
| 109 | 109 | ), |
| 110 | 110 | 'data-allow-clear' => 'false', |
| 111 | 111 | 'select2' => true, |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | array( |
| 122 | 122 | 'id' => 'wpinv_currency', |
| 123 | 123 | 'name' => 'wpinv_currency', |
| 124 | - 'label' => __( 'Currency', 'invoicing' ), |
|
| 124 | + 'label' => __('Currency', 'invoicing'), |
|
| 125 | 125 | 'label_type' => 'vertical', |
| 126 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
| 126 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
| 127 | 127 | 'class' => 'form-control-sm', |
| 128 | - 'value' => $invoice->get_currency( 'edit' ), |
|
| 128 | + 'value' => $invoice->get_currency('edit'), |
|
| 129 | 129 | 'required' => false, |
| 130 | 130 | 'data-allow-clear' => 'false', |
| 131 | 131 | 'select2' => true, |
@@ -137,24 +137,24 @@ discard block |
||
| 137 | 137 | </div> |
| 138 | 138 | </div> |
| 139 | 139 | |
| 140 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
| 140 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
| 141 | 141 | <?php endif; ?> |
| 142 | 142 | |
| 143 | 143 | <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items"> |
| 144 | 144 | <thead> |
| 145 | 145 | <tr> |
| 146 | - <th class="getpaid-item" colspan="2"><?php _e( 'Item', 'invoicing' ) ?></th> |
|
| 146 | + <th class="getpaid-item" colspan="2"><?php _e('Item', 'invoicing') ?></th> |
|
| 147 | 147 | <th class="getpaid-quantity hide-if-amount text-right"> |
| 148 | - <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span> |
|
| 149 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span> |
|
| 148 | + <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span> |
|
| 149 | + <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span> |
|
| 150 | 150 | </th> |
| 151 | 151 | <th class="getpaid-price hide-if-amount text-right"> |
| 152 | - <span class="getpaid-hide-if-hours"><?php _e( 'Price', 'invoicing' ) ?></span> |
|
| 153 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Rate', 'invoicing' ) ?></span> |
|
| 152 | + <span class="getpaid-hide-if-hours"><?php _e('Price', 'invoicing') ?></span> |
|
| 153 | + <span class="getpaid-hide-if-quantity"><?php _e('Rate', 'invoicing') ?></span> |
|
| 154 | 154 | </th> |
| 155 | 155 | <th class="getpaid-item-subtotal text-right"> |
| 156 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e( 'Amount', 'invoicing' ) ?></span> |
|
| 157 | - <span class="hide-if-amount"><?php _e( 'Total', 'invoicing' ) ?></span> |
|
| 156 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e('Amount', 'invoicing') ?></span> |
|
| 157 | + <span class="hide-if-amount"><?php _e('Total', 'invoicing') ?></span> |
|
| 158 | 158 | </th> |
| 159 | 159 | <th class="getpaid-item-actions hide-if-not-editable" width="70px"> </th> |
| 160 | 160 | </tr> |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | <tbody class="getpaid_invoice_line_items"> |
| 163 | 163 | <tr class="hide-if-has-items hide-if-not-editable"> |
| 164 | 164 | <td colspan="2" class="pt-4 pb-4"> |
| 165 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Items', 'invoicing' ) ?></button> |
|
| 166 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button> |
|
| 165 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Items', 'invoicing') ?></button> |
|
| 166 | + <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button> |
|
| 167 | 167 | </td> |
| 168 | 168 | <td class="hide-if-amount"> </th> |
| 169 | 169 | <td class="hide-if-amount"> </th> |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | <div class="col-12 col-sm-6 offset-sm-6"> |
| 196 | 196 | <table class="getpaid-invoice-totals text-right w-100"> |
| 197 | 197 | <tbody> |
| 198 | - <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?> |
|
| 199 | - <tr class="getpaid-totals-<?php echo sanitize_html_class( $key ); ?>"> |
|
| 200 | - <td class="label"><?php echo sanitize_text_field( $data['label'] ) ?>:</td> |
|
| 198 | + <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?> |
|
| 199 | + <tr class="getpaid-totals-<?php echo sanitize_html_class($key); ?>"> |
|
| 200 | + <td class="label"><?php echo sanitize_text_field($data['label']) ?>:</td> |
|
| 201 | 201 | <td width="1%"></td> |
| 202 | - <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td> |
|
| 202 | + <td class="value"><?php echo wp_kses_post($data['value']) ?></td> |
|
| 203 | 203 | </tr> |
| 204 | 204 | <?php endforeach; ?> |
| 205 | 205 | </tbody> |
@@ -212,18 +212,18 @@ discard block |
||
| 212 | 212 | <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable"> |
| 213 | 213 | <div class="row"> |
| 214 | 214 | <div class="text-left col-12 col-sm-8"> |
| 215 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Item', 'invoicing' ) ?></button> |
|
| 216 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button> |
|
| 217 | - <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?> |
|
| 215 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Item', 'invoicing') ?></button> |
|
| 216 | + <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button> |
|
| 217 | + <?php do_action('getpaid-invoice-items-actions', $invoice); ?> |
|
| 218 | 218 | </div> |
| 219 | 219 | <div class="text-right col-12 col-sm-4"> |
| 220 | - <button type="button" class="button button-primary recalculate-totals-button"><?php _e( 'Recalculate Totals', 'invoicing' ) ?></button> |
|
| 220 | + <button type="button" class="button button-primary recalculate-totals-button"><?php _e('Recalculate Totals', 'invoicing') ?></button> |
|
| 221 | 221 | </div> |
| 222 | 222 | </div> |
| 223 | 223 | </div> |
| 224 | 224 | |
| 225 | 225 | <div class="getpaid-invoice-item-actions hide-if-editable"> |
| 226 | - <p class="description m-2 text-right text-muted"><?php _e( 'This invoice is no longer editable', 'invoicing' ); ?></p> |
|
| 226 | + <p class="description m-2 text-right text-muted"><?php _e('This invoice is no longer editable', 'invoicing'); ?></p> |
|
| 227 | 227 | </div> |
| 228 | 228 | |
| 229 | 229 | <!-- Add items to an invoice --> |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | <div class="modal-dialog modal-dialog-centered" role="document"> |
| 232 | 232 | <div class="modal-content"> |
| 233 | 233 | <div class="modal-header"> |
| 234 | - <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e( "Add Item(s)", 'invoicing' ); ?></h5> |
|
| 235 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
| 234 | + <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e("Add Item(s)", 'invoicing'); ?></h5> |
|
| 235 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
| 236 | 236 | <span aria-hidden="true">×</span> |
| 237 | 237 | </button> |
| 238 | 238 | </div> |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | <table class="widefat"> |
| 241 | 241 | <thead> |
| 242 | 242 | <tr> |
| 243 | - <th class="pl-0 text-left"><?php _e( 'Item', 'invoicing' ) ?></th> |
|
| 243 | + <th class="pl-0 text-left"><?php _e('Item', 'invoicing') ?></th> |
|
| 244 | 244 | <th class="pr-0 text-right hide-if-amount"> |
| 245 | - <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span> |
|
| 246 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span> |
|
| 245 | + <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span> |
|
| 246 | + <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span> |
|
| 247 | 247 | </th> |
| 248 | 248 | </tr> |
| 249 | 249 | </thead> |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | <tr> |
| 252 | 252 | <td class="pl-0 text-left"> |
| 253 | 253 | <select class="regular-text getpaid-add-invoice-item-select"> |
| 254 | - <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option> |
|
| 255 | - <?php foreach ( get_posts( $item_args ) as $item ) : ?> |
|
| 256 | - <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags( $item->post_title ); ?></option> |
|
| 254 | + <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option> |
|
| 255 | + <?php foreach (get_posts($item_args) as $item) : ?> |
|
| 256 | + <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags($item->post_title); ?></option> |
|
| 257 | 257 | <?php endforeach; ?> |
| 258 | 258 | </select> |
| 259 | 259 | </td> |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | </table> |
| 266 | 266 | </div> |
| 267 | 267 | <div class="modal-footer"> |
| 268 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
| 269 | - <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e( 'Add', 'invoicing' ); ?></button> |
|
| 268 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
| 269 | + <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e('Add', 'invoicing'); ?></button> |
|
| 270 | 270 | </div> |
| 271 | 271 | </div> |
| 272 | 272 | </div> |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | <div class="modal-dialog modal-dialog-centered" role="document"> |
| 278 | 278 | <div class="modal-content"> |
| 279 | 279 | <div class="modal-header"> |
| 280 | - <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e( "Create Item", 'invoicing' ); ?></h5> |
|
| 281 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
| 280 | + <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e("Create Item", 'invoicing'); ?></h5> |
|
| 281 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
| 282 | 282 | <span aria-hidden="true">×</span> |
| 283 | 283 | </button> |
| 284 | 284 | </div> |
@@ -286,27 +286,27 @@ discard block |
||
| 286 | 286 | <div class="getpaid-create-item-div"> |
| 287 | 287 | <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id"> |
| 288 | 288 | <label class="form-group w-100"> |
| 289 | - <span><?php _e( 'Name', 'invoicing' ); ?></span> |
|
| 290 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
| 289 | + <span><?php _e('Name', 'invoicing'); ?></span> |
|
| 290 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
| 291 | 291 | </label> |
| 292 | 292 | <label class="form-group w-100"> |
| 293 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span> |
|
| 294 | - <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span> |
|
| 295 | - <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
| 293 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span> |
|
| 294 | + <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span> |
|
| 295 | + <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
| 296 | 296 | </label> |
| 297 | 297 | <label class="form-group w-100 hide-if-amount"> |
| 298 | - <span><?php _e( 'Quantity', 'invoicing' ); ?></span> |
|
| 298 | + <span><?php _e('Quantity', 'invoicing'); ?></span> |
|
| 299 | 299 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
| 300 | 300 | </label> |
| 301 | 301 | <label class="form-group w-100"> |
| 302 | - <span><?php _e( 'Item Description', 'invoicing' ); ?></span> |
|
| 303 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
| 302 | + <span><?php _e('Item Description', 'invoicing'); ?></span> |
|
| 303 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
| 304 | 304 | </label> |
| 305 | 305 | </div> |
| 306 | 306 | </div> |
| 307 | 307 | <div class="modal-footer"> |
| 308 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
| 309 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Create', 'invoicing' ); ?></button> |
|
| 308 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
| 309 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Create', 'invoicing'); ?></button> |
|
| 310 | 310 | </div> |
| 311 | 311 | </div> |
| 312 | 312 | </div> |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | <div class="modal-dialog modal-dialog-centered" role="document"> |
| 318 | 318 | <div class="modal-content"> |
| 319 | 319 | <div class="modal-header"> |
| 320 | - <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e( "Edit Item", 'invoicing' ); ?></h5> |
|
| 321 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
| 320 | + <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e("Edit Item", 'invoicing'); ?></h5> |
|
| 321 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
| 322 | 322 | <span aria-hidden="true">×</span> |
| 323 | 323 | </button> |
| 324 | 324 | </div> |
@@ -326,27 +326,27 @@ discard block |
||
| 326 | 326 | <div class="getpaid-edit-item-div"> |
| 327 | 327 | <input type="hidden" name="id" class="form-control form-control-sm item-id"> |
| 328 | 328 | <label class="form-group w-100"> |
| 329 | - <span><?php _e( 'Name', 'invoicing' ); ?></span> |
|
| 330 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
| 329 | + <span><?php _e('Name', 'invoicing'); ?></span> |
|
| 330 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
| 331 | 331 | </label> |
| 332 | 332 | <label class="form-group w-100"> |
| 333 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span> |
|
| 334 | - <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span> |
|
| 335 | - <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
| 333 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span> |
|
| 334 | + <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span> |
|
| 335 | + <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
| 336 | 336 | </label> |
| 337 | 337 | <label class="form-group w-100 hide-if-amount"> |
| 338 | - <span><?php _e( 'Quantity', 'invoicing' ); ?></span> |
|
| 338 | + <span><?php _e('Quantity', 'invoicing'); ?></span> |
|
| 339 | 339 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
| 340 | 340 | </label> |
| 341 | 341 | <label class="form-group w-100"> |
| 342 | - <span><?php _e( 'Item Description', 'invoicing' ); ?></span> |
|
| 343 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
| 342 | + <span><?php _e('Item Description', 'invoicing'); ?></span> |
|
| 343 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
| 344 | 344 | </label> |
| 345 | 345 | </div> |
| 346 | 346 | </div> |
| 347 | 347 | <div class="modal-footer"> |
| 348 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
| 349 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Save', 'invoicing' ); ?></button> |
|
| 348 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
| 349 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Save', 'invoicing'); ?></button> |
|
| 350 | 350 | </div> |
| 351 | 351 | </div> |
| 352 | 352 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | $aui_settings = AyeCode_UI_Settings::instance(); |
| 10 | 10 | $aui_settings->enqueue_scripts(); |
@@ -17,15 +17,15 @@ discard block |
||
| 17 | 17 | <head> |
| 18 | 18 | <meta name="viewport" content="width=device-width"/> |
| 19 | 19 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 20 | - <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
|
| 20 | + <title><?php esc_html_e('GetPaid › Setup Wizard', 'invoicing'); ?></title> |
|
| 21 | 21 | <?php |
| 22 | 22 | getpaid_admin()->enqeue_scripts(); |
| 23 | - wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
| 24 | - wp_print_styles( 'select2' ); |
|
| 25 | - wp_print_scripts( 'select2' ); |
|
| 26 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
| 27 | - do_action( 'admin_print_styles' ); |
|
| 28 | - do_action( 'admin_head' ); |
|
| 23 | + wp_enqueue_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0'); |
|
| 24 | + wp_print_styles('select2'); |
|
| 25 | + wp_print_scripts('select2'); |
|
| 26 | + wp_print_scripts('wpinv-admin-script'); |
|
| 27 | + do_action('admin_print_styles'); |
|
| 28 | + do_action('admin_head'); |
|
| 29 | 29 | ?> |
| 30 | 30 | <style> |
| 31 | 31 | body, p{ |
@@ -37,21 +37,21 @@ discard block |
||
| 37 | 37 | font-weight: 500; |
| 38 | 38 | margin-bottom: .1rem; |
| 39 | 39 | } |
| 40 | - <?php echo $aui_settings::css_primary( '#009874', true ); ?> |
|
| 40 | + <?php echo $aui_settings::css_primary('#009874', true); ?> |
|
| 41 | 41 | </style> |
| 42 | 42 | </head> |
| 43 | 43 | |
| 44 | 44 | <body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;"> |
| 45 | 45 | |
| 46 | - <?php if ( isset( $_REQUEST['step'] ) ) : ?> |
|
| 46 | + <?php if (isset($_REQUEST['step'])) : ?> |
|
| 47 | 47 | <ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center"> |
| 48 | - <?php foreach ( $steps as $step => $data ) : ?> |
|
| 48 | + <?php foreach ($steps as $step => $data) : ?> |
|
| 49 | 49 | <li class="list-group-item flex-fill rounded-0 <?php |
| 50 | 50 | echo $step == $current ? 'active' : 'd-none d-md-block'; |
| 51 | - echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? ' done' : ''; |
|
| 51 | + echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? ' done' : ''; |
|
| 52 | 52 | ?>"> |
| 53 | - <i class="far fa-check-circle <?php echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? 'text-success' : '' ;?>"></i> |
|
| 54 | - <?php echo esc_html( $data['name'] ); ?> |
|
| 53 | + <i class="far fa-check-circle <?php echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? 'text-success' : ''; ?>"></i> |
|
| 54 | + <?php echo esc_html($data['name']); ?> |
|
| 55 | 55 | </li> |
| 56 | 56 | <?php endforeach; ?> |
| 57 | 57 | </ol> |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | <div class="text-center pb-3 mt-5"> |
| 63 | 63 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
| 64 | 64 | <span class="text-black-50"> |
| 65 | - <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" /> |
|
| 65 | + <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" /> |
|
| 66 | 66 | </span> |
| 67 | 67 | </a> |
| 68 | 68 | </div> |
| 69 | 69 | \ No newline at end of file |
@@ -55,9 +55,12 @@ |
||
| 55 | 55 | </li> |
| 56 | 56 | <?php endforeach; ?> |
| 57 | 57 | </ol> |
| 58 | - <?php else: ?> |
|
| 58 | + <?php else { |
|
| 59 | + : ?> |
|
| 59 | 60 | <div class='mb-3'> </div> |
| 60 | - <?php endif; ?> |
|
| 61 | + <?php endif; |
|
| 62 | +} |
|
| 63 | +?> |
|
| 61 | 64 | |
| 62 | 65 | <div class="text-center pb-3 mt-5"> |
| 63 | 66 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
@@ -4,15 +4,15 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | ?> |
| 10 | 10 | |
| 11 | 11 | <div class="card shadow-sm my-5"> |
| 12 | 12 | |
| 13 | 13 | <form method="post" class="text-left card-body" action="options.php"> |
| 14 | - <?php settings_fields( 'wpinv_settings' ); ?> |
|
| 15 | - <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $next_url ); ?>"> |
|
| 14 | + <?php settings_fields('wpinv_settings'); ?> |
|
| 15 | + <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($next_url); ?>"> |
|
| 16 | 16 | |
| 17 | 17 | <table class="gp-setup-maps w-100 " cellspacing="0"> |
| 18 | 18 | <tbody> |
@@ -20,28 +20,28 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | global $wp_settings_fields; |
| 22 | 22 | |
| 23 | - if ( isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
| 24 | - $settings = $wp_settings_fields[ $page ][ $section ]; |
|
| 23 | + if (isset($wp_settings_fields[$page][$section])) { |
|
| 24 | + $settings = $wp_settings_fields[$page][$section]; |
|
| 25 | 25 | |
| 26 | - foreach ( $settings as $field ) { |
|
| 26 | + foreach ($settings as $field) { |
|
| 27 | 27 | |
| 28 | - $name = esc_attr( $field['id'] ); |
|
| 29 | - $id = sanitize_key( $name ); |
|
| 28 | + $name = esc_attr($field['id']); |
|
| 29 | + $id = sanitize_key($name); |
|
| 30 | 30 | $class = ''; |
| 31 | - $value = isset( $field['args']['std'] ) ? $field['args']['std'] : ''; |
|
| 32 | - $value = wpinv_clean( wpinv_get_option( $field['args']['id'], $value ) ); |
|
| 33 | - $help_text = isset( $field['args']['desc'] ) ? wp_kses_post( $field['args']['desc'] ) : ''; |
|
| 34 | - $type = str_replace( 'wpinv_', '', str_replace( '_callback', '', $field['callback'] ) ); |
|
| 35 | - $label = isset( $field['args']['name'] ) ? wp_kses_post( $field['args']['name'] ) : ''; |
|
| 36 | - $options = isset( $field['args']['options'] ) ? $field['args']['options'] : array(); |
|
| 31 | + $value = isset($field['args']['std']) ? $field['args']['std'] : ''; |
|
| 32 | + $value = wpinv_clean(wpinv_get_option($field['args']['id'], $value)); |
|
| 33 | + $help_text = isset($field['args']['desc']) ? wp_kses_post($field['args']['desc']) : ''; |
|
| 34 | + $type = str_replace('wpinv_', '', str_replace('_callback', '', $field['callback'])); |
|
| 35 | + $label = isset($field['args']['name']) ? wp_kses_post($field['args']['name']) : ''; |
|
| 36 | + $options = isset($field['args']['options']) ? $field['args']['options'] : array(); |
|
| 37 | 37 | |
| 38 | - if ( false !== strpos( $name, 'logo') ) { |
|
| 38 | + if (false !== strpos($name, 'logo')) { |
|
| 39 | 39 | $type = 'hidden'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if ( 'country_states' == $type ) { |
|
| 42 | + if ('country_states' == $type) { |
|
| 43 | 43 | |
| 44 | - if ( 0 == count( wpinv_get_country_states( wpinv_get_default_country() ) ) ) { |
|
| 44 | + if (0 == count(wpinv_get_country_states(wpinv_get_default_country()))) { |
|
| 45 | 45 | $type = 'text'; |
| 46 | 46 | } else { |
| 47 | 47 | $type = 'select'; |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | $class = 'getpaid_js_field-state'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ( 'wpinv_settings[default_country]' == $name ) { |
|
| 53 | + if ('wpinv_settings[default_country]' == $name) { |
|
| 54 | 54 | $class = 'getpaid_js_field-country'; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - switch ( $type ) { |
|
| 57 | + switch ($type) { |
|
| 58 | 58 | |
| 59 | 59 | case 'hidden': |
| 60 | 60 | echo "<input type='hidden' id='$id' name='$name' value='$value' />"; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'type' => $type, |
| 67 | 67 | 'id' => $id, |
| 68 | 68 | 'name' => $name, |
| 69 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 69 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
| 70 | 70 | 'required' => false, |
| 71 | 71 | 'help_text' => $help_text, |
| 72 | 72 | 'label' => $label, |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | array( |
| 83 | 83 | 'id' => $id, |
| 84 | 84 | 'name' => $name, |
| 85 | - 'value' => is_scalar( $value ) ? esc_textarea( $value ) : '', |
|
| 85 | + 'value' => is_scalar($value) ? esc_textarea($value) : '', |
|
| 86 | 86 | 'required' => false, |
| 87 | 87 | 'help_text' => $help_text, |
| 88 | 88 | 'label' => $label, |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | 96 | // Bug fixed in AUI 0.1.51 for name stripping [] |
| 97 | - echo str_replace( sanitize_html_class( $name ), esc_attr( $name ), $textarea ); |
|
| 97 | + echo str_replace(sanitize_html_class($name), esc_attr($name), $textarea); |
|
| 98 | 98 | |
| 99 | 99 | break; |
| 100 | 100 | case 'select': |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'id' => $id, |
| 104 | 104 | 'name' => $name, |
| 105 | 105 | 'placeholder' => '', |
| 106 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
| 106 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
| 107 | 107 | 'required' => false, |
| 108 | 108 | 'help_text' => $help_text, |
| 109 | 109 | 'label' => $label, |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | <input |
| 129 | 129 | type="submit" |
| 130 | 130 | class="btn btn-primary button-next" |
| 131 | - value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/> |
|
| 131 | + value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/> |
|
| 132 | 132 | </p> |
| 133 | 133 | </table> |
| 134 | 134 | </form> |
@@ -4,78 +4,78 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | ?> |
| 10 | 10 | |
| 11 | 11 | <div class="card shadow-sm my-5"> |
| 12 | 12 | |
| 13 | 13 | <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"> |
| 14 | - <?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?> |
|
| 14 | + <?php esc_html_e('Welcome to GetPaid!', 'invoicing'); ?> |
|
| 15 | 15 | </h1> |
| 16 | 16 | |
| 17 | 17 | <div class="card-body text-muted "> |
| 18 | - <p><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p> |
|
| 18 | + <p><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p> |
|
| 19 | 19 | <hr class="mt-4 pt-3 pb-0" /> |
| 20 | - <p class="small"><?php _e( 'This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes</b>.', 'invoicing' ); ?></p> |
|
| 20 | + <p class="small"><?php _e('This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes</b>.', 'invoicing'); ?></p> |
|
| 21 | 21 | </div> |
| 22 | 22 | |
| 23 | 23 | <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0"> |
| 24 | 24 | <a |
| 25 | - href="<?php echo esc_url( $next_url ); ?>" |
|
| 26 | - class="btn btn-primary button-next"><?php esc_html_e( "Let's go!", 'invoicing' ); ?></a> |
|
| 25 | + href="<?php echo esc_url($next_url); ?>" |
|
| 26 | + class="btn btn-primary button-next"><?php esc_html_e("Let's go!", 'invoicing'); ?></a> |
|
| 27 | 27 | <a |
| 28 | - href="<?php echo esc_url( admin_url() ); ?>" |
|
| 29 | - class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a> |
|
| 28 | + href="<?php echo esc_url(admin_url()); ?>" |
|
| 29 | + class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a> |
|
| 30 | 30 | </div> |
| 31 | 31 | </div> |
| 32 | 32 | |
| 33 | 33 | <div class="card shadow-sm my-5"> |
| 34 | 34 | <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"> |
| 35 | - <?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?> |
|
| 35 | + <?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?> |
|
| 36 | 36 | </h1> |
| 37 | 37 | |
| 38 | 38 | <div class="card-body text-muted overflow-hidden"> |
| 39 | - <p><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p> |
|
| 39 | + <p><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p> |
|
| 40 | 40 | <hr> |
| 41 | 41 | |
| 42 | 42 | <div class="row row-cols-2 text-left"> |
| 43 | 43 | <div class="col mt-3"> |
| 44 | 44 | <div class="media"> |
| 45 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="..."> |
|
| 45 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="..."> |
|
| 46 | 46 | <div class="media-body"> |
| 47 | - <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via Buy Now Buttons', 'invoicing' );?></h6> |
|
| 48 | - <small><?php _e( 'Sell via buy now buttons anywhere on your site', 'invoicing' );?></small> |
|
| 47 | + <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6> |
|
| 48 | + <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small> |
|
| 49 | 49 | </div> |
| 50 | 50 | </div> |
| 51 | 51 | </div> |
| 52 | 52 | |
| 53 | 53 | <div class="col mt-3"> |
| 54 | 54 | <div class="media"> |
| 55 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="..."> |
|
| 55 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="..."> |
|
| 56 | 56 | <div class="media-body"> |
| 57 | - <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via payment form', 'invoicing' );?></h6> |
|
| 58 | - <small><?php _e( 'Payment forms are conversion-optimized checkout forms', 'invoicing' );?></small> |
|
| 57 | + <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6> |
|
| 58 | + <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small> |
|
| 59 | 59 | </div> |
| 60 | 60 | </div> |
| 61 | 61 | </div> |
| 62 | 62 | |
| 63 | 63 | <div class="col mt-3"> |
| 64 | 64 | <div class="media"> |
| 65 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="..."> |
|
| 65 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="..."> |
|
| 66 | 66 | <div class="media-body"> |
| 67 | - <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6> |
|
| 68 | - <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard','invoicing');?></small> |
|
| 67 | + <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6> |
|
| 68 | + <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard', 'invoicing'); ?></small> |
|
| 69 | 69 | </div> |
| 70 | 70 | </div> |
| 71 | 71 | </div> |
| 72 | 72 | |
| 73 | 73 | <div class="col mt-3"> |
| 74 | 74 | <div class="media"> |
| 75 | - <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="..."> |
|
| 75 | + <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="..."> |
|
| 76 | 76 | <div class="media-body"> |
| 77 | - <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6> |
|
| 78 | - <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small> |
|
| 77 | + <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6> |
|
| 78 | + <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small> |
|
| 79 | 79 | </div> |
| 80 | 80 | </div> |
| 81 | 81 | </div> |
@@ -86,51 +86,51 @@ discard block |
||
| 86 | 86 | <div class="mt-5"> |
| 87 | 87 | <a |
| 88 | 88 | href="https://wpgetpaid.com/features-list/" |
| 89 | - class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a> |
|
| 89 | + class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a> |
|
| 90 | 90 | </div> |
| 91 | 91 | |
| 92 | 92 | <div class="mt-5 mx-n4 py-4" style="background:#eafaf6;"> |
| 93 | - <h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e( 'More with Membership!' , 'invoicing' );?></h4> |
|
| 93 | + <h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4> |
|
| 94 | 94 | <div class="row row-cols-2 text-left px-5"> |
| 95 | 95 | |
| 96 | 96 | <div class="col"> |
| 97 | 97 | <ul class="list-unstyled"> |
| 98 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'PDF Invoices' , 'invoicing' );?></li> |
|
| 99 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Gravity Forms' , 'invoicing' );?></li> |
|
| 100 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Contact form 7' , 'invoicing' );?></li> |
|
| 101 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'AffiliateWP Integration' , 'invoicing' );?></li> |
|
| 98 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('PDF Invoices', 'invoicing'); ?></li> |
|
| 99 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Gravity Forms', 'invoicing'); ?></li> |
|
| 100 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Contact form 7', 'invoicing'); ?></li> |
|
| 101 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('AffiliateWP Integration', 'invoicing'); ?></li> |
|
| 102 | 102 | </ul> |
| 103 | 103 | </div> |
| 104 | 104 | |
| 105 | 105 | <div class="col"> |
| 106 | 106 | <ul class="list-unstyled"> |
| 107 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Ninja forms' , 'invoicing' );?></li> |
|
| 108 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Digital Downloads' , 'invoicing' );?></li> |
|
| 109 | - <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Wallet' , 'invoicing' );?></li> |
|
| 107 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Ninja forms', 'invoicing'); ?></li> |
|
| 108 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Digital Downloads', 'invoicing'); ?></li> |
|
| 109 | + <li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Wallet', 'invoicing'); ?></li> |
|
| 110 | 110 | </ul> |
| 111 | 111 | </div> |
| 112 | 112 | </div> |
| 113 | 113 | |
| 114 | - <h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5> |
|
| 115 | - <h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e( '$49', 'invoicing' ); ?></h1> |
|
| 114 | + <h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5> |
|
| 115 | + <h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e('$49', 'invoicing'); ?></h1> |
|
| 116 | 116 | |
| 117 | 117 | <div class="mt-2"> |
| 118 | 118 | <a |
| 119 | 119 | href="https://wpgetpaid.com/downloads/membership/" |
| 120 | - class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a> |
|
| 120 | + class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a> |
|
| 121 | 121 | </div> |
| 122 | 122 | |
| 123 | 123 | </div> |
| 124 | 124 | |
| 125 | 125 | <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0"> |
| 126 | 126 | <a |
| 127 | - href="<?php echo esc_url( $next_url ); ?>" |
|
| 128 | - class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a> |
|
| 127 | + href="<?php echo esc_url($next_url); ?>" |
|
| 128 | + class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a> |
|
| 129 | 129 | <a |
| 130 | 130 | href="https://docs.wpgetpaid.com/" |
| 131 | - class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a> |
|
| 131 | + class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a> |
|
| 132 | 132 | <a |
| 133 | - href="<?php echo esc_url( admin_url() ); ?>" |
|
| 134 | - class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a> |
|
| 133 | + href="<?php echo esc_url(admin_url()); ?>" |
|
| 134 | + class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a> |
|
| 135 | 135 | </div> |
| 136 | 136 | </div> |