@@ -7,31 +7,31 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class='form-group'> |
15 | 15 | <label class="d-block"> |
16 | - <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span> |
|
16 | + <span><?php esc_html_e('Field Label', 'invoicing'); ?></span> |
|
17 | 17 | <input v-model='active_form_element.label' class='form-control' type="text"/> |
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | |
21 | 21 | <div class='form-group'> |
22 | 22 | <label class="d-block"> |
23 | - <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span> |
|
24 | - <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | - <small class="form-text text-muted"><?php esc_html_e( 'HTML is allowed', 'invoicing' ); ?></small> |
|
23 | + <span><?php esc_html_e('Help Text', 'invoicing'); ?></span> |
|
24 | + <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea> |
|
25 | + <small class="form-text text-muted"><?php esc_html_e('HTML is allowed', 'invoicing'); ?></small> |
|
26 | 26 | </label> |
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class='form-group form-check'> |
30 | 30 | <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' /> |
31 | - <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label> |
|
31 | + <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class='form-group form-check'> |
35 | 35 | <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' /> |
36 | - <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label> |
|
36 | + <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label> |
|
37 | 37 | </div> |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Prepare the company name. |
13 | -$company_name = wpinv_get_option( 'vat_company_name' ); |
|
13 | +$company_name = wpinv_get_option('vat_company_name'); |
|
14 | 14 | |
15 | -if ( empty( $company_name ) ) { |
|
15 | +if (empty($company_name)) { |
|
16 | 16 | $company_name = wpinv_get_business_name(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Prepare the VAT number. |
20 | -$vat_number = wpinv_get_option( 'vat_number' ); |
|
20 | +$vat_number = wpinv_get_option('vat_number'); |
|
21 | 21 | |
22 | 22 | ?> |
23 | 23 | <div class="getpaid-company-address form-group"> |
@@ -25,36 +25,36 @@ discard block |
||
25 | 25 | <div class="row"> |
26 | 26 | |
27 | 27 | <div class="invoice-company-address-label col-2"> |
28 | - <strong><?php esc_html_e( 'From:', 'invoicing' ); ?></strong> |
|
28 | + <strong><?php esc_html_e('From:', 'invoicing'); ?></strong> |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | <div class="invoice-company-address-value col-10"> |
32 | 32 | |
33 | - <?php do_action( 'getpaid_company_address_top' ); ?> |
|
33 | + <?php do_action('getpaid_company_address_top'); ?> |
|
34 | 34 | |
35 | 35 | <div class="name"> |
36 | - <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
37 | - <?php echo esc_html( $company_name ); ?> |
|
36 | + <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
37 | + <?php echo esc_html($company_name); ?> |
|
38 | 38 | </a> |
39 | 39 | </div> |
40 | 40 | |
41 | - <?php if ( $address = wpinv_get_business_address() ) { ?> |
|
42 | - <?php echo wp_kses_post( $address ); ?> |
|
41 | + <?php if ($address = wpinv_get_business_address()) { ?> |
|
42 | + <?php echo wp_kses_post($address); ?> |
|
43 | 43 | <?php } ?> |
44 | 44 | |
45 | - <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?> |
|
45 | + <?php if ($email_from = wpinv_mail_get_from_address()) { ?> |
|
46 | 46 | <div class="email_from"> |
47 | - <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email_from ) ); ?> |
|
47 | + <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email_from)); ?> |
|
48 | 48 | </div> |
49 | 49 | <?php } ?> |
50 | 50 | |
51 | - <?php if ( ! empty( $vat_number ) ) { ?> |
|
51 | + <?php if (!empty($vat_number)) { ?> |
|
52 | 52 | <div class="email_from"> |
53 | - <?php echo wp_sprintf( __( 'VAT Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?> |
|
53 | + <?php echo wp_sprintf(__('VAT Number: %s', 'invoicing'), esc_html($vat_number)); ?> |
|
54 | 54 | </div> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | - <?php do_action( 'getpaid_company_address_bottom' ); ?> |
|
57 | + <?php do_action('getpaid_company_address_bottom'); ?> |
|
58 | 58 | |
59 | 59 | </div> |
60 | 60 |
@@ -8,25 +8,25 @@ |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | |
15 | 15 | <div class="getpaid-header-left-actions"> |
16 | 16 | |
17 | - <?php if ( $invoice->is_type( 'invoice' ) && $invoice->needs_payment() && ! $invoice->is_held() ) : ?> |
|
18 | - <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url( $invoice->get_checkout_payment_url() ); ?>"> |
|
19 | - <?php esc_html_e( 'Pay For Invoice', 'invoicing' ); ?> |
|
17 | + <?php if ($invoice->is_type('invoice') && $invoice->needs_payment() && !$invoice->is_held()) : ?> |
|
18 | + <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url($invoice->get_checkout_payment_url()); ?>"> |
|
19 | + <?php esc_html_e('Pay For Invoice', 'invoicing'); ?> |
|
20 | 20 | </a> |
21 | 21 | <?php endif; ?> |
22 | 22 | |
23 | - <?php if ( $invoice->is_type( 'invoice' ) && $invoice->is_paid() ) : ?> |
|
24 | - <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url( $invoice->get_receipt_url() ); ?>"> |
|
25 | - <?php esc_html_e( 'View Receipt', 'invoicing' ); ?> |
|
23 | + <?php if ($invoice->is_type('invoice') && $invoice->is_paid()) : ?> |
|
24 | + <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url($invoice->get_receipt_url()); ?>"> |
|
25 | + <?php esc_html_e('View Receipt', 'invoicing'); ?> |
|
26 | 26 | </a> |
27 | 27 | <?php endif; ?> |
28 | 28 | |
29 | - <?php do_action( 'wpinv_invoice_display_left_actions', $invoice ); ?> |
|
29 | + <?php do_action('wpinv_invoice_display_left_actions', $invoice); ?> |
|
30 | 30 | |
31 | 31 | </div> |
32 | 32 |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Fetch the invoice. |
13 | -if ( empty( $invoice ) ) { |
|
14 | - $invoice = new WPInv_Invoice( $GLOBALS['post'] ); |
|
13 | +if (empty($invoice)) { |
|
14 | + $invoice = new WPInv_Invoice($GLOBALS['post']); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | ?><!DOCTYPE html> |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | |
22 | 22 | <head> |
23 | 23 | |
24 | - <meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
24 | + <meta charset="<?php bloginfo('charset'); ?>"> |
|
25 | 25 | <meta name="viewport" content="width=device-width, initial-scale=1.0" > |
26 | 26 | |
27 | 27 | <meta name="robots" content="noindex,nofollow"> |
28 | 28 | |
29 | 29 | <link rel="profile" href="https://gmpg.org/xfn/11"> |
30 | 30 | |
31 | - <title><?php esc_html_e( 'Invalid Access', 'invoicing' ); ?></title> |
|
31 | + <title><?php esc_html_e('Invalid Access', 'invoicing'); ?></title> |
|
32 | 32 | |
33 | - <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?> |
|
33 | + <?php do_action('wpinv_invoice_print_head', $invoice); ?> |
|
34 | 34 | |
35 | 35 | </head> |
36 | 36 | |
@@ -39,20 +39,20 @@ discard block |
||
39 | 39 | |
40 | 40 | <?php |
41 | 41 | |
42 | - if ( ! $invoice->exists() || $invoice->is_draft() ) { |
|
43 | - $error = __( 'This invoice was deleted or is not visible.', 'invoicing' ); |
|
42 | + if (!$invoice->exists() || $invoice->is_draft()) { |
|
43 | + $error = __('This invoice was deleted or is not visible.', 'invoicing'); |
|
44 | 44 | } else { |
45 | 45 | |
46 | 46 | $user_id = get_current_user_id(); |
47 | - if ( wpinv_require_login_to_checkout() && empty( $user_id ) ) { |
|
48 | - $error = __( 'You must be logged in to view this invoice.', 'invoicing' ); |
|
47 | + if (wpinv_require_login_to_checkout() && empty($user_id)) { |
|
48 | + $error = __('You must be logged in to view this invoice.', 'invoicing'); |
|
49 | 49 | $error .= sprintf( |
50 | 50 | ' <a href="%s">%s</a>', |
51 | - wp_login_url( $invoice->get_view_url() ), |
|
52 | - __( 'Login.', 'invoicing' ) |
|
51 | + wp_login_url($invoice->get_view_url()), |
|
52 | + __('Login.', 'invoicing') |
|
53 | 53 | ); |
54 | 54 | } else { |
55 | - $error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' ); |
|
55 | + $error = __('This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | <div class="container"> |
62 | 62 | <div class="alert alert-danger m-5" role="alert"> |
63 | - <h4 class="alert-heading"><?php esc_html_e( 'Access Denied', 'invoicing' ); ?></h4> |
|
64 | - <p><?php echo wp_kses_post( $error ); ?></p> |
|
63 | + <h4 class="alert-heading"><?php esc_html_e('Access Denied', 'invoicing'); ?></h4> |
|
64 | + <p><?php echo wp_kses_post($error); ?></p> |
|
65 | 65 | </div> |
66 | 66 | </div> |
67 | 67 |
@@ -9,45 +9,45 @@ |
||
9 | 9 | * @var WPInv_Subscriptions_Widget $widget |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) : |
|
14 | +foreach (array_keys($widget->get_subscriptions_table_columns()) as $column) : |
|
15 | 15 | |
16 | - $class = sanitize_html_class( $column ); |
|
17 | - echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>"; |
|
16 | + $class = sanitize_html_class($column); |
|
17 | + echo "<td class='getpaid-subscriptions-table-column-" . esc_attr($class) . "'>"; |
|
18 | 18 | |
19 | - do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription ); |
|
19 | + do_action("getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription); |
|
20 | 20 | |
21 | - switch ( $column ) : |
|
21 | + switch ($column) : |
|
22 | 22 | |
23 | 23 | case 'subscription': |
24 | 24 | $subscription_id = (int) $subscription->get_id(); |
25 | - $url = esc_url( $subscription->get_view_url() ); |
|
25 | + $url = esc_url($subscription->get_view_url()); |
|
26 | 26 | $id_label = sprintf( |
27 | - esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
27 | + esc_attr_x('#%s', 'subscription id', 'invoicing'), |
|
28 | 28 | (int) $subscription->get_id() |
29 | 29 | ); |
30 | - echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) ); |
|
30 | + echo wp_kses_post($widget->add_row_actions("<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription)); |
|
31 | 31 | break; |
32 | 32 | |
33 | 33 | case 'status': |
34 | - echo esc_html( $subscription->get_status_label() ); |
|
34 | + echo esc_html($subscription->get_status_label()); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | case 'renewal-date': |
38 | - $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
39 | - echo $subscription->is_active() ? esc_html( $renewal ) : '—'; |
|
38 | + $renewal = getpaid_format_date_value($subscription->get_next_renewal_date()); |
|
39 | + echo $subscription->is_active() ? esc_html($renewal) : '—'; |
|
40 | 40 | break; |
41 | 41 | |
42 | 42 | case 'amount': |
43 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
44 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
45 | - echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
43 | + $frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), ''); |
|
44 | + $amount = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency()); |
|
45 | + echo wp_kses_post("<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>"); |
|
46 | 46 | break; |
47 | 47 | |
48 | 48 | endswitch; |
49 | 49 | |
50 | - do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
50 | + do_action("getpaid_subscriptions_frontend_subscription_table_$column", $subscription); |
|
51 | 51 | |
52 | 52 | echo '</td>'; |
53 | 53 |
@@ -9,17 +9,17 @@ discard block |
||
9 | 9 | * @var WPInv_Subscriptions_Widget $widget |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_single_subscription_before_notices', $subscription ); |
|
14 | +do_action('getpaid_single_subscription_before_notices', $subscription); |
|
15 | 15 | |
16 | 16 | // Display errors and notices. |
17 | 17 | wpinv_print_errors(); |
18 | 18 | |
19 | -$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() ); |
|
20 | -$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
19 | +$subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_invoice_id()); |
|
20 | +$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id()); |
|
21 | 21 | |
22 | -do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups ); |
|
22 | +do_action('getpaid_before_single_subscription', $subscription, $subscription_groups); |
|
23 | 23 | |
24 | 24 | ?> |
25 | 25 | |
@@ -31,44 +31,44 @@ discard block |
||
31 | 31 | |
32 | 32 | </style> |
33 | 33 | |
34 | -<h2 class="mb-1 h4"><?php esc_html_e( 'Subscription Details', 'invoicing' ); ?></h2> |
|
34 | +<h2 class="mb-1 h4"><?php esc_html_e('Subscription Details', 'invoicing'); ?></h2> |
|
35 | 35 | <table class="table table-bordered"> |
36 | 36 | <tbody> |
37 | 37 | |
38 | - <?php foreach ( $widget->get_single_subscription_columns( $subscription ) as $key => $label ) : ?> |
|
38 | + <?php foreach ($widget->get_single_subscription_columns($subscription) as $key => $label) : ?> |
|
39 | 39 | |
40 | - <tr class="getpaid-subscription-meta-<?php echo sanitize_html_class( $key ); ?>"> |
|
40 | + <tr class="getpaid-subscription-meta-<?php echo sanitize_html_class($key); ?>"> |
|
41 | 41 | |
42 | 42 | <th class="font-weight-bold" style="width: 35%"> |
43 | - <?php echo esc_html( $label ); ?> |
|
43 | + <?php echo esc_html($label); ?> |
|
44 | 44 | </th> |
45 | 45 | |
46 | 46 | <td style="width: 65%"> |
47 | 47 | <?php |
48 | 48 | |
49 | - switch ( $key ) { |
|
49 | + switch ($key) { |
|
50 | 50 | |
51 | 51 | case 'status': |
52 | - echo esc_html( $subscription->get_status_label() ); |
|
52 | + echo esc_html($subscription->get_status_label()); |
|
53 | 53 | break; |
54 | 54 | |
55 | 55 | case 'start_date': |
56 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
56 | + echo esc_html(getpaid_format_date_value($subscription->get_date_created())); |
|
57 | 57 | break; |
58 | 58 | |
59 | 59 | case 'expiry_date': |
60 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
60 | + echo esc_html(getpaid_format_date_value($subscription->get_next_renewal_date())); |
|
61 | 61 | break; |
62 | 62 | |
63 | 63 | case 'initial_amount': |
64 | - echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) ); |
|
64 | + echo wp_kses_post(wpinv_price($subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency())); |
|
65 | 65 | |
66 | - if ( $subscription->has_trial_period() ) { |
|
66 | + if ($subscription->has_trial_period()) { |
|
67 | 67 | |
68 | 68 | echo "<small class='text-muted'> "; |
69 | 69 | printf( |
70 | - esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
71 | - esc_html( $subscription->get_trial_period() ) |
|
70 | + esc_html_x('( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing'), |
|
71 | + esc_html($subscription->get_trial_period()) |
|
72 | 72 | ); |
73 | 73 | echo '</small>'; |
74 | 74 | |
@@ -77,29 +77,29 @@ discard block |
||
77 | 77 | break; |
78 | 78 | |
79 | 79 | case 'recurring_amount': |
80 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
81 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
82 | - echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
80 | + $frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), ''); |
|
81 | + $amount = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency()); |
|
82 | + echo wp_kses_post(strtolower("<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>")); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case 'item': |
86 | - if ( empty( $subscription_group ) ) { |
|
87 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
86 | + if (empty($subscription_group)) { |
|
87 | + echo wp_kses_post(WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id())); |
|
88 | 88 | } else { |
89 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
90 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
89 | + $markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items'])); |
|
90 | + echo wp_kses_post(implode(' | ', $markup)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | break; |
94 | 94 | |
95 | 95 | case 'payments': |
96 | 96 | $max_activations = (int) $subscription->get_bill_times(); |
97 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
97 | + echo ((int) $subscription->get_times_billed()) . ' / ' . (empty($max_activations) ? '∞' : (int) $max_activations); |
|
98 | 98 | |
99 | 99 | break; |
100 | 100 | |
101 | 101 | } |
102 | - do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
102 | + do_action("getpaid_render_single_subscription_column_$key", $subscription); |
|
103 | 103 | |
104 | 104 | ?> |
105 | 105 | </td> |
@@ -111,34 +111,34 @@ discard block |
||
111 | 111 | </tbody> |
112 | 112 | </table> |
113 | 113 | |
114 | -<?php if ( ! empty( $subscription_group ) ) : ?> |
|
115 | - <h2 class='mt-5 mb-1 h4'><?php esc_html_e( 'Subscription Items', 'invoicing' ); ?></h2> |
|
116 | - <?php getpaid_admin_subscription_item_details_metabox( $subscription ); ?> |
|
114 | +<?php if (!empty($subscription_group)) : ?> |
|
115 | + <h2 class='mt-5 mb-1 h4'><?php esc_html_e('Subscription Items', 'invoicing'); ?></h2> |
|
116 | + <?php getpaid_admin_subscription_item_details_metabox($subscription); ?> |
|
117 | 117 | <?php endif; ?> |
118 | 118 | |
119 | -<h2 class='mt-5 mb-1 h4'><?php esc_html_e( 'Related Invoices', 'invoicing' ); ?></h2> |
|
119 | +<h2 class='mt-5 mb-1 h4'><?php esc_html_e('Related Invoices', 'invoicing'); ?></h2> |
|
120 | 120 | |
121 | -<?php echo wp_kses_post( getpaid_admin_subscription_invoice_details_metabox( $subscription ) ); ?> |
|
121 | +<?php echo wp_kses_post(getpaid_admin_subscription_invoice_details_metabox($subscription)); ?> |
|
122 | 122 | |
123 | -<?php if ( 1 < count( $subscription_groups ) ) : ?> |
|
124 | - <h2 class='mt-5 mb-1 h4'><?php esc_html_e( 'Related Subscriptions', 'invoicing' ); ?></h2> |
|
125 | - <?php getpaid_admin_subscription_related_subscriptions_metabox( $subscription ); ?> |
|
123 | +<?php if (1 < count($subscription_groups)) : ?> |
|
124 | + <h2 class='mt-5 mb-1 h4'><?php esc_html_e('Related Subscriptions', 'invoicing'); ?></h2> |
|
125 | + <?php getpaid_admin_subscription_related_subscriptions_metabox($subscription); ?> |
|
126 | 126 | <?php endif; ?> |
127 | 127 | |
128 | 128 | <span class="form-text"> |
129 | 129 | |
130 | 130 | <?php |
131 | - if ( $subscription->can_cancel() ) { |
|
131 | + if ($subscription->can_cancel()) { |
|
132 | 132 | printf( |
133 | 133 | '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
134 | - esc_url( $subscription->get_cancel_url() ), |
|
135 | - esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
|
136 | - esc_html__( 'Cancel Subscription', 'invoicing' ) |
|
134 | + esc_url($subscription->get_cancel_url()), |
|
135 | + esc_attr__('Are you sure you want to cancel this subscription?', 'invoicing'), |
|
136 | + esc_html__('Cancel Subscription', 'invoicing') |
|
137 | 137 | ); |
138 | 138 | } |
139 | 139 | |
140 | - do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
140 | + do_action('getpaid-single-subscription-page-actions', $subscription); |
|
141 | 141 | ?> |
142 | 142 | |
143 | - <a href="<?php echo esc_url( getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) ); ?>" class="btn btn-secondary btn-sm"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></a> |
|
143 | + <a href="<?php echo esc_url(getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')))); ?>" class="btn btn-secondary btn-sm"><?php esc_html_e('Go Back', 'invoicing'); ?></a> |
|
144 | 144 | </span> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Reports_Export Class. |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | public function display() { |
20 | 20 | |
21 | 21 | echo "<div class='row mt-4' style='max-width: 920px;' >"; |
22 | - foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) { |
|
23 | - $this->display_post_type_export( $post_type ); |
|
22 | + foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) { |
|
23 | + $this->display_post_type_export($post_type); |
|
24 | 24 | } |
25 | 25 | $this->display_subscription_export(); |
26 | 26 | echo '</div>'; |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * Retrieves the download url. |
32 | 32 | * |
33 | 33 | */ |
34 | - public function get_download_url( $post_type ) { |
|
34 | + public function get_download_url($post_type) { |
|
35 | 35 | |
36 | 36 | return wp_nonce_url( |
37 | 37 | add_query_arg( |
38 | 38 | array( |
39 | 39 | 'getpaid-admin-action' => 'export_invoices', |
40 | - 'post_type' => urlencode( $post_type ), |
|
40 | + 'post_type' => urlencode($post_type), |
|
41 | 41 | ) |
42 | 42 | ), |
43 | 43 | 'getpaid-nonce', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Displays a single post type export card. |
51 | 51 | * |
52 | 52 | */ |
53 | - public function display_post_type_export( $post_type ) { |
|
53 | + public function display_post_type_export($post_type) { |
|
54 | 54 | |
55 | 55 | ?> |
56 | 56 | |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | <strong> |
62 | 62 | <?php |
63 | 63 | printf( |
64 | - __( 'Export %s', 'invoicing' ), |
|
65 | - sanitize_text_field( getpaid_get_post_type_label( $post_type ) ) |
|
64 | + __('Export %s', 'invoicing'), |
|
65 | + sanitize_text_field(getpaid_get_post_type_label($post_type)) |
|
66 | 66 | ); |
67 | 67 | ?> |
68 | 68 | </strong> |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | |
71 | 71 | <div class="card-body"> |
72 | 72 | |
73 | - <form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>"> |
|
73 | + <form method="post" action="<?php echo esc_url($this->get_download_url($post_type)); ?>"> |
|
74 | 74 | |
75 | 75 | <?php |
76 | - $this->display_markup( $this->generate_from_date( $post_type ) ); |
|
77 | - $this->display_markup( $this->generate_to_date( $post_type ) ); |
|
78 | - $this->display_markup( $this->generate_post_status_select( $post_type ) ); |
|
79 | - $this->display_markup( $this->generate_file_type_select( $post_type ) ); |
|
80 | - submit_button( __( 'Download', 'invoicing' ) ); |
|
76 | + $this->display_markup($this->generate_from_date($post_type)); |
|
77 | + $this->display_markup($this->generate_to_date($post_type)); |
|
78 | + $this->display_markup($this->generate_post_status_select($post_type)); |
|
79 | + $this->display_markup($this->generate_file_type_select($post_type)); |
|
80 | + submit_button(__('Download', 'invoicing')); |
|
81 | 81 | ?> |
82 | 82 | |
83 | 83 | </form> |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | * Generates the from date input field. |
96 | 96 | * |
97 | 97 | */ |
98 | - public function generate_from_date( $post_type ) { |
|
98 | + public function generate_from_date($post_type) { |
|
99 | 99 | |
100 | 100 | return aui()->input( |
101 | 101 | array( |
102 | 102 | 'name' => 'from_date', |
103 | - 'id' => esc_attr( "$post_type-from_date" ), |
|
103 | + 'id' => esc_attr("$post_type-from_date"), |
|
104 | 104 | 'placeholder' => 'yy-mm-dd', |
105 | - 'label' => __( 'From Date', 'invoicing' ), |
|
105 | + 'label' => __('From Date', 'invoicing'), |
|
106 | 106 | 'label_type' => 'vertical', |
107 | 107 | 'label_class' => 'd-block', |
108 | 108 | 'type' => 'datepicker', |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | * Generates the to date input field. |
116 | 116 | * |
117 | 117 | */ |
118 | - public function generate_to_date( $post_type ) { |
|
118 | + public function generate_to_date($post_type) { |
|
119 | 119 | |
120 | 120 | return aui()->input( |
121 | 121 | array( |
122 | 122 | 'name' => 'to_date', |
123 | - 'id' => esc_attr( "$post_type-to_date" ), |
|
123 | + 'id' => esc_attr("$post_type-to_date"), |
|
124 | 124 | 'placeholder' => 'yy-mm-dd', |
125 | - 'label' => __( 'To Date', 'invoicing' ), |
|
125 | + 'label' => __('To Date', 'invoicing'), |
|
126 | 126 | 'label_type' => 'vertical', |
127 | 127 | 'label_class' => 'd-block', |
128 | 128 | 'type' => 'datepicker', |
@@ -135,20 +135,20 @@ discard block |
||
135 | 135 | * Generates the to post status select field. |
136 | 136 | * |
137 | 137 | */ |
138 | - public function generate_post_status_select( $post_type ) { |
|
138 | + public function generate_post_status_select($post_type) { |
|
139 | 139 | |
140 | - if ( 'subscriptions' === $post_type ) { |
|
140 | + if ('subscriptions' === $post_type) { |
|
141 | 141 | $options = getpaid_get_subscription_statuses(); |
142 | 142 | } else { |
143 | - $options = wpinv_get_invoice_statuses( true, false, $post_type ); |
|
143 | + $options = wpinv_get_invoice_statuses(true, false, $post_type); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return aui()->select( |
147 | 147 | array( |
148 | 148 | 'name' => 'status', |
149 | - 'id' => esc_attr( "$post_type-status" ), |
|
150 | - 'placeholder' => __( 'All Statuses', 'invoicing' ), |
|
151 | - 'label' => __( 'Status', 'invoicing' ), |
|
149 | + 'id' => esc_attr("$post_type-status"), |
|
150 | + 'placeholder' => __('All Statuses', 'invoicing'), |
|
151 | + 'label' => __('Status', 'invoicing'), |
|
152 | 152 | 'label_type' => 'vertical', |
153 | 153 | 'label_class' => 'd-block', |
154 | 154 | 'options' => $options, |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | * Generates the to file type select field. |
162 | 162 | * |
163 | 163 | */ |
164 | - public function generate_file_type_select( $post_type ) { |
|
164 | + public function generate_file_type_select($post_type) { |
|
165 | 165 | |
166 | 166 | return aui()->select( |
167 | 167 | array( |
168 | 168 | 'name' => 'file_type', |
169 | - 'id' => esc_attr( "$post_type-file_type" ), |
|
170 | - 'placeholder' => __( 'Select File Type', 'invoicing' ), |
|
171 | - 'label' => __( 'Export File', 'invoicing' ), |
|
169 | + 'id' => esc_attr("$post_type-file_type"), |
|
170 | + 'placeholder' => __('Select File Type', 'invoicing'), |
|
171 | + 'label' => __('Export File', 'invoicing'), |
|
172 | 172 | 'label_type' => 'vertical', |
173 | 173 | 'label_class' => 'd-block', |
174 | 174 | 'options' => array( |
175 | - 'csv' => __( 'CSV', 'invoicing' ), |
|
176 | - 'xml' => __( 'XML', 'invoicing' ), |
|
177 | - 'json' => __( 'JSON', 'invoicing' ), |
|
175 | + 'csv' => __('CSV', 'invoicing'), |
|
176 | + 'xml' => __('XML', 'invoicing'), |
|
177 | + 'json' => __('JSON', 'invoicing'), |
|
178 | 178 | ), |
179 | 179 | ) |
180 | 180 | ); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * Displays a field's markup. |
186 | 186 | * |
187 | 187 | */ |
188 | - public function display_markup( $markup ) { |
|
188 | + public function display_markup($markup) { |
|
189 | 189 | |
190 | 190 | echo str_replace( |
191 | 191 | array( |
@@ -211,20 +211,20 @@ discard block |
||
211 | 211 | |
212 | 212 | <div class="card-header"> |
213 | 213 | <strong> |
214 | - <?php esc_html_e( 'Export Subscriptions', 'invoicing' ); ?> |
|
214 | + <?php esc_html_e('Export Subscriptions', 'invoicing'); ?> |
|
215 | 215 | </strong> |
216 | 216 | </div> |
217 | 217 | |
218 | 218 | <div class="card-body"> |
219 | 219 | |
220 | - <form method="post" action="<?php echo esc_url( $this->get_download_url( 'subscriptions' ) ); ?>"> |
|
220 | + <form method="post" action="<?php echo esc_url($this->get_download_url('subscriptions')); ?>"> |
|
221 | 221 | |
222 | 222 | <?php |
223 | - $this->display_markup( $this->generate_from_date( 'subscriptions' ) ); |
|
224 | - $this->display_markup( $this->generate_to_date( 'subscriptions' ) ); |
|
225 | - $this->display_markup( $this->generate_post_status_select( 'subscriptions' ) ); |
|
226 | - $this->display_markup( $this->generate_file_type_select( 'subscriptions' ) ); |
|
227 | - submit_button( __( 'Download', 'invoicing' ) ); |
|
223 | + $this->display_markup($this->generate_from_date('subscriptions')); |
|
224 | + $this->display_markup($this->generate_to_date('subscriptions')); |
|
225 | + $this->display_markup($this->generate_post_status_select('subscriptions')); |
|
226 | + $this->display_markup($this->generate_file_type_select('subscriptions')); |
|
227 | + submit_button(__('Download', 'invoicing')); |
|
228 | 228 | ?> |
229 | 229 | |
230 | 230 | </form> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * GetPaid_Reports_Report Class. |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | |
26 | - $this->views = array( |
|
26 | + $this->views = array( |
|
27 | 27 | |
28 | 28 | 'items' => array( |
29 | - 'label' => __( 'Items', 'invoicing' ), |
|
29 | + 'label' => __('Items', 'invoicing'), |
|
30 | 30 | 'class' => 'GetPaid_Reports_Report_Items', |
31 | 31 | ), |
32 | 32 | |
33 | 33 | 'gateways' => array( |
34 | - 'label' => __( 'Payment Methods', 'invoicing' ), |
|
34 | + 'label' => __('Payment Methods', 'invoicing'), |
|
35 | 35 | 'class' => 'GetPaid_Reports_Report_Gateways', |
36 | 36 | ), |
37 | 37 | |
38 | 38 | 'discounts' => array( |
39 | - 'label' => __( 'Discount Codes', 'invoicing' ), |
|
39 | + 'label' => __('Discount Codes', 'invoicing'), |
|
40 | 40 | 'class' => 'GetPaid_Reports_Report_Discounts', |
41 | 41 | ), |
42 | 42 | |
43 | 43 | ); |
44 | 44 | |
45 | - $this->views = apply_filters( 'wpinv_report_views', $this->views ); |
|
45 | + $this->views = apply_filters('wpinv_report_views', $this->views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | public function get_range() { |
54 | 54 | $valid_ranges = $this->get_periods(); |
55 | 55 | |
56 | - if ( isset( $_GET['date_range'] ) && array_key_exists( $_GET['date_range'], $valid_ranges ) ) { |
|
57 | - return sanitize_key( $_GET['date_range'] ); |
|
56 | + if (isset($_GET['date_range']) && array_key_exists($_GET['date_range'], $valid_ranges)) { |
|
57 | + return sanitize_key($_GET['date_range']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return '7_days'; |
@@ -68,22 +68,22 @@ discard block |
||
68 | 68 | public function get_periods() { |
69 | 69 | |
70 | 70 | $periods = array( |
71 | - 'today' => __( 'Today', 'invoicing' ), |
|
72 | - 'yesterday' => __( 'Yesterday', 'invoicing' ), |
|
73 | - 'week' => __( 'This week', 'invoicing' ), |
|
74 | - 'last_week' => __( 'Last week', 'invoicing' ), |
|
75 | - '7_days' => __( 'Last 7 days', 'invoicing' ), |
|
76 | - 'month' => __( 'This month', 'invoicing' ), |
|
77 | - 'last_month' => __( 'Last month', 'invoicing' ), |
|
78 | - '30_days' => __( 'Last 30 days', 'invoicing' ), |
|
79 | - 'quarter' => __( 'This Quarter', 'invoicing' ), |
|
80 | - 'last_quarter' => __( 'Last Quarter', 'invoicing' ), |
|
81 | - 'year' => __( 'This year', 'invoicing' ), |
|
82 | - 'last_year' => __( 'Last Year', 'invoicing' ), |
|
83 | - 'custom' => __( 'Custom Date Range', 'invoicing' ), |
|
71 | + 'today' => __('Today', 'invoicing'), |
|
72 | + 'yesterday' => __('Yesterday', 'invoicing'), |
|
73 | + 'week' => __('This week', 'invoicing'), |
|
74 | + 'last_week' => __('Last week', 'invoicing'), |
|
75 | + '7_days' => __('Last 7 days', 'invoicing'), |
|
76 | + 'month' => __('This month', 'invoicing'), |
|
77 | + 'last_month' => __('Last month', 'invoicing'), |
|
78 | + '30_days' => __('Last 30 days', 'invoicing'), |
|
79 | + 'quarter' => __('This Quarter', 'invoicing'), |
|
80 | + 'last_quarter' => __('Last Quarter', 'invoicing'), |
|
81 | + 'year' => __('This year', 'invoicing'), |
|
82 | + 'last_year' => __('Last Year', 'invoicing'), |
|
83 | + 'custom' => __('Custom Date Range', 'invoicing'), |
|
84 | 84 | ); |
85 | 85 | |
86 | - return apply_filters( 'getpaid_earning_periods', $periods ); |
|
86 | + return apply_filters('getpaid_earning_periods', $periods); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -96,21 +96,21 @@ discard block |
||
96 | 96 | ?> |
97 | 97 | |
98 | 98 | <form method="get" class="getpaid-filter-earnings float-right"> |
99 | - <?php getpaid_hidden_field( 'page', isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : 'wpinv-reports' ); ?> |
|
100 | - <?php getpaid_hidden_field( 'tab', 'reports' ); ?> |
|
99 | + <?php getpaid_hidden_field('page', isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'wpinv-reports'); ?> |
|
100 | + <?php getpaid_hidden_field('tab', 'reports'); ?> |
|
101 | 101 | <select name='date_range'> |
102 | - <?php foreach ( $this->get_periods() as $key => $label ) : ?> |
|
103 | - <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $range ); ?>><?php echo esc_html( $label ); ?></option> |
|
102 | + <?php foreach ($this->get_periods() as $key => $label) : ?> |
|
103 | + <option value="<?php echo esc_attr($key); ?>" <?php selected($key, $range); ?>><?php echo esc_html($label); ?></option> |
|
104 | 104 | <?php endforeach; ?> |
105 | 105 | </select> |
106 | 106 | <span class="getpaid-date-range-picker <?php echo 'custom' == $range ? '' : 'd-none'; ?>"> |
107 | 107 | <input type="text" name="from" class="getpaid-from align-middle" /> |
108 | - <?php esc_html_e( 'to', 'invoicing' ); ?> |
|
108 | + <?php esc_html_e('to', 'invoicing'); ?> |
|
109 | 109 | <input type="text" name="to" class="getpaid-to align-middle" /> |
110 | 110 | </span> |
111 | 111 | <button type="submit" class="button button-primary"> |
112 | 112 | <i class="fa fa-chevron-right fa-lg"></i> |
113 | - <span class="screen-reader-text"><?php esc_html_e( 'View Reports', 'invoicing' ); ?></span> |
|
113 | + <span class="screen-reader-text"><?php esc_html_e('View Reports', 'invoicing'); ?></span> |
|
114 | 114 | </button> |
115 | 115 | </form> |
116 | 116 | |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | |
160 | 160 | <div class="col-12 col-md-4"> |
161 | 161 | <div class="row getpaid-report-cards"> |
162 | - <?php foreach ( $this->get_cards() as $key => $card ) : ?> |
|
162 | + <?php foreach ($this->get_cards() as $key => $card) : ?> |
|
163 | 163 | <div class="col-12 mb-4"> |
164 | 164 | |
165 | - <!-- <?php echo esc_html( $card['label'] ); ?> Card --> |
|
166 | - <div class="card p-0 m-0 shadow-none <?php echo sanitize_html_class( $key ); ?>"> |
|
165 | + <!-- <?php echo esc_html($card['label']); ?> Card --> |
|
166 | + <div class="card p-0 m-0 shadow-none <?php echo sanitize_html_class($key); ?>"> |
|
167 | 167 | |
168 | 168 | <div class="card-body"> |
169 | 169 | |
170 | 170 | <p class="getpaid-current text-uppercase small mb-2"> |
171 | - <strong><?php echo esc_html( $card['label'] ); ?></strong> |
|
172 | - <span title="<?php echo esc_attr( $card['description'] ); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span> |
|
171 | + <strong><?php echo esc_html($card['label']); ?></strong> |
|
172 | + <span title="<?php echo esc_attr($card['description']); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span> |
|
173 | 173 | </p> |
174 | 174 | <h5 class="font-weight-bold mb-0"> |
175 | 175 | <span class="getpaid-report-card-value"> |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | <hr> |
182 | 182 | |
183 | - <p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e( 'Previous Period', 'invoicing' ); ?></strong></p> |
|
183 | + <p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e('Previous Period', 'invoicing'); ?></strong></p> |
|
184 | 184 | <h5 class="getpaid-report-card-previous-value font-weight-bold text-muted mb-0"> |
185 | 185 | <span class="spinner is-active float-none"></span> |
186 | 186 | </h5> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | </div> |
189 | 189 | |
190 | 190 | </div> |
191 | - <!-- <?php echo esc_html( $card['label'] ); ?> Card --> |
|
191 | + <!-- <?php echo esc_html($card['label']); ?> Card --> |
|
192 | 192 | |
193 | 193 | </div> |
194 | 194 | <?php endforeach; ?> |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | |
214 | 214 | ?> |
215 | 215 | |
216 | - <?php foreach ( $graphs as $key => $graph ) : ?> |
|
216 | + <?php foreach ($graphs as $key => $graph) : ?> |
|
217 | 217 | <div class="row mb-4"> |
218 | 218 | <div class="col-12"> |
219 | 219 | <div class="card m-0 p-0 single-report-card" style="max-width:100%"> |
220 | 220 | <div class="card-header"> |
221 | - <strong><?php echo esc_html( $graph ); ?></strong> |
|
221 | + <strong><?php echo esc_html($graph); ?></strong> |
|
222 | 222 | </div> |
223 | 223 | <div class="card-body"> |
224 | - <canvas id="getpaid-chartjs-<?php echo esc_attr( $key ); ?>"></canvas> |
|
224 | + <canvas id="getpaid-chartjs-<?php echo esc_attr($key); ?>"></canvas> |
|
225 | 225 | </div> |
226 | 226 | </div> |
227 | 227 | </div> |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | * Retrieves the download url. |
237 | 237 | * |
238 | 238 | */ |
239 | - public function get_download_url( $graph, $file_type ) { |
|
239 | + public function get_download_url($graph, $file_type) { |
|
240 | 240 | |
241 | 241 | return wp_nonce_url( |
242 | 242 | add_query_arg( |
243 | 243 | array( |
244 | 244 | 'getpaid-admin-action' => 'download_graph', |
245 | - 'file_type' => urlencode( $file_type ), |
|
246 | - 'graph' => urlencode( $graph ), |
|
245 | + 'file_type' => urlencode($file_type), |
|
246 | + 'graph' => urlencode($graph), |
|
247 | 247 | ) |
248 | 248 | ), |
249 | 249 | 'getpaid-nonce', |
@@ -260,27 +260,27 @@ discard block |
||
260 | 260 | |
261 | 261 | ?> |
262 | 262 | |
263 | - <?php foreach ( $this->views as $key => $view ) : ?> |
|
263 | + <?php foreach ($this->views as $key => $view) : ?> |
|
264 | 264 | <div class="row mb-4"> |
265 | 265 | <div class="col-12"> |
266 | 266 | <div class="card m-0 p-0" style="max-width:100%"> |
267 | 267 | <div class="card-header"> |
268 | 268 | <div class="row"> |
269 | - <div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-9' : 'col-12'; ?>"> |
|
270 | - <strong><?php echo esc_html( $view['label'] ); ?></strong> |
|
269 | + <div class="<?php echo empty($view['disable-downloads']) ? 'col-9' : 'col-12'; ?>"> |
|
270 | + <strong><?php echo esc_html($view['label']); ?></strong> |
|
271 | 271 | </div> |
272 | - <div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-3' : 'd-none'; ?>"> |
|
273 | - <a title="<?php esc_attr_e( 'Download JSON', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'json' ) ); ?>"> |
|
272 | + <div class="<?php echo empty($view['disable-downloads']) ? 'col-3' : 'd-none'; ?>"> |
|
273 | + <a title="<?php esc_attr_e('Download JSON', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'json')); ?>"> |
|
274 | 274 | <i class="fa fa-download text-dark" style="font-size: 16px" aria-hidden="true"></i> |
275 | - <span class="screen-reader-text"><?php esc_html_e( 'Download JSON', 'invoicing' ); ?></span> |
|
275 | + <span class="screen-reader-text"><?php esc_html_e('Download JSON', 'invoicing'); ?></span> |
|
276 | 276 | </a> |
277 | - <a title="<?php esc_attr_e( 'Download CSV', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'csv' ) ); ?>"> |
|
277 | + <a title="<?php esc_attr_e('Download CSV', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'csv')); ?>"> |
|
278 | 278 | <i class="fa fa-file-csv text-dark" style="font-size: 16px" aria-hidden="true"></i> |
279 | - <span class="screen-reader-text"><?php esc_html_e( 'Download CSV', 'invoicing' ); ?></span> |
|
279 | + <span class="screen-reader-text"><?php esc_html_e('Download CSV', 'invoicing'); ?></span> |
|
280 | 280 | </a> |
281 | - <a title="<?php esc_attr_e( 'Download XML', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'xml' ) ); ?>"> |
|
281 | + <a title="<?php esc_attr_e('Download XML', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'xml')); ?>"> |
|
282 | 282 | <i class="fa fa-file-code text-dark" style="font-size: 16px" aria-hidden="true"></i> |
283 | - <span class="screen-reader-text"><?php esc_html_e( 'Download XML', 'invoicing' ); ?></span> |
|
283 | + <span class="screen-reader-text"><?php esc_html_e('Download XML', 'invoicing'); ?></span> |
|
284 | 284 | </a> |
285 | 285 | </div> |
286 | 286 | </div> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | <?php |
301 | 301 | |
302 | - do_action( 'getpaid_reports_display_right', $this ); |
|
302 | + do_action('getpaid_reports_display_right', $this); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -310,56 +310,56 @@ discard block |
||
310 | 310 | |
311 | 311 | $cards = array( |
312 | 312 | 'total_sales' => array( |
313 | - 'description' => __( 'Gross sales in the period.', 'invoicing' ), |
|
314 | - 'label' => __( 'Gross Revenue', 'invoicing' ), |
|
313 | + 'description' => __('Gross sales in the period.', 'invoicing'), |
|
314 | + 'label' => __('Gross Revenue', 'invoicing'), |
|
315 | 315 | ), |
316 | 316 | 'net_sales' => array( |
317 | - 'description' => __( 'Net sales in the period.', 'invoicing' ), |
|
318 | - 'label' => __( 'Net Revenue', 'invoicing' ), |
|
317 | + 'description' => __('Net sales in the period.', 'invoicing'), |
|
318 | + 'label' => __('Net Revenue', 'invoicing'), |
|
319 | 319 | ), |
320 | 320 | 'average_sales' => array( |
321 | - 'description' => __( 'Average net daily/monthly sales.', 'invoicing' ), |
|
322 | - 'label' => __( 'Avg. Net Sales', 'invoicing' ), |
|
321 | + 'description' => __('Average net daily/monthly sales.', 'invoicing'), |
|
322 | + 'label' => __('Avg. Net Sales', 'invoicing'), |
|
323 | 323 | ), |
324 | 324 | 'average_total_sales' => array( |
325 | - 'description' => __( 'Average gross daily/monthly sales.', 'invoicing' ), |
|
326 | - 'label' => __( 'Avg. Gross Sales', 'invoicing' ), |
|
325 | + 'description' => __('Average gross daily/monthly sales.', 'invoicing'), |
|
326 | + 'label' => __('Avg. Gross Sales', 'invoicing'), |
|
327 | 327 | ), |
328 | 328 | 'total_invoices' => array( |
329 | - 'description' => __( 'Number of paid invoices.', 'invoicing' ), |
|
330 | - 'label' => __( 'Paid Invoices', 'invoicing' ), |
|
329 | + 'description' => __('Number of paid invoices.', 'invoicing'), |
|
330 | + 'label' => __('Paid Invoices', 'invoicing'), |
|
331 | 331 | ), |
332 | 332 | 'total_items' => array( |
333 | - 'description' => __( 'Number of items purchased.', 'invoicing' ), |
|
334 | - 'label' => __( 'Purchased Items', 'invoicing' ), |
|
333 | + 'description' => __('Number of items purchased.', 'invoicing'), |
|
334 | + 'label' => __('Purchased Items', 'invoicing'), |
|
335 | 335 | ), |
336 | 336 | 'refunded_items' => array( |
337 | - 'description' => __( 'Number of items refunded.', 'invoicing' ), |
|
338 | - 'label' => __( 'Refunded Items', 'invoicing' ), |
|
337 | + 'description' => __('Number of items refunded.', 'invoicing'), |
|
338 | + 'label' => __('Refunded Items', 'invoicing'), |
|
339 | 339 | ), |
340 | 340 | 'total_tax' => array( |
341 | - 'description' => __( 'Total charged for taxes.', 'invoicing' ), |
|
342 | - 'label' => __( 'Tax', 'invoicing' ), |
|
341 | + 'description' => __('Total charged for taxes.', 'invoicing'), |
|
342 | + 'label' => __('Tax', 'invoicing'), |
|
343 | 343 | ), |
344 | 344 | 'total_refunded_tax' => array( |
345 | - 'description' => __( 'Total refunded for taxes.', 'invoicing' ), |
|
346 | - 'label' => __( 'Refunded Tax', 'invoicing' ), |
|
345 | + 'description' => __('Total refunded for taxes.', 'invoicing'), |
|
346 | + 'label' => __('Refunded Tax', 'invoicing'), |
|
347 | 347 | ), |
348 | 348 | 'total_fees' => array( |
349 | - 'description' => __( 'Total fees charged.', 'invoicing' ), |
|
350 | - 'label' => __( 'Fees', 'invoicing' ), |
|
349 | + 'description' => __('Total fees charged.', 'invoicing'), |
|
350 | + 'label' => __('Fees', 'invoicing'), |
|
351 | 351 | ), |
352 | 352 | 'total_refunds' => array( |
353 | - 'description' => __( 'Total of refunded invoices.', 'invoicing' ), |
|
354 | - 'label' => __( 'Refunded', 'invoicing' ), |
|
353 | + 'description' => __('Total of refunded invoices.', 'invoicing'), |
|
354 | + 'label' => __('Refunded', 'invoicing'), |
|
355 | 355 | ), |
356 | 356 | 'total_discount' => array( |
357 | - 'description' => __( 'Total of discounts used.', 'invoicing' ), |
|
358 | - 'label' => __( 'Discounted', 'invoicing' ), |
|
357 | + 'description' => __('Total of discounts used.', 'invoicing'), |
|
358 | + 'label' => __('Discounted', 'invoicing'), |
|
359 | 359 | ), |
360 | 360 | ); |
361 | 361 | |
362 | - return apply_filters( 'wpinv_report_cards', $cards ); |
|
362 | + return apply_filters('wpinv_report_cards', $cards); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * All Invoicing extensions screen related functions can be found here. |
6 | 6 | * |
7 | 7 | */ |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; |
10 | 10 | } |
11 | 11 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function get_tabs() { |
24 | 24 | $tabs = array( |
25 | - 'addons' => __( 'Addons', 'invoicing' ), |
|
26 | - 'gateways' => __( 'Payment Gateways', 'invoicing' ), |
|
27 | - 'recommended_plugins' => __( 'Recommended plugins', 'invoicing' ), |
|
28 | - 'membership' => __( 'Membership', 'invoicing' ), |
|
25 | + 'addons' => __('Addons', 'invoicing'), |
|
26 | + 'gateways' => __('Payment Gateways', 'invoicing'), |
|
27 | + 'recommended_plugins' => __('Recommended plugins', 'invoicing'), |
|
28 | + 'membership' => __('Membership', 'invoicing'), |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | return $tabs; |
@@ -38,57 +38,57 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - public function get_section_data( $section_id ) { |
|
42 | - $section = self::get_tab( $section_id ); |
|
41 | + public function get_section_data($section_id) { |
|
42 | + $section = self::get_tab($section_id); |
|
43 | 43 | $api_url = 'https://wpinvoicing.com/edd-api/v2/products/'; |
44 | 44 | $section_data = new stdClass(); |
45 | 45 | |
46 | - if ( $section_id == 'recommended_plugins' ) { |
|
46 | + if ($section_id == 'recommended_plugins') { |
|
47 | 47 | $section_data->products = self::get_recommend_wp_plugins_edd_formatted(); |
48 | - } elseif ( ! empty( $section ) ) { |
|
49 | - if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing |
|
48 | + } elseif (!empty($section)) { |
|
49 | + if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing |
|
50 | 50 | //if ( 1==1) { |
51 | 51 | |
52 | 52 | $query_args = array( |
53 | 53 | 'category' => $section_id, |
54 | 54 | 'number' => 100, |
55 | 55 | ); |
56 | - $query_args = apply_filters( 'wpeu_edd_api_query_args', $query_args, $api_url, $section_id ); |
|
56 | + $query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id); |
|
57 | 57 | |
58 | 58 | $raw_section = wp_safe_remote_get( |
59 | - esc_url_raw( add_query_arg( $query_args, $api_url ) ), |
|
59 | + esc_url_raw(add_query_arg($query_args, $api_url)), |
|
60 | 60 | array( |
61 | 61 | 'user-agent' => 'Invoicing Addons Page', |
62 | 62 | 'timeout' => 15, |
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | |
66 | - if ( ! is_wp_error( $raw_section ) ) { |
|
67 | - $section_data = json_decode( wp_remote_retrieve_body( $raw_section ) ); |
|
66 | + if (!is_wp_error($raw_section)) { |
|
67 | + $section_data = json_decode(wp_remote_retrieve_body($raw_section)); |
|
68 | 68 | |
69 | - if ( ! empty( $section_data->products ) ) { |
|
70 | - set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS ); |
|
69 | + if (!empty($section_data->products)) { |
|
70 | + set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - $products = isset( $section_data->products ) ? $section_data->products : array(); |
|
77 | - if ( 'addons' == $section_id ) { |
|
76 | + $products = isset($section_data->products) ? $section_data->products : array(); |
|
77 | + if ('addons' == $section_id) { |
|
78 | 78 | |
79 | 79 | $quotes = new stdClass(); |
80 | 80 | $quotes->info = new stdClass(); |
81 | 81 | $quotes->info->id = ''; |
82 | 82 | $quotes->info->slug = 'invoicing-quotes'; |
83 | - $quotes->info->title = __( 'Quotes', 'invoicing' ); |
|
84 | - $quotes->info->excerpt = __( 'Create quotes and estimates', 'invoicing' ); |
|
83 | + $quotes->info->title = __('Quotes', 'invoicing'); |
|
84 | + $quotes->info->excerpt = __('Create quotes and estimates', 'invoicing'); |
|
85 | 85 | $quotes->info->link = 'https://wordpress.org/plugins/invoicing-quotes/'; |
86 | 86 | $quotes->info->thumbnail = WPINV_PLUGIN_URL . 'assets/images/Quotes-1-768x384.png'; |
87 | 87 | |
88 | 88 | $products[] = $quotes; |
89 | 89 | } |
90 | 90 | |
91 | - return apply_filters( 'wpi_addons_section_data', $products, $section_id ); |
|
91 | + return apply_filters('wpi_addons_section_data', $products, $section_id); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param string $theme |
100 | 100 | * @param string $plugin |
101 | 101 | */ |
102 | - public function output_button( $addon ) { |
|
103 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
102 | + public function output_button($addon) { |
|
103 | + $current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']); |
|
104 | 104 | // $button_text = __('Free','invoicing'); |
105 | 105 | // $licensing = false; |
106 | 106 | // $installed = false; |
@@ -112,30 +112,30 @@ discard block |
||
112 | 112 | // $install_status = 'get'; |
113 | 113 | // $onclick = ''; |
114 | 114 | |
115 | - $wp_org_themes = array( 'supreme-directory', 'directory-starter' ); |
|
115 | + $wp_org_themes = array('supreme-directory', 'directory-starter'); |
|
116 | 116 | |
117 | 117 | $button_args = array( |
118 | 118 | 'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab, |
119 | - 'id' => isset( $addon->info->id ) ? absint( $addon->info->id ) : '', |
|
120 | - 'title' => isset( $addon->info->title ) ? $addon->info->title : '', |
|
121 | - 'button_text' => __( 'Free', 'invoicing' ), |
|
122 | - 'price_text' => __( 'Free', 'invoicing' ), |
|
123 | - 'link' => isset( $addon->info->link ) ? $addon->info->link : '', // link to product |
|
124 | - 'url' => isset( $addon->info->link ) ? $addon->info->link : '', // button url |
|
119 | + 'id' => isset($addon->info->id) ? absint($addon->info->id) : '', |
|
120 | + 'title' => isset($addon->info->title) ? $addon->info->title : '', |
|
121 | + 'button_text' => __('Free', 'invoicing'), |
|
122 | + 'price_text' => __('Free', 'invoicing'), |
|
123 | + 'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product |
|
124 | + 'url' => isset($addon->info->link) ? $addon->info->link : '', // button url |
|
125 | 125 | 'class' => 'button-primary', |
126 | 126 | 'install_status' => 'get', |
127 | 127 | 'installed' => false, |
128 | 128 | 'price' => '', |
129 | - 'licensing' => isset( $addon->licensing->enabled ) && $addon->licensing->enabled ? true : false, |
|
130 | - 'license' => isset( $addon->licensing->license ) && $addon->licensing->license ? $addon->licensing->license : '', |
|
129 | + 'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false, |
|
130 | + 'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '', |
|
131 | 131 | 'onclick' => '', |
132 | - 'slug' => isset( $addon->info->slug ) ? $addon->info->slug : '', |
|
132 | + 'slug' => isset($addon->info->slug) ? $addon->info->slug : '', |
|
133 | 133 | 'active' => false, |
134 | 134 | 'file' => '', |
135 | 135 | 'update_url' => '', |
136 | 136 | ); |
137 | 137 | |
138 | - if ( 'invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ( $current_tab == 'recommended_plugins' && isset( $addon->info->slug ) && $addon->info->slug ) ) { |
|
138 | + if ('invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug)) { |
|
139 | 139 | include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. |
140 | 140 | $status = install_plugin_install_status( |
141 | 141 | array( |
@@ -143,81 +143,81 @@ discard block |
||
143 | 143 | 'version' => '', |
144 | 144 | ) |
145 | 145 | ); |
146 | - $button_args['install_status'] = isset( $status['status'] ) ? $status['status'] : 'install'; |
|
147 | - $button_args['file'] = isset( $status['file'] ) ? $status['file'] : ''; |
|
148 | - } elseif ( ($current_tab == 'addons' || $current_tab == 'gateways') && isset( $addon->info->id ) && $addon->info->id ) { |
|
146 | + $button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install'; |
|
147 | + $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
148 | + } elseif (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) { |
|
149 | 149 | include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; //for plugins_api.. |
150 | - if ( ! empty( $addon->licensing->edd_slug ) ) { |
|
151 | -$button_args['slug'] = $addon->licensing->edd_slug;} |
|
152 | - $status = self::install_plugin_install_status( $addon ); |
|
153 | - $button_args['file'] = isset( $status['file'] ) ? $status['file'] : ''; |
|
154 | - if ( isset( $status['status'] ) ) { |
|
155 | -$button_args['install_status'] = $status['status'];} |
|
150 | + if (!empty($addon->licensing->edd_slug)) { |
|
151 | +$button_args['slug'] = $addon->licensing->edd_slug; } |
|
152 | + $status = self::install_plugin_install_status($addon); |
|
153 | + $button_args['file'] = isset($status['file']) ? $status['file'] : ''; |
|
154 | + if (isset($status['status'])) { |
|
155 | +$button_args['install_status'] = $status['status']; } |
|
156 | 156 | $button_args['update_url'] = 'https://wpinvoicing.com'; |
157 | - } elseif ( $current_tab == 'themes' && isset( $addon->info->id ) && $addon->info->id ) { |
|
158 | - if ( ! empty( $addon->licensing->edd_slug ) ) { |
|
159 | -$button_args['slug'] = $addon->licensing->edd_slug;} |
|
160 | - $button_args['installed'] = self::is_theme_installed( $addon ); |
|
161 | - if ( ! in_array( $button_args['slug'], $wp_org_themes ) ) { |
|
157 | + } elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) { |
|
158 | + if (!empty($addon->licensing->edd_slug)) { |
|
159 | +$button_args['slug'] = $addon->licensing->edd_slug; } |
|
160 | + $button_args['installed'] = self::is_theme_installed($addon); |
|
161 | + if (!in_array($button_args['slug'], $wp_org_themes)) { |
|
162 | 162 | $button_args['update_url'] = 'https://wpinvoicing.com'; |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | 166 | // set price |
167 | - if ( isset( $addon->pricing ) && ! empty( $addon->pricing ) ) { |
|
168 | - if ( is_object( $addon->pricing ) ) { |
|
169 | - $prices = (array)$addon->pricing; |
|
170 | - $button_args['price'] = reset( $prices ); |
|
171 | - } elseif ( isset( $addon->pricing ) ) { |
|
167 | + if (isset($addon->pricing) && !empty($addon->pricing)) { |
|
168 | + if (is_object($addon->pricing)) { |
|
169 | + $prices = (array) $addon->pricing; |
|
170 | + $button_args['price'] = reset($prices); |
|
171 | + } elseif (isset($addon->pricing)) { |
|
172 | 172 | $button_args['price'] = $addon->pricing; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | 176 | // set price text |
177 | - if ( $button_args['price'] && $button_args['price'] != '0.00' ) { |
|
178 | - $button_args['price_text'] = sprintf( __( 'From: $%d', 'invoicing' ), $button_args['price'] ); |
|
177 | + if ($button_args['price'] && $button_args['price'] != '0.00') { |
|
178 | + $button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // set if installed |
182 | - if ( in_array( $button_args['install_status'], array( 'installed', 'latest_installed', 'update_available', 'newer_installed' ) ) ) { |
|
182 | + if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) { |
|
183 | 183 | $button_args['installed'] = true; |
184 | 184 | } |
185 | 185 | |
186 | 186 | // print_r($button_args); |
187 | 187 | // set if active |
188 | - if ( $button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes') ) { |
|
189 | - if ( $button_args['type'] != 'themes' ) { |
|
190 | - $button_args['active'] = is_plugin_active( $button_args['file'] ); |
|
188 | + if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) { |
|
189 | + if ($button_args['type'] != 'themes') { |
|
190 | + $button_args['active'] = is_plugin_active($button_args['file']); |
|
191 | 191 | } else { |
192 | - $button_args['active'] = self::is_theme_active( $addon ); |
|
192 | + $button_args['active'] = self::is_theme_active($addon); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | 196 | // set button text and class |
197 | - if ( $button_args['active'] ) { |
|
198 | - $button_args['button_text'] = __( 'Active', 'invoicing' ); |
|
197 | + if ($button_args['active']) { |
|
198 | + $button_args['button_text'] = __('Active', 'invoicing'); |
|
199 | 199 | $button_args['class'] = ' button-secondary disabled '; |
200 | - } elseif ( $button_args['installed'] ) { |
|
201 | - $button_args['button_text'] = __( 'Activate', 'invoicing' ); |
|
200 | + } elseif ($button_args['installed']) { |
|
201 | + $button_args['button_text'] = __('Activate', 'invoicing'); |
|
202 | 202 | |
203 | - if ( $button_args['type'] != 'themes' ) { |
|
204 | - if ( current_user_can( 'manage_options' ) ) { |
|
205 | - $button_args['url'] = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $button_args['file'] ), 'activate-plugin_' . $button_args['file'] ); |
|
203 | + if ($button_args['type'] != 'themes') { |
|
204 | + if (current_user_can('manage_options')) { |
|
205 | + $button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']); |
|
206 | 206 | } else { |
207 | 207 | $button_args['url'] = '#'; |
208 | 208 | } |
209 | 209 | } else { |
210 | - if ( current_user_can( 'switch_themes' ) ) { |
|
211 | - $button_args['url'] = self::get_theme_activation_url( $addon ); |
|
210 | + if (current_user_can('switch_themes')) { |
|
211 | + $button_args['url'] = self::get_theme_activation_url($addon); |
|
212 | 212 | } else { |
213 | 213 | $button_args['url'] = '#'; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | } else { |
217 | - if ( $button_args['type'] == 'recommended_plugins' ) { |
|
218 | - $button_args['button_text'] = __( 'Install', 'invoicing' ); |
|
217 | + if ($button_args['type'] == 'recommended_plugins') { |
|
218 | + $button_args['button_text'] = __('Install', 'invoicing'); |
|
219 | 219 | } else { |
220 | - $button_args['button_text'] = __( 'Get it', 'invoicing' ); |
|
220 | + $button_args['button_text'] = __('Get it', 'invoicing'); |
|
221 | 221 | |
222 | 222 | /*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){ |
223 | 223 | $button_args['button_text'] = __('Install','invoicing'); |
@@ -229,41 +229,41 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | // filter the button arguments |
232 | - $button_args = apply_filters( 'edd_api_button_args', $button_args ); |
|
232 | + $button_args = apply_filters('edd_api_button_args', $button_args); |
|
233 | 233 | // print_r($button_args); |
234 | 234 | // set price text |
235 | - if ( isset( $button_args['price_text'] ) ) { |
|
235 | + if (isset($button_args['price_text'])) { |
|
236 | 236 | ?> |
237 | 237 | <a |
238 | 238 | target="_blank" |
239 | 239 | class="addons-price-text" |
240 | - href="<?php echo esc_url( $button_args['link'] ); ?>"> |
|
241 | - <?php echo esc_html( $button_args['price_text'] ); ?> |
|
240 | + href="<?php echo esc_url($button_args['link']); ?>"> |
|
241 | + <?php echo esc_html($button_args['price_text']); ?> |
|
242 | 242 | </a> |
243 | 243 | <?php |
244 | 244 | } |
245 | 245 | |
246 | 246 | ?> |
247 | 247 | <a |
248 | - data-licence="<?php echo esc_attr( $button_args['license'] ); ?>" |
|
248 | + data-licence="<?php echo esc_attr($button_args['license']); ?>" |
|
249 | 249 | data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>" |
250 | - data-title="<?php echo esc_attr( $button_args['title'] ); ?>" |
|
251 | - data-type="<?php echo esc_attr( $button_args['type'] ); ?>" |
|
252 | - data-text-error-message="<?php esc_attr_e( 'Something went wrong!', 'invoicing' ); ?>" |
|
253 | - data-text-activate="<?php esc_attr_e( 'Activate', 'invoicing' ); ?>" |
|
254 | - data-text-activating="<?php esc_attr_e( 'Activating', 'invoicing' ); ?>" |
|
255 | - data-text-deactivate="<?php esc_attr_e( 'Deactivate', 'invoicing' ); ?>" |
|
256 | - data-text-installed="<?php esc_attr_e( 'Installed', 'invoicing' ); ?>" |
|
257 | - data-text-install="<?php esc_attr_e( 'Install', 'invoicing' ); ?>" |
|
258 | - data-text-installing="<?php esc_attr_e( 'Installing', 'invoicing' ); ?>" |
|
259 | - data-text-error="<?php esc_attr_e( 'Error', 'invoicing' ); ?>" |
|
250 | + data-title="<?php echo esc_attr($button_args['title']); ?>" |
|
251 | + data-type="<?php echo esc_attr($button_args['type']); ?>" |
|
252 | + data-text-error-message="<?php esc_attr_e('Something went wrong!', 'invoicing'); ?>" |
|
253 | + data-text-activate="<?php esc_attr_e('Activate', 'invoicing'); ?>" |
|
254 | + data-text-activating="<?php esc_attr_e('Activating', 'invoicing'); ?>" |
|
255 | + data-text-deactivate="<?php esc_attr_e('Deactivate', 'invoicing'); ?>" |
|
256 | + data-text-installed="<?php esc_attr_e('Installed', 'invoicing'); ?>" |
|
257 | + data-text-install="<?php esc_attr_e('Install', 'invoicing'); ?>" |
|
258 | + data-text-installing="<?php esc_attr_e('Installing', 'invoicing'); ?>" |
|
259 | + data-text-error="<?php esc_attr_e('Error', 'invoicing'); ?>" |
|
260 | 260 | <?php |
261 | - if ( ! empty( $button_args['onclick'] ) ) { |
|
262 | -echo " onclick='" . esc_attr( $button_args['onclick'] ) . "' ";} |
|
261 | + if (!empty($button_args['onclick'])) { |
|
262 | +echo " onclick='" . esc_attr($button_args['onclick']) . "' "; } |
|
263 | 263 | ?> |
264 | - class="addons-button <?php echo esc_attr( $button_args['class'] ); ?>" |
|
265 | - href="<?php echo esc_url( $button_args['url'] ); ?>"> |
|
266 | - <?php echo esc_html( $button_args['button_text'] ); ?> |
|
264 | + class="addons-button <?php echo esc_attr($button_args['class']); ?>" |
|
265 | + href="<?php echo esc_url($button_args['url']); ?>"> |
|
266 | + <?php echo esc_html($button_args['button_text']); ?> |
|
267 | 267 | </a> |
268 | 268 | <?php |
269 | 269 | |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | $tabs = self::get_tabs(); |
278 | 278 | $sections = self::get_sections(); |
279 | 279 | $theme = wp_get_theme(); |
280 | - $section_keys = array_keys( $sections ); |
|
281 | - $current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys ); |
|
282 | - $current_tab = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] ); |
|
280 | + $section_keys = array_keys($sections); |
|
281 | + $current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys); |
|
282 | + $current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']); |
|
283 | 283 | include_once WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php'; |
284 | 284 | } |
285 | 285 | |
@@ -294,19 +294,19 @@ discard block |
||
294 | 294 | 'slug' => 'invoicing-quotes', |
295 | 295 | 'name' => 'Quotes', |
296 | 296 | 'thumbnail' => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.png', |
297 | - 'desc' => __( 'Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing' ), |
|
297 | + 'desc' => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'), |
|
298 | 298 | ), |
299 | 299 | 'geodirectory' => array( |
300 | 300 | 'url' => 'https://wordpress.org/plugins/geodirectory/', |
301 | 301 | 'slug' => 'geodirectory', |
302 | 302 | 'name' => 'GeoDirectory', |
303 | - 'desc' => __( 'Turn any WordPress theme into a global business directory portal.', 'invoicing' ), |
|
303 | + 'desc' => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'), |
|
304 | 304 | ), |
305 | 305 | 'userswp' => array( |
306 | 306 | 'url' => 'https://wordpress.org/plugins/userswp/', |
307 | 307 | 'slug' => 'userswp', |
308 | 308 | 'name' => 'UsersWP', |
309 | - 'desc' => __( 'Allow frontend user login and registration as well as have slick profile pages.', 'invoicing' ), |
|
309 | + 'desc' => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'), |
|
310 | 310 | ), |
311 | 311 | ); |
312 | 312 |