@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Billing_Details { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $user_ID; |
10 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
11 | - $invoice = new WPInv_Invoice( $post_id ); |
|
10 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
11 | + $invoice = new WPInv_Invoice($post_id); |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | <div class="gdmbx2-wrap form-table"> |
15 | 15 | <div id="gdmbx2-metabox-wpinv_address" class="gdmbx2-metabox gdmbx-field-list wpinv-address gdmbx-row"> |
16 | 16 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-user-id table-layout"> |
17 | 17 | <div class="gdmbx-th"> |
18 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
18 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
19 | 19 | </div> |
20 | 20 | <div class="gdmbx-td gdmbx-customer-div"> |
21 | - <?php wpinv_dropdown_users( array( |
|
21 | + <?php wpinv_dropdown_users(array( |
|
22 | 22 | 'name' => 'post_author_override', |
23 | 23 | 'selected' => empty($post->ID) ? $user_ID : $post->post_author, |
24 | 24 | 'include_selected' => true, |
25 | 25 | 'show' => 'display_name_with_email', |
26 | 26 | 'orderby' => 'user_email', |
27 | 27 | 'class' => 'gdmbx2-text-large wpi_select2' |
28 | - ) ); ?> |
|
28 | + )); ?> |
|
29 | 29 | </div> |
30 | 30 | </div> |
31 | 31 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-email table-layout" style="display:none"> |
32 | - <div class="gdmbx-th"><label for="wpinv_email"><?php _e( 'Email', 'invoicing' );?> <span class="required">*</span></label> |
|
32 | + <div class="gdmbx-th"><label for="wpinv_email"><?php _e('Email', 'invoicing'); ?> <span class="required">*</span></label> |
|
33 | 33 | </div> |
34 | 34 | <div class="gdmbx-td"> |
35 | 35 | <input type="hidden" id="wpinv_new_user" name="wpinv_new_user" value="" /> |
@@ -37,137 +37,137 @@ discard block |
||
37 | 37 | </div> |
38 | 38 | </div> |
39 | 39 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-btns table-layout"> |
40 | - <div class="gdmbx-th"><label><?php _e( 'Actions', 'invoicing' );?></label> |
|
40 | + <div class="gdmbx-th"><label><?php _e('Actions', 'invoicing'); ?></label> |
|
41 | 41 | </div> |
42 | - <?php if ( $invoice->has_status( array( 'auto-draft', 'draft', 'wpi-pending', 'wpi-quote-pending' ) ) ) { ?> |
|
42 | + <?php if ($invoice->has_status(array('auto-draft', 'draft', 'wpi-pending', 'wpi-quote-pending'))) { ?> |
|
43 | 43 | <div class="gdmbx-td"> |
44 | - <a id="wpinv-fill-user-details" class="button button-small button-secondary" title="<?php esc_attr_e( 'Fill User Details', 'invoicing' );?>" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-refresh"></i><?php _e( 'Fill User Details', 'invoicing' );?></a> |
|
45 | - <a class="wpinv-new-user button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-plus"></i><?php _e( 'Add New User', 'invoicing' );?></a> |
|
46 | - <a style="display:none" class="wpinv-new-cancel button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-close"></i><?php _e( 'Cancel', 'invoicing' );?> </a> |
|
44 | + <a id="wpinv-fill-user-details" class="button button-small button-secondary" title="<?php esc_attr_e('Fill User Details', 'invoicing'); ?>" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-refresh"></i><?php _e('Fill User Details', 'invoicing'); ?></a> |
|
45 | + <a class="wpinv-new-user button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-plus"></i><?php _e('Add New User', 'invoicing'); ?></a> |
|
46 | + <a style="display:none" class="wpinv-new-cancel button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-close"></i><?php _e('Cancel', 'invoicing'); ?> </a> |
|
47 | 47 | </div> |
48 | 48 | <?php } ?> |
49 | 49 | </div> |
50 | 50 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-first-name table-layout"> |
51 | - <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e( 'First Name', 'invoicing' );?></label></div> |
|
51 | + <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e('First Name', 'invoicing'); ?></label></div> |
|
52 | 52 | <div class="gdmbx-td"> |
53 | - <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr( $invoice->first_name );?>" /> |
|
53 | + <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr($invoice->first_name); ?>" /> |
|
54 | 54 | </div> |
55 | 55 | </div> |
56 | 56 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-last-name table-layout"> |
57 | - <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e( 'Last Name', 'invoicing' );?></label></div> |
|
57 | + <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e('Last Name', 'invoicing'); ?></label></div> |
|
58 | 58 | <div class="gdmbx-td"> |
59 | - <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr( $invoice->last_name );?>" /> |
|
59 | + <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr($invoice->last_name); ?>" /> |
|
60 | 60 | </div> |
61 | 61 | </div> |
62 | 62 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-company table-layout"> |
63 | - <div class="gdmbx-th"><label for="wpinv_company"><?php _e( 'Company', 'invoicing' );?></label></div> |
|
63 | + <div class="gdmbx-th"><label for="wpinv_company"><?php _e('Company', 'invoicing'); ?></label></div> |
|
64 | 64 | <div class="gdmbx-td"> |
65 | - <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr( $invoice->company );?>" /> |
|
65 | + <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr($invoice->company); ?>" /> |
|
66 | 66 | </div> |
67 | 67 | </div> |
68 | 68 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-vat-number table-layout"> |
69 | - <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e( 'Vat Number', 'invoicing' );?></label></div> |
|
69 | + <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e('Vat Number', 'invoicing'); ?></label></div> |
|
70 | 70 | <div class="gdmbx-td"> |
71 | - <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr( $invoice->vat_number );?>" /> |
|
71 | + <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr($invoice->vat_number); ?>" /> |
|
72 | 72 | </div> |
73 | 73 | </div> |
74 | 74 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-address table-layout"> |
75 | - <div class="gdmbx-th"><label for="wpinv_address"><?php _e( 'Address', 'invoicing' );?></label></div> |
|
75 | + <div class="gdmbx-th"><label for="wpinv_address"><?php _e('Address', 'invoicing'); ?></label></div> |
|
76 | 76 | <div class="gdmbx-td"> |
77 | - <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr( $invoice->address );?>" /> |
|
77 | + <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr($invoice->address); ?>" /> |
|
78 | 78 | </div> |
79 | 79 | </div> |
80 | 80 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-city table-layout"> |
81 | - <div class="gdmbx-th"><label for="wpinv_city"><?php _e( 'City', 'invoicing' );?></label></div> |
|
81 | + <div class="gdmbx-th"><label for="wpinv_city"><?php _e('City', 'invoicing'); ?></label></div> |
|
82 | 82 | <div class="gdmbx-td"> |
83 | - <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr( $invoice->city );?>" /> |
|
83 | + <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr($invoice->city); ?>" /> |
|
84 | 84 | </div> |
85 | 85 | </div> |
86 | 86 | <div class="gdmbx-row gdmbx-type-select gdmbx-wpinv-country table-layout"> |
87 | - <div class="gdmbx-th"><label for="wpinv_country"><?php _e( 'Country', 'invoicing' );?> <span class="wpi-loader"><i class="fa fa-refresh fa-spin"></i></span></label></div> |
|
87 | + <div class="gdmbx-th"><label for="wpinv_country"><?php _e('Country', 'invoicing'); ?> <span class="wpi-loader"><i class="fa fa-refresh fa-spin"></i></span></label></div> |
|
88 | 88 | <div class="gdmbx-td"> |
89 | 89 | <?php |
90 | - echo wpinv_html_select( array( |
|
91 | - 'options' => array_merge( array( '' => __( 'Choose a country', 'invoicing' ) ), wpinv_get_country_list() ), |
|
90 | + echo wpinv_html_select(array( |
|
91 | + 'options' => array_merge(array('' => __('Choose a country', 'invoicing')), wpinv_get_country_list()), |
|
92 | 92 | 'name' => 'wpinv_country', |
93 | 93 | 'id' => 'wpinv_country', |
94 | 94 | 'selected' => $invoice->country, |
95 | 95 | 'show_option_all' => false, |
96 | 96 | 'show_option_none' => false, |
97 | 97 | 'class' => 'gdmbx2-text-large wpi_select2', |
98 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
98 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
99 | 99 | 'required' => false, |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | </div> |
104 | 104 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-state table-layout"> |
105 | - <div class="gdmbx-th"><label for="wpinv_state"><?php _e( 'State', 'invoicing' );?></label></div> |
|
105 | + <div class="gdmbx-th"><label for="wpinv_state"><?php _e('State', 'invoicing'); ?></label></div> |
|
106 | 106 | <div class="gdmbx-td"> |
107 | 107 | <?php |
108 | - $states = wpinv_get_country_states( $invoice->country ); |
|
109 | - if( !empty( $states ) ) { |
|
110 | - echo wpinv_html_select( array( |
|
111 | - 'options' => array_merge( array( '' => __( 'Choose a state', 'invoicing' ) ), $states ), |
|
108 | + $states = wpinv_get_country_states($invoice->country); |
|
109 | + if (!empty($states)) { |
|
110 | + echo wpinv_html_select(array( |
|
111 | + 'options' => array_merge(array('' => __('Choose a state', 'invoicing')), $states), |
|
112 | 112 | 'name' => 'wpinv_state', |
113 | 113 | 'id' => 'wpinv_state', |
114 | 114 | 'selected' => $invoice->state, |
115 | 115 | 'show_option_all' => false, |
116 | 116 | 'show_option_none' => false, |
117 | 117 | 'class' => 'gdmbx2-text-large wpi_select2', |
118 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
118 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
119 | 119 | 'required' => false, |
120 | - ) ); |
|
120 | + )); |
|
121 | 121 | } else { |
122 | - echo wpinv_html_text( array( |
|
122 | + echo wpinv_html_text(array( |
|
123 | 123 | 'name' => 'wpinv_state', |
124 | - 'value' => ! empty( $invoice->state ) ? $invoice->state : '', |
|
124 | + 'value' => !empty($invoice->state) ? $invoice->state : '', |
|
125 | 125 | 'id' => 'wpinv_state', |
126 | 126 | 'class' => 'gdmbx2-text-large', |
127 | 127 | 'required' => false, |
128 | - ) ); |
|
128 | + )); |
|
129 | 129 | } |
130 | 130 | ?> |
131 | 131 | </div> |
132 | 132 | </div> |
133 | 133 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-zip table-layout"> |
134 | - <div class="gdmbx-th"><label for="wpinv_zip"><?php _e( 'Zipcode', 'invoicing' );?></label></div> |
|
134 | + <div class="gdmbx-th"><label for="wpinv_zip"><?php _e('Zipcode', 'invoicing'); ?></label></div> |
|
135 | 135 | <div class="gdmbx-td"> |
136 | - <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr( $invoice->zip );?>" /> |
|
136 | + <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr($invoice->zip); ?>" /> |
|
137 | 137 | </div> |
138 | 138 | </div> |
139 | 139 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-phone table-layout"> |
140 | - <div class="gdmbx-th"><label for="wpinv_phone"><?php _e( 'Phone', 'invoicing' );?></label></div> |
|
140 | + <div class="gdmbx-th"><label for="wpinv_phone"><?php _e('Phone', 'invoicing'); ?></label></div> |
|
141 | 141 | <div class="gdmbx-td"> |
142 | - <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr( $invoice->phone );?>" /> |
|
142 | + <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr($invoice->phone); ?>" /> |
|
143 | 143 | </div> |
144 | 144 | </div> |
145 | 145 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-ip table-layout"> |
146 | - <div class="gdmbx-th"><label for="wpinv_ip"><?php _e( 'IP Address', 'invoicing' );?><?php if ($invoice->ip) { ?> |
|
147 | - <a href="<?php echo admin_url( 'admin-ajax.php?action=wpinv_ip_geolocation&ip=' . $invoice->ip ); ?>" title="<?php esc_attr_e( 'View IP information', 'invoicing' );?>" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a> |
|
146 | + <div class="gdmbx-th"><label for="wpinv_ip"><?php _e('IP Address', 'invoicing'); ?><?php if ($invoice->ip) { ?> |
|
147 | + <a href="<?php echo admin_url('admin-ajax.php?action=wpinv_ip_geolocation&ip=' . $invoice->ip); ?>" title="<?php esc_attr_e('View IP information', 'invoicing'); ?>" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a> |
|
148 | 148 | <?php } ?></label></div> |
149 | 149 | <div class="gdmbx-td"> |
150 | - <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr( $invoice->ip );?>" readonly /> |
|
150 | + <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr($invoice->ip); ?>" readonly /> |
|
151 | 151 | </div> |
152 | 152 | </div> |
153 | 153 | |
154 | - <?php if( ! $invoice->is_paid() ) { ?> |
|
154 | + <?php if (!$invoice->is_paid()) { ?> |
|
155 | 155 | |
156 | 156 | <div class="gdmbx-row gdmbx-type-select gdmbx-wpinv-currency table-layout"> |
157 | - <div class="gdmbx-th"><label for="wpinv_currency"><?php _e( 'Currency', 'invoicing' );?></label></div> |
|
157 | + <div class="gdmbx-th"><label for="wpinv_currency"><?php _e('Currency', 'invoicing'); ?></label></div> |
|
158 | 158 | <div class="gdmbx-td"> |
159 | 159 | <?php |
160 | - echo wpinv_html_select( array( |
|
161 | - 'options' => array_merge( array( '' => __( 'Currency for the invoice', 'invoicing' ) ), wpinv_get_currencies() ), |
|
160 | + echo wpinv_html_select(array( |
|
161 | + 'options' => array_merge(array('' => __('Currency for the invoice', 'invoicing')), wpinv_get_currencies()), |
|
162 | 162 | 'name' => 'wpinv_currency', |
163 | 163 | 'id' => 'wpinv_currency', |
164 | 164 | 'selected' => $invoice->get_currency(), |
165 | 165 | 'show_option_all' => false, |
166 | 166 | 'show_option_none' => false, |
167 | 167 | 'class' => 'gdmbx2-text-large wpi_select2', |
168 | - 'placeholder' => __( 'Choose a currency', 'invoicing' ), |
|
168 | + 'placeholder' => __('Choose a currency', 'invoicing'), |
|
169 | 169 | 'required' => true, |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | ?> |
172 | 172 | </div> |
173 | 173 | </div> |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | <?php } ?> |
176 | 176 | </div> |
177 | 177 | </div> |
178 | -<?php wp_nonce_field( 'wpinv_save_invoice', 'wpinv_save_invoice' ) ;?> |
|
178 | +<?php wp_nonce_field('wpinv_save_invoice', 'wpinv_save_invoice'); ?> |
|
179 | 179 | <?php |
180 | 180 | } |
181 | 181 | } |
@@ -1,47 +1,47 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Items { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $wpinv_euvat, $ajax_cart_details; |
10 | 10 | |
11 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
12 | - $invoice = new WPInv_Invoice( $post_id ); |
|
11 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
12 | + $invoice = new WPInv_Invoice($post_id); |
|
13 | 13 | $ajax_cart_details = $invoice->get_cart_details(); |
14 | - $subtotal = $invoice->get_subtotal( true ); |
|
14 | + $subtotal = $invoice->get_subtotal(true); |
|
15 | 15 | $discount_raw = $invoice->get_discount(); |
16 | - $discount = wpinv_price( $discount_raw, $invoice->get_currency() ); |
|
16 | + $discount = wpinv_price($discount_raw, $invoice->get_currency()); |
|
17 | 17 | $discounts = $discount_raw > 0 ? $invoice->get_discounts() : ''; |
18 | - $tax = $invoice->get_tax( true ); |
|
19 | - $total = $invoice->get_total( true ); |
|
18 | + $tax = $invoice->get_tax(true); |
|
19 | + $total = $invoice->get_total(true); |
|
20 | 20 | $item_quantities = wpinv_item_quantities_enabled(); |
21 | 21 | $use_taxes = wpinv_use_taxes(); |
22 | - if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) { |
|
22 | + if (!$use_taxes && (float) $invoice->get_tax() > 0) { |
|
23 | 23 | $use_taxes = true; |
24 | 24 | } |
25 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
25 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
26 | 26 | $is_recurring = $invoice->is_recurring(); |
27 | 27 | $post_type_object = get_post_type_object($invoice->post_type); |
28 | 28 | $type_title = $post_type_object->labels->singular_name; |
29 | 29 | |
30 | 30 | $cols = 5; |
31 | - if ( $item_quantities ) { |
|
31 | + if ($item_quantities) { |
|
32 | 32 | $cols++; |
33 | 33 | } |
34 | - if ( $use_taxes ) { |
|
34 | + if ($use_taxes) { |
|
35 | 35 | $cols++; |
36 | 36 | } |
37 | 37 | $class = ''; |
38 | - if ( $invoice->is_paid() ) { |
|
38 | + if ($invoice->is_paid()) { |
|
39 | 39 | $class .= ' wpinv-paid'; |
40 | 40 | } |
41 | - if ( $invoice->is_refunded() ) { |
|
41 | + if ($invoice->is_refunded()) { |
|
42 | 42 | $class .= ' wpinv-refunded'; |
43 | 43 | } |
44 | - if ( $is_recurring ) { |
|
44 | + if ($is_recurring) { |
|
45 | 45 | $class .= ' wpi-recurring'; |
46 | 46 | } |
47 | 47 | ?> |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
50 | 50 | <thead> |
51 | 51 | <tr> |
52 | - <th class="id"><?php _e( 'ID', 'invoicing' );?></th> |
|
53 | - <th class="title"><?php _e( 'Item', 'invoicing' );?></th> |
|
54 | - <th class="price"><?php _e( 'Price', 'invoicing' );?></th> |
|
55 | - <?php if ( $item_quantities ) { ?> |
|
56 | - <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th> |
|
52 | + <th class="id"><?php _e('ID', 'invoicing'); ?></th> |
|
53 | + <th class="title"><?php _e('Item', 'invoicing'); ?></th> |
|
54 | + <th class="price"><?php _e('Price', 'invoicing'); ?></th> |
|
55 | + <?php if ($item_quantities) { ?> |
|
56 | + <th class="qty"><?php _e('Qty', 'invoicing'); ?></th> |
|
57 | 57 | <?php } ?> |
58 | - <th class="total"><?php _e( 'Total', 'invoicing' );?></th> |
|
59 | - <?php if ( $use_taxes ) { ?> |
|
60 | - <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th> |
|
58 | + <th class="total"><?php _e('Total', 'invoicing'); ?></th> |
|
59 | + <?php if ($use_taxes) { ?> |
|
60 | + <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th> |
|
61 | 61 | <?php } ?> |
62 | 62 | <th class="action"></th> |
63 | 63 | </tr> |
64 | 64 | </thead> |
65 | 65 | <tbody class="wpinv-line-items"> |
66 | - <?php echo wpinv_admin_get_line_items( $invoice ); ?> |
|
66 | + <?php echo wpinv_admin_get_line_items($invoice); ?> |
|
67 | 67 | </tbody> |
68 | 68 | <tfoot class="wpinv-totals"> |
69 | 69 | <tr> |
@@ -74,45 +74,45 @@ discard block |
||
74 | 74 | <td class="id"> |
75 | 75 | </td> |
76 | 76 | <td class="title"> |
77 | - <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | - <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?> |
|
77 | + <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | + <?php if ($wpinv_euvat->allow_vat_rules()) { ?> |
|
79 | 79 | <div class="wp-clearfix"> |
80 | 80 | <label class="wpi-vat-rule"> |
81 | - <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span> |
|
81 | + <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span> |
|
82 | 82 | <span class="input-text-wrap"> |
83 | - <?php echo wpinv_html_select( array( |
|
83 | + <?php echo wpinv_html_select(array( |
|
84 | 84 | 'options' => $wpinv_euvat->get_rules(), |
85 | 85 | 'name' => '_wpinv_quick[vat_rule]', |
86 | 86 | 'id' => '_wpinv_quick_vat_rule', |
87 | 87 | 'show_option_all' => false, |
88 | 88 | 'show_option_none' => false, |
89 | 89 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule wpi_select2', |
90 | - ) ); ?> |
|
90 | + )); ?> |
|
91 | 91 | </span> |
92 | 92 | </label> |
93 | 93 | </div> |
94 | - <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?> |
|
94 | + <?php } if ($wpinv_euvat->allow_vat_classes()) { ?> |
|
95 | 95 | <div class="wp-clearfix"> |
96 | 96 | <label class="wpi-vat-class"> |
97 | - <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span> |
|
97 | + <span class="title"><?php _e('VAT class', 'invoicing'); ?></span> |
|
98 | 98 | <span class="input-text-wrap"> |
99 | - <?php echo wpinv_html_select( array( |
|
99 | + <?php echo wpinv_html_select(array( |
|
100 | 100 | 'options' => $wpinv_euvat->get_all_classes(), |
101 | 101 | 'name' => '_wpinv_quick[vat_class]', |
102 | 102 | 'id' => '_wpinv_quick_vat_class', |
103 | 103 | 'show_option_all' => false, |
104 | 104 | 'show_option_none' => false, |
105 | 105 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class wpi_select2', |
106 | - ) ); ?> |
|
106 | + )); ?> |
|
107 | 107 | </span> |
108 | 108 | </label> |
109 | 109 | </div> |
110 | 110 | <?php } ?> |
111 | 111 | <div class="wp-clearfix"> |
112 | 112 | <label class="wpi-item-type"> |
113 | - <span class="title"><?php _e( 'Item type', 'invoicing' );?></span> |
|
113 | + <span class="title"><?php _e('Item type', 'invoicing'); ?></span> |
|
114 | 114 | <span class="input-text-wrap"> |
115 | - <?php echo wpinv_html_select( array( |
|
115 | + <?php echo wpinv_html_select(array( |
|
116 | 116 | 'options' => $item_types, |
117 | 117 | 'name' => '_wpinv_quick[type]', |
118 | 118 | 'id' => '_wpinv_quick_type', |
@@ -120,37 +120,37 @@ discard block |
||
120 | 120 | 'show_option_all' => false, |
121 | 121 | 'show_option_none' => false, |
122 | 122 | 'class' => 'gdmbx2-text-medium wpinv-quick-type wpi_select2', |
123 | - ) ); ?> |
|
123 | + )); ?> |
|
124 | 124 | </span> |
125 | 125 | </label> |
126 | 126 | </div> |
127 | 127 | |
128 | 128 | <div class="wp-clearfix"> |
129 | 129 | <?php |
130 | - echo wpinv_html_textarea( array( |
|
130 | + echo wpinv_html_textarea(array( |
|
131 | 131 | 'name' => '_wpinv_quick[excerpt]', |
132 | 132 | 'id' => '_wpinv_quick_excerpt', |
133 | 133 | 'value' => '', |
134 | 134 | 'class' => 'large-text', |
135 | - 'label' => __( 'Item description', 'invoicing' ), |
|
136 | - ) ); |
|
135 | + 'label' => __('Item description', 'invoicing'), |
|
136 | + )); |
|
137 | 137 | ?> |
138 | 138 | </div> |
139 | 139 | |
140 | 140 | <div class="wp-clearfix"> |
141 | 141 | <label class="wpi-item-actions"> |
142 | 142 | <span class="input-text-wrap"> |
143 | - <input type="button" value="<?php esc_attr_e( 'Add', 'invoicing' ); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item"> |
|
143 | + <input type="button" value="<?php esc_attr_e('Add', 'invoicing'); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item"> |
|
144 | 144 | </span> |
145 | 145 | </label> |
146 | 146 | </div> |
147 | 147 | </td> |
148 | 148 | <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td> |
149 | - <?php if ( $item_quantities ) { ?> |
|
149 | + <?php if ($item_quantities) { ?> |
|
150 | 150 | <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td> |
151 | 151 | <?php } ?> |
152 | 152 | <td class="total"></td> |
153 | - <?php if ( $use_taxes ) { ?> |
|
153 | + <?php if ($use_taxes) { ?> |
|
154 | 154 | <td class="tax"></td> |
155 | 155 | <?php } ?> |
156 | 156 | <td class="action"></td> |
@@ -163,29 +163,29 @@ discard block |
||
163 | 163 | <td colspan="<?php echo $cols; ?>"></td> |
164 | 164 | </tr> |
165 | 165 | <tr class="totals"> |
166 | - <td colspan="<?php echo ( $cols - 4 ); ?>"></td> |
|
166 | + <td colspan="<?php echo ($cols - 4); ?>"></td> |
|
167 | 167 | <td colspan="4"> |
168 | 168 | <table cellspacing="0" cellpadding="0"> |
169 | 169 | <tr class="subtotal"> |
170 | - <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td> |
|
171 | - <td class="total"><?php echo $subtotal;?></td> |
|
170 | + <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td> |
|
171 | + <td class="total"><?php echo $subtotal; ?></td> |
|
172 | 172 | <td class="action"></td> |
173 | 173 | </tr> |
174 | 174 | <tr class="discount"> |
175 | - <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td> |
|
176 | - <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td> |
|
175 | + <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td> |
|
176 | + <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td> |
|
177 | 177 | <td class="action"></td> |
178 | 178 | </tr> |
179 | - <?php if ( $use_taxes ) { ?> |
|
179 | + <?php if ($use_taxes) { ?> |
|
180 | 180 | <tr class="tax"> |
181 | - <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td> |
|
182 | - <td class="total"><?php echo $tax;?></td> |
|
181 | + <td class="name"><?php _e('Tax:', 'invoicing'); ?></td> |
|
182 | + <td class="total"><?php echo $tax; ?></td> |
|
183 | 183 | <td class="action"></td> |
184 | 184 | </tr> |
185 | 185 | <?php } ?> |
186 | 186 | <tr class="total"> |
187 | - <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td> |
|
188 | - <td class="total"><?php echo $total;?></td> |
|
187 | + <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td> |
|
188 | + <td class="total"><?php echo $total; ?></td> |
|
189 | 189 | <td class="action"></td> |
190 | 190 | </tr> |
191 | 191 | </table> |
@@ -196,90 +196,90 @@ discard block |
||
196 | 196 | <div class="wpinv-actions"> |
197 | 197 | <?php ob_start(); ?> |
198 | 198 | <?php |
199 | - if ( !$invoice->is_paid() && !$invoice->is_refunded() ) { |
|
200 | - if ( !$invoice->is_recurring() ) { |
|
201 | - echo wpinv_item_dropdown( array( |
|
199 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
200 | + if (!$invoice->is_recurring()) { |
|
201 | + echo wpinv_item_dropdown(array( |
|
202 | 202 | 'name' => 'wpinv_invoice_item', |
203 | 203 | 'id' => 'wpinv_invoice_item', |
204 | 204 | 'show_recurring' => true, |
205 | 205 | 'class' => 'wpi_select2', |
206 | - ) ); |
|
206 | + )); |
|
207 | 207 | ?> |
208 | - <input type="button" value="<?php echo sprintf(esc_attr__( 'Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e( 'Recalculate Totals', 'invoicing' );?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
208 | + <input type="button" value="<?php echo sprintf(esc_attr__('Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e('Recalculate Totals', 'invoicing'); ?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
209 | 209 | <?php } ?> |
210 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
211 | - <?php $item_actions = ob_get_clean(); echo apply_filters( 'wpinv_invoice_items_actions_content', $item_actions, $invoice, $post ); ?> |
|
210 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
211 | + <?php $item_actions = ob_get_clean(); echo apply_filters('wpinv_invoice_items_actions_content', $item_actions, $invoice, $post); ?> |
|
212 | 212 | </div> |
213 | 213 | </div> |
214 | 214 | <?php |
215 | 215 | } |
216 | 216 | |
217 | - public static function prices( $post ) { |
|
217 | + public static function prices($post) { |
|
218 | 218 | $symbol = wpinv_currency_symbol(); |
219 | 219 | $position = wpinv_currency_position(); |
220 | - $item = new WPInv_Item( $post->ID ); |
|
220 | + $item = new WPInv_Item($post->ID); |
|
221 | 221 | |
222 | 222 | $price = $item->get_price(); |
223 | 223 | $is_dynamic_pricing = $item->get_is_dynamic_pricing(); |
224 | 224 | $minimum_price = $item->get_minimum_price(); |
225 | 225 | $is_recurring = $item->is_recurring(); |
226 | 226 | $period = $item->get_recurring_period(); |
227 | - $interval = absint( $item->get_recurring_interval() ); |
|
228 | - $times = absint( $item->get_recurring_limit() ); |
|
227 | + $interval = absint($item->get_recurring_interval()); |
|
228 | + $times = absint($item->get_recurring_limit()); |
|
229 | 229 | $free_trial = $item->has_free_trial(); |
230 | 230 | $trial_interval = $item->get_trial_interval(); |
231 | 231 | $trial_period = $item->get_trial_period(); |
232 | 232 | |
233 | 233 | $intervals = array(); |
234 | - for ( $i = 1; $i <= 90; $i++ ) { |
|
234 | + for ($i = 1; $i <= 90; $i++) { |
|
235 | 235 | $intervals[$i] = $i; |
236 | 236 | } |
237 | 237 | |
238 | - $interval = $interval > 0 ? $interval : 1; |
|
238 | + $interval = $interval > 0 ? $interval : 1; |
|
239 | 239 | |
240 | 240 | $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n'; |
241 | 241 | |
242 | 242 | $minimum_price_style = 'margin-left: 24px;'; |
243 | - if(! $is_dynamic_pricing ) { |
|
243 | + if (!$is_dynamic_pricing) { |
|
244 | 244 | $minimum_price_style .= 'display: none;'; |
245 | 245 | } |
246 | 246 | |
247 | 247 | ?> |
248 | - <p class="wpinv-row-prices"><?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $price;?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce( 'wpinv_item_meta_box_save' ) ;?>" /> |
|
249 | - <?php do_action( 'wpinv_prices_metabox_price', $item ); ?> |
|
248 | + <p class="wpinv-row-prices"><?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $price; ?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce('wpinv_item_meta_box_save'); ?>" /> |
|
249 | + <?php do_action('wpinv_prices_metabox_price', $item); ?> |
|
250 | 250 | </p> |
251 | 251 | |
252 | - <?php if( $item->supports_dynamic_pricing() ) { ?> |
|
252 | + <?php if ($item->supports_dynamic_pricing()) { ?> |
|
253 | 253 | |
254 | 254 | <p class="wpinv-row-name-your-price"> |
255 | 255 | <label> |
256 | - <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked( 1, $is_dynamic_pricing ); ?> /> |
|
257 | - <?php echo apply_filters( 'wpinv_name_your_price_toggle_text', __( 'User can set a custom price', 'invoicing' ) ); ?> |
|
256 | + <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked(1, $is_dynamic_pricing); ?> /> |
|
257 | + <?php echo apply_filters('wpinv_name_your_price_toggle_text', __('User can set a custom price', 'invoicing')); ?> |
|
258 | 258 | </label> |
259 | - <?php do_action( 'wpinv_prices_metabox_name_your_price_field', $item ); ?> |
|
259 | + <?php do_action('wpinv_prices_metabox_name_your_price_field', $item); ?> |
|
260 | 260 | </p> |
261 | 261 | |
262 | 262 | <p class="wpinv-row-minimum-price" style="<?php echo $minimum_price_style; ?>"> |
263 | 263 | <label> |
264 | - <?php _e( 'Minimum Price', 'invoicing' ); ?> |
|
265 | - <?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $minimum_price;?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?> |
|
264 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
265 | + <?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $minimum_price; ?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?> |
|
266 | 266 | </label> |
267 | 267 | |
268 | - <?php do_action( 'wpinv_prices_metabox_minimum_price_field', $item ); ?> |
|
268 | + <?php do_action('wpinv_prices_metabox_minimum_price_field', $item); ?> |
|
269 | 269 | </p> |
270 | 270 | |
271 | 271 | <?php } ?> |
272 | 272 | |
273 | 273 | <p class="wpinv-row-is-recurring"> |
274 | 274 | <label for="wpinv_is_recurring"> |
275 | - <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> /> |
|
276 | - <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?> |
|
275 | + <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> /> |
|
276 | + <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?> |
|
277 | 277 | </label> |
278 | - <?php do_action( 'wpinv_prices_metabox_is_recurring_field', $item ); ?> |
|
278 | + <?php do_action('wpinv_prices_metabox_is_recurring_field', $item); ?> |
|
279 | 279 | </p> |
280 | - <p class="wpinv-row-recurring-fields <?php echo $class;?>"> |
|
281 | - <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e( 'day(s)', 'invoicing' ); ?>" <?php selected( 'D', $period );?>><?php _e( 'Daily', 'invoicing' ); ?></option><option value="W" data-text="<?php esc_attr_e( 'week(s)', 'invoicing' ); ?>" <?php selected( 'W', $period );?>><?php _e( 'Weekly', 'invoicing' ); ?></option><option value="M" data-text="<?php esc_attr_e( 'month(s)', 'invoicing' ); ?>" <?php selected( 'M', $period );?>><?php _e( 'Monthly', 'invoicing' ); ?></option><option value="Y" data-text="<?php esc_attr_e( 'year(s)', 'invoicing' ); ?>" <?php selected( 'Y', $period );?>><?php _e( 'Yearly', 'invoicing' ); ?></option></select></label> |
|
282 | - <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array( |
|
280 | + <p class="wpinv-row-recurring-fields <?php echo $class; ?>"> |
|
281 | + <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e('day(s)', 'invoicing'); ?>" <?php selected('D', $period); ?>><?php _e('Daily', 'invoicing'); ?></option><option value="W" data-text="<?php esc_attr_e('week(s)', 'invoicing'); ?>" <?php selected('W', $period); ?>><?php _e('Weekly', 'invoicing'); ?></option><option value="M" data-text="<?php esc_attr_e('month(s)', 'invoicing'); ?>" <?php selected('M', $period); ?>><?php _e('Monthly', 'invoicing'); ?></option><option value="Y" data-text="<?php esc_attr_e('year(s)', 'invoicing'); ?>" <?php selected('Y', $period); ?>><?php _e('Yearly', 'invoicing'); ?></option></select></label> |
|
282 | + <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array( |
|
283 | 283 | 'options' => $intervals, |
284 | 284 | 'name' => 'wpinv_recurring_interval', |
285 | 285 | 'id' => 'wpinv_recurring_interval', |
@@ -287,30 +287,30 @@ discard block |
||
287 | 287 | 'show_option_all' => false, |
288 | 288 | 'show_option_none' => false, |
289 | 289 | 'class' => 'wpi_select2', |
290 | - ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label> |
|
291 | - <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e( 'for', 'invoicing' );?> <input class="small-text" type="number" value="<?php echo $times;?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e( 'time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing' );?></label> |
|
290 | + )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label> |
|
291 | + <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e('for', 'invoicing'); ?> <input class="small-text" type="number" value="<?php echo $times; ?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e('time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing'); ?></label> |
|
292 | 292 | <span class="clear wpi-trial-clr"></span> |
293 | 293 | <label class="wpinv-free-trial" for="wpinv_free_trial"> |
294 | - <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> |
|
295 | - <?php echo __( 'Offer free trial for', 'invoicing' ); ?> |
|
294 | + <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool) $free_trial); ?> /> |
|
295 | + <?php echo __('Offer free trial for', 'invoicing'); ?> |
|
296 | 296 | </label> |
297 | 297 | <label class="wpinv-trial-interval" for="wpinv_trial_interval"> |
298 | - <input class="small-text" type="number" value="<?php echo $trial_interval;?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected( 'D', $trial_period );?>><?php _e( 'day(s)', 'invoicing' ); ?></option><option value="W" <?php selected( 'W', $trial_period );?>><?php _e( 'week(s)', 'invoicing' ); ?></option><option value="M" <?php selected( 'M', $trial_period );?>><?php _e( 'month(s)', 'invoicing' ); ?></option><option value="Y" <?php selected( 'Y', $trial_period );?>><?php _e( 'year(s)', 'invoicing' ); ?></option></select> |
|
298 | + <input class="small-text" type="number" value="<?php echo $trial_interval; ?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected('D', $trial_period); ?>><?php _e('day(s)', 'invoicing'); ?></option><option value="W" <?php selected('W', $trial_period); ?>><?php _e('week(s)', 'invoicing'); ?></option><option value="M" <?php selected('M', $trial_period); ?>><?php _e('month(s)', 'invoicing'); ?></option><option value="Y" <?php selected('Y', $trial_period); ?>><?php _e('year(s)', 'invoicing'); ?></option></select> |
|
299 | 299 | </label> |
300 | - <?php do_action( 'wpinv_prices_metabox_recurring_fields', $item ); ?> |
|
300 | + <?php do_action('wpinv_prices_metabox_recurring_fields', $item); ?> |
|
301 | 301 | </p> |
302 | - <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" /> |
|
303 | - <?php do_action( 'wpinv_item_price_field', $post->ID ); ?> |
|
302 | + <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" /> |
|
303 | + <?php do_action('wpinv_item_price_field', $post->ID); ?> |
|
304 | 304 | <?php |
305 | 305 | } |
306 | 306 | |
307 | - public static function vat_rules( $post ) { |
|
307 | + public static function vat_rules($post) { |
|
308 | 308 | global $wpinv_euvat; |
309 | 309 | |
310 | - $rule_type = $wpinv_euvat->get_item_rule( $post->ID ); |
|
310 | + $rule_type = $wpinv_euvat->get_item_rule($post->ID); |
|
311 | 311 | ?> |
312 | - <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label> |
|
313 | - <?php echo wpinv_html_select( array( |
|
312 | + <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label> |
|
313 | + <?php echo wpinv_html_select(array( |
|
314 | 314 | 'options' => $wpinv_euvat->get_rules(), |
315 | 315 | 'name' => 'wpinv_vat_rules', |
316 | 316 | 'id' => 'wpinv_vat_rules', |
@@ -318,19 +318,19 @@ discard block |
||
318 | 318 | 'show_option_all' => false, |
319 | 319 | 'show_option_none' => false, |
320 | 320 | 'class' => 'gdmbx2-text-medium wpinv-vat-rules wpi_select2', |
321 | - ) ); ?> |
|
321 | + )); ?> |
|
322 | 322 | </p> |
323 | - <p class="wpi-m0"><?php _e( 'When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing' ); ?></p> |
|
324 | - <p class="wpi-m0"><?php _e( 'If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing' ); ?></p> |
|
323 | + <p class="wpi-m0"><?php _e('When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing'); ?></p> |
|
324 | + <p class="wpi-m0"><?php _e('If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing'); ?></p> |
|
325 | 325 | <?php |
326 | 326 | } |
327 | 327 | |
328 | - public static function vat_classes( $post ) { |
|
328 | + public static function vat_classes($post) { |
|
329 | 329 | global $wpinv_euvat; |
330 | 330 | |
331 | - $vat_class = $wpinv_euvat->get_item_class( $post->ID ); |
|
331 | + $vat_class = $wpinv_euvat->get_item_class($post->ID); |
|
332 | 332 | ?> |
333 | - <p><?php echo wpinv_html_select( array( |
|
333 | + <p><?php echo wpinv_html_select(array( |
|
334 | 334 | 'options' => $wpinv_euvat->get_all_classes(), |
335 | 335 | 'name' => 'wpinv_vat_class', |
336 | 336 | 'id' => 'wpinv_vat_class', |
@@ -338,18 +338,18 @@ discard block |
||
338 | 338 | 'show_option_all' => false, |
339 | 339 | 'show_option_none' => false, |
340 | 340 | 'class' => 'gdmbx2-text-medium wpinv-vat-class wpi_select2', |
341 | - ) ); ?> |
|
341 | + )); ?> |
|
342 | 342 | </p> |
343 | - <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p> |
|
343 | + <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p> |
|
344 | 344 | <?php |
345 | 345 | } |
346 | 346 | |
347 | - public static function item_info( $post ) { |
|
348 | - $item_type = wpinv_get_item_type( $post->ID ); |
|
349 | - do_action( 'wpinv_item_info_metabox_before', $post ); |
|
347 | + public static function item_info($post) { |
|
348 | + $item_type = wpinv_get_item_type($post->ID); |
|
349 | + do_action('wpinv_item_info_metabox_before', $post); |
|
350 | 350 | ?> |
351 | - <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label> |
|
352 | - <?php echo wpinv_html_select( array( |
|
351 | + <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label> |
|
352 | + <?php echo wpinv_html_select(array( |
|
353 | 353 | 'options' => wpinv_get_item_types(), |
354 | 354 | 'name' => 'wpinv_item_type', |
355 | 355 | 'id' => 'wpinv_item_type', |
@@ -357,127 +357,127 @@ discard block |
||
357 | 357 | 'show_option_all' => false, |
358 | 358 | 'show_option_none' => false, |
359 | 359 | 'class' => 'gdmbx2-text-medium wpinv-item-type', |
360 | - ) ); ?> |
|
360 | + )); ?> |
|
361 | 361 | </p> |
362 | - <p class="wpi-m0"><?php _e( 'Select item type.', 'invoicing' );?><br><?php _e( '<b>Standard:</b> Standard item type', 'invoicing' );?><br><?php _e( '<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing' );?></p> |
|
362 | + <p class="wpi-m0"><?php _e('Select item type.', 'invoicing'); ?><br><?php _e('<b>Standard:</b> Standard item type', 'invoicing'); ?><br><?php _e('<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing'); ?></p> |
|
363 | 363 | <?php |
364 | - do_action( 'wpinv_item_info_metabox_after', $post ); |
|
364 | + do_action('wpinv_item_info_metabox_after', $post); |
|
365 | 365 | } |
366 | 366 | |
367 | - public static function meta_values( $post ) { |
|
368 | - $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array( |
|
367 | + public static function meta_values($post) { |
|
368 | + $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array( |
|
369 | 369 | 'type', |
370 | 370 | 'custom_id' |
371 | - ) ); |
|
371 | + )); |
|
372 | 372 | |
373 | - if ( empty( $meta_keys ) ) { |
|
373 | + if (empty($meta_keys)) { |
|
374 | 374 | return; |
375 | 375 | } |
376 | 376 | |
377 | - do_action( 'wpinv_meta_values_metabox_before', $post ); |
|
377 | + do_action('wpinv_meta_values_metabox_before', $post); |
|
378 | 378 | |
379 | - foreach ( $meta_keys as $meta_key ) { |
|
379 | + foreach ($meta_keys as $meta_key) { |
|
380 | 380 | ?> |
381 | - <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p> |
|
381 | + <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p> |
|
382 | 382 | <?php |
383 | 383 | } |
384 | 384 | |
385 | - do_action( 'wpinv_meta_values_metabox_after', $post ); |
|
385 | + do_action('wpinv_meta_values_metabox_after', $post); |
|
386 | 386 | } |
387 | 387 | |
388 | - public static function save( $post_id, $data, $post ) { |
|
389 | - $invoice = new WPInv_Invoice( $post_id ); |
|
388 | + public static function save($post_id, $data, $post) { |
|
389 | + $invoice = new WPInv_Invoice($post_id); |
|
390 | 390 | |
391 | 391 | // Billing |
392 | - $first_name = sanitize_text_field( $data['wpinv_first_name'] ); |
|
393 | - $last_name = sanitize_text_field( $data['wpinv_last_name'] ); |
|
394 | - $company = sanitize_text_field( $data['wpinv_company'] ); |
|
395 | - $vat_number = sanitize_text_field( $data['wpinv_vat_number'] ); |
|
396 | - $phone = sanitize_text_field( $data['wpinv_phone'] ); |
|
397 | - $address = sanitize_text_field( $data['wpinv_address'] ); |
|
398 | - $city = sanitize_text_field( $data['wpinv_city'] ); |
|
399 | - $zip = sanitize_text_field( $data['wpinv_zip'] ); |
|
400 | - $country = sanitize_text_field( $data['wpinv_country'] ); |
|
401 | - $state = sanitize_text_field( $data['wpinv_state'] ); |
|
392 | + $first_name = sanitize_text_field($data['wpinv_first_name']); |
|
393 | + $last_name = sanitize_text_field($data['wpinv_last_name']); |
|
394 | + $company = sanitize_text_field($data['wpinv_company']); |
|
395 | + $vat_number = sanitize_text_field($data['wpinv_vat_number']); |
|
396 | + $phone = sanitize_text_field($data['wpinv_phone']); |
|
397 | + $address = sanitize_text_field($data['wpinv_address']); |
|
398 | + $city = sanitize_text_field($data['wpinv_city']); |
|
399 | + $zip = sanitize_text_field($data['wpinv_zip']); |
|
400 | + $country = sanitize_text_field($data['wpinv_country']); |
|
401 | + $state = sanitize_text_field($data['wpinv_state']); |
|
402 | 402 | |
403 | 403 | // Details |
404 | - $status = sanitize_text_field( $data['wpinv_status'] ); |
|
405 | - $old_status = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status; |
|
406 | - $number = sanitize_text_field( $data['wpinv_number'] ); |
|
407 | - $due_date = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : ''; |
|
404 | + $status = sanitize_text_field($data['wpinv_status']); |
|
405 | + $old_status = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status; |
|
406 | + $number = sanitize_text_field($data['wpinv_number']); |
|
407 | + $due_date = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : ''; |
|
408 | 408 | //$discounts = sanitize_text_field( $data['wpinv_discounts'] ); |
409 | 409 | //$discount = sanitize_text_field( $data['wpinv_discount'] ); |
410 | 410 | |
411 | - $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
412 | - |
|
413 | - $invoice->set( 'due_date', $due_date ); |
|
414 | - $invoice->set( 'first_name', $first_name ); |
|
415 | - $invoice->set( 'last_name', $last_name ); |
|
416 | - $invoice->set( 'company', $company ); |
|
417 | - $invoice->set( 'vat_number', $vat_number ); |
|
418 | - $invoice->set( 'phone', $phone ); |
|
419 | - $invoice->set( 'address', $address ); |
|
420 | - $invoice->set( 'city', $city ); |
|
421 | - $invoice->set( 'zip', $zip ); |
|
422 | - $invoice->set( 'country', $country ); |
|
423 | - $invoice->set( 'state', $state ); |
|
424 | - $invoice->set( 'status', $status ); |
|
411 | + $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
412 | + |
|
413 | + $invoice->set('due_date', $due_date); |
|
414 | + $invoice->set('first_name', $first_name); |
|
415 | + $invoice->set('last_name', $last_name); |
|
416 | + $invoice->set('company', $company); |
|
417 | + $invoice->set('vat_number', $vat_number); |
|
418 | + $invoice->set('phone', $phone); |
|
419 | + $invoice->set('address', $address); |
|
420 | + $invoice->set('city', $city); |
|
421 | + $invoice->set('zip', $zip); |
|
422 | + $invoice->set('country', $country); |
|
423 | + $invoice->set('state', $state); |
|
424 | + $invoice->set('status', $status); |
|
425 | 425 | //$invoice->set( 'number', $number ); |
426 | 426 | //$invoice->set( 'discounts', $discounts ); |
427 | 427 | //$invoice->set( 'discount', $discount ); |
428 | - $invoice->set( 'ip', $ip ); |
|
428 | + $invoice->set('ip', $ip); |
|
429 | 429 | $invoice->old_status = $_POST['original_post_status']; |
430 | 430 | |
431 | 431 | $currency = $invoice->get_currency(); |
432 | - if ( ! empty( sanitize_text_field( $data['wpinv_currency'] ) ) ) { |
|
433 | - $currency = sanitize_text_field( $data['wpinv_currency'] ); |
|
432 | + if (!empty(sanitize_text_field($data['wpinv_currency']))) { |
|
433 | + $currency = sanitize_text_field($data['wpinv_currency']); |
|
434 | 434 | } |
435 | 435 | |
436 | - if ( empty( $currency ) ) { |
|
436 | + if (empty($currency)) { |
|
437 | 437 | $currency = wpinv_get_currency(); |
438 | 438 | } |
439 | 439 | |
440 | - if ( ! $invoice->is_paid() ) { |
|
440 | + if (!$invoice->is_paid()) { |
|
441 | 441 | $invoice->currency = $currency; |
442 | 442 | } |
443 | 443 | |
444 | - if ( !empty( $data['wpinv_gateway'] ) ) { |
|
445 | - $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) ); |
|
444 | + if (!empty($data['wpinv_gateway'])) { |
|
445 | + $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway'])); |
|
446 | 446 | } |
447 | 447 | $saved = $invoice->save(); |
448 | 448 | |
449 | 449 | // Check for payment notes |
450 | - if ( !empty( $data['invoice_note'] ) ) { |
|
451 | - $note = wp_kses( $data['invoice_note'], array() ); |
|
452 | - $note_type = sanitize_text_field( $data['invoice_note_type'] ); |
|
450 | + if (!empty($data['invoice_note'])) { |
|
451 | + $note = wp_kses($data['invoice_note'], array()); |
|
452 | + $note_type = sanitize_text_field($data['invoice_note_type']); |
|
453 | 453 | $is_customer_note = $note_type == 'customer' ? 1 : 0; |
454 | 454 | |
455 | - wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note ); |
|
455 | + wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | // Update user address if empty. |
459 | - if ( $saved && !empty( $invoice ) ) { |
|
460 | - if ( $user_id = $invoice->get_user_id() ) { |
|
461 | - $user_address = wpinv_get_user_address( $user_id, false ); |
|
459 | + if ($saved && !empty($invoice)) { |
|
460 | + if ($user_id = $invoice->get_user_id()) { |
|
461 | + $user_address = wpinv_get_user_address($user_id, false); |
|
462 | 462 | |
463 | 463 | if (empty($user_address['first_name'])) { |
464 | - update_user_meta( $user_id, '_wpinv_first_name', $first_name ); |
|
465 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
464 | + update_user_meta($user_id, '_wpinv_first_name', $first_name); |
|
465 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
466 | 466 | } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) { |
467 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
467 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) { |
471 | - update_user_meta( $user_id, '_wpinv_address', $address ); |
|
472 | - update_user_meta( $user_id, '_wpinv_city', $city ); |
|
473 | - update_user_meta( $user_id, '_wpinv_state', $state ); |
|
474 | - update_user_meta( $user_id, '_wpinv_country', $country ); |
|
475 | - update_user_meta( $user_id, '_wpinv_zip', $zip ); |
|
476 | - update_user_meta( $user_id, '_wpinv_phone', $phone ); |
|
471 | + update_user_meta($user_id, '_wpinv_address', $address); |
|
472 | + update_user_meta($user_id, '_wpinv_city', $city); |
|
473 | + update_user_meta($user_id, '_wpinv_state', $state); |
|
474 | + update_user_meta($user_id, '_wpinv_country', $country); |
|
475 | + update_user_meta($user_id, '_wpinv_zip', $zip); |
|
476 | + update_user_meta($user_id, '_wpinv_phone', $phone); |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
480 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
480 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | return $saved; |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if ( ! defined( 'ABSPATH' ) ) { |
|
4 | + exit; |
|
5 | +} |
|
4 | 6 | |
5 | 7 | add_action( 'wpinv_manual_cc_form', '__return_false' ); |
6 | 8 | add_filter( 'wpinv_manual_support_subscription', '__return_true' ); |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
3 | +if (!defined('ABSPATH')) exit; |
|
4 | 4 | |
5 | -add_action( 'wpinv_manual_cc_form', '__return_false' ); |
|
6 | -add_filter( 'wpinv_manual_support_subscription', '__return_true' ); |
|
5 | +add_action('wpinv_manual_cc_form', '__return_false'); |
|
6 | +add_filter('wpinv_manual_support_subscription', '__return_true'); |
|
7 | 7 | |
8 | -function wpinv_process_manual_payment( $purchase_data ) { |
|
9 | - if( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'wpi-gateway' ) ) { |
|
10 | - wp_die( __( 'Nonce verification has failed', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
|
8 | +function wpinv_process_manual_payment($purchase_data) { |
|
9 | + if (!wp_verify_nonce($purchase_data['gateway_nonce'], 'wpi-gateway')) { |
|
10 | + wp_die(__('Nonce verification has failed', 'invoicing'), __('Error', 'invoicing'), array('response' => 403)); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /* |
@@ -42,45 +42,45 @@ discard block |
||
42 | 42 | ); |
43 | 43 | |
44 | 44 | // Record the pending payment |
45 | - $invoice = wpinv_get_invoice( $purchase_data['invoice_id'] ); |
|
45 | + $invoice = wpinv_get_invoice($purchase_data['invoice_id']); |
|
46 | 46 | |
47 | - if ( !empty( $invoice ) ) { |
|
48 | - wpinv_set_payment_transaction_id( $invoice->ID, $invoice->generate_key() ); |
|
49 | - wpinv_update_payment_status( $invoice, 'publish' ); |
|
47 | + if (!empty($invoice)) { |
|
48 | + wpinv_set_payment_transaction_id($invoice->ID, $invoice->generate_key()); |
|
49 | + wpinv_update_payment_status($invoice, 'publish'); |
|
50 | 50 | |
51 | 51 | // Empty the shopping cart |
52 | 52 | wpinv_empty_cart(); |
53 | 53 | |
54 | 54 | // (Maybe) set recurring hooks. |
55 | - wpinv_start_manual_subscription_profile( $purchase_data['invoice_id'] ); |
|
55 | + wpinv_start_manual_subscription_profile($purchase_data['invoice_id']); |
|
56 | 56 | |
57 | - do_action( 'wpinv_send_to_success_page', $invoice->ID, $payment_data ); |
|
57 | + do_action('wpinv_send_to_success_page', $invoice->ID, $payment_data); |
|
58 | 58 | |
59 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
59 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
60 | 60 | } else { |
61 | - wpinv_record_gateway_error( __( 'Payment Error', 'invoicing' ), sprintf( __( 'Payment creation failed while processing a manual (free or test) purchase. Payment data: %s', 'invoicing' ), json_encode( $payment_data ) ), $invoice ); |
|
61 | + wpinv_record_gateway_error(__('Payment Error', 'invoicing'), sprintf(__('Payment creation failed while processing a manual (free or test) purchase. Payment data: %s', 'invoicing'), json_encode($payment_data)), $invoice); |
|
62 | 62 | // If errors are present, send the user back to the purchase page so they can be corrected |
63 | - wpinv_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['wpi-gateway'] ); |
|
63 | + wpinv_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['wpi-gateway']); |
|
64 | 64 | } |
65 | 65 | } |
66 | -add_action( 'wpinv_gateway_manual', 'wpinv_process_manual_payment' ); |
|
66 | +add_action('wpinv_gateway_manual', 'wpinv_process_manual_payment'); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Starts a manual subscription profile. |
70 | 70 | */ |
71 | -function wpinv_start_manual_subscription_profile( $invoice_id ) { |
|
71 | +function wpinv_start_manual_subscription_profile($invoice_id) { |
|
72 | 72 | |
73 | 73 | // Retrieve the subscription. |
74 | - $subscription = wpinv_get_subscription( $invoice_id ); |
|
75 | - if ( empty( $subscription ) ) { |
|
74 | + $subscription = wpinv_get_subscription($invoice_id); |
|
75 | + if (empty($subscription)) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | 79 | // Schedule an action to run when the subscription expires. |
80 | 80 | $action_id = as_schedule_single_action( |
81 | - strtotime( $subscription->expiration ), |
|
81 | + strtotime($subscription->expiration), |
|
82 | 82 | 'wpinv_renew_manual_subscription_profile', |
83 | - array( $invoice_id ), |
|
83 | + array($invoice_id), |
|
84 | 84 | 'invoicing' |
85 | 85 | ); |
86 | 86 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * Renews a manual subscription profile. |
99 | 99 | */ |
100 | -function wpinv_renew_manual_subscription_profile( $invoice_id ) { |
|
100 | +function wpinv_renew_manual_subscription_profile($invoice_id) { |
|
101 | 101 | |
102 | 102 | // Retrieve the subscription. |
103 | - $subscription = wpinv_get_subscription( $invoice_id ); |
|
104 | - if ( empty( $subscription ) ) { |
|
103 | + $subscription = wpinv_get_subscription($invoice_id); |
|
104 | + if (empty($subscription)) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | $max_bills = $subscription->bill_times; |
110 | 110 | |
111 | 111 | // If we have not maxed out on bill times... |
112 | - if ( empty( $bill_times ) || $times_billed > $max_bills ) { |
|
112 | + if (empty($bill_times) || $times_billed > $max_bills) { |
|
113 | 113 | |
114 | 114 | // Renew the subscription. |
115 | - $subscription->add_payment( array( |
|
115 | + $subscription->add_payment(array( |
|
116 | 116 | 'amount' => $subscription->recurring_amount, |
117 | 117 | 'transaction_id' => time(), |
118 | 118 | 'gateway' => 'manual' |
119 | - ) ); |
|
119 | + )); |
|
120 | 120 | |
121 | 121 | // Calculate the new expiration. |
122 | - $new_expiration = strtotime( "+ {$subscription->frequency} {$subscription->period}", strtotime( $subscription->expiration ) ); |
|
122 | + $new_expiration = strtotime("+ {$subscription->frequency} {$subscription->period}", strtotime($subscription->expiration)); |
|
123 | 123 | |
124 | 124 | // Schedule an action to run when the subscription expires. |
125 | 125 | $action_id = as_schedule_single_action( |
126 | 126 | $new_expiration, |
127 | 127 | 'wpinv_renew_manual_subscription_profile', |
128 | - array( $invoice_id ), |
|
128 | + array($invoice_id), |
|
129 | 129 | 'invoicing' |
130 | 130 | ); |
131 | 131 | |
132 | 132 | $subscription->update( |
133 | 133 | array( |
134 | - 'expiration' => date_i18n( 'Y-m-d H:i:s', $new_expiration ), |
|
134 | + 'expiration' => date_i18n('Y-m-d H:i:s', $new_expiration), |
|
135 | 135 | 'status' => 'active', |
136 | 136 | 'profile_id' => $action_id, |
137 | 137 | ) |
@@ -149,4 +149,4 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | } |
152 | -add_action( 'wpinv_renew_manual_subscription_profile', 'wpinv_renew_manual_subscription_profile' ); |
|
152 | +add_action('wpinv_renew_manual_subscription_profile', 'wpinv_renew_manual_subscription_profile'); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @return string The action ID. |
14 | 14 | */ |
15 | 15 | function as_enqueue_async_action( $hook, $args = array(), $group = '' ) { |
16 | - return ActionScheduler::factory()->async( $hook, $args, $group ); |
|
16 | + return ActionScheduler::factory()->async( $hook, $args, $group ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return string The job ID |
28 | 28 | */ |
29 | 29 | function as_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
30 | - return ActionScheduler::factory()->single( $hook, $args, $timestamp, $group ); |
|
30 | + return ActionScheduler::factory()->single( $hook, $args, $timestamp, $group ); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return string The job ID |
43 | 43 | */ |
44 | 44 | function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
45 | - return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); |
|
45 | + return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string The job ID |
70 | 70 | */ |
71 | 71 | function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
72 | - return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); |
|
72 | + return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | * @return string The scheduled action ID if a scheduled action was found, or empty string if no matching action found. |
90 | 90 | */ |
91 | 91 | function as_unschedule_action( $hook, $args = array(), $group = '' ) { |
92 | - $params = array(); |
|
93 | - if ( is_array($args) ) { |
|
94 | - $params['args'] = $args; |
|
95 | - } |
|
96 | - if ( !empty($group) ) { |
|
97 | - $params['group'] = $group; |
|
98 | - } |
|
99 | - $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
100 | - |
|
101 | - if ( ! empty( $job_id ) ) { |
|
102 | - ActionScheduler::store()->cancel_action( $job_id ); |
|
103 | - } |
|
104 | - |
|
105 | - return $job_id; |
|
92 | + $params = array(); |
|
93 | + if ( is_array($args) ) { |
|
94 | + $params['args'] = $args; |
|
95 | + } |
|
96 | + if ( !empty($group) ) { |
|
97 | + $params['group'] = $group; |
|
98 | + } |
|
99 | + $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
100 | + |
|
101 | + if ( ! empty( $job_id ) ) { |
|
102 | + ActionScheduler::store()->cancel_action( $job_id ); |
|
103 | + } |
|
104 | + |
|
105 | + return $job_id; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | * @param string $group |
114 | 114 | */ |
115 | 115 | function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) { |
116 | - if ( empty( $args ) ) { |
|
117 | - if ( ! empty( $hook ) && empty( $group ) ) { |
|
118 | - ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook ); |
|
119 | - return; |
|
120 | - } |
|
121 | - if ( ! empty( $group ) && empty( $hook ) ) { |
|
122 | - ActionScheduler_Store::instance()->cancel_actions_by_group( $group ); |
|
123 | - return; |
|
124 | - } |
|
125 | - } |
|
126 | - do { |
|
127 | - $unscheduled_action = as_unschedule_action( $hook, $args, $group ); |
|
128 | - } while ( ! empty( $unscheduled_action ) ); |
|
116 | + if ( empty( $args ) ) { |
|
117 | + if ( ! empty( $hook ) && empty( $group ) ) { |
|
118 | + ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook ); |
|
119 | + return; |
|
120 | + } |
|
121 | + if ( ! empty( $group ) && empty( $hook ) ) { |
|
122 | + ActionScheduler_Store::instance()->cancel_actions_by_group( $group ); |
|
123 | + return; |
|
124 | + } |
|
125 | + } |
|
126 | + do { |
|
127 | + $unscheduled_action = as_unschedule_action( $hook, $args, $group ); |
|
128 | + } while ( ! empty( $unscheduled_action ) ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -144,33 +144,33 @@ discard block |
||
144 | 144 | * @return int|bool The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action. |
145 | 145 | */ |
146 | 146 | function as_next_scheduled_action( $hook, $args = NULL, $group = '' ) { |
147 | - $params = array(); |
|
148 | - if ( is_array($args) ) { |
|
149 | - $params['args'] = $args; |
|
150 | - } |
|
151 | - if ( !empty($group) ) { |
|
152 | - $params['group'] = $group; |
|
153 | - } |
|
154 | - |
|
155 | - $params['status'] = ActionScheduler_Store::STATUS_RUNNING; |
|
156 | - $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
157 | - if ( ! empty( $job_id ) ) { |
|
158 | - return true; |
|
159 | - } |
|
160 | - |
|
161 | - $params['status'] = ActionScheduler_Store::STATUS_PENDING; |
|
162 | - $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
163 | - if ( empty($job_id) ) { |
|
164 | - return false; |
|
165 | - } |
|
166 | - $job = ActionScheduler::store()->fetch_action( $job_id ); |
|
167 | - $scheduled_date = $job->get_schedule()->get_date(); |
|
168 | - if ( $scheduled_date ) { |
|
169 | - return (int) $scheduled_date->format( 'U' ); |
|
170 | - } elseif ( NULL === $scheduled_date ) { // pending async action with NullSchedule |
|
171 | - return true; |
|
172 | - } |
|
173 | - return false; |
|
147 | + $params = array(); |
|
148 | + if ( is_array($args) ) { |
|
149 | + $params['args'] = $args; |
|
150 | + } |
|
151 | + if ( !empty($group) ) { |
|
152 | + $params['group'] = $group; |
|
153 | + } |
|
154 | + |
|
155 | + $params['status'] = ActionScheduler_Store::STATUS_RUNNING; |
|
156 | + $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
157 | + if ( ! empty( $job_id ) ) { |
|
158 | + return true; |
|
159 | + } |
|
160 | + |
|
161 | + $params['status'] = ActionScheduler_Store::STATUS_PENDING; |
|
162 | + $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
163 | + if ( empty($job_id) ) { |
|
164 | + return false; |
|
165 | + } |
|
166 | + $job = ActionScheduler::store()->fetch_action( $job_id ); |
|
167 | + $scheduled_date = $job->get_schedule()->get_date(); |
|
168 | + if ( $scheduled_date ) { |
|
169 | + return (int) $scheduled_date->format( 'U' ); |
|
170 | + } elseif ( NULL === $scheduled_date ) { // pending async action with NullSchedule |
|
171 | + return true; |
|
172 | + } |
|
173 | + return false; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -196,30 +196,30 @@ discard block |
||
196 | 196 | * @return array |
197 | 197 | */ |
198 | 198 | function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
199 | - $store = ActionScheduler::store(); |
|
200 | - foreach ( array('date', 'modified') as $key ) { |
|
201 | - if ( isset($args[$key]) ) { |
|
202 | - $args[$key] = as_get_datetime_object($args[$key]); |
|
203 | - } |
|
204 | - } |
|
205 | - $ids = $store->query_actions( $args ); |
|
206 | - |
|
207 | - if ( $return_format == 'ids' || $return_format == 'int' ) { |
|
208 | - return $ids; |
|
209 | - } |
|
210 | - |
|
211 | - $actions = array(); |
|
212 | - foreach ( $ids as $action_id ) { |
|
213 | - $actions[$action_id] = $store->fetch_action( $action_id ); |
|
214 | - } |
|
215 | - |
|
216 | - if ( $return_format == ARRAY_A ) { |
|
217 | - foreach ( $actions as $action_id => $action_object ) { |
|
218 | - $actions[$action_id] = get_object_vars($action_object); |
|
219 | - } |
|
220 | - } |
|
221 | - |
|
222 | - return $actions; |
|
199 | + $store = ActionScheduler::store(); |
|
200 | + foreach ( array('date', 'modified') as $key ) { |
|
201 | + if ( isset($args[$key]) ) { |
|
202 | + $args[$key] = as_get_datetime_object($args[$key]); |
|
203 | + } |
|
204 | + } |
|
205 | + $ids = $store->query_actions( $args ); |
|
206 | + |
|
207 | + if ( $return_format == 'ids' || $return_format == 'int' ) { |
|
208 | + return $ids; |
|
209 | + } |
|
210 | + |
|
211 | + $actions = array(); |
|
212 | + foreach ( $ids as $action_id ) { |
|
213 | + $actions[$action_id] = $store->fetch_action( $action_id ); |
|
214 | + } |
|
215 | + |
|
216 | + if ( $return_format == ARRAY_A ) { |
|
217 | + foreach ( $actions as $action_id => $action_object ) { |
|
218 | + $actions[$action_id] = get_object_vars($action_object); |
|
219 | + } |
|
220 | + } |
|
221 | + |
|
222 | + return $actions; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | * @return ActionScheduler_DateTime |
241 | 241 | */ |
242 | 242 | function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) { |
243 | - if ( is_object( $date_string ) && $date_string instanceof DateTime ) { |
|
244 | - $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); |
|
245 | - } elseif ( is_numeric( $date_string ) ) { |
|
246 | - $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); |
|
247 | - } else { |
|
248 | - $date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) ); |
|
249 | - } |
|
250 | - return $date; |
|
243 | + if ( is_object( $date_string ) && $date_string instanceof DateTime ) { |
|
244 | + $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); |
|
245 | + } elseif ( is_numeric( $date_string ) ) { |
|
246 | + $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); |
|
247 | + } else { |
|
248 | + $date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) ); |
|
249 | + } |
|
250 | + return $date; |
|
251 | 251 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | * @param string $group The group to assign this job to. |
13 | 13 | * @return string The action ID. |
14 | 14 | */ |
15 | -function as_enqueue_async_action( $hook, $args = array(), $group = '' ) { |
|
16 | - return ActionScheduler::factory()->async( $hook, $args, $group ); |
|
15 | +function as_enqueue_async_action($hook, $args = array(), $group = '') { |
|
16 | + return ActionScheduler::factory()->async($hook, $args, $group); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string The job ID |
28 | 28 | */ |
29 | -function as_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
|
30 | - return ActionScheduler::factory()->single( $hook, $args, $timestamp, $group ); |
|
29 | +function as_schedule_single_action($timestamp, $hook, $args = array(), $group = '') { |
|
30 | + return ActionScheduler::factory()->single($hook, $args, $timestamp, $group); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string The job ID |
43 | 43 | */ |
44 | -function as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
|
45 | - return ActionScheduler::factory()->recurring( $hook, $args, $timestamp, $interval_in_seconds, $group ); |
|
44 | +function as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') { |
|
45 | + return ActionScheduler::factory()->recurring($hook, $args, $timestamp, $interval_in_seconds, $group); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string The job ID |
70 | 70 | */ |
71 | -function as_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
|
72 | - return ActionScheduler::factory()->cron( $hook, $args, $timestamp, $schedule, $group ); |
|
71 | +function as_schedule_cron_action($timestamp, $schedule, $hook, $args = array(), $group = '') { |
|
72 | + return ActionScheduler::factory()->cron($hook, $args, $timestamp, $schedule, $group); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string The scheduled action ID if a scheduled action was found, or empty string if no matching action found. |
90 | 90 | */ |
91 | -function as_unschedule_action( $hook, $args = array(), $group = '' ) { |
|
91 | +function as_unschedule_action($hook, $args = array(), $group = '') { |
|
92 | 92 | $params = array(); |
93 | - if ( is_array($args) ) { |
|
93 | + if (is_array($args)) { |
|
94 | 94 | $params['args'] = $args; |
95 | 95 | } |
96 | - if ( !empty($group) ) { |
|
96 | + if (!empty($group)) { |
|
97 | 97 | $params['group'] = $group; |
98 | 98 | } |
99 | - $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
99 | + $job_id = ActionScheduler::store()->find_action($hook, $params); |
|
100 | 100 | |
101 | - if ( ! empty( $job_id ) ) { |
|
102 | - ActionScheduler::store()->cancel_action( $job_id ); |
|
101 | + if (!empty($job_id)) { |
|
102 | + ActionScheduler::store()->cancel_action($job_id); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $job_id; |
@@ -112,20 +112,20 @@ discard block |
||
112 | 112 | * @param array $args Args that would have been passed to the job |
113 | 113 | * @param string $group |
114 | 114 | */ |
115 | -function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) { |
|
116 | - if ( empty( $args ) ) { |
|
117 | - if ( ! empty( $hook ) && empty( $group ) ) { |
|
118 | - ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook ); |
|
115 | +function as_unschedule_all_actions($hook, $args = array(), $group = '') { |
|
116 | + if (empty($args)) { |
|
117 | + if (!empty($hook) && empty($group)) { |
|
118 | + ActionScheduler_Store::instance()->cancel_actions_by_hook($hook); |
|
119 | 119 | return; |
120 | 120 | } |
121 | - if ( ! empty( $group ) && empty( $hook ) ) { |
|
122 | - ActionScheduler_Store::instance()->cancel_actions_by_group( $group ); |
|
121 | + if (!empty($group) && empty($hook)) { |
|
122 | + ActionScheduler_Store::instance()->cancel_actions_by_group($group); |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | do { |
127 | - $unscheduled_action = as_unschedule_action( $hook, $args, $group ); |
|
128 | - } while ( ! empty( $unscheduled_action ) ); |
|
127 | + $unscheduled_action = as_unschedule_action($hook, $args, $group); |
|
128 | + } while (!empty($unscheduled_action)); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -143,31 +143,31 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return int|bool The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action. |
145 | 145 | */ |
146 | -function as_next_scheduled_action( $hook, $args = NULL, $group = '' ) { |
|
146 | +function as_next_scheduled_action($hook, $args = NULL, $group = '') { |
|
147 | 147 | $params = array(); |
148 | - if ( is_array($args) ) { |
|
148 | + if (is_array($args)) { |
|
149 | 149 | $params['args'] = $args; |
150 | 150 | } |
151 | - if ( !empty($group) ) { |
|
151 | + if (!empty($group)) { |
|
152 | 152 | $params['group'] = $group; |
153 | 153 | } |
154 | 154 | |
155 | 155 | $params['status'] = ActionScheduler_Store::STATUS_RUNNING; |
156 | - $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
157 | - if ( ! empty( $job_id ) ) { |
|
156 | + $job_id = ActionScheduler::store()->find_action($hook, $params); |
|
157 | + if (!empty($job_id)) { |
|
158 | 158 | return true; |
159 | 159 | } |
160 | 160 | |
161 | 161 | $params['status'] = ActionScheduler_Store::STATUS_PENDING; |
162 | - $job_id = ActionScheduler::store()->find_action( $hook, $params ); |
|
163 | - if ( empty($job_id) ) { |
|
162 | + $job_id = ActionScheduler::store()->find_action($hook, $params); |
|
163 | + if (empty($job_id)) { |
|
164 | 164 | return false; |
165 | 165 | } |
166 | - $job = ActionScheduler::store()->fetch_action( $job_id ); |
|
166 | + $job = ActionScheduler::store()->fetch_action($job_id); |
|
167 | 167 | $scheduled_date = $job->get_schedule()->get_date(); |
168 | - if ( $scheduled_date ) { |
|
169 | - return (int) $scheduled_date->format( 'U' ); |
|
170 | - } elseif ( NULL === $scheduled_date ) { // pending async action with NullSchedule |
|
168 | + if ($scheduled_date) { |
|
169 | + return (int) $scheduled_date->format('U'); |
|
170 | + } elseif (NULL === $scheduled_date) { // pending async action with NullSchedule |
|
171 | 171 | return true; |
172 | 172 | } |
173 | 173 | return false; |
@@ -195,26 +195,26 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @return array |
197 | 197 | */ |
198 | -function as_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
|
198 | +function as_get_scheduled_actions($args = array(), $return_format = OBJECT) { |
|
199 | 199 | $store = ActionScheduler::store(); |
200 | - foreach ( array('date', 'modified') as $key ) { |
|
201 | - if ( isset($args[$key]) ) { |
|
200 | + foreach (array('date', 'modified') as $key) { |
|
201 | + if (isset($args[$key])) { |
|
202 | 202 | $args[$key] = as_get_datetime_object($args[$key]); |
203 | 203 | } |
204 | 204 | } |
205 | - $ids = $store->query_actions( $args ); |
|
205 | + $ids = $store->query_actions($args); |
|
206 | 206 | |
207 | - if ( $return_format == 'ids' || $return_format == 'int' ) { |
|
207 | + if ($return_format == 'ids' || $return_format == 'int') { |
|
208 | 208 | return $ids; |
209 | 209 | } |
210 | 210 | |
211 | 211 | $actions = array(); |
212 | - foreach ( $ids as $action_id ) { |
|
213 | - $actions[$action_id] = $store->fetch_action( $action_id ); |
|
212 | + foreach ($ids as $action_id) { |
|
213 | + $actions[$action_id] = $store->fetch_action($action_id); |
|
214 | 214 | } |
215 | 215 | |
216 | - if ( $return_format == ARRAY_A ) { |
|
217 | - foreach ( $actions as $action_id => $action_object ) { |
|
216 | + if ($return_format == ARRAY_A) { |
|
217 | + foreach ($actions as $action_id => $action_object) { |
|
218 | 218 | $actions[$action_id] = get_object_vars($action_object); |
219 | 219 | } |
220 | 220 | } |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return ActionScheduler_DateTime |
241 | 241 | */ |
242 | -function as_get_datetime_object( $date_string = null, $timezone = 'UTC' ) { |
|
243 | - if ( is_object( $date_string ) && $date_string instanceof DateTime ) { |
|
244 | - $date = new ActionScheduler_DateTime( $date_string->format( 'Y-m-d H:i:s' ), new DateTimeZone( $timezone ) ); |
|
245 | - } elseif ( is_numeric( $date_string ) ) { |
|
246 | - $date = new ActionScheduler_DateTime( '@' . $date_string, new DateTimeZone( $timezone ) ); |
|
242 | +function as_get_datetime_object($date_string = null, $timezone = 'UTC') { |
|
243 | + if (is_object($date_string) && $date_string instanceof DateTime) { |
|
244 | + $date = new ActionScheduler_DateTime($date_string->format('Y-m-d H:i:s'), new DateTimeZone($timezone)); |
|
245 | + } elseif (is_numeric($date_string)) { |
|
246 | + $date = new ActionScheduler_DateTime('@' . $date_string, new DateTimeZone($timezone)); |
|
247 | 247 | } else { |
248 | - $date = new ActionScheduler_DateTime( $date_string, new DateTimeZone( $timezone ) ); |
|
248 | + $date = new ActionScheduler_DateTime($date_string, new DateTimeZone($timezone)); |
|
249 | 249 | } |
250 | 250 | return $date; |
251 | 251 | } |
@@ -10,138 +10,138 @@ |
||
10 | 10 | */ |
11 | 11 | class ActionScheduler_AdminView_Deprecated { |
12 | 12 | |
13 | - public function action_scheduler_post_type_args( $args ) { |
|
14 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
15 | - return $args; |
|
16 | - } |
|
13 | + public function action_scheduler_post_type_args( $args ) { |
|
14 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
15 | + return $args; |
|
16 | + } |
|
17 | 17 | |
18 | - /** |
|
19 | - * Customise the post status related views displayed on the Scheduled Actions administration screen. |
|
20 | - * |
|
21 | - * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
22 | - * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
23 | - */ |
|
24 | - public function list_table_views( $views ) { |
|
25 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
26 | - return $views; |
|
27 | - } |
|
18 | + /** |
|
19 | + * Customise the post status related views displayed on the Scheduled Actions administration screen. |
|
20 | + * |
|
21 | + * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
22 | + * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
23 | + */ |
|
24 | + public function list_table_views( $views ) { |
|
25 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
26 | + return $views; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Do not include the "Edit" action for the Scheduled Actions administration screen. |
|
31 | - * |
|
32 | - * Hooked to the 'bulk_actions-edit-action-scheduler' filter. |
|
33 | - * |
|
34 | - * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
35 | - * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
36 | - */ |
|
37 | - public function bulk_actions( $actions ) { |
|
38 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
39 | - return $actions; |
|
40 | - } |
|
29 | + /** |
|
30 | + * Do not include the "Edit" action for the Scheduled Actions administration screen. |
|
31 | + * |
|
32 | + * Hooked to the 'bulk_actions-edit-action-scheduler' filter. |
|
33 | + * |
|
34 | + * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
35 | + * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
36 | + */ |
|
37 | + public function bulk_actions( $actions ) { |
|
38 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
39 | + return $actions; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Completely customer the columns displayed on the Scheduled Actions administration screen. |
|
44 | - * |
|
45 | - * Because we can't filter the content of the default title and date columns, we need to recreate our own |
|
46 | - * custom columns for displaying those post fields. For the column content, @see self::list_table_column_content(). |
|
47 | - * |
|
48 | - * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
49 | - * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
50 | - */ |
|
51 | - public function list_table_columns( $columns ) { |
|
52 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
53 | - return $columns; |
|
54 | - } |
|
42 | + /** |
|
43 | + * Completely customer the columns displayed on the Scheduled Actions administration screen. |
|
44 | + * |
|
45 | + * Because we can't filter the content of the default title and date columns, we need to recreate our own |
|
46 | + * custom columns for displaying those post fields. For the column content, @see self::list_table_column_content(). |
|
47 | + * |
|
48 | + * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
49 | + * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
50 | + */ |
|
51 | + public function list_table_columns( $columns ) { |
|
52 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
53 | + return $columns; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Make our custom title & date columns use defaulting title & date sorting. |
|
58 | - * |
|
59 | - * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
60 | - * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
61 | - */ |
|
62 | - public static function list_table_sortable_columns( $columns ) { |
|
63 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
64 | - return $columns; |
|
65 | - } |
|
56 | + /** |
|
57 | + * Make our custom title & date columns use defaulting title & date sorting. |
|
58 | + * |
|
59 | + * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
60 | + * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
61 | + */ |
|
62 | + public static function list_table_sortable_columns( $columns ) { |
|
63 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
64 | + return $columns; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Print the content for our custom columns. |
|
69 | - * |
|
70 | - * @param string $column_name The key for the column for which we should output our content. |
|
71 | - * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
|
72 | - */ |
|
73 | - public static function list_table_column_content( $column_name, $post_id ) { |
|
74 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
75 | - } |
|
67 | + /** |
|
68 | + * Print the content for our custom columns. |
|
69 | + * |
|
70 | + * @param string $column_name The key for the column for which we should output our content. |
|
71 | + * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
|
72 | + */ |
|
73 | + public static function list_table_column_content( $column_name, $post_id ) { |
|
74 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Hide the inline "Edit" action for all 'scheduled-action' posts. |
|
79 | - * |
|
80 | - * Hooked to the 'post_row_actions' filter. |
|
81 | - * |
|
82 | - * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
83 | - * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
84 | - */ |
|
85 | - public static function row_actions( $actions, $post ) { |
|
86 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
87 | - return $actions; |
|
88 | - } |
|
77 | + /** |
|
78 | + * Hide the inline "Edit" action for all 'scheduled-action' posts. |
|
79 | + * |
|
80 | + * Hooked to the 'post_row_actions' filter. |
|
81 | + * |
|
82 | + * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
83 | + * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
84 | + */ |
|
85 | + public static function row_actions( $actions, $post ) { |
|
86 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
87 | + return $actions; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Run an action when triggered from the Action Scheduler administration screen. |
|
92 | - * |
|
93 | - * @codeCoverageIgnore |
|
94 | - */ |
|
95 | - public static function maybe_execute_action() { |
|
96 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
97 | - } |
|
90 | + /** |
|
91 | + * Run an action when triggered from the Action Scheduler administration screen. |
|
92 | + * |
|
93 | + * @codeCoverageIgnore |
|
94 | + */ |
|
95 | + public static function maybe_execute_action() { |
|
96 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Convert an interval of seconds into a two part human friendly string. |
|
101 | - * |
|
102 | - * The WordPress human_time_diff() function only calculates the time difference to one degree, meaning |
|
103 | - * even if an action is 1 day and 11 hours away, it will display "1 day". This funciton goes one step |
|
104 | - * further to display two degrees of accuracy. |
|
105 | - * |
|
106 | - * Based on Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ |
|
107 | - * |
|
108 | - * @param int $interval A interval in seconds. |
|
109 | - * @return string A human friendly string representation of the interval. |
|
110 | - */ |
|
111 | - public static function admin_notices() { |
|
112 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
113 | - } |
|
99 | + /** |
|
100 | + * Convert an interval of seconds into a two part human friendly string. |
|
101 | + * |
|
102 | + * The WordPress human_time_diff() function only calculates the time difference to one degree, meaning |
|
103 | + * even if an action is 1 day and 11 hours away, it will display "1 day". This funciton goes one step |
|
104 | + * further to display two degrees of accuracy. |
|
105 | + * |
|
106 | + * Based on Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ |
|
107 | + * |
|
108 | + * @param int $interval A interval in seconds. |
|
109 | + * @return string A human friendly string representation of the interval. |
|
110 | + */ |
|
111 | + public static function admin_notices() { |
|
112 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
117 | - * |
|
118 | - * @param string $orderby MySQL orderby string. |
|
119 | - * @param WP_Query $query Instance of a WP_Query object |
|
120 | - * @return string MySQL orderby string. |
|
121 | - */ |
|
122 | - public function custom_orderby( $orderby, $query ){ |
|
123 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
124 | - } |
|
115 | + /** |
|
116 | + * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
117 | + * |
|
118 | + * @param string $orderby MySQL orderby string. |
|
119 | + * @param WP_Query $query Instance of a WP_Query object |
|
120 | + * @return string MySQL orderby string. |
|
121 | + */ |
|
122 | + public function custom_orderby( $orderby, $query ){ |
|
123 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
128 | - * |
|
129 | - * @param string $search MySQL search string. |
|
130 | - * @param WP_Query $query Instance of a WP_Query object |
|
131 | - * @return string MySQL search string. |
|
132 | - */ |
|
133 | - public function search_post_password( $search, $query ) { |
|
134 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
135 | - } |
|
126 | + /** |
|
127 | + * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
128 | + * |
|
129 | + * @param string $search MySQL search string. |
|
130 | + * @param WP_Query $query Instance of a WP_Query object |
|
131 | + * @return string MySQL search string. |
|
132 | + */ |
|
133 | + public function search_post_password( $search, $query ) { |
|
134 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * Change messages when a scheduled action is updated. |
|
139 | - * |
|
140 | - * @param array $messages |
|
141 | - * @return array |
|
142 | - */ |
|
143 | - public function post_updated_messages( $messages ) { |
|
144 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
145 | - return $messages; |
|
146 | - } |
|
137 | + /** |
|
138 | + * Change messages when a scheduled action is updated. |
|
139 | + * |
|
140 | + * @param array $messages |
|
141 | + * @return array |
|
142 | + */ |
|
143 | + public function post_updated_messages( $messages ) { |
|
144 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
145 | + return $messages; |
|
146 | + } |
|
147 | 147 | } |
148 | 148 | \ No newline at end of file |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class ActionScheduler_AdminView_Deprecated { |
12 | 12 | |
13 | - public function action_scheduler_post_type_args( $args ) { |
|
14 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
13 | + public function action_scheduler_post_type_args($args) { |
|
14 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
15 | 15 | return $args; |
16 | 16 | } |
17 | 17 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
22 | 22 | * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
23 | 23 | */ |
24 | - public function list_table_views( $views ) { |
|
25 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
24 | + public function list_table_views($views) { |
|
25 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
26 | 26 | return $views; |
27 | 27 | } |
28 | 28 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
35 | 35 | * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
36 | 36 | */ |
37 | - public function bulk_actions( $actions ) { |
|
38 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
37 | + public function bulk_actions($actions) { |
|
38 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
39 | 39 | return $actions; |
40 | 40 | } |
41 | 41 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
49 | 49 | * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
50 | 50 | */ |
51 | - public function list_table_columns( $columns ) { |
|
52 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
51 | + public function list_table_columns($columns) { |
|
52 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
53 | 53 | return $columns; |
54 | 54 | } |
55 | 55 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
60 | 60 | * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
61 | 61 | */ |
62 | - public static function list_table_sortable_columns( $columns ) { |
|
63 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
62 | + public static function list_table_sortable_columns($columns) { |
|
63 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
64 | 64 | return $columns; |
65 | 65 | } |
66 | 66 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @param string $column_name The key for the column for which we should output our content. |
71 | 71 | * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
72 | 72 | */ |
73 | - public static function list_table_column_content( $column_name, $post_id ) { |
|
74 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
73 | + public static function list_table_column_content($column_name, $post_id) { |
|
74 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
83 | 83 | * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
84 | 84 | */ |
85 | - public static function row_actions( $actions, $post ) { |
|
86 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
85 | + public static function row_actions($actions, $post) { |
|
86 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
87 | 87 | return $actions; |
88 | 88 | } |
89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @codeCoverageIgnore |
94 | 94 | */ |
95 | 95 | public static function maybe_execute_action() { |
96 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
96 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return string A human friendly string representation of the interval. |
110 | 110 | */ |
111 | 111 | public static function admin_notices() { |
112 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
112 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param WP_Query $query Instance of a WP_Query object |
120 | 120 | * @return string MySQL orderby string. |
121 | 121 | */ |
122 | - public function custom_orderby( $orderby, $query ){ |
|
123 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
122 | + public function custom_orderby($orderby, $query) { |
|
123 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * @param WP_Query $query Instance of a WP_Query object |
131 | 131 | * @return string MySQL search string. |
132 | 132 | */ |
133 | - public function search_post_password( $search, $query ) { |
|
134 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
133 | + public function search_post_password($search, $query) { |
|
134 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * @param array $messages |
141 | 141 | * @return array |
142 | 142 | */ |
143 | - public function post_updated_messages( $messages ) { |
|
144 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
143 | + public function post_updated_messages($messages) { |
|
144 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
145 | 145 | return $messages; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | \ No newline at end of file |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * @return string The job ID |
20 | 20 | */ |
21 | 21 | function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
22 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
23 | - return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
22 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
23 | + return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @return string The job ID |
38 | 38 | */ |
39 | 39 | function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
40 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
41 | - return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
40 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
41 | + return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return string The job ID |
66 | 66 | */ |
67 | 67 | function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
68 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
69 | - return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
68 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
69 | + return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @deprecated 2.1.0 |
80 | 80 | */ |
81 | 81 | function wc_unschedule_action( $hook, $args = array(), $group = '' ) { |
82 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
83 | - as_unschedule_action( $hook, $args, $group ); |
|
82 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
83 | + as_unschedule_action( $hook, $args, $group ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * @return int|bool The timestamp for the next occurrence, or false if nothing was found |
94 | 94 | */ |
95 | 95 | function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) { |
96 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
97 | - return as_next_scheduled_action( $hook, $args, $group ); |
|
96 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
97 | + return as_next_scheduled_action( $hook, $args, $group ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -121,6 +121,6 @@ discard block |
||
121 | 121 | * @return array |
122 | 122 | */ |
123 | 123 | function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
124 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
125 | - return as_get_scheduled_actions( $args, $return_format ); |
|
124 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
125 | + return as_get_scheduled_actions( $args, $return_format ); |
|
126 | 126 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The job ID |
20 | 20 | */ |
21 | -function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
|
22 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
23 | - return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
21 | +function wc_schedule_single_action($timestamp, $hook, $args = array(), $group = '') { |
|
22 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_single_action()'); |
|
23 | + return as_schedule_single_action($timestamp, $hook, $args, $group); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return string The job ID |
38 | 38 | */ |
39 | -function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
|
40 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
41 | - return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
39 | +function wc_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') { |
|
40 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_recurring_action()'); |
|
41 | + return as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args, $group); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string The job ID |
66 | 66 | */ |
67 | -function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
|
68 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
69 | - return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
67 | +function wc_schedule_cron_action($timestamp, $schedule, $hook, $args = array(), $group = '') { |
|
68 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_cron_action()'); |
|
69 | + return as_schedule_cron_action($timestamp, $schedule, $hook, $args, $group); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @deprecated 2.1.0 |
80 | 80 | */ |
81 | -function wc_unschedule_action( $hook, $args = array(), $group = '' ) { |
|
82 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
83 | - as_unschedule_action( $hook, $args, $group ); |
|
81 | +function wc_unschedule_action($hook, $args = array(), $group = '') { |
|
82 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_unschedule_action()'); |
|
83 | + as_unschedule_action($hook, $args, $group); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return int|bool The timestamp for the next occurrence, or false if nothing was found |
94 | 94 | */ |
95 | -function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) { |
|
96 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
97 | - return as_next_scheduled_action( $hook, $args, $group ); |
|
95 | +function wc_next_scheduled_action($hook, $args = NULL, $group = '') { |
|
96 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_next_scheduled_action()'); |
|
97 | + return as_next_scheduled_action($hook, $args, $group); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return array |
122 | 122 | */ |
123 | -function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
|
124 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
125 | - return as_get_scheduled_actions( $args, $return_format ); |
|
123 | +function wc_get_scheduled_actions($args = array(), $return_format = OBJECT) { |
|
124 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_get_scheduled_actions()'); |
|
125 | + return as_get_scheduled_actions($args, $return_format); |
|
126 | 126 | } |
@@ -5,25 +5,25 @@ |
||
5 | 5 | */ |
6 | 6 | abstract class ActionScheduler_Schedule_Deprecated implements ActionScheduler_Schedule { |
7 | 7 | |
8 | - /** |
|
9 | - * Get the date & time this schedule was created to run, or calculate when it should be run |
|
10 | - * after a given date & time. |
|
11 | - * |
|
12 | - * @param DateTime $after |
|
13 | - * |
|
14 | - * @return DateTime|null |
|
15 | - */ |
|
16 | - public function next( DateTime $after = NULL ) { |
|
17 | - if ( empty( $after ) ) { |
|
18 | - $return_value = $this->get_date(); |
|
19 | - $replacement_method = 'get_date()'; |
|
20 | - } else { |
|
21 | - $return_value = $this->get_next( $after ); |
|
22 | - $replacement_method = 'get_next( $after )'; |
|
23 | - } |
|
8 | + /** |
|
9 | + * Get the date & time this schedule was created to run, or calculate when it should be run |
|
10 | + * after a given date & time. |
|
11 | + * |
|
12 | + * @param DateTime $after |
|
13 | + * |
|
14 | + * @return DateTime|null |
|
15 | + */ |
|
16 | + public function next( DateTime $after = NULL ) { |
|
17 | + if ( empty( $after ) ) { |
|
18 | + $return_value = $this->get_date(); |
|
19 | + $replacement_method = 'get_date()'; |
|
20 | + } else { |
|
21 | + $return_value = $this->get_next( $after ); |
|
22 | + $replacement_method = 'get_next( $after )'; |
|
23 | + } |
|
24 | 24 | |
25 | - _deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); |
|
25 | + _deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); |
|
26 | 26 | |
27 | - return $return_value; |
|
28 | - } |
|
27 | + return $return_value; |
|
28 | + } |
|
29 | 29 | } |
@@ -13,16 +13,16 @@ |
||
13 | 13 | * |
14 | 14 | * @return DateTime|null |
15 | 15 | */ |
16 | - public function next( DateTime $after = NULL ) { |
|
17 | - if ( empty( $after ) ) { |
|
16 | + public function next(DateTime $after = NULL) { |
|
17 | + if (empty($after)) { |
|
18 | 18 | $return_value = $this->get_date(); |
19 | 19 | $replacement_method = 'get_date()'; |
20 | 20 | } else { |
21 | - $return_value = $this->get_next( $after ); |
|
21 | + $return_value = $this->get_next($after); |
|
22 | 22 | $replacement_method = 'get_next( $after )'; |
23 | 23 | } |
24 | 24 | |
25 | - _deprecated_function( __METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method ); |
|
25 | + _deprecated_function(__METHOD__, '3.0.0', __CLASS__ . '::' . $replacement_method); |
|
26 | 26 | |
27 | 27 | return $return_value; |
28 | 28 | } |
@@ -6,44 +6,44 @@ |
||
6 | 6 | */ |
7 | 7 | abstract class ActionScheduler_Store_Deprecated { |
8 | 8 | |
9 | - /** |
|
10 | - * Mark an action that failed to fetch correctly as failed. |
|
11 | - * |
|
12 | - * @since 2.2.6 |
|
13 | - * |
|
14 | - * @param int $action_id The ID of the action. |
|
15 | - */ |
|
16 | - public function mark_failed_fetch_action( $action_id ) { |
|
17 | - _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
18 | - self::$store->mark_failure( $action_id ); |
|
19 | - } |
|
9 | + /** |
|
10 | + * Mark an action that failed to fetch correctly as failed. |
|
11 | + * |
|
12 | + * @since 2.2.6 |
|
13 | + * |
|
14 | + * @param int $action_id The ID of the action. |
|
15 | + */ |
|
16 | + public function mark_failed_fetch_action( $action_id ) { |
|
17 | + _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
18 | + self::$store->mark_failure( $action_id ); |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * Add base hooks |
|
23 | - * |
|
24 | - * @since 2.2.6 |
|
25 | - */ |
|
26 | - protected static function hook() { |
|
27 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
28 | - } |
|
21 | + /** |
|
22 | + * Add base hooks |
|
23 | + * |
|
24 | + * @since 2.2.6 |
|
25 | + */ |
|
26 | + protected static function hook() { |
|
27 | + _deprecated_function( __METHOD__, '3.0.0' ); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Remove base hooks |
|
32 | - * |
|
33 | - * @since 2.2.6 |
|
34 | - */ |
|
35 | - protected static function unhook() { |
|
36 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
37 | - } |
|
30 | + /** |
|
31 | + * Remove base hooks |
|
32 | + * |
|
33 | + * @since 2.2.6 |
|
34 | + */ |
|
35 | + protected static function unhook() { |
|
36 | + _deprecated_function( __METHOD__, '3.0.0' ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Get the site's local time. |
|
41 | - * |
|
42 | - * @deprecated 2.1.0 |
|
43 | - * @return DateTimeZone |
|
44 | - */ |
|
45 | - protected function get_local_timezone() { |
|
46 | - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
47 | - return ActionScheduler_TimezoneHelper::get_local_timezone(); |
|
48 | - } |
|
39 | + /** |
|
40 | + * Get the site's local time. |
|
41 | + * |
|
42 | + * @deprecated 2.1.0 |
|
43 | + * @return DateTimeZone |
|
44 | + */ |
|
45 | + protected function get_local_timezone() { |
|
46 | + _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
47 | + return ActionScheduler_TimezoneHelper::get_local_timezone(); |
|
48 | + } |
|
49 | 49 | } |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @param int $action_id The ID of the action. |
15 | 15 | */ |
16 | - public function mark_failed_fetch_action( $action_id ) { |
|
17 | - _deprecated_function( __METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()' ); |
|
18 | - self::$store->mark_failure( $action_id ); |
|
16 | + public function mark_failed_fetch_action($action_id) { |
|
17 | + _deprecated_function(__METHOD__, '3.0.0', 'ActionScheduler_Store::mark_failure()'); |
|
18 | + self::$store->mark_failure($action_id); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @since 2.2.6 |
25 | 25 | */ |
26 | 26 | protected static function hook() { |
27 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
27 | + _deprecated_function(__METHOD__, '3.0.0'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @since 2.2.6 |
34 | 34 | */ |
35 | 35 | protected static function unhook() { |
36 | - _deprecated_function( __METHOD__, '3.0.0' ); |
|
36 | + _deprecated_function(__METHOD__, '3.0.0'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return DateTimeZone |
44 | 44 | */ |
45 | 45 | protected function get_local_timezone() { |
46 | - _deprecated_function( __FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()' ); |
|
46 | + _deprecated_function(__FUNCTION__, '2.1.0', 'ActionScheduler_TimezoneHelper::set_local_timezone()'); |
|
47 | 47 | return ActionScheduler_TimezoneHelper::get_local_timezone(); |
48 | 48 | } |
49 | 49 | } |
@@ -5,23 +5,23 @@ |
||
5 | 5 | */ |
6 | 6 | abstract class ActionScheduler_Abstract_QueueRunner_Deprecated { |
7 | 7 | |
8 | - /** |
|
9 | - * Get the maximum number of seconds a batch can run for. |
|
10 | - * |
|
11 | - * @deprecated 2.1.1 |
|
12 | - * @return int The number of seconds. |
|
13 | - */ |
|
14 | - protected function get_maximum_execution_time() { |
|
15 | - _deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' ); |
|
8 | + /** |
|
9 | + * Get the maximum number of seconds a batch can run for. |
|
10 | + * |
|
11 | + * @deprecated 2.1.1 |
|
12 | + * @return int The number of seconds. |
|
13 | + */ |
|
14 | + protected function get_maximum_execution_time() { |
|
15 | + _deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' ); |
|
16 | 16 | |
17 | - $maximum_execution_time = 30; |
|
17 | + $maximum_execution_time = 30; |
|
18 | 18 | |
19 | - // Apply deprecated filter |
|
20 | - if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { |
|
21 | - _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); |
|
22 | - $maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time ); |
|
23 | - } |
|
19 | + // Apply deprecated filter |
|
20 | + if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { |
|
21 | + _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); |
|
22 | + $maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time ); |
|
23 | + } |
|
24 | 24 | |
25 | - return absint( $maximum_execution_time ); |
|
26 | - } |
|
25 | + return absint( $maximum_execution_time ); |
|
26 | + } |
|
27 | 27 | } |
@@ -12,16 +12,16 @@ |
||
12 | 12 | * @return int The number of seconds. |
13 | 13 | */ |
14 | 14 | protected function get_maximum_execution_time() { |
15 | - _deprecated_function( __METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()' ); |
|
15 | + _deprecated_function(__METHOD__, '2.1.1', 'ActionScheduler_Abstract_QueueRunner::get_time_limit()'); |
|
16 | 16 | |
17 | 17 | $maximum_execution_time = 30; |
18 | 18 | |
19 | 19 | // Apply deprecated filter |
20 | - if ( has_filter( 'action_scheduler_maximum_execution_time' ) ) { |
|
21 | - _deprecated_function( 'action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit' ); |
|
22 | - $maximum_execution_time = apply_filters( 'action_scheduler_maximum_execution_time', $maximum_execution_time ); |
|
20 | + if (has_filter('action_scheduler_maximum_execution_time')) { |
|
21 | + _deprecated_function('action_scheduler_maximum_execution_time', '2.1.1', 'action_scheduler_queue_runner_time_limit'); |
|
22 | + $maximum_execution_time = apply_filters('action_scheduler_maximum_execution_time', $maximum_execution_time); |
|
23 | 23 | } |
24 | 24 | |
25 | - return absint( $maximum_execution_time ); |
|
25 | + return absint($maximum_execution_time); |
|
26 | 26 | } |
27 | 27 | } |