@@ -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,14 +29,14 @@ 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 | $capabilities = wpinv_current_user_can_manage_invoicing(); |
37 | 37 | |
38 | 38 | // Fires before registering post types. |
39 | - do_action( 'getpaid_register_post_types' ); |
|
39 | + do_action('getpaid_register_post_types'); |
|
40 | 40 | |
41 | 41 | // Register item post type. |
42 | 42 | register_post_type( |
@@ -45,29 +45,29 @@ discard block |
||
45 | 45 | 'wpinv_register_post_type_invoice_item', |
46 | 46 | array( |
47 | 47 | 'labels' => array( |
48 | - 'name' => _x( 'Items', 'post type general name', 'invoicing' ), |
|
49 | - 'singular_name' => _x( 'Item', 'post type singular name', 'invoicing' ), |
|
50 | - 'menu_name' => _x( 'Items', 'admin menu', 'invoicing' ), |
|
51 | - 'name_admin_bar' => _x( 'Item', 'add new on admin bar', 'invoicing' ), |
|
52 | - 'add_new' => _x( 'Add New', 'Item', 'invoicing' ), |
|
53 | - 'add_new_item' => __( 'Add New Item', 'invoicing' ), |
|
54 | - 'new_item' => __( 'New Item', 'invoicing' ), |
|
55 | - 'edit_item' => __( 'Edit Item', 'invoicing' ), |
|
56 | - 'view_item' => __( 'View Item', 'invoicing' ), |
|
57 | - 'all_items' => __( 'Items', 'invoicing' ), |
|
58 | - 'search_items' => __( 'Search items', 'invoicing' ), |
|
59 | - 'parent_item_colon' => __( 'Parent item:', 'invoicing' ), |
|
60 | - 'not_found' => __( 'No items found.', 'invoicing' ), |
|
61 | - 'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' ) |
|
48 | + 'name' => _x('Items', 'post type general name', 'invoicing'), |
|
49 | + 'singular_name' => _x('Item', 'post type singular name', 'invoicing'), |
|
50 | + 'menu_name' => _x('Items', 'admin menu', 'invoicing'), |
|
51 | + 'name_admin_bar' => _x('Item', 'add new on admin bar', 'invoicing'), |
|
52 | + 'add_new' => _x('Add New', 'Item', 'invoicing'), |
|
53 | + 'add_new_item' => __('Add New Item', 'invoicing'), |
|
54 | + 'new_item' => __('New Item', 'invoicing'), |
|
55 | + 'edit_item' => __('Edit Item', 'invoicing'), |
|
56 | + 'view_item' => __('View Item', 'invoicing'), |
|
57 | + 'all_items' => __('Items', 'invoicing'), |
|
58 | + 'search_items' => __('Search items', 'invoicing'), |
|
59 | + 'parent_item_colon' => __('Parent item:', 'invoicing'), |
|
60 | + 'not_found' => __('No items found.', 'invoicing'), |
|
61 | + 'not_found_in_trash' => __('No items found in trash.', 'invoicing') |
|
62 | 62 | ), |
63 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
63 | + 'description' => __('This is where you can add new invoice items.', 'invoicing'), |
|
64 | 64 | 'public' => false, |
65 | 65 | 'has_archive' => false, |
66 | 66 | '_builtin' => false, |
67 | 67 | 'show_ui' => true, |
68 | 68 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
69 | 69 | 'show_in_nav_menus' => false, |
70 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
70 | + 'supports' => array('title', 'excerpt', 'thumbnail'), |
|
71 | 71 | 'rewrite' => false, |
72 | 72 | 'query_var' => false, |
73 | 73 | 'map_meta_cap' => true, |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | 'wpinv_register_post_type_payment_form', |
85 | 85 | array( |
86 | 86 | 'labels' => array( |
87 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
88 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
89 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
90 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
91 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
92 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
93 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
94 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
95 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
96 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
97 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
98 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
99 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
100 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
87 | + 'name' => _x('Payment Forms', 'post type general name', 'invoicing'), |
|
88 | + 'singular_name' => _x('Payment Form', 'post type singular name', 'invoicing'), |
|
89 | + 'menu_name' => _x('Payment Forms', 'admin menu', 'invoicing'), |
|
90 | + 'name_admin_bar' => _x('Payment Form', 'add new on admin bar', 'invoicing'), |
|
91 | + 'add_new' => _x('Add New', 'Payment Form', 'invoicing'), |
|
92 | + 'add_new_item' => __('Add New Payment Form', 'invoicing'), |
|
93 | + 'new_item' => __('New Payment Form', 'invoicing'), |
|
94 | + 'edit_item' => __('Edit Payment Form', 'invoicing'), |
|
95 | + 'view_item' => __('View Payment Form', 'invoicing'), |
|
96 | + 'all_items' => __('Payment Forms', 'invoicing'), |
|
97 | + 'search_items' => __('Search Payment Forms', 'invoicing'), |
|
98 | + 'parent_item_colon' => __('Parent Payment Forms:', 'invoicing'), |
|
99 | + 'not_found' => __('No payment forms found.', 'invoicing'), |
|
100 | + 'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing') |
|
101 | 101 | ), |
102 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
102 | + 'description' => __('Add new payment forms.', 'invoicing'), |
|
103 | 103 | 'public' => false, |
104 | 104 | 'show_ui' => true, |
105 | 105 | 'show_in_menu' => $capabilities ? 'wpinv' : true, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'has_archive' => false, |
111 | 111 | 'hierarchical' => false, |
112 | 112 | 'menu_position' => null, |
113 | - 'supports' => array( 'title' ), |
|
113 | + 'supports' => array('title'), |
|
114 | 114 | 'menu_icon' => 'dashicons-media-form', |
115 | 115 | 'capabilities' => array( |
116 | 116 | 'edit_post' => $capabilities, |
@@ -133,32 +133,32 @@ discard block |
||
133 | 133 | 'wpinv_register_post_type_invoice', |
134 | 134 | array( |
135 | 135 | 'labels' => array( |
136 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
137 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
138 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
139 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
140 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
141 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
142 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
143 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
144 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
145 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
146 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
147 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
148 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
149 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
150 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
151 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
152 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
153 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
154 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
155 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
156 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
157 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
158 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
159 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
136 | + 'name' => __('Invoices', 'invoicing'), |
|
137 | + 'singular_name' => __('Invoice', 'invoicing'), |
|
138 | + 'all_items' => __('Invoices', 'invoicing'), |
|
139 | + 'menu_name' => _x('Invoices', 'Admin menu name', 'invoicing'), |
|
140 | + 'add_new' => __('Add New', 'invoicing'), |
|
141 | + 'add_new_item' => __('Add new invoice', 'invoicing'), |
|
142 | + 'edit' => __('Edit', 'invoicing'), |
|
143 | + 'edit_item' => __('Edit invoice', 'invoicing'), |
|
144 | + 'new_item' => __('New invoice', 'invoicing'), |
|
145 | + 'view_item' => __('View invoice', 'invoicing'), |
|
146 | + 'view_items' => __('View Invoices', 'invoicing'), |
|
147 | + 'search_items' => __('Search invoices', 'invoicing'), |
|
148 | + 'not_found' => __('No invoices found', 'invoicing'), |
|
149 | + 'not_found_in_trash' => __('No invoices found in trash', 'invoicing'), |
|
150 | + 'parent' => __('Parent invoice', 'invoicing'), |
|
151 | + 'featured_image' => __('Invoice image', 'invoicing'), |
|
152 | + 'set_featured_image' => __('Set invoice image', 'invoicing'), |
|
153 | + 'remove_featured_image' => __('Remove invoice image', 'invoicing'), |
|
154 | + 'use_featured_image' => __('Use as invoice image', 'invoicing'), |
|
155 | + 'insert_into_item' => __('Insert into invoice', 'invoicing'), |
|
156 | + 'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'), |
|
157 | + 'filter_items_list' => __('Filter invoices', 'invoicing'), |
|
158 | + 'items_list_navigation' => __('Invoices navigation', 'invoicing'), |
|
159 | + 'items_list' => __('Invoices list', 'invoicing'), |
|
160 | 160 | ), |
161 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
161 | + 'description' => __('This is where invoices are stored.', 'invoicing'), |
|
162 | 162 | 'public' => true, |
163 | 163 | 'has_archive' => false, |
164 | 164 | 'publicly_queryable' => true, |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'show_ui' => true, |
167 | 167 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
168 | 168 | 'show_in_nav_menus' => false, |
169 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
169 | + 'supports' => array('title', 'author', 'excerpt'), |
|
170 | 170 | 'rewrite' => array( |
171 | 171 | 'slug' => 'invoice', |
172 | 172 | 'with_front' => false, |
@@ -189,32 +189,32 @@ discard block |
||
189 | 189 | 'wpinv_register_post_type_discount', |
190 | 190 | array( |
191 | 191 | 'labels' => array( |
192 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
193 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
194 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
195 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
196 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
197 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
198 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
199 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
200 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
201 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
202 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
203 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
204 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
205 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
206 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
207 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
208 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
209 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
210 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
211 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
212 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
213 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
214 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
215 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
192 | + 'name' => __('Discounts', 'invoicing'), |
|
193 | + 'singular_name' => __('Discount', 'invoicing'), |
|
194 | + 'all_items' => __('Discounts', 'invoicing'), |
|
195 | + 'menu_name' => _x('Discounts', 'Admin menu name', 'invoicing'), |
|
196 | + 'add_new' => __('Add New', 'invoicing'), |
|
197 | + 'add_new_item' => __('Add new discount', 'invoicing'), |
|
198 | + 'edit' => __('Edit', 'invoicing'), |
|
199 | + 'edit_item' => __('Edit discount', 'invoicing'), |
|
200 | + 'new_item' => __('New discount', 'invoicing'), |
|
201 | + 'view_item' => __('View discount', 'invoicing'), |
|
202 | + 'view_items' => __('View Discounts', 'invoicing'), |
|
203 | + 'search_items' => __('Search discounts', 'invoicing'), |
|
204 | + 'not_found' => __('No discounts found', 'invoicing'), |
|
205 | + 'not_found_in_trash' => __('No discounts found in trash', 'invoicing'), |
|
206 | + 'parent' => __('Parent discount', 'invoicing'), |
|
207 | + 'featured_image' => __('Discount image', 'invoicing'), |
|
208 | + 'set_featured_image' => __('Set discount image', 'invoicing'), |
|
209 | + 'remove_featured_image' => __('Remove discount image', 'invoicing'), |
|
210 | + 'use_featured_image' => __('Use as discount image', 'invoicing'), |
|
211 | + 'insert_into_item' => __('Insert into discount', 'invoicing'), |
|
212 | + 'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'), |
|
213 | + 'filter_items_list' => __('Filter discounts', 'invoicing'), |
|
214 | + 'items_list_navigation' => __('Discount navigation', 'invoicing'), |
|
215 | + 'items_list' => __('Discounts list', 'invoicing'), |
|
216 | 216 | ), |
217 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
217 | + 'description' => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'), |
|
218 | 218 | 'public' => false, |
219 | 219 | 'can_export' => true, |
220 | 220 | '_builtin' => false, |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | 'map_meta_cap' => true, |
228 | 228 | 'has_archive' => false, |
229 | 229 | 'hierarchical' => false, |
230 | - 'supports' => array( 'title', 'excerpt' ), |
|
230 | + 'supports' => array('title', 'excerpt'), |
|
231 | 231 | 'show_in_nav_menus' => false, |
232 | 232 | 'show_in_admin_bar' => true, |
233 | 233 | 'menu_position' => null, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | ) |
236 | 236 | ); |
237 | 237 | |
238 | - do_action( 'getpaid_after_register_post_types' ); |
|
238 | + do_action('getpaid_after_register_post_types'); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -248,79 +248,79 @@ discard block |
||
248 | 248 | array( |
249 | 249 | |
250 | 250 | 'wpi-pending' => array( |
251 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
251 | + 'label' => _x('Pending Payment', 'Invoice status', 'invoicing'), |
|
252 | 252 | 'public' => true, |
253 | 253 | 'exclude_from_search' => true, |
254 | 254 | 'show_in_admin_all_list' => true, |
255 | 255 | 'show_in_admin_status_list' => true, |
256 | 256 | /* translators: %s: number of invoices */ |
257 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
257 | + 'label_count' => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing') |
|
258 | 258 | ), |
259 | 259 | |
260 | 260 | 'wpi-processing' => array( |
261 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
261 | + 'label' => _x('Processing', 'Invoice status', 'invoicing'), |
|
262 | 262 | 'public' => true, |
263 | 263 | 'exclude_from_search' => true, |
264 | 264 | 'show_in_admin_all_list' => true, |
265 | 265 | 'show_in_admin_status_list' => true, |
266 | 266 | /* translators: %s: number of invoices */ |
267 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
267 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing') |
|
268 | 268 | ), |
269 | 269 | |
270 | 270 | 'wpi-onhold' => array( |
271 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
271 | + 'label' => _x('On Hold', 'Invoice status', 'invoicing'), |
|
272 | 272 | 'public' => true, |
273 | 273 | 'exclude_from_search' => true, |
274 | 274 | 'show_in_admin_all_list' => true, |
275 | 275 | 'show_in_admin_status_list' => true, |
276 | 276 | /* translators: %s: number of invoices */ |
277 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
277 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing') |
|
278 | 278 | ), |
279 | 279 | |
280 | 280 | 'wpi-cancelled' => array( |
281 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
281 | + 'label' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
282 | 282 | 'public' => true, |
283 | 283 | 'exclude_from_search' => true, |
284 | 284 | 'show_in_admin_all_list' => true, |
285 | 285 | 'show_in_admin_status_list' => true, |
286 | 286 | /* translators: %s: number of invoices */ |
287 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
287 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing') |
|
288 | 288 | ), |
289 | 289 | |
290 | 290 | 'wpi-refunded' => array( |
291 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
291 | + 'label' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
292 | 292 | 'public' => true, |
293 | 293 | 'exclude_from_search' => true, |
294 | 294 | 'show_in_admin_all_list' => true, |
295 | 295 | 'show_in_admin_status_list' => true, |
296 | 296 | /* translators: %s: number of invoices */ |
297 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
297 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing') |
|
298 | 298 | ), |
299 | 299 | |
300 | 300 | 'wpi-failed' => array( |
301 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
301 | + 'label' => _x('Failed', 'Invoice status', 'invoicing'), |
|
302 | 302 | 'public' => true, |
303 | 303 | 'exclude_from_search' => true, |
304 | 304 | 'show_in_admin_all_list' => true, |
305 | 305 | 'show_in_admin_status_list' => true, |
306 | 306 | /* translators: %s: number of invoices */ |
307 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
307 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing') |
|
308 | 308 | ), |
309 | 309 | |
310 | 310 | 'wpi-renewal' => array( |
311 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
311 | + 'label' => _x('Renewal', 'Invoice status', 'invoicing'), |
|
312 | 312 | 'public' => true, |
313 | 313 | 'exclude_from_search' => true, |
314 | 314 | 'show_in_admin_all_list' => true, |
315 | 315 | 'show_in_admin_status_list' => true, |
316 | 316 | /* translators: %s: number of invoices */ |
317 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
317 | + 'label_count' => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing') |
|
318 | 318 | ) |
319 | 319 | ) |
320 | 320 | ); |
321 | 321 | |
322 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
323 | - register_post_status( $invoice_statuse, $args ); |
|
322 | + foreach ($invoice_statuses as $invoice_statuse => $args) { |
|
323 | + register_post_status($invoice_statuse, $args); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * |
337 | 337 | */ |
338 | 338 | public static function maybe_flush_rewrite_rules() { |
339 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
340 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
339 | + if (!get_option('getpaid_flushed_rewrite_rules')) { |
|
340 | + update_option('getpaid_flushed_rewrite_rules', '1'); |
|
341 | 341 | self::flush_rewrite_rules(); |
342 | 342 | } |
343 | 343 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -72,28 +72,28 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param int|object|GetPaid_Payment_Form|WP_Post $form Form to read. |
74 | 74 | */ |
75 | - public function __construct( $form = 0 ) { |
|
76 | - parent::__construct( $form ); |
|
75 | + public function __construct($form = 0) { |
|
76 | + parent::__construct($form); |
|
77 | 77 | |
78 | - if ( is_numeric( $form ) && $form > 0 ) { |
|
79 | - $this->set_id( $form ); |
|
80 | - } elseif ( $form instanceof self ) { |
|
78 | + if (is_numeric($form) && $form > 0) { |
|
79 | + $this->set_id($form); |
|
80 | + } elseif ($form instanceof self) { |
|
81 | 81 | |
82 | - $this->set_id( $form->get_id() ); |
|
82 | + $this->set_id($form->get_id()); |
|
83 | 83 | $this->invoice = $form->invoice; |
84 | 84 | |
85 | - } elseif ( ! empty( $form->ID ) ) { |
|
86 | - $this->set_id( $form->ID ); |
|
85 | + } elseif (!empty($form->ID)) { |
|
86 | + $this->set_id($form->ID); |
|
87 | 87 | } else { |
88 | - $this->set_object_read( true ); |
|
88 | + $this->set_object_read(true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // Load the datastore. |
92 | - $this->data_store = GetPaid_Data_Store::load( $this->data_store_name ); |
|
92 | + $this->data_store = GetPaid_Data_Store::load($this->data_store_name); |
|
93 | 93 | |
94 | - if ( $this->get_id() > 0 ) { |
|
95 | - $this->post = get_post( $this->get_id() ); |
|
96 | - $this->data_store->read( $this ); |
|
94 | + if ($this->get_id() > 0) { |
|
95 | + $this->post = get_post($this->get_id()); |
|
96 | + $this->data_store->read($this); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | } |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @param string $context View or edit context. |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - public function get_version( $context = 'view' ) { |
|
124 | - return $this->get_prop( 'version', $context ); |
|
123 | + public function get_version($context = 'view') { |
|
124 | + return $this->get_prop('version', $context); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param string $context View or edit context. |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - public function get_date_created( $context = 'view' ) { |
|
135 | - return $this->get_prop( 'date_created', $context ); |
|
134 | + public function get_date_created($context = 'view') { |
|
135 | + return $this->get_prop('date_created', $context); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @param string $context View or edit context. |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function get_date_created_gmt( $context = 'view' ) { |
|
146 | - $date = $this->get_date_created( $context ); |
|
145 | + public function get_date_created_gmt($context = 'view') { |
|
146 | + $date = $this->get_date_created($context); |
|
147 | 147 | |
148 | - if ( $date ) { |
|
149 | - $date = get_gmt_from_date( $date ); |
|
148 | + if ($date) { |
|
149 | + $date = get_gmt_from_date($date); |
|
150 | 150 | } |
151 | 151 | return $date; |
152 | 152 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @param string $context View or edit context. |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - public function get_date_modified( $context = 'view' ) { |
|
162 | - return $this->get_prop( 'date_modified', $context ); |
|
161 | + public function get_date_modified($context = 'view') { |
|
162 | + return $this->get_prop('date_modified', $context); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @param string $context View or edit context. |
170 | 170 | * @return string |
171 | 171 | */ |
172 | - public function get_date_modified_gmt( $context = 'view' ) { |
|
173 | - $date = $this->get_date_modified( $context ); |
|
172 | + public function get_date_modified_gmt($context = 'view') { |
|
173 | + $date = $this->get_date_modified($context); |
|
174 | 174 | |
175 | - if ( $date ) { |
|
176 | - $date = get_gmt_from_date( $date ); |
|
175 | + if ($date) { |
|
176 | + $date = get_gmt_from_date($date); |
|
177 | 177 | } |
178 | 178 | return $date; |
179 | 179 | } |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | * @param string $context View or edit context. |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public function get_name( $context = 'view' ) { |
|
189 | - return $this->get_prop( 'name', $context ); |
|
188 | + public function get_name($context = 'view') { |
|
189 | + return $this->get_prop('name', $context); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | * @param string $context View or edit context. |
197 | 197 | * @return string |
198 | 198 | */ |
199 | - public function get_title( $context = 'view' ) { |
|
200 | - return $this->get_name( $context ); |
|
199 | + public function get_title($context = 'view') { |
|
200 | + return $this->get_name($context); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | * @param string $context View or edit context. |
208 | 208 | * @return int |
209 | 209 | */ |
210 | - public function get_author( $context = 'view' ) { |
|
211 | - return (int) $this->get_prop( 'author', $context ); |
|
210 | + public function get_author($context = 'view') { |
|
211 | + return (int) $this->get_prop('author', $context); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -218,21 +218,21 @@ discard block |
||
218 | 218 | * @param string $context View or edit context. |
219 | 219 | * @return array |
220 | 220 | */ |
221 | - public function get_elements( $context = 'view' ) { |
|
222 | - $elements = $this->get_prop( 'elements', $context ); |
|
221 | + public function get_elements($context = 'view') { |
|
222 | + $elements = $this->get_prop('elements', $context); |
|
223 | 223 | |
224 | - if ( empty( $elements ) || ! is_array( $elements ) ) { |
|
225 | - return wpinv_get_data( 'sample-payment-form' ); |
|
224 | + if (empty($elements) || !is_array($elements)) { |
|
225 | + return wpinv_get_data('sample-payment-form'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Ensure that all required elements exist. |
229 | 229 | $_elements = array(); |
230 | - foreach ( $elements as $element ) { |
|
230 | + foreach ($elements as $element) { |
|
231 | 231 | |
232 | - if ( $element['type'] == 'pay_button' && ! $this->has_element_type( 'gateway_select' ) ) { |
|
232 | + if ($element['type'] == 'pay_button' && !$this->has_element_type('gateway_select')) { |
|
233 | 233 | |
234 | 234 | $_elements[] = array( |
235 | - 'text' => __( 'Select Payment Method', 'invoicing' ), |
|
235 | + 'text' => __('Select Payment Method', 'invoicing'), |
|
236 | 236 | 'id' => 'gtscicd', |
237 | 237 | 'name' => 'gtscicd', |
238 | 238 | 'type' => 'gateway_select', |
@@ -257,22 +257,22 @@ discard block |
||
257 | 257 | * @param string $return objects or arrays. |
258 | 258 | * @return GetPaid_Form_Item[] |
259 | 259 | */ |
260 | - public function get_items( $context = 'view', $return = 'objects' ) { |
|
261 | - $items = $this->get_prop( 'items', $context ); |
|
260 | + public function get_items($context = 'view', $return = 'objects') { |
|
261 | + $items = $this->get_prop('items', $context); |
|
262 | 262 | |
263 | - if ( empty( $items ) || ! is_array( $items ) ) { |
|
264 | - $items = wpinv_get_data( 'sample-payment-form-items' ); |
|
263 | + if (empty($items) || !is_array($items)) { |
|
264 | + $items = wpinv_get_data('sample-payment-form-items'); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | // Convert the items. |
268 | 268 | $prepared = array(); |
269 | 269 | |
270 | - foreach ( $items as $key => $value ) { |
|
270 | + foreach ($items as $key => $value) { |
|
271 | 271 | |
272 | 272 | // Form items. |
273 | - if ( $value instanceof GetPaid_Form_Item ) { |
|
273 | + if ($value instanceof GetPaid_Form_Item) { |
|
274 | 274 | |
275 | - if ( $value->can_purchase() ) { |
|
275 | + if ($value->can_purchase()) { |
|
276 | 276 | $prepared[] = $value; |
277 | 277 | } |
278 | 278 | |
@@ -281,16 +281,16 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | // $item_id => $quantity (buy buttons) |
284 | - if ( is_numeric( $key ) && is_numeric( $value ) ) { |
|
285 | - $item = new GetPaid_Form_Item( $key ); |
|
284 | + if (is_numeric($key) && is_numeric($value)) { |
|
285 | + $item = new GetPaid_Form_Item($key); |
|
286 | 286 | |
287 | - if ( $item->can_purchase() ) { |
|
287 | + if ($item->can_purchase()) { |
|
288 | 288 | |
289 | 289 | $value = (float) $value; |
290 | - $item->set_quantity( $value ); |
|
291 | - if ( 0 == $value ) { |
|
292 | - $item->set_quantity( 1 ); |
|
293 | - $item->set_allow_quantities( true ); |
|
290 | + $item->set_quantity($value); |
|
291 | + if (0 == $value) { |
|
292 | + $item->set_quantity(1); |
|
293 | + $item->set_allow_quantities(true); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $prepared[] = $item; |
@@ -300,33 +300,33 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | // Items saved via payment forms editor. |
303 | - if ( is_array( $value ) && isset( $value['id'] ) ) { |
|
303 | + if (is_array($value) && isset($value['id'])) { |
|
304 | 304 | |
305 | - $item = new GetPaid_Form_Item( $value['id'] ); |
|
305 | + $item = new GetPaid_Form_Item($value['id']); |
|
306 | 306 | |
307 | - if ( ! $item->can_purchase() ) { |
|
307 | + if (!$item->can_purchase()) { |
|
308 | 308 | continue; |
309 | 309 | } |
310 | 310 | |
311 | 311 | // Sub-total (Cart items). |
312 | - if ( isset( $value['subtotal'] ) ) { |
|
313 | - $item->set_price( $value['subtotal'] ); |
|
312 | + if (isset($value['subtotal'])) { |
|
313 | + $item->set_price($value['subtotal']); |
|
314 | 314 | } |
315 | 315 | |
316 | - if ( isset( $value['quantity'] ) ) { |
|
317 | - $item->set_quantity( $value['quantity'] ); |
|
316 | + if (isset($value['quantity'])) { |
|
317 | + $item->set_quantity($value['quantity']); |
|
318 | 318 | } |
319 | 319 | |
320 | - if ( isset( $value['allow_quantities'] ) ) { |
|
321 | - $item->set_allow_quantities( $value['allow_quantities'] ); |
|
320 | + if (isset($value['allow_quantities'])) { |
|
321 | + $item->set_allow_quantities($value['allow_quantities']); |
|
322 | 322 | } |
323 | 323 | |
324 | - if ( isset( $value['required'] ) ) { |
|
325 | - $item->set_is_required( $value['required'] ); |
|
324 | + if (isset($value['required'])) { |
|
325 | + $item->set_is_required($value['required']); |
|
326 | 326 | } |
327 | 327 | |
328 | - if ( isset( $value['description'] ) ) { |
|
329 | - $item->set_custom_description( $value['description'] ); |
|
328 | + if (isset($value['description'])) { |
|
329 | + $item->set_custom_description($value['description']); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | $prepared[] = $item; |
@@ -335,14 +335,14 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // $item_id => array( 'price' => 10 ) (item variations) |
338 | - if ( is_numeric( $key ) && is_array( $value ) ) { |
|
339 | - $item = new GetPaid_Form_Item( $key ); |
|
338 | + if (is_numeric($key) && is_array($value)) { |
|
339 | + $item = new GetPaid_Form_Item($key); |
|
340 | 340 | |
341 | - if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) { |
|
342 | - $item->set_price( $value['price'] ); |
|
341 | + if (isset($value['price']) && $item->user_can_set_their_price()) { |
|
342 | + $item->set_price($value['price']); |
|
343 | 343 | } |
344 | 344 | |
345 | - if ( $item->can_purchase() ) { |
|
345 | + if ($item->can_purchase()) { |
|
346 | 346 | $prepared[] = $item; |
347 | 347 | } |
348 | 348 | |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | |
352 | 352 | } |
353 | 353 | |
354 | - if ( 'objects' == $return && 'view' == $context ) { |
|
354 | + if ('objects' == $return && 'view' == $context) { |
|
355 | 355 | return $prepared; |
356 | 356 | } |
357 | 357 | |
358 | 358 | $items = array(); |
359 | - foreach ( $prepared as $item ) { |
|
359 | + foreach ($prepared as $item) { |
|
360 | 360 | $items[] = $item->prepare_data_for_use(); |
361 | 361 | } |
362 | 362 | |
@@ -370,14 +370,14 @@ discard block |
||
370 | 370 | * @param int $item_id The item id to return. |
371 | 371 | * @return GetPaid_Form_Item|bool |
372 | 372 | */ |
373 | - public function get_item( $item_id ) { |
|
373 | + public function get_item($item_id) { |
|
374 | 374 | |
375 | - if ( empty( $item_id ) || ! is_numeric( $item_id ) ) { |
|
375 | + if (empty($item_id) || !is_numeric($item_id)) { |
|
376 | 376 | return false; |
377 | 377 | } |
378 | 378 | |
379 | - foreach( $this->get_items() as $item ) { |
|
380 | - if ( $item->get_id() == (int) $item_id ) { |
|
379 | + foreach ($this->get_items() as $item) { |
|
380 | + if ($item->get_id() == (int) $item_id) { |
|
381 | 381 | return $item; |
382 | 382 | } |
383 | 383 | } |
@@ -393,15 +393,15 @@ discard block |
||
393 | 393 | * @param string $element_type The element type to return. |
394 | 394 | * @return array|bool |
395 | 395 | */ |
396 | - public function get_element_type( $element_type ) { |
|
396 | + public function get_element_type($element_type) { |
|
397 | 397 | |
398 | - if ( empty( $element_type ) || ! is_scalar( $element_type ) ) { |
|
398 | + if (empty($element_type) || !is_scalar($element_type)) { |
|
399 | 399 | return false; |
400 | 400 | } |
401 | 401 | |
402 | - foreach ( $this->get_prop( 'elements' ) as $element ) { |
|
402 | + foreach ($this->get_prop('elements') as $element) { |
|
403 | 403 | |
404 | - if ( $element['type'] == $element_type ) { |
|
404 | + if ($element['type'] == $element_type) { |
|
405 | 405 | return $element; |
406 | 406 | } |
407 | 407 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | * @param string $context View or edit context. |
419 | 419 | * @return float |
420 | 420 | */ |
421 | - public function get_earned( $context = 'view' ) { |
|
422 | - return $this->get_prop( 'earned', $context ); |
|
421 | + public function get_earned($context = 'view') { |
|
422 | + return $this->get_prop('earned', $context); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | * @param string $context View or edit context. |
430 | 430 | * @return float |
431 | 431 | */ |
432 | - public function get_refunded( $context = 'view' ) { |
|
433 | - return $this->get_prop( 'refunded', $context ); |
|
432 | + public function get_refunded($context = 'view') { |
|
433 | + return $this->get_prop('refunded', $context); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -440,8 +440,8 @@ discard block |
||
440 | 440 | * @param string $context View or edit context. |
441 | 441 | * @return float |
442 | 442 | */ |
443 | - public function get_cancelled( $context = 'view' ) { |
|
444 | - return $this->get_prop( 'cancelled', $context ); |
|
443 | + public function get_cancelled($context = 'view') { |
|
444 | + return $this->get_prop('cancelled', $context); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | * @param string $context View or edit context. |
452 | 452 | * @return float |
453 | 453 | */ |
454 | - public function get_failed( $context = 'view' ) { |
|
455 | - return $this->get_prop( 'failed', $context ); |
|
454 | + public function get_failed($context = 'view') { |
|
455 | + return $this->get_prop('failed', $context); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | * @return string |
464 | 464 | */ |
465 | 465 | public function get_currency() { |
466 | - $currency = empty( $this->invoice ) ? wpinv_get_currency() : $this->invoice->get_currency(); |
|
467 | - return apply_filters( 'getpaid-payment-form-currency', $currency, $this ); |
|
466 | + $currency = empty($this->invoice) ? wpinv_get_currency() : $this->invoice->get_currency(); |
|
467 | + return apply_filters('getpaid-payment-form-currency', $currency, $this); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /* |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @since 1.0.19 |
484 | 484 | */ |
485 | - public function set_version( $value ) { |
|
486 | - $this->set_prop( 'version', $value ); |
|
485 | + public function set_version($value) { |
|
486 | + $this->set_prop('version', $value); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | * @param string $value Value to set. |
494 | 494 | * @return bool Whether or not the date was set. |
495 | 495 | */ |
496 | - public function set_date_created( $value ) { |
|
497 | - $date = strtotime( $value ); |
|
496 | + public function set_date_created($value) { |
|
497 | + $date = strtotime($value); |
|
498 | 498 | |
499 | - if ( $date ) { |
|
500 | - $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) ); |
|
499 | + if ($date) { |
|
500 | + $this->set_prop('date_created', date('Y-m-d H:i:s', $date)); |
|
501 | 501 | return true; |
502 | 502 | } |
503 | 503 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | * @param string $value Value to set. |
513 | 513 | * @return bool Whether or not the date was set. |
514 | 514 | */ |
515 | - public function set_date_modified( $value ) { |
|
516 | - $date = strtotime( $value ); |
|
515 | + public function set_date_modified($value) { |
|
516 | + $date = strtotime($value); |
|
517 | 517 | |
518 | - if ( $date ) { |
|
519 | - $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) ); |
|
518 | + if ($date) { |
|
519 | + $this->set_prop('date_modified', date('Y-m-d H:i:s', $date)); |
|
520 | 520 | return true; |
521 | 521 | } |
522 | 522 | |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | * @since 1.0.19 |
531 | 531 | * @param string $value New name. |
532 | 532 | */ |
533 | - public function set_name( $value ) { |
|
534 | - $this->set_prop( 'name', sanitize_text_field( $value ) ); |
|
533 | + public function set_name($value) { |
|
534 | + $this->set_prop('name', sanitize_text_field($value)); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | /** |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | * @since 1.0.19 |
541 | 541 | * @param string $value New name. |
542 | 542 | */ |
543 | - public function set_title( $value ) { |
|
544 | - $this->set_name( $value ); |
|
543 | + public function set_title($value) { |
|
544 | + $this->set_name($value); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | /** |
@@ -550,8 +550,8 @@ discard block |
||
550 | 550 | * @since 1.0.19 |
551 | 551 | * @param int $value New author. |
552 | 552 | */ |
553 | - public function set_author( $value ) { |
|
554 | - $this->set_prop( 'author', (int) $value ); |
|
553 | + public function set_author($value) { |
|
554 | + $this->set_prop('author', (int) $value); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | /** |
@@ -561,21 +561,21 @@ discard block |
||
561 | 561 | * @sinve 2.3.4 Array values sanitized. |
562 | 562 | * @param array $value Form elements. |
563 | 563 | */ |
564 | - public function set_elements( $value ) { |
|
565 | - if ( is_array( $value ) ) { |
|
564 | + public function set_elements($value) { |
|
565 | + if (is_array($value)) { |
|
566 | 566 | |
567 | 567 | // sanitize |
568 | - if(!empty($value )){ |
|
568 | + if (!empty($value)) { |
|
569 | 569 | |
570 | - foreach($value as $key => $val_arr){ |
|
570 | + foreach ($value as $key => $val_arr) { |
|
571 | 571 | $help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : ''; |
572 | - $value[$key] = array_map( 'sanitize_text_field', $val_arr ); |
|
572 | + $value[$key] = array_map('sanitize_text_field', $val_arr); |
|
573 | 573 | $value[$key]['description'] = $help_text; |
574 | 574 | } |
575 | 575 | |
576 | 576 | } |
577 | 577 | |
578 | - $this->set_prop( 'elements', $value ); |
|
578 | + $this->set_prop('elements', $value); |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
@@ -585,9 +585,9 @@ discard block |
||
585 | 585 | * @since 1.0.19 |
586 | 586 | * @param array $value Form elements. |
587 | 587 | */ |
588 | - public function set_items( $value ) { |
|
589 | - if ( is_array( $value ) ) { |
|
590 | - $this->set_prop( 'items', $value ); |
|
588 | + public function set_items($value) { |
|
589 | + if (is_array($value)) { |
|
590 | + $this->set_prop('items', $value); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | * @since 1.0.19 |
598 | 598 | * @param float $value Amount earned. |
599 | 599 | */ |
600 | - public function set_earned( $value ) { |
|
601 | - $value = max( (float) $value, 0 ); |
|
602 | - $this->set_prop( 'earned', $value ); |
|
600 | + public function set_earned($value) { |
|
601 | + $value = max((float) $value, 0); |
|
602 | + $this->set_prop('earned', $value); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | * @since 1.0.19 |
609 | 609 | * @param float $value Amount refunded. |
610 | 610 | */ |
611 | - public function set_refunded( $value ) { |
|
612 | - $value = max( (float) $value, 0 ); |
|
613 | - $this->set_prop( 'refunded', $value ); |
|
611 | + public function set_refunded($value) { |
|
612 | + $value = max((float) $value, 0); |
|
613 | + $this->set_prop('refunded', $value); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | /** |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | * @since 1.0.19 |
620 | 620 | * @param float $value Amount cancelled. |
621 | 621 | */ |
622 | - public function set_cancelled( $value ) { |
|
623 | - $value = max( (float) $value, 0 ); |
|
624 | - $this->set_prop( 'cancelled', $value ); |
|
622 | + public function set_cancelled($value) { |
|
623 | + $value = max((float) $value, 0); |
|
624 | + $this->set_prop('cancelled', $value); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -630,9 +630,9 @@ discard block |
||
630 | 630 | * @since 1.0.19 |
631 | 631 | * @param float $value Amount cancelled. |
632 | 632 | */ |
633 | - public function set_failed( $value ) { |
|
634 | - $value = max( (float) $value, 0 ); |
|
635 | - $this->set_prop( 'failed', $value ); |
|
633 | + public function set_failed($value) { |
|
634 | + $value = max((float) $value, 0); |
|
635 | + $this->set_prop('failed', $value); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -641,11 +641,11 @@ discard block |
||
641 | 641 | * @deprecated |
642 | 642 | * @return int item id |
643 | 643 | */ |
644 | - public function create( $data = array() ) { |
|
644 | + public function create($data = array()) { |
|
645 | 645 | |
646 | 646 | // Set the properties. |
647 | - if ( is_array( $data ) ) { |
|
648 | - $this->set_props( $data ); |
|
647 | + if (is_array($data)) { |
|
648 | + $this->set_props($data); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | // Save the item. |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | * @deprecated |
660 | 660 | * @return int item id |
661 | 661 | */ |
662 | - public function update( $data = array() ) { |
|
663 | - return $this->create( $data ); |
|
662 | + public function update($data = array()) { |
|
663 | + return $this->create($data); |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | /* |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | */ |
681 | 681 | public function is_default() { |
682 | 682 | $is_default = $this->get_id() == wpinv_get_default_payment_form(); |
683 | - return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->get_id(), $this ); |
|
683 | + return (bool) apply_filters('wpinv_is_default_payment_form', $is_default, $this->get_id(), $this); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
@@ -692,11 +692,11 @@ discard block |
||
692 | 692 | public function is_active() { |
693 | 693 | $is_active = 0 !== (int) $this->get_id(); |
694 | 694 | |
695 | - if ( $is_active && ! current_user_can( 'edit_post', $this->get_id() ) && $this->get_status() != 'publish' ) { |
|
695 | + if ($is_active && !current_user_can('edit_post', $this->get_id()) && $this->get_status() != 'publish') { |
|
696 | 696 | $is_active = false; |
697 | 697 | } |
698 | 698 | |
699 | - return (bool) apply_filters( 'wpinv_is_payment_form_active', $is_active, $this ); |
|
699 | + return (bool) apply_filters('wpinv_is_payment_form_active', $is_active, $this); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
@@ -705,8 +705,8 @@ discard block |
||
705 | 705 | * @since 1.0.19 |
706 | 706 | * @return bool |
707 | 707 | */ |
708 | - public function has_item( $item_id ) { |
|
709 | - return false !== $this->get_item( $item_id ); |
|
708 | + public function has_item($item_id) { |
|
709 | + return false !== $this->get_item($item_id); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
@@ -715,8 +715,8 @@ discard block |
||
715 | 715 | * @since 1.0.19 |
716 | 716 | * @return bool |
717 | 717 | */ |
718 | - public function has_element_type( $element_type ) { |
|
719 | - return false !== $this->get_element_type( $element_type ); |
|
718 | + public function has_element_type($element_type) { |
|
719 | + return false !== $this->get_element_type($element_type); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | /** |
@@ -727,13 +727,13 @@ discard block |
||
727 | 727 | */ |
728 | 728 | public function is_recurring() { |
729 | 729 | |
730 | - if ( ! empty( $this->invoice ) ) { |
|
730 | + if (!empty($this->invoice)) { |
|
731 | 731 | return $this->invoice->is_recurring(); |
732 | 732 | } |
733 | 733 | |
734 | - foreach ( $this->get_items() as $item ) { |
|
734 | + foreach ($this->get_items() as $item) { |
|
735 | 735 | |
736 | - if ( $item->is_recurring() ) { |
|
736 | + if ($item->is_recurring()) { |
|
737 | 737 | return true; |
738 | 738 | } |
739 | 739 | |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * |
748 | 748 | * @since 1.0.19 |
749 | 749 | */ |
750 | - public function get_html( $extra_markup = '' ) { |
|
750 | + public function get_html($extra_markup = '') { |
|
751 | 751 | |
752 | 752 | // Return the HTML. |
753 | 753 | return wpinv_get_template_html( |
@@ -765,8 +765,8 @@ discard block |
||
765 | 765 | * |
766 | 766 | * @since 1.0.19 |
767 | 767 | */ |
768 | - public function display( $extra_markup = '' ) { |
|
769 | - echo $this->get_html( $extra_markup ); |
|
768 | + public function display($extra_markup = '') { |
|
769 | + echo $this->get_html($extra_markup); |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | } |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | * @package GetPaid |
16 | 16 | */ |
17 | 17 | |
18 | -defined( 'ABSPATH' ) || exit; |
|
18 | +defined('ABSPATH') || exit; |
|
19 | 19 | |
20 | 20 | // Define constants. |
21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
23 | 23 | } |
24 | 24 | |
25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
26 | - define( 'WPINV_VERSION', '2.3.4' ); |
|
25 | +if (!defined('WPINV_VERSION')) { |
|
26 | + define('WPINV_VERSION', '2.3.4'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function getpaid() { |
41 | 41 | |
42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
42 | + if (empty($GLOBALS['invoicing'])) { |
|
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @since 2.0.8 |
53 | 53 | */ |
54 | 54 | function getpaid_deactivation_hook() { |
55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
55 | + update_option('wpinv_flush_permalinks', 1); |
|
56 | 56 | } |
57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Kickstart the plugin. |
67 | -add_action( 'plugins_loaded', 'getpaid', -100 ); |
|
67 | +add_action('plugins_loaded', 'getpaid', -100); |