@@ -64,8 +64,8 @@ |
||
| 64 | 64 | $description = wpinv_get_gateway_description( $gateway ); |
| 65 | 65 | |
| 66 | 66 | if ( wpinv_is_test_mode( $gateway ) ) { |
| 67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
| 68 | - $description = "$description $sandbox_notice"; |
|
| 67 | + $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
| 68 | + $description = "$description $sandbox_notice"; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | echo wp_kses_post( wpautop( $description ) ); |
@@ -30,40 +30,40 @@ |
||
| 30 | 30 | // Item name. |
| 31 | 31 | if ( 'name' == $column ) { |
| 32 | 32 | |
| 33 | - // Display the name. |
|
| 34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 33 | + // Display the name. |
|
| 34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 35 | 35 | |
| 36 | - // And an optional description. |
|
| 37 | - $description = $item->get_description(); |
|
| 36 | + // And an optional description. |
|
| 37 | + $description = $item->get_description(); |
|
| 38 | 38 | |
| 39 | - if ( ! empty( $description ) ) { |
|
| 40 | - echo "<p class='small'>" . wp_kses_post( $description ) . "</p>"; |
|
| 39 | + if ( ! empty( $description ) ) { |
|
| 40 | + echo "<p class='small'>" . wp_kses_post( $description ) . "</p>"; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Item price. |
| 45 | 45 | if ( 'price' == $column ) { |
| 46 | 46 | |
| 47 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
| 48 | - $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
| 49 | - wpinv_the_price( $price, $invoice->get_currency() ); |
|
| 47 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
| 48 | + $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
| 49 | + wpinv_the_price( $price, $invoice->get_currency() ); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Item quantity. |
| 54 | 54 | if ( 'quantity' == $column ) { |
| 55 | - echo (float) $item->get_quantity(); |
|
| 55 | + echo (float) $item->get_quantity(); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Tax rate. |
| 59 | 59 | if ( 'tax_rate' == $column ) { |
| 60 | - echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
| 60 | + echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Item sub total. |
| 64 | 64 | if ( 'subtotal' == $column ) { |
| 65 | - $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
| 66 | - wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
| 65 | + $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
| 66 | + wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Fires when printing a line item column. |
@@ -30,21 +30,21 @@ discard block |
||
| 30 | 30 | // Item name. |
| 31 | 31 | if ( 'name' == $column ) { |
| 32 | 32 | |
| 33 | - // Display the name. |
|
| 34 | - echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>'; |
|
| 33 | + // Display the name. |
|
| 34 | + echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>'; |
|
| 35 | 35 | |
| 36 | - // And an optional description. |
|
| 37 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
| 38 | - echo wp_kses_post( "<p class='small'>$description</p>" ); |
|
| 36 | + // And an optional description. |
|
| 37 | + $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
| 38 | + echo wp_kses_post( "<p class='small'>$description</p>" ); |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // Item price. |
| 43 | 43 | if ( 'price' == $column ) { |
| 44 | 44 | |
| 45 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
| 46 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 47 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
| 45 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
| 46 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 47 | + wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
| 48 | 48 | } else { |
| 49 | 49 | wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
| 50 | 50 | } |
@@ -52,18 +52,18 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | // Item quantity. |
| 54 | 54 | if ( 'quantity' == $column ) { |
| 55 | - echo '—'; |
|
| 55 | + echo '—'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Item tax. |
| 59 | 59 | if ( 'tax_rate' == $column ) { |
| 60 | - echo '—'; |
|
| 60 | + echo '—'; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Item sub total. |
| 64 | 64 | if ( 'subtotal' == $column ) { |
| 65 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 66 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
| 65 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
| 66 | + wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
| 67 | 67 | } else { |
| 68 | 68 | wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
| 69 | 69 | } |
@@ -126,25 +126,25 @@ |
||
| 126 | 126 | |
| 127 | 127 | if ( ! empty( $invoice_actions ) ) { |
| 128 | 128 | |
| 129 | - echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">'; |
|
| 129 | + echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">'; |
|
| 130 | 130 | |
| 131 | - foreach ( $invoice_actions as $key => $invoice_action ) { |
|
| 131 | + foreach ( $invoice_actions as $key => $invoice_action ) { |
|
| 132 | 132 | |
| 133 | - $key = sanitize_html_class( $key ); |
|
| 134 | - $class = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] ); |
|
| 135 | - $url = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] ); |
|
| 136 | - $attrs = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs']; |
|
| 137 | - $anchor = esc_html( $invoice_action['name'] ); |
|
| 133 | + $key = sanitize_html_class( $key ); |
|
| 134 | + $class = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] ); |
|
| 135 | + $url = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] ); |
|
| 136 | + $attrs = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs']; |
|
| 137 | + $anchor = esc_html( $invoice_action['name'] ); |
|
| 138 | 138 | |
| 139 | - echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" ); |
|
| 139 | + echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - echo '</div>'; |
|
| 142 | + echo '</div>'; |
|
| 143 | 143 | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if ( ! empty( $alert ) ) { |
| 147 | - echo wp_kses_post( $alert ); |
|
| 147 | + echo wp_kses_post( $alert ); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | ?> |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param string $default_path The root path to the default template. Defaults to invoicing/templates |
| 141 | 141 | */ |
| 142 | 142 | function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
| 143 | - return getpaid_template()->get_template( $template_name, $args, $template_path, $default_path ); |
|
| 143 | + return getpaid_template()->get_template( $template_name, $args, $template_path, $default_path ); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @return string |
| 159 | 159 | */ |
| 160 | 160 | function wpinv_get_theme_template_dir_name() { |
| 161 | - return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) ); |
|
| 161 | + return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) ); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -175,125 +175,125 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | function wpinv_get_template_part( $slug, $name = null, $load = true ) { |
| 178 | - do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
| 178 | + do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
| 179 | 179 | |
| 180 | - // Setup possible parts |
|
| 181 | - $templates = array(); |
|
| 182 | - if ( isset( $name ) ) { |
|
| 183 | - $templates[] = $slug . '-' . $name . '.php'; |
|
| 180 | + // Setup possible parts |
|
| 181 | + $templates = array(); |
|
| 182 | + if ( isset( $name ) ) { |
|
| 183 | + $templates[] = $slug . '-' . $name . '.php'; |
|
| 184 | 184 | } |
| 185 | - $templates[] = $slug . '.php'; |
|
| 185 | + $templates[] = $slug . '.php'; |
|
| 186 | 186 | |
| 187 | - // Allow template parts to be filtered |
|
| 188 | - $templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name ); |
|
| 187 | + // Allow template parts to be filtered |
|
| 188 | + $templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name ); |
|
| 189 | 189 | |
| 190 | - // Return the part that is found |
|
| 191 | - return wpinv_locate_tmpl( $templates, $load, false ); |
|
| 190 | + // Return the part that is found |
|
| 191 | + return wpinv_locate_tmpl( $templates, $load, false ); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) { |
| 195 | - // No file found yet |
|
| 196 | - $located = false; |
|
| 195 | + // No file found yet |
|
| 196 | + $located = false; |
|
| 197 | 197 | |
| 198 | - // Try to find a template file |
|
| 199 | - foreach ( (array)$template_names as $template_name ) { |
|
| 198 | + // Try to find a template file |
|
| 199 | + foreach ( (array)$template_names as $template_name ) { |
|
| 200 | 200 | |
| 201 | - // Continue if template is empty |
|
| 202 | - if ( empty( $template_name ) ) { |
|
| 203 | - continue; |
|
| 201 | + // Continue if template is empty |
|
| 202 | + if ( empty( $template_name ) ) { |
|
| 203 | + continue; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - // Trim off any slashes from the template name |
|
| 207 | - $template_name = ltrim( $template_name, '/' ); |
|
| 206 | + // Trim off any slashes from the template name |
|
| 207 | + $template_name = ltrim( $template_name, '/' ); |
|
| 208 | 208 | |
| 209 | - // try locating this template file by looping through the template paths |
|
| 210 | - foreach ( wpinv_get_theme_template_paths() as $template_path ) { |
|
| 209 | + // try locating this template file by looping through the template paths |
|
| 210 | + foreach ( wpinv_get_theme_template_paths() as $template_path ) { |
|
| 211 | 211 | |
| 212 | - if ( file_exists( $template_path . $template_name ) ) { |
|
| 213 | - $located = $template_path . $template_name; |
|
| 214 | - break; |
|
| 215 | - } |
|
| 216 | - } |
|
| 212 | + if ( file_exists( $template_path . $template_name ) ) { |
|
| 213 | + $located = $template_path . $template_name; |
|
| 214 | + break; |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - if ( ! empty( $located ) ) { |
|
| 219 | - break; |
|
| 220 | - } |
|
| 221 | - } |
|
| 218 | + if ( ! empty( $located ) ) { |
|
| 219 | + break; |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
| 224 | - load_template( $located, $require_once ); |
|
| 223 | + if ( ( true == $load ) && ! empty( $located ) ) { |
|
| 224 | + load_template( $located, $require_once ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - return $located; |
|
| 227 | + return $located; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | function wpinv_get_theme_template_paths() { |
| 231 | - $template_dir = wpinv_get_theme_template_dir_name(); |
|
| 231 | + $template_dir = wpinv_get_theme_template_dir_name(); |
|
| 232 | 232 | |
| 233 | - $file_paths = array( |
|
| 234 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
| 235 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
| 236 | - 100 => wpinv_get_templates_dir(), |
|
| 237 | - ); |
|
| 233 | + $file_paths = array( |
|
| 234 | + 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
| 235 | + 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
| 236 | + 100 => wpinv_get_templates_dir(), |
|
| 237 | + ); |
|
| 238 | 238 | |
| 239 | - $file_paths = apply_filters( 'wpinv_template_paths', $file_paths ); |
|
| 239 | + $file_paths = apply_filters( 'wpinv_template_paths', $file_paths ); |
|
| 240 | 240 | |
| 241 | - // sort the file paths based on priority |
|
| 242 | - ksort( $file_paths, SORT_NUMERIC ); |
|
| 241 | + // sort the file paths based on priority |
|
| 242 | + ksort( $file_paths, SORT_NUMERIC ); |
|
| 243 | 243 | |
| 244 | - return array_map( 'trailingslashit', $file_paths ); |
|
| 244 | + return array_map( 'trailingslashit', $file_paths ); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | function wpinv_checkout_meta_tags() { |
| 248 | 248 | |
| 249 | - $pages = array(); |
|
| 250 | - $pages[] = wpinv_get_option( 'success_page' ); |
|
| 251 | - $pages[] = wpinv_get_option( 'failure_page' ); |
|
| 252 | - $pages[] = wpinv_get_option( 'invoice_history_page' ); |
|
| 253 | - $pages[] = wpinv_get_option( 'invoice_subscription_page' ); |
|
| 249 | + $pages = array(); |
|
| 250 | + $pages[] = wpinv_get_option( 'success_page' ); |
|
| 251 | + $pages[] = wpinv_get_option( 'failure_page' ); |
|
| 252 | + $pages[] = wpinv_get_option( 'invoice_history_page' ); |
|
| 253 | + $pages[] = wpinv_get_option( 'invoice_subscription_page' ); |
|
| 254 | 254 | |
| 255 | - if ( ! wpinv_is_checkout() && ! is_page( $pages ) ) { |
|
| 256 | - return; |
|
| 257 | - } |
|
| 255 | + if ( ! wpinv_is_checkout() && ! is_page( $pages ) ) { |
|
| 256 | + return; |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - echo '<meta name="robots" content="noindex,nofollow" />' . "\n"; |
|
| 259 | + echo '<meta name="robots" content="noindex,nofollow" />' . "\n"; |
|
| 260 | 260 | } |
| 261 | 261 | add_action( 'wp_head', 'wpinv_checkout_meta_tags' ); |
| 262 | 262 | |
| 263 | 263 | function wpinv_add_body_classes( $class ) { |
| 264 | - $classes = (array)$class; |
|
| 264 | + $classes = (array)$class; |
|
| 265 | 265 | |
| 266 | - if ( wpinv_is_checkout() ) { |
|
| 267 | - $classes[] = 'wpinv-checkout'; |
|
| 268 | - $classes[] = 'wpinv-page'; |
|
| 269 | - } |
|
| 266 | + if ( wpinv_is_checkout() ) { |
|
| 267 | + $classes[] = 'wpinv-checkout'; |
|
| 268 | + $classes[] = 'wpinv-page'; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - if ( wpinv_is_success_page() ) { |
|
| 272 | - $classes[] = 'wpinv-success'; |
|
| 273 | - $classes[] = 'wpinv-page'; |
|
| 274 | - } |
|
| 271 | + if ( wpinv_is_success_page() ) { |
|
| 272 | + $classes[] = 'wpinv-success'; |
|
| 273 | + $classes[] = 'wpinv-page'; |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - if ( wpinv_is_failed_transaction_page() ) { |
|
| 277 | - $classes[] = 'wpinv-failed-transaction'; |
|
| 278 | - $classes[] = 'wpinv-page'; |
|
| 279 | - } |
|
| 276 | + if ( wpinv_is_failed_transaction_page() ) { |
|
| 277 | + $classes[] = 'wpinv-failed-transaction'; |
|
| 278 | + $classes[] = 'wpinv-page'; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - if ( wpinv_is_invoice_history_page() ) { |
|
| 282 | - $classes[] = 'wpinv-history'; |
|
| 283 | - $classes[] = 'wpinv-page'; |
|
| 284 | - } |
|
| 281 | + if ( wpinv_is_invoice_history_page() ) { |
|
| 282 | + $classes[] = 'wpinv-history'; |
|
| 283 | + $classes[] = 'wpinv-page'; |
|
| 284 | + } |
|
| 285 | 285 | |
| 286 | - if ( wpinv_is_subscriptions_history_page() ) { |
|
| 287 | - $classes[] = 'wpinv-subscription'; |
|
| 288 | - $classes[] = 'wpinv-page'; |
|
| 289 | - } |
|
| 286 | + if ( wpinv_is_subscriptions_history_page() ) { |
|
| 287 | + $classes[] = 'wpinv-subscription'; |
|
| 288 | + $classes[] = 'wpinv-page'; |
|
| 289 | + } |
|
| 290 | 290 | |
| 291 | - if ( wpinv_is_test_mode() ) { |
|
| 292 | - $classes[] = 'wpinv-test-mode'; |
|
| 293 | - $classes[] = 'wpinv-page'; |
|
| 294 | - } |
|
| 291 | + if ( wpinv_is_test_mode() ) { |
|
| 292 | + $classes[] = 'wpinv-test-mode'; |
|
| 293 | + $classes[] = 'wpinv-page'; |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - return array_unique( $classes ); |
|
| 296 | + return array_unique( $classes ); |
|
| 297 | 297 | } |
| 298 | 298 | add_filter( 'body_class', 'wpinv_add_body_classes' ); |
| 299 | 299 | |
@@ -458,16 +458,16 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | wpinv_html_select( |
| 460 | 460 | array( |
| 461 | - 'name' => $args['name'], |
|
| 462 | - 'selected' => $args['selected'], |
|
| 463 | - 'id' => $args['id'], |
|
| 464 | - 'class' => $args['class'], |
|
| 465 | - 'options' => $options, |
|
| 466 | - 'multiple' => $args['multiple'], |
|
| 467 | - 'placeholder' => $args['placeholder'], |
|
| 468 | - 'show_option_all' => $args['show_option_all'], |
|
| 469 | - 'show_option_none' => $args['show_option_none'], |
|
| 470 | - 'data' => $args['data'], |
|
| 461 | + 'name' => $args['name'], |
|
| 462 | + 'selected' => $args['selected'], |
|
| 463 | + 'id' => $args['id'], |
|
| 464 | + 'class' => $args['class'], |
|
| 465 | + 'options' => $options, |
|
| 466 | + 'multiple' => $args['multiple'], |
|
| 467 | + 'placeholder' => $args['placeholder'], |
|
| 468 | + 'show_option_all' => $args['show_option_all'], |
|
| 469 | + 'show_option_none' => $args['show_option_none'], |
|
| 470 | + 'data' => $args['data'], |
|
| 471 | 471 | ) |
| 472 | 472 | ); |
| 473 | 473 | |
@@ -767,21 +767,21 @@ discard block |
||
| 767 | 767 | |
| 768 | 768 | $formatted_address = str_ireplace( array_keys( $replacements ), $replacements, $format ); |
| 769 | 769 | |
| 770 | - // Remove unavailable tags. |
|
| 770 | + // Remove unavailable tags. |
|
| 771 | 771 | $formatted_address = preg_replace( '/\{\{\w+\}\}/', '', $formatted_address ); |
| 772 | 772 | |
| 773 | 773 | // Clean up white space. |
| 774 | - $formatted_address = preg_replace( '/ +/', ' ', trim( $formatted_address ) ); |
|
| 774 | + $formatted_address = preg_replace( '/ +/', ' ', trim( $formatted_address ) ); |
|
| 775 | 775 | $formatted_address = preg_replace( '/\n\n+/', "\n", $formatted_address ); |
| 776 | 776 | |
| 777 | 777 | // Break newlines apart and remove empty lines/trim commas and white space. |
| 778 | - $formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) ); |
|
| 778 | + $formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) ); |
|
| 779 | 779 | |
| 780 | 780 | // Add html breaks. |
| 781 | - $formatted_address = implode( $separator, $formatted_address ); |
|
| 781 | + $formatted_address = implode( $separator, $formatted_address ); |
|
| 782 | 782 | |
| 783 | - // We're done! |
|
| 784 | - return $formatted_address; |
|
| 783 | + // We're done! |
|
| 784 | + return $formatted_address; |
|
| 785 | 785 | |
| 786 | 786 | } |
| 787 | 787 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | function getpaid_display_invoice_subscriptions( $invoice ) { |
| 828 | 828 | |
| 829 | 829 | // Subscriptions. |
| 830 | - $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
| 830 | + $subscriptions = getpaid_get_invoice_subscriptions( $invoice ); |
|
| 831 | 831 | |
| 832 | 832 | if ( empty( $subscriptions ) || ! $invoice->is_recurring() ) { |
| 833 | 833 | return; |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | function wpinv_empty_cart_message() { |
| 1042 | - return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' ); |
|
| 1042 | + return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' ); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | /** |
@@ -1237,9 +1237,9 @@ discard block |
||
| 1237 | 1237 | |
| 1238 | 1238 | if ( 0 == count( $form->get_items() ) ) { |
| 1239 | 1239 | aui()->alert( |
| 1240 | - array( |
|
| 1241 | - 'type' => 'warning', |
|
| 1242 | - 'content' => __( 'No published items found', 'invoicing' ), |
|
| 1240 | + array( |
|
| 1241 | + 'type' => 'warning', |
|
| 1242 | + 'content' => __( 'No published items found', 'invoicing' ), |
|
| 1243 | 1243 | ), |
| 1244 | 1244 | true |
| 1245 | 1245 | ); |
@@ -1262,10 +1262,10 @@ discard block |
||
| 1262 | 1262 | $invoice = wpinv_get_invoice( $invoice_id ); |
| 1263 | 1263 | |
| 1264 | 1264 | if ( empty( $invoice ) ) { |
| 1265 | - aui()->alert( |
|
| 1266 | - array( |
|
| 1267 | - 'type' => 'warning', |
|
| 1268 | - 'content' => __( 'Invoice not found', 'invoicing' ), |
|
| 1265 | + aui()->alert( |
|
| 1266 | + array( |
|
| 1267 | + 'type' => 'warning', |
|
| 1268 | + 'content' => __( 'Invoice not found', 'invoicing' ), |
|
| 1269 | 1269 | ), |
| 1270 | 1270 | true |
| 1271 | 1271 | ); |
@@ -1273,10 +1273,10 @@ discard block |
||
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | if ( $invoice->is_paid() ) { |
| 1276 | - aui()->alert( |
|
| 1277 | - array( |
|
| 1278 | - 'type' => 'warning', |
|
| 1279 | - 'content' => __( 'Invoice has already been paid', 'invoicing' ), |
|
| 1276 | + aui()->alert( |
|
| 1277 | + array( |
|
| 1278 | + 'type' => 'warning', |
|
| 1279 | + 'content' => __( 'Invoice has already been paid', 'invoicing' ), |
|
| 1280 | 1280 | ), |
| 1281 | 1281 | true |
| 1282 | 1282 | ); |
@@ -1340,7 +1340,7 @@ discard block |
||
| 1340 | 1340 | return "<button class='btn btn-primary getpaid-payment-button' type='button' data-form='$form'>$label</button>"; |
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | - if ( ! empty( $items ) ) { |
|
| 1343 | + if ( ! empty( $items ) ) { |
|
| 1344 | 1344 | $items = esc_attr( $items ); |
| 1345 | 1345 | return "<button class='btn btn-primary getpaid-payment-button' type='button' data-item='$items'>$label</button>"; |
| 1346 | 1346 | } |
@@ -1526,21 +1526,21 @@ discard block |
||
| 1526 | 1526 | |
| 1527 | 1527 | return aui()->select( |
| 1528 | 1528 | array( |
| 1529 | - 'options' => $states, |
|
| 1530 | - 'name' => esc_attr( $field_name ), |
|
| 1531 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
| 1532 | - 'value' => sanitize_text_field( $state ), |
|
| 1533 | - 'placeholder' => $placeholder, |
|
| 1534 | - 'required' => $required, |
|
| 1535 | - 'label' => wp_kses_post( $label ), |
|
| 1536 | - 'label_type' => 'vertical', |
|
| 1537 | - 'help_text' => $help_text, |
|
| 1538 | - 'class' => 'getpaid-address-field wpinv_state', |
|
| 1539 | - 'wrap_class' => "$wrapper_class getpaid-address-field-wrapper__state", |
|
| 1540 | - 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__state', |
|
| 1541 | - 'extra_attributes' => array( |
|
| 1542 | - 'autocomplete' => 'address-level1', |
|
| 1543 | - ), |
|
| 1529 | + 'options' => $states, |
|
| 1530 | + 'name' => esc_attr( $field_name ), |
|
| 1531 | + 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
| 1532 | + 'value' => sanitize_text_field( $state ), |
|
| 1533 | + 'placeholder' => $placeholder, |
|
| 1534 | + 'required' => $required, |
|
| 1535 | + 'label' => wp_kses_post( $label ), |
|
| 1536 | + 'label_type' => 'vertical', |
|
| 1537 | + 'help_text' => $help_text, |
|
| 1538 | + 'class' => 'getpaid-address-field wpinv_state', |
|
| 1539 | + 'wrap_class' => "$wrapper_class getpaid-address-field-wrapper__state", |
|
| 1540 | + 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__state', |
|
| 1541 | + 'extra_attributes' => array( |
|
| 1542 | + 'autocomplete' => 'address-level1', |
|
| 1543 | + ), |
|
| 1544 | 1544 | ), |
| 1545 | 1545 | $echo |
| 1546 | 1546 | ); |
@@ -126,14 +126,14 @@ |
||
| 126 | 126 | */ |
| 127 | 127 | function getpaid_doing_it_wrong( $function, $message, $version ) { |
| 128 | 128 | |
| 129 | - $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); |
|
| 130 | - |
|
| 131 | - if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) { |
|
| 132 | - do_action( 'doing_it_wrong_run', $function, $message, $version ); |
|
| 133 | - error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); |
|
| 134 | - } else { |
|
| 135 | - _doing_it_wrong( esc_html( $function ), wp_kses_post( $message ), esc_html( $version ) ); |
|
| 136 | - } |
|
| 129 | + $message .= ' Backtrace: ' . wp_debug_backtrace_summary(); |
|
| 130 | + |
|
| 131 | + if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) { |
|
| 132 | + do_action( 'doing_it_wrong_run', $function, $message, $version ); |
|
| 133 | + error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." ); |
|
| 134 | + } else { |
|
| 135 | + _doing_it_wrong( esc_html( $function ), wp_kses_post( $message ), esc_html( $version ) ); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | |
@@ -12,49 +12,49 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | class GetPaid_Reports { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Class constructor. |
|
| 17 | - * |
|
| 18 | - */ |
|
| 19 | - public function __construct() { |
|
| 20 | - add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
| 21 | - add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
| 22 | - add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
| 23 | - add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
| 24 | - add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
| 25 | - |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Registers the reports page. |
|
| 30 | - * |
|
| 31 | - */ |
|
| 32 | - public function register_reports_page() { |
|
| 33 | - |
|
| 34 | - add_submenu_page( |
|
| 15 | + /** |
|
| 16 | + * Class constructor. |
|
| 17 | + * |
|
| 18 | + */ |
|
| 19 | + public function __construct() { |
|
| 20 | + add_action( 'admin_menu', array( $this, 'register_reports_page' ), 20 ); |
|
| 21 | + add_action( 'wpinv_reports_tab_reports', array( $this, 'display_reports_tab' ) ); |
|
| 22 | + add_action( 'wpinv_reports_tab_export', array( $this, 'display_exports_tab' ) ); |
|
| 23 | + add_action( 'getpaid_authenticated_admin_action_download_graph', array( $this, 'download_graph' ) ); |
|
| 24 | + add_action( 'getpaid_authenticated_admin_action_export_invoices', array( $this, 'export_invoices' ) ); |
|
| 25 | + |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Registers the reports page. |
|
| 30 | + * |
|
| 31 | + */ |
|
| 32 | + public function register_reports_page() { |
|
| 33 | + |
|
| 34 | + add_submenu_page( |
|
| 35 | 35 | 'wpinv', |
| 36 | 36 | __( 'Reports', 'invoicing' ), |
| 37 | 37 | __( 'Reports', 'invoicing' ), |
| 38 | 38 | wpinv_get_capability(), |
| 39 | 39 | 'wpinv-reports', |
| 40 | 40 | array( $this, 'display_reports_page' ) |
| 41 | - ); |
|
| 41 | + ); |
|
| 42 | 42 | |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Displays the reports page. |
|
| 47 | - * |
|
| 48 | - */ |
|
| 49 | - public function display_reports_page() { |
|
| 45 | + /** |
|
| 46 | + * Displays the reports page. |
|
| 47 | + * |
|
| 48 | + */ |
|
| 49 | + public function display_reports_page() { |
|
| 50 | 50 | |
| 51 | - // Prepare variables. |
|
| 52 | - $tabs = $this->get_tabs(); |
|
| 53 | - $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
| 54 | - $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
| 51 | + // Prepare variables. |
|
| 52 | + $tabs = $this->get_tabs(); |
|
| 53 | + $current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'reports'; |
|
| 54 | + $current_tab = array_key_exists( $current_tab, $tabs ) ? $current_tab : 'reports'; |
|
| 55 | 55 | |
| 56 | - // Display the current tab. |
|
| 57 | - ?> |
|
| 56 | + // Display the current tab. |
|
| 57 | + ?> |
|
| 58 | 58 | |
| 59 | 59 | <div class="wrap"> |
| 60 | 60 | |
@@ -63,19 +63,19 @@ discard block |
||
| 63 | 63 | <nav class="nav-tab-wrapper"> |
| 64 | 64 | |
| 65 | 65 | <?php |
| 66 | - foreach ( $tabs as $key => $label ) { |
|
| 66 | + foreach ( $tabs as $key => $label ) { |
|
| 67 | 67 | |
| 68 | - $key = sanitize_key( $key ); |
|
| 69 | - $label = esc_html( $label ); |
|
| 70 | - $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
| 71 | - $url = esc_url( |
|
| 68 | + $key = sanitize_key( $key ); |
|
| 69 | + $label = esc_html( $label ); |
|
| 70 | + $class = $key == $current_tab ? 'nav-tab nav-tab-active' : 'nav-tab'; |
|
| 71 | + $url = esc_url( |
|
| 72 | 72 | add_query_arg( 'tab', $key, admin_url( 'admin.php?page=wpinv-reports' ) ) |
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | - echo wp_kses_post( "\n\t\t\t<a href='$url' class='" . $class . "'>$label</a>" ); |
|
| 75 | + echo wp_kses_post( "\n\t\t\t<a href='$url' class='" . $class . "'>$label</a>" ); |
|
| 76 | 76 | |
| 77 | - } |
|
| 78 | - ?> |
|
| 77 | + } |
|
| 78 | + ?> |
|
| 79 | 79 | |
| 80 | 80 | </nav> |
| 81 | 81 | |
@@ -86,82 +86,82 @@ discard block |
||
| 86 | 86 | </div> |
| 87 | 87 | <?php |
| 88 | 88 | |
| 89 | - // Wordfence loads an unsupported version of chart js on our page. |
|
| 90 | - wp_deregister_style( 'chart-js' ); |
|
| 91 | - wp_deregister_script( 'chart-js' ); |
|
| 92 | - wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.min.js', array( 'jquery' ), '3.7.1', true ); |
|
| 89 | + // Wordfence loads an unsupported version of chart js on our page. |
|
| 90 | + wp_deregister_style( 'chart-js' ); |
|
| 91 | + wp_deregister_script( 'chart-js' ); |
|
| 92 | + wp_enqueue_script( 'chart-js', WPINV_PLUGIN_URL . 'assets/js/chart.min.js', array( 'jquery' ), '3.7.1', true ); |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Retrieves reports page tabs. |
|
| 98 | - * |
|
| 99 | - * @return array |
|
| 100 | - */ |
|
| 101 | - public function get_tabs() { |
|
| 96 | + /** |
|
| 97 | + * Retrieves reports page tabs. |
|
| 98 | + * |
|
| 99 | + * @return array |
|
| 100 | + */ |
|
| 101 | + public function get_tabs() { |
|
| 102 | 102 | |
| 103 | - $tabs = array( |
|
| 104 | - 'reports' => __( 'Reports', 'invoicing' ), |
|
| 105 | - 'export' => __( 'Export', 'invoicing' ), |
|
| 106 | - ); |
|
| 103 | + $tabs = array( |
|
| 104 | + 'reports' => __( 'Reports', 'invoicing' ), |
|
| 105 | + 'export' => __( 'Export', 'invoicing' ), |
|
| 106 | + ); |
|
| 107 | 107 | |
| 108 | - return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
| 109 | - } |
|
| 108 | + return apply_filters( 'getpaid_report_tabs', $tabs ); |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Displays the reports tab. |
|
| 113 | - * |
|
| 114 | - */ |
|
| 115 | - public function display_reports_tab() { |
|
| 111 | + /** |
|
| 112 | + * Displays the reports tab. |
|
| 113 | + * |
|
| 114 | + */ |
|
| 115 | + public function display_reports_tab() { |
|
| 116 | 116 | |
| 117 | - $reports = new GetPaid_Reports_Report(); |
|
| 118 | - $reports->display(); |
|
| 117 | + $reports = new GetPaid_Reports_Report(); |
|
| 118 | + $reports->display(); |
|
| 119 | 119 | |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Displays the exports tab. |
|
| 124 | - * |
|
| 125 | - */ |
|
| 126 | - public function display_exports_tab() { |
|
| 122 | + /** |
|
| 123 | + * Displays the exports tab. |
|
| 124 | + * |
|
| 125 | + */ |
|
| 126 | + public function display_exports_tab() { |
|
| 127 | 127 | |
| 128 | - $exports = new GetPaid_Reports_Export(); |
|
| 129 | - $exports->display(); |
|
| 128 | + $exports = new GetPaid_Reports_Export(); |
|
| 129 | + $exports->display(); |
|
| 130 | 130 | |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Donwnloads a graph. |
|
| 135 | - * |
|
| 136 | - * @param array $args |
|
| 137 | - */ |
|
| 138 | - public function download_graph( $args ) { |
|
| 133 | + /** |
|
| 134 | + * Donwnloads a graph. |
|
| 135 | + * |
|
| 136 | + * @param array $args |
|
| 137 | + */ |
|
| 138 | + public function download_graph( $args ) { |
|
| 139 | 139 | |
| 140 | - if ( ! empty( $args['graph'] ) ) { |
|
| 141 | - $downloader = new GetPaid_Graph_Downloader(); |
|
| 142 | - $downloader->download( $args['graph'] ); |
|
| 143 | - } |
|
| 140 | + if ( ! empty( $args['graph'] ) ) { |
|
| 141 | + $downloader = new GetPaid_Graph_Downloader(); |
|
| 142 | + $downloader->download( $args['graph'] ); |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - } |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - /** |
|
| 148 | - * Exports invoices. |
|
| 149 | - * |
|
| 150 | - * @param array $args |
|
| 151 | - */ |
|
| 152 | - public function export_invoices( $args ) { |
|
| 147 | + /** |
|
| 148 | + * Exports invoices. |
|
| 149 | + * |
|
| 150 | + * @param array $args |
|
| 151 | + */ |
|
| 152 | + public function export_invoices( $args ) { |
|
| 153 | 153 | |
| 154 | - if ( ! empty( $args['post_type'] ) ) { |
|
| 154 | + if ( ! empty( $args['post_type'] ) ) { |
|
| 155 | 155 | |
| 156 | - if ( 'subscriptions' === $args['post_type'] ) { |
|
| 157 | - $downloader = new GetPaid_Subscription_Exporter(); |
|
| 158 | - } else { |
|
| 159 | - $downloader = new GetPaid_Invoice_Exporter(); |
|
| 160 | - } |
|
| 156 | + if ( 'subscriptions' === $args['post_type'] ) { |
|
| 157 | + $downloader = new GetPaid_Subscription_Exporter(); |
|
| 158 | + } else { |
|
| 159 | + $downloader = new GetPaid_Invoice_Exporter(); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - $downloader->export( $args['post_type'], $args ); |
|
| 163 | - } |
|
| 162 | + $downloader->export( $args['post_type'], $args ); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - } |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | 167 | } |
@@ -12,218 +12,218 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class GetPaid_Graph_Downloader { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @var GetPaid_Reports_Report |
|
| 17 | - */ |
|
| 18 | - public $handler; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * Class constructor. |
|
| 22 | - * |
|
| 23 | - */ |
|
| 24 | - public function __construct() { |
|
| 25 | - $this->handler = new GetPaid_Reports_Report(); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Prepares the datastore handler. |
|
| 30 | - * |
|
| 31 | - * @return GetPaid_Reports_Report_Items|GetPaid_Reports_Report_Gateways|GetPaid_Reports_Report_Discounts |
|
| 32 | - */ |
|
| 33 | - public function prepare_handler( $graph ) { |
|
| 34 | - |
|
| 35 | - if ( empty( $this->handler->views[ $graph ] ) ) { |
|
| 36 | - wp_die( esc_html__( 'Invalid Graph', 'invoicing' ), 400 ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - return new $this->handler->views[ $graph ]['class'](); |
|
| 40 | - |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Prepares the output stream. |
|
| 45 | - * |
|
| 46 | - * @return resource |
|
| 47 | - */ |
|
| 48 | - public function prepare_output() { |
|
| 49 | - |
|
| 50 | - $output = fopen( 'php://output', 'w' ); |
|
| 51 | - |
|
| 52 | - if ( false === $output ) { |
|
| 53 | - wp_die( esc_html__( 'Unsupported server', 'invoicing' ), 500 ); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - return $output; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Prepares the file type. |
|
| 61 | - * |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 64 | - public function prepare_file_type( $graph ) { |
|
| 65 | - |
|
| 66 | - $file_type = empty( $_REQUEST['file_type'] ) ? 'csv' : sanitize_text_field( $_REQUEST['file_type'] ); |
|
| 67 | - $file_name = wpinv_sanitize_key( "getpaid-$graph-" . current_time( 'Y-m-d' ) ); |
|
| 68 | - |
|
| 69 | - header( "Content-Type:application/$file_type" ); |
|
| 70 | - header( "Content-Disposition:attachment;filename=$file_name.$file_type" ); |
|
| 71 | - |
|
| 72 | - return $file_type; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Handles the actual download. |
|
| 77 | - * |
|
| 78 | - */ |
|
| 79 | - public function download( $graph ) { |
|
| 80 | - global $wpdb; |
|
| 81 | - |
|
| 82 | - $handler = $this->prepare_handler( $graph ); |
|
| 83 | - $stream = $this->prepare_output(); |
|
| 84 | - $stats = $wpdb->get_results( $handler->get_sql( $handler->get_range() ) ); |
|
| 85 | - $headers = array( $handler->field, 'total', 'total_raw' ); |
|
| 86 | - $file_type = $this->prepare_file_type( $graph ); |
|
| 87 | - |
|
| 88 | - if ( 'csv' == $file_type ) { |
|
| 89 | - $this->download_csv( $stats, $stream, $headers ); |
|
| 90 | - } elseif ( 'xml' == $file_type ) { |
|
| 91 | - $this->download_xml( $stats, $stream, $headers ); |
|
| 92 | - } else { |
|
| 93 | - $this->download_json( $stats, $stream, $headers ); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - fclose( $stream ); |
|
| 97 | - exit; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Downloads graph as csv |
|
| 102 | - * |
|
| 103 | - * @param array $stats The stats being downloaded. |
|
| 104 | - * @param resource $stream The stream to output to. |
|
| 105 | - * @param array $headers The fields to stream. |
|
| 106 | - * @since 1.0.19 |
|
| 107 | - */ |
|
| 108 | - public function download_csv( $stats, $stream, $headers ) { |
|
| 109 | - |
|
| 110 | - // Output the csv column headers. |
|
| 111 | - fputcsv( $stream, $headers ); |
|
| 112 | - |
|
| 113 | - // Loop through |
|
| 114 | - foreach ( $stats as $stat ) { |
|
| 115 | - $row = array_values( $this->prepare_row( $stat, $headers ) ); |
|
| 116 | - $row = array_map( 'maybe_serialize', $row ); |
|
| 117 | - fputcsv( $stream, $row ); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Downloads graph as json |
|
| 124 | - * |
|
| 125 | - * @param array $stats The stats being downloaded. |
|
| 126 | - * @param resource $stream The stream to output to. |
|
| 127 | - * @param array $headers The fields to stream. |
|
| 128 | - * @since 1.0.19 |
|
| 129 | - */ |
|
| 130 | - public function download_json( $stats, $stream, $headers ) { |
|
| 131 | - |
|
| 132 | - $prepared = array(); |
|
| 133 | - |
|
| 134 | - // Loop through |
|
| 135 | - foreach ( $stats as $stat ) { |
|
| 136 | - $prepared[] = $this->prepare_row( $stat, $headers ); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - fwrite( $stream, wp_json_encode( $prepared ) ); |
|
| 140 | - |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Downloads graph as xml |
|
| 145 | - * |
|
| 146 | - * @param array $stats The stats being downloaded. |
|
| 147 | - * @param resource $stream The stream to output to. |
|
| 148 | - * @param array $headers The fields to stream. |
|
| 149 | - * @since 1.0.19 |
|
| 150 | - */ |
|
| 151 | - public function download_xml( $stats, $stream, $headers ) { |
|
| 152 | - |
|
| 153 | - $prepared = array(); |
|
| 154 | - |
|
| 155 | - // Loop through |
|
| 156 | - foreach ( $stats as $stat ) { |
|
| 157 | - $prepared[] = $this->prepare_row( $stat, $headers ); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - $xml = new SimpleXMLElement( '<?xml version="1.0"?><data></data>' ); |
|
| 161 | - $this->convert_array_xml( $prepared, $xml ); |
|
| 162 | - |
|
| 163 | - fwrite( $stream, $xml->asXML() ); |
|
| 164 | - |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * Converts stats array to xml |
|
| 169 | - * |
|
| 170 | - * @access public |
|
| 171 | - * @since 1.0.19 |
|
| 172 | - */ |
|
| 173 | - public function convert_array_xml( $data, $xml ) { |
|
| 174 | - |
|
| 175 | - // Loop through |
|
| 176 | - foreach ( $data as $key => $value ) { |
|
| 177 | - |
|
| 178 | - $key = preg_replace( '/[^A-Za-z0-9_\-]/', '', $key ); |
|
| 179 | - |
|
| 180 | - if ( is_array( $value ) ) { |
|
| 181 | - |
|
| 182 | - if ( is_numeric( $key ) ) { |
|
| 183 | - $key = 'item' . $key; //dealing with <0/>..<n/> issues |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - $subnode = $xml->addChild( $key ); |
|
| 187 | - $this->convert_array_xml( $value, $subnode ); |
|
| 188 | - |
|
| 189 | - } else { |
|
| 190 | - $xml->addChild( $key, htmlspecialchars( $value ) ); |
|
| 191 | - } |
|
| 15 | + /** |
|
| 16 | + * @var GetPaid_Reports_Report |
|
| 17 | + */ |
|
| 18 | + public $handler; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * Class constructor. |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | + public function __construct() { |
|
| 25 | + $this->handler = new GetPaid_Reports_Report(); |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Prepares the datastore handler. |
|
| 30 | + * |
|
| 31 | + * @return GetPaid_Reports_Report_Items|GetPaid_Reports_Report_Gateways|GetPaid_Reports_Report_Discounts |
|
| 32 | + */ |
|
| 33 | + public function prepare_handler( $graph ) { |
|
| 34 | + |
|
| 35 | + if ( empty( $this->handler->views[ $graph ] ) ) { |
|
| 36 | + wp_die( esc_html__( 'Invalid Graph', 'invoicing' ), 400 ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + return new $this->handler->views[ $graph ]['class'](); |
|
| 40 | + |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Prepares the output stream. |
|
| 45 | + * |
|
| 46 | + * @return resource |
|
| 47 | + */ |
|
| 48 | + public function prepare_output() { |
|
| 49 | + |
|
| 50 | + $output = fopen( 'php://output', 'w' ); |
|
| 51 | + |
|
| 52 | + if ( false === $output ) { |
|
| 53 | + wp_die( esc_html__( 'Unsupported server', 'invoicing' ), 500 ); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + return $output; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Prepares the file type. |
|
| 61 | + * |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | + public function prepare_file_type( $graph ) { |
|
| 65 | + |
|
| 66 | + $file_type = empty( $_REQUEST['file_type'] ) ? 'csv' : sanitize_text_field( $_REQUEST['file_type'] ); |
|
| 67 | + $file_name = wpinv_sanitize_key( "getpaid-$graph-" . current_time( 'Y-m-d' ) ); |
|
| 68 | + |
|
| 69 | + header( "Content-Type:application/$file_type" ); |
|
| 70 | + header( "Content-Disposition:attachment;filename=$file_name.$file_type" ); |
|
| 71 | + |
|
| 72 | + return $file_type; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Handles the actual download. |
|
| 77 | + * |
|
| 78 | + */ |
|
| 79 | + public function download( $graph ) { |
|
| 80 | + global $wpdb; |
|
| 81 | + |
|
| 82 | + $handler = $this->prepare_handler( $graph ); |
|
| 83 | + $stream = $this->prepare_output(); |
|
| 84 | + $stats = $wpdb->get_results( $handler->get_sql( $handler->get_range() ) ); |
|
| 85 | + $headers = array( $handler->field, 'total', 'total_raw' ); |
|
| 86 | + $file_type = $this->prepare_file_type( $graph ); |
|
| 87 | + |
|
| 88 | + if ( 'csv' == $file_type ) { |
|
| 89 | + $this->download_csv( $stats, $stream, $headers ); |
|
| 90 | + } elseif ( 'xml' == $file_type ) { |
|
| 91 | + $this->download_xml( $stats, $stream, $headers ); |
|
| 92 | + } else { |
|
| 93 | + $this->download_json( $stats, $stream, $headers ); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + fclose( $stream ); |
|
| 97 | + exit; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Downloads graph as csv |
|
| 102 | + * |
|
| 103 | + * @param array $stats The stats being downloaded. |
|
| 104 | + * @param resource $stream The stream to output to. |
|
| 105 | + * @param array $headers The fields to stream. |
|
| 106 | + * @since 1.0.19 |
|
| 107 | + */ |
|
| 108 | + public function download_csv( $stats, $stream, $headers ) { |
|
| 109 | + |
|
| 110 | + // Output the csv column headers. |
|
| 111 | + fputcsv( $stream, $headers ); |
|
| 112 | + |
|
| 113 | + // Loop through |
|
| 114 | + foreach ( $stats as $stat ) { |
|
| 115 | + $row = array_values( $this->prepare_row( $stat, $headers ) ); |
|
| 116 | + $row = array_map( 'maybe_serialize', $row ); |
|
| 117 | + fputcsv( $stream, $row ); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Downloads graph as json |
|
| 124 | + * |
|
| 125 | + * @param array $stats The stats being downloaded. |
|
| 126 | + * @param resource $stream The stream to output to. |
|
| 127 | + * @param array $headers The fields to stream. |
|
| 128 | + * @since 1.0.19 |
|
| 129 | + */ |
|
| 130 | + public function download_json( $stats, $stream, $headers ) { |
|
| 131 | + |
|
| 132 | + $prepared = array(); |
|
| 133 | + |
|
| 134 | + // Loop through |
|
| 135 | + foreach ( $stats as $stat ) { |
|
| 136 | + $prepared[] = $this->prepare_row( $stat, $headers ); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + fwrite( $stream, wp_json_encode( $prepared ) ); |
|
| 140 | + |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Downloads graph as xml |
|
| 145 | + * |
|
| 146 | + * @param array $stats The stats being downloaded. |
|
| 147 | + * @param resource $stream The stream to output to. |
|
| 148 | + * @param array $headers The fields to stream. |
|
| 149 | + * @since 1.0.19 |
|
| 150 | + */ |
|
| 151 | + public function download_xml( $stats, $stream, $headers ) { |
|
| 152 | + |
|
| 153 | + $prepared = array(); |
|
| 154 | + |
|
| 155 | + // Loop through |
|
| 156 | + foreach ( $stats as $stat ) { |
|
| 157 | + $prepared[] = $this->prepare_row( $stat, $headers ); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + $xml = new SimpleXMLElement( '<?xml version="1.0"?><data></data>' ); |
|
| 161 | + $this->convert_array_xml( $prepared, $xml ); |
|
| 162 | + |
|
| 163 | + fwrite( $stream, $xml->asXML() ); |
|
| 164 | + |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * Converts stats array to xml |
|
| 169 | + * |
|
| 170 | + * @access public |
|
| 171 | + * @since 1.0.19 |
|
| 172 | + */ |
|
| 173 | + public function convert_array_xml( $data, $xml ) { |
|
| 174 | + |
|
| 175 | + // Loop through |
|
| 176 | + foreach ( $data as $key => $value ) { |
|
| 177 | + |
|
| 178 | + $key = preg_replace( '/[^A-Za-z0-9_\-]/', '', $key ); |
|
| 179 | + |
|
| 180 | + if ( is_array( $value ) ) { |
|
| 181 | + |
|
| 182 | + if ( is_numeric( $key ) ) { |
|
| 183 | + $key = 'item' . $key; //dealing with <0/>..<n/> issues |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + $subnode = $xml->addChild( $key ); |
|
| 187 | + $this->convert_array_xml( $value, $subnode ); |
|
| 188 | + |
|
| 189 | + } else { |
|
| 190 | + $xml->addChild( $key, htmlspecialchars( $value ) ); |
|
| 191 | + } |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - } |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - /** |
|
| 197 | - * Prepares a single row for download. |
|
| 198 | - * |
|
| 199 | - * @param stdClass|array $row The row to prepare.. |
|
| 200 | - * @param array $fields The fields to stream. |
|
| 201 | - * @since 1.0.19 |
|
| 202 | - * @return array |
|
| 203 | - */ |
|
| 204 | - public function prepare_row( $row, $fields ) { |
|
| 196 | + /** |
|
| 197 | + * Prepares a single row for download. |
|
| 198 | + * |
|
| 199 | + * @param stdClass|array $row The row to prepare.. |
|
| 200 | + * @param array $fields The fields to stream. |
|
| 201 | + * @since 1.0.19 |
|
| 202 | + * @return array |
|
| 203 | + */ |
|
| 204 | + public function prepare_row( $row, $fields ) { |
|
| 205 | 205 | |
| 206 | - $prepared = array(); |
|
| 207 | - $row = (array) $row; |
|
| 206 | + $prepared = array(); |
|
| 207 | + $row = (array) $row; |
|
| 208 | 208 | |
| 209 | - foreach ( $fields as $field ) { |
|
| 209 | + foreach ( $fields as $field ) { |
|
| 210 | 210 | |
| 211 | - if ( $field === 'total' ) { |
|
| 212 | - $prepared[ $field ] = html_entity_decode( strip_tags( wpinv_price( $row['total'] ) ), ENT_QUOTES ); |
|
| 213 | - continue; |
|
| 214 | - } |
|
| 211 | + if ( $field === 'total' ) { |
|
| 212 | + $prepared[ $field ] = html_entity_decode( strip_tags( wpinv_price( $row['total'] ) ), ENT_QUOTES ); |
|
| 213 | + continue; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - if ( $field === 'total_raw' ) { |
|
| 217 | - $prepared[ $field ] = wpinv_round_amount( wpinv_sanitize_amount( $row['total'] ) ); |
|
| 218 | - continue; |
|
| 219 | - } |
|
| 216 | + if ( $field === 'total_raw' ) { |
|
| 217 | + $prepared[ $field ] = wpinv_round_amount( wpinv_sanitize_amount( $row['total'] ) ); |
|
| 218 | + continue; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - $prepared[ $field ] = strip_tags( $row[ $field ] ); |
|
| 221 | + $prepared[ $field ] = strip_tags( $row[ $field ] ); |
|
| 222 | 222 | |
| 223 | - } |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | - return $prepared; |
|
| 226 | - } |
|
| 225 | + return $prepared; |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | } |
@@ -42,92 +42,92 @@ discard block |
||
| 42 | 42 | <tr class="wpinv-item wpinv-item-<?php echo esc_attr( $invoice->get_status() ); ?>"> |
| 43 | 43 | <?php |
| 44 | 44 | |
| 45 | - foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
| 45 | + foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
| 46 | 46 | |
| 47 | - $column_id = sanitize_html_class( $column_id ); |
|
| 48 | - $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
| 47 | + $column_id = sanitize_html_class( $column_id ); |
|
| 48 | + $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
| 49 | 49 | |
| 50 | - echo "<td class='" . esc_attr( $column_id . ' ' . $class ) . "'>"; |
|
| 51 | - switch ( $column_id ) { |
|
| 50 | + echo "<td class='" . esc_attr( $column_id . ' ' . $class ) . "'>"; |
|
| 51 | + switch ( $column_id ) { |
|
| 52 | 52 | |
| 53 | - case 'invoice-number': |
|
| 54 | - echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
| 55 | - break; |
|
| 53 | + case 'invoice-number': |
|
| 54 | + echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
| 55 | + break; |
|
| 56 | 56 | |
| 57 | - case 'created-date': |
|
| 58 | - echo esc_html( getpaid_format_date_value( $invoice->get_date_created() ) ); |
|
| 59 | - break; |
|
| 57 | + case 'created-date': |
|
| 58 | + echo esc_html( getpaid_format_date_value( $invoice->get_date_created() ) ); |
|
| 59 | + break; |
|
| 60 | 60 | |
| 61 | - case 'payment-date': |
|
| 62 | - if ( $invoice->needs_payment() ) { |
|
| 63 | - echo '—'; |
|
| 64 | - } else { |
|
| 65 | - echo esc_html( getpaid_format_date_value( $invoice->get_date_completed() ) ); |
|
| 66 | - } |
|
| 61 | + case 'payment-date': |
|
| 62 | + if ( $invoice->needs_payment() ) { |
|
| 63 | + echo '—'; |
|
| 64 | + } else { |
|
| 65 | + echo esc_html( getpaid_format_date_value( $invoice->get_date_completed() ) ); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - break; |
|
| 68 | + break; |
|
| 69 | 69 | |
| 70 | - case 'invoice-status': |
|
| 71 | - echo wp_kses_post( $invoice->get_status_label_html() ); |
|
| 70 | + case 'invoice-status': |
|
| 71 | + echo wp_kses_post( $invoice->get_status_label_html() ); |
|
| 72 | 72 | |
| 73 | - break; |
|
| 73 | + break; |
|
| 74 | 74 | |
| 75 | - case 'invoice-total': |
|
| 76 | - wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
| 75 | + case 'invoice-total': |
|
| 76 | + wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
| 77 | 77 | |
| 78 | - break; |
|
| 78 | + break; |
|
| 79 | 79 | |
| 80 | - case 'invoice-actions': |
|
| 81 | - $actions = array( |
|
| 80 | + case 'invoice-actions': |
|
| 81 | + $actions = array( |
|
| 82 | 82 | |
| 83 | - 'pay' => array( |
|
| 84 | - 'url' => $invoice->get_checkout_payment_url(), |
|
| 85 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
| 86 | - 'class' => 'btn-success', |
|
| 87 | - ), |
|
| 83 | + 'pay' => array( |
|
| 84 | + 'url' => $invoice->get_checkout_payment_url(), |
|
| 85 | + 'name' => __( 'Pay Now', 'invoicing' ), |
|
| 86 | + 'class' => 'btn-success', |
|
| 87 | + ), |
|
| 88 | 88 | |
| 89 | - 'print' => array( |
|
| 90 | - 'url' => $invoice->get_view_url(), |
|
| 91 | - 'name' => __( 'View', 'invoicing' ), |
|
| 92 | - 'class' => 'btn-secondary', |
|
| 93 | - 'attrs' => 'target="_blank"', |
|
| 94 | - ), |
|
| 95 | - ); |
|
| 89 | + 'print' => array( |
|
| 90 | + 'url' => $invoice->get_view_url(), |
|
| 91 | + 'name' => __( 'View', 'invoicing' ), |
|
| 92 | + 'class' => 'btn-secondary', |
|
| 93 | + 'attrs' => 'target="_blank"', |
|
| 94 | + ), |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | - if ( ! $invoice->needs_payment() ) { |
|
| 98 | - unset( $actions['pay'] ); |
|
| 99 | - } |
|
| 97 | + if ( ! $invoice->needs_payment() ) { |
|
| 98 | + unset( $actions['pay'] ); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - if ( $invoice->needs_payment() ) { |
|
| 102 | - $actions['delete'] = array( |
|
| 103 | - 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
| 104 | - 'name' => __( 'Delete', 'invoicing' ), |
|
| 105 | - 'class' => 'btn-danger', |
|
| 106 | - ); |
|
| 107 | - } |
|
| 101 | + if ( $invoice->needs_payment() ) { |
|
| 102 | + $actions['delete'] = array( |
|
| 103 | + 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
| 104 | + 'name' => __( 'Delete', 'invoicing' ), |
|
| 105 | + 'class' => 'btn-danger', |
|
| 106 | + ); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
| 109 | + $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
| 110 | 110 | |
| 111 | - foreach ( $actions as $key => $action ) { |
|
| 112 | - $class = ! empty( $action['class'] ) ? sanitize_html_class( $action['class'] ) : ''; |
|
| 113 | - echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . esc_attr( $class . ' ' . sanitize_html_class( $key ) ) . '" ' . ( ! empty( $action['attrs'] ) ? esc_html( $action['attrs'] ) : '' ) . '>' . esc_attr( $action['name'] ) . '</a>'; |
|
| 114 | - } |
|
| 111 | + foreach ( $actions as $key => $action ) { |
|
| 112 | + $class = ! empty( $action['class'] ) ? sanitize_html_class( $action['class'] ) : ''; |
|
| 113 | + echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . esc_attr( $class . ' ' . sanitize_html_class( $key ) ) . '" ' . ( ! empty( $action['attrs'] ) ? esc_html( $action['attrs'] ) : '' ) . '>' . esc_attr( $action['name'] ) . '</a>'; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - break; |
|
| 116 | + break; |
|
| 117 | 117 | |
| 118 | - default: |
|
| 119 | - do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
| 120 | - break; |
|
| 118 | + default: |
|
| 119 | + do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
| 120 | + break; |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
| 125 | + do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
| 126 | 126 | |
| 127 | - echo '</td>'; |
|
| 127 | + echo '</td>'; |
|
| 128 | 128 | |
| 129 | - endforeach; |
|
| 130 | - ?> |
|
| 129 | + endforeach; |
|
| 130 | + ?> |
|
| 131 | 131 | </tr> |
| 132 | 132 | |
| 133 | 133 | <?php endforeach; ?> |
@@ -141,18 +141,18 @@ discard block |
||
| 141 | 141 | <?php if ( 1 < $invoices->max_num_pages ) : ?> |
| 142 | 142 | <div class="invoicing-Pagination"> |
| 143 | 143 | <?php |
| 144 | - $big = 999999; |
|
| 145 | - |
|
| 146 | - echo wp_kses_post( |
|
| 147 | - paginate_links( |
|
| 148 | - array( |
|
| 149 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
| 150 | - 'format' => '?paged=%#%', |
|
| 151 | - 'total' => $invoices->max_num_pages, |
|
| 152 | - ) |
|
| 153 | - ) |
|
| 144 | + $big = 999999; |
|
| 145 | + |
|
| 146 | + echo wp_kses_post( |
|
| 147 | + paginate_links( |
|
| 148 | + array( |
|
| 149 | + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
| 150 | + 'format' => '?paged=%#%', |
|
| 151 | + 'total' => $invoices->max_num_pages, |
|
| 152 | + ) |
|
| 153 | + ) |
|
| 154 | 154 | ); |
| 155 | - ?> |
|
| 155 | + ?> |
|
| 156 | 156 | </div> |
| 157 | 157 | <?php endif; ?> |
| 158 | 158 | |