@@ -46,62 +46,62 @@ discard block |
||
| 46 | 46 | <td style="width: 65%"> |
| 47 | 47 | <?php |
| 48 | 48 | |
| 49 | - switch ( $key ) { |
|
| 49 | + switch ( $key ) { |
|
| 50 | 50 | |
| 51 | - case 'status': |
|
| 52 | - echo esc_html( $subscription->get_status_label() ); |
|
| 53 | - break; |
|
| 51 | + case 'status': |
|
| 52 | + echo esc_html( $subscription->get_status_label() ); |
|
| 53 | + break; |
|
| 54 | 54 | |
| 55 | - case 'start_date': |
|
| 56 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
| 57 | - break; |
|
| 55 | + case 'start_date': |
|
| 56 | + echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
| 57 | + break; |
|
| 58 | 58 | |
| 59 | - case 'expiry_date': |
|
| 60 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
| 61 | - break; |
|
| 59 | + case 'expiry_date': |
|
| 60 | + echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
| 61 | + break; |
|
| 62 | 62 | |
| 63 | - case 'initial_amount': |
|
| 64 | - echo wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
| 63 | + case 'initial_amount': |
|
| 64 | + echo 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 | - echo "<small class='text-muted'> "; |
|
| 69 | - printf( |
|
| 70 | - _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
| 71 | - esc_html( $subscription->get_trial_period() ) |
|
| 72 | - ); |
|
| 73 | - echo '</small>'; |
|
| 68 | + echo "<small class='text-muted'> "; |
|
| 69 | + printf( |
|
| 70 | + _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
| 71 | + esc_html( $subscription->get_trial_period() ) |
|
| 72 | + ); |
|
| 73 | + echo '</small>'; |
|
| 74 | 74 | |
| 75 | - } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - break; |
|
| 77 | + break; |
|
| 78 | 78 | |
| 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>" ) ); |
|
| 83 | - break; |
|
| 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>" ) ); |
|
| 83 | + break; |
|
| 84 | 84 | |
| 85 | - case 'item': |
|
| 86 | - if ( empty( $subscription_group ) ) { |
|
| 87 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
| 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 ) ); |
|
| 91 | - } |
|
| 85 | + case 'item': |
|
| 86 | + if ( empty( $subscription_group ) ) { |
|
| 87 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
| 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 ) ); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - break; |
|
| 93 | + break; |
|
| 94 | 94 | |
| 95 | - case 'payments': |
|
| 96 | - $max_activations = (int) $subscription->get_bill_times(); |
|
| 97 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
| 95 | + case 'payments': |
|
| 96 | + $max_activations = (int) $subscription->get_bill_times(); |
|
| 97 | + echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '∞' : (int) $max_activations ); |
|
| 98 | 98 | |
| 99 | - break; |
|
| 99 | + break; |
|
| 100 | 100 | |
| 101 | - } |
|
| 102 | - do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
| 101 | + } |
|
| 102 | + do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
| 103 | 103 | |
| 104 | - ?> |
|
| 104 | + ?> |
|
| 105 | 105 | </td> |
| 106 | 106 | |
| 107 | 107 | </tr> |
@@ -128,17 +128,17 @@ discard block |
||
| 128 | 128 | <span class="form-text"> |
| 129 | 129 | |
| 130 | 130 | <?php |
| 131 | - if ( $subscription->can_cancel() ) { |
|
| 132 | - printf( |
|
| 131 | + if ( $subscription->can_cancel() ) { |
|
| 132 | + printf( |
|
| 133 | 133 | '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
| 134 | 134 | esc_url( $subscription->get_cancel_url() ), |
| 135 | 135 | esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
| 136 | 136 | __( 'Cancel Subscription', 'invoicing' ) |
| 137 | 137 | ); |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
| 141 | - ?> |
|
| 140 | + do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
| 141 | + ?> |
|
| 142 | 142 | |
| 143 | 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 _e( 'Go Back', 'invoicing' ); ?></a> |
| 144 | 144 | </span> |
@@ -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 _e( 'Subscription Details', 'invoicing' ); ?></h2> |
|
| 34 | +<h2 class="mb-1 h4"><?php _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 wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
| 64 | + echo 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 | - _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
| 71 | - esc_html( $subscription->get_trial_period() ) |
|
| 70 | + _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 _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 _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 _e( 'Related Invoices', 'invoicing' ); ?></h2> |
|
| 119 | +<h2 class='mt-5 mb-1 h4'><?php _e('Related Invoices', 'invoicing'); ?></h2> |
|
| 120 | 120 | |
| 121 | -<?php echo getpaid_admin_subscription_invoice_details_metabox( $subscription ); ?> |
|
| 121 | +<?php echo 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 _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 _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 | - __( 'Cancel Subscription', 'invoicing' ) |
|
| 134 | + esc_url($subscription->get_cancel_url()), |
|
| 135 | + esc_attr__('Are you sure you want to cancel this subscription?', 'invoicing'), |
|
| 136 | + __('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 _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 _e('Go Back', 'invoicing'); ?></a> |
|
| 144 | 144 | </span> |
@@ -26,58 +26,58 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - // Fires before printing a line item column. |
|
| 30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 31 | - |
|
| 32 | - // Item name. |
|
| 33 | - if ( 'name' == $key ) { |
|
| 34 | - |
|
| 35 | - ob_start(); |
|
| 36 | - // And an optional description. |
|
| 37 | - $description = $item->get_description(); |
|
| 38 | - |
|
| 39 | - if ( ! empty( $description ) ) { |
|
| 40 | - $description = wp_kses_post( $description ); |
|
| 41 | - echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - // Price help text. |
|
| 45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | - if ( $description ) { |
|
| 47 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 51 | - |
|
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 53 | - |
|
| 54 | - edit_post_link( |
|
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 56 | - '<small class="form-text text-muted">', |
|
| 57 | - '</small>', |
|
| 58 | - $item->get_id(), |
|
| 59 | - 'text-danger' |
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - $description = ob_get_clean(); |
|
| 65 | - |
|
| 66 | - // Display the name. |
|
| 67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 69 | - |
|
| 70 | - if ( ! empty( $description ) ) { |
|
| 71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - if ( $item->allows_quantities() ) { |
|
| 75 | - printf( |
|
| 76 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 77 | - sprintf( |
|
| 78 | - __( 'Qty %s', 'invoicing' ), |
|
| 79 | - sprintf( |
|
| 80 | - '<input |
|
| 29 | + // Fires before printing a line item column. |
|
| 30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 31 | + |
|
| 32 | + // Item name. |
|
| 33 | + if ( 'name' == $key ) { |
|
| 34 | + |
|
| 35 | + ob_start(); |
|
| 36 | + // And an optional description. |
|
| 37 | + $description = $item->get_description(); |
|
| 38 | + |
|
| 39 | + if ( ! empty( $description ) ) { |
|
| 40 | + $description = wp_kses_post( $description ); |
|
| 41 | + echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + // Price help text. |
|
| 45 | + $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | + if ( $description ) { |
|
| 47 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 51 | + |
|
| 52 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 53 | + |
|
| 54 | + edit_post_link( |
|
| 55 | + __( 'Edit this item.', 'invoicing' ), |
|
| 56 | + '<small class="form-text text-muted">', |
|
| 57 | + '</small>', |
|
| 58 | + $item->get_id(), |
|
| 59 | + 'text-danger' |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + $description = ob_get_clean(); |
|
| 65 | + |
|
| 66 | + // Display the name. |
|
| 67 | + $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 69 | + |
|
| 70 | + if ( ! empty( $description ) ) { |
|
| 71 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + if ( $item->allows_quantities() ) { |
|
| 75 | + printf( |
|
| 76 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 77 | + sprintf( |
|
| 78 | + __( 'Qty %s', 'invoicing' ), |
|
| 79 | + sprintf( |
|
| 80 | + '<input |
|
| 81 | 81 | type="number" |
| 82 | 82 | step="0.01" |
| 83 | 83 | style="width: 48px;" |
@@ -87,53 +87,53 @@ discard block |
||
| 87 | 87 | %s>', |
| 88 | 88 | (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
| 89 | 89 | null !== $max_qty ? 'max="' . (float) $max_qty . '"' : '' |
| 90 | - ) |
|
| 91 | - ) |
|
| 92 | - ); |
|
| 93 | - } else { |
|
| 94 | - printf( |
|
| 95 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 96 | - sprintf( |
|
| 97 | - __( 'Qty %s', 'invoicing' ), |
|
| 98 | - (float) $item->get_quantity() |
|
| 99 | - ) |
|
| 100 | - ); |
|
| 101 | - } |
|
| 90 | + ) |
|
| 91 | + ) |
|
| 92 | + ); |
|
| 93 | + } else { |
|
| 94 | + printf( |
|
| 95 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 96 | + sprintf( |
|
| 97 | + __( 'Qty %s', 'invoicing' ), |
|
| 98 | + (float) $item->get_quantity() |
|
| 99 | + ) |
|
| 100 | + ); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - // Item price. |
|
| 105 | - if ( 'price' == $key ) { |
|
| 104 | + // Item price. |
|
| 105 | + if ( 'price' == $key ) { |
|
| 106 | 106 | |
| 107 | - // Set the currency position. |
|
| 108 | - $position = wpinv_currency_position(); |
|
| 107 | + // Set the currency position. |
|
| 108 | + $position = wpinv_currency_position(); |
|
| 109 | 109 | |
| 110 | - if ( $position == 'left_space' ) { |
|
| 111 | - $position = 'left'; |
|
| 112 | - } |
|
| 110 | + if ( $position == 'left_space' ) { |
|
| 111 | + $position = 'left'; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - if ( $position == 'right_space' ) { |
|
| 115 | - $position = 'right'; |
|
| 116 | - } |
|
| 114 | + if ( $position == 'right_space' ) { |
|
| 115 | + $position = 'right'; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - if ( $item->user_can_set_their_price() ) { |
|
| 119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 120 | - $minimum = (float) $item->get_minimum_price(); |
|
| 121 | - $validate_minimum = ''; |
|
| 122 | - $class = ''; |
|
| 123 | - $data_minimum = ''; |
|
| 118 | + if ( $item->user_can_set_their_price() ) { |
|
| 119 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 120 | + $minimum = (float) $item->get_minimum_price(); |
|
| 121 | + $validate_minimum = ''; |
|
| 122 | + $class = ''; |
|
| 123 | + $data_minimum = ''; |
|
| 124 | 124 | |
| 125 | - if ( $minimum > 0 ) { |
|
| 126 | - $validate_minimum = sprintf( |
|
| 127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 129 | - ); |
|
| 125 | + if ( $minimum > 0 ) { |
|
| 126 | + $validate_minimum = sprintf( |
|
| 127 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 128 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 129 | + ); |
|
| 130 | 130 | |
| 131 | - $class = 'getpaid-validate-minimum-amount'; |
|
| 131 | + $class = 'getpaid-validate-minimum-amount'; |
|
| 132 | 132 | |
| 133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 134 | - } |
|
| 133 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - ?> |
|
| 136 | + ?> |
|
| 137 | 137 | <div class="input-group input-group-sm"> |
| 138 | 138 | <?php if ( 'left' == $position ) : ?> |
| 139 | 139 | <div class="input-group-prepend"> |
@@ -158,43 +158,43 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | <?php |
| 160 | 160 | |
| 161 | - } else { |
|
| 162 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 161 | + } else { |
|
| 162 | + echo wpinv_price( $item->get_price(), $currency ); |
|
| 163 | 163 | |
| 164 | - ?> |
|
| 164 | + ?> |
|
| 165 | 165 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
| 166 | 166 | <?php |
| 167 | - } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - printf( |
|
| 169 | + printf( |
|
| 170 | 170 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
| 171 | 171 | sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
| 172 | 172 | ); |
| 173 | - } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - // Item quantity. |
|
| 176 | - if ( 'quantity' == $key ) { |
|
| 175 | + // Item quantity. |
|
| 176 | + if ( 'quantity' == $key ) { |
|
| 177 | 177 | |
| 178 | - if ( $item->allows_quantities() ) { |
|
| 179 | - ?> |
|
| 178 | + if ( $item->allows_quantities() ) { |
|
| 179 | + ?> |
|
| 180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required> |
| 181 | 181 | <?php |
| 182 | - } else { |
|
| 183 | - echo (float) $item->get_quantity(); |
|
| 184 | - echo ' '; |
|
| 185 | - ?> |
|
| 182 | + } else { |
|
| 183 | + echo (float) $item->get_quantity(); |
|
| 184 | + echo ' '; |
|
| 185 | + ?> |
|
| 186 | 186 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
| 187 | 187 | <?php |
| 188 | - } |
|
| 188 | + } |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - // Item sub total. |
|
| 192 | - if ( 'subtotal' == $key ) { |
|
| 193 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 194 | - } |
|
| 191 | + // Item sub total. |
|
| 192 | + if ( 'subtotal' == $key ) { |
|
| 193 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 197 | - ?> |
|
| 196 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 197 | + ?> |
|
| 198 | 198 | |
| 199 | 199 | </div> |
| 200 | 200 | |
@@ -9,50 +9,50 @@ discard block |
||
| 9 | 9 | * @var GetPaid_Form_Item $item |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | -do_action( 'getpaid_before_payment_form_cart_item', $form, $item ); |
|
| 14 | +do_action('getpaid_before_payment_form_cart_item', $form, $item); |
|
| 15 | 15 | |
| 16 | 16 | $currency = $form->get_currency(); |
| 17 | -$max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
| 17 | +$max_qty = wpinv_item_max_buyable_quantity($item->get_id()); |
|
| 18 | 18 | ?> |
| 19 | 19 | <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'> |
| 20 | 20 | |
| 21 | 21 | <div class="form-row needs-validation"> |
| 22 | 22 | |
| 23 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
| 23 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
| 24 | 24 | |
| 25 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
| 25 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | 29 | // Fires before printing a line item column. |
| 30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 30 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
| 31 | 31 | |
| 32 | 32 | // Item name. |
| 33 | - if ( 'name' == $key ) { |
|
| 33 | + if ('name' == $key) { |
|
| 34 | 34 | |
| 35 | 35 | ob_start(); |
| 36 | 36 | // And an optional description. |
| 37 | 37 | $description = $item->get_description(); |
| 38 | 38 | |
| 39 | - if ( ! empty( $description ) ) { |
|
| 40 | - $description = wp_kses_post( $description ); |
|
| 39 | + if (!empty($description)) { |
|
| 40 | + $description = wp_kses_post($description); |
|
| 41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Price help text. |
| 45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | - if ( $description ) { |
|
| 45 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
| 46 | + if ($description) { |
|
| 47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 50 | + do_action('getpaid_payment_form_cart_item_description', $item, $form); |
|
| 51 | 51 | |
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 52 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
| 53 | 53 | |
| 54 | 54 | edit_post_link( |
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 55 | + __('Edit this item.', 'invoicing'), |
|
| 56 | 56 | '<small class="form-text text-muted">', |
| 57 | 57 | '</small>', |
| 58 | 58 | $item->get_id(), |
@@ -64,18 +64,18 @@ discard block |
||
| 64 | 64 | $description = ob_get_clean(); |
| 65 | 65 | |
| 66 | 66 | // Display the name. |
| 67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 67 | + $tootip = empty($description) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>'; |
|
| 69 | 69 | |
| 70 | - if ( ! empty( $description ) ) { |
|
| 71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 70 | + if (!empty($description)) { |
|
| 71 | + printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( $item->allows_quantities() ) { |
|
| 74 | + if ($item->allows_quantities()) { |
|
| 75 | 75 | printf( |
| 76 | 76 | '<small class="d-sm-none text-muted form-text">%s</small>', |
| 77 | 77 | sprintf( |
| 78 | - __( 'Qty %s', 'invoicing' ), |
|
| 78 | + __('Qty %s', 'invoicing'), |
|
| 79 | 79 | sprintf( |
| 80 | 80 | '<input |
| 81 | 81 | type="number" |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | printf( |
| 95 | 95 | '<small class="d-sm-none text-muted form-text">%s</small>', |
| 96 | 96 | sprintf( |
| 97 | - __( 'Qty %s', 'invoicing' ), |
|
| 97 | + __('Qty %s', 'invoicing'), |
|
| 98 | 98 | (float) $item->get_quantity() |
| 99 | 99 | ) |
| 100 | 100 | ); |
@@ -102,56 +102,56 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // Item price. |
| 105 | - if ( 'price' == $key ) { |
|
| 105 | + if ('price' == $key) { |
|
| 106 | 106 | |
| 107 | 107 | // Set the currency position. |
| 108 | 108 | $position = wpinv_currency_position(); |
| 109 | 109 | |
| 110 | - if ( $position == 'left_space' ) { |
|
| 110 | + if ($position == 'left_space') { |
|
| 111 | 111 | $position = 'left'; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( $position == 'right_space' ) { |
|
| 114 | + if ($position == 'right_space') { |
|
| 115 | 115 | $position = 'right'; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( $item->user_can_set_their_price() ) { |
|
| 119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 118 | + if ($item->user_can_set_their_price()) { |
|
| 119 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
| 120 | 120 | $minimum = (float) $item->get_minimum_price(); |
| 121 | 121 | $validate_minimum = ''; |
| 122 | 122 | $class = ''; |
| 123 | 123 | $data_minimum = ''; |
| 124 | 124 | |
| 125 | - if ( $minimum > 0 ) { |
|
| 125 | + if ($minimum > 0) { |
|
| 126 | 126 | $validate_minimum = sprintf( |
| 127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 127 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
| 128 | + strip_tags(wpinv_price($minimum, $currency)) |
|
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | $class = 'getpaid-validate-minimum-amount'; |
| 132 | 132 | |
| 133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 133 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | ?> |
| 137 | 137 | <div class="input-group input-group-sm"> |
| 138 | - <?php if ( 'left' == $position ) : ?> |
|
| 138 | + <?php if ('left' == $position) : ?> |
|
| 139 | 139 | <div class="input-group-prepend"> |
| 140 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
| 140 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 141 | 141 | </div> |
| 142 | 142 | <?php endif; ?> |
| 143 | 143 | |
| 144 | - <input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
| 144 | + <input type="text" <?php echo $data_minimum; ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
| 145 | 145 | |
| 146 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
| 146 | + <?php if (!empty($validate_minimum)) : ?> |
|
| 147 | 147 | <div class="invalid-tooltip"> |
| 148 | 148 | <?php echo $validate_minimum; ?> |
| 149 | 149 | </div> |
| 150 | 150 | <?php endif; ?> |
| 151 | 151 | |
| 152 | - <?php if ( 'left' != $position ) : ?> |
|
| 152 | + <?php if ('left' != $position) : ?> |
|
| 153 | 153 | <div class="input-group-append"> |
| 154 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
| 154 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 155 | 155 | </div> |
| 156 | 156 | <?php endif; ?> |
| 157 | 157 | </div> |
@@ -159,23 +159,23 @@ discard block |
||
| 159 | 159 | <?php |
| 160 | 160 | |
| 161 | 161 | } else { |
| 162 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 162 | + echo wpinv_price($item->get_price(), $currency); |
|
| 163 | 163 | |
| 164 | 164 | ?> |
| 165 | - <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
|
| 165 | + <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'> |
|
| 166 | 166 | <?php |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | printf( |
| 170 | 170 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
| 171 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 171 | + sprintf(__('Subtotal: %s', 'invoicing'), wpinv_price($item->get_sub_total(), $currency)) |
|
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // Item quantity. |
| 176 | - if ( 'quantity' == $key ) { |
|
| 176 | + if ('quantity' == $key) { |
|
| 177 | 177 | |
| 178 | - if ( $item->allows_quantities() ) { |
|
| 178 | + if ($item->allows_quantities()) { |
|
| 179 | 179 | ?> |
| 180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required> |
| 181 | 181 | <?php |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Item sub total. |
| 192 | - if ( 'subtotal' == $key ) { |
|
| 193 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 192 | + if ('subtotal' == $key) { |
|
| 193 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 196 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
| 197 | 197 | ?> |
| 198 | 198 | |
| 199 | 199 | </div> |
@@ -204,4 +204,4 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | </div> |
| 206 | 206 | <?php |
| 207 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
| 207 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
|
@@ -1,32 +1,32 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - // Is the request set up correctly? |
|
| 4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | - return aui()->alert( |
|
| 3 | + // Is the request set up correctly? |
|
| 4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | + return aui()->alert( |
|
| 6 | 6 | array( |
| 7 | - 'type' => 'warning', |
|
| 8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 7 | + 'type' => 'warning', |
|
| 8 | + 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 9 | 9 | ) |
| 10 | 10 | ); |
| 11 | 11 | wp_die( __( 'No payment form or item selected', 'invoicing' ), 400 ); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - // Payment form or button? |
|
| 15 | - if ( ! empty( $_GET['form'] ) ) { |
|
| 14 | + // Payment form or button? |
|
| 15 | + if ( ! empty( $_GET['form'] ) ) { |
|
| 16 | 16 | |
| 17 | - $shortcode = sprintf( |
|
| 17 | + $shortcode = sprintf( |
|
| 18 | 18 | '[getpaid form=%s]', |
| 19 | 19 | (int) $_GET['form'] |
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - } else { |
|
| 22 | + } else { |
|
| 23 | 23 | |
| 24 | - $shortcode = sprintf( |
|
| 24 | + $shortcode = sprintf( |
|
| 25 | 25 | '[getpaid item=%s]', |
| 26 | 26 | esc_attr( urldecode( $_GET['item'] ) ) |
| 27 | - ); |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | ?> |
| 32 | 32 | |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <title>GetPaid</title> |
| 46 | 46 | <?php |
| 47 | - wp_enqueue_scripts(); |
|
| 48 | - wp_print_styles(); |
|
| 49 | - wp_print_head_scripts(); |
|
| 50 | - wp_custom_css_cb(); |
|
| 51 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 52 | - ?> |
|
| 47 | + wp_enqueue_scripts(); |
|
| 48 | + wp_print_styles(); |
|
| 49 | + wp_print_head_scripts(); |
|
| 50 | + wp_custom_css_cb(); |
|
| 51 | + wpinv_get_template( 'frontend-head.php' ); |
|
| 52 | + ?> |
|
| 53 | 53 | |
| 54 | 54 | <style type="text/css"> |
| 55 | 55 | .body{ |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | <body class="body page-template-default page"> |
| 84 | 84 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
| 85 | 85 | <?php |
| 86 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
| 87 | - echo do_shortcode( $shortcode ); |
|
| 88 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 89 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 90 | - ?> |
|
| 86 | + do_action( 'getpaid_payment_form_embed_top' ); |
|
| 87 | + echo do_shortcode( $shortcode ); |
|
| 88 | + do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 89 | + wpinv_get_template( 'frontend-footer.php' ); |
|
| 90 | + ?> |
|
| 91 | 91 | </div> |
| 92 | 92 | <?php wp_footer(); ?> |
| 93 | 93 | </body> |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Is the request set up correctly? |
| 4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 4 | + if (empty($_GET['form']) && empty($_GET['item'])) { |
|
| 5 | 5 | return aui()->alert( |
| 6 | 6 | array( |
| 7 | 7 | 'type' => 'warning', |
| 8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
| 8 | + 'content' => __('No payment form or item selected', 'invoicing'), |
|
| 9 | 9 | ) |
| 10 | 10 | ); |
| 11 | -wp_die( __( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 11 | +wp_die(__('No payment form or item selected', 'invoicing'), 400); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // Payment form or button? |
| 15 | - if ( ! empty( $_GET['form'] ) ) { |
|
| 15 | + if (!empty($_GET['form'])) { |
|
| 16 | 16 | |
| 17 | 17 | $shortcode = sprintf( |
| 18 | 18 | '[getpaid form=%s]', |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $shortcode = sprintf( |
| 25 | 25 | '[getpaid item=%s]', |
| 26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
| 26 | + esc_attr(urldecode($_GET['item'])) |
|
| 27 | 27 | ); |
| 28 | 28 | |
| 29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | <head> |
| 37 | 37 | |
| 38 | - <meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
| 38 | + <meta charset="<?php bloginfo('charset'); ?>"> |
|
| 39 | 39 | <meta name="viewport" content="width=device-width, initial-scale=1.0" > |
| 40 | 40 | |
| 41 | 41 | <meta name="robots" content="noindex,nofollow"> |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | wp_print_styles(); |
| 49 | 49 | wp_print_head_scripts(); |
| 50 | 50 | wp_custom_css_cb(); |
| 51 | - wpinv_get_template( 'frontend-head.php' ); |
|
| 51 | + wpinv_get_template('frontend-head.php'); |
|
| 52 | 52 | ?> |
| 53 | 53 | |
| 54 | 54 | <style type="text/css"> |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | <body class="body page-template-default page"> |
| 84 | 84 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
| 85 | 85 | <?php |
| 86 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
| 87 | - echo do_shortcode( $shortcode ); |
|
| 88 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
| 89 | - wpinv_get_template( 'frontend-footer.php' ); |
|
| 86 | + do_action('getpaid_payment_form_embed_top'); |
|
| 87 | + echo do_shortcode($shortcode); |
|
| 88 | + do_action('getpaid_payment_form_embed_bottom'); |
|
| 89 | + wpinv_get_template('frontend-footer.php'); |
|
| 90 | 90 | ?> |
| 91 | 91 | </div> |
| 92 | 92 | <?php wp_footer(); ?> |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
| 36 | 36 | |
| 37 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 38 | - return 'manage_options'; |
|
| 39 | - }; |
|
| 37 | + if ( current_user_can( 'manage_options' ) ) { |
|
| 38 | + return 'manage_options'; |
|
| 39 | + }; |
|
| 40 | 40 | |
| 41 | - return $capalibilty; |
|
| 41 | + return $capalibilty; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | // Prepare user values. |
| 63 | 63 | $prefix = preg_replace( '/\s+/', '', $prefix ); |
| 64 | 64 | $prefix = empty( $prefix ) ? $email : $prefix; |
| 65 | - $args = array( |
|
| 66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
| 67 | - 'user_pass' => wp_generate_password(), |
|
| 68 | - 'user_email' => $email, |
|
| 65 | + $args = array( |
|
| 66 | + 'user_login' => wpinv_generate_user_name( $prefix ), |
|
| 67 | + 'user_pass' => wp_generate_password(), |
|
| 68 | + 'user_email' => $email, |
|
| 69 | 69 | 'role' => 'subscriber', |
| 70 | 70 | ); |
| 71 | 71 | |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | function wpinv_generate_user_name( $prefix = '' ) { |
| 83 | 83 | |
| 84 | 84 | // If prefix is an email, retrieve the part before the email. |
| 85 | - $prefix = strtok( $prefix, '@' ); |
|
| 85 | + $prefix = strtok( $prefix, '@' ); |
|
| 86 | 86 | $prefix = trim( $prefix, '.' ); |
| 87 | 87 | |
| 88 | - // Sanitize the username. |
|
| 89 | - $prefix = sanitize_user( $prefix, true ); |
|
| 88 | + // Sanitize the username. |
|
| 89 | + $prefix = sanitize_user( $prefix, true ); |
|
| 90 | 90 | |
| 91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 94 | - } |
|
| 91 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 92 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 93 | + $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | $username = $prefix; |
| 97 | 97 | $postfix = 2; |
@@ -220,52 +220,52 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | foreach ( getpaid_user_address_fields() as $key => $label ) { |
| 222 | 222 | |
| 223 | - // Display the country. |
|
| 224 | - if ( 'country' == $key ) { |
|
| 225 | - |
|
| 226 | - echo aui()->select( |
|
| 227 | - array( |
|
| 228 | - 'options' => wpinv_get_country_list(), |
|
| 229 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 230 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 231 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 232 | - 'placeholder' => $label, |
|
| 233 | - 'label' => wp_kses_post( $label ), |
|
| 234 | - 'label_type' => 'vertical', |
|
| 235 | - 'class' => 'getpaid-address-field', |
|
| 236 | - ) |
|
| 237 | - ); |
|
| 238 | - |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - // Display the state. |
|
| 242 | - elseif ( 'state' == $key ) { |
|
| 243 | - |
|
| 244 | - echo getpaid_get_states_select_markup( |
|
| 245 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
| 246 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
| 247 | - $label, |
|
| 248 | - $label, |
|
| 249 | - '', |
|
| 250 | - false, |
|
| 251 | - '', |
|
| 252 | - 'getpaid_address[' . esc_attr( $key ) . ']' |
|
| 253 | - ); |
|
| 223 | + // Display the country. |
|
| 224 | + if ( 'country' == $key ) { |
|
| 225 | + |
|
| 226 | + echo aui()->select( |
|
| 227 | + array( |
|
| 228 | + 'options' => wpinv_get_country_list(), |
|
| 229 | + 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 230 | + 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 231 | + 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 232 | + 'placeholder' => $label, |
|
| 233 | + 'label' => wp_kses_post( $label ), |
|
| 234 | + 'label_type' => 'vertical', |
|
| 235 | + 'class' => 'getpaid-address-field', |
|
| 236 | + ) |
|
| 237 | + ); |
|
| 238 | + |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + // Display the state. |
|
| 242 | + elseif ( 'state' == $key ) { |
|
| 243 | + |
|
| 244 | + echo getpaid_get_states_select_markup( |
|
| 245 | + getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
| 246 | + getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
| 247 | + $label, |
|
| 248 | + $label, |
|
| 249 | + '', |
|
| 250 | + false, |
|
| 251 | + '', |
|
| 252 | + 'getpaid_address[' . esc_attr( $key ) . ']' |
|
| 253 | + ); |
|
| 254 | 254 | |
| 255 | 255 | } else { |
| 256 | 256 | |
| 257 | - echo aui()->input( |
|
| 257 | + echo aui()->input( |
|
| 258 | 258 | array( |
| 259 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 260 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 261 | - 'placeholder' => $label, |
|
| 262 | - 'label' => wp_kses_post( $label ), |
|
| 263 | - 'label_type' => 'vertical', |
|
| 264 | - 'type' => 'text', |
|
| 265 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 266 | - 'class' => 'getpaid-address-field', |
|
| 259 | + 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 260 | + 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 261 | + 'placeholder' => $label, |
|
| 262 | + 'label' => wp_kses_post( $label ), |
|
| 263 | + 'label_type' => 'vertical', |
|
| 264 | + 'type' => 'text', |
|
| 265 | + 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 266 | + 'class' => 'getpaid-address-field', |
|
| 267 | 267 | ) |
| 268 | - ); |
|
| 268 | + ); |
|
| 269 | 269 | |
| 270 | 270 | } |
| 271 | 271 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package GetPaid |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Generates a users select dropdown. |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | * @param array $args |
| 17 | 17 | * @see wp_dropdown_users |
| 18 | 18 | */ |
| 19 | -function wpinv_dropdown_users( $args = '' ) { |
|
| 19 | +function wpinv_dropdown_users($args = '') { |
|
| 20 | 20 | |
| 21 | - if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) { |
|
| 21 | + if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) { |
|
| 22 | 22 | $args['show'] = 'display_name_with_login'; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - return wp_dropdown_users( $args ); |
|
| 25 | + return wp_dropdown_users($args); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | * @return string capability to check against |
| 33 | 33 | * @param string $capalibilty Optional. The alternative capability to check against. |
| 34 | 34 | */ |
| 35 | -function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
|
| 35 | +function wpinv_get_capability($capalibilty = 'manage_invoicing') { |
|
| 36 | 36 | |
| 37 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 37 | + if (current_user_can('manage_options')) { |
|
| 38 | 38 | return 'manage_options'; |
| 39 | 39 | }; |
| 40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @return bool |
| 49 | 49 | */ |
| 50 | 50 | function wpinv_current_user_can_manage_invoicing() { |
| 51 | - return current_user_can( wpinv_get_capability() ); |
|
| 51 | + return current_user_can(wpinv_get_capability()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -57,19 +57,19 @@ discard block |
||
| 57 | 57 | * @since 1.0.19 |
| 58 | 58 | * @return int|WP_Error |
| 59 | 59 | */ |
| 60 | -function wpinv_create_user( $email, $prefix = '' ) { |
|
| 60 | +function wpinv_create_user($email, $prefix = '') { |
|
| 61 | 61 | |
| 62 | 62 | // Prepare user values. |
| 63 | - $prefix = preg_replace( '/\s+/', '', $prefix ); |
|
| 64 | - $prefix = empty( $prefix ) ? $email : $prefix; |
|
| 65 | - $args = array( |
|
| 66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
| 63 | + $prefix = preg_replace('/\s+/', '', $prefix); |
|
| 64 | + $prefix = empty($prefix) ? $email : $prefix; |
|
| 65 | + $args = array( |
|
| 66 | + 'user_login' => wpinv_generate_user_name($prefix), |
|
| 67 | 67 | 'user_pass' => wp_generate_password(), |
| 68 | 68 | 'user_email' => $email, |
| 69 | 69 | 'role' => 'subscriber', |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - return wp_insert_user( $args ); |
|
| 72 | + return wp_insert_user($args); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
@@ -79,26 +79,26 @@ discard block |
||
| 79 | 79 | * @since 1.0.19 |
| 80 | 80 | * @return bool|WP_User |
| 81 | 81 | */ |
| 82 | -function wpinv_generate_user_name( $prefix = '' ) { |
|
| 82 | +function wpinv_generate_user_name($prefix = '') { |
|
| 83 | 83 | |
| 84 | 84 | // If prefix is an email, retrieve the part before the email. |
| 85 | - $prefix = strtok( $prefix, '@' ); |
|
| 86 | - $prefix = trim( $prefix, '.' ); |
|
| 85 | + $prefix = strtok($prefix, '@'); |
|
| 86 | + $prefix = trim($prefix, '.'); |
|
| 87 | 87 | |
| 88 | 88 | // Sanitize the username. |
| 89 | - $prefix = sanitize_user( $prefix, true ); |
|
| 89 | + $prefix = sanitize_user($prefix, true); |
|
| 90 | 90 | |
| 91 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
| 92 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
| 93 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
| 91 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
| 92 | + if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) { |
|
| 93 | + $prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $username = $prefix; |
| 97 | 97 | $postfix = 2; |
| 98 | 98 | |
| 99 | - while ( username_exists( $username ) ) { |
|
| 99 | + while (username_exists($username)) { |
|
| 100 | 100 | $username = $prefix + $postfix; |
| 101 | - $postfix ++; |
|
| 101 | + $postfix++; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return $username; |
@@ -115,31 +115,31 @@ discard block |
||
| 115 | 115 | $tabs = array( |
| 116 | 116 | |
| 117 | 117 | 'gp-invoices' => array( |
| 118 | - 'label' => __( 'Invoices', 'invoicing' ), // Name of the tab. |
|
| 118 | + 'label' => __('Invoices', 'invoicing'), // Name of the tab. |
|
| 119 | 119 | 'content' => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead. |
| 120 | 120 | 'icon' => 'fas fa-file-invoice', // Shown on some profile plugins. |
| 121 | 121 | ), |
| 122 | 122 | |
| 123 | 123 | 'gp-subscriptions' => array( |
| 124 | - 'label' => __( 'Subscriptions', 'invoicing' ), |
|
| 124 | + 'label' => __('Subscriptions', 'invoicing'), |
|
| 125 | 125 | 'content' => '[wpinv_subscriptions]', |
| 126 | 126 | 'icon' => 'fas fa-redo', |
| 127 | 127 | ), |
| 128 | 128 | |
| 129 | 129 | 'gp-edit-address' => array( |
| 130 | - 'label' => __( 'Billing Address', 'invoicing' ), |
|
| 130 | + 'label' => __('Billing Address', 'invoicing'), |
|
| 131 | 131 | 'callback' => 'getpaid_display_address_edit_tab', |
| 132 | 132 | 'icon' => 'fas fa-credit-card', |
| 133 | 133 | ), |
| 134 | 134 | |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs ); |
|
| 137 | + $tabs = apply_filters('getpaid_user_content_tabs', $tabs); |
|
| 138 | 138 | |
| 139 | 139 | // Make sure address editing is last on the list. |
| 140 | - if ( isset( $tabs['gp-edit-address'] ) ) { |
|
| 140 | + if (isset($tabs['gp-edit-address'])) { |
|
| 141 | 141 | $address = $tabs['gp-edit-address']; |
| 142 | - unset( $tabs['gp-edit-address'] ); |
|
| 142 | + unset($tabs['gp-edit-address']); |
|
| 143 | 143 | $tabs['gp-edit-address'] = $address; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -153,19 +153,19 @@ discard block |
||
| 153 | 153 | * @param array $tab |
| 154 | 154 | * @return array |
| 155 | 155 | */ |
| 156 | -function getpaid_prepare_user_content_tab( $tab ) { |
|
| 156 | +function getpaid_prepare_user_content_tab($tab) { |
|
| 157 | 157 | |
| 158 | - if ( ! empty( $tab['callback'] ) ) { |
|
| 159 | - return call_user_func( $tab['callback'] ); |
|
| 158 | + if (!empty($tab['callback'])) { |
|
| 159 | + return call_user_func($tab['callback']); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( ! empty( $tab['content'] ) ) { |
|
| 163 | - return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) ); |
|
| 162 | + if (!empty($tab['content'])) { |
|
| 163 | + return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content'])))))))); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $notice = aui()->alert( |
| 167 | 167 | array( |
| 168 | - 'content' => __( 'This tab has no content or content callback.', 'invoicing' ), |
|
| 168 | + 'content' => __('This tab has no content or content callback.', 'invoicing'), |
|
| 169 | 169 | 'type' => 'error', |
| 170 | 170 | ) |
| 171 | 171 | ); |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | * @param string $default |
| 182 | 182 | * @return array |
| 183 | 183 | */ |
| 184 | -function getpaid_get_tab_url( $tab, $default ) { |
|
| 184 | +function getpaid_get_tab_url($tab, $default) { |
|
| 185 | 185 | global $getpaid_tab_url; |
| 186 | 186 | |
| 187 | - if ( empty( $getpaid_tab_url ) ) { |
|
| 187 | + if (empty($getpaid_tab_url)) { |
|
| 188 | 188 | return $default; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - return sprintf( $getpaid_tab_url, $tab ); |
|
| 191 | + return sprintf($getpaid_tab_url, $tab); |
|
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | function getpaid_display_address_edit_tab() { |
| 202 | 202 | |
| 203 | - if ( 0 === get_current_user_id() ) { |
|
| 203 | + if (0 === get_current_user_id()) { |
|
| 204 | 204 | return '<div class="bsui">' . aui()->alert( |
| 205 | 205 | array( |
| 206 | 206 | 'type' => 'error', |
| 207 | - 'content' => __( 'Your must be logged in to view this section', 'invoicing' ), |
|
| 207 | + 'content' => __('Your must be logged in to view this section', 'invoicing'), |
|
| 208 | 208 | 'dismissible' => false, |
| 209 | 209 | ) |
| 210 | 210 | ) . '</div>'; |
@@ -218,19 +218,19 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | <?php |
| 220 | 220 | |
| 221 | - foreach ( getpaid_user_address_fields() as $key => $label ) { |
|
| 221 | + foreach (getpaid_user_address_fields() as $key => $label) { |
|
| 222 | 222 | |
| 223 | 223 | // Display the country. |
| 224 | - if ( 'country' == $key ) { |
|
| 224 | + if ('country' == $key) { |
|
| 225 | 225 | |
| 226 | 226 | echo aui()->select( |
| 227 | 227 | array( |
| 228 | 228 | 'options' => wpinv_get_country_list(), |
| 229 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 230 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 231 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 229 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
| 230 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
| 231 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
| 232 | 232 | 'placeholder' => $label, |
| 233 | - 'label' => wp_kses_post( $label ), |
|
| 233 | + 'label' => wp_kses_post($label), |
|
| 234 | 234 | 'label_type' => 'vertical', |
| 235 | 235 | 'class' => 'getpaid-address-field', |
| 236 | 236 | ) |
@@ -239,30 +239,30 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // Display the state. |
| 242 | - elseif ( 'state' == $key ) { |
|
| 242 | + elseif ('state' == $key) { |
|
| 243 | 243 | |
| 244 | 244 | echo getpaid_get_states_select_markup( |
| 245 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
| 246 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
| 245 | + getpaid_get_user_address_field(get_current_user_id(), 'country'), |
|
| 246 | + getpaid_get_user_address_field(get_current_user_id(), 'state'), |
|
| 247 | 247 | $label, |
| 248 | 248 | $label, |
| 249 | 249 | '', |
| 250 | 250 | false, |
| 251 | 251 | '', |
| 252 | - 'getpaid_address[' . esc_attr( $key ) . ']' |
|
| 252 | + 'getpaid_address[' . esc_attr($key) . ']' |
|
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | 255 | } else { |
| 256 | 256 | |
| 257 | 257 | echo aui()->input( |
| 258 | 258 | array( |
| 259 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
| 260 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
| 259 | + 'name' => 'getpaid_address[' . esc_attr($key) . ']', |
|
| 260 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
| 261 | 261 | 'placeholder' => $label, |
| 262 | - 'label' => wp_kses_post( $label ), |
|
| 262 | + 'label' => wp_kses_post($label), |
|
| 263 | 263 | 'label_type' => 'vertical', |
| 264 | 264 | 'type' => 'text', |
| 265 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
| 265 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
| 266 | 266 | 'class' => 'getpaid-address-field', |
| 267 | 267 | ) |
| 268 | 268 | ); |
@@ -275,30 +275,30 @@ discard block |
||
| 275 | 275 | 'name' => 'getpaid_address[email_cc]', |
| 276 | 276 | 'id' => 'wpinv-email_cc', |
| 277 | 277 | 'placeholder' => '[email protected], [email protected]', |
| 278 | - 'label' => __( 'Other email addresses', 'invoicing' ), |
|
| 278 | + 'label' => __('Other email addresses', 'invoicing'), |
|
| 279 | 279 | 'label_type' => 'vertical', |
| 280 | 280 | 'type' => 'text', |
| 281 | - 'value' => sanitize_text_field( get_user_meta( get_current_user_id(), '_wpinv_email_cc', true ) ), |
|
| 281 | + 'value' => sanitize_text_field(get_user_meta(get_current_user_id(), '_wpinv_email_cc', true)), |
|
| 282 | 282 | 'class' => 'getpaid-address-field', |
| 283 | - 'help_text' => __( 'Optionally provide other email addresses where we should send payment notifications', 'invoicing' ), |
|
| 283 | + 'help_text' => __('Optionally provide other email addresses where we should send payment notifications', 'invoicing'), |
|
| 284 | 284 | ) |
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | - do_action( 'getpaid_display_address_edit_tab' ); |
|
| 287 | + do_action('getpaid_display_address_edit_tab'); |
|
| 288 | 288 | |
| 289 | 289 | echo aui()->input( |
| 290 | 290 | array( |
| 291 | 291 | 'name' => 'getpaid_profile_edit_submit_button', |
| 292 | 292 | 'id' => 'getpaid_profile_edit_submit_button', |
| 293 | - 'value' => __( 'Save Address', 'invoicing' ), |
|
| 294 | - 'help_text' => __( 'New invoices will use this address as the billing address.', 'invoicing' ), |
|
| 293 | + 'value' => __('Save Address', 'invoicing'), |
|
| 294 | + 'help_text' => __('New invoices will use this address as the billing address.', 'invoicing'), |
|
| 295 | 295 | 'type' => 'submit', |
| 296 | 296 | 'class' => 'btn btn-primary btn-block submit-button', |
| 297 | 297 | ) |
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | - wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); |
|
| 301 | - getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' ); |
|
| 300 | + wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); |
|
| 301 | + getpaid_hidden_field('getpaid-action', 'edit_billing_details'); |
|
| 302 | 302 | ?> |
| 303 | 303 | |
| 304 | 304 | </form> |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | return ob_get_clean(); |
| 310 | 310 | } |
| 311 | -add_shortcode( 'getpaid_edit_address', 'getpaid_display_address_edit_tab' ); |
|
| 311 | +add_shortcode('getpaid_edit_address', 'getpaid_display_address_edit_tab'); |
|
| 312 | 312 | |
| 313 | 313 | /** |
| 314 | 314 | * Saves the billing address edit tab. |
@@ -316,30 +316,30 @@ discard block |
||
| 316 | 316 | * @since 2.1.4 |
| 317 | 317 | * @param array $data |
| 318 | 318 | */ |
| 319 | -function getpaid_save_address_edit_tab( $data ) { |
|
| 319 | +function getpaid_save_address_edit_tab($data) { |
|
| 320 | 320 | |
| 321 | - if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) { |
|
| 321 | + if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) { |
|
| 322 | 322 | return; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | $data = $data['getpaid_address']; |
| 326 | 326 | $user_id = get_current_user_id(); |
| 327 | 327 | |
| 328 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
| 328 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
| 329 | 329 | |
| 330 | - if ( isset( $data[ $field ] ) ) { |
|
| 331 | - $value = sanitize_text_field( $data[ $field ] ); |
|
| 332 | - update_user_meta( $user_id, '_wpinv_' . $field, $value ); |
|
| 330 | + if (isset($data[$field])) { |
|
| 331 | + $value = sanitize_text_field($data[$field]); |
|
| 332 | + update_user_meta($user_id, '_wpinv_' . $field, $value); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if ( isset( $data['email_cc'] ) ) { |
|
| 337 | - update_user_meta( $user_id, '_wpinv_email_cc', sanitize_text_field( $data['email_cc'] ) ); |
|
| 336 | + if (isset($data['email_cc'])) { |
|
| 337 | + update_user_meta($user_id, '_wpinv_email_cc', sanitize_text_field($data['email_cc'])); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success' ); |
|
| 340 | + wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success'); |
|
| 341 | 341 | } |
| 342 | -add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' ); |
|
| 342 | +add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab'); |
|
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | /* |
@@ -357,27 +357,27 @@ discard block |
||
| 357 | 357 | * @param array $tabs |
| 358 | 358 | * @return array |
| 359 | 359 | */ |
| 360 | -function getpaid_filter_userswp_account_tabs( $tabs ) { |
|
| 360 | +function getpaid_filter_userswp_account_tabs($tabs) { |
|
| 361 | 361 | |
| 362 | 362 | // Abort if the integration is inactive. |
| 363 | - if ( ! getpaid_is_userswp_integration_active() ) { |
|
| 363 | + if (!getpaid_is_userswp_integration_active()) { |
|
| 364 | 364 | return $tabs; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $new_tabs = array(); |
|
| 367 | + $new_tabs = array(); |
|
| 368 | 368 | |
| 369 | - foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) { |
|
| 369 | + foreach (getpaid_get_user_content_tabs() as $slug => $tab) { |
|
| 370 | 370 | |
| 371 | - $new_tabs[ $slug ] = array( |
|
| 371 | + $new_tabs[$slug] = array( |
|
| 372 | 372 | 'title' => $tab['label'], |
| 373 | 373 | 'icon' => $tab['icon'], |
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - return array_merge( $tabs, $new_tabs ); |
|
| 378 | + return array_merge($tabs, $new_tabs); |
|
| 379 | 379 | } |
| 380 | -add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' ); |
|
| 380 | +add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs'); |
|
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | 383 | * Display our UsersWP account tabs. |
@@ -386,18 +386,18 @@ discard block |
||
| 386 | 386 | * @param array $tabs |
| 387 | 387 | * @return array |
| 388 | 388 | */ |
| 389 | -function getpaid_display_userswp_account_tabs( $tab ) { |
|
| 389 | +function getpaid_display_userswp_account_tabs($tab) { |
|
| 390 | 390 | global $getpaid_tab_url; |
| 391 | 391 | |
| 392 | 392 | $our_tabs = getpaid_get_user_content_tabs(); |
| 393 | 393 | |
| 394 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
| 395 | - $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() ); |
|
| 396 | - echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] ); |
|
| 394 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
| 395 | + $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url()); |
|
| 396 | + echo getpaid_prepare_user_content_tab($our_tabs[$tab]); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | } |
| 400 | -add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' ); |
|
| 400 | +add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs'); |
|
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | /** |
@@ -408,17 +408,17 @@ discard block |
||
| 408 | 408 | * @param string $tab Current tab. |
| 409 | 409 | * @return string Title. |
| 410 | 410 | */ |
| 411 | -function getpaid_filter_userswp_account_title( $title, $tab ) { |
|
| 411 | +function getpaid_filter_userswp_account_title($title, $tab) { |
|
| 412 | 412 | |
| 413 | - $our_tabs = getpaid_get_user_content_tabs(); |
|
| 413 | + $our_tabs = getpaid_get_user_content_tabs(); |
|
| 414 | 414 | |
| 415 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
| 416 | - return $our_tabs[ $tab ]['label']; |
|
| 415 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
| 416 | + return $our_tabs[$tab]['label']; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | return $title; |
| 420 | 420 | } |
| 421 | -add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 ); |
|
| 421 | +add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2); |
|
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | 424 | * Registers the UsersWP integration settings. |
@@ -427,26 +427,26 @@ discard block |
||
| 427 | 427 | * @param array $settings An array of integration settings. |
| 428 | 428 | * @return array |
| 429 | 429 | */ |
| 430 | -function getpaid_register_userswp_settings( $settings ) { |
|
| 430 | +function getpaid_register_userswp_settings($settings) { |
|
| 431 | 431 | |
| 432 | - if ( defined( 'USERSWP_PLUGIN_FILE' ) ) { |
|
| 432 | + if (defined('USERSWP_PLUGIN_FILE')) { |
|
| 433 | 433 | |
| 434 | 434 | $settings[] = array( |
| 435 | 435 | |
| 436 | 436 | 'id' => 'userswp', |
| 437 | - 'label' => __( 'UsersWP', 'invoicing' ), |
|
| 437 | + 'label' => __('UsersWP', 'invoicing'), |
|
| 438 | 438 | 'settings' => array( |
| 439 | 439 | |
| 440 | 440 | 'userswp_settings' => array( |
| 441 | 441 | 'id' => 'userswp_settings', |
| 442 | - 'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>', |
|
| 442 | + 'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>', |
|
| 443 | 443 | 'type' => 'header', |
| 444 | 444 | ), |
| 445 | 445 | |
| 446 | 446 | 'enable_userswp' => array( |
| 447 | 447 | 'id' => 'enable_userswp', |
| 448 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
| 449 | - 'desc' => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ), |
|
| 448 | + 'name' => __('Enable Integration', 'invoicing'), |
|
| 449 | + 'desc' => __('Display GetPaid items on UsersWP account page.', 'invoicing'), |
|
| 450 | 450 | 'type' => 'checkbox', |
| 451 | 451 | 'std' => 1, |
| 452 | 452 | ), |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | return $settings; |
| 461 | 461 | } |
| 462 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' ); |
|
| 462 | +add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings'); |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Ovewrites the invoices history page to UsersWP. |
@@ -467,18 +467,18 @@ discard block |
||
| 467 | 467 | * @since 2.3.1 |
| 468 | 468 | * @return bool |
| 469 | 469 | */ |
| 470 | -function getpaid_userswp_overwrite_invoice_history_page( $url, $post_type ) { |
|
| 470 | +function getpaid_userswp_overwrite_invoice_history_page($url, $post_type) { |
|
| 471 | 471 | |
| 472 | 472 | $our_tabs = getpaid_get_user_content_tabs(); |
| 473 | 473 | $tab = "gp-{$post_type}s"; |
| 474 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
| 475 | - return add_query_arg( 'type', $tab, uwp_get_account_page_url() ); |
|
| 474 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
| 475 | + return add_query_arg('type', $tab, uwp_get_account_page_url()); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | return $url; |
| 479 | 479 | |
| 480 | 480 | } |
| 481 | -add_filter( 'wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2 ); |
|
| 481 | +add_filter('wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2); |
|
| 482 | 482 | |
| 483 | 483 | /** |
| 484 | 484 | * Checks if the integration is enabled. |
@@ -487,8 +487,8 @@ discard block |
||
| 487 | 487 | * @return bool |
| 488 | 488 | */ |
| 489 | 489 | function getpaid_is_userswp_integration_active() { |
| 490 | - $enabled = wpinv_get_option( 'enable_userswp', 1 ); |
|
| 491 | - return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled ); |
|
| 490 | + $enabled = wpinv_get_option('enable_userswp', 1); |
|
| 491 | + return defined('USERSWP_PLUGIN_FILE') && !empty($enabled); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | /* |
@@ -506,26 +506,26 @@ discard block |
||
| 506 | 506 | * @param array $settings An array of integration settings. |
| 507 | 507 | * @return array |
| 508 | 508 | */ |
| 509 | -function getpaid_register_buddypress_settings( $settings ) { |
|
| 509 | +function getpaid_register_buddypress_settings($settings) { |
|
| 510 | 510 | |
| 511 | - if ( class_exists( 'BuddyPress' ) ) { |
|
| 511 | + if (class_exists('BuddyPress')) { |
|
| 512 | 512 | |
| 513 | 513 | $settings[] = array( |
| 514 | 514 | |
| 515 | 515 | 'id' => 'buddypress', |
| 516 | - 'label' => __( 'BuddyPress', 'invoicing' ), |
|
| 516 | + 'label' => __('BuddyPress', 'invoicing'), |
|
| 517 | 517 | 'settings' => array( |
| 518 | 518 | |
| 519 | 519 | 'buddypress_settings' => array( |
| 520 | 520 | 'id' => 'buddypress_settings', |
| 521 | - 'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>', |
|
| 521 | + 'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>', |
|
| 522 | 522 | 'type' => 'header', |
| 523 | 523 | ), |
| 524 | 524 | |
| 525 | 525 | 'enable_buddypress' => array( |
| 526 | 526 | 'id' => 'enable_buddypress', |
| 527 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
| 528 | - 'desc' => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ), |
|
| 527 | + 'name' => __('Enable Integration', 'invoicing'), |
|
| 528 | + 'desc' => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'), |
|
| 529 | 529 | 'type' => 'checkbox', |
| 530 | 530 | 'std' => 1, |
| 531 | 531 | ), |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | return $settings; |
| 540 | 540 | } |
| 541 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' ); |
|
| 541 | +add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings'); |
|
| 542 | 542 | |
| 543 | 543 | /** |
| 544 | 544 | * Checks if the integration is enabled. |
@@ -547,8 +547,8 @@ discard block |
||
| 547 | 547 | * @return bool |
| 548 | 548 | */ |
| 549 | 549 | function getpaid_is_buddypress_integration_active() { |
| 550 | - $enabled = wpinv_get_option( 'enable_buddypress', 1 ); |
|
| 551 | - return class_exists( 'BuddyPress' ) && ! empty( $enabled ); |
|
| 550 | + $enabled = wpinv_get_option('enable_buddypress', 1); |
|
| 551 | + return class_exists('BuddyPress') && !empty($enabled); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | /** |
@@ -559,10 +559,10 @@ discard block |
||
| 559 | 559 | */ |
| 560 | 560 | function getpaid_setup_buddypress_integration() { |
| 561 | 561 | |
| 562 | - if ( getpaid_is_buddypress_integration_active() ) { |
|
| 562 | + if (getpaid_is_buddypress_integration_active()) { |
|
| 563 | 563 | require_once WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php'; |
| 564 | 564 | buddypress()->getpaid = new BP_GetPaid_Component(); |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | } |
| 568 | -add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' ); |
|
| 568 | +add_action('bp_setup_components', 'getpaid_setup_buddypress_integration'); |
|