@@ -15,322 +15,322 @@ |
||
15 | 15 | class GetPaid_Post_Types { |
16 | 16 | |
17 | 17 | /** |
18 | - * Hook in methods. |
|
19 | - */ |
|
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' ) ); |
|
25 | - } |
|
18 | + * Hook in methods. |
|
19 | + */ |
|
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' ) ); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Register core post types. |
|
29 | - */ |
|
30 | - public static function register_post_types() { |
|
27 | + /** |
|
28 | + * Register core post types. |
|
29 | + */ |
|
30 | + public static function register_post_types() { |
|
31 | 31 | |
32 | - if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
33 | - return; |
|
34 | - } |
|
32 | + if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) { |
|
33 | + return; |
|
34 | + } |
|
35 | 35 | |
36 | - // Fires before registering post types. |
|
37 | - do_action( 'getpaid_register_post_types' ); |
|
36 | + // Fires before registering post types. |
|
37 | + do_action( 'getpaid_register_post_types' ); |
|
38 | 38 | |
39 | - // Register item post type. |
|
40 | - register_post_type( |
|
41 | - 'wpi_item', |
|
42 | - apply_filters( |
|
43 | - 'wpinv_register_post_type_invoice_item', |
|
44 | - array( |
|
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' ) |
|
60 | - ), |
|
61 | - 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
62 | - 'public' => false, |
|
63 | - 'has_archive' => false, |
|
64 | - '_builtin' => false, |
|
65 | - 'show_ui' => true, |
|
66 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
67 | - 'show_in_nav_menus' => false, |
|
68 | - 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
69 | - 'rewrite' => false, |
|
70 | - 'query_var' => false, |
|
71 | - 'capability_type' => 'wpi_item', |
|
72 | - 'map_meta_cap' => true, |
|
73 | - 'show_in_admin_bar' => true, |
|
74 | - 'can_export' => true, |
|
75 | - ) |
|
76 | - ) |
|
77 | - ); |
|
39 | + // Register item post type. |
|
40 | + register_post_type( |
|
41 | + 'wpi_item', |
|
42 | + apply_filters( |
|
43 | + 'wpinv_register_post_type_invoice_item', |
|
44 | + array( |
|
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' ) |
|
60 | + ), |
|
61 | + 'description' => __( 'This is where you can add new invoice items.', 'invoicing' ), |
|
62 | + 'public' => false, |
|
63 | + 'has_archive' => false, |
|
64 | + '_builtin' => false, |
|
65 | + 'show_ui' => true, |
|
66 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
67 | + 'show_in_nav_menus' => false, |
|
68 | + 'supports' => array( 'title', 'excerpt', 'thumbnail' ), |
|
69 | + 'rewrite' => false, |
|
70 | + 'query_var' => false, |
|
71 | + 'capability_type' => 'wpi_item', |
|
72 | + 'map_meta_cap' => true, |
|
73 | + 'show_in_admin_bar' => true, |
|
74 | + 'can_export' => true, |
|
75 | + ) |
|
76 | + ) |
|
77 | + ); |
|
78 | 78 | |
79 | - // Register payment form post type. |
|
80 | - register_post_type( |
|
81 | - 'wpi_payment_form', |
|
82 | - apply_filters( |
|
83 | - 'wpinv_register_post_type_payment_form', |
|
84 | - array( |
|
85 | - 'labels' => array( |
|
86 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
87 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
88 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
89 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
90 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
91 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
92 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
93 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
94 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
95 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
96 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
97 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
98 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
99 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
100 | - ), |
|
101 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
102 | - 'public' => false, |
|
103 | - 'show_ui' => true, |
|
104 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
|
105 | - 'show_in_nav_menus' => false, |
|
106 | - 'query_var' => false, |
|
107 | - 'rewrite' => true, |
|
108 | - 'map_meta_cap' => true, |
|
109 | - 'has_archive' => false, |
|
110 | - 'hierarchical' => false, |
|
111 | - 'menu_position' => null, |
|
112 | - 'supports' => array( 'title' ), |
|
113 | - 'menu_icon' => 'dashicons-media-form', |
|
114 | - ) |
|
115 | - ) |
|
116 | - ); |
|
79 | + // Register payment form post type. |
|
80 | + register_post_type( |
|
81 | + 'wpi_payment_form', |
|
82 | + apply_filters( |
|
83 | + 'wpinv_register_post_type_payment_form', |
|
84 | + array( |
|
85 | + 'labels' => array( |
|
86 | + 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
87 | + 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
88 | + 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
89 | + 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
90 | + 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
91 | + 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
92 | + 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
93 | + 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
94 | + 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
95 | + 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
96 | + 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
97 | + 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
98 | + 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
99 | + 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
100 | + ), |
|
101 | + 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
102 | + 'public' => false, |
|
103 | + 'show_ui' => true, |
|
104 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
|
105 | + 'show_in_nav_menus' => false, |
|
106 | + 'query_var' => false, |
|
107 | + 'rewrite' => true, |
|
108 | + 'map_meta_cap' => true, |
|
109 | + 'has_archive' => false, |
|
110 | + 'hierarchical' => false, |
|
111 | + 'menu_position' => null, |
|
112 | + 'supports' => array( 'title' ), |
|
113 | + 'menu_icon' => 'dashicons-media-form', |
|
114 | + ) |
|
115 | + ) |
|
116 | + ); |
|
117 | 117 | |
118 | - // Register invoice post type. |
|
119 | - register_post_type( |
|
120 | - 'wpi_invoice', |
|
121 | - apply_filters( |
|
122 | - 'wpinv_register_post_type_invoice', |
|
123 | - array( |
|
124 | - 'labels' => array( |
|
125 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
126 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
127 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
128 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
129 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
130 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
131 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
132 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
133 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
134 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
135 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
136 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
137 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
138 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
139 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
140 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
141 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
142 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
143 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
144 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
145 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
146 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
147 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
148 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
149 | - ), |
|
150 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
151 | - 'public' => true, |
|
152 | - 'has_archive' => false, |
|
153 | - 'publicly_queryable' => true, |
|
154 | - 'exclude_from_search' => true, |
|
155 | - 'show_ui' => true, |
|
156 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
157 | - 'show_in_nav_menus' => false, |
|
158 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
159 | - 'rewrite' => array( |
|
160 | - 'slug' => 'invoice', |
|
161 | - 'with_front' => false, |
|
162 | - ), |
|
163 | - 'query_var' => false, |
|
164 | - 'capability_type' => 'wpi_invoice', |
|
165 | - 'map_meta_cap' => true, |
|
166 | - 'show_in_admin_bar' => true, |
|
167 | - 'can_export' => true, |
|
168 | - 'hierarchical' => false, |
|
169 | - 'menu_position' => null, |
|
170 | - 'menu_icon' => 'dashicons-media-spreadsheet', |
|
171 | - ) |
|
172 | - ) |
|
173 | - ); |
|
118 | + // Register invoice post type. |
|
119 | + register_post_type( |
|
120 | + 'wpi_invoice', |
|
121 | + apply_filters( |
|
122 | + 'wpinv_register_post_type_invoice', |
|
123 | + array( |
|
124 | + 'labels' => array( |
|
125 | + 'name' => __( 'Invoices', 'invoicing' ), |
|
126 | + 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
127 | + 'all_items' => __( 'Invoices', 'invoicing' ), |
|
128 | + 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
129 | + 'add_new' => __( 'Add New', 'invoicing' ), |
|
130 | + 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
131 | + 'edit' => __( 'Edit', 'invoicing' ), |
|
132 | + 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
133 | + 'new_item' => __( 'New invoice', 'invoicing' ), |
|
134 | + 'view_item' => __( 'View invoice', 'invoicing' ), |
|
135 | + 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
136 | + 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
137 | + 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
138 | + 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
139 | + 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
140 | + 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
141 | + 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
142 | + 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
143 | + 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
144 | + 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
145 | + 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
146 | + 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
147 | + 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
148 | + 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
149 | + ), |
|
150 | + 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
151 | + 'public' => true, |
|
152 | + 'has_archive' => false, |
|
153 | + 'publicly_queryable' => true, |
|
154 | + 'exclude_from_search' => true, |
|
155 | + 'show_ui' => true, |
|
156 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
157 | + 'show_in_nav_menus' => false, |
|
158 | + 'supports' => array( 'title', 'author', 'excerpt' ), |
|
159 | + 'rewrite' => array( |
|
160 | + 'slug' => 'invoice', |
|
161 | + 'with_front' => false, |
|
162 | + ), |
|
163 | + 'query_var' => false, |
|
164 | + 'capability_type' => 'wpi_invoice', |
|
165 | + 'map_meta_cap' => true, |
|
166 | + 'show_in_admin_bar' => true, |
|
167 | + 'can_export' => true, |
|
168 | + 'hierarchical' => false, |
|
169 | + 'menu_position' => null, |
|
170 | + 'menu_icon' => 'dashicons-media-spreadsheet', |
|
171 | + ) |
|
172 | + ) |
|
173 | + ); |
|
174 | 174 | |
175 | - // Register discount post type. |
|
176 | - register_post_type( |
|
177 | - 'wpi_discount', |
|
178 | - apply_filters( |
|
179 | - 'wpinv_register_post_type_discount', |
|
180 | - array( |
|
181 | - 'labels' => array( |
|
182 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
183 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
184 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
185 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
186 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
187 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
188 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
189 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
190 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
191 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
192 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
193 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
194 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
195 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
196 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
197 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
198 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
199 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
200 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
201 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
202 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
203 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
204 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
205 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
206 | - ), |
|
207 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
208 | - 'public' => false, |
|
209 | - 'can_export' => true, |
|
210 | - '_builtin' => false, |
|
211 | - 'publicly_queryable' => false, |
|
212 | - 'exclude_from_search'=> true, |
|
213 | - 'show_ui' => true, |
|
214 | - 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
215 | - 'query_var' => false, |
|
216 | - 'rewrite' => false, |
|
217 | - 'capability_type' => 'wpi_discount', |
|
218 | - 'map_meta_cap' => true, |
|
219 | - 'has_archive' => false, |
|
220 | - 'hierarchical' => false, |
|
221 | - 'supports' => array( 'title', 'excerpt' ), |
|
222 | - 'show_in_nav_menus' => false, |
|
223 | - 'show_in_admin_bar' => true, |
|
224 | - 'menu_position' => null, |
|
225 | - ) |
|
226 | - ) |
|
227 | - ); |
|
175 | + // Register discount post type. |
|
176 | + register_post_type( |
|
177 | + 'wpi_discount', |
|
178 | + apply_filters( |
|
179 | + 'wpinv_register_post_type_discount', |
|
180 | + array( |
|
181 | + 'labels' => array( |
|
182 | + 'name' => __( 'Discounts', 'invoicing' ), |
|
183 | + 'singular_name' => __( 'Discount', 'invoicing' ), |
|
184 | + 'all_items' => __( 'Discounts', 'invoicing' ), |
|
185 | + 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
186 | + 'add_new' => __( 'Add New', 'invoicing' ), |
|
187 | + 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
188 | + 'edit' => __( 'Edit', 'invoicing' ), |
|
189 | + 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
190 | + 'new_item' => __( 'New discount', 'invoicing' ), |
|
191 | + 'view_item' => __( 'View discount', 'invoicing' ), |
|
192 | + 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
193 | + 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
194 | + 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
195 | + 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
196 | + 'parent' => __( 'Parent discount', 'invoicing' ), |
|
197 | + 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
198 | + 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
199 | + 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
200 | + 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
201 | + 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
202 | + 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
203 | + 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
204 | + 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
205 | + 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
206 | + ), |
|
207 | + 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
208 | + 'public' => false, |
|
209 | + 'can_export' => true, |
|
210 | + '_builtin' => false, |
|
211 | + 'publicly_queryable' => false, |
|
212 | + 'exclude_from_search'=> true, |
|
213 | + 'show_ui' => true, |
|
214 | + 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
|
215 | + 'query_var' => false, |
|
216 | + 'rewrite' => false, |
|
217 | + 'capability_type' => 'wpi_discount', |
|
218 | + 'map_meta_cap' => true, |
|
219 | + 'has_archive' => false, |
|
220 | + 'hierarchical' => false, |
|
221 | + 'supports' => array( 'title', 'excerpt' ), |
|
222 | + 'show_in_nav_menus' => false, |
|
223 | + 'show_in_admin_bar' => true, |
|
224 | + 'menu_position' => null, |
|
225 | + ) |
|
226 | + ) |
|
227 | + ); |
|
228 | 228 | |
229 | - do_action( 'getpaid_after_register_post_types' ); |
|
230 | - } |
|
229 | + do_action( 'getpaid_after_register_post_types' ); |
|
230 | + } |
|
231 | 231 | |
232 | - /** |
|
233 | - * Register our custom post statuses. |
|
234 | - */ |
|
235 | - public static function register_post_status() { |
|
232 | + /** |
|
233 | + * Register our custom post statuses. |
|
234 | + */ |
|
235 | + public static function register_post_status() { |
|
236 | 236 | |
237 | - $invoice_statuses = apply_filters( |
|
238 | - 'getpaid_register_invoice_post_statuses', |
|
239 | - array( |
|
237 | + $invoice_statuses = apply_filters( |
|
238 | + 'getpaid_register_invoice_post_statuses', |
|
239 | + array( |
|
240 | 240 | |
241 | - 'wpi-pending' => array( |
|
242 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
243 | - 'public' => true, |
|
244 | - 'exclude_from_search' => true, |
|
245 | - 'show_in_admin_all_list' => true, |
|
246 | - 'show_in_admin_status_list' => true, |
|
247 | - /* translators: %s: number of invoices */ |
|
248 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
249 | - ), |
|
241 | + 'wpi-pending' => array( |
|
242 | + 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
243 | + 'public' => true, |
|
244 | + 'exclude_from_search' => true, |
|
245 | + 'show_in_admin_all_list' => true, |
|
246 | + 'show_in_admin_status_list' => true, |
|
247 | + /* translators: %s: number of invoices */ |
|
248 | + 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
249 | + ), |
|
250 | 250 | |
251 | - 'wpi-processing' => array( |
|
252 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
253 | - 'public' => true, |
|
254 | - 'exclude_from_search' => true, |
|
255 | - 'show_in_admin_all_list' => true, |
|
256 | - 'show_in_admin_status_list' => true, |
|
257 | - /* translators: %s: number of invoices */ |
|
258 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
259 | - ), |
|
251 | + 'wpi-processing' => array( |
|
252 | + 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
253 | + 'public' => true, |
|
254 | + 'exclude_from_search' => true, |
|
255 | + 'show_in_admin_all_list' => true, |
|
256 | + 'show_in_admin_status_list' => true, |
|
257 | + /* translators: %s: number of invoices */ |
|
258 | + 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
259 | + ), |
|
260 | 260 | |
261 | - 'wpi-onhold' => array( |
|
262 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
263 | - 'public' => true, |
|
264 | - 'exclude_from_search' => true, |
|
265 | - 'show_in_admin_all_list' => true, |
|
266 | - 'show_in_admin_status_list' => true, |
|
267 | - /* translators: %s: number of invoices */ |
|
268 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
269 | - ), |
|
261 | + 'wpi-onhold' => array( |
|
262 | + 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
263 | + 'public' => true, |
|
264 | + 'exclude_from_search' => true, |
|
265 | + 'show_in_admin_all_list' => true, |
|
266 | + 'show_in_admin_status_list' => true, |
|
267 | + /* translators: %s: number of invoices */ |
|
268 | + 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
269 | + ), |
|
270 | 270 | |
271 | - 'wpi-cancelled' => array( |
|
272 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
273 | - 'public' => true, |
|
274 | - 'exclude_from_search' => true, |
|
275 | - 'show_in_admin_all_list' => true, |
|
276 | - 'show_in_admin_status_list' => true, |
|
277 | - /* translators: %s: number of invoices */ |
|
278 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
279 | - ), |
|
271 | + 'wpi-cancelled' => array( |
|
272 | + 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
273 | + 'public' => true, |
|
274 | + 'exclude_from_search' => true, |
|
275 | + 'show_in_admin_all_list' => true, |
|
276 | + 'show_in_admin_status_list' => true, |
|
277 | + /* translators: %s: number of invoices */ |
|
278 | + 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
279 | + ), |
|
280 | 280 | |
281 | - 'wpi-refunded' => array( |
|
282 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
283 | - 'public' => true, |
|
284 | - 'exclude_from_search' => true, |
|
285 | - 'show_in_admin_all_list' => true, |
|
286 | - 'show_in_admin_status_list' => true, |
|
287 | - /* translators: %s: number of invoices */ |
|
288 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
289 | - ), |
|
281 | + 'wpi-refunded' => array( |
|
282 | + 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
283 | + 'public' => true, |
|
284 | + 'exclude_from_search' => true, |
|
285 | + 'show_in_admin_all_list' => true, |
|
286 | + 'show_in_admin_status_list' => true, |
|
287 | + /* translators: %s: number of invoices */ |
|
288 | + 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
289 | + ), |
|
290 | 290 | |
291 | - 'wpi-failed' => array( |
|
292 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
293 | - 'public' => true, |
|
294 | - 'exclude_from_search' => true, |
|
295 | - 'show_in_admin_all_list' => true, |
|
296 | - 'show_in_admin_status_list' => true, |
|
297 | - /* translators: %s: number of invoices */ |
|
298 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
299 | - ), |
|
291 | + 'wpi-failed' => array( |
|
292 | + 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
293 | + 'public' => true, |
|
294 | + 'exclude_from_search' => true, |
|
295 | + 'show_in_admin_all_list' => true, |
|
296 | + 'show_in_admin_status_list' => true, |
|
297 | + /* translators: %s: number of invoices */ |
|
298 | + 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
299 | + ), |
|
300 | 300 | |
301 | - 'wpi-renewal' => array( |
|
302 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
303 | - 'public' => true, |
|
304 | - 'exclude_from_search' => true, |
|
305 | - 'show_in_admin_all_list' => true, |
|
306 | - 'show_in_admin_status_list' => true, |
|
307 | - /* translators: %s: number of invoices */ |
|
308 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
309 | - ) |
|
310 | - ) |
|
311 | - ); |
|
301 | + 'wpi-renewal' => array( |
|
302 | + 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
303 | + 'public' => true, |
|
304 | + 'exclude_from_search' => true, |
|
305 | + 'show_in_admin_all_list' => true, |
|
306 | + 'show_in_admin_status_list' => true, |
|
307 | + /* translators: %s: number of invoices */ |
|
308 | + 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
309 | + ) |
|
310 | + ) |
|
311 | + ); |
|
312 | 312 | |
313 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
314 | - register_post_status( $invoice_statuse, $args ); |
|
315 | - } |
|
316 | - } |
|
313 | + foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
314 | + register_post_status( $invoice_statuse, $args ); |
|
315 | + } |
|
316 | + } |
|
317 | 317 | |
318 | - /** |
|
319 | - * Flush rewrite rules. |
|
320 | - */ |
|
321 | - public static function flush_rewrite_rules() { |
|
322 | - flush_rewrite_rules(); |
|
323 | - } |
|
318 | + /** |
|
319 | + * Flush rewrite rules. |
|
320 | + */ |
|
321 | + public static function flush_rewrite_rules() { |
|
322 | + flush_rewrite_rules(); |
|
323 | + } |
|
324 | 324 | |
325 | - /** |
|
326 | - * Flush rules to prevent 404. |
|
327 | - * |
|
328 | - */ |
|
329 | - public static function maybe_flush_rewrite_rules() { |
|
330 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
331 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
332 | - self::flush_rewrite_rules(); |
|
333 | - } |
|
334 | - } |
|
325 | + /** |
|
326 | + * Flush rules to prevent 404. |
|
327 | + * |
|
328 | + */ |
|
329 | + public static function maybe_flush_rewrite_rules() { |
|
330 | + if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
331 | + update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
332 | + self::flush_rewrite_rules(); |
|
333 | + } |
|
334 | + } |
|
335 | 335 | |
336 | 336 | } |
@@ -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 | 'capability_type' => 'wpi_item', |
@@ -83,22 +83,22 @@ discard block |
||
83 | 83 | 'wpinv_register_post_type_payment_form', |
84 | 84 | array( |
85 | 85 | 'labels' => array( |
86 | - 'name' => _x( 'Payment Forms', 'post type general name', 'invoicing' ), |
|
87 | - 'singular_name' => _x( 'Payment Form', 'post type singular name', 'invoicing' ), |
|
88 | - 'menu_name' => _x( 'Payment Forms', 'admin menu', 'invoicing' ), |
|
89 | - 'name_admin_bar' => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ), |
|
90 | - 'add_new' => _x( 'Add New', 'Payment Form', 'invoicing' ), |
|
91 | - 'add_new_item' => __( 'Add New Payment Form', 'invoicing' ), |
|
92 | - 'new_item' => __( 'New Payment Form', 'invoicing' ), |
|
93 | - 'edit_item' => __( 'Edit Payment Form', 'invoicing' ), |
|
94 | - 'view_item' => __( 'View Payment Form', 'invoicing' ), |
|
95 | - 'all_items' => __( 'Payment Forms', 'invoicing' ), |
|
96 | - 'search_items' => __( 'Search Payment Forms', 'invoicing' ), |
|
97 | - 'parent_item_colon' => __( 'Parent Payment Forms:', 'invoicing' ), |
|
98 | - 'not_found' => __( 'No payment forms found.', 'invoicing' ), |
|
99 | - 'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' ) |
|
86 | + 'name' => _x('Payment Forms', 'post type general name', 'invoicing'), |
|
87 | + 'singular_name' => _x('Payment Form', 'post type singular name', 'invoicing'), |
|
88 | + 'menu_name' => _x('Payment Forms', 'admin menu', 'invoicing'), |
|
89 | + 'name_admin_bar' => _x('Payment Form', 'add new on admin bar', 'invoicing'), |
|
90 | + 'add_new' => _x('Add New', 'Payment Form', 'invoicing'), |
|
91 | + 'add_new_item' => __('Add New Payment Form', 'invoicing'), |
|
92 | + 'new_item' => __('New Payment Form', 'invoicing'), |
|
93 | + 'edit_item' => __('Edit Payment Form', 'invoicing'), |
|
94 | + 'view_item' => __('View Payment Form', 'invoicing'), |
|
95 | + 'all_items' => __('Payment Forms', 'invoicing'), |
|
96 | + 'search_items' => __('Search Payment Forms', 'invoicing'), |
|
97 | + 'parent_item_colon' => __('Parent Payment Forms:', 'invoicing'), |
|
98 | + 'not_found' => __('No payment forms found.', 'invoicing'), |
|
99 | + 'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing') |
|
100 | 100 | ), |
101 | - 'description' => __( 'Add new payment forms.', 'invoicing' ), |
|
101 | + 'description' => __('Add new payment forms.', 'invoicing'), |
|
102 | 102 | 'public' => false, |
103 | 103 | 'show_ui' => true, |
104 | 104 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : true, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'has_archive' => false, |
110 | 110 | 'hierarchical' => false, |
111 | 111 | 'menu_position' => null, |
112 | - 'supports' => array( 'title' ), |
|
112 | + 'supports' => array('title'), |
|
113 | 113 | 'menu_icon' => 'dashicons-media-form', |
114 | 114 | ) |
115 | 115 | ) |
@@ -122,32 +122,32 @@ discard block |
||
122 | 122 | 'wpinv_register_post_type_invoice', |
123 | 123 | array( |
124 | 124 | 'labels' => array( |
125 | - 'name' => __( 'Invoices', 'invoicing' ), |
|
126 | - 'singular_name' => __( 'Invoice', 'invoicing' ), |
|
127 | - 'all_items' => __( 'Invoices', 'invoicing' ), |
|
128 | - 'menu_name' => _x( 'Invoices', 'Admin menu name', 'invoicing' ), |
|
129 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
130 | - 'add_new_item' => __( 'Add new invoice', 'invoicing' ), |
|
131 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
132 | - 'edit_item' => __( 'Edit invoice', 'invoicing' ), |
|
133 | - 'new_item' => __( 'New invoice', 'invoicing' ), |
|
134 | - 'view_item' => __( 'View invoice', 'invoicing' ), |
|
135 | - 'view_items' => __( 'View Invoices', 'invoicing' ), |
|
136 | - 'search_items' => __( 'Search invoices', 'invoicing' ), |
|
137 | - 'not_found' => __( 'No invoices found', 'invoicing' ), |
|
138 | - 'not_found_in_trash' => __( 'No invoices found in trash', 'invoicing' ), |
|
139 | - 'parent' => __( 'Parent invoice', 'invoicing' ), |
|
140 | - 'featured_image' => __( 'Invoice image', 'invoicing' ), |
|
141 | - 'set_featured_image' => __( 'Set invoice image', 'invoicing' ), |
|
142 | - 'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ), |
|
143 | - 'use_featured_image' => __( 'Use as invoice image', 'invoicing' ), |
|
144 | - 'insert_into_item' => __( 'Insert into invoice', 'invoicing' ), |
|
145 | - 'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ), |
|
146 | - 'filter_items_list' => __( 'Filter invoices', 'invoicing' ), |
|
147 | - 'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ), |
|
148 | - 'items_list' => __( 'Invoices list', 'invoicing' ), |
|
125 | + 'name' => __('Invoices', 'invoicing'), |
|
126 | + 'singular_name' => __('Invoice', 'invoicing'), |
|
127 | + 'all_items' => __('Invoices', 'invoicing'), |
|
128 | + 'menu_name' => _x('Invoices', 'Admin menu name', 'invoicing'), |
|
129 | + 'add_new' => __('Add New', 'invoicing'), |
|
130 | + 'add_new_item' => __('Add new invoice', 'invoicing'), |
|
131 | + 'edit' => __('Edit', 'invoicing'), |
|
132 | + 'edit_item' => __('Edit invoice', 'invoicing'), |
|
133 | + 'new_item' => __('New invoice', 'invoicing'), |
|
134 | + 'view_item' => __('View invoice', 'invoicing'), |
|
135 | + 'view_items' => __('View Invoices', 'invoicing'), |
|
136 | + 'search_items' => __('Search invoices', 'invoicing'), |
|
137 | + 'not_found' => __('No invoices found', 'invoicing'), |
|
138 | + 'not_found_in_trash' => __('No invoices found in trash', 'invoicing'), |
|
139 | + 'parent' => __('Parent invoice', 'invoicing'), |
|
140 | + 'featured_image' => __('Invoice image', 'invoicing'), |
|
141 | + 'set_featured_image' => __('Set invoice image', 'invoicing'), |
|
142 | + 'remove_featured_image' => __('Remove invoice image', 'invoicing'), |
|
143 | + 'use_featured_image' => __('Use as invoice image', 'invoicing'), |
|
144 | + 'insert_into_item' => __('Insert into invoice', 'invoicing'), |
|
145 | + 'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'), |
|
146 | + 'filter_items_list' => __('Filter invoices', 'invoicing'), |
|
147 | + 'items_list_navigation' => __('Invoices navigation', 'invoicing'), |
|
148 | + 'items_list' => __('Invoices list', 'invoicing'), |
|
149 | 149 | ), |
150 | - 'description' => __( 'This is where invoices are stored.', 'invoicing' ), |
|
150 | + 'description' => __('This is where invoices are stored.', 'invoicing'), |
|
151 | 151 | 'public' => true, |
152 | 152 | 'has_archive' => false, |
153 | 153 | 'publicly_queryable' => true, |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'show_ui' => true, |
156 | 156 | 'show_in_menu' => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false, |
157 | 157 | 'show_in_nav_menus' => false, |
158 | - 'supports' => array( 'title', 'author', 'excerpt' ), |
|
158 | + 'supports' => array('title', 'author', 'excerpt'), |
|
159 | 159 | 'rewrite' => array( |
160 | 160 | 'slug' => 'invoice', |
161 | 161 | 'with_front' => false, |
@@ -179,32 +179,32 @@ discard block |
||
179 | 179 | 'wpinv_register_post_type_discount', |
180 | 180 | array( |
181 | 181 | 'labels' => array( |
182 | - 'name' => __( 'Discounts', 'invoicing' ), |
|
183 | - 'singular_name' => __( 'Discount', 'invoicing' ), |
|
184 | - 'all_items' => __( 'Discounts', 'invoicing' ), |
|
185 | - 'menu_name' => _x( 'Discounts', 'Admin menu name', 'invoicing' ), |
|
186 | - 'add_new' => __( 'Add New', 'invoicing' ), |
|
187 | - 'add_new_item' => __( 'Add new discount', 'invoicing' ), |
|
188 | - 'edit' => __( 'Edit', 'invoicing' ), |
|
189 | - 'edit_item' => __( 'Edit discount', 'invoicing' ), |
|
190 | - 'new_item' => __( 'New discount', 'invoicing' ), |
|
191 | - 'view_item' => __( 'View discount', 'invoicing' ), |
|
192 | - 'view_items' => __( 'View Discounts', 'invoicing' ), |
|
193 | - 'search_items' => __( 'Search discounts', 'invoicing' ), |
|
194 | - 'not_found' => __( 'No discounts found', 'invoicing' ), |
|
195 | - 'not_found_in_trash' => __( 'No discounts found in trash', 'invoicing' ), |
|
196 | - 'parent' => __( 'Parent discount', 'invoicing' ), |
|
197 | - 'featured_image' => __( 'Discount image', 'invoicing' ), |
|
198 | - 'set_featured_image' => __( 'Set discount image', 'invoicing' ), |
|
199 | - 'remove_featured_image' => __( 'Remove discount image', 'invoicing' ), |
|
200 | - 'use_featured_image' => __( 'Use as discount image', 'invoicing' ), |
|
201 | - 'insert_into_item' => __( 'Insert into discount', 'invoicing' ), |
|
202 | - 'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ), |
|
203 | - 'filter_items_list' => __( 'Filter discounts', 'invoicing' ), |
|
204 | - 'items_list_navigation' => __( 'Discount navigation', 'invoicing' ), |
|
205 | - 'items_list' => __( 'Discounts list', 'invoicing' ), |
|
182 | + 'name' => __('Discounts', 'invoicing'), |
|
183 | + 'singular_name' => __('Discount', 'invoicing'), |
|
184 | + 'all_items' => __('Discounts', 'invoicing'), |
|
185 | + 'menu_name' => _x('Discounts', 'Admin menu name', 'invoicing'), |
|
186 | + 'add_new' => __('Add New', 'invoicing'), |
|
187 | + 'add_new_item' => __('Add new discount', 'invoicing'), |
|
188 | + 'edit' => __('Edit', 'invoicing'), |
|
189 | + 'edit_item' => __('Edit discount', 'invoicing'), |
|
190 | + 'new_item' => __('New discount', 'invoicing'), |
|
191 | + 'view_item' => __('View discount', 'invoicing'), |
|
192 | + 'view_items' => __('View Discounts', 'invoicing'), |
|
193 | + 'search_items' => __('Search discounts', 'invoicing'), |
|
194 | + 'not_found' => __('No discounts found', 'invoicing'), |
|
195 | + 'not_found_in_trash' => __('No discounts found in trash', 'invoicing'), |
|
196 | + 'parent' => __('Parent discount', 'invoicing'), |
|
197 | + 'featured_image' => __('Discount image', 'invoicing'), |
|
198 | + 'set_featured_image' => __('Set discount image', 'invoicing'), |
|
199 | + 'remove_featured_image' => __('Remove discount image', 'invoicing'), |
|
200 | + 'use_featured_image' => __('Use as discount image', 'invoicing'), |
|
201 | + 'insert_into_item' => __('Insert into discount', 'invoicing'), |
|
202 | + 'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'), |
|
203 | + 'filter_items_list' => __('Filter discounts', 'invoicing'), |
|
204 | + 'items_list_navigation' => __('Discount navigation', 'invoicing'), |
|
205 | + 'items_list' => __('Discounts list', 'invoicing'), |
|
206 | 206 | ), |
207 | - 'description' => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ), |
|
207 | + 'description' => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'), |
|
208 | 208 | 'public' => false, |
209 | 209 | 'can_export' => true, |
210 | 210 | '_builtin' => false, |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | 'map_meta_cap' => true, |
219 | 219 | 'has_archive' => false, |
220 | 220 | 'hierarchical' => false, |
221 | - 'supports' => array( 'title', 'excerpt' ), |
|
221 | + 'supports' => array('title', 'excerpt'), |
|
222 | 222 | 'show_in_nav_menus' => false, |
223 | 223 | 'show_in_admin_bar' => true, |
224 | 224 | 'menu_position' => null, |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | ) |
227 | 227 | ); |
228 | 228 | |
229 | - do_action( 'getpaid_after_register_post_types' ); |
|
229 | + do_action('getpaid_after_register_post_types'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -239,79 +239,79 @@ discard block |
||
239 | 239 | array( |
240 | 240 | |
241 | 241 | 'wpi-pending' => array( |
242 | - 'label' => _x( 'Pending Payment', 'Invoice status', 'invoicing' ), |
|
242 | + 'label' => _x('Pending Payment', 'Invoice status', 'invoicing'), |
|
243 | 243 | 'public' => true, |
244 | 244 | 'exclude_from_search' => true, |
245 | 245 | 'show_in_admin_all_list' => true, |
246 | 246 | 'show_in_admin_status_list' => true, |
247 | 247 | /* translators: %s: number of invoices */ |
248 | - 'label_count' => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' ) |
|
248 | + 'label_count' => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing') |
|
249 | 249 | ), |
250 | 250 | |
251 | 251 | 'wpi-processing' => array( |
252 | - 'label' => _x( 'Processing', 'Invoice status', 'invoicing' ), |
|
252 | + 'label' => _x('Processing', 'Invoice status', 'invoicing'), |
|
253 | 253 | 'public' => true, |
254 | 254 | 'exclude_from_search' => true, |
255 | 255 | 'show_in_admin_all_list' => true, |
256 | 256 | 'show_in_admin_status_list' => true, |
257 | 257 | /* translators: %s: number of invoices */ |
258 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' ) |
|
258 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing') |
|
259 | 259 | ), |
260 | 260 | |
261 | 261 | 'wpi-onhold' => array( |
262 | - 'label' => _x( 'On Hold', 'Invoice status', 'invoicing' ), |
|
262 | + 'label' => _x('On Hold', 'Invoice status', 'invoicing'), |
|
263 | 263 | 'public' => true, |
264 | 264 | 'exclude_from_search' => true, |
265 | 265 | 'show_in_admin_all_list' => true, |
266 | 266 | 'show_in_admin_status_list' => true, |
267 | 267 | /* translators: %s: number of invoices */ |
268 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' ) |
|
268 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing') |
|
269 | 269 | ), |
270 | 270 | |
271 | 271 | 'wpi-cancelled' => array( |
272 | - 'label' => _x( 'Cancelled', 'Invoice status', 'invoicing' ), |
|
272 | + 'label' => _x('Cancelled', 'Invoice status', 'invoicing'), |
|
273 | 273 | 'public' => true, |
274 | 274 | 'exclude_from_search' => true, |
275 | 275 | 'show_in_admin_all_list' => true, |
276 | 276 | 'show_in_admin_status_list' => true, |
277 | 277 | /* translators: %s: number of invoices */ |
278 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' ) |
|
278 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing') |
|
279 | 279 | ), |
280 | 280 | |
281 | 281 | 'wpi-refunded' => array( |
282 | - 'label' => _x( 'Refunded', 'Invoice status', 'invoicing' ), |
|
282 | + 'label' => _x('Refunded', 'Invoice status', 'invoicing'), |
|
283 | 283 | 'public' => true, |
284 | 284 | 'exclude_from_search' => true, |
285 | 285 | 'show_in_admin_all_list' => true, |
286 | 286 | 'show_in_admin_status_list' => true, |
287 | 287 | /* translators: %s: number of invoices */ |
288 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' ) |
|
288 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing') |
|
289 | 289 | ), |
290 | 290 | |
291 | 291 | 'wpi-failed' => array( |
292 | - 'label' => _x( 'Failed', 'Invoice status', 'invoicing' ), |
|
292 | + 'label' => _x('Failed', 'Invoice status', 'invoicing'), |
|
293 | 293 | 'public' => true, |
294 | 294 | 'exclude_from_search' => true, |
295 | 295 | 'show_in_admin_all_list' => true, |
296 | 296 | 'show_in_admin_status_list' => true, |
297 | 297 | /* translators: %s: number of invoices */ |
298 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' ) |
|
298 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing') |
|
299 | 299 | ), |
300 | 300 | |
301 | 301 | 'wpi-renewal' => array( |
302 | - 'label' => _x( 'Renewal', 'Invoice status', 'invoicing' ), |
|
302 | + 'label' => _x('Renewal', 'Invoice status', 'invoicing'), |
|
303 | 303 | 'public' => true, |
304 | 304 | 'exclude_from_search' => true, |
305 | 305 | 'show_in_admin_all_list' => true, |
306 | 306 | 'show_in_admin_status_list' => true, |
307 | 307 | /* translators: %s: number of invoices */ |
308 | - 'label_count' => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' ) |
|
308 | + 'label_count' => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing') |
|
309 | 309 | ) |
310 | 310 | ) |
311 | 311 | ); |
312 | 312 | |
313 | - foreach ( $invoice_statuses as $invoice_statuse => $args ) { |
|
314 | - register_post_status( $invoice_statuse, $args ); |
|
313 | + foreach ($invoice_statuses as $invoice_statuse => $args) { |
|
314 | + register_post_status($invoice_statuse, $args); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * |
328 | 328 | */ |
329 | 329 | public static function maybe_flush_rewrite_rules() { |
330 | - if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) { |
|
331 | - update_option( 'getpaid_flushed_rewrite_rules', '1' ); |
|
330 | + if (!get_option('getpaid_flushed_rewrite_rules')) { |
|
331 | + update_option('getpaid_flushed_rewrite_rules', '1'); |
|
332 | 332 | self::flush_rewrite_rules(); |
333 | 333 | } |
334 | 334 | } |