@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | function aui_init_flatpickr(){ |
| 248 | 248 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
| 249 | 249 | $aui_doing_init_flatpickr = true; |
| 250 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
| 250 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
| 251 | 251 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
| 252 | 252 | } |
| 253 | 253 | $aui_doing_init_flatpickr = false; |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | |
| 995 | 995 | <?php |
| 996 | 996 | // FSE tweaks. |
| 997 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
| 997 | + if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template') { ?> |
|
| 998 | 998 | function aui_fse_set_data_scroll() { |
| 999 | 999 | console.log('init scroll'); |
| 1000 | 1000 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Post types Admin Class |
@@ -21,74 +21,74 @@ discard block |
||
| 21 | 21 | GetPaid_Metaboxes::init(); |
| 22 | 22 | |
| 23 | 23 | // Filter the post updated messages. |
| 24 | - add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' ); |
|
| 24 | + add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages'); |
|
| 25 | 25 | |
| 26 | 26 | // Filter post actions. |
| 27 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 ); |
|
| 28 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 ); |
|
| 27 | + add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2); |
|
| 28 | + add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2); |
|
| 29 | 29 | |
| 30 | 30 | // Invoice table columns. |
| 31 | - add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 ); |
|
| 32 | - add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 ); |
|
| 33 | - add_filter( 'bulk_actions-edit-wpi_invoice', array( __CLASS__, 'invoice_bulk_actions' ) ); |
|
| 34 | - add_filter( 'handle_bulk_actions-edit-wpi_invoice', array( __CLASS__, 'handle_invoice_bulk_actions' ), 10, 3 ); |
|
| 31 | + add_filter('manage_wpi_invoice_posts_columns', array(__CLASS__, 'invoice_columns'), 100); |
|
| 32 | + add_action('manage_wpi_invoice_posts_custom_column', array(__CLASS__, 'display_invoice_columns'), 10, 2); |
|
| 33 | + add_filter('bulk_actions-edit-wpi_invoice', array(__CLASS__, 'invoice_bulk_actions')); |
|
| 34 | + add_filter('handle_bulk_actions-edit-wpi_invoice', array(__CLASS__, 'handle_invoice_bulk_actions'), 10, 3); |
|
| 35 | 35 | |
| 36 | 36 | // Items table columns. |
| 37 | - add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 ); |
|
| 38 | - add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 ); |
|
| 39 | - add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 ); |
|
| 40 | - add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 ); |
|
| 41 | - add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 ); |
|
| 42 | - add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 ); |
|
| 37 | + add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100); |
|
| 38 | + add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20); |
|
| 39 | + add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2); |
|
| 40 | + add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100); |
|
| 41 | + add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100); |
|
| 42 | + add_action('request', array(__CLASS__, 'reorder_items'), 100); |
|
| 43 | 43 | |
| 44 | 44 | // Payment forms columns. |
| 45 | - add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 ); |
|
| 46 | - add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 ); |
|
| 47 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 ); |
|
| 45 | + add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100); |
|
| 46 | + add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2); |
|
| 47 | + add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2); |
|
| 48 | 48 | |
| 49 | 49 | // Discount table columns. |
| 50 | - add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 ); |
|
| 51 | - add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 ); |
|
| 50 | + add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100); |
|
| 51 | + add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100); |
|
| 52 | 52 | |
| 53 | 53 | // Deleting posts. |
| 54 | - add_action( 'delete_post', array( __CLASS__, 'delete_post' ) ); |
|
| 55 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 ); |
|
| 54 | + add_action('delete_post', array(__CLASS__, 'delete_post')); |
|
| 55 | + add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2); |
|
| 56 | 56 | |
| 57 | - add_filter( 'display_post_states', array( __CLASS__, 'add_display_post_states' ), 10, 2 ); |
|
| 57 | + add_filter('display_post_states', array(__CLASS__, 'add_display_post_states'), 10, 2); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Post updated messages. |
| 62 | 62 | */ |
| 63 | - public static function post_updated_messages( $messages ) { |
|
| 63 | + public static function post_updated_messages($messages) { |
|
| 64 | 64 | global $post; |
| 65 | 65 | |
| 66 | 66 | $messages['wpi_discount'] = array( |
| 67 | 67 | 0 => '', |
| 68 | - 1 => __( 'Discount updated.', 'invoicing' ), |
|
| 69 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
| 70 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
| 71 | - 4 => __( 'Discount updated.', 'invoicing' ), |
|
| 72 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 73 | - 6 => __( 'Discount updated.', 'invoicing' ), |
|
| 74 | - 7 => __( 'Discount saved.', 'invoicing' ), |
|
| 75 | - 8 => __( 'Discount submitted.', 'invoicing' ), |
|
| 76 | - 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
| 77 | - 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
| 68 | + 1 => __('Discount updated.', 'invoicing'), |
|
| 69 | + 2 => __('Custom field updated.', 'invoicing'), |
|
| 70 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
| 71 | + 4 => __('Discount updated.', 'invoicing'), |
|
| 72 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
| 73 | + 6 => __('Discount updated.', 'invoicing'), |
|
| 74 | + 7 => __('Discount saved.', 'invoicing'), |
|
| 75 | + 8 => __('Discount submitted.', 'invoicing'), |
|
| 76 | + 9 => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
| 77 | + 10 => __('Discount draft updated.', 'invoicing'), |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | $messages['wpi_payment_form'] = array( |
| 81 | 81 | 0 => '', |
| 82 | - 1 => __( 'Payment Form updated.', 'invoicing' ), |
|
| 83 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
| 84 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
| 85 | - 4 => __( 'Payment Form updated.', 'invoicing' ), |
|
| 86 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 87 | - 6 => __( 'Payment Form updated.', 'invoicing' ), |
|
| 88 | - 7 => __( 'Payment Form saved.', 'invoicing' ), |
|
| 89 | - 8 => __( 'Payment Form submitted.', 'invoicing' ), |
|
| 90 | - 9 => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
| 91 | - 10 => __( 'Payment Form draft updated.', 'invoicing' ), |
|
| 82 | + 1 => __('Payment Form updated.', 'invoicing'), |
|
| 83 | + 2 => __('Custom field updated.', 'invoicing'), |
|
| 84 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
| 85 | + 4 => __('Payment Form updated.', 'invoicing'), |
|
| 86 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
| 87 | + 6 => __('Payment Form updated.', 'invoicing'), |
|
| 88 | + 7 => __('Payment Form saved.', 'invoicing'), |
|
| 89 | + 8 => __('Payment Form submitted.', 'invoicing'), |
|
| 90 | + 9 => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
| 91 | + 10 => __('Payment Form draft updated.', 'invoicing'), |
|
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | 94 | return $messages; |
@@ -98,16 +98,16 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * Post row actions. |
| 100 | 100 | */ |
| 101 | - public static function post_row_actions( $actions, $post ) { |
|
| 101 | + public static function post_row_actions($actions, $post) { |
|
| 102 | 102 | |
| 103 | - $post = get_post( $post ); |
|
| 103 | + $post = get_post($post); |
|
| 104 | 104 | |
| 105 | 105 | // We do not want to edit the default payment form. |
| 106 | - if ( 'wpi_payment_form' == $post->post_type ) { |
|
| 106 | + if ('wpi_payment_form' == $post->post_type) { |
|
| 107 | 107 | |
| 108 | - if ( wpinv_get_default_payment_form() === $post->ID ) { |
|
| 109 | - unset( $actions['trash'] ); |
|
| 110 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 108 | + if (wpinv_get_default_payment_form() === $post->ID) { |
|
| 109 | + unset($actions['trash']); |
|
| 110 | + unset($actions['inline hide-if-no-js']); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $actions['duplicate'] = sprintf( |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | 'getpaid-nonce' |
| 125 | 125 | ) |
| 126 | 126 | ), |
| 127 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
| 127 | + esc_html(__('Duplicate', 'invoicing')) |
|
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | 130 | $actions['reset'] = sprintf( |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | 'getpaid-nonce' |
| 142 | 142 | ) |
| 143 | 143 | ), |
| 144 | - esc_html( __( 'Reset Stats', 'invoicing' ) ) |
|
| 144 | + esc_html(__('Reset Stats', 'invoicing')) |
|
| 145 | 145 | ); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Link to item payment form. |
| 149 | - if ( 'wpi_item' == $post->post_type ) { |
|
| 149 | + if ('wpi_item' == $post->post_type) { |
|
| 150 | 150 | |
| 151 | - if ( in_array( get_post_meta( $post->ID, '_wpinv_type', true ), array( '', 'fee', 'custom' ), true ) ) { |
|
| 151 | + if (in_array(get_post_meta($post->ID, '_wpinv_type', true), array('', 'fee', 'custom'), true)) { |
|
| 152 | 152 | |
| 153 | 153 | $actions['buy'] = sprintf( |
| 154 | 154 | '<a href="%1$s">%2$s</a>', |
| 155 | - esc_url( getpaid_embed_url( false, $post->ID . '|0' ) ), |
|
| 156 | - esc_html( __( 'Buy', 'invoicing' ) ) |
|
| 155 | + esc_url(getpaid_embed_url(false, $post->ID . '|0')), |
|
| 156 | + esc_html(__('Buy', 'invoicing')) |
|
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | } |
@@ -170,28 +170,28 @@ discard block |
||
| 170 | 170 | * @param WP_Post $post |
| 171 | 171 | * @return array $actions actions without edit option |
| 172 | 172 | */ |
| 173 | - public static function filter_invoice_row_actions( $actions, $post ) { |
|
| 173 | + public static function filter_invoice_row_actions($actions, $post) { |
|
| 174 | 174 | |
| 175 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
| 175 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
| 176 | 176 | |
| 177 | 177 | $actions = array(); |
| 178 | - $invoice = new WPInv_Invoice( $post ); |
|
| 178 | + $invoice = new WPInv_Invoice($post); |
|
| 179 | 179 | |
| 180 | 180 | $actions['edit'] = sprintf( |
| 181 | 181 | '<a href="%1$s">%2$s</a>', |
| 182 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
| 183 | - esc_html( __( 'Edit', 'invoicing' ) ) |
|
| 182 | + esc_url(get_edit_post_link($invoice->get_id())), |
|
| 183 | + esc_html(__('Edit', 'invoicing')) |
|
| 184 | 184 | ); |
| 185 | 185 | |
| 186 | - if ( ! $invoice->is_draft() ) { |
|
| 186 | + if (!$invoice->is_draft()) { |
|
| 187 | 187 | |
| 188 | 188 | $actions['view'] = sprintf( |
| 189 | 189 | '<a href="%1$s">%2$s</a>', |
| 190 | - esc_url( $invoice->get_view_url() ), |
|
| 190 | + esc_url($invoice->get_view_url()), |
|
| 191 | 191 | sprintf( |
| 192 | 192 | // translators: %s is the invoice type |
| 193 | - esc_html__( 'View %s', 'invoicing' ), |
|
| 194 | - getpaid_get_post_type_label( $invoice->get_post_type(), false ) |
|
| 193 | + esc_html__('View %s', 'invoicing'), |
|
| 194 | + getpaid_get_post_type_label($invoice->get_post_type(), false) |
|
| 195 | 195 | ) |
| 196 | 196 | ); |
| 197 | 197 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | 'getpaid-nonce' |
| 210 | 210 | ) |
| 211 | 211 | ), |
| 212 | - esc_html( __( 'Send to Customer', 'invoicing' ) ) |
|
| 212 | + esc_html(__('Send to Customer', 'invoicing')) |
|
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | 'getpaid-nonce' |
| 229 | 229 | ) |
| 230 | 230 | ), |
| 231 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
| 231 | + esc_html(__('Duplicate', 'invoicing')) |
|
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | 234 | } |
@@ -239,42 +239,42 @@ discard block |
||
| 239 | 239 | /** |
| 240 | 240 | * Returns an array of invoice table columns. |
| 241 | 241 | */ |
| 242 | - public static function invoice_columns( $columns ) { |
|
| 242 | + public static function invoice_columns($columns) { |
|
| 243 | 243 | |
| 244 | 244 | $columns = array( |
| 245 | 245 | 'cb' => $columns['cb'], |
| 246 | - 'number' => __( 'Invoice', 'invoicing' ), |
|
| 247 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
| 248 | - 'invoice_date' => __( 'Created', 'invoicing' ), |
|
| 249 | - 'payment_date' => __( 'Completed', 'invoicing' ), |
|
| 250 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
| 251 | - 'recurring' => __( 'Recurring', 'invoicing' ), |
|
| 252 | - 'status' => __( 'Status', 'invoicing' ), |
|
| 246 | + 'number' => __('Invoice', 'invoicing'), |
|
| 247 | + 'customer' => __('Customer', 'invoicing'), |
|
| 248 | + 'invoice_date' => __('Created', 'invoicing'), |
|
| 249 | + 'payment_date' => __('Completed', 'invoicing'), |
|
| 250 | + 'amount' => __('Amount', 'invoicing'), |
|
| 251 | + 'recurring' => __('Recurring', 'invoicing'), |
|
| 252 | + 'status' => __('Status', 'invoicing'), |
|
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | - return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
| 255 | + return apply_filters('wpi_invoice_table_columns', $columns); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Displays invoice table columns. |
| 260 | 260 | */ |
| 261 | - public static function display_invoice_columns( $column_name, $post_id ) { |
|
| 261 | + public static function display_invoice_columns($column_name, $post_id) { |
|
| 262 | 262 | |
| 263 | - $invoice = new WPInv_Invoice( $post_id ); |
|
| 263 | + $invoice = new WPInv_Invoice($post_id); |
|
| 264 | 264 | |
| 265 | - switch ( $column_name ) { |
|
| 265 | + switch ($column_name) { |
|
| 266 | 266 | |
| 267 | 267 | case 'invoice_date': |
| 268 | - $date_time = esc_attr( $invoice->get_created_date() ); |
|
| 269 | - $date = esc_html( getpaid_format_date_value( $date_time, '—', true ) ); |
|
| 270 | - echo wp_kses_post( "<span title='$date_time'>$date</span>" ); |
|
| 268 | + $date_time = esc_attr($invoice->get_created_date()); |
|
| 269 | + $date = esc_html(getpaid_format_date_value($date_time, '—', true)); |
|
| 270 | + echo wp_kses_post("<span title='$date_time'>$date</span>"); |
|
| 271 | 271 | break; |
| 272 | 272 | |
| 273 | 273 | case 'payment_date': |
| 274 | - if ( $invoice->is_paid() ) { |
|
| 275 | - $date_time = esc_attr( $invoice->get_completed_date() ); |
|
| 276 | - $date = esc_html( getpaid_format_date_value( $date_time, '—', true ) ); |
|
| 277 | - echo wp_kses_post( "<span title='$date_time'>$date</span>" ); |
|
| 274 | + if ($invoice->is_paid()) { |
|
| 275 | + $date_time = esc_attr($invoice->get_completed_date()); |
|
| 276 | + $date = esc_html(getpaid_format_date_value($date_time, '—', true)); |
|
| 277 | + echo wp_kses_post("<span title='$date_time'>$date</span>"); |
|
| 278 | 278 | } else { |
| 279 | 279 | echo '—'; |
| 280 | 280 | } |
@@ -283,61 +283,61 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | case 'amount': |
| 285 | 285 | $amount = $invoice->get_total(); |
| 286 | - $formated_amount = wp_kses_post( wpinv_price( $amount, $invoice->get_currency() ) ); |
|
| 286 | + $formated_amount = wp_kses_post(wpinv_price($amount, $invoice->get_currency())); |
|
| 287 | 287 | |
| 288 | - if ( $invoice->is_refunded() ) { |
|
| 289 | - $refunded_amount = wpinv_price( 0, $invoice->get_currency() ); |
|
| 290 | - echo wp_kses_post( "<del>$formated_amount</del> <ins>$refunded_amount</ins>" ); |
|
| 288 | + if ($invoice->is_refunded()) { |
|
| 289 | + $refunded_amount = wpinv_price(0, $invoice->get_currency()); |
|
| 290 | + echo wp_kses_post("<del>$formated_amount</del> <ins>$refunded_amount</ins>"); |
|
| 291 | 291 | } else { |
| 292 | 292 | |
| 293 | 293 | $discount = $invoice->get_total_discount(); |
| 294 | 294 | |
| 295 | - if ( ! empty( $discount ) ) { |
|
| 296 | - $new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() ); |
|
| 297 | - echo wp_kses_post( "<del>$new_amount</del> <ins>$formated_amount</ins>" ); |
|
| 295 | + if (!empty($discount)) { |
|
| 296 | + $new_amount = wpinv_price($amount + $discount, $invoice->get_currency()); |
|
| 297 | + echo wp_kses_post("<del>$new_amount</del> <ins>$formated_amount</ins>"); |
|
| 298 | 298 | } else { |
| 299 | - echo wp_kses_post( $formated_amount ); |
|
| 299 | + echo wp_kses_post($formated_amount); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | break; |
| 304 | 304 | |
| 305 | 305 | case 'status': |
| 306 | - $status = esc_html( $invoice->get_status() ); |
|
| 307 | - $status_label = esc_html( $invoice->get_status_nicename() ); |
|
| 306 | + $status = esc_html($invoice->get_status()); |
|
| 307 | + $status_label = esc_html($invoice->get_status_nicename()); |
|
| 308 | 308 | |
| 309 | 309 | // If it is paid, show the gateway title. |
| 310 | - if ( $invoice->is_paid() ) { |
|
| 311 | - $gateway = esc_html( $invoice->get_gateway_title() ); |
|
| 312 | - $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), esc_html( $gateway ) ); |
|
| 310 | + if ($invoice->is_paid()) { |
|
| 311 | + $gateway = esc_html($invoice->get_gateway_title()); |
|
| 312 | + $gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), esc_html($gateway)); |
|
| 313 | 313 | |
| 314 | - echo wp_kses_post( "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>" ); |
|
| 314 | + echo wp_kses_post("<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>"); |
|
| 315 | 315 | } else { |
| 316 | - echo wp_kses_post( "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>" ); |
|
| 316 | + echo wp_kses_post("<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>"); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | // If it is not paid, display the overdue and view status. |
| 320 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
| 320 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
| 321 | 321 | |
| 322 | 322 | // Invoice view status. |
| 323 | - if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) { |
|
| 324 | - echo ' <i class="fa fa-eye wpi-help-tip" title="' . esc_attr__( 'Viewed by Customer', 'invoicing' ) . '"></i>'; |
|
| 323 | + if (wpinv_is_invoice_viewed($invoice->get_id())) { |
|
| 324 | + echo ' <i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>'; |
|
| 325 | 325 | } else { |
| 326 | - echo ' <i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__( 'Not Viewed by Customer', 'invoicing' ) . '"></i>'; |
|
| 326 | + echo ' <i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>'; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | // Display the overview status. |
| 330 | - if ( wpinv_get_option( 'overdue_active' ) ) { |
|
| 330 | + if (wpinv_get_option('overdue_active')) { |
|
| 331 | 331 | $due_date = $invoice->get_due_date(); |
| 332 | - $fomatted = getpaid_format_date( $due_date ); |
|
| 332 | + $fomatted = getpaid_format_date($due_date); |
|
| 333 | 333 | |
| 334 | - if ( ! empty( $fomatted ) ) { |
|
| 334 | + if (!empty($fomatted)) { |
|
| 335 | 335 | $date = wp_sprintf( |
| 336 | 336 | // translators: %s is the due date. |
| 337 | - __( 'Due %s', 'invoicing' ), |
|
| 337 | + __('Due %s', 'invoicing'), |
|
| 338 | 338 | $fomatted |
| 339 | 339 | ); |
| 340 | - echo wp_kses_post( "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>" ); |
|
| 340 | + echo wp_kses_post("<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>"); |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | break; |
| 346 | 346 | |
| 347 | 347 | case 'recurring': |
| 348 | - if ( $invoice->is_recurring() ) { |
|
| 348 | + if ($invoice->is_recurring()) { |
|
| 349 | 349 | echo '<i class="fa fa-check" style="color:#43850a;"></i>'; |
| 350 | 350 | } else { |
| 351 | 351 | echo '<i class="fa fa-times" style="color:#616161;"></i>'; |
@@ -353,26 +353,26 @@ discard block |
||
| 353 | 353 | break; |
| 354 | 354 | |
| 355 | 355 | case 'number': |
| 356 | - $edit_link = esc_url( get_edit_post_link( $invoice->get_id() ) ); |
|
| 357 | - $invoice_number = esc_html( $invoice->get_number() ); |
|
| 358 | - $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' ); |
|
| 356 | + $edit_link = esc_url(get_edit_post_link($invoice->get_id())); |
|
| 357 | + $invoice_number = esc_html($invoice->get_number()); |
|
| 358 | + $invoice_details = esc_attr__('View Invoice Details', 'invoicing'); |
|
| 359 | 359 | |
| 360 | - echo wp_kses_post( "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>" ); |
|
| 360 | + echo wp_kses_post("<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>"); |
|
| 361 | 361 | |
| 362 | - do_action( 'getpaid_admin_table_invoice_number_column', $invoice ); |
|
| 362 | + do_action('getpaid_admin_table_invoice_number_column', $invoice); |
|
| 363 | 363 | break; |
| 364 | 364 | |
| 365 | 365 | case 'customer': |
| 366 | 366 | $customer_name = $invoice->get_user_full_name(); |
| 367 | 367 | |
| 368 | - if ( empty( $customer_name ) ) { |
|
| 368 | + if (empty($customer_name)) { |
|
| 369 | 369 | $customer_name = $invoice->get_email(); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if ( ! empty( $customer_name ) ) { |
|
| 373 | - $customer_details = esc_attr__( 'View Customer Details', 'invoicing' ); |
|
| 374 | - $view_link = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) ); |
|
| 375 | - echo wp_kses_post( "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>" ); |
|
| 372 | + if (!empty($customer_name)) { |
|
| 373 | + $customer_details = esc_attr__('View Customer Details', 'invoicing'); |
|
| 374 | + $view_link = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php'))); |
|
| 375 | + echo wp_kses_post("<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>"); |
|
| 376 | 376 | } else { |
| 377 | 377 | echo '<div>—</div>'; |
| 378 | 378 | } |
@@ -386,19 +386,19 @@ discard block |
||
| 386 | 386 | /** |
| 387 | 387 | * Displays invoice bulk actions. |
| 388 | 388 | */ |
| 389 | - public static function invoice_bulk_actions( $actions ) { |
|
| 390 | - $actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' ); |
|
| 389 | + public static function invoice_bulk_actions($actions) { |
|
| 390 | + $actions['resend-invoice'] = __('Send to Customer', 'invoicing'); |
|
| 391 | 391 | return $actions; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | 395 | * Processes invoice bulk actions. |
| 396 | 396 | */ |
| 397 | - public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) { |
|
| 397 | + public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) { |
|
| 398 | 398 | |
| 399 | - if ( 'resend-invoice' === $action ) { |
|
| 400 | - foreach ( $post_ids as $post_id ) { |
|
| 401 | - getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true ); |
|
| 399 | + if ('resend-invoice' === $action) { |
|
| 400 | + foreach ($post_ids as $post_id) { |
|
| 401 | + getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
@@ -409,49 +409,49 @@ discard block |
||
| 409 | 409 | /** |
| 410 | 410 | * Returns an array of payment forms table columns. |
| 411 | 411 | */ |
| 412 | - public static function payment_form_columns( $columns ) { |
|
| 412 | + public static function payment_form_columns($columns) { |
|
| 413 | 413 | |
| 414 | 414 | $columns = array( |
| 415 | 415 | 'cb' => $columns['cb'], |
| 416 | - 'title' => __( 'Name', 'invoicing' ), |
|
| 417 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
| 418 | - 'earnings' => __( 'Revenue', 'invoicing' ), |
|
| 419 | - 'refunds' => __( 'Refunded', 'invoicing' ), |
|
| 420 | - 'items' => __( 'Items', 'invoicing' ), |
|
| 421 | - 'date' => __( 'Date', 'invoicing' ), |
|
| 416 | + 'title' => __('Name', 'invoicing'), |
|
| 417 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
| 418 | + 'earnings' => __('Revenue', 'invoicing'), |
|
| 419 | + 'refunds' => __('Refunded', 'invoicing'), |
|
| 420 | + 'items' => __('Items', 'invoicing'), |
|
| 421 | + 'date' => __('Date', 'invoicing'), |
|
| 422 | 422 | ); |
| 423 | 423 | |
| 424 | - return apply_filters( 'wpi_payment_form_table_columns', $columns ); |
|
| 424 | + return apply_filters('wpi_payment_form_table_columns', $columns); |
|
| 425 | 425 | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
| 429 | 429 | * Displays payment form table columns. |
| 430 | 430 | */ |
| 431 | - public static function display_payment_form_columns( $column_name, $post_id ) { |
|
| 431 | + public static function display_payment_form_columns($column_name, $post_id) { |
|
| 432 | 432 | |
| 433 | 433 | // Retrieve the payment form. |
| 434 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
| 434 | + $form = new GetPaid_Payment_Form($post_id); |
|
| 435 | 435 | |
| 436 | - switch ( $column_name ) { |
|
| 436 | + switch ($column_name) { |
|
| 437 | 437 | |
| 438 | 438 | case 'earnings': |
| 439 | - echo wp_kses_post( wpinv_price( $form->get_earned() ) ); |
|
| 439 | + echo wp_kses_post(wpinv_price($form->get_earned())); |
|
| 440 | 440 | break; |
| 441 | 441 | |
| 442 | 442 | case 'refunds': |
| 443 | - echo wp_kses_post( wpinv_price( $form->get_refunded() ) ); |
|
| 443 | + echo wp_kses_post(wpinv_price($form->get_refunded())); |
|
| 444 | 444 | break; |
| 445 | 445 | |
| 446 | 446 | case 'refunds': |
| 447 | - echo wp_kses_post( wpinv_price( $form->get_refunded() ) ); |
|
| 447 | + echo wp_kses_post(wpinv_price($form->get_refunded())); |
|
| 448 | 448 | break; |
| 449 | 449 | |
| 450 | 450 | case 'shortcode': |
| 451 | - if ( $form->is_default() ) { |
|
| 451 | + if ($form->is_default()) { |
|
| 452 | 452 | echo '—'; |
| 453 | 453 | } else { |
| 454 | - echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>'; |
|
| 454 | + echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>'; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | break; |
@@ -459,28 +459,28 @@ discard block |
||
| 459 | 459 | case 'items': |
| 460 | 460 | $items = $form->get_items(); |
| 461 | 461 | |
| 462 | - if ( $form->is_default() || empty( $items ) ) { |
|
| 462 | + if ($form->is_default() || empty($items)) { |
|
| 463 | 463 | echo '—'; |
| 464 | 464 | return; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | $_items = array(); |
| 468 | 468 | |
| 469 | - foreach ( $items as $item ) { |
|
| 469 | + foreach ($items as $item) { |
|
| 470 | 470 | $url = $item->get_edit_url(); |
| 471 | 471 | |
| 472 | - if ( empty( $url ) ) { |
|
| 473 | - $_items[] = esc_html( $item->get_name() ); |
|
| 472 | + if (empty($url)) { |
|
| 473 | + $_items[] = esc_html($item->get_name()); |
|
| 474 | 474 | } else { |
| 475 | 475 | $_items[] = sprintf( |
| 476 | 476 | '<a href="%s">%s</a>', |
| 477 | - esc_url( $url ), |
|
| 478 | - esc_html( $item->get_name() ) |
|
| 477 | + esc_url($url), |
|
| 478 | + esc_html($item->get_name()) |
|
| 479 | 479 | ); |
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - echo wp_kses_post( implode( '<br>', $_items ) ); |
|
| 483 | + echo wp_kses_post(implode('<br>', $_items)); |
|
| 484 | 484 | |
| 485 | 485 | break; |
| 486 | 486 | |
@@ -491,10 +491,10 @@ discard block |
||
| 491 | 491 | /** |
| 492 | 492 | * Filters post states. |
| 493 | 493 | */ |
| 494 | - public static function filter_payment_form_state( $post_states, $post ) { |
|
| 494 | + public static function filter_payment_form_state($post_states, $post) { |
|
| 495 | 495 | |
| 496 | - if ( 'wpi_payment_form' === $post->post_type && wpinv_get_default_payment_form() === $post->ID ) { |
|
| 497 | - $post_states['default_form'] = __( 'Default Payment Form', 'invoicing' ); |
|
| 496 | + if ('wpi_payment_form' === $post->post_type && wpinv_get_default_payment_form() === $post->ID) { |
|
| 497 | + $post_states['default_form'] = __('Default Payment Form', 'invoicing'); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | return $post_states; |
@@ -504,35 +504,35 @@ discard block |
||
| 504 | 504 | /** |
| 505 | 505 | * Returns an array of coupon table columns. |
| 506 | 506 | */ |
| 507 | - public static function discount_columns( $columns ) { |
|
| 507 | + public static function discount_columns($columns) { |
|
| 508 | 508 | |
| 509 | 509 | $columns = array( |
| 510 | 510 | 'cb' => $columns['cb'], |
| 511 | - 'title' => __( 'Name', 'invoicing' ), |
|
| 512 | - 'code' => __( 'Code', 'invoicing' ), |
|
| 513 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
| 514 | - 'usage' => __( 'Usage / Limit', 'invoicing' ), |
|
| 515 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
| 516 | - 'expiry_date' => __( 'Expiry Date', 'invoicing' ), |
|
| 511 | + 'title' => __('Name', 'invoicing'), |
|
| 512 | + 'code' => __('Code', 'invoicing'), |
|
| 513 | + 'amount' => __('Amount', 'invoicing'), |
|
| 514 | + 'usage' => __('Usage / Limit', 'invoicing'), |
|
| 515 | + 'start_date' => __('Start Date', 'invoicing'), |
|
| 516 | + 'expiry_date' => __('Expiry Date', 'invoicing'), |
|
| 517 | 517 | ); |
| 518 | 518 | |
| 519 | - return apply_filters( 'wpi_discount_table_columns', $columns ); |
|
| 519 | + return apply_filters('wpi_discount_table_columns', $columns); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | /** |
| 523 | 523 | * Filters post states. |
| 524 | 524 | */ |
| 525 | - public static function filter_discount_state( $post_states, $post ) { |
|
| 525 | + public static function filter_discount_state($post_states, $post) { |
|
| 526 | 526 | |
| 527 | - if ( 'wpi_discount' === $post->post_type ) { |
|
| 527 | + if ('wpi_discount' === $post->post_type) { |
|
| 528 | 528 | |
| 529 | - $discount = new WPInv_Discount( $post ); |
|
| 529 | + $discount = new WPInv_Discount($post); |
|
| 530 | 530 | |
| 531 | 531 | $status = $discount->is_expired() ? 'expired' : $discount->get_status(); |
| 532 | 532 | |
| 533 | - if ( 'publish' !== $status ) { |
|
| 533 | + if ('publish' !== $status) { |
|
| 534 | 534 | return array( |
| 535 | - 'discount_status' => wpinv_discount_status( $status ), |
|
| 535 | + 'discount_status' => wpinv_discount_status($status), |
|
| 536 | 536 | ); |
| 537 | 537 | } |
| 538 | 538 | |
@@ -547,30 +547,30 @@ discard block |
||
| 547 | 547 | /** |
| 548 | 548 | * Returns an array of items table columns. |
| 549 | 549 | */ |
| 550 | - public static function item_columns( $columns ) { |
|
| 550 | + public static function item_columns($columns) { |
|
| 551 | 551 | |
| 552 | 552 | $columns = array( |
| 553 | 553 | 'cb' => $columns['cb'], |
| 554 | - 'title' => __( 'Name', 'invoicing' ), |
|
| 555 | - 'price' => __( 'Price', 'invoicing' ), |
|
| 556 | - 'vat_rule' => __( 'Tax Rule', 'invoicing' ), |
|
| 557 | - 'vat_class' => __( 'Tax Class', 'invoicing' ), |
|
| 558 | - 'type' => __( 'Type', 'invoicing' ), |
|
| 559 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
| 554 | + 'title' => __('Name', 'invoicing'), |
|
| 555 | + 'price' => __('Price', 'invoicing'), |
|
| 556 | + 'vat_rule' => __('Tax Rule', 'invoicing'), |
|
| 557 | + 'vat_class' => __('Tax Class', 'invoicing'), |
|
| 558 | + 'type' => __('Type', 'invoicing'), |
|
| 559 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
| 560 | 560 | ); |
| 561 | 561 | |
| 562 | - if ( ! wpinv_use_taxes() ) { |
|
| 563 | - unset( $columns['vat_rule'] ); |
|
| 564 | - unset( $columns['vat_class'] ); |
|
| 562 | + if (!wpinv_use_taxes()) { |
|
| 563 | + unset($columns['vat_rule']); |
|
| 564 | + unset($columns['vat_class']); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - return apply_filters( 'wpi_item_table_columns', $columns ); |
|
| 567 | + return apply_filters('wpi_item_table_columns', $columns); |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | /** |
| 571 | 571 | * Returns an array of sortable items table columns. |
| 572 | 572 | */ |
| 573 | - public static function sortable_item_columns( $columns ) { |
|
| 573 | + public static function sortable_item_columns($columns) { |
|
| 574 | 574 | |
| 575 | 575 | return array_merge( |
| 576 | 576 | $columns, |
@@ -587,45 +587,45 @@ discard block |
||
| 587 | 587 | /** |
| 588 | 588 | * Displays items table columns. |
| 589 | 589 | */ |
| 590 | - public static function display_item_columns( $column_name, $post_id ) { |
|
| 590 | + public static function display_item_columns($column_name, $post_id) { |
|
| 591 | 591 | |
| 592 | - $item = new WPInv_Item( $post_id ); |
|
| 592 | + $item = new WPInv_Item($post_id); |
|
| 593 | 593 | |
| 594 | - switch ( $column_name ) { |
|
| 594 | + switch ($column_name) { |
|
| 595 | 595 | |
| 596 | 596 | case 'price': |
| 597 | - if ( ! $item->is_recurring() ) { |
|
| 598 | - echo wp_kses_post( $item->get_the_price() ); |
|
| 597 | + if (!$item->is_recurring()) { |
|
| 598 | + echo wp_kses_post($item->get_the_price()); |
|
| 599 | 599 | break; |
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | $price = wp_sprintf( |
| 603 | - __( '%1$s / %2$s', 'invoicing' ), |
|
| 603 | + __('%1$s / %2$s', 'invoicing'), |
|
| 604 | 604 | $item->get_the_price(), |
| 605 | - getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' ) |
|
| 605 | + getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '') |
|
| 606 | 606 | ); |
| 607 | 607 | |
| 608 | - if ( $item->get_the_price() == $item->get_the_initial_price() ) { |
|
| 609 | - echo wp_kses_post( $price ); |
|
| 608 | + if ($item->get_the_price() == $item->get_the_initial_price()) { |
|
| 609 | + echo wp_kses_post($price); |
|
| 610 | 610 | break; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - echo wp_kses_post( $item->get_the_initial_price() ); |
|
| 613 | + echo wp_kses_post($item->get_the_initial_price()); |
|
| 614 | 614 | |
| 615 | - echo '<span class="meta">' . wp_sprintf( esc_html__( 'then %s', 'invoicing' ), wp_kses_post( $price ) ) . '</span>'; |
|
| 615 | + echo '<span class="meta">' . wp_sprintf(esc_html__('then %s', 'invoicing'), wp_kses_post($price)) . '</span>'; |
|
| 616 | 616 | break; |
| 617 | 617 | |
| 618 | 618 | case 'vat_rule': |
| 619 | - echo wp_kses_post( getpaid_get_tax_rule_label( $item->get_vat_rule() ) ); |
|
| 619 | + echo wp_kses_post(getpaid_get_tax_rule_label($item->get_vat_rule())); |
|
| 620 | 620 | break; |
| 621 | 621 | |
| 622 | 622 | case 'vat_class': |
| 623 | - echo wp_kses_post( getpaid_get_tax_class_label( $item->get_vat_class() ) ); |
|
| 623 | + echo wp_kses_post(getpaid_get_tax_class_label($item->get_vat_class())); |
|
| 624 | 624 | break; |
| 625 | 625 | |
| 626 | 626 | case 'shortcode': |
| 627 | - if ( $item->is_type( array( '', 'fee', 'custom' ) ) ) { |
|
| 628 | - echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
| 627 | + if ($item->is_type(array('', 'fee', 'custom'))) { |
|
| 628 | + echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
| 629 | 629 | } else { |
| 630 | 630 | echo '—'; |
| 631 | 631 | } |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | break; |
| 634 | 634 | |
| 635 | 635 | case 'type': |
| 636 | - echo wp_kses_post( wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>' ); |
|
| 636 | + echo wp_kses_post(wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'); |
|
| 637 | 637 | break; |
| 638 | 638 | |
| 639 | 639 | } |
@@ -643,21 +643,21 @@ discard block |
||
| 643 | 643 | /** |
| 644 | 644 | * Lets users filter items using taxes. |
| 645 | 645 | */ |
| 646 | - public static function add_item_filters( $post_type ) { |
|
| 646 | + public static function add_item_filters($post_type) { |
|
| 647 | 647 | |
| 648 | 648 | // Abort if we're not dealing with items. |
| 649 | - if ( 'wpi_item' !== $post_type ) { |
|
| 649 | + if ('wpi_item' !== $post_type) { |
|
| 650 | 650 | return; |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | // Filter by vat rules. |
| 654 | - if ( wpinv_use_taxes() ) { |
|
| 654 | + if (wpinv_use_taxes()) { |
|
| 655 | 655 | |
| 656 | 656 | // Sanitize selected vat rule. |
| 657 | 657 | $vat_rule = ''; |
| 658 | 658 | $vat_rules = getpaid_get_tax_rules(); |
| 659 | - if ( isset( $_GET['vat_rule'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 660 | - $vat_rule = sanitize_text_field( $_GET['vat_rule'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 659 | + if (isset($_GET['vat_rule'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 660 | + $vat_rule = sanitize_text_field($_GET['vat_rule']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | // Filter by VAT rule. |
@@ -665,13 +665,13 @@ discard block |
||
| 665 | 665 | array( |
| 666 | 666 | 'options' => array_merge( |
| 667 | 667 | array( |
| 668 | - '' => __( 'All Tax Rules', 'invoicing' ), |
|
| 668 | + '' => __('All Tax Rules', 'invoicing'), |
|
| 669 | 669 | ), |
| 670 | 670 | $vat_rules |
| 671 | 671 | ), |
| 672 | 672 | 'name' => 'vat_rule', |
| 673 | 673 | 'id' => 'vat_rule', |
| 674 | - 'selected' => in_array( $vat_rule, array_keys( $vat_rules ), true ) ? $vat_rule : '', |
|
| 674 | + 'selected' => in_array($vat_rule, array_keys($vat_rules), true) ? $vat_rule : '', |
|
| 675 | 675 | 'show_option_all' => false, |
| 676 | 676 | 'show_option_none' => false, |
| 677 | 677 | ) |
@@ -682,21 +682,21 @@ discard block |
||
| 682 | 682 | // Sanitize selected vat rule. |
| 683 | 683 | $vat_class = ''; |
| 684 | 684 | $vat_classes = getpaid_get_tax_classes(); |
| 685 | - if ( isset( $_GET['vat_class'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 686 | - $vat_class = sanitize_text_field( $_GET['vat_class'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 685 | + if (isset($_GET['vat_class'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 686 | + $vat_class = sanitize_text_field($_GET['vat_class']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | wpinv_html_select( |
| 690 | 690 | array( |
| 691 | 691 | 'options' => array_merge( |
| 692 | 692 | array( |
| 693 | - '' => __( 'All Tax Classes', 'invoicing' ), |
|
| 693 | + '' => __('All Tax Classes', 'invoicing'), |
|
| 694 | 694 | ), |
| 695 | 695 | $vat_classes |
| 696 | 696 | ), |
| 697 | 697 | 'name' => 'vat_class', |
| 698 | 698 | 'id' => 'vat_class', |
| 699 | - 'selected' => in_array( $vat_class, array_keys( $vat_classes ), true ) ? $vat_class : '', |
|
| 699 | + 'selected' => in_array($vat_class, array_keys($vat_classes), true) ? $vat_class : '', |
|
| 700 | 700 | 'show_option_all' => false, |
| 701 | 701 | 'show_option_none' => false, |
| 702 | 702 | ) |
@@ -705,22 +705,22 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | // Filter by item type. |
| 708 | - $type = ''; |
|
| 709 | - if ( isset( $_GET['type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 710 | - $type = sanitize_text_field( $_GET['type'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 708 | + $type = ''; |
|
| 709 | + if (isset($_GET['type'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 710 | + $type = sanitize_text_field($_GET['type']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | wpinv_html_select( |
| 714 | 714 | array( |
| 715 | 715 | 'options' => array_merge( |
| 716 | 716 | array( |
| 717 | - '' => __( 'All item types', 'invoicing' ), |
|
| 717 | + '' => __('All item types', 'invoicing'), |
|
| 718 | 718 | ), |
| 719 | 719 | wpinv_get_item_types() |
| 720 | 720 | ), |
| 721 | 721 | 'name' => 'type', |
| 722 | 722 | 'id' => 'type', |
| 723 | - 'selected' => in_array( $type, wpinv_item_types(), true ) ? $type : '', |
|
| 723 | + 'selected' => in_array($type, wpinv_item_types(), true) ? $type : '', |
|
| 724 | 724 | 'show_option_all' => false, |
| 725 | 725 | 'show_option_none' => false, |
| 726 | 726 | ) |
@@ -731,45 +731,45 @@ discard block |
||
| 731 | 731 | /** |
| 732 | 732 | * Filters the item query. |
| 733 | 733 | */ |
| 734 | - public static function filter_item_query( $query ) { |
|
| 734 | + public static function filter_item_query($query) { |
|
| 735 | 735 | |
| 736 | 736 | // modify the query only if it admin and main query. |
| 737 | - if ( ! ( is_admin() && $query->is_main_query() ) ) { |
|
| 737 | + if (!(is_admin() && $query->is_main_query())) { |
|
| 738 | 738 | return $query; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | // we want to modify the query for our items. |
| 742 | - if ( empty( $query->query['post_type'] ) || 'wpi_item' !== $query->query['post_type'] ) { |
|
| 742 | + if (empty($query->query['post_type']) || 'wpi_item' !== $query->query['post_type']) { |
|
| 743 | 743 | return $query; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - if ( empty( $query->query_vars['meta_query'] ) ) { |
|
| 746 | + if (empty($query->query_vars['meta_query'])) { |
|
| 747 | 747 | $query->query_vars['meta_query'] = array(); |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | // Filter vat rule type |
| 751 | - if ( ! empty( $_GET['vat_rule'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 751 | + if (!empty($_GET['vat_rule'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 752 | 752 | $query->query_vars['meta_query'][] = array( |
| 753 | 753 | 'key' => '_wpinv_vat_rule', |
| 754 | - 'value' => sanitize_text_field( $_GET['vat_rule'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 754 | + 'value' => sanitize_text_field($_GET['vat_rule']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 755 | 755 | 'compare' => '=', |
| 756 | 756 | ); |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | // Filter vat class |
| 760 | - if ( ! empty( $_GET['vat_class'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 760 | + if (!empty($_GET['vat_class'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 761 | 761 | $query->query_vars['meta_query'][] = array( |
| 762 | 762 | 'key' => '_wpinv_vat_class', |
| 763 | - 'value' => sanitize_text_field( $_GET['vat_class'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 763 | + 'value' => sanitize_text_field($_GET['vat_class']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 764 | 764 | 'compare' => '=', |
| 765 | 765 | ); |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | // Filter item type |
| 769 | - if ( ! empty( $_GET['type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 769 | + if (!empty($_GET['type'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 770 | 770 | $query->query_vars['meta_query'][] = array( |
| 771 | 771 | 'key' => '_wpinv_type', |
| 772 | - 'value' => sanitize_text_field( $_GET['type'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 772 | + 'value' => sanitize_text_field($_GET['type']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 773 | 773 | 'compare' => '=', |
| 774 | 774 | ); |
| 775 | 775 | } |
@@ -779,15 +779,15 @@ discard block |
||
| 779 | 779 | /** |
| 780 | 780 | * Reorders items. |
| 781 | 781 | */ |
| 782 | - public static function reorder_items( $vars ) { |
|
| 782 | + public static function reorder_items($vars) { |
|
| 783 | 783 | global $typenow; |
| 784 | 784 | |
| 785 | - if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) { |
|
| 785 | + if ('wpi_item' !== $typenow || empty($vars['orderby'])) { |
|
| 786 | 786 | return $vars; |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | // By item type. |
| 790 | - if ( 'type' === $vars['orderby'] ) { |
|
| 790 | + if ('type' === $vars['orderby']) { |
|
| 791 | 791 | return array_merge( |
| 792 | 792 | $vars, |
| 793 | 793 | array( |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | // By vat class. |
| 801 | - if ( 'vat_class' === $vars['orderby'] ) { |
|
| 801 | + if ('vat_class' === $vars['orderby']) { |
|
| 802 | 802 | return array_merge( |
| 803 | 803 | $vars, |
| 804 | 804 | array( |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | // By vat rule. |
| 812 | - if ( 'vat_rule' === $vars['orderby'] ) { |
|
| 812 | + if ('vat_rule' === $vars['orderby']) { |
|
| 813 | 813 | return array_merge( |
| 814 | 814 | $vars, |
| 815 | 815 | array( |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | // By price. |
| 823 | - if ( 'price' === $vars['orderby'] ) { |
|
| 823 | + if ('price' === $vars['orderby']) { |
|
| 824 | 824 | return array_merge( |
| 825 | 825 | $vars, |
| 826 | 826 | array( |
@@ -837,27 +837,27 @@ discard block |
||
| 837 | 837 | /** |
| 838 | 838 | * Fired when deleting a post. |
| 839 | 839 | */ |
| 840 | - public static function delete_post( $post_id ) { |
|
| 840 | + public static function delete_post($post_id) { |
|
| 841 | 841 | |
| 842 | - switch ( get_post_type( $post_id ) ) { |
|
| 842 | + switch (get_post_type($post_id)) { |
|
| 843 | 843 | |
| 844 | 844 | case 'wpi_item': |
| 845 | - do_action( 'getpaid_before_delete_item', new WPInv_Item( $post_id ) ); |
|
| 845 | + do_action('getpaid_before_delete_item', new WPInv_Item($post_id)); |
|
| 846 | 846 | break; |
| 847 | 847 | |
| 848 | 848 | case 'wpi_payment_form': |
| 849 | - do_action( 'getpaid_before_delete_payment_form', new GetPaid_Payment_Form( $post_id ) ); |
|
| 849 | + do_action('getpaid_before_delete_payment_form', new GetPaid_Payment_Form($post_id)); |
|
| 850 | 850 | break; |
| 851 | 851 | |
| 852 | 852 | case 'wpi_discount': |
| 853 | - do_action( 'getpaid_before_delete_discount', new WPInv_Discount( $post_id ) ); |
|
| 853 | + do_action('getpaid_before_delete_discount', new WPInv_Discount($post_id)); |
|
| 854 | 854 | break; |
| 855 | 855 | |
| 856 | 856 | case 'wpi_invoice': |
| 857 | - $invoice = new WPInv_Invoice( $post_id ); |
|
| 858 | - do_action( 'getpaid_before_delete_invoice', $invoice ); |
|
| 859 | - $invoice->get_data_store()->delete_items( $invoice ); |
|
| 860 | - $invoice->get_data_store()->delete_special_fields( $invoice ); |
|
| 857 | + $invoice = new WPInv_Invoice($post_id); |
|
| 858 | + do_action('getpaid_before_delete_invoice', $invoice); |
|
| 859 | + $invoice->get_data_store()->delete_items($invoice); |
|
| 860 | + $invoice->get_data_store()->delete_special_fields($invoice); |
|
| 861 | 861 | break; |
| 862 | 862 | } |
| 863 | 863 | } |
@@ -870,28 +870,28 @@ discard block |
||
| 870 | 870 | * |
| 871 | 871 | * @return mixed |
| 872 | 872 | */ |
| 873 | - public static function add_display_post_states( $post_states, $post ) { |
|
| 873 | + public static function add_display_post_states($post_states, $post) { |
|
| 874 | 874 | |
| 875 | - if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) { |
|
| 876 | - $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' ); |
|
| 875 | + if (wpinv_get_option('success_page', 0) == $post->ID) { |
|
| 876 | + $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing'); |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | - foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) { |
|
| 879 | + foreach (getpaid_get_invoice_post_types() as $post_type => $label) { |
|
| 880 | 880 | |
| 881 | - if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) { |
|
| 882 | - $post_states[ "getpaid_{$post_type}_history_page" ] = sprintf( |
|
| 883 | - __( 'GetPaid %s History Page', 'invoicing' ), |
|
| 881 | + if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) { |
|
| 882 | + $post_states["getpaid_{$post_type}_history_page"] = sprintf( |
|
| 883 | + __('GetPaid %s History Page', 'invoicing'), |
|
| 884 | 884 | $label |
| 885 | 885 | ); |
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) { |
|
| 890 | - $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' ); |
|
| 889 | + if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) { |
|
| 890 | + $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing'); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | - if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) { |
|
| 894 | - $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' ); |
|
| 893 | + if (wpinv_get_option('checkout_page', 0) == $post->ID) { |
|
| 894 | + $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing'); |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | return $post_states; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Invoicing |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Returns the errors as html |
@@ -15,35 +15,35 @@ discard block |
||
| 15 | 15 | * @param bool $wrap whether or not to wrap the errors. |
| 16 | 16 | * @since 1.0.19 |
| 17 | 17 | */ |
| 18 | -function getpaid_get_errors_html( $clear = true, $wrap = true ) { |
|
| 18 | +function getpaid_get_errors_html($clear = true, $wrap = true) { |
|
| 19 | 19 | |
| 20 | 20 | $errors = ''; |
| 21 | - foreach ( wpinv_get_errors() as $id => $error ) { |
|
| 22 | - $type = 'error'; |
|
| 21 | + foreach (wpinv_get_errors() as $id => $error) { |
|
| 22 | + $type = 'error'; |
|
| 23 | 23 | |
| 24 | - if ( is_array( $error ) ) { |
|
| 24 | + if (is_array($error)) { |
|
| 25 | 25 | $type = $error['type']; |
| 26 | 26 | $error = $error['text']; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if ( $wrap ) { |
|
| 29 | + if ($wrap) { |
|
| 30 | 30 | |
| 31 | 31 | $errors .= aui()->alert( |
| 32 | 32 | array( |
| 33 | - 'content' => wp_kses_post( $error ), |
|
| 33 | + 'content' => wp_kses_post($error), |
|
| 34 | 34 | 'type' => $type, |
| 35 | 35 | ) |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | } else { |
| 39 | 39 | |
| 40 | - $id = esc_attr( $id ); |
|
| 41 | - $error = wp_kses_post( $error ); |
|
| 40 | + $id = esc_attr($id); |
|
| 41 | + $error = wp_kses_post($error); |
|
| 42 | 42 | $errors .= "<div data-code='$id'>$error</div>"; |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ( $clear ) { |
|
| 46 | + if ($clear) { |
|
| 47 | 47 | wpinv_clear_errors(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * Prints (then clears) all available errors. |
| 56 | 56 | */ |
| 57 | 57 | function wpinv_print_errors() { |
| 58 | - echo wp_kses_post( getpaid_get_errors_html() ); |
|
| 58 | + echo wp_kses_post(getpaid_get_errors_html()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -69,54 +69,54 @@ discard block |
||
| 69 | 69 | $all_errors = array( |
| 70 | 70 | 'perm_cancel_subscription' => array( |
| 71 | 71 | 'type' => 'error', |
| 72 | - 'text' => __( 'You do not have permission to cancel this subscription', 'invoicing' ), |
|
| 72 | + 'text' => __('You do not have permission to cancel this subscription', 'invoicing'), |
|
| 73 | 73 | ), |
| 74 | 74 | 'cannot_cancel_subscription' => array( |
| 75 | 75 | 'type' => 'error', |
| 76 | - 'text' => __( 'This subscription cannot be cancelled as it is not active.', 'invoicing' ), |
|
| 76 | + 'text' => __('This subscription cannot be cancelled as it is not active.', 'invoicing'), |
|
| 77 | 77 | ), |
| 78 | 78 | 'cancelled_subscription' => array( |
| 79 | 79 | 'type' => 'success', |
| 80 | - 'text' => __( 'Subscription cancelled successfully.', 'invoicing' ), |
|
| 80 | + 'text' => __('Subscription cancelled successfully.', 'invoicing'), |
|
| 81 | 81 | ), |
| 82 | 82 | 'address_updated' => array( |
| 83 | 83 | 'type' => 'success', |
| 84 | - 'text' => __( 'Address updated successfully.', 'invoicing' ), |
|
| 84 | + 'text' => __('Address updated successfully.', 'invoicing'), |
|
| 85 | 85 | ), |
| 86 | 86 | 'perm_delete_invoice' => array( |
| 87 | 87 | 'type' => 'error', |
| 88 | - 'text' => __( 'You do not have permission to delete this invoice', 'invoicing' ), |
|
| 88 | + 'text' => __('You do not have permission to delete this invoice', 'invoicing'), |
|
| 89 | 89 | ), |
| 90 | 90 | 'cannot_delete_invoice' => array( |
| 91 | 91 | 'type' => 'error', |
| 92 | - 'text' => __( 'This invoice cannot be deleted as it has already been paid.', 'invoicing' ), |
|
| 92 | + 'text' => __('This invoice cannot be deleted as it has already been paid.', 'invoicing'), |
|
| 93 | 93 | ), |
| 94 | 94 | 'deleted_invoice' => array( |
| 95 | 95 | 'type' => 'success', |
| 96 | - 'text' => __( 'Invoice deleted successfully.', 'invoicing' ), |
|
| 96 | + 'text' => __('Invoice deleted successfully.', 'invoicing'), |
|
| 97 | 97 | ), |
| 98 | 98 | 'card_declined' => array( |
| 99 | 99 | 'type' => 'error', |
| 100 | - 'text' => __( 'Your card was declined.', 'invoicing' ), |
|
| 100 | + 'text' => __('Your card was declined.', 'invoicing'), |
|
| 101 | 101 | ), |
| 102 | 102 | 'invalid_currency' => array( |
| 103 | 103 | 'type' => 'error', |
| 104 | - 'text' => __( 'The chosen payment gateway does not support this currency.', 'invoicing' ), |
|
| 104 | + 'text' => __('The chosen payment gateway does not support this currency.', 'invoicing'), |
|
| 105 | 105 | ), |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $errors = apply_filters( 'wpinv_errors', array() ); |
|
| 108 | + $errors = apply_filters('wpinv_errors', array()); |
|
| 109 | 109 | |
| 110 | - if ( isset( $_GET['wpinv-notice'] ) && isset( $all_errors[ $_GET['wpinv-notice'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 111 | - $errors[ $_GET['wpinv-notice'] ] = $all_errors[ $_GET['wpinv-notice'] ]; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 110 | + if (isset($_GET['wpinv-notice']) && isset($all_errors[$_GET['wpinv-notice']])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 111 | + $errors[$_GET['wpinv-notice']] = $all_errors[$_GET['wpinv-notice']]; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( isset( $GLOBALS['wpinv_notice'] ) && isset( $all_errors[ $GLOBALS['wpinv_notice'] ] ) ) { |
|
| 115 | - $errors[ $GLOBALS['wpinv_notice'] ] = $all_errors[ $GLOBALS['wpinv_notice'] ]; |
|
| 114 | + if (isset($GLOBALS['wpinv_notice']) && isset($all_errors[$GLOBALS['wpinv_notice']])) { |
|
| 115 | + $errors[$GLOBALS['wpinv_notice']] = $all_errors[$GLOBALS['wpinv_notice']]; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( isset( $GLOBALS['wpinv_custom_notice'] ) ) { |
|
| 119 | - $errors[ $GLOBALS['wpinv_custom_notice']['code'] ] = $GLOBALS['wpinv_custom_notice']; |
|
| 118 | + if (isset($GLOBALS['wpinv_custom_notice'])) { |
|
| 119 | + $errors[$GLOBALS['wpinv_custom_notice']['code']] = $GLOBALS['wpinv_custom_notice']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | return $errors; |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | * @param string $error The error message. |
| 130 | 130 | * @param string $type The error type. |
| 131 | 131 | */ |
| 132 | -function wpinv_set_error( $error_id, $message = '', $type = 'error' ) { |
|
| 132 | +function wpinv_set_error($error_id, $message = '', $type = 'error') { |
|
| 133 | 133 | |
| 134 | - if ( ! empty( $message ) ) { |
|
| 134 | + if (!empty($message)) { |
|
| 135 | 135 | $GLOBALS['wpinv_custom_notice'] = array( |
| 136 | 136 | 'code' => $error_id, |
| 137 | 137 | 'type' => $type, |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * |
| 148 | 148 | */ |
| 149 | 149 | function wpinv_has_errors() { |
| 150 | - return count( wpinv_get_errors() ) > 0; |
|
| 150 | + return count(wpinv_get_errors()) > 0; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | */ |
| 157 | 157 | function wpinv_clear_errors() { |
| 158 | - unset( $GLOBALS['wpinv_notice'] ); |
|
| 158 | + unset($GLOBALS['wpinv_notice']); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | */ |
| 165 | 165 | function wpinv_unset_error() { |
| 166 | - unset( $GLOBALS['wpinv_notice'] ); |
|
| 166 | + unset($GLOBALS['wpinv_notice']); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | * @param string $message Message to log. |
| 175 | 175 | * @param string $version Version the message was added in. |
| 176 | 176 | */ |
| 177 | -function getpaid_doing_it_wrong( $function, $message, $version ) { |
|
| 177 | +function getpaid_doing_it_wrong($function, $message, $version) { |
|
| 178 | 178 | |
| 179 | 179 | $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); |
| 180 | 180 | |
| 181 | - if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) { |
|
| 182 | - do_action( 'doing_it_wrong_run', $function, $message, $version ); |
|
| 183 | - error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); |
|
| 181 | + if (wp_doing_ajax() || defined('REST_REQUEST')) { |
|
| 182 | + do_action('doing_it_wrong_run', $function, $message, $version); |
|
| 183 | + error_log("{$function} was called incorrectly. {$message}. This message was added in version {$version}."); |
|
| 184 | 184 | } else { |
| 185 | - _doing_it_wrong( esc_html( $function ), wp_kses_post( $message ), esc_html( $version ) ); |
|
| 185 | + _doing_it_wrong(esc_html($function), wp_kses_post($message), esc_html($version)); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | } |
@@ -196,41 +196,41 @@ discard block |
||
| 196 | 196 | * @param string $line The line that contains the error. |
| 197 | 197 | * @param bool $exit Whether or not to exit function execution. |
| 198 | 198 | */ |
| 199 | -function wpinv_error_log( $log, $title = '', $file = '', $line = '', $exit = false ) { |
|
| 199 | +function wpinv_error_log($log, $title = '', $file = '', $line = '', $exit = false) { |
|
| 200 | 200 | |
| 201 | - if ( true === apply_filters( 'wpinv_log_errors', true ) ) { |
|
| 201 | + if (true === apply_filters('wpinv_log_errors', true)) { |
|
| 202 | 202 | |
| 203 | 203 | // Ensure the log is a scalar. |
| 204 | - if ( ! is_scalar( $log ) ) { |
|
| 205 | - $log = print_r( $log, true ); |
|
| 204 | + if (!is_scalar($log)) { |
|
| 205 | + $log = print_r($log, true); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Add title. |
| 209 | - if ( ! empty( $title ) ) { |
|
| 210 | - $log = $title . ' ' . trim( $log ); |
|
| 209 | + if (!empty($title)) { |
|
| 210 | + $log = $title . ' ' . trim($log); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | // Add the file to the label. |
| 214 | - if ( ! empty( $file ) ) { |
|
| 214 | + if (!empty($file)) { |
|
| 215 | 215 | $log .= ' in ' . $file; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // Add the line number to the label. |
| 219 | - if ( ! empty( $line ) ) { |
|
| 219 | + if (!empty($line)) { |
|
| 220 | 220 | $log .= ' on line ' . $line; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // Log the message. |
| 224 | - error_log( trim( $log ) ); |
|
| 224 | + error_log(trim($log)); |
|
| 225 | 225 | |
| 226 | 226 | // ... and a backtrace. |
| 227 | - if ( false !== $title && false !== $file ) { |
|
| 228 | - error_log( 'Backtrace ' . wp_debug_backtrace_summary() ); |
|
| 227 | + if (false !== $title && false !== $file) { |
|
| 228 | + error_log('Backtrace ' . wp_debug_backtrace_summary()); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // Maybe exit. |
| 233 | - if ( $exit ) { |
|
| 233 | + if ($exit) { |
|
| 234 | 234 | exit; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Payment form submission itemss class |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @param GetPaid_Payment_Form_Submission $submission |
| 25 | 25 | */ |
| 26 | - public function __construct( $submission ) { |
|
| 26 | + public function __construct($submission) { |
|
| 27 | 27 | |
| 28 | 28 | $data = $submission->get_data(); |
| 29 | 29 | $payment_form = $submission->get_payment_form(); |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Prepare the selected items. |
| 34 | 34 | $selected_items = array(); |
| 35 | - if ( ! empty( $data['getpaid-items'] ) ) { |
|
| 36 | - $selected_items = wpinv_clean( $data['getpaid-items'] ); |
|
| 35 | + if (!empty($data['getpaid-items'])) { |
|
| 36 | + $selected_items = wpinv_clean($data['getpaid-items']); |
|
| 37 | 37 | |
| 38 | - if ( ! empty( $invoice ) && $submission->is_initial_fetch() ) { |
|
| 39 | - foreach ( $invoice->get_items() as $invoice_item ) { |
|
| 40 | - if ( isset( $selected_items[ $invoice_item->get_id() ] ) ) { |
|
| 41 | - $selected_items[ $invoice_item->get_id() ]['quantity'] = $invoice_item->get_quantity(); |
|
| 42 | - $selected_items[ $invoice_item->get_id() ]['price'] = $invoice_item->get_price(); |
|
| 38 | + if (!empty($invoice) && $submission->is_initial_fetch()) { |
|
| 39 | + foreach ($invoice->get_items() as $invoice_item) { |
|
| 40 | + if (isset($selected_items[$invoice_item->get_id()])) { |
|
| 41 | + $selected_items[$invoice_item->get_id()]['quantity'] = $invoice_item->get_quantity(); |
|
| 42 | + $selected_items[$invoice_item->get_id()]['price'] = $invoice_item->get_price(); |
|
| 43 | 43 | |
| 44 | - $force_prices[ $invoice_item->get_id() ] = $invoice_item->get_price(); |
|
| 44 | + $force_prices[$invoice_item->get_id()] = $invoice_item->get_price(); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // (Maybe) set form items. |
| 51 | - if ( isset( $data['getpaid-form-items'] ) ) { |
|
| 51 | + if (isset($data['getpaid-form-items'])) { |
|
| 52 | 52 | |
| 53 | 53 | // Confirm items key. |
| 54 | - $form_items = wpinv_clean( $data['getpaid-form-items'] ); |
|
| 55 | - if ( ! isset( $data['getpaid-form-items-key'] ) || md5( NONCE_KEY . AUTH_KEY . $form_items ) !== $data['getpaid-form-items-key'] ) { |
|
| 56 | - throw new Exception( __( 'We could not validate the form items. Please reload the page and try again.', 'invoicing' ) ); |
|
| 54 | + $form_items = wpinv_clean($data['getpaid-form-items']); |
|
| 55 | + if (!isset($data['getpaid-form-items-key']) || md5(NONCE_KEY . AUTH_KEY . $form_items) !== $data['getpaid-form-items-key']) { |
|
| 56 | + throw new Exception(__('We could not validate the form items. Please reload the page and try again.', 'invoicing')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $items = array(); |
|
| 59 | + $items = array(); |
|
| 60 | 60 | $item_ids = array(); |
| 61 | 61 | |
| 62 | - foreach ( getpaid_convert_items_to_array( $form_items ) as $item_id => $qty ) { |
|
| 63 | - if ( ! in_array( $item_id, $item_ids ) ) { |
|
| 64 | - $item = new GetPaid_Form_Item( $item_id ); |
|
| 65 | - $item->set_quantity( $qty ); |
|
| 62 | + foreach (getpaid_convert_items_to_array($form_items) as $item_id => $qty) { |
|
| 63 | + if (!in_array($item_id, $item_ids)) { |
|
| 64 | + $item = new GetPaid_Form_Item($item_id); |
|
| 65 | + $item->set_quantity($qty); |
|
| 66 | 66 | |
| 67 | - if ( empty( $qty ) ) { |
|
| 68 | - $item->set_allow_quantities( true ); |
|
| 69 | - $item->set_is_required( false ); |
|
| 67 | + if (empty($qty)) { |
|
| 68 | + $item->set_allow_quantities(true); |
|
| 69 | + $item->set_is_required(false); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if ( ! $item->user_can_set_their_price() && isset( $force_prices[ $item_id ] ) ) { |
|
| 73 | - $item->set_is_dynamic_pricing( true ); |
|
| 74 | - $item->set_minimum_price( 0 ); |
|
| 72 | + if (!$item->user_can_set_their_price() && isset($force_prices[$item_id])) { |
|
| 73 | + $item->set_is_dynamic_pricing(true); |
|
| 74 | + $item->set_minimum_price(0); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $item_ids[] = $item->get_id(); |
@@ -79,23 +79,23 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if ( ! $payment_form->is_default() ) { |
|
| 82 | + if (!$payment_form->is_default()) { |
|
| 83 | 83 | |
| 84 | - foreach ( $payment_form->get_items() as $item ) { |
|
| 85 | - if ( ! in_array( $item->get_id(), $item_ids ) ) { |
|
| 84 | + foreach ($payment_form->get_items() as $item) { |
|
| 85 | + if (!in_array($item->get_id(), $item_ids)) { |
|
| 86 | 86 | $item_ids[] = $item->get_id(); |
| 87 | 87 | $items[] = $item; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $payment_form->set_items( $items ); |
|
| 92 | + $payment_form->set_items($items); |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // Process each individual item. |
| 97 | - foreach ( $payment_form->get_items() as $item ) { |
|
| 98 | - $this->process_item( $item, $selected_items, $submission ); |
|
| 97 | + foreach ($payment_form->get_items() as $item) { |
|
| 98 | + $this->process_item($item, $selected_items, $submission); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | } |
@@ -107,40 +107,40 @@ discard block |
||
| 107 | 107 | * @param array $selected_items |
| 108 | 108 | * @param GetPaid_Payment_Form_Submission $submission |
| 109 | 109 | */ |
| 110 | - public function process_item( $item, $selected_items, $submission ) { |
|
| 110 | + public function process_item($item, $selected_items, $submission) { |
|
| 111 | 111 | |
| 112 | 112 | // Abort if this is an optional item and it has not been selected. |
| 113 | - if ( ! $item->is_required() && ! isset( $selected_items[ $item->get_id() ] ) ) { |
|
| 113 | + if (!$item->is_required() && !isset($selected_items[$item->get_id()])) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // (maybe) let customers change the quantities and prices. |
| 118 | - if ( isset( $selected_items[ $item->get_id() ] ) ) { |
|
| 118 | + if (isset($selected_items[$item->get_id()])) { |
|
| 119 | 119 | |
| 120 | 120 | // Maybe change the quantities. |
| 121 | - if ( $item->allows_quantities() ) { |
|
| 122 | - $item->set_quantity( (float) $selected_items[ $item->get_id() ]['quantity'] ); |
|
| 121 | + if ($item->allows_quantities()) { |
|
| 122 | + $item->set_quantity((float) $selected_items[$item->get_id()]['quantity']); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // Maybe change the price. |
| 126 | - if ( $item->user_can_set_their_price() ) { |
|
| 127 | - $price = (float) wpinv_sanitize_amount( $selected_items[ $item->get_id() ]['price'] ); |
|
| 126 | + if ($item->user_can_set_their_price()) { |
|
| 127 | + $price = (float) wpinv_sanitize_amount($selected_items[$item->get_id()]['price']); |
|
| 128 | 128 | |
| 129 | - if ( $item->get_minimum_price() > $price ) { |
|
| 130 | - throw new Exception( sprintf( __( 'The minimum allowed amount is %s', 'invoicing' ), getpaid_unstandardize_amount( $item->get_minimum_price() ) ) ); |
|
| 129 | + if ($item->get_minimum_price() > $price) { |
|
| 130 | + throw new Exception(sprintf(__('The minimum allowed amount is %s', 'invoicing'), getpaid_unstandardize_amount($item->get_minimum_price()))); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $item->set_price( $price ); |
|
| 133 | + $item->set_price($price); |
|
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if ( 0 == $item->get_quantity() ) { |
|
| 138 | + if (0 == $item->get_quantity()) { |
|
| 139 | 139 | return; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Save the item. |
| 143 | - $this->items[] = apply_filters( 'getpaid_payment_form_submission_processed_item', $item, $submission ); |
|
| 143 | + $this->items[] = apply_filters('getpaid_payment_form_submission_processed_item', $item, $submission); |
|
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @param string $context View or edit context. |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - public function get_name( $context = 'view' ) { |
|
| 98 | - $name = parent::get_name( $context ); |
|
| 99 | - return $name . wpinv_get_item_suffix( $this ); |
|
| 97 | + public function get_name($context = 'view') { |
|
| 98 | + $name = parent::get_name($context); |
|
| 99 | + return $name . wpinv_get_item_suffix($this); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | * @param string $context View or edit context. |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | - public function get_raw_name( $context = 'view' ) { |
|
| 110 | - return parent::get_name( $context ); |
|
| 109 | + public function get_raw_name($context = 'view') { |
|
| 110 | + return parent::get_name($context); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | * @param string $context View or edit context. |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | - public function get_description( $context = 'view' ) { |
|
| 120 | + public function get_description($context = 'view') { |
|
| 121 | 121 | |
| 122 | - if ( isset( $this->custom_description ) ) { |
|
| 122 | + if (isset($this->custom_description)) { |
|
| 123 | 123 | return $this->custom_description; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return parent::get_description( $context ); |
|
| 126 | + return parent::get_description($context); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @param string $context View or edit context. |
| 134 | 134 | * @return float |
| 135 | 135 | */ |
| 136 | - public function get_sub_total( $context = 'view' ) { |
|
| 137 | - return $this->get_quantity( $context ) * $this->get_initial_price( $context ); |
|
| 136 | + public function get_sub_total($context = 'view') { |
|
| 137 | + return $this->get_quantity($context) * $this->get_initial_price($context); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | * @param string $context View or edit context. |
| 145 | 145 | * @return float |
| 146 | 146 | */ |
| 147 | - public function get_recurring_sub_total( $context = 'view' ) { |
|
| 147 | + public function get_recurring_sub_total($context = 'view') { |
|
| 148 | 148 | |
| 149 | - if ( $this->is_recurring() ) { |
|
| 150 | - return $this->get_quantity( $context ) * $this->get_price( $context ); |
|
| 149 | + if ($this->is_recurring()) { |
|
| 150 | + return $this->get_quantity($context) * $this->get_price($context); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return 0; |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | /** |
| 157 | 157 | * @deprecated |
| 158 | 158 | */ |
| 159 | - public function get_qantity( $context = 'view' ) { |
|
| 160 | - return $this->get_quantity( $context ); |
|
| 159 | + public function get_qantity($context = 'view') { |
|
| 160 | + return $this->get_quantity($context); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | * @param string $context View or edit context. |
| 168 | 168 | * @return float |
| 169 | 169 | */ |
| 170 | - public function get_quantity( $context = 'view' ) { |
|
| 170 | + public function get_quantity($context = 'view') { |
|
| 171 | 171 | $quantity = (float) $this->quantity; |
| 172 | 172 | |
| 173 | - if ( 'view' === $context ) { |
|
| 174 | - return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this ); |
|
| 173 | + if ('view' === $context) { |
|
| 174 | + return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $quantity; |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | * @param string $context View or edit context. |
| 186 | 186 | * @return meta |
| 187 | 187 | */ |
| 188 | - public function get_item_meta( $context = 'view' ) { |
|
| 188 | + public function get_item_meta($context = 'view') { |
|
| 189 | 189 | $meta = $this->meta; |
| 190 | 190 | |
| 191 | - if ( 'view' === $context ) { |
|
| 192 | - return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this ); |
|
| 191 | + if ('view' === $context) { |
|
| 192 | + return apply_filters('getpaid_payment_form_item_meta', $meta, $this); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return $meta; |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | * @param string $context View or edit context. |
| 204 | 204 | * @return bool |
| 205 | 205 | */ |
| 206 | - public function get_allow_quantities( $context = 'view' ) { |
|
| 206 | + public function get_allow_quantities($context = 'view') { |
|
| 207 | 207 | $allow_quantities = (bool) $this->allow_quantities; |
| 208 | 208 | |
| 209 | - if ( 'view' === $context ) { |
|
| 210 | - return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this ); |
|
| 209 | + if ('view' === $context) { |
|
| 210 | + return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | return $allow_quantities; |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | * @param string $context View or edit context. |
| 222 | 222 | * @return bool |
| 223 | 223 | */ |
| 224 | - public function get_is_required( $context = 'view' ) { |
|
| 224 | + public function get_is_required($context = 'view') { |
|
| 225 | 225 | $is_required = (bool) $this->is_required; |
| 226 | 226 | |
| 227 | - if ( 'view' === $context ) { |
|
| 228 | - return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this ); |
|
| 227 | + if ('view' === $context) { |
|
| 228 | + return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | return $is_required; |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | * @since 1.0.19 |
| 239 | 239 | * @return array |
| 240 | 240 | */ |
| 241 | - public function prepare_data_for_use( $required = null ) { |
|
| 241 | + public function prepare_data_for_use($required = null) { |
|
| 242 | 242 | |
| 243 | - $required = is_null( $required ) ? $this->is_required() : $required; |
|
| 243 | + $required = is_null($required) ? $this->is_required() : $required; |
|
| 244 | 244 | return array( |
| 245 | - 'title' => wp_strip_all_tags( $this->get_name() ), |
|
| 245 | + 'title' => wp_strip_all_tags($this->get_name()), |
|
| 246 | 246 | 'id' => $this->get_id(), |
| 247 | 247 | 'price' => $this->get_price(), |
| 248 | 248 | 'recurring' => $this->is_recurring(), |
@@ -259,30 +259,30 @@ discard block |
||
| 259 | 259 | * @since 1.0.19 |
| 260 | 260 | * @return array |
| 261 | 261 | */ |
| 262 | - public function prepare_data_for_invoice_edit_ajax( $currency = '', $is_renewal = false ) { |
|
| 262 | + public function prepare_data_for_invoice_edit_ajax($currency = '', $is_renewal = false) { |
|
| 263 | 263 | |
| 264 | - $description = getpaid_item_recurring_price_help_text( $this, $currency ); |
|
| 264 | + $description = getpaid_item_recurring_price_help_text($this, $currency); |
|
| 265 | 265 | |
| 266 | - if ( $description ) { |
|
| 266 | + if ($description) { |
|
| 267 | 267 | $description = "<div class='getpaid-subscription-help-text'>$description</div>"; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $price = ! $is_renewal ? $this->get_price() : $this->get_recurring_price(); |
|
| 271 | - $subtotal = ! $is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total(); |
|
| 270 | + $price = !$is_renewal ? $this->get_price() : $this->get_recurring_price(); |
|
| 271 | + $subtotal = !$is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total(); |
|
| 272 | 272 | return array( |
| 273 | 273 | 'id' => $this->get_id(), |
| 274 | 274 | 'texts' => array( |
| 275 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 276 | - 'item-description' => wp_kses_post( $this->get_description() ) . $description, |
|
| 277 | - 'item-quantity' => floatval( $this->get_quantity() ), |
|
| 278 | - 'item-price' => wpinv_price( $price, $currency ), |
|
| 279 | - 'item-total' => wpinv_price( $subtotal, $currency ), |
|
| 275 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
| 276 | + 'item-description' => wp_kses_post($this->get_description()) . $description, |
|
| 277 | + 'item-quantity' => floatval($this->get_quantity()), |
|
| 278 | + 'item-price' => wpinv_price($price, $currency), |
|
| 279 | + 'item-total' => wpinv_price($subtotal, $currency), |
|
| 280 | 280 | ), |
| 281 | 281 | 'inputs' => array( |
| 282 | 282 | 'item-id' => $this->get_id(), |
| 283 | - 'item-name' => sanitize_text_field( $this->get_name() ), |
|
| 284 | - 'item-description' => wp_kses_post( $this->get_description() ), |
|
| 285 | - 'item-quantity' => floatval( $this->get_quantity() ), |
|
| 283 | + 'item-name' => sanitize_text_field($this->get_name()), |
|
| 284 | + 'item-description' => wp_kses_post($this->get_description()), |
|
| 285 | + 'item-quantity' => floatval($this->get_quantity()), |
|
| 286 | 286 | 'item-price' => $price, |
| 287 | 287 | ), |
| 288 | 288 | ); |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | return array( |
| 301 | 301 | 'post_id' => $this->invoice_id, |
| 302 | 302 | 'item_id' => $this->get_id(), |
| 303 | - 'item_name' => sanitize_text_field( $this->get_raw_name( 'edit' ) ), |
|
| 304 | - 'item_description' => $this->get_description( 'edit' ), |
|
| 303 | + 'item_name' => sanitize_text_field($this->get_raw_name('edit')), |
|
| 304 | + 'item_description' => $this->get_description('edit'), |
|
| 305 | 305 | 'tax' => $this->item_tax, |
| 306 | - 'item_price' => $this->get_price( 'edit' ), |
|
| 307 | - 'quantity' => (float) $this->get_quantity( 'edit' ), |
|
| 306 | + 'item_price' => $this->get_price('edit'), |
|
| 307 | + 'quantity' => (float) $this->get_quantity('edit'), |
|
| 308 | 308 | 'discount' => $this->item_discount, |
| 309 | - 'subtotal' => $this->get_sub_total( 'edit' ), |
|
| 310 | - 'price' => $this->get_sub_total( 'edit' ) + $this->item_tax - $this->item_discount, |
|
| 311 | - 'meta' => $this->get_item_meta( 'edit' ), |
|
| 309 | + 'subtotal' => $this->get_sub_total('edit'), |
|
| 310 | + 'price' => $this->get_sub_total('edit') + $this->item_tax - $this->item_discount, |
|
| 311 | + 'meta' => $this->get_item_meta('edit'), |
|
| 312 | 312 | ); |
| 313 | 313 | |
| 314 | 314 | } |
@@ -329,9 +329,9 @@ discard block |
||
| 329 | 329 | * @since 1.0.19 |
| 330 | 330 | * @param float $quantity The item quantity. |
| 331 | 331 | */ |
| 332 | - public function set_quantity( $quantity ) { |
|
| 332 | + public function set_quantity($quantity) { |
|
| 333 | 333 | |
| 334 | - if ( ! is_numeric( $quantity ) ) { |
|
| 334 | + if (!is_numeric($quantity)) { |
|
| 335 | 335 | $quantity = 1; |
| 336 | 336 | } |
| 337 | 337 | |
@@ -345,8 +345,8 @@ discard block |
||
| 345 | 345 | * @since 1.0.19 |
| 346 | 346 | * @param array $meta The item meta data. |
| 347 | 347 | */ |
| 348 | - public function set_item_meta( $meta ) { |
|
| 349 | - $this->meta = maybe_unserialize( $meta ); |
|
| 348 | + public function set_item_meta($meta) { |
|
| 349 | + $this->meta = maybe_unserialize($meta); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @since 1.0.19 |
| 356 | 356 | * @param bool $allow_quantities |
| 357 | 357 | */ |
| 358 | - public function set_allow_quantities( $allow_quantities ) { |
|
| 358 | + public function set_allow_quantities($allow_quantities) { |
|
| 359 | 359 | $this->allow_quantities = (bool) $allow_quantities; |
| 360 | 360 | } |
| 361 | 361 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * @since 1.0.19 |
| 366 | 366 | * @param bool $is_required |
| 367 | 367 | */ |
| 368 | - public function set_is_required( $is_required ) { |
|
| 368 | + public function set_is_required($is_required) { |
|
| 369 | 369 | $this->is_required = (bool) $is_required; |
| 370 | 370 | } |
| 371 | 371 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * @since 1.0.19 |
| 376 | 376 | * @param string $description |
| 377 | 377 | */ |
| 378 | - public function set_custom_description( $description ) { |
|
| 378 | + public function set_custom_description($description) { |
|
| 379 | 379 | $this->custom_description = $description; |
| 380 | 380 | } |
| 381 | 381 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * |
| 385 | 385 | * @return int item id |
| 386 | 386 | */ |
| 387 | - public function save( $data = array() ) { |
|
| 387 | + public function save($data = array()) { |
|
| 388 | 388 | return $this->get_id(); |
| 389 | 389 | } |
| 390 | 390 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -defined( 'ABSPATH' ) || exit; |
|
| 7 | +defined('ABSPATH') || exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Abstaract Payment Gateway class. |
@@ -138,53 +138,53 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function __construct() { |
| 140 | 140 | |
| 141 | - do_action( 'getpaid_before_init_payment_gateway_' . $this->id, $this ); |
|
| 141 | + do_action('getpaid_before_init_payment_gateway_' . $this->id, $this); |
|
| 142 | 142 | |
| 143 | 143 | // Register gateway. |
| 144 | - add_filter( 'wpinv_payment_gateways', array( $this, 'register_gateway' ) ); |
|
| 144 | + add_filter('wpinv_payment_gateways', array($this, 'register_gateway')); |
|
| 145 | 145 | |
| 146 | - $this->enabled = wpinv_is_gateway_active( $this->id ); |
|
| 146 | + $this->enabled = wpinv_is_gateway_active($this->id); |
|
| 147 | 147 | |
| 148 | 148 | // Add support for various features. |
| 149 | - foreach ( $this->supports as $feature ) { |
|
| 150 | - add_filter( "wpinv_{$this->id}_support_{$feature}", '__return_true' ); |
|
| 151 | - add_filter( "getpaid_{$this->id}_support_{$feature}", '__return_true' ); |
|
| 152 | - add_filter( "getpaid_{$this->id}_supports_{$feature}", '__return_true' ); |
|
| 149 | + foreach ($this->supports as $feature) { |
|
| 150 | + add_filter("wpinv_{$this->id}_support_{$feature}", '__return_true'); |
|
| 151 | + add_filter("getpaid_{$this->id}_support_{$feature}", '__return_true'); |
|
| 152 | + add_filter("getpaid_{$this->id}_supports_{$feature}", '__return_true'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Invoice addons. |
| 156 | - if ( $this->supports( 'addons' ) ) { |
|
| 157 | - add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ), 10, 2 ); |
|
| 156 | + if ($this->supports('addons')) { |
|
| 157 | + add_action("getpaid_process_{$this->id}_invoice_addons", array($this, 'process_addons'), 10, 2); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Gateway settings. |
| 161 | - add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) ); |
|
| 161 | + add_filter("wpinv_gateway_settings_{$this->id}", array($this, 'admin_settings')); |
|
| 162 | 162 | |
| 163 | 163 | // Gateway checkout fiellds. |
| 164 | - add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 ); |
|
| 164 | + add_action("wpinv_{$this->id}_cc_form", array($this, 'payment_fields'), 10, 2); |
|
| 165 | 165 | |
| 166 | 166 | // Process payment. |
| 167 | - add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 ); |
|
| 167 | + add_action("getpaid_gateway_{$this->id}", array($this, 'process_payment'), 10, 3); |
|
| 168 | 168 | |
| 169 | 169 | // Change the checkout button text. |
| 170 | - if ( ! empty( $this->checkout_button_text ) ) { |
|
| 171 | - add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) ); |
|
| 170 | + if (!empty($this->checkout_button_text)) { |
|
| 171 | + add_filter("getpaid_gateway_{$this->id}_checkout_button_label", array($this, 'rename_checkout_button')); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Check if a gateway is valid for a given currency. |
| 175 | - add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 ); |
|
| 175 | + add_filter("getpaid_gateway_{$this->id}_is_valid_for_currency", array($this, 'validate_currency'), 10, 2); |
|
| 176 | 176 | |
| 177 | 177 | // Generate the transaction url. |
| 178 | - add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 ); |
|
| 178 | + add_filter("getpaid_gateway_{$this->id}_transaction_url", array($this, 'filter_transaction_url'), 10, 2); |
|
| 179 | 179 | |
| 180 | 180 | // Generate the subscription url. |
| 181 | - add_filter( 'getpaid_remote_subscription_profile_url', array( $this, 'generate_subscription_url' ), 10, 2 ); |
|
| 181 | + add_filter('getpaid_remote_subscription_profile_url', array($this, 'generate_subscription_url'), 10, 2); |
|
| 182 | 182 | |
| 183 | 183 | // Confirm payments. |
| 184 | - add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 ); |
|
| 184 | + add_filter("wpinv_payment_confirm_{$this->id}", array($this, 'confirm_payment'), 10, 2); |
|
| 185 | 185 | |
| 186 | 186 | // Verify IPNs. |
| 187 | - add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) ); |
|
| 187 | + add_action("wpinv_verify_{$this->id}_ipn", array($this, 'verify_ipn')); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @since 1.0.19 |
| 195 | 195 | * @return bool |
| 196 | 196 | */ |
| 197 | - public function is( $gateway ) { |
|
| 197 | + public function is($gateway) { |
|
| 198 | 198 | return $gateway == $this->id; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -204,23 +204,23 @@ discard block |
||
| 204 | 204 | * @since 1.0.19 |
| 205 | 205 | * @return array |
| 206 | 206 | */ |
| 207 | - public function get_tokens( $sandbox = null ) { |
|
| 207 | + public function get_tokens($sandbox = null) { |
|
| 208 | 208 | |
| 209 | - if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) { |
|
| 210 | - $tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true ); |
|
| 209 | + if (is_user_logged_in() && $this->supports('tokens') && 0 == count($this->tokens)) { |
|
| 210 | + $tokens = get_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", true); |
|
| 211 | 211 | |
| 212 | - if ( is_array( $tokens ) ) { |
|
| 212 | + if (is_array($tokens)) { |
|
| 213 | 213 | $this->tokens = $tokens; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if ( ! is_bool( $sandbox ) ) { |
|
| 217 | + if (!is_bool($sandbox)) { |
|
| 218 | 218 | return $this->tokens; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // Filter tokens. |
| 222 | - $args = array( 'type' => $sandbox ? 'sandbox' : 'live' ); |
|
| 223 | - return wp_list_filter( $this->tokens, $args ); |
|
| 222 | + $args = array('type' => $sandbox ? 'sandbox' : 'live'); |
|
| 223 | + return wp_list_filter($this->tokens, $args); |
|
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @since 1.0.19 |
| 231 | 231 | */ |
| 232 | - public function save_token( $token ) { |
|
| 232 | + public function save_token($token) { |
|
| 233 | 233 | |
| 234 | 234 | $tokens = $this->get_tokens(); |
| 235 | 235 | $tokens[] = $token; |
| 236 | 236 | |
| 237 | - update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens ); |
|
| 237 | + update_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens); |
|
| 238 | 238 | |
| 239 | 239 | $this->tokens = $tokens; |
| 240 | 240 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | 248 | public function get_method_title() { |
| 249 | - return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this ); |
|
| 249 | + return apply_filters('getpaid_gateway_method_title', $this->method_title, $this); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @return string |
| 256 | 256 | */ |
| 257 | 257 | public function get_method_description() { |
| 258 | - return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this ); |
|
| 258 | + return apply_filters('getpaid_gateway_method_description', $this->method_description, $this); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param WPInv_Invoice $invoice Invoice object. |
| 265 | 265 | * @return string |
| 266 | 266 | */ |
| 267 | - public function get_return_url( $invoice ) { |
|
| 267 | + public function get_return_url($invoice) { |
|
| 268 | 268 | |
| 269 | 269 | // Payment success url |
| 270 | 270 | $return_url = add_query_arg( |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | wpinv_get_success_page_uri() |
| 277 | 277 | ); |
| 278 | 278 | |
| 279 | - return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this ); |
|
| 279 | + return apply_filters('getpaid_gateway_success_url', $return_url, $invoice, $this); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -285,24 +285,24 @@ discard block |
||
| 285 | 285 | * @param string $content Success page content. |
| 286 | 286 | * @return string |
| 287 | 287 | */ |
| 288 | - public function confirm_payment( $content ) { |
|
| 288 | + public function confirm_payment($content) { |
|
| 289 | 289 | |
| 290 | 290 | // Retrieve the invoice. |
| 291 | 291 | $invoice_id = getpaid_get_current_invoice_id(); |
| 292 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
| 292 | + $invoice = wpinv_get_invoice($invoice_id); |
|
| 293 | 293 | |
| 294 | 294 | // Ensure that it exists and that it is pending payment. |
| 295 | - if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) { |
|
| 295 | + if (empty($invoice_id) || !$invoice->needs_payment()) { |
|
| 296 | 296 | return $content; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // Can the user view this invoice?? |
| 300 | - if ( ! wpinv_user_can_view_invoice( $invoice ) ) { |
|
| 300 | + if (!wpinv_user_can_view_invoice($invoice)) { |
|
| 301 | 301 | return $content; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // Show payment processing indicator. |
| 305 | - return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) ); |
|
| 305 | + return wpinv_get_template_html('wpinv-payment-processing.php', compact('invoice')); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @param GetPaid_Form_Item[] $items |
| 320 | 320 | * @return WPInv_Invoice |
| 321 | 321 | */ |
| 322 | - public function process_addons( $invoice, $items ) { |
|
| 322 | + public function process_addons($invoice, $items) { |
|
| 323 | 323 | |
| 324 | 324 | } |
| 325 | 325 | |
@@ -330,14 +330,14 @@ discard block |
||
| 330 | 330 | * @param WPInv_Invoice $invoice Invoice object. |
| 331 | 331 | * @return string transaction URL, or empty string. |
| 332 | 332 | */ |
| 333 | - public function filter_transaction_url( $transaction_url, $invoice ) { |
|
| 333 | + public function filter_transaction_url($transaction_url, $invoice) { |
|
| 334 | 334 | |
| 335 | - $transaction_id = $invoice->get_transaction_id(); |
|
| 335 | + $transaction_id = $invoice->get_transaction_id(); |
|
| 336 | 336 | |
| 337 | - if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) { |
|
| 338 | - $transaction_url = sprintf( $this->view_transaction_url, $transaction_id ); |
|
| 339 | - $replace = $this->is_sandbox( $invoice ) ? 'sandbox' : ''; |
|
| 340 | - $transaction_url = str_replace( '{sandbox}', $replace, $transaction_url ); |
|
| 337 | + if (!empty($this->view_transaction_url) && !empty($transaction_id)) { |
|
| 338 | + $transaction_url = sprintf($this->view_transaction_url, $transaction_id); |
|
| 339 | + $replace = $this->is_sandbox($invoice) ? 'sandbox' : ''; |
|
| 340 | + $transaction_url = str_replace('{sandbox}', $replace, $transaction_url); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | return $transaction_url; |
@@ -350,15 +350,15 @@ discard block |
||
| 350 | 350 | * @param WPInv_Subscription $subscription Subscription objectt. |
| 351 | 351 | * @return string subscription URL, or empty string. |
| 352 | 352 | */ |
| 353 | - public function generate_subscription_url( $subscription_url, $subscription ) { |
|
| 353 | + public function generate_subscription_url($subscription_url, $subscription) { |
|
| 354 | 354 | |
| 355 | - $profile_id = $subscription->get_profile_id(); |
|
| 355 | + $profile_id = $subscription->get_profile_id(); |
|
| 356 | 356 | |
| 357 | - if ( $this->id == $subscription->get_gateway() && ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) { |
|
| 357 | + if ($this->id == $subscription->get_gateway() && !empty($this->view_subscription_url) && !empty($profile_id)) { |
|
| 358 | 358 | |
| 359 | - $subscription_url = sprintf( $this->view_subscription_url, $profile_id ); |
|
| 360 | - $replace = $this->is_sandbox( $subscription->get_parent_invoice() ) ? 'sandbox' : ''; |
|
| 361 | - $subscription_url = str_replace( '{sandbox}', $replace, $subscription_url ); |
|
| 359 | + $subscription_url = sprintf($this->view_subscription_url, $profile_id); |
|
| 360 | + $replace = $this->is_sandbox($subscription->get_parent_invoice()) ? 'sandbox' : ''; |
|
| 361 | + $subscription_url = str_replace('{sandbox}', $replace, $subscription_url); |
|
| 362 | 362 | |
| 363 | 363 | } |
| 364 | 364 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * @return bool |
| 372 | 372 | */ |
| 373 | 373 | public function is_available() { |
| 374 | - return ! empty( $this->enabled ); |
|
| 374 | + return !empty($this->enabled); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | * @return string |
| 381 | 381 | */ |
| 382 | 382 | public function get_title() { |
| 383 | - return apply_filters( 'getpaid_gateway_title', $this->title, $this ); |
|
| 383 | + return apply_filters('getpaid_gateway_title', $this->title, $this); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | * @return string |
| 390 | 390 | */ |
| 391 | 391 | public function get_description() { |
| 392 | - return apply_filters( 'getpaid_gateway_description', $this->description, $this ); |
|
| 392 | + return apply_filters('getpaid_gateway_description', $this->description, $this); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -401,9 +401,9 @@ discard block |
||
| 401 | 401 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
| 402 | 402 | * @return void |
| 403 | 403 | */ |
| 404 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
| 404 | + public function process_payment($invoice, $submission_data, $submission) { |
|
| 405 | 405 | // Process the payment then either redirect to the success page or the gateway. |
| 406 | - do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission ); |
|
| 406 | + do_action('getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | * @param string $reason Refund reason. |
| 418 | 418 | * @return WP_Error|bool True or false based on success, or a WP_Error object. |
| 419 | 419 | */ |
| 420 | - public function process_refund( $invoice, $amount = null, $reason = '' ) { |
|
| 421 | - return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason ); |
|
| 420 | + public function process_refund($invoice, $amount = null, $reason = '') { |
|
| 421 | + return apply_filters('getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | * @param int $invoice_id 0 or invoice id. |
| 428 | 428 | * @param GetPaid_Payment_Form $form Current payment form. |
| 429 | 429 | */ |
| 430 | - public function payment_fields( $invoice_id, $form ) { |
|
| 431 | - do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form ); |
|
| 430 | + public function payment_fields($invoice_id, $form) { |
|
| 431 | + do_action('getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | * |
| 437 | 437 | * @param array $admin_settings |
| 438 | 438 | */ |
| 439 | - public function admin_settings( $admin_settings ) { |
|
| 439 | + public function admin_settings($admin_settings) { |
|
| 440 | 440 | return $admin_settings; |
| 441 | 441 | } |
| 442 | 442 | |
@@ -445,8 +445,8 @@ discard block |
||
| 445 | 445 | * |
| 446 | 446 | * @param string $option |
| 447 | 447 | */ |
| 448 | - public function get_option( $option, $default = false ) { |
|
| 449 | - return wpinv_get_option( $this->id . '_' . $option, $default ); |
|
| 448 | + public function get_option($option, $default = false) { |
|
| 449 | + return wpinv_get_option($this->id . '_' . $option, $default); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | * @return bool True if the gateway supports the feature, false otherwise. |
| 460 | 460 | * @since 1.0.19 |
| 461 | 461 | */ |
| 462 | - public function supports( $feature ) { |
|
| 463 | - return getpaid_payment_gateway_supports( $this->id, $feature ); |
|
| 462 | + public function supports($feature) { |
|
| 463 | + return getpaid_payment_gateway_supports($this->id, $feature); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -468,39 +468,39 @@ discard block |
||
| 468 | 468 | * |
| 469 | 469 | * @param bool $save whether or not to display the save button. |
| 470 | 470 | */ |
| 471 | - public function get_cc_form( $save = false ) { |
|
| 471 | + public function get_cc_form($save = false) { |
|
| 472 | 472 | |
| 473 | 473 | ob_start(); |
| 474 | 474 | |
| 475 | - $id_prefix = esc_attr( uniqid( $this->id ) ); |
|
| 475 | + $id_prefix = esc_attr(uniqid($this->id)); |
|
| 476 | 476 | |
| 477 | 477 | $months = array( |
| 478 | - '01' => __( 'January', 'invoicing' ), |
|
| 479 | - '02' => __( 'February', 'invoicing' ), |
|
| 480 | - '03' => __( 'March', 'invoicing' ), |
|
| 481 | - '04' => __( 'April', 'invoicing' ), |
|
| 482 | - '05' => __( 'May', 'invoicing' ), |
|
| 483 | - '06' => __( 'June', 'invoicing' ), |
|
| 484 | - '07' => __( 'July', 'invoicing' ), |
|
| 485 | - '08' => __( 'August', 'invoicing' ), |
|
| 486 | - '09' => __( 'September', 'invoicing' ), |
|
| 487 | - '10' => __( 'October', 'invoicing' ), |
|
| 488 | - '11' => __( 'November', 'invoicing' ), |
|
| 489 | - '12' => __( 'December', 'invoicing' ), |
|
| 478 | + '01' => __('January', 'invoicing'), |
|
| 479 | + '02' => __('February', 'invoicing'), |
|
| 480 | + '03' => __('March', 'invoicing'), |
|
| 481 | + '04' => __('April', 'invoicing'), |
|
| 482 | + '05' => __('May', 'invoicing'), |
|
| 483 | + '06' => __('June', 'invoicing'), |
|
| 484 | + '07' => __('July', 'invoicing'), |
|
| 485 | + '08' => __('August', 'invoicing'), |
|
| 486 | + '09' => __('September', 'invoicing'), |
|
| 487 | + '10' => __('October', 'invoicing'), |
|
| 488 | + '11' => __('November', 'invoicing'), |
|
| 489 | + '12' => __('December', 'invoicing'), |
|
| 490 | 490 | ); |
| 491 | - $months = apply_filters( 'getpaid_cc_months', $months, $this ); |
|
| 491 | + $months = apply_filters('getpaid_cc_months', $months, $this); |
|
| 492 | 492 | |
| 493 | - $year = (int) current_time( 'Y' ); |
|
| 493 | + $year = (int) current_time('Y'); |
|
| 494 | 494 | $years = array(); |
| 495 | 495 | |
| 496 | - for ( $i = 0; $i <= 10; $i++ ) { |
|
| 497 | - $years[ $year + $i ] = $year + $i; |
|
| 496 | + for ($i = 0; $i <= 10; $i++) { |
|
| 497 | + $years[$year + $i] = $year + $i; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - $years = apply_filters( 'getpaid_cc_years', $years, $this ); |
|
| 500 | + $years = apply_filters('getpaid_cc_years', $years, $this); |
|
| 501 | 501 | |
| 502 | 502 | ?> |
| 503 | - <div class="<?php echo esc_attr( $this->id ); ?>-cc-form getpaid-cc-form mt-1"> |
|
| 503 | + <div class="<?php echo esc_attr($this->id); ?>-cc-form getpaid-cc-form mt-1"> |
|
| 504 | 504 | |
| 505 | 505 | |
| 506 | 506 | <div class="getpaid-cc-card-inner"> |
@@ -509,9 +509,9 @@ discard block |
||
| 509 | 509 | <div class="col-12"> |
| 510 | 510 | |
| 511 | 511 | <div class="form-group mb-3"> |
| 512 | - <label for="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>"><?php esc_html_e( 'Card number', 'invoicing' ); ?></label> |
|
| 512 | + <label for="<?php echo esc_attr("$id_prefix-cc-number"); ?>"><?php esc_html_e('Card number', 'invoicing'); ?></label> |
|
| 513 | 513 | <div class="input-group input-group-sm"> |
| 514 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 514 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 515 | 515 | <div class="input-group-prepend "> |
| 516 | 516 | <span class="input-group-text"> |
| 517 | 517 | <i class="fa fa-credit-card"></i> |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | <i class="fa fa-credit-card"></i> |
| 523 | 523 | </span> |
| 524 | 524 | <?php endif; ?> |
| 525 | - <input type="text" name="<?php echo esc_attr( $this->id . '[cc_number]' ); ?>" id="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number"> |
|
| 525 | + <input type="text" name="<?php echo esc_attr($this->id . '[cc_number]'); ?>" id="<?php echo esc_attr("$id_prefix-cc-number"); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number"> |
|
| 526 | 526 | </div> |
| 527 | 527 | </div> |
| 528 | 528 | |
@@ -530,16 +530,16 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | <div class="col-12"> |
| 532 | 532 | <div class="form-group mb-3"> |
| 533 | - <label><?php esc_html_e( 'Expiration', 'invoicing' ); ?></label> |
|
| 533 | + <label><?php esc_html_e('Expiration', 'invoicing'); ?></label> |
|
| 534 | 534 | <div class="form-row row"> |
| 535 | 535 | |
| 536 | 536 | <div class="col"> |
| 537 | - <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_month]"> |
|
| 538 | - <option disabled selected="selected"><?php esc_html_e( 'MM', 'invoicing' ); ?></option> |
|
| 537 | + <select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr($this->id); ?>[cc_expire_month]"> |
|
| 538 | + <option disabled selected="selected"><?php esc_html_e('MM', 'invoicing'); ?></option> |
|
| 539 | 539 | |
| 540 | 540 | <?php |
| 541 | - foreach ( $months as $key => $month ) { |
|
| 542 | - echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $month ) . '</option>'; |
|
| 541 | + foreach ($months as $key => $month) { |
|
| 542 | + echo "<option value='" . esc_attr($key) . "'>" . esc_html($month) . '</option>'; |
|
| 543 | 543 | } |
| 544 | 544 | ?> |
| 545 | 545 | |
@@ -547,12 +547,12 @@ discard block |
||
| 547 | 547 | </div> |
| 548 | 548 | |
| 549 | 549 | <div class="col"> |
| 550 | - <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_year]"> |
|
| 551 | - <option disabled selected="selected"><?php esc_html_e( 'YY', 'invoicing' ); ?></option> |
|
| 550 | + <select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr($this->id); ?>[cc_expire_year]"> |
|
| 551 | + <option disabled selected="selected"><?php esc_html_e('YY', 'invoicing'); ?></option> |
|
| 552 | 552 | |
| 553 | 553 | <?php |
| 554 | - foreach ( $years as $key => $year ) { |
|
| 555 | - echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $year ) . '</option>'; |
|
| 554 | + foreach ($years as $key => $year) { |
|
| 555 | + echo "<option value='" . esc_attr($key) . "'>" . esc_html($year) . '</option>'; |
|
| 556 | 556 | } |
| 557 | 557 | ?> |
| 558 | 558 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | array( |
| 570 | 570 | 'name' => $this->id . '[cc_cvv2]', |
| 571 | 571 | 'id' => "$id_prefix-cc-cvv2", |
| 572 | - 'label' => __( 'CCV', 'invoicing' ), |
|
| 572 | + 'label' => __('CCV', 'invoicing'), |
|
| 573 | 573 | 'label_type' => 'vertical', |
| 574 | 574 | 'class' => 'form-control-sm', |
| 575 | 575 | 'extra_attributes' => array( |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | |
| 586 | 586 | <?php |
| 587 | 587 | |
| 588 | - if ( $save ) { |
|
| 588 | + if ($save) { |
|
| 589 | 589 | $this->save_payment_method_checkbox(); |
| 590 | 590 | } |
| 591 | 591 | |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | * |
| 605 | 605 | * @since 1.0.19 |
| 606 | 606 | */ |
| 607 | - public function new_payment_method_entry( $form ) { |
|
| 608 | - echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses( $form, getpaid_allowed_html() ) . '</div>'; |
|
| 607 | + public function new_payment_method_entry($form) { |
|
| 608 | + echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses($form, getpaid_allowed_html()) . '</div>'; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -614,10 +614,10 @@ discard block |
||
| 614 | 614 | * @since 1.0.19 |
| 615 | 615 | */ |
| 616 | 616 | public function saved_payment_methods() { |
| 617 | - echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">'; |
|
| 617 | + echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr(count($this->get_tokens($this->is_sandbox()))) . '">'; |
|
| 618 | 618 | |
| 619 | - foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) { |
|
| 620 | - $this->get_saved_payment_method_option_html( $token ); |
|
| 619 | + foreach ($this->get_tokens($this->is_sandbox()) as $token) { |
|
| 620 | + $this->get_saved_payment_method_option_html($token); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | $this->get_new_payment_method_option_html(); |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | * @param array $token Payment Token. |
| 633 | 633 | * @return string Generated payment method HTML |
| 634 | 634 | */ |
| 635 | - public function get_saved_payment_method_option_html( $token ) { |
|
| 635 | + public function get_saved_payment_method_option_html($token) { |
|
| 636 | 636 | |
| 637 | 637 | printf( |
| 638 | 638 | '<li class="getpaid-payment-method form-group mb-3"> |
@@ -641,11 +641,11 @@ discard block |
||
| 641 | 641 | <span>%3$s</span> |
| 642 | 642 | </label> |
| 643 | 643 | </li>', |
| 644 | - esc_attr( $this->id ), |
|
| 645 | - esc_attr( $token['id'] ), |
|
| 646 | - esc_html( $token['name'] ), |
|
| 647 | - checked( empty( $token['default'] ), false, false ), |
|
| 648 | - empty( $token['currency'] ) ? 'none' : esc_attr( $token['currency'] ) |
|
| 644 | + esc_attr($this->id), |
|
| 645 | + esc_attr($token['id']), |
|
| 646 | + esc_html($token['name']), |
|
| 647 | + checked(empty($token['default']), false, false), |
|
| 648 | + empty($token['currency']) ? 'none' : esc_attr($token['currency']) |
|
| 649 | 649 | ); |
| 650 | 650 | |
| 651 | 651 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | */ |
| 658 | 658 | public function get_new_payment_method_option_html() { |
| 659 | 659 | |
| 660 | - $label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this ); |
|
| 660 | + $label = apply_filters('getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __('Use a new payment method', 'invoicing'), $this); |
|
| 661 | 661 | |
| 662 | 662 | printf( |
| 663 | 663 | '<li class="getpaid-new-payment-method"> |
@@ -666,8 +666,8 @@ discard block |
||
| 666 | 666 | <span>%2$s</span> |
| 667 | 667 | </label> |
| 668 | 668 | </li>', |
| 669 | - esc_attr( $this->id ), |
|
| 670 | - esc_html( $label ) |
|
| 669 | + esc_attr($this->id), |
|
| 670 | + esc_html($label) |
|
| 671 | 671 | ); |
| 672 | 672 | |
| 673 | 673 | } |
@@ -682,10 +682,10 @@ discard block |
||
| 682 | 682 | aui()->input( |
| 683 | 683 | array( |
| 684 | 684 | 'type' => 'checkbox', |
| 685 | - 'name' => esc_attr( "getpaid-$this->id-new-payment-method" ), |
|
| 686 | - 'id' => esc_attr( uniqid( $this->id ) ), |
|
| 685 | + 'name' => esc_attr("getpaid-$this->id-new-payment-method"), |
|
| 686 | + 'id' => esc_attr(uniqid($this->id)), |
|
| 687 | 687 | 'required' => false, |
| 688 | - 'label' => esc_html__( 'Save payment method', 'invoicing' ), |
|
| 688 | + 'label' => esc_html__('Save payment method', 'invoicing'), |
|
| 689 | 689 | 'value' => 'true', |
| 690 | 690 | 'checked' => true, |
| 691 | 691 | 'wrap_class' => 'getpaid-save-payment-method pt-1 pb-1', |
@@ -700,9 +700,9 @@ discard block |
||
| 700 | 700 | * |
| 701 | 701 | * @return array |
| 702 | 702 | */ |
| 703 | - public function register_gateway( $gateways ) { |
|
| 703 | + public function register_gateway($gateways) { |
|
| 704 | 704 | |
| 705 | - $gateways[ $this->id ] = array( |
|
| 705 | + $gateways[$this->id] = array( |
|
| 706 | 706 | |
| 707 | 707 | 'admin_label' => $this->method_title, |
| 708 | 708 | 'checkout_label' => $this->title, |
@@ -720,13 +720,13 @@ discard block |
||
| 720 | 720 | * @param WPInv_Invoice|null $invoice Invoice object or null. |
| 721 | 721 | * @return bool |
| 722 | 722 | */ |
| 723 | - public function is_sandbox( $invoice = null ) { |
|
| 723 | + public function is_sandbox($invoice = null) { |
|
| 724 | 724 | |
| 725 | - if ( is_a( $invoice, 'WPInv_Invoice' ) && ! $invoice->needs_payment() ) { |
|
| 725 | + if (is_a($invoice, 'WPInv_Invoice') && !$invoice->needs_payment()) { |
|
| 726 | 726 | return $invoice->get_mode() === 'test'; |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | - return wpinv_is_test_mode( $this->id ); |
|
| 729 | + return wpinv_is_test_mode($this->id); |
|
| 730 | 730 | |
| 731 | 731 | } |
| 732 | 732 | |
@@ -744,15 +744,15 @@ discard block |
||
| 744 | 744 | * |
| 745 | 745 | * @return bool |
| 746 | 746 | */ |
| 747 | - public function validate_currency( $validation, $currency ) { |
|
| 747 | + public function validate_currency($validation, $currency) { |
|
| 748 | 748 | |
| 749 | 749 | // Required currencies. |
| 750 | - if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) { |
|
| 750 | + if (!empty($this->currencies) && !in_array($currency, $this->currencies)) { |
|
| 751 | 751 | return false; |
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | // Excluded currencies. |
| 755 | - if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) { |
|
| 755 | + if (!empty($this->exclude_currencies) && in_array($currency, $this->exclude_currencies)) { |
|
| 756 | 756 | return false; |
| 757 | 757 | } |
| 758 | 758 | |
@@ -763,13 +763,13 @@ discard block |
||
| 763 | 763 | * Displays an error |
| 764 | 764 | * |
| 765 | 765 | */ |
| 766 | - public function show_error( $code, $message, $type ) { |
|
| 766 | + public function show_error($code, $message, $type) { |
|
| 767 | 767 | |
| 768 | - if ( is_admin() ) { |
|
| 769 | - getpaid_admin()->{"show_$type"}( $message ); |
|
| 768 | + if (is_admin()) { |
|
| 769 | + getpaid_admin()->{"show_$type"}($message); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - wpinv_set_error( $code, $message, $type ); |
|
| 772 | + wpinv_set_error($code, $message, $type); |
|
| 773 | 773 | |
| 774 | 774 | } |
| 775 | 775 | |
@@ -8,40 +8,40 @@ discard block |
||
| 8 | 8 | * @version 1.0.19 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | +defined('ABSPATH') || exit; |
|
| 12 | 12 | |
| 13 | 13 | $getpaid_pages = GetPaid_Installer::get_pages(); |
| 14 | -$pages = wpinv_get_pages( true ); |
|
| 14 | +$pages = wpinv_get_pages(true); |
|
| 15 | 15 | |
| 16 | 16 | $currencies = wpinv_get_currencies(); |
| 17 | 17 | |
| 18 | 18 | $currency_code_options = array(); |
| 19 | -foreach ( $currencies as $code => $name ) { |
|
| 20 | - $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')'; |
|
| 19 | +foreach ($currencies as $code => $name) { |
|
| 20 | + $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')'; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $invoice_number_padd_options = array(); |
| 24 | -for ( $i = 0; $i <= 20; $i++ ) { |
|
| 25 | - $invoice_number_padd_options[ $i ] = $i; |
|
| 24 | +for ($i = 0; $i <= 20; $i++) { |
|
| 25 | + $invoice_number_padd_options[$i] = $i; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $currency_symbol = wpinv_currency_symbol(); |
| 29 | 29 | |
| 30 | 30 | $last_number = $reset_number = ''; |
| 31 | -if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) { |
|
| 32 | - $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number ); |
|
| 31 | +if ($last_invoice_number = get_option('wpinv_last_invoice_number')) { |
|
| 32 | + $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number); |
|
| 33 | 33 | |
| 34 | - if ( ! empty( $last_invoice_number ) ) { |
|
| 35 | - $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number ); |
|
| 34 | + if (!empty($last_invoice_number)) { |
|
| 35 | + $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $nonce = wp_create_nonce( 'reset_invoice_count' ); |
|
| 38 | + $nonce = wp_create_nonce('reset_invoice_count'); |
|
| 39 | 39 | $reset_number = '<a href="' . add_query_arg( |
| 40 | 40 | array( |
| 41 | 41 | 'reset_invoice_count' => 1, |
| 42 | 42 | '_nonce' => $nonce, |
| 43 | 43 | ) |
| 44 | - ) . '" class="btn button">' . __( 'Force Reset Sequence', 'invoicing' ) . '</a>'; |
|
| 44 | + ) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>'; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $alert_wrapper_start = '<p style="color: #F00">'; |
@@ -54,59 +54,59 @@ discard block |
||
| 54 | 54 | 'main' => array( |
| 55 | 55 | 'location_settings' => array( |
| 56 | 56 | 'id' => 'location_settings', |
| 57 | - 'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>', |
|
| 57 | + 'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>', |
|
| 58 | 58 | 'desc' => '', |
| 59 | 59 | 'type' => 'header', |
| 60 | 60 | ), |
| 61 | 61 | 'default_country' => array( |
| 62 | 62 | 'id' => 'default_country', |
| 63 | - 'name' => __( 'Default Country', 'invoicing' ), |
|
| 64 | - 'desc' => __( 'Where does your store operate from?', 'invoicing' ), |
|
| 63 | + 'name' => __('Default Country', 'invoicing'), |
|
| 64 | + 'desc' => __('Where does your store operate from?', 'invoicing'), |
|
| 65 | 65 | 'type' => 'select', |
| 66 | 66 | 'options' => wpinv_get_country_list(), |
| 67 | 67 | 'std' => 'GB', |
| 68 | 68 | 'class' => 'wpi_select2', |
| 69 | - 'placeholder' => __( 'Select a country', 'invoicing' ), |
|
| 69 | + 'placeholder' => __('Select a country', 'invoicing'), |
|
| 70 | 70 | ), |
| 71 | 71 | 'default_state' => array( |
| 72 | 72 | 'id' => 'default_state', |
| 73 | - 'name' => __( 'Default State / Province', 'invoicing' ), |
|
| 74 | - 'desc' => __( 'What state / province does your store operate from?', 'invoicing' ), |
|
| 73 | + 'name' => __('Default State / Province', 'invoicing'), |
|
| 74 | + 'desc' => __('What state / province does your store operate from?', 'invoicing'), |
|
| 75 | 75 | 'type' => 'country_states', |
| 76 | 76 | 'class' => 'wpi_select2', |
| 77 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
| 77 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
| 78 | 78 | ), |
| 79 | 79 | 'store_name' => array( |
| 80 | 80 | 'id' => 'store_name', |
| 81 | - 'name' => __( 'Store Name', 'invoicing' ), |
|
| 82 | - 'desc' => __( 'Store name to print on invoices.', 'invoicing' ), |
|
| 83 | - 'std' => get_option( 'blogname' ), |
|
| 81 | + 'name' => __('Store Name', 'invoicing'), |
|
| 82 | + 'desc' => __('Store name to print on invoices.', 'invoicing'), |
|
| 83 | + 'std' => get_option('blogname'), |
|
| 84 | 84 | 'type' => 'text', |
| 85 | 85 | ), |
| 86 | 86 | 'logo' => array( |
| 87 | 87 | 'id' => 'logo', |
| 88 | - 'name' => __( 'Logo URL', 'invoicing' ), |
|
| 89 | - 'desc' => __( 'Store logo to print on invoices.', 'invoicing' ), |
|
| 88 | + 'name' => __('Logo URL', 'invoicing'), |
|
| 89 | + 'desc' => __('Store logo to print on invoices.', 'invoicing'), |
|
| 90 | 90 | 'type' => 'text', |
| 91 | 91 | ), |
| 92 | 92 | 'logo_width' => array( |
| 93 | 93 | 'id' => 'logo_width', |
| 94 | - 'name' => __( 'Logo width', 'invoicing' ), |
|
| 95 | - 'desc' => __( 'Logo width to use in invoice image.', 'invoicing' ), |
|
| 94 | + 'name' => __('Logo width', 'invoicing'), |
|
| 95 | + 'desc' => __('Logo width to use in invoice image.', 'invoicing'), |
|
| 96 | 96 | 'type' => 'number', |
| 97 | - 'placeholder' => __( 'Auto', 'invoicing' ), |
|
| 97 | + 'placeholder' => __('Auto', 'invoicing'), |
|
| 98 | 98 | ), |
| 99 | 99 | 'logo_height' => array( |
| 100 | 100 | 'id' => 'logo_height', |
| 101 | - 'name' => __( 'Logo height', 'invoicing' ), |
|
| 102 | - 'desc' => __( 'Logo height to use in invoice image.', 'invoicing' ), |
|
| 101 | + 'name' => __('Logo height', 'invoicing'), |
|
| 102 | + 'desc' => __('Logo height to use in invoice image.', 'invoicing'), |
|
| 103 | 103 | 'type' => 'number', |
| 104 | - 'placeholder' => __( 'Auto', 'invoicing' ), |
|
| 104 | + 'placeholder' => __('Auto', 'invoicing'), |
|
| 105 | 105 | ), |
| 106 | 106 | 'store_address' => array( |
| 107 | 107 | 'id' => 'store_address', |
| 108 | - 'name' => __( 'Store Address', 'invoicing' ), |
|
| 109 | - 'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ), |
|
| 108 | + 'name' => __('Store Address', 'invoicing'), |
|
| 109 | + 'desc' => __('Enter the store address to display on invoice', 'invoicing'), |
|
| 110 | 110 | 'type' => 'textarea', |
| 111 | 111 | ), |
| 112 | 112 | |
@@ -114,114 +114,114 @@ discard block |
||
| 114 | 114 | 'page_section' => array( |
| 115 | 115 | 'page_settings' => array( |
| 116 | 116 | 'id' => 'page_settings', |
| 117 | - 'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>', |
|
| 117 | + 'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>', |
|
| 118 | 118 | 'desc' => '', |
| 119 | 119 | 'type' => 'header', |
| 120 | 120 | ), |
| 121 | 121 | 'checkout_page' => array( |
| 122 | 122 | 'id' => 'checkout_page', |
| 123 | - 'name' => __( 'Checkout Page', 'invoicing' ), |
|
| 124 | - 'desc' => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ), |
|
| 123 | + 'name' => __('Checkout Page', 'invoicing'), |
|
| 124 | + 'desc' => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'), |
|
| 125 | 125 | 'type' => 'select', |
| 126 | 126 | 'options' => $pages, |
| 127 | 127 | 'class' => 'wpi_select2', |
| 128 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 129 | - 'default_content' => empty( $getpaid_pages['checkout_page'] ) ? '' : $getpaid_pages['checkout_page']['content'], |
|
| 128 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 129 | + 'default_content' => empty($getpaid_pages['checkout_page']) ? '' : $getpaid_pages['checkout_page']['content'], |
|
| 130 | 130 | 'help-tip' => true, |
| 131 | 131 | ), |
| 132 | 132 | 'success_page' => array( |
| 133 | 133 | 'id' => 'success_page', |
| 134 | - 'name' => __( 'Success Page', 'invoicing' ), |
|
| 135 | - 'desc' => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ), |
|
| 134 | + 'name' => __('Success Page', 'invoicing'), |
|
| 135 | + 'desc' => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'), |
|
| 136 | 136 | 'type' => 'select', |
| 137 | 137 | 'options' => $pages, |
| 138 | 138 | 'class' => 'wpi_select2', |
| 139 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 140 | - 'default_content' => empty( $getpaid_pages['success_page'] ) ? '' : $getpaid_pages['success_page']['content'], |
|
| 139 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 140 | + 'default_content' => empty($getpaid_pages['success_page']) ? '' : $getpaid_pages['success_page']['content'], |
|
| 141 | 141 | 'help-tip' => true, |
| 142 | 142 | ), |
| 143 | 143 | 'failure_page' => array( |
| 144 | 144 | 'id' => 'failure_page', |
| 145 | - 'name' => __( 'Failed Transaction Page', 'invoicing' ), |
|
| 146 | - 'desc' => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ), |
|
| 145 | + 'name' => __('Failed Transaction Page', 'invoicing'), |
|
| 146 | + 'desc' => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'), |
|
| 147 | 147 | 'type' => 'select', |
| 148 | 148 | 'options' => $pages, |
| 149 | 149 | 'class' => 'wpi_select2', |
| 150 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 151 | - 'default_content' => empty( $getpaid_pages['failure_page'] ) ? '' : $getpaid_pages['failure_page']['content'], |
|
| 150 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 151 | + 'default_content' => empty($getpaid_pages['failure_page']) ? '' : $getpaid_pages['failure_page']['content'], |
|
| 152 | 152 | 'help-tip' => true, |
| 153 | 153 | ), |
| 154 | 154 | 'invoice_history_page' => array( |
| 155 | 155 | 'id' => 'invoice_history_page', |
| 156 | - 'name' => __( 'Invoice History Page', 'invoicing' ), |
|
| 157 | - 'desc' => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ), |
|
| 156 | + 'name' => __('Invoice History Page', 'invoicing'), |
|
| 157 | + 'desc' => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'), |
|
| 158 | 158 | 'type' => 'select', |
| 159 | 159 | 'options' => $pages, |
| 160 | 160 | 'class' => 'wpi_select2', |
| 161 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 162 | - 'default_content' => empty( $getpaid_pages['invoice_history_page'] ) ? '' : $getpaid_pages['invoice_history_page']['content'], |
|
| 161 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 162 | + 'default_content' => empty($getpaid_pages['invoice_history_page']) ? '' : $getpaid_pages['invoice_history_page']['content'], |
|
| 163 | 163 | 'help-tip' => true, |
| 164 | 164 | ), |
| 165 | 165 | 'invoice_subscription_page' => array( |
| 166 | 166 | 'id' => 'invoice_subscription_page', |
| 167 | - 'name' => __( 'Invoice Subscriptions Page', 'invoicing' ), |
|
| 168 | - 'desc' => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ), |
|
| 167 | + 'name' => __('Invoice Subscriptions Page', 'invoicing'), |
|
| 168 | + 'desc' => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'), |
|
| 169 | 169 | 'type' => 'select', |
| 170 | 170 | 'options' => $pages, |
| 171 | 171 | 'class' => 'wpi_select2', |
| 172 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 173 | - 'default_content' => empty( $getpaid_pages['invoice_subscription_page'] ) ? '' : $getpaid_pages['invoice_subscription_page']['content'], |
|
| 172 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 173 | + 'default_content' => empty($getpaid_pages['invoice_subscription_page']) ? '' : $getpaid_pages['invoice_subscription_page']['content'], |
|
| 174 | 174 | 'help-tip' => true, |
| 175 | 175 | ), |
| 176 | 176 | ), |
| 177 | 177 | 'currency_section' => array( |
| 178 | 178 | 'currency_settings' => array( |
| 179 | 179 | 'id' => 'currency_settings', |
| 180 | - 'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>', |
|
| 180 | + 'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>', |
|
| 181 | 181 | 'desc' => '', |
| 182 | 182 | 'type' => 'header', |
| 183 | 183 | ), |
| 184 | 184 | 'currency' => array( |
| 185 | 185 | 'id' => 'currency', |
| 186 | - 'name' => __( 'Currency', 'invoicing' ), |
|
| 187 | - 'desc' => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ), |
|
| 186 | + 'name' => __('Currency', 'invoicing'), |
|
| 187 | + 'desc' => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'), |
|
| 188 | 188 | 'type' => 'select', |
| 189 | 189 | 'class' => 'wpi_select2', |
| 190 | 190 | 'options' => $currency_code_options, |
| 191 | 191 | ), |
| 192 | 192 | 'currency_position' => array( |
| 193 | 193 | 'id' => 'currency_position', |
| 194 | - 'name' => __( 'Currency Position', 'invoicing' ), |
|
| 195 | - 'desc' => __( 'Choose the location of the currency sign.', 'invoicing' ), |
|
| 194 | + 'name' => __('Currency Position', 'invoicing'), |
|
| 195 | + 'desc' => __('Choose the location of the currency sign.', 'invoicing'), |
|
| 196 | 196 | 'type' => 'select', |
| 197 | 197 | 'class' => 'wpi_select2', |
| 198 | 198 | 'options' => array( |
| 199 | - 'left' => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')', |
|
| 200 | - 'right' => __( 'Right', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . $currency_symbol . ')', |
|
| 201 | - 'left_space' => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')', |
|
| 202 | - 'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')', |
|
| 199 | + 'left' => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')', |
|
| 200 | + 'right' => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')', |
|
| 201 | + 'left_space' => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')', |
|
| 202 | + 'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')', |
|
| 203 | 203 | ), |
| 204 | 204 | ), |
| 205 | 205 | 'thousands_separator' => array( |
| 206 | 206 | 'id' => 'thousands_separator', |
| 207 | - 'name' => __( 'Thousands Separator', 'invoicing' ), |
|
| 208 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ), |
|
| 207 | + 'name' => __('Thousands Separator', 'invoicing'), |
|
| 208 | + 'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'), |
|
| 209 | 209 | 'type' => 'text', |
| 210 | 210 | 'size' => 'small', |
| 211 | 211 | 'std' => ',', |
| 212 | 212 | ), |
| 213 | 213 | 'decimal_separator' => array( |
| 214 | 214 | 'id' => 'decimal_separator', |
| 215 | - 'name' => __( 'Decimal Separator', 'invoicing' ), |
|
| 216 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ), |
|
| 215 | + 'name' => __('Decimal Separator', 'invoicing'), |
|
| 216 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'), |
|
| 217 | 217 | 'type' => 'text', |
| 218 | 218 | 'size' => 'small', |
| 219 | 219 | 'std' => '.', |
| 220 | 220 | ), |
| 221 | 221 | 'decimals' => array( |
| 222 | 222 | 'id' => 'decimals', |
| 223 | - 'name' => __( 'Number of Decimals', 'invoicing' ), |
|
| 224 | - 'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ), |
|
| 223 | + 'name' => __('Number of Decimals', 'invoicing'), |
|
| 224 | + 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'), |
|
| 225 | 225 | 'type' => 'number', |
| 226 | 226 | 'size' => 'small', |
| 227 | 227 | 'std' => '2', |
@@ -233,21 +233,21 @@ discard block |
||
| 233 | 233 | 'labels' => array( |
| 234 | 234 | 'labels' => array( |
| 235 | 235 | 'id' => 'labels_settings', |
| 236 | - 'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>', |
|
| 236 | + 'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>', |
|
| 237 | 237 | 'desc' => '', |
| 238 | 238 | 'type' => 'header', |
| 239 | 239 | ), |
| 240 | 240 | 'vat_invoice_notice_label' => array( |
| 241 | 241 | 'id' => 'vat_invoice_notice_label', |
| 242 | - 'name' => __( 'Invoice Notice Label', 'invoicing' ), |
|
| 243 | - 'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ), |
|
| 242 | + 'name' => __('Invoice Notice Label', 'invoicing'), |
|
| 243 | + 'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'), |
|
| 244 | 244 | 'type' => 'text', |
| 245 | 245 | 'size' => 'regular', |
| 246 | 246 | ), |
| 247 | 247 | 'vat_invoice_notice' => array( |
| 248 | 248 | 'id' => 'vat_invoice_notice', |
| 249 | - 'name' => __( 'Invoice notice', 'invoicing' ), |
|
| 250 | - 'desc' => __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ), |
|
| 249 | + 'name' => __('Invoice notice', 'invoicing'), |
|
| 250 | + 'desc' => __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'), |
|
| 251 | 251 | 'type' => 'text', |
| 252 | 252 | 'size' => 'regular', |
| 253 | 253 | ), |
@@ -260,22 +260,22 @@ discard block |
||
| 260 | 260 | 'main' => array( |
| 261 | 261 | 'gateway_settings' => array( |
| 262 | 262 | 'id' => 'api_header', |
| 263 | - 'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>', |
|
| 263 | + 'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>', |
|
| 264 | 264 | 'desc' => '', |
| 265 | 265 | 'type' => 'header', |
| 266 | 266 | ), |
| 267 | 267 | 'gateways' => array( |
| 268 | 268 | 'id' => 'gateways', |
| 269 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
| 270 | - 'desc' => __( 'Choose the payment gateways you want to enable.', 'invoicing' ), |
|
| 269 | + 'name' => __('Payment Gateways', 'invoicing'), |
|
| 270 | + 'desc' => __('Choose the payment gateways you want to enable.', 'invoicing'), |
|
| 271 | 271 | 'type' => 'gateways', |
| 272 | - 'std' => array( 'manual' => 1 ), |
|
| 272 | + 'std' => array('manual' => 1), |
|
| 273 | 273 | 'options' => wpinv_get_payment_gateways(), |
| 274 | 274 | ), |
| 275 | 275 | 'default_gateway' => array( |
| 276 | 276 | 'id' => 'default_gateway', |
| 277 | - 'name' => __( 'Default Gateway', 'invoicing' ), |
|
| 278 | - 'desc' => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ), |
|
| 277 | + 'name' => __('Default Gateway', 'invoicing'), |
|
| 278 | + 'desc' => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'), |
|
| 279 | 279 | 'type' => 'gateway_select', |
| 280 | 280 | 'std' => 'manual', |
| 281 | 281 | 'class' => 'wpi_select2', |
@@ -291,32 +291,32 @@ discard block |
||
| 291 | 291 | 'main' => array( |
| 292 | 292 | 'tax_settings' => array( |
| 293 | 293 | 'id' => 'tax_settings', |
| 294 | - 'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>', |
|
| 294 | + 'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>', |
|
| 295 | 295 | 'type' => 'header', |
| 296 | 296 | ), |
| 297 | 297 | |
| 298 | 298 | 'enable_taxes' => array( |
| 299 | 299 | 'id' => 'enable_taxes', |
| 300 | - 'name' => __( 'Enable Taxes', 'invoicing' ), |
|
| 301 | - 'desc' => __( 'Enable tax rates and calculations.', 'invoicing' ), |
|
| 300 | + 'name' => __('Enable Taxes', 'invoicing'), |
|
| 301 | + 'desc' => __('Enable tax rates and calculations.', 'invoicing'), |
|
| 302 | 302 | 'type' => 'checkbox', |
| 303 | 303 | 'std' => 0, |
| 304 | 304 | ), |
| 305 | 305 | |
| 306 | 306 | 'tax_subtotal_rounding' => array( |
| 307 | 307 | 'id' => 'tax_subtotal_rounding', |
| 308 | - 'name' => __( 'Rounding', 'invoicing' ), |
|
| 309 | - 'desc' => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ), |
|
| 308 | + 'name' => __('Rounding', 'invoicing'), |
|
| 309 | + 'desc' => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'), |
|
| 310 | 310 | 'type' => 'checkbox', |
| 311 | 311 | 'std' => 1, |
| 312 | 312 | ), |
| 313 | 313 | |
| 314 | 314 | 'prices_include_tax' => array( |
| 315 | 315 | 'id' => 'prices_include_tax', |
| 316 | - 'name' => __( 'Prices entered with tax', 'invoicing' ), |
|
| 316 | + 'name' => __('Prices entered with tax', 'invoicing'), |
|
| 317 | 317 | 'options' => array( |
| 318 | - 'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ), |
|
| 319 | - 'no' => __( 'No, I will enter prices exclusive of tax', 'invoicing' ), |
|
| 318 | + 'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'), |
|
| 319 | + 'no' => __('No, I will enter prices exclusive of tax', 'invoicing'), |
|
| 320 | 320 | ), |
| 321 | 321 | 'type' => 'select', |
| 322 | 322 | 'std' => 'no', |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | 'tax_base' => array( |
| 326 | 326 | 'id' => 'tax_base', |
| 327 | - 'name' => __( 'Calculate tax based on', 'invoicing' ), |
|
| 327 | + 'name' => __('Calculate tax based on', 'invoicing'), |
|
| 328 | 328 | 'options' => array( |
| 329 | - 'billing' => __( 'Customer billing address', 'invoicing' ), |
|
| 330 | - 'base' => __( 'Shop base address', 'invoicing' ), |
|
| 329 | + 'billing' => __('Customer billing address', 'invoicing'), |
|
| 330 | + 'base' => __('Shop base address', 'invoicing'), |
|
| 331 | 331 | ), |
| 332 | 332 | 'type' => 'select', |
| 333 | 333 | 'std' => 'billing', |
@@ -335,24 +335,24 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | 'vat_same_country_rule' => array( |
| 337 | 337 | 'id' => 'vat_same_country_rule', |
| 338 | - 'name' => __( 'Same country rule', 'invoicing' ), |
|
| 339 | - 'desc' => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ), |
|
| 338 | + 'name' => __('Same country rule', 'invoicing'), |
|
| 339 | + 'desc' => __('What should happen if a customer is from the same country as your business?', 'invoicing'), |
|
| 340 | 340 | 'type' => 'select', |
| 341 | 341 | 'options' => array( |
| 342 | - 'no' => __( 'Do not charge tax', 'invoicing' ), |
|
| 343 | - 'always' => __( 'Charge tax unless vat number is validated', 'invoicing' ), |
|
| 344 | - 'vat_too' => __( 'Charge tax even if vat number is validated', 'invoicing' ), |
|
| 342 | + 'no' => __('Do not charge tax', 'invoicing'), |
|
| 343 | + 'always' => __('Charge tax unless vat number is validated', 'invoicing'), |
|
| 344 | + 'vat_too' => __('Charge tax even if vat number is validated', 'invoicing'), |
|
| 345 | 345 | ), |
| 346 | - 'placeholder' => __( 'Select an option', 'invoicing' ), |
|
| 346 | + 'placeholder' => __('Select an option', 'invoicing'), |
|
| 347 | 347 | 'std' => 'vat_too', |
| 348 | 348 | ), |
| 349 | 349 | |
| 350 | 350 | 'tax_display_totals' => array( |
| 351 | 351 | 'id' => 'tax_display_totals', |
| 352 | - 'name' => __( 'Display tax totals', 'invoicing' ), |
|
| 352 | + 'name' => __('Display tax totals', 'invoicing'), |
|
| 353 | 353 | 'options' => array( |
| 354 | - 'single' => __( 'As a single total', 'invoicing' ), |
|
| 355 | - 'individual' => __( 'As individual tax rates', 'invoicing' ), |
|
| 354 | + 'single' => __('As a single total', 'invoicing'), |
|
| 355 | + 'individual' => __('As individual tax rates', 'invoicing'), |
|
| 356 | 356 | ), |
| 357 | 357 | 'type' => 'select', |
| 358 | 358 | 'std' => 'individual', |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | 'tax_rate' => array( |
| 362 | 362 | 'id' => 'tax_rate', |
| 363 | - 'name' => __( 'Fallback Tax Rate', 'invoicing' ), |
|
| 364 | - 'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ), |
|
| 363 | + 'name' => __('Fallback Tax Rate', 'invoicing'), |
|
| 364 | + 'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'), |
|
| 365 | 365 | 'type' => 'number', |
| 366 | 366 | 'size' => 'small', |
| 367 | 367 | 'min' => '0', |
@@ -373,8 +373,8 @@ discard block |
||
| 373 | 373 | 'rules' => array( |
| 374 | 374 | 'tax_rules' => array( |
| 375 | 375 | 'id' => 'tax_rules', |
| 376 | - 'name' => '<h3>' . __( 'Tax Rules', 'invoicing' ) . '</h3>', |
|
| 377 | - 'desc' => __( 'Create/Update tax rules', 'invoicing' ), |
|
| 376 | + 'name' => '<h3>' . __('Tax Rules', 'invoicing') . '</h3>', |
|
| 377 | + 'desc' => __('Create/Update tax rules', 'invoicing'), |
|
| 378 | 378 | 'type' => 'tax_rules', |
| 379 | 379 | ), |
| 380 | 380 | ), |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | 'rates' => array( |
| 383 | 383 | 'tax_rates' => array( |
| 384 | 384 | 'id' => 'tax_rates', |
| 385 | - 'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>', |
|
| 386 | - 'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ), |
|
| 385 | + 'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>', |
|
| 386 | + 'desc' => __('Enter tax rates for specific regions.', 'invoicing'), |
|
| 387 | 387 | 'type' => 'tax_rates', |
| 388 | 388 | ), |
| 389 | 389 | ), |
@@ -392,31 +392,31 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | 'vat_company_name' => array( |
| 394 | 394 | 'id' => 'vat_company_name', |
| 395 | - 'name' => __( 'Company Name', 'invoicing' ), |
|
| 396 | - 'desc' => wp_sprintf( __( 'Verify your company name and VAT number on the %1$sEU VIES System.%2$s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ), |
|
| 395 | + 'name' => __('Company Name', 'invoicing'), |
|
| 396 | + 'desc' => wp_sprintf(__('Verify your company name and VAT number on the %1$sEU VIES System.%2$s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'), |
|
| 397 | 397 | 'type' => 'text', |
| 398 | 398 | 'size' => 'regular', |
| 399 | 399 | ), |
| 400 | 400 | |
| 401 | 401 | 'vat_number' => array( |
| 402 | 402 | 'id' => 'vat_number', |
| 403 | - 'name' => __( 'VAT Number', 'invoicing' ), |
|
| 404 | - 'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ), |
|
| 403 | + 'name' => __('VAT Number', 'invoicing'), |
|
| 404 | + 'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'), |
|
| 405 | 405 | 'type' => 'text', |
| 406 | 406 | 'size' => 'regular', |
| 407 | 407 | ), |
| 408 | 408 | |
| 409 | 409 | 'vat_prevent_b2c_purchase' => array( |
| 410 | 410 | 'id' => 'vat_prevent_b2c_purchase', |
| 411 | - 'name' => __( 'Prevent B2C Sales', 'invoicing' ), |
|
| 412 | - 'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ), |
|
| 411 | + 'name' => __('Prevent B2C Sales', 'invoicing'), |
|
| 412 | + 'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'), |
|
| 413 | 413 | 'type' => 'checkbox', |
| 414 | 414 | ), |
| 415 | 415 | |
| 416 | 416 | 'validate_vat_number' => array( |
| 417 | 417 | 'id' => 'validate_vat_number', |
| 418 | - 'name' => __( 'Validate VAT Number', 'invoicing' ), |
|
| 419 | - 'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ), |
|
| 418 | + 'name' => __('Validate VAT Number', 'invoicing'), |
|
| 419 | + 'desc' => __('Validate VAT numbers with VIES.', 'invoicing'), |
|
| 420 | 420 | 'type' => 'checkbox', |
| 421 | 421 | ), |
| 422 | 422 | |
@@ -431,66 +431,66 @@ discard block |
||
| 431 | 431 | 'main' => array( |
| 432 | 432 | 'email_settings_header' => array( |
| 433 | 433 | 'id' => 'email_settings_header', |
| 434 | - 'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>', |
|
| 434 | + 'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>', |
|
| 435 | 435 | 'type' => 'header', |
| 436 | 436 | ), |
| 437 | 437 | 'email_from_name' => array( |
| 438 | 438 | 'id' => 'email_from_name', |
| 439 | - 'name' => __( 'From Name', 'invoicing' ), |
|
| 440 | - 'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ), |
|
| 441 | - 'std' => esc_attr( get_bloginfo( 'name', 'display' ) ), |
|
| 439 | + 'name' => __('From Name', 'invoicing'), |
|
| 440 | + 'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'), |
|
| 441 | + 'std' => esc_attr(get_bloginfo('name', 'display')), |
|
| 442 | 442 | 'type' => 'text', |
| 443 | 443 | ), |
| 444 | 444 | 'email_from' => array( |
| 445 | 445 | 'id' => 'email_from', |
| 446 | - 'name' => __( 'From Email', 'invoicing' ), |
|
| 447 | - 'desc' => sprintf( __( 'Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close ), |
|
| 448 | - 'std' => get_option( 'admin_email' ), |
|
| 446 | + 'name' => __('From Email', 'invoicing'), |
|
| 447 | + 'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close), |
|
| 448 | + 'std' => get_option('admin_email'), |
|
| 449 | 449 | 'type' => 'text', |
| 450 | 450 | ), |
| 451 | 451 | 'admin_email' => array( |
| 452 | 452 | 'id' => 'admin_email', |
| 453 | - 'name' => __( 'Admin Email', 'invoicing' ), |
|
| 454 | - 'desc' => __( 'Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing' ), |
|
| 455 | - 'std' => get_option( 'admin_email' ), |
|
| 453 | + 'name' => __('Admin Email', 'invoicing'), |
|
| 454 | + 'desc' => __('Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing'), |
|
| 455 | + 'std' => get_option('admin_email'), |
|
| 456 | 456 | 'type' => 'text', |
| 457 | 457 | ), |
| 458 | 458 | 'skip_email_free_invoice' => array( |
| 459 | 459 | 'id' => 'skip_email_free_invoice', |
| 460 | - 'name' => __( 'Skip Free Invoices', 'invoicing' ), |
|
| 461 | - 'desc' => __( 'Check this to disable sending emails for free invoices.', 'invoicing' ), |
|
| 460 | + 'name' => __('Skip Free Invoices', 'invoicing'), |
|
| 461 | + 'desc' => __('Check this to disable sending emails for free invoices.', 'invoicing'), |
|
| 462 | 462 | 'type' => 'checkbox', |
| 463 | 463 | 'std' => false, |
| 464 | 464 | ), |
| 465 | 465 | 'overdue_settings_header' => array( |
| 466 | 466 | 'id' => 'overdue_settings_header', |
| 467 | - 'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>', |
|
| 467 | + 'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>', |
|
| 468 | 468 | 'type' => 'header', |
| 469 | 469 | ), |
| 470 | 470 | 'overdue_active' => array( |
| 471 | 471 | 'id' => 'overdue_active', |
| 472 | - 'name' => __( 'Enable Due Date', 'invoicing' ), |
|
| 473 | - 'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ), |
|
| 472 | + 'name' => __('Enable Due Date', 'invoicing'), |
|
| 473 | + 'desc' => __('Check this to enable due date option for invoices.', 'invoicing'), |
|
| 474 | 474 | 'type' => 'checkbox', |
| 475 | 475 | 'std' => false, |
| 476 | 476 | ), |
| 477 | 477 | 'email_template_header' => array( |
| 478 | 478 | 'id' => 'email_template_header', |
| 479 | - 'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>', |
|
| 479 | + 'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>', |
|
| 480 | 480 | 'type' => 'header', |
| 481 | 481 | ), |
| 482 | 482 | 'email_header_image' => array( |
| 483 | 483 | 'id' => 'email_header_image', |
| 484 | - 'name' => __( 'Header Image', 'invoicing' ), |
|
| 485 | - 'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ), |
|
| 484 | + 'name' => __('Header Image', 'invoicing'), |
|
| 485 | + 'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'), |
|
| 486 | 486 | 'std' => '', |
| 487 | 487 | 'type' => 'text', |
| 488 | 488 | ), |
| 489 | 489 | 'email_footer_text' => array( |
| 490 | 490 | 'id' => 'email_footer_text', |
| 491 | - 'name' => __( 'Footer Text', 'invoicing' ), |
|
| 492 | - 'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ), |
|
| 493 | - 'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ), |
|
| 491 | + 'name' => __('Footer Text', 'invoicing'), |
|
| 492 | + 'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'), |
|
| 493 | + 'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'), |
|
| 494 | 494 | 'type' => 'textarea', |
| 495 | 495 | 'class' => 'regular-text', |
| 496 | 496 | 'rows' => 2, |
@@ -498,29 +498,29 @@ discard block |
||
| 498 | 498 | ), |
| 499 | 499 | 'email_base_color' => array( |
| 500 | 500 | 'id' => 'email_base_color', |
| 501 | - 'name' => __( 'Base Color', 'invoicing' ), |
|
| 502 | - 'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ), |
|
| 501 | + 'name' => __('Base Color', 'invoicing'), |
|
| 502 | + 'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'), |
|
| 503 | 503 | 'std' => '#557da2', |
| 504 | 504 | 'type' => 'color', |
| 505 | 505 | ), |
| 506 | 506 | 'email_background_color' => array( |
| 507 | 507 | 'id' => 'email_background_color', |
| 508 | - 'name' => __( 'Background Color', 'invoicing' ), |
|
| 509 | - 'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ), |
|
| 508 | + 'name' => __('Background Color', 'invoicing'), |
|
| 509 | + 'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'), |
|
| 510 | 510 | 'std' => '#f5f5f5', |
| 511 | 511 | 'type' => 'color', |
| 512 | 512 | ), |
| 513 | 513 | 'email_body_background_color' => array( |
| 514 | 514 | 'id' => 'email_body_background_color', |
| 515 | - 'name' => __( 'Body Background Color', 'invoicing' ), |
|
| 516 | - 'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ), |
|
| 515 | + 'name' => __('Body Background Color', 'invoicing'), |
|
| 516 | + 'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'), |
|
| 517 | 517 | 'std' => '#fdfdfd', |
| 518 | 518 | 'type' => 'color', |
| 519 | 519 | ), |
| 520 | 520 | 'email_text_color' => array( |
| 521 | 521 | 'id' => 'email_text_color', |
| 522 | - 'name' => __( 'Body Text Color', 'invoicing' ), |
|
| 523 | - 'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ), |
|
| 522 | + 'name' => __('Body Text Color', 'invoicing'), |
|
| 523 | + 'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'), |
|
| 524 | 524 | 'std' => '#505050', |
| 525 | 525 | 'type' => 'color', |
| 526 | 526 | ), |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | ), |
| 536 | 536 | |
| 537 | 537 | // Integrations. |
| 538 | - 'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ), |
|
| 538 | + 'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'), |
|
| 539 | 539 | |
| 540 | 540 | /** Privacy Settings */ |
| 541 | 541 | 'privacy' => apply_filters( |
@@ -544,17 +544,17 @@ discard block |
||
| 544 | 544 | 'main' => array( |
| 545 | 545 | 'invoicing_privacy_policy_settings' => array( |
| 546 | 546 | 'id' => 'invoicing_privacy_policy_settings', |
| 547 | - 'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>', |
|
| 547 | + 'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>', |
|
| 548 | 548 | 'type' => 'header', |
| 549 | 549 | ), |
| 550 | 550 | 'privacy_page' => array( |
| 551 | 551 | 'id' => 'privacy_page', |
| 552 | - 'name' => __( 'Privacy Page', 'invoicing' ), |
|
| 553 | - 'desc' => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ), |
|
| 552 | + 'name' => __('Privacy Page', 'invoicing'), |
|
| 553 | + 'desc' => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'), |
|
| 554 | 554 | 'type' => 'select', |
| 555 | - 'options' => wpinv_get_pages( true, __( 'Select a page', 'invoicing' ) ), |
|
| 555 | + 'options' => wpinv_get_pages(true, __('Select a page', 'invoicing')), |
|
| 556 | 556 | 'class' => 'wpi_select2', |
| 557 | - 'placeholder' => __( 'Select a page', 'invoicing' ), |
|
| 557 | + 'placeholder' => __('Select a page', 'invoicing'), |
|
| 558 | 558 | ), |
| 559 | 559 | ), |
| 560 | 560 | ) |
@@ -566,19 +566,19 @@ discard block |
||
| 566 | 566 | 'main' => array( |
| 567 | 567 | 'invoice_number_format_settings' => array( |
| 568 | 568 | 'id' => 'invoice_number_format_settings', |
| 569 | - 'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>', |
|
| 569 | + 'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>', |
|
| 570 | 570 | 'type' => 'header', |
| 571 | 571 | ), |
| 572 | 572 | 'sequential_invoice_number' => array( |
| 573 | 573 | 'id' => 'sequential_invoice_number', |
| 574 | - 'name' => __( 'Sequential Invoice Numbers', 'invoicing' ), |
|
| 575 | - 'desc' => __( 'Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number, |
|
| 574 | + 'name' => __('Sequential Invoice Numbers', 'invoicing'), |
|
| 575 | + 'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number, |
|
| 576 | 576 | 'type' => 'checkbox', |
| 577 | 577 | ), |
| 578 | 578 | 'invoice_sequence_start' => array( |
| 579 | 579 | 'id' => 'invoice_sequence_start', |
| 580 | - 'name' => __( 'Sequential Starting Number', 'invoicing' ), |
|
| 581 | - 'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number, |
|
| 580 | + 'name' => __('Sequential Starting Number', 'invoicing'), |
|
| 581 | + 'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number, |
|
| 582 | 582 | 'type' => 'number', |
| 583 | 583 | 'size' => 'small', |
| 584 | 584 | 'std' => '1', |
@@ -586,8 +586,8 @@ discard block |
||
| 586 | 586 | ), |
| 587 | 587 | 'invoice_number_padd' => array( |
| 588 | 588 | 'id' => 'invoice_number_padd', |
| 589 | - 'name' => __( 'Minimum Digits', 'invoicing' ), |
|
| 590 | - 'desc' => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ), |
|
| 589 | + 'name' => __('Minimum Digits', 'invoicing'), |
|
| 590 | + 'desc' => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'), |
|
| 591 | 591 | 'type' => 'select', |
| 592 | 592 | 'options' => $invoice_number_padd_options, |
| 593 | 593 | 'std' => 5, |
@@ -595,8 +595,8 @@ discard block |
||
| 595 | 595 | ), |
| 596 | 596 | 'invoice_number_prefix' => array( |
| 597 | 597 | 'id' => 'invoice_number_prefix', |
| 598 | - 'name' => __( 'Invoice Number Prefix', 'invoicing' ), |
|
| 599 | - 'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ), |
|
| 598 | + 'name' => __('Invoice Number Prefix', 'invoicing'), |
|
| 599 | + 'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'), |
|
| 600 | 600 | 'type' => 'text', |
| 601 | 601 | 'size' => 'regular', |
| 602 | 602 | 'std' => 'INV-', |
@@ -604,77 +604,77 @@ discard block |
||
| 604 | 604 | ), |
| 605 | 605 | 'invoice_number_postfix' => array( |
| 606 | 606 | 'id' => 'invoice_number_postfix', |
| 607 | - 'name' => __( 'Invoice Number Postfix', 'invoicing' ), |
|
| 608 | - 'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ), |
|
| 607 | + 'name' => __('Invoice Number Postfix', 'invoicing'), |
|
| 608 | + 'desc' => __('Postfix for all invoice numbers.', 'invoicing'), |
|
| 609 | 609 | 'type' => 'text', |
| 610 | 610 | 'size' => 'regular', |
| 611 | 611 | 'std' => '', |
| 612 | 612 | ), |
| 613 | 613 | 'checkout_settings' => array( |
| 614 | 614 | 'id' => 'checkout_settings', |
| 615 | - 'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>', |
|
| 615 | + 'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>', |
|
| 616 | 616 | 'type' => 'header', |
| 617 | 617 | ), |
| 618 | 618 | 'disable_new_user_emails' => array( |
| 619 | 619 | 'id' => 'disable_new_user_emails', |
| 620 | - 'name' => __( 'Disable new user emails', 'invoicing' ), |
|
| 621 | - 'desc' => __( 'Do not send an email to customers when a new user account is created for them.', 'invoicing' ), |
|
| 620 | + 'name' => __('Disable new user emails', 'invoicing'), |
|
| 621 | + 'desc' => __('Do not send an email to customers when a new user account is created for them.', 'invoicing'), |
|
| 622 | 622 | 'type' => 'checkbox', |
| 623 | 623 | ), |
| 624 | 624 | 'login_to_checkout' => array( |
| 625 | 625 | 'id' => 'login_to_checkout', |
| 626 | - 'name' => __( 'Require Login To Checkout', 'invoicing' ), |
|
| 627 | - 'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ), |
|
| 626 | + 'name' => __('Require Login To Checkout', 'invoicing'), |
|
| 627 | + 'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'), |
|
| 628 | 628 | 'type' => 'checkbox', |
| 629 | 629 | ), |
| 630 | 630 | 'enable_recaptcha' => array( |
| 631 | 631 | 'id' => 'enable_recaptcha', |
| 632 | - 'name' => __( 'Enable reCAPTCHA', 'invoicing' ), |
|
| 633 | - 'desc' => __( 'If ticked then reCAPTCHA will be enabled on the checkout page.', 'invoicing' ), |
|
| 632 | + 'name' => __('Enable reCAPTCHA', 'invoicing'), |
|
| 633 | + 'desc' => __('If ticked then reCAPTCHA will be enabled on the checkout page.', 'invoicing'), |
|
| 634 | 634 | 'type' => 'checkbox', |
| 635 | 635 | ), |
| 636 | 636 | 'recaptcha_version' => array( |
| 637 | 637 | 'id' => 'recaptcha_version', |
| 638 | - 'name' => __( 'reCAPTCHA Version', 'invoicing' ), |
|
| 639 | - 'desc' => __( 'Select the version of reCAPTCHA you would like to use.', 'invoicing' ), |
|
| 638 | + 'name' => __('reCAPTCHA Version', 'invoicing'), |
|
| 639 | + 'desc' => __('Select the version of reCAPTCHA you would like to use.', 'invoicing'), |
|
| 640 | 640 | 'type' => 'select', |
| 641 | 641 | 'options' => array( |
| 642 | - 'v2' => __( 'reCAPTCHA v2', 'invoicing' ), |
|
| 643 | - 'v3' => __( 'reCAPTCHA v3', 'invoicing' ), |
|
| 642 | + 'v2' => __('reCAPTCHA v2', 'invoicing'), |
|
| 643 | + 'v3' => __('reCAPTCHA v3', 'invoicing'), |
|
| 644 | 644 | ), |
| 645 | 645 | 'std' => 'v2', |
| 646 | 646 | ), |
| 647 | 647 | 'recaptcha_site_key' => array( |
| 648 | 648 | 'id' => 'recaptcha_site_key', |
| 649 | - 'name' => __( 'reCAPTCHA Site Key', 'invoicing' ), |
|
| 650 | - 'desc' => __( 'Enter your reCAPTCHA site key.', 'invoicing' ) . ' <a href="https://www.google.com/recaptcha/admin/create" target="_blank">' . __( 'Generate a site key.', 'invoicing' ) . '</a>', |
|
| 649 | + 'name' => __('reCAPTCHA Site Key', 'invoicing'), |
|
| 650 | + 'desc' => __('Enter your reCAPTCHA site key.', 'invoicing') . ' <a href="https://www.google.com/recaptcha/admin/create" target="_blank">' . __('Generate a site key.', 'invoicing') . '</a>', |
|
| 651 | 651 | 'type' => 'text', |
| 652 | 652 | 'size' => 'regular', |
| 653 | 653 | ), |
| 654 | 654 | 'recaptcha_secret_key' => array( |
| 655 | 655 | 'id' => 'recaptcha_secret_key', |
| 656 | - 'name' => __( 'reCAPTCHA Secret Key', 'invoicing' ), |
|
| 657 | - 'desc' => __( 'Enter your reCAPTCHA secret key.', 'invoicing' ), |
|
| 656 | + 'name' => __('reCAPTCHA Secret Key', 'invoicing'), |
|
| 657 | + 'desc' => __('Enter your reCAPTCHA secret key.', 'invoicing'), |
|
| 658 | 658 | 'type' => 'text', |
| 659 | 659 | 'size' => 'regular', |
| 660 | 660 | ), |
| 661 | 661 | 'maxmind_license_key' => array( |
| 662 | 662 | 'id' => 'maxmind_license_key', |
| 663 | - 'name' => __( 'MaxMind License Key', 'invoicing' ), |
|
| 663 | + 'name' => __('MaxMind License Key', 'invoicing'), |
|
| 664 | 664 | 'type' => 'text', |
| 665 | 665 | 'size' => 'regular', |
| 666 | - 'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>', |
|
| 666 | + 'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __('How to generate a free license key.', 'invoicing') . '</a>', |
|
| 667 | 667 | ), |
| 668 | 668 | |
| 669 | 669 | 'uninstall_settings' => array( |
| 670 | 670 | 'id' => 'uninstall_settings', |
| 671 | - 'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>', |
|
| 671 | + 'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>', |
|
| 672 | 672 | 'type' => 'header', |
| 673 | 673 | ), |
| 674 | 674 | 'remove_data_on_unistall' => array( |
| 675 | 675 | 'id' => 'remove_data_on_unistall', |
| 676 | - 'name' => __( 'Remove Data on Uninstall?', 'invoicing' ), |
|
| 677 | - 'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ), |
|
| 676 | + 'name' => __('Remove Data on Uninstall?', 'invoicing'), |
|
| 677 | + 'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'), |
|
| 678 | 678 | 'type' => 'checkbox', |
| 679 | 679 | 'std' => '', |
| 680 | 680 | ), |
@@ -683,13 +683,13 @@ discard block |
||
| 683 | 683 | 'custom-css' => array( |
| 684 | 684 | 'css_settings' => array( |
| 685 | 685 | 'id' => 'css_settings', |
| 686 | - 'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>', |
|
| 686 | + 'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>', |
|
| 687 | 687 | 'type' => 'header', |
| 688 | 688 | ), |
| 689 | 689 | 'template_custom_css' => array( |
| 690 | 690 | 'id' => 'template_custom_css', |
| 691 | - 'name' => __( 'Invoice Template CSS', 'invoicing' ), |
|
| 692 | - 'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ), |
|
| 691 | + 'name' => __('Invoice Template CSS', 'invoicing'), |
|
| 692 | + 'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'), |
|
| 693 | 693 | 'type' => 'textarea', |
| 694 | 694 | 'class' => 'regular-text', |
| 695 | 695 | 'rows' => 10, |
@@ -704,8 +704,8 @@ discard block |
||
| 704 | 704 | 'main' => array( |
| 705 | 705 | 'tool_settings' => array( |
| 706 | 706 | 'id' => 'tool_settings', |
| 707 | - 'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>', |
|
| 708 | - 'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ), |
|
| 707 | + 'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>', |
|
| 708 | + 'desc' => __('Invoicing diagnostic tools', 'invoicing'), |
|
| 709 | 709 | 'type' => 'tools', |
| 710 | 710 | ), |
| 711 | 711 | ), |
@@ -1,155 +1,155 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -function wpinv_is_subscription_payment( $invoice = '' ) { |
|
| 3 | - if ( empty( $invoice ) ) { |
|
| 2 | +function wpinv_is_subscription_payment($invoice = '') { |
|
| 3 | + if (empty($invoice)) { |
|
| 4 | 4 | return false; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | - if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
| 8 | - $invoice = wpinv_get_invoice( $invoice ); |
|
| 7 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
| 8 | + $invoice = wpinv_get_invoice($invoice); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | - if ( empty( $invoice ) ) { |
|
| 11 | + if (empty($invoice)) { |
|
| 12 | 12 | return false; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - if ( $invoice->is_renewal() ) { |
|
| 15 | + if ($invoice->is_renewal()) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | return false; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function wpinv_payment_link_transaction_id( $invoice = '' ) { |
|
| 23 | - if ( empty( $invoice ) ) { |
|
| 22 | +function wpinv_payment_link_transaction_id($invoice = '') { |
|
| 23 | + if (empty($invoice)) { |
|
| 24 | 24 | return false; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) { |
|
| 28 | - $invoice = wpinv_get_invoice( $invoice ); |
|
| 27 | + if (!is_object($invoice) && is_scalar($invoice)) { |
|
| 28 | + $invoice = wpinv_get_invoice($invoice); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if ( empty( $invoice ) ) { |
|
| 31 | + if (empty($invoice)) { |
|
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice ); |
|
| 35 | + return apply_filters('wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -function wpinv_subscription_initial_payment_desc( $amount, $period, $interval, $trial_period = '', $trial_interval = 0 ) { |
|
| 39 | - $interval = (int)$interval > 0 ? (int)$interval : 1; |
|
| 38 | +function wpinv_subscription_initial_payment_desc($amount, $period, $interval, $trial_period = '', $trial_interval = 0) { |
|
| 39 | + $interval = (int) $interval > 0 ? (int) $interval : 1; |
|
| 40 | 40 | |
| 41 | - if ( $trial_interval > 0 && ! empty( $trial_period ) ) { |
|
| 42 | - $amount = __( 'Free', 'invoicing' ); |
|
| 41 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
| 42 | + $amount = __('Free', 'invoicing'); |
|
| 43 | 43 | $interval = $trial_interval; |
| 44 | 44 | $period = $trial_period; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $description = ''; |
| 48 | - switch ( $period ) { |
|
| 48 | + switch ($period) { |
|
| 49 | 49 | case 'D': |
| 50 | 50 | case 'day': |
| 51 | - $description = wp_sprintf( _n( '%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 51 | + $description = wp_sprintf(_n('%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing'), $amount, $interval); |
|
| 52 | 52 | break; |
| 53 | 53 | case 'W': |
| 54 | 54 | case 'week': |
| 55 | - $description = wp_sprintf( _n( '%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 55 | + $description = wp_sprintf(_n('%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
| 56 | 56 | break; |
| 57 | 57 | case 'M': |
| 58 | 58 | case 'month': |
| 59 | - $description = wp_sprintf( _n( '%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 59 | + $description = wp_sprintf(_n('%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing'), $amount, $interval); |
|
| 60 | 60 | break; |
| 61 | 61 | case 'Y': |
| 62 | 62 | case 'year': |
| 63 | - $description = wp_sprintf( _n( '%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 63 | + $description = wp_sprintf(_n('%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing'), $amount, $interval); |
|
| 64 | 64 | break; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval ); |
|
| 67 | + return apply_filters('wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -function wpinv_subscription_recurring_payment_desc( $amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0 ) { |
|
| 71 | - $interval = (int)$interval > 0 ? (int)$interval : 1; |
|
| 72 | - $bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0; |
|
| 70 | +function wpinv_subscription_recurring_payment_desc($amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0) { |
|
| 71 | + $interval = (int) $interval > 0 ? (int) $interval : 1; |
|
| 72 | + $bill_times = (int) $bill_times > 0 ? (int) $bill_times : 0; |
|
| 73 | 73 | |
| 74 | 74 | $description = ''; |
| 75 | - switch ( $period ) { |
|
| 75 | + switch ($period) { |
|
| 76 | 76 | case 'D': |
| 77 | 77 | case 'day': |
| 78 | - if ( (int)$bill_times > 0 ) { |
|
| 79 | - if ( $interval > 1 ) { |
|
| 80 | - if ( $bill_times > 1 ) { |
|
| 81 | - $description = wp_sprintf( __( '%1$s for each %2$d days, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
| 78 | + if ((int) $bill_times > 0) { |
|
| 79 | + if ($interval > 1) { |
|
| 80 | + if ($bill_times > 1) { |
|
| 81 | + $description = wp_sprintf(__('%1$s for each %2$d days, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
| 82 | 82 | } else { |
| 83 | - $description = wp_sprintf( __( '%1$s for %2$d days.', 'invoicing' ), $amount, $interval ); |
|
| 83 | + $description = wp_sprintf(__('%1$s for %2$d days.', 'invoicing'), $amount, $interval); |
|
| 84 | 84 | } |
| 85 | 85 | } else { |
| 86 | - $description = wp_sprintf( _n( '%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
| 86 | + $description = wp_sprintf(_n('%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
| 87 | 87 | } |
| 88 | 88 | } else { |
| 89 | - $description = wp_sprintf( _n( '%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 89 | + $description = wp_sprintf(_n('%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing'), $amount, $interval); |
|
| 90 | 90 | } |
| 91 | 91 | break; |
| 92 | 92 | case 'W': |
| 93 | 93 | case 'week': |
| 94 | - if ( (int)$bill_times > 0 ) { |
|
| 95 | - if ( $interval > 1 ) { |
|
| 96 | - if ( $bill_times > 1 ) { |
|
| 97 | - $description = wp_sprintf( __( '%1$s for each %2$d weeks, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
| 94 | + if ((int) $bill_times > 0) { |
|
| 95 | + if ($interval > 1) { |
|
| 96 | + if ($bill_times > 1) { |
|
| 97 | + $description = wp_sprintf(__('%1$s for each %2$d weeks, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
| 98 | 98 | } else { |
| 99 | - $description = wp_sprintf( __( '%1$s for %2$d weeks.', 'invoicing' ), $amount, $interval ); |
|
| 99 | + $description = wp_sprintf(__('%1$s for %2$d weeks.', 'invoicing'), $amount, $interval); |
|
| 100 | 100 | } |
| 101 | 101 | } else { |
| 102 | - $description = wp_sprintf( _n( '%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
| 102 | + $description = wp_sprintf(_n('%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
| 103 | 103 | } |
| 104 | 104 | } else { |
| 105 | - $description = wp_sprintf( _n( '%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 105 | + $description = wp_sprintf(_n('%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing'), $amount, $interval); |
|
| 106 | 106 | } |
| 107 | 107 | break; |
| 108 | 108 | case 'M': |
| 109 | 109 | case 'month': |
| 110 | - if ( (int)$bill_times > 0 ) { |
|
| 111 | - if ( $interval > 1 ) { |
|
| 112 | - if ( $bill_times > 1 ) { |
|
| 113 | - $description = wp_sprintf( __( '%1$s for each %2$d months, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
| 110 | + if ((int) $bill_times > 0) { |
|
| 111 | + if ($interval > 1) { |
|
| 112 | + if ($bill_times > 1) { |
|
| 113 | + $description = wp_sprintf(__('%1$s for each %2$d months, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
| 114 | 114 | } else { |
| 115 | - $description = wp_sprintf( __( '%1$s for %2$d months.', 'invoicing' ), $amount, $interval ); |
|
| 115 | + $description = wp_sprintf(__('%1$s for %2$d months.', 'invoicing'), $amount, $interval); |
|
| 116 | 116 | } |
| 117 | 117 | } else { |
| 118 | - $description = wp_sprintf( _n( '%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
| 118 | + $description = wp_sprintf(_n('%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
| 119 | 119 | } |
| 120 | 120 | } else { |
| 121 | - $description = wp_sprintf( _n( '%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 121 | + $description = wp_sprintf(_n('%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing'), $amount, $interval); |
|
| 122 | 122 | } |
| 123 | 123 | break; |
| 124 | 124 | case 'Y': |
| 125 | 125 | case 'year': |
| 126 | - if ( (int)$bill_times > 0 ) { |
|
| 127 | - if ( $interval > 1 ) { |
|
| 128 | - if ( $bill_times > 1 ) { |
|
| 129 | - $description = wp_sprintf( __( '%1$s for each %2$d years, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times ); |
|
| 126 | + if ((int) $bill_times > 0) { |
|
| 127 | + if ($interval > 1) { |
|
| 128 | + if ($bill_times > 1) { |
|
| 129 | + $description = wp_sprintf(__('%1$s for each %2$d years, for %3$d installments.', 'invoicing'), $amount, $interval, $bill_times); |
|
| 130 | 130 | } else { |
| 131 | - $description = wp_sprintf( __( '%1$s for %2$d years.', 'invoicing' ), $amount, $interval ); |
|
| 131 | + $description = wp_sprintf(__('%1$s for %2$d years.', 'invoicing'), $amount, $interval); |
|
| 132 | 132 | } |
| 133 | 133 | } else { |
| 134 | - $description = wp_sprintf( _n( '%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times ); |
|
| 134 | + $description = wp_sprintf(_n('%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing'), $amount, $bill_times); |
|
| 135 | 135 | } |
| 136 | 136 | } else { |
| 137 | - $description = wp_sprintf( _n( '%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing' ), $amount, $interval ); |
|
| 137 | + $description = wp_sprintf(_n('%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing'), $amount, $interval); |
|
| 138 | 138 | } |
| 139 | 139 | break; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
| 142 | + return apply_filters('wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | -function wpinv_subscription_payment_desc( $invoice ) { |
|
| 146 | - if ( empty( $invoice ) ) { |
|
| 145 | +function wpinv_subscription_payment_desc($invoice) { |
|
| 146 | + if (empty($invoice)) { |
|
| 147 | 147 | return null; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $description = ''; |
| 151 | - if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) { |
|
| 152 | - if ( $item->has_free_trial() ) { |
|
| 151 | + if ($invoice->is_parent() && $item = $invoice->get_recurring(true)) { |
|
| 152 | + if ($item->has_free_trial()) { |
|
| 153 | 153 | $trial_period = $item->get_trial_period(); |
| 154 | 154 | $trial_interval = $item->get_trial_interval(); |
| 155 | 155 | } else { |
@@ -157,40 +157,40 @@ discard block |
||
| 157 | 157 | $trial_interval = 0; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() ); |
|
| 160 | + $description = wpinv_get_billing_cycle($invoice->get_total(), $invoice->get_recurring_details('total'), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency()); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice ); |
|
| 163 | + return apply_filters('wpinv_subscription_payment_desc', $description, $invoice); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | -function wpinv_get_billing_cycle( $initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '' ) { |
|
| 167 | - $initial_total = wpinv_round_amount( $initial ); |
|
| 168 | - $recurring_total = wpinv_round_amount( $recurring ); |
|
| 166 | +function wpinv_get_billing_cycle($initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '') { |
|
| 167 | + $initial_total = wpinv_round_amount($initial); |
|
| 168 | + $recurring_total = wpinv_round_amount($recurring); |
|
| 169 | 169 | |
| 170 | - if ( $trial_interval > 0 && ! empty( $trial_period ) ) { |
|
| 170 | + if ($trial_interval > 0 && !empty($trial_period)) { |
|
| 171 | 171 | // Free trial |
| 172 | 172 | } else { |
| 173 | - if ( $bill_times == 1 ) { |
|
| 173 | + if ($bill_times == 1) { |
|
| 174 | 174 | $recurring_total = $initial_total; |
| 175 | - } elseif ( $bill_times > 1 && $initial_total != $recurring_total ) { |
|
| 175 | + } elseif ($bill_times > 1 && $initial_total != $recurring_total) { |
|
| 176 | 176 | $bill_times--; |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $initial_amount = wpinv_price( $initial_total, $currency ); |
|
| 181 | - $recurring_amount = wpinv_price( $recurring_total, $currency ); |
|
| 180 | + $initial_amount = wpinv_price($initial_total, $currency); |
|
| 181 | + $recurring_amount = wpinv_price($recurring_total, $currency); |
|
| 182 | 182 | |
| 183 | - $recurring = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval ); |
|
| 183 | + $recurring = wpinv_subscription_recurring_payment_desc($recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval); |
|
| 184 | 184 | |
| 185 | - if ( $initial_total != $recurring_total ) { |
|
| 186 | - $initial = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval ); |
|
| 185 | + if ($initial_total != $recurring_total) { |
|
| 186 | + $initial = wpinv_subscription_initial_payment_desc($initial_amount, $period, $interval, $trial_period, $trial_interval); |
|
| 187 | 187 | |
| 188 | - $description = wp_sprintf( __( '%1$s Then %2$s', 'invoicing' ), $initial, $recurring ); |
|
| 188 | + $description = wp_sprintf(__('%1$s Then %2$s', 'invoicing'), $initial, $recurring); |
|
| 189 | 189 | } else { |
| 190 | 190 | $description = $recurring; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency ); |
|
| 193 | + return apply_filters('wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -200,27 +200,27 @@ discard block |
||
| 200 | 200 | * @param string $card_number Card number. |
| 201 | 201 | * @return string |
| 202 | 202 | */ |
| 203 | -function getpaid_get_card_name( $card_number ) { |
|
| 203 | +function getpaid_get_card_name($card_number) { |
|
| 204 | 204 | |
| 205 | 205 | // Known regexes. |
| 206 | 206 | $regexes = array( |
| 207 | - '/^4/' => __( 'Visa', 'invoicing' ), |
|
| 208 | - '/^5[1-5]/' => __( 'Mastercard', 'invoicing' ), |
|
| 209 | - '/^3[47]/' => __( 'Amex', 'invoicing' ), |
|
| 210 | - '/^3(?:0[0-5]|[68])/' => __( 'Diners Club', 'invoicing' ), |
|
| 211 | - '/^6(?:011|5)/' => __( 'Discover', 'invoicing' ), |
|
| 212 | - '/^(?:2131|1800|35\d{3})/' => __( 'JCB', 'invoicing' ), |
|
| 207 | + '/^4/' => __('Visa', 'invoicing'), |
|
| 208 | + '/^5[1-5]/' => __('Mastercard', 'invoicing'), |
|
| 209 | + '/^3[47]/' => __('Amex', 'invoicing'), |
|
| 210 | + '/^3(?:0[0-5]|[68])/' => __('Diners Club', 'invoicing'), |
|
| 211 | + '/^6(?:011|5)/' => __('Discover', 'invoicing'), |
|
| 212 | + '/^(?:2131|1800|35\d{3})/' => __('JCB', 'invoicing'), |
|
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | // Confirm if one matches. |
| 216 | - foreach ( $regexes as $regex => $card ) { |
|
| 217 | - if ( preg_match( $regex, $card_number ) >= 1 ) { |
|
| 216 | + foreach ($regexes as $regex => $card) { |
|
| 217 | + if (preg_match($regex, $card_number) >= 1) { |
|
| 218 | 218 | return $card; |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // None matched. |
| 223 | - return __( 'Card', 'invoicing' ); |
|
| 223 | + return __('Card', 'invoicing'); |
|
| 224 | 224 | |
| 225 | 225 | } |
| 226 | 226 | |
@@ -229,25 +229,25 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @param WPInv_Invoice|int|null $invoice |
| 231 | 231 | */ |
| 232 | -function wpinv_send_back_to_checkout( $invoice = null ) { |
|
| 233 | - $response = array( 'success' => false ); |
|
| 234 | - $invoice = wpinv_get_invoice( $invoice ); |
|
| 232 | +function wpinv_send_back_to_checkout($invoice = null) { |
|
| 233 | + $response = array('success' => false); |
|
| 234 | + $invoice = wpinv_get_invoice($invoice); |
|
| 235 | 235 | |
| 236 | 236 | // Was an invoice created? |
| 237 | - if ( ! empty( $invoice ) ) { |
|
| 238 | - $invoice = is_scalar( $invoice ) ? new WPInv_Invoice( $invoice ) : $invoice; |
|
| 237 | + if (!empty($invoice)) { |
|
| 238 | + $invoice = is_scalar($invoice) ? new WPInv_Invoice($invoice) : $invoice; |
|
| 239 | 239 | $response['invoice'] = $invoice->get_id(); |
| 240 | - do_action( 'getpaid_checkout_invoice_exception', $invoice ); |
|
| 240 | + do_action('getpaid_checkout_invoice_exception', $invoice); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Do we have any errors? |
| 244 | - if ( wpinv_get_errors() ) { |
|
| 245 | - $response['data'] = getpaid_get_errors_html( true, false ); |
|
| 244 | + if (wpinv_get_errors()) { |
|
| 245 | + $response['data'] = getpaid_get_errors_html(true, false); |
|
| 246 | 246 | } else { |
| 247 | - $response['data'] = __( 'An error occured while processing your payment. Please try again.', 'invoicing' ); |
|
| 247 | + $response['data'] = __('An error occured while processing your payment. Please try again.', 'invoicing'); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - wp_send_json( $response ); |
|
| 250 | + wp_send_json($response); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @return string |
| 257 | 257 | */ |
| 258 | 258 | function getpaid_get_recaptcha_site_key() { |
| 259 | - return apply_filters( 'getpaid_recaptcha_site_key', wpinv_get_option( 'recaptcha_site_key', '' ) ); |
|
| 259 | + return apply_filters('getpaid_recaptcha_site_key', wpinv_get_option('recaptcha_site_key', '')); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @return string |
| 266 | 266 | */ |
| 267 | 267 | function getpaid_get_recaptcha_secret_key() { |
| 268 | - return apply_filters( 'getpaid_recaptcha_secret_key', wpinv_get_option( 'recaptcha_secret_key', '' ) ); |
|
| 268 | + return apply_filters('getpaid_recaptcha_secret_key', wpinv_get_option('recaptcha_secret_key', '')); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @return bool |
| 275 | 275 | */ |
| 276 | 276 | function getpaid_is_recaptcha_enabled() { |
| 277 | - return wpinv_get_option( 'enable_recaptcha', false ) && getpaid_get_recaptcha_site_key() && getpaid_get_recaptcha_secret_key(); |
|
| 277 | + return wpinv_get_option('enable_recaptcha', false) && getpaid_get_recaptcha_site_key() && getpaid_get_recaptcha_secret_key(); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * @return string |
| 284 | 284 | */ |
| 285 | 285 | function getpaid_get_recaptcha_version() { |
| 286 | - return apply_filters( 'getpaid_recaptcha_version', wpinv_get_option( 'recaptcha_version', 'v2' ) ); |
|
| 286 | + return apply_filters('getpaid_recaptcha_version', wpinv_get_option('recaptcha_version', 'v2')); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | 'version' => getpaid_get_recaptcha_version(), |
| 298 | 298 | ); |
| 299 | 299 | |
| 300 | - if ( ! getpaid_is_recaptcha_enabled() ) { |
|
| 300 | + if (!getpaid_is_recaptcha_enabled()) { |
|
| 301 | 301 | return $settings; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | $settings['sitekey'] = getpaid_get_recaptcha_site_key(); |
| 305 | 305 | |
| 306 | 306 | // Version 2 render params. |
| 307 | - if ( 'v2' === getpaid_get_recaptcha_version() ) { |
|
| 307 | + if ('v2' === getpaid_get_recaptcha_version()) { |
|
| 308 | 308 | $settings['render_params'] = array( |
| 309 | 309 | 'sitekey' => getpaid_get_recaptcha_site_key(), |
| 310 | 310 | 'theme' => 'light', |
@@ -313,41 +313,41 @@ discard block |
||
| 313 | 313 | ); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - return apply_filters( 'getpaid_recaptcha_settings', $settings ); |
|
| 316 | + return apply_filters('getpaid_recaptcha_settings', $settings); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | 320 | * Displays reCAPTCHA before payment button. |
| 321 | 321 | */ |
| 322 | 322 | function getpaid_display_recaptcha_before_payment_button() { |
| 323 | - if ( ! getpaid_is_recaptcha_enabled() || 'v2' !== getpaid_get_recaptcha_version() ) { |
|
| 323 | + if (!getpaid_is_recaptcha_enabled() || 'v2' !== getpaid_get_recaptcha_version()) { |
|
| 324 | 324 | return; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | printf( |
| 328 | 328 | '<div class="getpaid-recaptcha-wrapper"><div class="g-recaptcha mw-100 overflow-hidden my-2" id="getpaid-recaptcha-%s"></div></div>', |
| 329 | - esc_attr( wp_unique_id() ) |
|
| 329 | + esc_attr(wp_unique_id()) |
|
| 330 | 330 | ); |
| 331 | 331 | } |
| 332 | -add_action( 'getpaid_before_payment_form_pay_button', 'getpaid_display_recaptcha_before_payment_button' ); |
|
| 332 | +add_action('getpaid_before_payment_form_pay_button', 'getpaid_display_recaptcha_before_payment_button'); |
|
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | 335 | * Validates the reCAPTCHA response. |
| 336 | 336 | * |
| 337 | 337 | * @param GetPaid_Payment_Form_Submission $submission |
| 338 | 338 | */ |
| 339 | -function getpaid_validate_recaptcha_response( $submission ) { |
|
| 339 | +function getpaid_validate_recaptcha_response($submission) { |
|
| 340 | 340 | |
| 341 | 341 | // Check if reCAPTCHA is enabled. |
| 342 | - if ( ! getpaid_is_recaptcha_enabled() ) { |
|
| 342 | + if (!getpaid_is_recaptcha_enabled()) { |
|
| 343 | 343 | return; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $token = $submission->get_field( 'g-recaptcha-response' ); |
|
| 346 | + $token = $submission->get_field('g-recaptcha-response'); |
|
| 347 | 347 | |
| 348 | 348 | // Abort if no token was provided. |
| 349 | - if ( empty( $token ) ) { |
|
| 350 | - wp_send_json_error( 'v2' === getpaid_get_recaptcha_version() ? __( 'Please confirm that you are not a robot.', 'invoicing' ) : __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) ); |
|
| 349 | + if (empty($token)) { |
|
| 350 | + wp_send_json_error('v2' === getpaid_get_recaptcha_version() ? __('Please confirm that you are not a robot.', 'invoicing') : __("Unable to verify that you're not a robot. Please try again.", 'invoicing')); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $result = wp_remote_post( |
@@ -361,20 +361,20 @@ discard block |
||
| 361 | 361 | ); |
| 362 | 362 | |
| 363 | 363 | // Site not reachable, give benefit of doubt. |
| 364 | - if ( is_wp_error( $result ) ) { |
|
| 364 | + if (is_wp_error($result)) { |
|
| 365 | 365 | return; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - $result = json_decode( wp_remote_retrieve_body( $result ), true ); |
|
| 368 | + $result = json_decode(wp_remote_retrieve_body($result), true); |
|
| 369 | 369 | |
| 370 | - if ( empty( $result['success'] ) && ! in_array( 'missing-input-secret', $result['error-codes'], true ) && ! in_array( 'invalid-input-secret', $result['error-codes'], true ) ) { |
|
| 371 | - wp_send_json_error( __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) ); |
|
| 370 | + if (empty($result['success']) && !in_array('missing-input-secret', $result['error-codes'], true) && !in_array('invalid-input-secret', $result['error-codes'], true)) { |
|
| 371 | + wp_send_json_error(__("Unable to verify that you're not a robot. Please try again.", 'invoicing')); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // For v3, check the score. |
| 375 | - $minimum_score = apply_filters( 'getpaid_recaptcha_minimum_score', 0.4 ); |
|
| 376 | - if ( 'v3' === getpaid_get_recaptcha_version() && ( empty( $result['score'] ) || $result['score'] < $minimum_score ) ) { |
|
| 377 | - wp_send_json_error( __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) ); |
|
| 375 | + $minimum_score = apply_filters('getpaid_recaptcha_minimum_score', 0.4); |
|
| 376 | + if ('v3' === getpaid_get_recaptcha_version() && (empty($result['score']) || $result['score'] < $minimum_score)) { |
|
| 377 | + wp_send_json_error(__("Unable to verify that you're not a robot. Please try again.", 'invoicing')); |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | -add_action( 'getpaid_checkout_error_checks', 'getpaid_validate_recaptcha_response' ); |
|
| 380 | +add_action('getpaid_checkout_error_checks', 'getpaid_validate_recaptcha_response'); |
|
@@ -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 | // Standardize IDs. |
| 13 | 13 | global $rendered_getpaid_forms; |
| 14 | 14 | |
| 15 | 15 | // Make sure that the form is active. |
| 16 | -if ( ! $form->is_active() ) { |
|
| 16 | +if (!$form->is_active()) { |
|
| 17 | 17 | aui()->alert( |
| 18 | 18 | array( |
| 19 | 19 | 'type' => 'warning', |
| 20 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
| 20 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
| 21 | 21 | ), |
| 22 | 22 | true |
| 23 | 23 | ); |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Require login to checkout. |
| 28 | -if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) { |
|
| 28 | +if (wpinv_require_login_to_checkout() && !get_current_user_id()) { |
|
| 29 | 29 | |
| 30 | 30 | aui()->alert( |
| 31 | 31 | array( |
| 32 | 32 | 'type' => 'danger', |
| 33 | - 'content' => __( 'You must be logged in to checkout.', 'invoicing' ), |
|
| 33 | + 'content' => __('You must be logged in to checkout.', 'invoicing'), |
|
| 34 | 34 | ), |
| 35 | 35 | true |
| 36 | 36 | ); |
@@ -38,36 +38,36 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if ( ! is_array( $rendered_getpaid_forms ) ) { |
|
| 41 | +if (!is_array($rendered_getpaid_forms)) { |
|
| 42 | 42 | $rendered_getpaid_forms = array(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -$rendered_getpaid_forms[ $form->get_id() ] = isset( $rendered_getpaid_forms[ $form->get_id() ] ) ? $rendered_getpaid_forms[ $form->get_id() ] + 1 : 0; |
|
| 45 | +$rendered_getpaid_forms[$form->get_id()] = isset($rendered_getpaid_forms[$form->get_id()]) ? $rendered_getpaid_forms[$form->get_id()] + 1 : 0; |
|
| 46 | 46 | |
| 47 | 47 | // Fires before displaying a payment form. |
| 48 | -do_action( 'getpaid_before_payment_form', $form ); |
|
| 48 | +do_action('getpaid_before_payment_form', $form); |
|
| 49 | 49 | ?> |
| 50 | 50 | |
| 51 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr( uniqid( 'gpf' ) ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate> |
|
| 51 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr(uniqid('gpf')); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate> |
|
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | 54 | |
| 55 | 55 | // Fires when printing the top of a payment form. |
| 56 | - do_action( 'getpaid_payment_form_top', $form ); |
|
| 56 | + do_action('getpaid_payment_form_top', $form); |
|
| 57 | 57 | |
| 58 | 58 | // And the optional invoice id. |
| 59 | - if ( ! empty( $form->invoice ) ) { |
|
| 60 | - getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
| 59 | + if (!empty($form->invoice)) { |
|
| 60 | + getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // We also want to include the form id. |
| 64 | - getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
| 64 | + getpaid_hidden_field('form_id', $form->get_id()); |
|
| 65 | 65 | |
| 66 | 66 | // And an indication that this is a payment form submission. |
| 67 | - getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
| 67 | + getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
| 68 | 68 | |
| 69 | 69 | // Fires before displaying payment form elements. |
| 70 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
| 70 | + do_action('getpaid_payment_form_before_elements', $form); |
|
| 71 | 71 | |
| 72 | 72 | // Display the elements. |
| 73 | 73 | ?> |
@@ -75,17 +75,17 @@ discard block |
||
| 75 | 75 | <div class="row"> |
| 76 | 76 | <?php |
| 77 | 77 | |
| 78 | - foreach ( $form->get_elements() as $element ) { |
|
| 79 | - if ( isset( $element['type'] ) ) { |
|
| 80 | - $grid_class = getpaid_get_form_element_grid_class( $element ); |
|
| 81 | - do_action( 'getpaid_payment_form_element_before', $element, $form ); |
|
| 82 | - do_action( "getpaid_payment_form_element_before_{$element['type']}_template", $element, $form ); |
|
| 83 | - echo "<div class='" . esc_attr( $grid_class ) . "'>"; |
|
| 84 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
| 85 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
| 78 | + foreach ($form->get_elements() as $element) { |
|
| 79 | + if (isset($element['type'])) { |
|
| 80 | + $grid_class = getpaid_get_form_element_grid_class($element); |
|
| 81 | + do_action('getpaid_payment_form_element_before', $element, $form); |
|
| 82 | + do_action("getpaid_payment_form_element_before_{$element['type']}_template", $element, $form); |
|
| 83 | + echo "<div class='" . esc_attr($grid_class) . "'>"; |
|
| 84 | + do_action('getpaid_payment_form_element', $element, $form); |
|
| 85 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
| 86 | 86 | echo '</div>'; |
| 87 | - do_action( 'getpaid_payment_form_element_after', $element, $form ); |
|
| 88 | - do_action( "getpaid_payment_form_element_after_{$element['type']}_template", $element, $form ); |
|
| 87 | + do_action('getpaid_payment_form_element_after', $element, $form); |
|
| 88 | + do_action("getpaid_payment_form_element_after_{$element['type']}_template", $element, $form); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -95,28 +95,28 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | <?php |
| 97 | 97 | // Fires after displaying payment form elements. |
| 98 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
| 98 | + do_action('getpaid_payment_form_after_elements', $form); |
|
| 99 | 99 | |
| 100 | 100 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
| 101 | 101 | |
| 102 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 102 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
| 103 | 103 | |
| 104 | 104 | edit_post_link( |
| 105 | - __( 'Edit this form.', 'invoicing' ), |
|
| 105 | + __('Edit this form.', 'invoicing'), |
|
| 106 | 106 | '<small class="form-text text-muted">', |
| 107 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
| 107 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
| 108 | 108 | $form->get_id(), |
| 109 | 109 | 'text-danger' |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - echo wp_kses( $extra_markup, getpaid_allowed_html() ); |
|
| 114 | + echo wp_kses($extra_markup, getpaid_allowed_html()); |
|
| 115 | 115 | ?> |
| 116 | 116 | |
| 117 | 117 | <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;"> |
| 118 | 118 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
| 119 | - <span class="sr-only"><?php esc_html_e( 'Loading...', 'invoicing' ); ?></span> |
|
| 119 | + <span class="sr-only"><?php esc_html_e('Loading...', 'invoicing'); ?></span> |
|
| 120 | 120 | </div> |
| 121 | 121 | </div> |
| 122 | 122 | |
@@ -125,4 +125,4 @@ discard block |
||
| 125 | 125 | <?php |
| 126 | 126 | |
| 127 | 127 | // Fires after displaying a payment form. |
| 128 | -do_action( 'getpaid_after_payment_form', $form ); |
|
| 128 | +do_action('getpaid_after_payment_form', $form); |
|