@@ -1,72 +1,72 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | 6 | global $wpinv_euvat; |
| 7 | 7 | |
| 8 | -$sent_to_admin = !empty( $sent_to_admin ) ? true : false; |
|
| 9 | -if ( $sent_to_admin ) { |
|
| 10 | - $invoice_url = get_edit_post_link( $invoice->ID ); |
|
| 8 | +$sent_to_admin = !empty($sent_to_admin) ? true : false; |
|
| 9 | +if ($sent_to_admin) { |
|
| 10 | + $invoice_url = get_edit_post_link($invoice->ID); |
|
| 11 | 11 | } else { |
| 12 | - $secret = !empty( $email_type ) && $email_type == 'user_invoice' ? true : false; |
|
| 13 | - $invoice_url = $invoice->get_view_url( $secret ); |
|
| 12 | + $secret = !empty($email_type) && $email_type == 'user_invoice' ? true : false; |
|
| 13 | + $invoice_url = $invoice->get_view_url($secret); |
|
| 14 | 14 | } |
| 15 | 15 | $use_taxes = wpinv_use_taxes(); |
| 16 | 16 | $vat_name = $wpinv_euvat->get_vat_name(); |
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_before_invoice_details', $invoice, $sent_to_admin ); ?> |
|
| 18 | +do_action('wpinv_email_before_invoice_details', $invoice, $sent_to_admin); ?> |
|
| 19 | 19 | <div id="wpinv-email-details"> |
| 20 | - <h3 class="wpinv-details-t"><?php echo apply_filters( 'wpinv_email_details_title', __( 'Invoice Details', 'invoicing' ) ); ?></h3> |
|
| 20 | + <h3 class="wpinv-details-t"><?php echo apply_filters('wpinv_email_details_title', __('Invoice Details', 'invoicing')); ?></h3> |
|
| 21 | 21 | <table class="table table-bordered table-sm"> |
| 22 | - <?php if ( $invoice_number = $invoice->get_number() ) { ?> |
|
| 22 | + <?php if ($invoice_number = $invoice->get_number()) { ?> |
|
| 23 | 23 | <tr> |
| 24 | - <td><?php echo apply_filters( 'wpinv_email_details_number', __( 'Invoice Number', 'invoicing' ), $invoice ); ?></td> |
|
| 25 | - <td><a href="<?php echo esc_url( $invoice_url ) ;?>"><?php echo $invoice_number; ?></a></td> |
|
| 24 | + <td><?php echo apply_filters('wpinv_email_details_number', __('Invoice Number', 'invoicing'), $invoice); ?></td> |
|
| 25 | + <td><a href="<?php echo esc_url($invoice_url); ?>"><?php echo $invoice_number; ?></a></td> |
|
| 26 | 26 | </tr> |
| 27 | 27 | <?php } ?> |
| 28 | 28 | <tr> |
| 29 | - <td><?php echo apply_filters( 'wpinv_email_details_status', __( 'Invoice Status', 'invoicing' ), $invoice ); ?></td> |
|
| 30 | - <td><?php echo $invoice->get_status( true ); ?></td> |
|
| 29 | + <td><?php echo apply_filters('wpinv_email_details_status', __('Invoice Status', 'invoicing'), $invoice); ?></td> |
|
| 30 | + <td><?php echo $invoice->get_status(true); ?></td> |
|
| 31 | 31 | </tr> |
| 32 | - <?php if ( $invoice->is_renewal() ) { ?> |
|
| 32 | + <?php if ($invoice->is_renewal()) { ?> |
|
| 33 | 33 | <tr> |
| 34 | - <td><?php _e( 'Parent Invoice', 'invoicing' ); ?></td> |
|
| 35 | - <td><?php echo wpinv_invoice_link( $invoice->parent_invoice ); ?></td> |
|
| 34 | + <td><?php _e('Parent Invoice', 'invoicing'); ?></td> |
|
| 35 | + <td><?php echo wpinv_invoice_link($invoice->parent_invoice); ?></td> |
|
| 36 | 36 | </tr> |
| 37 | 37 | <?php } ?> |
| 38 | 38 | <tr> |
| 39 | - <td><?php _e( 'Payment Method', 'invoicing' ); ?></td> |
|
| 39 | + <td><?php _e('Payment Method', 'invoicing'); ?></td> |
|
| 40 | 40 | <td><?php echo $invoice->get_gateway_title(); ?></td> |
| 41 | 41 | </tr> |
| 42 | - <?php if ( $invoice_date = $invoice->get_invoice_date( false ) ) { ?> |
|
| 42 | + <?php if ($invoice_date = $invoice->get_invoice_date(false)) { ?> |
|
| 43 | 43 | <tr> |
| 44 | - <td><?php echo apply_filters( 'wpinv_email_details_date', __( 'Invoice Date', 'invoicing' ), $invoice ); ?></td> |
|
| 45 | - <td><?php echo wp_sprintf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $invoice_date ) ), $invoice->get_invoice_date() ); ?></td> |
|
| 44 | + <td><?php echo apply_filters('wpinv_email_details_date', __('Invoice Date', 'invoicing'), $invoice); ?></td> |
|
| 45 | + <td><?php echo wp_sprintf('<time datetime="%s">%s</time>', date_i18n('c', strtotime($invoice_date)), $invoice->get_invoice_date()); ?></td> |
|
| 46 | 46 | </tr> |
| 47 | 47 | <?php } ?> |
| 48 | - <?php if ( wpinv_get_option( 'overdue_active' ) && $invoice->needs_payment() && ( $due_date = $invoice->get_due_date() ) ) { ?> |
|
| 48 | + <?php if (wpinv_get_option('overdue_active') && $invoice->needs_payment() && ($due_date = $invoice->get_due_date())) { ?> |
|
| 49 | 49 | <tr> |
| 50 | - <td><?php _e( 'Due Date', 'invoicing' ); ?></td> |
|
| 51 | - <td><?php echo wp_sprintf( '<time datetime="%s">%s</time>', date_i18n( 'c', strtotime( $due_date ) ), $invoice->get_due_date( true ) ); ?></td> |
|
| 50 | + <td><?php _e('Due Date', 'invoicing'); ?></td> |
|
| 51 | + <td><?php echo wp_sprintf('<time datetime="%s">%s</time>', date_i18n('c', strtotime($due_date)), $invoice->get_due_date(true)); ?></td> |
|
| 52 | 52 | </tr> |
| 53 | 53 | <?php } ?> |
| 54 | - <?php if ( empty( $sent_to_admin ) && $owner_vat_number = $wpinv_euvat->get_vat_number() ) { ?> |
|
| 54 | + <?php if (empty($sent_to_admin) && $owner_vat_number = $wpinv_euvat->get_vat_number()) { ?> |
|
| 55 | 55 | <tr> |
| 56 | - <td><?php echo wp_sprintf( __( 'Owner %s Number', 'invoicing' ), $vat_name ); ?></td> |
|
| 56 | + <td><?php echo wp_sprintf(__('Owner %s Number', 'invoicing'), $vat_name); ?></td> |
|
| 57 | 57 | <td><?php echo $owner_vat_number; ?></td> |
| 58 | 58 | </tr> |
| 59 | 59 | <?php } ?> |
| 60 | - <?php if ( $use_taxes && $user_vat_number = $invoice->vat_number ) { ?> |
|
| 60 | + <?php if ($use_taxes && $user_vat_number = $invoice->vat_number) { ?> |
|
| 61 | 61 | <tr> |
| 62 | - <td><?php echo wp_sprintf( __( 'Invoice %s Number', 'invoicing' ), $vat_name ); ?></td> |
|
| 62 | + <td><?php echo wp_sprintf(__('Invoice %s Number', 'invoicing'), $vat_name); ?></td> |
|
| 63 | 63 | <td><?php echo $user_vat_number; ?></td> |
| 64 | 64 | </tr> |
| 65 | 65 | <?php } ?> |
| 66 | 66 | <tr class="table-active"> |
| 67 | - <td><strong><?php _e( 'Total Amount', 'invoicing' ) ?></strong></td> |
|
| 68 | - <td><strong><?php echo $invoice->get_total( true ); ?></strong></td> |
|
| 67 | + <td><strong><?php _e('Total Amount', 'invoicing') ?></strong></td> |
|
| 68 | + <td><strong><?php echo $invoice->get_total(true); ?></strong></td> |
|
| 69 | 69 | </tr> |
| 70 | 70 | </table> |
| 71 | 71 | </div> |
| 72 | -<?php do_action( 'wpinv_email_after_invoice_details', $invoice, $sent_to_admin ); ?> |
|
| 73 | 72 | \ No newline at end of file |
| 73 | +<?php do_action('wpinv_email_after_invoice_details', $invoice, $sent_to_admin); ?> |
|
| 74 | 74 | \ No newline at end of file |
@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // don't load directly |
| 3 | -if ( !defined('ABSPATH') ) |
|
| 3 | +if (!defined('ABSPATH')) |
|
| 4 | 4 | die('-1'); |
| 5 | 5 | |
| 6 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
| 6 | +do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin); |
|
| 7 | 7 | |
| 8 | -do_action( 'wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
| 8 | +do_action('wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
| 9 | 9 | |
| 10 | -do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin ); |
|
| 10 | +do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin); |
|
| 11 | 11 | |
| 12 | -do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin ); |
|
| 12 | +do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin); |
|
| 13 | 13 | |
| 14 | -do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin ); |
|
| 14 | +do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin); |
|
| 15 | 15 | |
| 16 | -do_action( 'wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note ); |
|
| 16 | +do_action('wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note); |
|
| 17 | 17 | |
| 18 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
| 19 | 18 | \ No newline at end of file |
| 19 | +do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin); |
|
| 20 | 20 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
@@ -14,73 +14,73 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function init() { |
| 17 | - do_action( 'wpinv_class_notes_init', $this ); |
|
| 17 | + do_action('wpinv_class_notes_init', $this); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function includes() { |
| 21 | - do_action( 'wpinv_class_notes_includes', $this ); |
|
| 21 | + do_action('wpinv_class_notes_includes', $this); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function actions() { |
| 25 | 25 | // Secure inovice notes |
| 26 | - add_action( 'pre_get_comments', array( $this, 'set_invoice_note_type' ), 11, 1 ); |
|
| 26 | + add_action('pre_get_comments', array($this, 'set_invoice_note_type'), 11, 1); |
|
| 27 | 27 | |
| 28 | 28 | // Count comments |
| 29 | - add_filter( 'wp_count_comments', array( $this, 'wp_count_comments' ), 11, 2 ); |
|
| 29 | + add_filter('wp_count_comments', array($this, 'wp_count_comments'), 11, 2); |
|
| 30 | 30 | |
| 31 | 31 | // Delete comments count cache whenever there is a new comment or a comment status changes |
| 32 | - add_action( 'wp_insert_comment', array( $this, 'delete_comments_count_cache' ) ); |
|
| 33 | - add_action( 'wp_set_comment_status', array( $this, 'delete_comments_count_cache' ) ); |
|
| 32 | + add_action('wp_insert_comment', array($this, 'delete_comments_count_cache')); |
|
| 33 | + add_action('wp_set_comment_status', array($this, 'delete_comments_count_cache')); |
|
| 34 | 34 | |
| 35 | - do_action( 'wpinv_class_notes_actions', $this ); |
|
| 35 | + do_action('wpinv_class_notes_actions', $this); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function set_invoice_note_type( $query ) { |
|
| 39 | - $post_ID = !empty( $query->query_vars['post_ID'] ) ? $query->query_vars['post_ID'] : $query->query_vars['post_id']; |
|
| 38 | + public function set_invoice_note_type($query) { |
|
| 39 | + $post_ID = !empty($query->query_vars['post_ID']) ? $query->query_vars['post_ID'] : $query->query_vars['post_id']; |
|
| 40 | 40 | |
| 41 | - if ( $post_ID && in_array(get_post_type( $post_ID ), array($this->invoice_post_type, 'wpi_quote' )) ) { |
|
| 41 | + if ($post_ID && in_array(get_post_type($post_ID), array($this->invoice_post_type, 'wpi_quote'))) { |
|
| 42 | 42 | $query->query_vars['type__in'] = $this->comment_type; |
| 43 | 43 | $query->query_vars['type__not_in'] = ''; |
| 44 | 44 | } else { |
| 45 | - if ( isset( $query->query_vars['type__in'] ) && $type_in = $query->query_vars['type__in'] ) { |
|
| 46 | - if ( is_array( $type_in ) && in_array( $this->comment_type, $type_in ) ) { |
|
| 47 | - $key = array_search( $this->comment_type, $type_in ); |
|
| 48 | - unset( $query->query_vars['type__in'][$key] ); |
|
| 49 | - } else if ( !is_array( $type_in ) && $type_in == $this->comment_type ) { |
|
| 45 | + if (isset($query->query_vars['type__in']) && $type_in = $query->query_vars['type__in']) { |
|
| 46 | + if (is_array($type_in) && in_array($this->comment_type, $type_in)) { |
|
| 47 | + $key = array_search($this->comment_type, $type_in); |
|
| 48 | + unset($query->query_vars['type__in'][$key]); |
|
| 49 | + } else if (!is_array($type_in) && $type_in == $this->comment_type) { |
|
| 50 | 50 | $query->query_vars['type__in'] = ''; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if ( isset( $query->query_vars['type__not_in'] ) && $type_not_in = $query->query_vars['type__not_in'] ) { |
|
| 55 | - if ( is_array( $type_not_in ) && !in_array( $this->comment_type, $type_not_in ) ) { |
|
| 54 | + if (isset($query->query_vars['type__not_in']) && $type_not_in = $query->query_vars['type__not_in']) { |
|
| 55 | + if (is_array($type_not_in) && !in_array($this->comment_type, $type_not_in)) { |
|
| 56 | 56 | $query->query_vars['type__not_in'][] = $this->comment_type; |
| 57 | - } else if ( !is_array( $type_not_in ) && $type_not_in != $this->comment_type ) { |
|
| 57 | + } else if (!is_array($type_not_in) && $type_not_in != $this->comment_type) { |
|
| 58 | 58 | $query->query_vars['type__not_in'] = (array)$query->query_vars['type__not_in']; |
| 59 | 59 | $query->query_vars['type__not_in'][] = $this->comment_type; |
| 60 | 60 | } |
| 61 | 61 | } else { |
| 62 | - $query->query_vars['type__not_in'] = $this->comment_type; |
|
| 62 | + $query->query_vars['type__not_in'] = $this->comment_type; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $query; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function get_invoice_notes( $invoice_id = 0, $type = '' ) { |
|
| 69 | + public function get_invoice_notes($invoice_id = 0, $type = '') { |
|
| 70 | 70 | $args = array( |
| 71 | 71 | 'post_id' => $invoice_id, |
| 72 | 72 | 'orderby' => 'comment_ID', |
| 73 | 73 | 'order' => 'ASC', |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - if ( $type == 'customer' ) { |
|
| 76 | + if ($type == 'customer') { |
|
| 77 | 77 | $args['meta_key'] = '_wpi_customer_note'; |
| 78 | 78 | $args['meta_value'] = 1; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $args = apply_filters( 'wpinv_invoice_notes_args', $args, $this, $invoice_id, $type ); |
|
| 81 | + $args = apply_filters('wpinv_invoice_notes_args', $args, $this, $invoice_id, $type); |
|
| 82 | 82 | |
| 83 | - return get_comments( $args ); |
|
| 83 | + return get_comments($args); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @return void |
| 92 | 92 | */ |
| 93 | 93 | public function delete_comments_count_cache() { |
| 94 | - delete_transient( 'wpinv_count_comments' ); |
|
| 94 | + delete_transient('wpinv_count_comments'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -102,16 +102,16 @@ discard block |
||
| 102 | 102 | * @param int $post_id Post ID. |
| 103 | 103 | * @return object |
| 104 | 104 | */ |
| 105 | - public function wp_count_comments( $stats, $post_id ) { |
|
| 105 | + public function wp_count_comments($stats, $post_id) { |
|
| 106 | 106 | global $wpdb; |
| 107 | 107 | |
| 108 | - if ( 0 === $post_id ) { |
|
| 109 | - $stats = get_transient( 'wpinv_count_comments' ); |
|
| 108 | + if (0 === $post_id) { |
|
| 109 | + $stats = get_transient('wpinv_count_comments'); |
|
| 110 | 110 | |
| 111 | - if ( ! $stats ) { |
|
| 111 | + if (!$stats) { |
|
| 112 | 112 | $stats = array(); |
| 113 | 113 | |
| 114 | - $count = $wpdb->get_results( "SELECT comment_approved, COUNT(*) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN ('" . $this->comment_type . "') GROUP BY comment_approved", ARRAY_A ); |
|
| 114 | + $count = $wpdb->get_results("SELECT comment_approved, COUNT(*) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN ('" . $this->comment_type . "') GROUP BY comment_approved", ARRAY_A); |
|
| 115 | 115 | |
| 116 | 116 | $total = 0; |
| 117 | 117 | $approved = array( |
@@ -122,26 +122,26 @@ discard block |
||
| 122 | 122 | 'post-trashed' => 'post-trashed', |
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - foreach ( (array) $count as $row ) { |
|
| 125 | + foreach ((array)$count as $row) { |
|
| 126 | 126 | // Do not count post-trashed toward totals. |
| 127 | - if ( 'post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved'] ) { |
|
| 127 | + if ('post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved']) { |
|
| 128 | 128 | $total += $row['num_comments']; |
| 129 | 129 | } |
| 130 | - if ( isset( $approved[ $row['comment_approved'] ] ) ) { |
|
| 131 | - $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments']; |
|
| 130 | + if (isset($approved[$row['comment_approved']])) { |
|
| 131 | + $stats[$approved[$row['comment_approved']]] = $row['num_comments']; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $stats['total_comments'] = $total; |
| 136 | 136 | $stats['all'] = $total; |
| 137 | - foreach ( $approved as $key ) { |
|
| 138 | - if ( empty( $stats[ $key ] ) ) { |
|
| 139 | - $stats[ $key ] = 0; |
|
| 137 | + foreach ($approved as $key) { |
|
| 138 | + if (empty($stats[$key])) { |
|
| 139 | + $stats[$key] = 0; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $stats = (object) $stats; |
|
| 144 | - set_transient( 'wpinv_count_comments', $stats ); |
|
| 143 | + $stats = (object)$stats; |
|
| 144 | + set_transient('wpinv_count_comments', $stats); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -293,7 +293,7 @@ |
||
| 293 | 293 | $localize['deletePackages'] = __( 'GD package items should be deleted from GD payment manager only', 'invoicing' ); |
| 294 | 294 | $localize['deleteInvoiceFirst'] = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ); |
| 295 | 295 | |
| 296 | - $localize = apply_filters( 'wpinv_admin_js_localize', $localize ); |
|
| 296 | + $localize = apply_filters( 'wpinv_admin_js_localize', $localize ); |
|
| 297 | 297 | |
| 298 | 298 | wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize ); |
| 299 | 299 | } |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // MUST have WordPress. |
| 10 | -if ( !defined( 'WPINC' ) ) { |
|
| 11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 10 | +if (!defined('WPINC')) { |
|
| 11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | class WPInv_Plugin { |
| 15 | 15 | private static $instance; |
| 16 | 16 | |
| 17 | 17 | public static function run() { |
| 18 | - if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) { |
|
| 18 | + if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) { |
|
| 19 | 19 | self::$instance = new WPInv_Plugin; |
| 20 | 20 | self::$instance->includes(); |
| 21 | 21 | self::$instance->actions(); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | self::$instance->reports = new WPInv_Reports(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - do_action( 'wpinv_loaded' ); |
|
| 26 | + do_action('wpinv_loaded'); |
|
| 27 | 27 | |
| 28 | 28 | return self::$instance; |
| 29 | 29 | } |
@@ -33,31 +33,31 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function define_constants() { |
| 36 | - define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) ); |
|
| 37 | - define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) ); |
|
| 36 | + define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE)); |
|
| 37 | + define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | private function actions() { |
| 41 | 41 | /* Internationalize the text strings used. */ |
| 42 | - add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) ); |
|
| 42 | + add_action('plugins_loaded', array(&$this, 'plugins_loaded')); |
|
| 43 | 43 | |
| 44 | 44 | /* Perform actions on admin initialization. */ |
| 45 | - add_action( 'admin_init', array( &$this, 'admin_init') ); |
|
| 46 | - add_action( 'init', array( &$this, 'init' ), 3 ); |
|
| 47 | - add_action( 'init', array( 'WPInv_Shortcodes', 'init' ) ); |
|
| 48 | - add_action( 'init', array( &$this, 'wpinv_actions' ) ); |
|
| 45 | + add_action('admin_init', array(&$this, 'admin_init')); |
|
| 46 | + add_action('init', array(&$this, 'init'), 3); |
|
| 47 | + add_action('init', array('WPInv_Shortcodes', 'init')); |
|
| 48 | + add_action('init', array(&$this, 'wpinv_actions')); |
|
| 49 | 49 | |
| 50 | - if ( class_exists( 'BuddyPress' ) ) { |
|
| 51 | - add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) ); |
|
| 50 | + if (class_exists('BuddyPress')) { |
|
| 51 | + add_action('bp_include', array(&$this, 'bp_invoicing_init')); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) ); |
|
| 54 | + add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts')); |
|
| 55 | 55 | |
| 56 | - if ( is_admin() ) { |
|
| 57 | - add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) ); |
|
| 58 | - add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) ); |
|
| 56 | + if (is_admin()) { |
|
| 57 | + add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); |
|
| 58 | + add_action('admin_body_class', array(&$this, 'admin_body_class')); |
|
| 59 | 59 | } else { |
| 60 | - add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) ); |
|
| 60 | + add_filter('pre_get_posts', array(&$this, 'pre_get_posts')); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference. |
| 69 | 69 | */ |
| 70 | - do_action_ref_array( 'wpinv_actions', array( &$this ) ); |
|
| 70 | + do_action_ref_array('wpinv_actions', array(&$this)); |
|
| 71 | 71 | |
| 72 | - add_action( 'admin_init', array( &$this, 'activation_redirect') ); |
|
| 72 | + add_action('admin_init', array(&$this, 'activation_redirect')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function plugins_loaded() { |
@@ -83,193 +83,193 @@ discard block |
||
| 83 | 83 | * @since 1.0 |
| 84 | 84 | */ |
| 85 | 85 | public function load_textdomain() { |
| 86 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'invoicing' ); |
|
| 86 | + $locale = apply_filters('plugin_locale', get_locale(), 'invoicing'); |
|
| 87 | 87 | |
| 88 | - load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' ); |
|
| 89 | - load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' ); |
|
| 88 | + load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo'); |
|
| 89 | + load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages'); |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Define language constants. |
| 93 | 93 | */ |
| 94 | - require_once( WPINV_PLUGIN_DIR . 'language.php' ); |
|
| 94 | + require_once(WPINV_PLUGIN_DIR . 'language.php'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function includes() { |
| 98 | 98 | global $wpinv_options; |
| 99 | 99 | |
| 100 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' ); |
|
| 100 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php'); |
|
| 101 | 101 | $wpinv_options = wpinv_get_settings(); |
| 102 | 102 | |
| 103 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' ); |
|
| 104 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' ); |
|
| 105 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' ); |
|
| 106 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' ); |
|
| 107 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' ); |
|
| 108 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' ); |
|
| 109 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' ); |
|
| 110 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' ); |
|
| 111 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' ); |
|
| 112 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' ); |
|
| 113 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' ); |
|
| 114 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' ); |
|
| 115 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' ); |
|
| 116 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gd-functions.php' ); |
|
| 117 | - require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' ); |
|
| 103 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php'); |
|
| 104 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php'); |
|
| 105 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php'); |
|
| 106 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php'); |
|
| 107 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php'); |
|
| 108 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php'); |
|
| 109 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php'); |
|
| 110 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php'); |
|
| 111 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php'); |
|
| 112 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php'); |
|
| 113 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php'); |
|
| 114 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php'); |
|
| 115 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php'); |
|
| 116 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gd-functions.php'); |
|
| 117 | + require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php'); |
|
| 118 | 118 | //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' ); |
| 119 | 119 | //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' ); |
| 120 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' ); |
|
| 120 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php'); |
|
| 121 | 121 | //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscription.php' ); |
| 122 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' ); |
|
| 123 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' ); |
|
| 124 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php' ); |
|
| 125 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' ); |
|
| 126 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' ); |
|
| 127 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' ); |
|
| 128 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php' ); |
|
| 129 | - if ( !class_exists( 'Geodir_EUVat' ) ) { |
|
| 130 | - require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
|
| 122 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php'); |
|
| 123 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php'); |
|
| 124 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php'); |
|
| 125 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php'); |
|
| 126 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php'); |
|
| 127 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php'); |
|
| 128 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php'); |
|
| 129 | + if (!class_exists('Geodir_EUVat')) { |
|
| 130 | + require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $gateways = array_keys( wpinv_get_enabled_payment_gateways() ); |
|
| 134 | - if ( !empty( $gateways ) ) { |
|
| 135 | - foreach ( $gateways as $gateway ) { |
|
| 136 | - if ( $gateway == 'manual' ) { |
|
| 133 | + $gateways = array_keys(wpinv_get_enabled_payment_gateways()); |
|
| 134 | + if (!empty($gateways)) { |
|
| 135 | + foreach ($gateways as $gateway) { |
|
| 136 | + if ($gateway == 'manual') { |
|
| 137 | 137 | continue; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php'; |
| 141 | 141 | |
| 142 | - if ( file_exists( $gateway_file ) ) { |
|
| 143 | - require_once( $gateway_file ); |
|
| 142 | + if (file_exists($gateway_file)) { |
|
| 143 | + require_once($gateway_file); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | - require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' ); |
|
| 147 | + require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php'); |
|
| 148 | 148 | |
| 149 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
| 150 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' ); |
|
| 151 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' ); |
|
| 152 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' ); |
|
| 149 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
| 150 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php'); |
|
| 151 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php'); |
|
| 152 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php'); |
|
| 153 | 153 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' ); |
| 154 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' ); |
|
| 155 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' ); |
|
| 156 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' ); |
|
| 157 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' ); |
|
| 158 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' ); |
|
| 154 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php'); |
|
| 155 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php'); |
|
| 156 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php'); |
|
| 157 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php'); |
|
| 158 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php'); |
|
| 159 | 159 | //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // include css inliner |
| 163 | - if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) { |
|
| 164 | - include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' ); |
|
| 163 | + if (!class_exists('Emogrifier') && class_exists('DOMDocument')) { |
|
| 164 | + include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' ); |
|
| 167 | + require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php'); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | public function init() { |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function admin_init() { |
| 174 | - if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) { |
|
| 174 | + if (!(defined('DOING_AJAX') && DOING_AJAX)) { |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) ); |
|
| 177 | + add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php')); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | public function activation_redirect() { |
| 181 | 181 | // Bail if no activation redirect |
| 182 | - if ( !get_transient( '_wpinv_activation_redirect' ) ) { |
|
| 182 | + if (!get_transient('_wpinv_activation_redirect')) { |
|
| 183 | 183 | return; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // Delete the redirect transient |
| 187 | - delete_transient( '_wpinv_activation_redirect' ); |
|
| 187 | + delete_transient('_wpinv_activation_redirect'); |
|
| 188 | 188 | |
| 189 | 189 | // Bail if activating from network, or bulk |
| 190 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 190 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 191 | 191 | return; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) ); |
|
| 194 | + wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general')); |
|
| 195 | 195 | exit; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | public function enqueue_scripts() { |
| 199 | - $suffix = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 199 | + $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 200 | 200 | |
| 201 | - wp_deregister_style( 'font-awesome' ); |
|
| 202 | - wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' ); |
|
| 203 | - wp_enqueue_style( 'font-awesome' ); |
|
| 201 | + wp_deregister_style('font-awesome'); |
|
| 202 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0'); |
|
| 203 | + wp_enqueue_style('font-awesome'); |
|
| 204 | 204 | |
| 205 | - wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION ); |
|
| 206 | - wp_enqueue_style( 'wpinv_front_style' ); |
|
| 205 | + wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION); |
|
| 206 | + wp_enqueue_style('wpinv_front_style'); |
|
| 207 | 207 | |
| 208 | 208 | // Register scripts |
| 209 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
| 210 | - wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array( 'jquery', 'wpinv-vat-script' ), WPINV_VERSION ); |
|
| 209 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
| 210 | + wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array('jquery', 'wpinv-vat-script'), WPINV_VERSION); |
|
| 211 | 211 | |
| 212 | 212 | $localize = array(); |
| 213 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 214 | - $localize['nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 213 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
| 214 | + $localize['nonce'] = wp_create_nonce('wpinv-nonce'); |
|
| 215 | 215 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
| 216 | 216 | $localize['currency_pos'] = wpinv_currency_position(); |
| 217 | 217 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
| 218 | 218 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
| 219 | 219 | $localize['decimals'] = wpinv_decimals(); |
| 220 | 220 | |
| 221 | - $localize = apply_filters( 'wpinv_front_js_localize', $localize ); |
|
| 221 | + $localize = apply_filters('wpinv_front_js_localize', $localize); |
|
| 222 | 222 | |
| 223 | - wp_enqueue_script( 'jquery-blockui' ); |
|
| 224 | - wp_enqueue_script( 'wpinv-front-script' ); |
|
| 225 | - wp_localize_script( 'wpinv-front-script', 'WPInv', $localize ); |
|
| 223 | + wp_enqueue_script('jquery-blockui'); |
|
| 224 | + wp_enqueue_script('wpinv-front-script'); |
|
| 225 | + wp_localize_script('wpinv-front-script', 'WPInv', $localize); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | public function admin_enqueue_scripts() { |
| 229 | 229 | global $post, $pagenow; |
| 230 | 230 | |
| 231 | 231 | $post_type = wpinv_admin_post_type(); |
| 232 | - $suffix = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 232 | + $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
|
| 233 | 233 | |
| 234 | - wp_deregister_style( 'font-awesome' ); |
|
| 235 | - wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' ); |
|
| 236 | - wp_enqueue_style( 'font-awesome' ); |
|
| 234 | + wp_deregister_style('font-awesome'); |
|
| 235 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0'); |
|
| 236 | + wp_enqueue_style('font-awesome'); |
|
| 237 | 237 | |
| 238 | - wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' ); |
|
| 239 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
| 238 | + wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16'); |
|
| 239 | + wp_enqueue_style('jquery-ui-css'); |
|
| 240 | 240 | |
| 241 | - wp_register_style( 'jquery-chosen', WPINV_PLUGIN_URL . 'assets/css/chosen' . $suffix . '.css', array(), '1.6.2' ); |
|
| 242 | - wp_enqueue_style( 'jquery-chosen' ); |
|
| 241 | + wp_register_style('jquery-chosen', WPINV_PLUGIN_URL . 'assets/css/chosen' . $suffix . '.css', array(), '1.6.2'); |
|
| 242 | + wp_enqueue_style('jquery-chosen'); |
|
| 243 | 243 | |
| 244 | - wp_register_script( 'jquery-chosen', WPINV_PLUGIN_URL . 'assets/js/chosen.jquery' . $suffix . '.js', array( 'jquery' ), '1.6.2' ); |
|
| 245 | - wp_enqueue_script( 'jquery-chosen' ); |
|
| 244 | + wp_register_script('jquery-chosen', WPINV_PLUGIN_URL . 'assets/js/chosen.jquery' . $suffix . '.js', array('jquery'), '1.6.2'); |
|
| 245 | + wp_enqueue_script('jquery-chosen'); |
|
| 246 | 246 | |
| 247 | - wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION ); |
|
| 248 | - wp_enqueue_style( 'wpinv_meta_box_style' ); |
|
| 247 | + wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION); |
|
| 248 | + wp_enqueue_style('wpinv_meta_box_style'); |
|
| 249 | 249 | |
| 250 | - wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION ); |
|
| 251 | - wp_enqueue_style( 'wpinv_admin_style' ); |
|
| 250 | + wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION); |
|
| 251 | + wp_enqueue_style('wpinv_admin_style'); |
|
| 252 | 252 | |
| 253 | - if ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) { |
|
| 254 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 253 | + if ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) { |
|
| 254 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 258 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 257 | + wp_enqueue_style('wp-color-picker'); |
|
| 258 | + wp_enqueue_script('wp-color-picker'); |
|
| 259 | 259 | |
| 260 | - wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true ); |
|
| 260 | + wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true); |
|
| 261 | 261 | |
| 262 | - wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui' ), WPINV_VERSION ); |
|
| 263 | - wp_enqueue_script( 'wpinv-admin-script' ); |
|
| 262 | + wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array('jquery', 'jquery-blockui'), WPINV_VERSION); |
|
| 263 | + wp_enqueue_script('wpinv-admin-script'); |
|
| 264 | 264 | |
| 265 | 265 | $localize = array(); |
| 266 | - $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); |
|
| 267 | - $localize['post_ID'] = isset( $post->ID ) ? $post->ID : ''; |
|
| 268 | - $localize['wpinv_nonce'] = wp_create_nonce( 'wpinv-nonce' ); |
|
| 269 | - $localize['add_invoice_note_nonce'] = wp_create_nonce( 'add-invoice-note' ); |
|
| 270 | - $localize['delete_invoice_note_nonce'] = wp_create_nonce( 'delete-invoice-note' ); |
|
| 271 | - $localize['invoice_item_nonce'] = wp_create_nonce( 'invoice-item' ); |
|
| 272 | - $localize['billing_details_nonce'] = wp_create_nonce( 'get-billing-details' ); |
|
| 266 | + $localize['ajax_url'] = admin_url('admin-ajax.php'); |
|
| 267 | + $localize['post_ID'] = isset($post->ID) ? $post->ID : ''; |
|
| 268 | + $localize['wpinv_nonce'] = wp_create_nonce('wpinv-nonce'); |
|
| 269 | + $localize['add_invoice_note_nonce'] = wp_create_nonce('add-invoice-note'); |
|
| 270 | + $localize['delete_invoice_note_nonce'] = wp_create_nonce('delete-invoice-note'); |
|
| 271 | + $localize['invoice_item_nonce'] = wp_create_nonce('invoice-item'); |
|
| 272 | + $localize['billing_details_nonce'] = wp_create_nonce('get-billing-details'); |
|
| 273 | 273 | $localize['tax'] = wpinv_tax_amount(); |
| 274 | 274 | $localize['discount'] = wpinv_discount_amount(); |
| 275 | 275 | $localize['currency_symbol'] = wpinv_currency_symbol(); |
@@ -277,57 +277,57 @@ discard block |
||
| 277 | 277 | $localize['thousand_sep'] = wpinv_thousands_separator(); |
| 278 | 278 | $localize['decimal_sep'] = wpinv_decimal_separator(); |
| 279 | 279 | $localize['decimals'] = wpinv_decimals(); |
| 280 | - $localize['save_invoice'] = __( 'Save Invoice', 'invoicing' ); |
|
| 281 | - $localize['status_publish'] = wpinv_status_nicename( 'publish' ); |
|
| 282 | - $localize['status_pending'] = wpinv_status_nicename( 'pending' ); |
|
| 283 | - $localize['delete_tax_rate'] = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ); |
|
| 284 | - $localize['OneItemMin'] = __( 'Invoice must contain at least one item', 'invoicing' ); |
|
| 285 | - $localize['DeleteInvoiceItem'] = __( 'Are you sure you wish to delete this item?', 'invoicing' ); |
|
| 286 | - $localize['FillBillingDetails'] = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ); |
|
| 287 | - $localize['confirmCalcTotals'] = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ); |
|
| 288 | - $localize['AreYouSure'] = __( 'Are you sure?', 'invoicing' ); |
|
| 280 | + $localize['save_invoice'] = __('Save Invoice', 'invoicing'); |
|
| 281 | + $localize['status_publish'] = wpinv_status_nicename('publish'); |
|
| 282 | + $localize['status_pending'] = wpinv_status_nicename('pending'); |
|
| 283 | + $localize['delete_tax_rate'] = __('Are you sure you wish to delete this tax rate?', 'invoicing'); |
|
| 284 | + $localize['OneItemMin'] = __('Invoice must contain at least one item', 'invoicing'); |
|
| 285 | + $localize['DeleteInvoiceItem'] = __('Are you sure you wish to delete this item?', 'invoicing'); |
|
| 286 | + $localize['FillBillingDetails'] = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'); |
|
| 287 | + $localize['confirmCalcTotals'] = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'); |
|
| 288 | + $localize['AreYouSure'] = __('Are you sure?', 'invoicing'); |
|
| 289 | 289 | $localize['hasGD'] = wpinv_gd_active(); |
| 290 | 290 | $localize['hasPM'] = wpinv_pm_active(); |
| 291 | - $localize['emptyInvoice'] = __( 'Add atleast one item to save invoice!', 'invoicing' ); |
|
| 292 | - $localize['deletePackage'] = __( 'GD package items should be deleted from GD payment manager only, otherwise it will break invoices that created with this package!', 'invoicing' ); |
|
| 293 | - $localize['deletePackages'] = __( 'GD package items should be deleted from GD payment manager only', 'invoicing' ); |
|
| 294 | - $localize['deleteInvoiceFirst'] = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ); |
|
| 291 | + $localize['emptyInvoice'] = __('Add atleast one item to save invoice!', 'invoicing'); |
|
| 292 | + $localize['deletePackage'] = __('GD package items should be deleted from GD payment manager only, otherwise it will break invoices that created with this package!', 'invoicing'); |
|
| 293 | + $localize['deletePackages'] = __('GD package items should be deleted from GD payment manager only', 'invoicing'); |
|
| 294 | + $localize['deleteInvoiceFirst'] = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'); |
|
| 295 | 295 | |
| 296 | - $localize = apply_filters( 'wpinv_admin_js_localize', $localize ); |
|
| 296 | + $localize = apply_filters('wpinv_admin_js_localize', $localize); |
|
| 297 | 297 | |
| 298 | - wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize ); |
|
| 298 | + wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - public function admin_body_class( $classes ) { |
|
| 301 | + public function admin_body_class($classes) { |
|
| 302 | 302 | global $pagenow; |
| 303 | 303 | |
| 304 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 304 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 305 | 305 | |
| 306 | 306 | $add_class = false; |
| 307 | - if ( $pagenow == 'admin.php' && $page ) { |
|
| 308 | - $add_class = strpos( $page, 'wpinv-' ); |
|
| 307 | + if ($pagenow == 'admin.php' && $page) { |
|
| 308 | + $add_class = strpos($page, 'wpinv-'); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $settings_class = array(); |
| 312 | - if ( $page == 'wpinv-settings' ) { |
|
| 313 | - if ( !empty( $_REQUEST['tab'] ) ) { |
|
| 314 | - $settings_class[] = sanitize_text_field( $_REQUEST['tab'] ); |
|
| 312 | + if ($page == 'wpinv-settings') { |
|
| 313 | + if (!empty($_REQUEST['tab'])) { |
|
| 314 | + $settings_class[] = sanitize_text_field($_REQUEST['tab']); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if ( !empty( $_REQUEST['section'] ) ) { |
|
| 318 | - $settings_class[] = sanitize_text_field( $_REQUEST['section'] ); |
|
| 317 | + if (!empty($_REQUEST['section'])) { |
|
| 318 | + $settings_class[] = sanitize_text_field($_REQUEST['section']); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main'; |
|
| 321 | + $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main'; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if ( !empty( $settings_class ) ) { |
|
| 325 | - $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) ); |
|
| 324 | + if (!empty($settings_class)) { |
|
| 325 | + $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-')); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | $post_type = wpinv_admin_post_type(); |
| 329 | 329 | |
| 330 | - if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) { |
|
| 330 | + if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) { |
|
| 331 | 331 | return $classes .= ' wpinv'; |
| 332 | 332 | } else { |
| 333 | 333 | return $classes; |
@@ -339,26 +339,26 @@ discard block |
||
| 339 | 339 | public function admin_print_scripts_edit_php() { |
| 340 | 340 | $post_type = wpinv_admin_post_type(); |
| 341 | 341 | |
| 342 | - if ( $post_type == 'wpi_item' ) { |
|
| 343 | - wp_enqueue_script( 'wpinv-inline-edit-post', WPINV_PLUGIN_URL . 'assets/js/quick-edit.js', array( 'jquery', 'inline-edit-post' ), '', true ); |
|
| 342 | + if ($post_type == 'wpi_item') { |
|
| 343 | + wp_enqueue_script('wpinv-inline-edit-post', WPINV_PLUGIN_URL . 'assets/js/quick-edit.js', array('jquery', 'inline-edit-post'), '', true); |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | public function wpinv_actions() { |
| 348 | - if ( isset( $_REQUEST['wpi_action'] ) ) { |
|
| 349 | - do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST ); |
|
| 348 | + if (isset($_REQUEST['wpi_action'])) { |
|
| 349 | + do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - public function pre_get_posts( $wp_query ) { |
|
| 354 | - if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) { |
|
| 355 | - $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() ); |
|
| 353 | + public function pre_get_posts($wp_query) { |
|
| 354 | + if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) { |
|
| 355 | + $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses()); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | return $wp_query; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | public function bp_invoicing_init() { |
| 362 | - require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
|
| 362 | + require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php'); |
|
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | \ No newline at end of file |