@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Post types Class |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | * Hook in methods. |
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | - add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 ); |
|
22 | - add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 ); |
|
23 | - add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) ); |
|
24 | - add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) ); |
|
21 | + add_action('init', array(__CLASS__, 'register_post_types'), 1); |
|
22 | + add_action('init', array(__CLASS__, 'register_post_status'), 4); |
|
23 | + add_action('getpaid_flush_rewrite_rules', array(__CLASS__, 'flush_rewrite_rules')); |
|
24 | + add_action('getpaid_after_register_post_types', array(__CLASS__, 'maybe_flush_rewrite_rules')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function register_post_types() { |
31 | 31 | |
32 | - if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
32 | + if (!is_blog_installed() || post_type_exists('wpi_item')) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | 36 | // Fires before registering post types. |
37 | - do_action( 'getpaid_register_post_types' ); |
|
37 | + do_action('getpaid_register_post_types'); |
|
38 | 38 | |
39 | 39 | // Register item post type. |
40 | 40 | register_post_type( |
@@ -43,29 +43,29 @@ discard block |
||
43 | 43 | 'wpinv_register_post_type_invoice_item', |
44 | 44 | array( |
45 | 45 | 'labels' => array( |
46 | - 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
47 | - 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
48 | - 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
49 | - 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
50 | - 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
51 | - 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
52 | - 'new_item' => __( 'New Item', 'invoicing' ), |
|
53 | - 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
54 | - 'view_item' => __( 'View Item', 'invoicing' ), |
|
55 | - 'all_items' => __( 'Items', 'invoicing' ), |
|
56 | - 'search_items' => __( 'Search items', 'invoicing' ), |
|
57 | - 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
58 | - 'not_found' => __( 'No items found.', 'invoicing' ), |
|
59 | - 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ) |
|
46 | + 'name' => _x('Items', 'post type general name', 'invoicing'), |
|
47 | + 'singular_name' => _x('Item', 'post type singular name', 'invoicing'), |
|
48 | + 'menu_name' => _x('Items', 'admin menu', 'invoicing'), |
|
49 | + 'name_admin_bar' => _x('Item', 'add new on admin bar', 'invoicing'), |
|
50 | + 'add_new' => _x('Add New', 'Item', 'invoicing'), |
|
51 | + 'add_new_item' => __('Add New Item', 'invoicing'), |
|
52 | + 'new_item' => __('New Item', 'invoicing'), |
|
53 | + 'edit_item' => __('Edit Item', 'invoicing'), |
|
54 | + 'view_item' => __('View Item', 'invoicing'), |
|
55 | + 'all_items' => __('Items', 'invoicing'), |
|
56 | + 'search_items' => __('Search items', 'invoicing'), |
|
57 | + 'parent_item_colon' => __('Parent item:', 'invoicing'), |
|
58 | + 'not_found' => __('No items found.', 'invoicing'), |
|
59 | + 'not_found_in_trash' => __('No items found in trash.', 'invoicing') |
|
60 | 60 | ), |
61 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
61 | + 'description' => __('This is where you can add new invoice items.', 'invoicing'), |
|
62 | 62 | 'public' => false, |
63 | 63 | 'has_archive' => false, |
64 | 64 | '_builtin' => false, |
65 | 65 | 'show_ui' => true, |
66 | 66 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
67 | 67 | 'show_in_nav_menus' => false, |
68 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
68 | + 'supports' => array('title', 'excerpt', 'thumbnail'), |
|
69 | 69 | 'rewrite' => false, |
70 | 70 | 'query_var' => false, |
71 | 71 | 'map_meta_cap' => true, |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | 'wpinv_register_post_type_payment_form', |
83 | 83 | array( |
84 | 84 | 'labels' => array( |
85 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
86 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
87 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
88 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
89 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
90 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
91 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
92 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
93 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
94 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
95 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
96 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
97 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
98 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
85 | + 'name' => _x('Payment Forms', 'post type general name', 'invoicing'), |
|
86 | + 'singular_name' => _x('Payment Form', 'post type singular name', 'invoicing'), |
|
87 | + 'menu_name' => _x('Payment Forms', 'admin menu', 'invoicing'), |
|
88 | + 'name_admin_bar' => _x('Payment Form', 'add new on admin bar', 'invoicing'), |
|
89 | + 'add_new' => _x('Add New', 'Payment Form', 'invoicing'), |
|
90 | + 'add_new_item' => __('Add New Payment Form', 'invoicing'), |
|
91 | + 'new_item' => __('New Payment Form', 'invoicing'), |
|
92 | + 'edit_item' => __('Edit Payment Form', 'invoicing'), |
|
93 | + 'view_item' => __('View Payment Form', 'invoicing'), |
|
94 | + 'all_items' => __('Payment Forms', 'invoicing'), |
|
95 | + 'search_items' => __('Search Payment Forms', 'invoicing'), |
|
96 | + 'parent_item_colon' => __('Parent Payment Forms:', 'invoicing'), |
|
97 | + 'not_found' => __('No payment forms found.', 'invoicing'), |
|
98 | + 'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing') |
|
99 | 99 | ), |
100 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
100 | + 'description' => __('Add new payment forms.', 'invoicing'), |
|
101 | 101 | 'public' => false, |
102 | 102 | 'show_ui' => true, |
103 | 103 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'has_archive' => false, |
109 | 109 | 'hierarchical' => false, |
110 | 110 | 'menu_position' => null, |
111 | - 'supports' => array( 'title' ), |
|
111 | + 'supports' => array('title'), |
|
112 | 112 | 'menu_icon' => 'dashicons-media-form', |
113 | 113 | ) |
114 | 114 | ) |
@@ -121,32 +121,32 @@ discard block |
||
121 | 121 | 'wpinv_register_post_type_invoice', |
122 | 122 | array( |
123 | 123 | 'labels' => array( |
124 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
125 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
126 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
127 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
128 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
129 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
130 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
131 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
132 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
133 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
134 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
135 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
136 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
137 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
138 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
139 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
140 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
141 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
142 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
143 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
144 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
145 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
146 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
147 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
124 | + 'name' => __('Invoices', 'invoicing'), |
|
125 | + 'singular_name' => __('Invoice', 'invoicing'), |
|
126 | + 'all_items' => __('Invoices', 'invoicing'), |
|
127 | + 'menu_name' => _x('Invoices', 'Admin menu name', 'invoicing'), |
|
128 | + 'add_new' => __('Add New', 'invoicing'), |
|
129 | + 'add_new_item' => __('Add new invoice', 'invoicing'), |
|
130 | + 'edit' => __('Edit', 'invoicing'), |
|
131 | + 'edit_item' => __('Edit invoice', 'invoicing'), |
|
132 | + 'new_item' => __('New invoice', 'invoicing'), |
|
133 | + 'view_item' => __('View invoice', 'invoicing'), |
|
134 | + 'view_items' => __('View Invoices', 'invoicing'), |
|
135 | + 'search_items' => __('Search invoices', 'invoicing'), |
|
136 | + 'not_found' => __('No invoices found', 'invoicing'), |
|
137 | + 'not_found_in_trash' => __('No invoices found in trash', 'invoicing'), |
|
138 | + 'parent' => __('Parent invoice', 'invoicing'), |
|
139 | + 'featured_image' => __('Invoice image', 'invoicing'), |
|
140 | + 'set_featured_image' => __('Set invoice image', 'invoicing'), |
|
141 | + 'remove_featured_image' => __('Remove invoice image', 'invoicing'), |
|
142 | + 'use_featured_image' => __('Use as invoice image', 'invoicing'), |
|
143 | + 'insert_into_item' => __('Insert into invoice', 'invoicing'), |
|
144 | + 'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'), |
|
145 | + 'filter_items_list' => __('Filter invoices', 'invoicing'), |
|
146 | + 'items_list_navigation' => __('Invoices navigation', 'invoicing'), |
|
147 | + 'items_list' => __('Invoices list', 'invoicing'), |
|
148 | 148 | ), |
149 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
149 | + 'description' => __('This is where invoices are stored.', 'invoicing'), |
|
150 | 150 | 'public' => true, |
151 | 151 | 'has_archive' => false, |
152 | 152 | 'publicly_queryable' => true, |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'show_ui' => true, |
155 | 155 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
156 | 156 | 'show_in_nav_menus' => false, |
157 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
157 | + 'supports' => array('title', 'author', 'excerpt'), |
|
158 | 158 | 'rewrite' => array( |
159 | 159 | 'slug' => 'invoice', |
160 | 160 | 'with_front' => false, |
@@ -177,32 +177,32 @@ discard block |
||
177 | 177 | 'wpinv_register_post_type_discount', |
178 | 178 | array( |
179 | 179 | 'labels' => array( |
180 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
181 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
182 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
183 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
184 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
185 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
186 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
187 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
188 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
189 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
190 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
191 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
192 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
193 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
194 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
195 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
196 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
197 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
198 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
199 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
200 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
201 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
202 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
203 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
180 | + 'name' => __('Discounts', 'invoicing'), |
|
181 | + 'singular_name' => __('Discount', 'invoicing'), |
|
182 | + 'all_items' => __('Discounts', 'invoicing'), |
|
183 | + 'menu_name' => _x('Discounts', 'Admin menu name', 'invoicing'), |
|
184 | + 'add_new' => __('Add New', 'invoicing'), |
|
185 | + 'add_new_item' => __('Add new discount', 'invoicing'), |
|
186 | + 'edit' => __('Edit', 'invoicing'), |
|
187 | + 'edit_item' => __('Edit discount', 'invoicing'), |
|
188 | + 'new_item' => __('New discount', 'invoicing'), |
|
189 | + 'view_item' => __('View discount', 'invoicing'), |
|
190 | + 'view_items' => __('View Discounts', 'invoicing'), |
|
191 | + 'search_items' => __('Search discounts', 'invoicing'), |
|
192 | + 'not_found' => __('No discounts found', 'invoicing'), |
|
193 | + 'not_found_in_trash' => __('No discounts found in trash', 'invoicing'), |
|
194 | + 'parent' => __('Parent discount', 'invoicing'), |
|
195 | + 'featured_image' => __('Discount image', 'invoicing'), |
|
196 | + 'set_featured_image' => __('Set discount image', 'invoicing'), |
|
197 | + 'remove_featured_image' => __('Remove discount image', 'invoicing'), |
|
198 | + 'use_featured_image' => __('Use as discount image', 'invoicing'), |
|
199 | + 'insert_into_item' => __('Insert into discount', 'invoicing'), |
|
200 | + 'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'), |
|
201 | + 'filter_items_list' => __('Filter discounts', 'invoicing'), |
|
202 | + 'items_list_navigation' => __('Discount navigation', 'invoicing'), |
|
203 | + 'items_list' => __('Discounts list', 'invoicing'), |
|
204 | 204 | ), |
205 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
205 | + 'description' => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'), |
|
206 | 206 | 'public' => false, |
207 | 207 | 'can_export' => true, |
208 | 208 | '_builtin' => false, |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | 'map_meta_cap' => true, |
216 | 216 | 'has_archive' => false, |
217 | 217 | 'hierarchical' => false, |
218 | - 'supports' => array( 'title', 'excerpt' ), |
|
218 | + 'supports' => array('title', 'excerpt'), |
|
219 | 219 | 'show_in_nav_menus' => false, |
220 | 220 | 'show_in_admin_bar' => true, |
221 | 221 | 'menu_position' => null, |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ) |
224 | 224 | ); |
225 | 225 | |
226 | - do_action( 'getpaid_after_register_post_types' ); |
|
226 | + do_action('getpaid_after_register_post_types'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -236,79 +236,79 @@ discard block |
||
236 | 236 | array( |
237 | 237 | |
238 | 238 | 'wpi-pending' => array( |
239 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
239 | + 'label' => _x('Pending Payment', 'Invoice status', 'invoicing'), |
|
240 | 240 | 'public' => true, |
241 | 241 | 'exclude_from_search' => true, |
242 | 242 | 'show_in_admin_all_list' => true, |
243 | 243 | 'show_in_admin_status_list' => true, |
244 | 244 | /* translators: %s: number of invoices */ |
245 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
245 | + 'label_count' => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing') |
|
246 | 246 | ), |
247 | 247 | |
248 | 248 | 'wpi-processing' => array( |
249 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
249 | + 'label' => _x('Processing', 'Invoice status', 'invoicing'), |
|
250 | 250 | 'public' => true, |
251 | 251 | 'exclude_from_search' => true, |
252 | 252 | 'show_in_admin_all_list' => true, |
253 | 253 | 'show_in_admin_status_list' => true, |
254 | 254 | /* translators: %s: number of invoices */ |
255 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
255 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing') |
|
256 | 256 | ), |
257 | 257 | |
258 | 258 | 'wpi-onhold' => array( |
259 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
259 | + 'label' => _x('On Hold', 'Invoice status', 'invoicing'), |
|
260 | 260 | 'public' => true, |
261 | 261 | 'exclude_from_search' => true, |
262 | 262 | 'show_in_admin_all_list' => true, |
263 | 263 | 'show_in_admin_status_list' => true, |
264 | 264 | /* translators: %s: number of invoices */ |
265 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
265 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing') |
|
266 | 266 | ), |
267 | 267 | |
268 | 268 | 'wpi-cancelled' => array( |
269 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
269 | + 'label' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
270 | 270 | 'public' => true, |
271 | 271 | 'exclude_from_search' => true, |
272 | 272 | 'show_in_admin_all_list' => true, |
273 | 273 | 'show_in_admin_status_list' => true, |
274 | 274 | /* translators: %s: number of invoices */ |
275 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
275 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing') |
|
276 | 276 | ), |
277 | 277 | |
278 | 278 | 'wpi-refunded' => array( |
279 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
279 | + 'label' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
280 | 280 | 'public' => true, |
281 | 281 | 'exclude_from_search' => true, |
282 | 282 | 'show_in_admin_all_list' => true, |
283 | 283 | 'show_in_admin_status_list' => true, |
284 | 284 | /* translators: %s: number of invoices */ |
285 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
285 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing') |
|
286 | 286 | ), |
287 | 287 | |
288 | 288 | 'wpi-failed' => array( |
289 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
289 | + 'label' => _x('Failed', 'Invoice status', 'invoicing'), |
|
290 | 290 | 'public' => true, |
291 | 291 | 'exclude_from_search' => true, |
292 | 292 | 'show_in_admin_all_list' => true, |
293 | 293 | 'show_in_admin_status_list' => true, |
294 | 294 | /* translators: %s: number of invoices */ |
295 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
295 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing') |
|
296 | 296 | ), |
297 | 297 | |
298 | 298 | 'wpi-renewal' => array( |
299 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
299 | + 'label' => _x('Renewal', 'Invoice status', 'invoicing'), |
|
300 | 300 | 'public' => true, |
301 | 301 | 'exclude_from_search' => true, |
302 | 302 | 'show_in_admin_all_list' => true, |
303 | 303 | 'show_in_admin_status_list' => true, |
304 | 304 | /* translators: %s: number of invoices */ |
305 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
305 | + 'label_count' => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing') |
|
306 | 306 | ) |
307 | 307 | ) |
308 | 308 | ); |
309 | 309 | |
310 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
311 | - register_post_status( $invoice_statuse, $args ); |
|
310 | + foreach ($invoice_statuses as $invoice_statuse => $args) { |
|
311 | + register_post_status($invoice_statuse, $args); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * |
325 | 325 | */ |
326 | 326 | public static function maybe_flush_rewrite_rules() { |
327 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
328 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
327 | + if (!get_option('getpaid_flushed_rewrite_rules')) { |
|
328 | + update_option('getpaid_flushed_rewrite_rules', '1'); |
|
329 | 329 | self::flush_rewrite_rules(); |
330 | 330 | } |
331 | 331 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if (!defined('ABSPATH')) |
|
4 | 4 | die('-1'); |
5 | 5 | |
6 | -$email_footer = apply_filters( 'wpinv_email_footer_text', wpinv_get_option( 'email_footer_text', get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ) ) ); |
|
7 | -$email_footer = $email_footer ? wpautop( wp_kses_post( wptexturize( $email_footer ) ) ) : ''; |
|
6 | +$email_footer = apply_filters('wpinv_email_footer_text', wpinv_get_option('email_footer_text', get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'))); |
|
7 | +$email_footer = $email_footer ? wpautop(wp_kses_post(wptexturize($email_footer))) : ''; |
|
8 | 8 | ?> |
9 | 9 | </div> |
10 | 10 | </td> |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // don't load directly |
3 | -if ( !defined('ABSPATH') ) |
|
3 | +if (!defined('ABSPATH')) |
|
4 | 4 | die('-1'); |
5 | 5 | |
6 | -if ( !isset( $email_heading ) ) { |
|
6 | +if (!isset($email_heading)) { |
|
7 | 7 | global $email_heading; |
8 | 8 | } |
9 | 9 | ?> |
10 | 10 | <!DOCTYPE html> |
11 | 11 | <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'?>"> |
12 | 12 | <head> |
13 | - <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" /> |
|
13 | + <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> |
|
14 | 14 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
15 | 15 | <meta name="robots" content="noindex,nofollow"> |
16 | 16 | <title><?php echo wpinv_get_blogname(); ?></title> |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | <td align="center" valign="top"> |
23 | 23 | <div id="template_header_image"> |
24 | 24 | <?php |
25 | - if ( $img = wpinv_get_option( 'email_header_image', '' ) ) { |
|
26 | - echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url( $img ) . '" alt="' . esc_attr( wpinv_get_blogname() ) . '" /></p>'; |
|
25 | + if ($img = wpinv_get_option('email_header_image', '')) { |
|
26 | + echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url($img) . '" alt="' . esc_attr(wpinv_get_blogname()) . '" /></p>'; |
|
27 | 27 | } |
28 | 28 | ?> |
29 | 29 | </div> |
30 | 30 | <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_container"> |
31 | - <?php if ( !empty( $email_heading ) ) { ?> |
|
31 | + <?php if (!empty($email_heading)) { ?> |
|
32 | 32 | <tr> |
33 | 33 | <td align="center" valign="top"> |
34 | 34 | <!-- Header --> |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | $value = ''; |
13 | 13 | $class = ''; |
14 | 14 | |
15 | -if ( ! empty( $form->invoice ) ) { |
|
16 | - $value = sanitize_email( $form->invoice->get_email() ); |
|
17 | -} else if ( is_user_logged_in() ) { |
|
15 | +if (!empty($form->invoice)) { |
|
16 | + $value = sanitize_email($form->invoice->get_email()); |
|
17 | +} else if (is_user_logged_in()) { |
|
18 | 18 | $user = wp_get_current_user(); |
19 | - $value = sanitize_email( $user->user_email ); |
|
19 | + $value = sanitize_email($user->user_email); |
|
20 | 20 | } |
21 | 21 | |
22 | -if ( ! empty( $value ) && ! empty( $hide_billing_email ) ) { |
|
22 | +if (!empty($value) && !empty($hide_billing_email)) { |
|
23 | 23 | $class = 'd-none'; |
24 | 24 | } |
25 | 25 | |
26 | -do_action( 'getpaid_before_payment_form_billing_email', $form ); |
|
26 | +do_action('getpaid_before_payment_form_billing_email', $form); |
|
27 | 27 | |
28 | 28 | echo "<span class='$class'>"; |
29 | 29 | |
30 | 30 | echo aui()->input( |
31 | 31 | array( |
32 | 32 | 'name' => 'billing_email', |
33 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
34 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
35 | - 'required' => ! empty( $required ), |
|
36 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>', |
|
33 | + 'id' => esc_attr($id) . uniqid('_'), |
|
34 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
35 | + 'required' => !empty($required), |
|
36 | + 'label' => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>', |
|
37 | 37 | 'label_type' => 'vertical', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'type' => 'email', |
40 | 40 | 'value' => $value, |
41 | 41 | 'class' => 'wpinv_billing_email', |
@@ -47,4 +47,4 @@ discard block |
||
47 | 47 | |
48 | 48 | echo '</span>'; |
49 | 49 | |
50 | -do_action( 'getpaid_after_payment_form_billing_email', $form ); |
|
50 | +do_action('getpaid_after_payment_form_billing_email', $form); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | - do_action( 'wpinv_metabox_resend_invoice_before', $invoice ); |
|
27 | + do_action('wpinv_metabox_resend_invoice_before', $invoice); |
|
28 | 28 | |
29 | 29 | $invoice_actions = array( |
30 | 30 | 'resend-email' => array( |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | 'getpaid-nonce', |
39 | 39 | 'getpaid-nonce' |
40 | 40 | ), |
41 | - 'label' => __( 'Resend Invoice', 'invoicing' ), |
|
41 | + 'label' => __('Resend Invoice', 'invoicing'), |
|
42 | 42 | ) |
43 | 43 | ); |
44 | 44 | |
45 | - if ( $invoice->needs_payment() ) { |
|
45 | + if ($invoice->needs_payment()) { |
|
46 | 46 | |
47 | 47 | $invoice_actions['send-reminder'] = array( |
48 | 48 | 'url' => wp_nonce_url( |
@@ -55,29 +55,29 @@ discard block |
||
55 | 55 | 'getpaid-nonce', |
56 | 56 | 'getpaid-nonce' |
57 | 57 | ), |
58 | - 'label' => __( 'Send Reminder', 'invoicing' ), |
|
58 | + 'label' => __('Send Reminder', 'invoicing'), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - $invoice_actions = apply_filters( 'getpaid_edit_invoice_actions', $invoice_actions, $invoice ); |
|
63 | + $invoice_actions = apply_filters('getpaid_edit_invoice_actions', $invoice_actions, $invoice); |
|
64 | 64 | |
65 | - foreach ( $invoice_actions as $key => $action ) { |
|
65 | + foreach ($invoice_actions as $key => $action) { |
|
66 | 66 | |
67 | - if ( 'resend-email' === $key ) { |
|
68 | - echo wpautop( __( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ) ); |
|
67 | + if ('resend-email' === $key) { |
|
68 | + echo wpautop(__("This will send a copy of the invoice to the customer's email address.", 'invoicing')); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | printf( |
72 | 72 | '<p class="wpi-meta-row wpi-%s"><a href="%s" class="button button-secondary">%s</a>', |
73 | - esc_attr( $key ), |
|
74 | - esc_url( $action['url'] ), |
|
75 | - sanitize_text_field( $action['label'] ) |
|
73 | + esc_attr($key), |
|
74 | + esc_url($action['url']), |
|
75 | + sanitize_text_field($action['label']) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - do_action( 'wpinv_metabox_resend_invoice_after', $invoice ); |
|
80 | + do_action('wpinv_metabox_resend_invoice_after', $invoice); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Metaboxes Admin Class |
@@ -25,35 +25,35 @@ discard block |
||
25 | 25 | public static function init() { |
26 | 26 | |
27 | 27 | // Register metaboxes. |
28 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2 ); |
|
28 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2); |
|
29 | 29 | |
30 | 30 | // Remove metaboxes. |
31 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30 ); |
|
31 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30); |
|
32 | 32 | |
33 | 33 | // Rename metaboxes. |
34 | - add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45 ); |
|
34 | + add_action('add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45); |
|
35 | 35 | |
36 | 36 | // Save metaboxes. |
37 | - add_action( 'save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2 ); |
|
37 | + add_action('save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register core metaboxes. |
42 | 42 | */ |
43 | - public static function add_meta_boxes( $post_type, $post ) { |
|
43 | + public static function add_meta_boxes($post_type, $post) { |
|
44 | 44 | |
45 | 45 | // For invoices... |
46 | - self::add_invoice_meta_boxes( $post_type, $post ); |
|
46 | + self::add_invoice_meta_boxes($post_type, $post); |
|
47 | 47 | |
48 | 48 | // For payment forms. |
49 | - self::add_payment_form_meta_boxes( $post_type ); |
|
49 | + self::add_payment_form_meta_boxes($post_type); |
|
50 | 50 | |
51 | 51 | // For invoice items. |
52 | - self::add_item_meta_boxes( $post_type ); |
|
52 | + self::add_item_meta_boxes($post_type); |
|
53 | 53 | |
54 | 54 | // For invoice discounts. |
55 | - if ( $post_type == 'wpi_discount' ) { |
|
56 | - add_meta_box( 'wpinv_discount_details', __( 'Discount Details', 'invoicing' ), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high' ); |
|
55 | + if ($post_type == 'wpi_discount') { |
|
56 | + add_meta_box('wpinv_discount_details', __('Discount Details', 'invoicing'), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | } |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * Register core metaboxes. |
63 | 63 | */ |
64 | - protected static function add_payment_form_meta_boxes( $post_type ) { |
|
64 | + protected static function add_payment_form_meta_boxes($post_type) { |
|
65 | 65 | |
66 | 66 | // For payment forms. |
67 | - if ( $post_type == 'wpi_payment_form' ) { |
|
67 | + if ($post_type == 'wpi_payment_form') { |
|
68 | 68 | |
69 | 69 | // Design payment form. |
70 | - add_meta_box( 'wpinv-payment-form-design', __( 'Payment Form', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' ); |
|
70 | + add_meta_box('wpinv-payment-form-design', __('Payment Form', 'invoicing'), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal'); |
|
71 | 71 | |
72 | 72 | // Payment form information. |
73 | - add_meta_box( 'wpinv-payment-form-info', __( 'Details', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side' ); |
|
73 | + add_meta_box('wpinv-payment-form-info', __('Details', 'invoicing'), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side'); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * Register core metaboxes. |
81 | 81 | */ |
82 | - protected static function add_item_meta_boxes( $post_type ) { |
|
82 | + protected static function add_item_meta_boxes($post_type) { |
|
83 | 83 | |
84 | - if ( $post_type == 'wpi_item' ) { |
|
84 | + if ($post_type == 'wpi_item') { |
|
85 | 85 | |
86 | 86 | // Item details. |
87 | - add_meta_box( 'wpinv_item_details', __( 'Item Details', 'invoicing' ), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high' ); |
|
87 | + add_meta_box('wpinv_item_details', __('Item Details', 'invoicing'), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high'); |
|
88 | 88 | |
89 | 89 | // If taxes are enabled, register the tax metabox. |
90 | - if ( wpinv_use_taxes() ) { |
|
91 | - add_meta_box( 'wpinv_item_vat', __( 'Tax', 'invoicing' ), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high' ); |
|
90 | + if (wpinv_use_taxes()) { |
|
91 | + add_meta_box('wpinv_item_vat', __('Tax', 'invoicing'), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | // Item info. |
95 | - add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core' ); |
|
95 | + add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core'); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * Register invoice metaboxes. |
103 | 103 | */ |
104 | - protected static function add_invoice_meta_boxes( $post_type, $post ) { |
|
104 | + protected static function add_invoice_meta_boxes($post_type, $post) { |
|
105 | 105 | |
106 | 106 | // For invoices... |
107 | - if ( getpaid_is_invoice_post_type( $post_type ) ) { |
|
108 | - $invoice = new WPInv_Invoice( $post ); |
|
107 | + if (getpaid_is_invoice_post_type($post_type)) { |
|
108 | + $invoice = new WPInv_Invoice($post); |
|
109 | 109 | |
110 | 110 | // Resend invoice. |
111 | - if ( ! $invoice->is_draft() ) { |
|
111 | + if (!$invoice->is_draft()) { |
|
112 | 112 | |
113 | 113 | add_meta_box( |
114 | 114 | 'wpinv-mb-resend-invoice', |
115 | 115 | sprintf( |
116 | - __( 'Resend %s', 'invoicing' ), |
|
117 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
116 | + __('Resend %s', 'invoicing'), |
|
117 | + ucfirst($invoice->get_invoice_quote_type()) |
|
118 | 118 | ), |
119 | 119 | 'GetPaid_Meta_Box_Resend_Invoice::output', |
120 | 120 | $post_type, |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | // Subscriptions. |
128 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
129 | - if ( ! empty( $subscription ) ) { |
|
130 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscription Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced' ); |
|
131 | - add_meta_box( 'wpinv-mb-subscription-invoices', __( 'Related Payments', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced' ); |
|
128 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
129 | + if (!empty($subscription)) { |
|
130 | + add_meta_box('wpinv-mb-subscriptions', __('Subscription Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced'); |
|
131 | + add_meta_box('wpinv-mb-subscription-invoices', __('Related Payments', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // Invoice details. |
135 | 135 | add_meta_box( |
136 | 136 | 'wpinv-details', |
137 | 137 | sprintf( |
138 | - __( '%s Details', 'invoicing' ), |
|
139 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
138 | + __('%s Details', 'invoicing'), |
|
139 | + ucfirst($invoice->get_invoice_quote_type()) |
|
140 | 140 | ), |
141 | 141 | 'GetPaid_Meta_Box_Invoice_Details::output', |
142 | 142 | $post_type, |
@@ -144,19 +144,19 @@ discard block |
||
144 | 144 | ); |
145 | 145 | |
146 | 146 | // Payment details. |
147 | - if ( ! $invoice->is_draft() ) { |
|
148 | - add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default' ); |
|
147 | + if (!$invoice->is_draft()) { |
|
148 | + add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Billing details. |
152 | - add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high' ); |
|
152 | + add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high'); |
|
153 | 153 | |
154 | 154 | // Invoice items. |
155 | 155 | add_meta_box( |
156 | 156 | 'wpinv-items', |
157 | 157 | sprintf( |
158 | - __( '%s Items', 'invoicing' ), |
|
159 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
158 | + __('%s Items', 'invoicing'), |
|
159 | + ucfirst($invoice->get_invoice_quote_type()) |
|
160 | 160 | ), |
161 | 161 | 'GetPaid_Meta_Box_Invoice_Items::output', |
162 | 162 | $post_type, |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | add_meta_box( |
169 | 169 | 'wpinv-notes', |
170 | 170 | sprintf( |
171 | - __( '%s Notes', 'invoicing' ), |
|
172 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
171 | + __('%s Notes', 'invoicing'), |
|
172 | + ucfirst($invoice->get_invoice_quote_type()) |
|
173 | 173 | ), |
174 | 174 | 'WPInv_Meta_Box_Notes::output', |
175 | 175 | $post_type, |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | ); |
179 | 179 | |
180 | 180 | // Shipping Address. |
181 | - if ( get_post_meta( $invoice->get_id(), 'shipping_address', true ) ) { |
|
182 | - add_meta_box( 'wpinv-invoice-shipping-details', __( 'Shipping Address', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high' ); |
|
181 | + if (get_post_meta($invoice->get_id(), 'shipping_address', true)) { |
|
182 | + add_meta_box('wpinv-invoice-shipping-details', __('Shipping Address', 'invoicing'), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | // Payment form information. |
186 | - if ( get_post_meta( $invoice->get_id(), 'payment_form_data', true ) ) { |
|
187 | - add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high' ); |
|
186 | + if (get_post_meta($invoice->get_id(), 'payment_form_data', true)) { |
|
187 | + add_meta_box('wpinv-invoice-payment-form-details', __('Payment Form Details', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * Remove some metaboxes. |
196 | 196 | */ |
197 | 197 | public static function remove_meta_boxes() { |
198 | - remove_meta_box( 'wpseo_meta', 'wpi_invoice', 'normal' ); |
|
198 | + remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -211,46 +211,46 @@ discard block |
||
211 | 211 | * @param int $post_id Post ID. |
212 | 212 | * @param object $post Post object. |
213 | 213 | */ |
214 | - public static function save_meta_boxes( $post_id, $post ) { |
|
215 | - $post_id = absint( $post_id ); |
|
216 | - $data = wp_unslash( $_POST ); |
|
214 | + public static function save_meta_boxes($post_id, $post) { |
|
215 | + $post_id = absint($post_id); |
|
216 | + $data = wp_unslash($_POST); |
|
217 | 217 | |
218 | 218 | // Do not save for ajax requests. |
219 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
219 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
220 | 220 | return; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // $post_id and $post are required |
224 | - if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) { |
|
224 | + if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { |
|
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | 228 | // Dont' save meta boxes for revisions or autosaves. |
229 | - if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
229 | + if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | 233 | // Check the nonce. |
234 | - if ( empty( $data['getpaid_meta_nonce'] ) || ! wp_verify_nonce( $data['getpaid_meta_nonce'], 'getpaid_meta_nonce' ) ) { |
|
234 | + if (empty($data['getpaid_meta_nonce']) || !wp_verify_nonce($data['getpaid_meta_nonce'], 'getpaid_meta_nonce')) { |
|
235 | 235 | return; |
236 | 236 | } |
237 | 237 | |
238 | 238 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
239 | - if ( empty( $data['post_ID'] ) || absint( $data['post_ID'] ) !== $post_id ) { |
|
239 | + if (empty($data['post_ID']) || absint($data['post_ID']) !== $post_id) { |
|
240 | 240 | return; |
241 | 241 | } |
242 | 242 | |
243 | 243 | // Check user has permission to edit. |
244 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
244 | + if (!current_user_can('edit_post', $post_id)) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
248 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
249 | 249 | |
250 | 250 | // We need this save event to run once to avoid potential endless loops. |
251 | 251 | self::$saved_meta_boxes = true; |
252 | 252 | |
253 | - return GetPaid_Meta_Box_Invoice_Address::save( $post_id ); |
|
253 | + return GetPaid_Meta_Box_Invoice_Address::save($post_id); |
|
254 | 254 | |
255 | 255 | } |
256 | 256 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | ); |
263 | 263 | |
264 | 264 | // Is this our post type? |
265 | - if ( ! isset( $post_types_map[ $post->post_type ] ) ) { |
|
265 | + if (!isset($post_types_map[$post->post_type])) { |
|
266 | 266 | return; |
267 | 267 | } |
268 | 268 | |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | self::$saved_meta_boxes = true; |
271 | 271 | |
272 | 272 | // Save the post. |
273 | - $class = $post_types_map[ $post->post_type ]; |
|
274 | - $class::save( $post_id, $_POST, $post ); |
|
273 | + $class = $post_types_map[$post->post_type]; |
|
274 | + $class::save($post_id, $_POST, $post); |
|
275 | 275 | |
276 | 276 | } |
277 | 277 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Manual Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'addons' ); |
|
27 | + protected $supports = array('subscription', 'addons'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Test Gateway', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Test Gateway', 'invoicing' ); |
|
42 | + $this->title = __('Test Gateway', 'invoicing'); |
|
43 | + $this->method_title = __('Test Gateway', 'invoicing'); |
|
44 | 44 | |
45 | - add_filter( 'getpaid_daily_maintenance_should_expire_subscription', array( $this, 'maybe_renew_subscription' ), 10, 2 ); |
|
45 | + add_filter('getpaid_daily_maintenance_should_expire_subscription', array($this, 'maybe_renew_subscription'), 10, 2); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
55 | 55 | * @return array |
56 | 56 | */ |
57 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
57 | + public function process_payment($invoice, $submission_data, $submission) { |
|
58 | 58 | |
59 | 59 | // Mark it as paid. |
60 | 60 | $invoice->mark_paid(); |
61 | 61 | |
62 | 62 | // (Maybe) activate subscription. |
63 | - getpaid_activate_invoice_subscription( $invoice ); |
|
63 | + getpaid_activate_invoice_subscription($invoice); |
|
64 | 64 | |
65 | 65 | // Send to the success page. |
66 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
66 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * @param bool $should_expire |
75 | 75 | * @param WPInv_Subscription $subscription |
76 | 76 | */ |
77 | - public function maybe_renew_subscription( $should_expire, $subscription ) { |
|
77 | + public function maybe_renew_subscription($should_expire, $subscription) { |
|
78 | 78 | |
79 | 79 | // Ensure its our subscription && it's active. |
80 | - if ( 'manual' != $subscription->get_gateway() || ! $subscription->has_status( 'active trialling' ) ) { |
|
80 | + if ('manual' != $subscription->get_gateway() || !$subscription->has_status('active trialling')) { |
|
81 | 81 | return $should_expire; |
82 | 82 | } |
83 | 83 | |
84 | 84 | // If this is the last renewal, complete the subscription. |
85 | - if ( $subscription->is_last_renewal() ) { |
|
85 | + if ($subscription->is_last_renewal()) { |
|
86 | 86 | $subscription->complete(); |
87 | 87 | return false; |
88 | 88 | } |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * @param GetPaid_Form_Item[] $items |
109 | 109 | * @return WPInv_Invoice |
110 | 110 | */ |
111 | - public function process_addons( $invoice, $items ) { |
|
111 | + public function process_addons($invoice, $items) { |
|
112 | 112 | |
113 | - foreach ( $items as $item ) { |
|
114 | - $invoice->add_item( $item ); |
|
113 | + foreach ($items as $item) { |
|
114 | + $invoice->add_item($item); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $invoice->recalculate_total(); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @package Invoicing/data |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | return array( |
12 | 12 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GetPaid_Geolocation Class. |
@@ -64,31 +64,31 @@ discard block |
||
64 | 64 | |
65 | 65 | $transient_name = 'external_ip_address_0.0.0.0'; |
66 | 66 | |
67 | - if ( '' !== self::get_ip_address() ) { |
|
68 | - $transient_name = 'external_ip_address_' . self::get_ip_address(); |
|
67 | + if ('' !== self::get_ip_address()) { |
|
68 | + $transient_name = 'external_ip_address_' . self::get_ip_address(); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Try retrieving from cache. |
72 | - $external_ip_address = get_transient( $transient_name ); |
|
72 | + $external_ip_address = get_transient($transient_name); |
|
73 | 73 | |
74 | - if ( false === $external_ip_address ) { |
|
74 | + if (false === $external_ip_address) { |
|
75 | 75 | $external_ip_address = '0.0.0.0'; |
76 | - $ip_lookup_services = apply_filters( 'getpaid_geolocation_ip_lookup_apis', self::$ip_lookup_apis ); |
|
77 | - $ip_lookup_services_keys = array_keys( $ip_lookup_services ); |
|
78 | - shuffle( $ip_lookup_services_keys ); |
|
76 | + $ip_lookup_services = apply_filters('getpaid_geolocation_ip_lookup_apis', self::$ip_lookup_apis); |
|
77 | + $ip_lookup_services_keys = array_keys($ip_lookup_services); |
|
78 | + shuffle($ip_lookup_services_keys); |
|
79 | 79 | |
80 | - foreach ( $ip_lookup_services_keys as $service_name ) { |
|
81 | - $service_endpoint = $ip_lookup_services[ $service_name ]; |
|
82 | - $response = wp_safe_remote_get( $service_endpoint, array( 'timeout' => 2 ) ); |
|
80 | + foreach ($ip_lookup_services_keys as $service_name) { |
|
81 | + $service_endpoint = $ip_lookup_services[$service_name]; |
|
82 | + $response = wp_safe_remote_get($service_endpoint, array('timeout' => 2)); |
|
83 | 83 | |
84 | - if ( ! is_wp_error( $response ) && rest_is_ip_address( $response['body'] ) ) { |
|
85 | - $external_ip_address = apply_filters( 'getpaid_geolocation_ip_lookup_api_response', wpinv_clean( $response['body'] ), $service_name ); |
|
84 | + if (!is_wp_error($response) && rest_is_ip_address($response['body'])) { |
|
85 | + $external_ip_address = apply_filters('getpaid_geolocation_ip_lookup_api_response', wpinv_clean($response['body']), $service_name); |
|
86 | 86 | break; |
87 | 87 | } |
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | - set_transient( $transient_name, $external_ip_address, WEEK_IN_SECONDS ); |
|
91 | + set_transient($transient_name, $external_ip_address, WEEK_IN_SECONDS); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $external_ip_address; |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @param bool $api_fallback If true, uses geolocation APIs if the database file doesn't exist (can be slower). |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public static function geolocate_ip( $ip_address = '', $fallback = false, $api_fallback = true ) { |
|
105 | + public static function geolocate_ip($ip_address = '', $fallback = false, $api_fallback = true) { |
|
106 | 106 | |
107 | - if ( empty( $ip_address ) ) { |
|
107 | + if (empty($ip_address)) { |
|
108 | 108 | $ip_address = self::get_ip_address(); |
109 | 109 | } |
110 | 110 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | self::$current_user_ip = $ip_address; |
113 | 113 | |
114 | 114 | // Filter to allow custom geolocation of the IP address. |
115 | - $country_code = apply_filters( 'getpaid_geolocate_ip', false, $ip_address, $fallback, $api_fallback ); |
|
115 | + $country_code = apply_filters('getpaid_geolocate_ip', false, $ip_address, $fallback, $api_fallback); |
|
116 | 116 | |
117 | - if ( false !== $country_code ) { |
|
117 | + if (false !== $country_code) { |
|
118 | 118 | |
119 | 119 | return array( |
120 | 120 | 'country' => $country_code, |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param array $geolocation Geolocation data, including country, state, city, and postcode. |
135 | 135 | * @param string $ip_address IP Address. |
136 | 136 | */ |
137 | - $geolocation = apply_filters( |
|
137 | + $geolocation = apply_filters( |
|
138 | 138 | 'getpaid_get_geolocation', |
139 | 139 | array( |
140 | 140 | 'country' => $country_code, |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | ); |
147 | 147 | |
148 | 148 | // If we still haven't found a country code, let's consider doing an API lookup. |
149 | - if ( '' === $geolocation['country'] && $api_fallback ) { |
|
150 | - $geolocation['country'] = self::geolocate_via_api( $ip_address ); |
|
149 | + if ('' === $geolocation['country'] && $api_fallback) { |
|
150 | + $geolocation['country'] = self::geolocate_via_api($ip_address); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | // It's possible that we're in a local environment, in which case the geolocation needs to be done from the |
154 | 154 | // external address. |
155 | - if ( '' === $geolocation['country'] && $fallback ) { |
|
155 | + if ('' === $geolocation['country'] && $fallback) { |
|
156 | 156 | $external_ip_address = self::get_external_ip_address(); |
157 | 157 | |
158 | 158 | // Only bother with this if the external IP differs. |
159 | - if ( '0.0.0.0' !== $external_ip_address && $external_ip_address !== $ip_address ) { |
|
160 | - return self::geolocate_ip( $external_ip_address, false, $api_fallback ); |
|
159 | + if ('0.0.0.0' !== $external_ip_address && $external_ip_address !== $ip_address) { |
|
160 | + return self::geolocate_ip($external_ip_address, false, $api_fallback); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | 'HTTP_X_COUNTRY_CODE', |
188 | 188 | ); |
189 | 189 | |
190 | - foreach ( $headers as $header ) { |
|
191 | - if ( empty( $_SERVER[ $header ] ) ) { |
|
190 | + foreach ($headers as $header) { |
|
191 | + if (empty($_SERVER[$header])) { |
|
192 | 192 | continue; |
193 | 193 | } |
194 | 194 | |
195 | - $country_code = strtoupper( sanitize_text_field( wp_unslash( $_SERVER[ $header ] ) ) ); |
|
195 | + $country_code = strtoupper(sanitize_text_field(wp_unslash($_SERVER[$header]))); |
|
196 | 196 | break; |
197 | 197 | } |
198 | 198 | |
@@ -211,36 +211,36 @@ discard block |
||
211 | 211 | * @param string $ip_address IP address. |
212 | 212 | * @return string |
213 | 213 | */ |
214 | - protected static function geolocate_via_api( $ip_address ) { |
|
214 | + protected static function geolocate_via_api($ip_address) { |
|
215 | 215 | |
216 | 216 | // Retrieve from cache... |
217 | - $country_code = get_transient( 'geoip_' . $ip_address ); |
|
217 | + $country_code = get_transient('geoip_' . $ip_address); |
|
218 | 218 | |
219 | 219 | // If missing, retrieve from the API. |
220 | - if ( false === $country_code ) { |
|
221 | - $geoip_services = apply_filters( 'getpaid_geolocation_geoip_apis', self::$geoip_apis ); |
|
220 | + if (false === $country_code) { |
|
221 | + $geoip_services = apply_filters('getpaid_geolocation_geoip_apis', self::$geoip_apis); |
|
222 | 222 | |
223 | - if ( empty( $geoip_services ) ) { |
|
223 | + if (empty($geoip_services)) { |
|
224 | 224 | return ''; |
225 | 225 | } |
226 | 226 | |
227 | - $geoip_services_keys = array_keys( $geoip_services ); |
|
227 | + $geoip_services_keys = array_keys($geoip_services); |
|
228 | 228 | |
229 | - shuffle( $geoip_services_keys ); |
|
229 | + shuffle($geoip_services_keys); |
|
230 | 230 | |
231 | - foreach ( $geoip_services_keys as $service_name ) { |
|
231 | + foreach ($geoip_services_keys as $service_name) { |
|
232 | 232 | |
233 | - $service_endpoint = $geoip_services[ $service_name ]; |
|
234 | - $response = wp_safe_remote_get( sprintf( $service_endpoint, $ip_address ), array( 'timeout' => 2 ) ); |
|
235 | - $country_code = sanitize_text_field( strtoupper( self::handle_geolocation_response( $response, $service_name ) ) ); |
|
233 | + $service_endpoint = $geoip_services[$service_name]; |
|
234 | + $response = wp_safe_remote_get(sprintf($service_endpoint, $ip_address), array('timeout' => 2)); |
|
235 | + $country_code = sanitize_text_field(strtoupper(self::handle_geolocation_response($response, $service_name))); |
|
236 | 236 | |
237 | - if ( ! empty( $country_code ) ) { |
|
237 | + if (!empty($country_code)) { |
|
238 | 238 | break; |
239 | 239 | } |
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - set_transient( 'geoip_' . $ip_address, $country_code, WEEK_IN_SECONDS ); |
|
243 | + set_transient('geoip_' . $ip_address, $country_code, WEEK_IN_SECONDS); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | return $country_code; |
@@ -253,23 +253,23 @@ discard block |
||
253 | 253 | * @param String $geolocation_service |
254 | 254 | * @return string Country code |
255 | 255 | */ |
256 | - protected static function handle_geolocation_response( $geolocation_response, $geolocation_service ) { |
|
256 | + protected static function handle_geolocation_response($geolocation_response, $geolocation_service) { |
|
257 | 257 | |
258 | - if ( is_wp_error( $geolocation_response ) || empty( $geolocation_response['body'] ) ) { |
|
258 | + if (is_wp_error($geolocation_response) || empty($geolocation_response['body'])) { |
|
259 | 259 | return ''; |
260 | 260 | } |
261 | 261 | |
262 | - if ( $geolocation_service === 'ipinfo.io' ) { |
|
263 | - $data = json_decode( $geolocation_response['body'] ); |
|
264 | - return empty( $data ) || empty( $data->country ) ? '' : $data->country; |
|
262 | + if ($geolocation_service === 'ipinfo.io') { |
|
263 | + $data = json_decode($geolocation_response['body']); |
|
264 | + return empty($data) || empty($data->country) ? '' : $data->country; |
|
265 | 265 | } |
266 | 266 | |
267 | - if ( $geolocation_service === 'ip-api.com' ) { |
|
268 | - $data = json_decode( $geolocation_response['body'] ); |
|
269 | - return empty( $data ) || empty( $data->countryCode ) ? '' : $data->countryCode; |
|
267 | + if ($geolocation_service === 'ip-api.com') { |
|
268 | + $data = json_decode($geolocation_response['body']); |
|
269 | + return empty($data) || empty($data->countryCode) ? '' : $data->countryCode; |
|
270 | 270 | } |
271 | 271 | |
272 | - return apply_filters( 'getpaid_geolocation_geoip_response_' . $geolocation_service, '', $geolocation_response['body'] ); |
|
272 | + return apply_filters('getpaid_geolocation_geoip_response_' . $geolocation_service, '', $geolocation_response['body']); |
|
273 | 273 | |
274 | 274 | } |
275 | 275 |