Passed
Push — master ( 3a0618...5aee45 )
by Stiofan
05:13
created
includes/class-getpaid-post-types.php 1 patch
Indentation   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -15,331 +15,331 @@
 block discarded – undo
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
-		$capabilities = wpinv_current_user_can_manage_invoicing();
36
+        $capabilities = wpinv_current_user_can_manage_invoicing();
37 37
 
38
-		// Fires before registering post types.
39
-		do_action( 'getpaid_register_post_types' );
38
+        // Fires before registering post types.
39
+        do_action( 'getpaid_register_post_types' );
40 40
 
41
-		// Register item post type.
42
-		register_post_type(
43
-			'wpi_item',
44
-			apply_filters(
45
-				'wpinv_register_post_type_invoice_item',
46
-				array(
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' )
62
-					),
63
-					'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
64
-					'public'                => false,
65
-					'has_archive'           => false,
66
-					'_builtin'              => false,
67
-					'show_ui'               => true,
68
-					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69
-					'show_in_nav_menus'     => false,
70
-					'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
71
-					'rewrite'               => false,
72
-					'query_var'             => false,
73
-					'map_meta_cap'          => true,
74
-					'show_in_admin_bar'     => true,
75
-					'can_export'            => true,
76
-				)
77
-			)
78
-		);
41
+        // Register item post type.
42
+        register_post_type(
43
+            'wpi_item',
44
+            apply_filters(
45
+                'wpinv_register_post_type_invoice_item',
46
+                array(
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' )
62
+                    ),
63
+                    'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
64
+                    'public'                => false,
65
+                    'has_archive'           => false,
66
+                    '_builtin'              => false,
67
+                    'show_ui'               => true,
68
+                    'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69
+                    'show_in_nav_menus'     => false,
70
+                    'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
71
+                    'rewrite'               => false,
72
+                    'query_var'             => false,
73
+                    'map_meta_cap'          => true,
74
+                    'show_in_admin_bar'     => true,
75
+                    'can_export'            => true,
76
+                )
77
+            )
78
+        );
79 79
 
80
-		// Register payment form post type.
81
-		register_post_type(
82
-			'wpi_payment_form',
83
-			apply_filters(
84
-				'wpinv_register_post_type_payment_form',
85
-				array(
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' )
101
-					),
102
-					'description'        => __( 'Add new payment forms.', 'invoicing' ),
103
-					'public'             => false,
104
-					'show_ui'            => true,
105
-					'show_in_menu'       => $capabilities ? 'wpinv' : true,
106
-					'show_in_nav_menus'  => false,
107
-					'query_var'          => false,
108
-					'rewrite'            => true,
109
-					'map_meta_cap'       => true,
110
-					'has_archive'        => false,
111
-					'hierarchical'       => false,
112
-					'menu_position'      => null,
113
-					'supports'           => array( 'title' ),
114
-					'menu_icon'          => 'dashicons-media-form',
115
-					'capabilities' => array(
116
-						'edit_post'          => $capabilities,
117
-						'read_post'          => $capabilities,
118
-						'delete_post'        => $capabilities,
119
-						'edit_posts'         => 'update_core',
120
-						'edit_others_posts'  => 'update_core',
121
-						'delete_posts'       => 'update_core',
122
-						'publish_posts'      => 'update_core',
123
-						'read_private_posts' => 'update_core'
124
-					),
125
-				)
126
-			)
127
-		);
80
+        // Register payment form post type.
81
+        register_post_type(
82
+            'wpi_payment_form',
83
+            apply_filters(
84
+                'wpinv_register_post_type_payment_form',
85
+                array(
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' )
101
+                    ),
102
+                    'description'        => __( 'Add new payment forms.', 'invoicing' ),
103
+                    'public'             => false,
104
+                    'show_ui'            => true,
105
+                    'show_in_menu'       => $capabilities ? 'wpinv' : true,
106
+                    'show_in_nav_menus'  => false,
107
+                    'query_var'          => false,
108
+                    'rewrite'            => true,
109
+                    'map_meta_cap'       => true,
110
+                    'has_archive'        => false,
111
+                    'hierarchical'       => false,
112
+                    'menu_position'      => null,
113
+                    'supports'           => array( 'title' ),
114
+                    'menu_icon'          => 'dashicons-media-form',
115
+                    'capabilities' => array(
116
+                        'edit_post'          => $capabilities,
117
+                        'read_post'          => $capabilities,
118
+                        'delete_post'        => $capabilities,
119
+                        'edit_posts'         => 'update_core',
120
+                        'edit_others_posts'  => 'update_core',
121
+                        'delete_posts'       => 'update_core',
122
+                        'publish_posts'      => 'update_core',
123
+                        'read_private_posts' => 'update_core'
124
+                    ),
125
+                )
126
+            )
127
+        );
128 128
 
129
-		// Register invoice post type.
130
-		register_post_type(
131
-			'wpi_invoice',
132
-			apply_filters(
133
-				'wpinv_register_post_type_invoice',
134
-				array(
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' ),
160
-					),
161
-					'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
162
-					'public'                => true,
163
-					'has_archive'           => false,
164
-					'publicly_queryable'    => true,
165
-        			'exclude_from_search'   => true,
166
-        			'show_ui'               => true,
167
-					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
168
-					'show_in_nav_menus'     => false,
169
-					'supports'              => array( 'title', 'author', 'excerpt'  ),
170
-					'rewrite'               => array(
171
-						'slug'              => 'invoice',
172
-						'with_front'        => false,
173
-					),
174
-					'query_var'             => false,
175
-					'map_meta_cap'          => true,
176
-					'show_in_admin_bar'     => true,
177
-					'can_export'            => true,
178
-					'hierarchical'          => false,
179
-					'menu_position'         => null,
180
-					'menu_icon'             => 'dashicons-media-spreadsheet',
181
-				)
182
-			)
183
-		);
129
+        // Register invoice post type.
130
+        register_post_type(
131
+            'wpi_invoice',
132
+            apply_filters(
133
+                'wpinv_register_post_type_invoice',
134
+                array(
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' ),
160
+                    ),
161
+                    'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
162
+                    'public'                => true,
163
+                    'has_archive'           => false,
164
+                    'publicly_queryable'    => true,
165
+                    'exclude_from_search'   => true,
166
+                    'show_ui'               => true,
167
+                    'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
168
+                    'show_in_nav_menus'     => false,
169
+                    'supports'              => array( 'title', 'author', 'excerpt'  ),
170
+                    'rewrite'               => array(
171
+                        'slug'              => 'invoice',
172
+                        'with_front'        => false,
173
+                    ),
174
+                    'query_var'             => false,
175
+                    'map_meta_cap'          => true,
176
+                    'show_in_admin_bar'     => true,
177
+                    'can_export'            => true,
178
+                    'hierarchical'          => false,
179
+                    'menu_position'         => null,
180
+                    'menu_icon'             => 'dashicons-media-spreadsheet',
181
+                )
182
+            )
183
+        );
184 184
 
185
-		// Register discount post type.
186
-		register_post_type(
187
-			'wpi_discount',
188
-			apply_filters(
189
-				'wpinv_register_post_type_discount',
190
-				array(
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' ),
216
-					),
217
-					'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
218
-					'public'             => false,
219
-					'can_export'         => true,
220
-					'_builtin'           => false,
221
-					'publicly_queryable' => false,
222
-					'exclude_from_search'=> true,
223
-					'show_ui'            => true,
224
-					'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
225
-					'query_var'          => false,
226
-					'rewrite'            => false,
227
-					'map_meta_cap'       => true,
228
-					'has_archive'        => false,
229
-					'hierarchical'       => false,
230
-					'supports'           => array( 'title', 'excerpt' ),
231
-					'show_in_nav_menus'  => false,
232
-					'show_in_admin_bar'  => true,
233
-					'menu_position'      => null,
234
-				)
235
-			)
236
-		);
185
+        // Register discount post type.
186
+        register_post_type(
187
+            'wpi_discount',
188
+            apply_filters(
189
+                'wpinv_register_post_type_discount',
190
+                array(
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' ),
216
+                    ),
217
+                    'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
218
+                    'public'             => false,
219
+                    'can_export'         => true,
220
+                    '_builtin'           => false,
221
+                    'publicly_queryable' => false,
222
+                    'exclude_from_search'=> true,
223
+                    'show_ui'            => true,
224
+                    'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
225
+                    'query_var'          => false,
226
+                    'rewrite'            => false,
227
+                    'map_meta_cap'       => true,
228
+                    'has_archive'        => false,
229
+                    'hierarchical'       => false,
230
+                    'supports'           => array( 'title', 'excerpt' ),
231
+                    'show_in_nav_menus'  => false,
232
+                    'show_in_admin_bar'  => true,
233
+                    'menu_position'      => null,
234
+                )
235
+            )
236
+        );
237 237
 
238
-		do_action( 'getpaid_after_register_post_types' );
239
-	}
238
+        do_action( 'getpaid_after_register_post_types' );
239
+    }
240 240
 
241
-	/**
242
-	 * Register our custom post statuses.
243
-	 */
244
-	public static function register_post_status() {
241
+    /**
242
+     * Register our custom post statuses.
243
+     */
244
+    public static function register_post_status() {
245 245
 
246
-		$invoice_statuses = apply_filters(
247
-			'getpaid_register_invoice_post_statuses',
248
-			array(
246
+        $invoice_statuses = apply_filters(
247
+            'getpaid_register_invoice_post_statuses',
248
+            array(
249 249
 
250
-				'wpi-pending' => array(
251
-					'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
252
-        			'public'                    => true,
253
-        			'exclude_from_search'       => true,
254
-        			'show_in_admin_all_list'    => true,
255
-					'show_in_admin_status_list' => true,
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' )
258
-				),
250
+                'wpi-pending' => array(
251
+                    'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
252
+                    'public'                    => true,
253
+                    'exclude_from_search'       => true,
254
+                    'show_in_admin_all_list'    => true,
255
+                    'show_in_admin_status_list' => true,
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' )
258
+                ),
259 259
 
260
-				'wpi-processing' => array(
261
-					'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
262
-        			'public'                    => true,
263
-        			'exclude_from_search'       => true,
264
-        			'show_in_admin_all_list'    => true,
265
-					'show_in_admin_status_list' => true,
266
-					/* translators: %s: number of invoices */
267
-        			'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
268
-				),
260
+                'wpi-processing' => array(
261
+                    'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
262
+                    'public'                    => true,
263
+                    'exclude_from_search'       => true,
264
+                    'show_in_admin_all_list'    => true,
265
+                    'show_in_admin_status_list' => true,
266
+                    /* translators: %s: number of invoices */
267
+                    'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
268
+                ),
269 269
 
270
-				'wpi-onhold' => array(
271
-					'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
272
-        			'public'                    => true,
273
-        			'exclude_from_search'       => true,
274
-        			'show_in_admin_all_list'    => true,
275
-					'show_in_admin_status_list' => true,
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' )
278
-				),
270
+                'wpi-onhold' => array(
271
+                    'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
272
+                    'public'                    => true,
273
+                    'exclude_from_search'       => true,
274
+                    'show_in_admin_all_list'    => true,
275
+                    'show_in_admin_status_list' => true,
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' )
278
+                ),
279 279
 
280
-				'wpi-cancelled' => array(
281
-					'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
282
-        			'public'                    => true,
283
-        			'exclude_from_search'       => true,
284
-        			'show_in_admin_all_list'    => true,
285
-					'show_in_admin_status_list' => true,
286
-					/* translators: %s: number of invoices */
287
-        			'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
288
-				),
280
+                'wpi-cancelled' => array(
281
+                    'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
282
+                    'public'                    => true,
283
+                    'exclude_from_search'       => true,
284
+                    'show_in_admin_all_list'    => true,
285
+                    'show_in_admin_status_list' => true,
286
+                    /* translators: %s: number of invoices */
287
+                    'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
288
+                ),
289 289
 
290
-				'wpi-refunded' => array(
291
-					'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
292
-        			'public'                    => true,
293
-        			'exclude_from_search'       => true,
294
-        			'show_in_admin_all_list'    => true,
295
-					'show_in_admin_status_list' => true,
296
-					/* translators: %s: number of invoices */
297
-        			'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
298
-				),
290
+                'wpi-refunded' => array(
291
+                    'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
292
+                    'public'                    => true,
293
+                    'exclude_from_search'       => true,
294
+                    'show_in_admin_all_list'    => true,
295
+                    'show_in_admin_status_list' => true,
296
+                    /* translators: %s: number of invoices */
297
+                    'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
298
+                ),
299 299
 
300
-				'wpi-failed' => array(
301
-					'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
302
-        			'public'                    => true,
303
-        			'exclude_from_search'       => true,
304
-        			'show_in_admin_all_list'    => true,
305
-					'show_in_admin_status_list' => true,
306
-					/* translators: %s: number of invoices */
307
-        			'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
308
-				),
300
+                'wpi-failed' => array(
301
+                    'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
302
+                    'public'                    => true,
303
+                    'exclude_from_search'       => true,
304
+                    'show_in_admin_all_list'    => true,
305
+                    'show_in_admin_status_list' => true,
306
+                    /* translators: %s: number of invoices */
307
+                    'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
308
+                ),
309 309
 
310
-				'wpi-renewal' => array(
311
-					'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
312
-        			'public'                    => true,
313
-        			'exclude_from_search'       => true,
314
-        			'show_in_admin_all_list'    => true,
315
-					'show_in_admin_status_list' => true,
316
-					/* translators: %s: number of invoices */
317
-        			'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
318
-				)
319
-			)
320
-		);
310
+                'wpi-renewal' => array(
311
+                    'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
312
+                    'public'                    => true,
313
+                    'exclude_from_search'       => true,
314
+                    'show_in_admin_all_list'    => true,
315
+                    'show_in_admin_status_list' => true,
316
+                    /* translators: %s: number of invoices */
317
+                    'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
318
+                )
319
+            )
320
+        );
321 321
 
322
-		foreach ( $invoice_statuses as $invoice_statuse => $args ) {
323
-			register_post_status( $invoice_statuse, $args );
324
-		}
325
-	}
322
+        foreach ( $invoice_statuses as $invoice_statuse => $args ) {
323
+            register_post_status( $invoice_statuse, $args );
324
+        }
325
+    }
326 326
 
327
-	/**
328
-	 * Flush rewrite rules.
329
-	 */
330
-	public static function flush_rewrite_rules() {
331
-		flush_rewrite_rules();
332
-	}
327
+    /**
328
+     * Flush rewrite rules.
329
+     */
330
+    public static function flush_rewrite_rules() {
331
+        flush_rewrite_rules();
332
+    }
333 333
 
334
-	/**
335
-	 * Flush rules to prevent 404.
336
-	 *
337
-	 */
338
-	public static function maybe_flush_rewrite_rules() {
339
-		if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
340
-			update_option( 'getpaid_flushed_rewrite_rules', '1' );
341
-			self::flush_rewrite_rules();
342
-		}
343
-	}
334
+    /**
335
+     * Flush rules to prevent 404.
336
+     *
337
+     */
338
+    public static function maybe_flush_rewrite_rules() {
339
+        if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
340
+            update_option( 'getpaid_flushed_rewrite_rules', '1' );
341
+            self::flush_rewrite_rules();
342
+        }
343
+    }
344 344
 
345 345
 }
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form.php 1 patch
Indentation   +536 added lines, -536 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 /**
@@ -10,55 +10,55 @@  discard block
 block discarded – undo
10 10
 class GetPaid_Payment_Form extends GetPaid_Data {
11 11
 
12 12
     /**
13
-	 * Which data store to load.
14
-	 *
15
-	 * @var string
16
-	 */
13
+     * Which data store to load.
14
+     *
15
+     * @var string
16
+     */
17 17
     protected $data_store_name = 'payment_form';
18 18
 
19 19
     /**
20
-	 * This is the name of this object type.
21
-	 *
22
-	 * @var string
23
-	 */
24
-	protected $object_type = 'payment_form';
20
+     * This is the name of this object type.
21
+     *
22
+     * @var string
23
+     */
24
+    protected $object_type = 'payment_form';
25 25
 
26 26
     /**
27
-	 * Form Data array. This is the core form data exposed in APIs.
28
-	 *
29
-	 * @since 1.0.19
30
-	 * @var array
31
-	 */
32
-	protected $data = array(
33
-		'status'               => 'draft',
34
-		'version'              => '',
35
-		'date_created'         => null,
27
+     * Form Data array. This is the core form data exposed in APIs.
28
+     *
29
+     * @since 1.0.19
30
+     * @var array
31
+     */
32
+    protected $data = array(
33
+        'status'               => 'draft',
34
+        'version'              => '',
35
+        'date_created'         => null,
36 36
         'date_modified'        => null,
37 37
         'name'                 => '',
38 38
         'author'               => 1,
39 39
         'elements'             => null,
40
-		'items'                => null,
41
-		'earned'               => 0,
42
-		'refunded'             => 0,
43
-		'cancelled'            => 0,
44
-		'failed'               => 0,
45
-	);
46
-
47
-    /**
48
-	 * Stores meta in cache for future reads.
49
-	 *
50
-	 * A group must be set to to enable caching.
51
-	 *
52
-	 * @var string
53
-	 */
54
-	protected $cache_group = 'getpaid_forms';
55
-
56
-	/**
57
-	 * Stores a reference to the invoice if the form is for an invoice..
58
-	 *
59
-	 * @var WPInv_Invoice
60
-	 */
61
-	public $invoice = 0;
40
+        'items'                => null,
41
+        'earned'               => 0,
42
+        'refunded'             => 0,
43
+        'cancelled'            => 0,
44
+        'failed'               => 0,
45
+    );
46
+
47
+    /**
48
+     * Stores meta in cache for future reads.
49
+     *
50
+     * A group must be set to to enable caching.
51
+     *
52
+     * @var string
53
+     */
54
+    protected $cache_group = 'getpaid_forms';
55
+
56
+    /**
57
+     * Stores a reference to the invoice if the form is for an invoice..
58
+     *
59
+     * @var WPInv_Invoice
60
+     */
61
+    public $invoice = 0;
62 62
 
63 63
     /**
64 64
      * Stores a reference to the original WP_Post object
@@ -68,35 +68,35 @@  discard block
 block discarded – undo
68 68
     protected $post = null;
69 69
 
70 70
     /**
71
-	 * Get the form if ID is passed, otherwise the form is new and empty.
72
-	 *
73
-	 * @param  int|object|GetPaid_Payment_Form|WP_Post $form Form to read.
74
-	 */
75
-	public function __construct( $form = 0 ) {
76
-		parent::__construct( $form );
71
+     * Get the form if ID is passed, otherwise the form is new and empty.
72
+     *
73
+     * @param  int|object|GetPaid_Payment_Form|WP_Post $form Form to read.
74
+     */
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() );
83
-			$this->invoice = $form->invoice;
82
+            $this->set_id( $form->get_id() );
83
+            $this->invoice = $form->invoice;
84 84
 
85
-		} elseif ( ! empty( $form->ID ) ) {
86
-			$this->set_id( $form->ID );
87
-		} else {
88
-			$this->set_object_read( true );
89
-		}
85
+        } elseif ( ! empty( $form->ID ) ) {
86
+            $this->set_id( $form->ID );
87
+        } else {
88
+            $this->set_object_read( true );
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 ) {
94
+        if ( $this->get_id() > 0 ) {
95 95
             $this->post = get_post( $this->get_id() );
96
-			$this->data_store->read( $this );
96
+            $this->data_store->read( $this );
97 97
         }
98 98
 
99
-	}
99
+    }
100 100
 
101 101
     /*
102 102
 	|--------------------------------------------------------------------------
@@ -114,358 +114,358 @@  discard block
 block discarded – undo
114 114
     */
115 115
 
116 116
     /**
117
-	 * Get plugin version when the form was created.
118
-	 *
119
-	 * @since 1.0.19
120
-	 * @param  string $context View or edit context.
121
-	 * @return string
122
-	 */
123
-	public function get_version( $context = 'view' ) {
124
-		return $this->get_prop( 'version', $context );
117
+     * Get plugin version when the form was created.
118
+     *
119
+     * @since 1.0.19
120
+     * @param  string $context View or edit context.
121
+     * @return string
122
+     */
123
+    public function get_version( $context = 'view' ) {
124
+        return $this->get_prop( 'version', $context );
125 125
     }
126 126
 
127 127
     /**
128
-	 * Get date when the form was created.
129
-	 *
130
-	 * @since 1.0.19
131
-	 * @param  string $context View or edit context.
132
-	 * @return string
133
-	 */
134
-	public function get_date_created( $context = 'view' ) {
135
-		return $this->get_prop( 'date_created', $context );
128
+     * Get date when the form was created.
129
+     *
130
+     * @since 1.0.19
131
+     * @param  string $context View or edit context.
132
+     * @return string
133
+     */
134
+    public function get_date_created( $context = 'view' ) {
135
+        return $this->get_prop( 'date_created', $context );
136 136
     }
137 137
 
138 138
     /**
139
-	 * Get GMT date when the form was created.
140
-	 *
141
-	 * @since 1.0.19
142
-	 * @param  string $context View or edit context.
143
-	 * @return string
144
-	 */
145
-	public function get_date_created_gmt( $context = 'view' ) {
139
+     * Get GMT date when the form was created.
140
+     *
141
+     * @since 1.0.19
142
+     * @param  string $context View or edit context.
143
+     * @return string
144
+     */
145
+    public function get_date_created_gmt( $context = 'view' ) {
146 146
         $date = $this->get_date_created( $context );
147 147
 
148 148
         if ( $date ) {
149 149
             $date = get_gmt_from_date( $date );
150 150
         }
151
-		return $date;
151
+        return $date;
152 152
     }
153 153
 
154 154
     /**
155
-	 * Get date when the form was last modified.
156
-	 *
157
-	 * @since 1.0.19
158
-	 * @param  string $context View or edit context.
159
-	 * @return string
160
-	 */
161
-	public function get_date_modified( $context = 'view' ) {
162
-		return $this->get_prop( 'date_modified', $context );
155
+     * Get date when the form was last modified.
156
+     *
157
+     * @since 1.0.19
158
+     * @param  string $context View or edit context.
159
+     * @return string
160
+     */
161
+    public function get_date_modified( $context = 'view' ) {
162
+        return $this->get_prop( 'date_modified', $context );
163 163
     }
164 164
 
165 165
     /**
166
-	 * Get GMT date when the form was last modified.
167
-	 *
168
-	 * @since 1.0.19
169
-	 * @param  string $context View or edit context.
170
-	 * @return string
171
-	 */
172
-	public function get_date_modified_gmt( $context = 'view' ) {
166
+     * Get GMT date when the form was last modified.
167
+     *
168
+     * @since 1.0.19
169
+     * @param  string $context View or edit context.
170
+     * @return string
171
+     */
172
+    public function get_date_modified_gmt( $context = 'view' ) {
173 173
         $date = $this->get_date_modified( $context );
174 174
 
175 175
         if ( $date ) {
176 176
             $date = get_gmt_from_date( $date );
177 177
         }
178
-		return $date;
178
+        return $date;
179 179
     }
180 180
 
181 181
     /**
182
-	 * Get the form name.
183
-	 *
184
-	 * @since 1.0.19
185
-	 * @param  string $context View or edit context.
186
-	 * @return string
187
-	 */
188
-	public function get_name( $context = 'view' ) {
189
-		return $this->get_prop( 'name', $context );
182
+     * Get the form name.
183
+     *
184
+     * @since 1.0.19
185
+     * @param  string $context View or edit context.
186
+     * @return string
187
+     */
188
+    public function get_name( $context = 'view' ) {
189
+        return $this->get_prop( 'name', $context );
190 190
     }
191 191
 
192 192
     /**
193
-	 * Alias of self::get_name().
194
-	 *
195
-	 * @since 1.0.19
196
-	 * @param  string $context View or edit context.
197
-	 * @return string
198
-	 */
199
-	public function get_title( $context = 'view' ) {
200
-		return $this->get_name( $context );
201
-	}
193
+     * Alias of self::get_name().
194
+     *
195
+     * @since 1.0.19
196
+     * @param  string $context View or edit context.
197
+     * @return string
198
+     */
199
+    public function get_title( $context = 'view' ) {
200
+        return $this->get_name( $context );
201
+    }
202 202
 
203 203
     /**
204
-	 * Get the owner of the form.
205
-	 *
206
-	 * @since 1.0.19
207
-	 * @param  string $context View or edit context.
208
-	 * @return int
209
-	 */
210
-	public function get_author( $context = 'view' ) {
211
-		return (int) $this->get_prop( 'author', $context );
204
+     * Get the owner of the form.
205
+     *
206
+     * @since 1.0.19
207
+     * @param  string $context View or edit context.
208
+     * @return int
209
+     */
210
+    public function get_author( $context = 'view' ) {
211
+        return (int) $this->get_prop( 'author', $context );
212 212
     }
213 213
 
214 214
     /**
215
-	 * Get the elements that make up the form.
216
-	 *
217
-	 * @since 1.0.19
218
-	 * @param  string $context View or edit context.
219
-	 * @return array
220
-	 */
221
-	public function get_elements( $context = 'view' ) {
222
-		$elements = $this->get_prop( 'elements', $context );
215
+     * Get the elements that make up the form.
216
+     *
217
+     * @since 1.0.19
218
+     * @param  string $context View or edit context.
219
+     * @return array
220
+     */
221
+    public function get_elements( $context = 'view' ) {
222
+        $elements = $this->get_prop( 'elements', $context );
223 223
 
224
-		if ( empty( $elements ) || ! is_array( $elements ) ) {
224
+        if ( empty( $elements ) || ! is_array( $elements ) ) {
225 225
             return wpinv_get_data( 'sample-payment-form' );
226
-		}
226
+        }
227 227
 
228
-		// Ensure that all required elements exist.
229
-		$_elements = array();
230
-		foreach ( $elements as $element ) {
228
+        // Ensure that all required elements exist.
229
+        $_elements = array();
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
-				$_elements[] = array(
235
-					'text'        => __( 'Select Payment Method', 'invoicing' ),
236
-					'id'          => 'gtscicd',
237
-					'name'        => 'gtscicd',
238
-					'type'        => 'gateway_select',
239
-					'premade'     => true
234
+                $_elements[] = array(
235
+                    'text'        => __( 'Select Payment Method', 'invoicing' ),
236
+                    'id'          => 'gtscicd',
237
+                    'name'        => 'gtscicd',
238
+                    'type'        => 'gateway_select',
239
+                    'premade'     => true
240 240
 			
241
-				);
241
+                );
242 242
 
243
-			}
243
+            }
244 244
 
245
-			$_elements[] = $element;
245
+            $_elements[] = $element;
246 246
 
247
-		}
247
+        }
248 248
 
249 249
         return $_elements;
250
-	}
251
-
252
-	/**
253
-	 * Get the items sold via the form.
254
-	 *
255
-	 * @since 1.0.19
256
-	 * @param  string $context View or edit context.
257
-	 * @param  string $return objects or arrays.
258
-	 * @return GetPaid_Form_Item[]
259
-	 */
260
-	public function get_items( $context = 'view', $return = 'objects' ) {
261
-		$items = $this->get_prop( 'items', $context );
262
-
263
-		if ( empty( $items ) || ! is_array( $items ) ) {
250
+    }
251
+
252
+    /**
253
+     * Get the items sold via the form.
254
+     *
255
+     * @since 1.0.19
256
+     * @param  string $context View or edit context.
257
+     * @param  string $return objects or arrays.
258
+     * @return GetPaid_Form_Item[]
259
+     */
260
+    public function get_items( $context = 'view', $return = 'objects' ) {
261
+        $items = $this->get_prop( 'items', $context );
262
+
263
+        if ( empty( $items ) || ! is_array( $items ) ) {
264 264
             $items = wpinv_get_data( 'sample-payment-form-items' );
265
-		}
265
+        }
266 266
 
267
-		// Convert the items.
268
-		$prepared = array();
267
+        // Convert the items.
268
+        $prepared = array();
269 269
 
270
-		foreach ( $items as $key => $value ) {
270
+        foreach ( $items as $key => $value ) {
271 271
 
272
-			// Form items.
273
-			if ( $value instanceof GetPaid_Form_Item ) {
272
+            // Form items.
273
+            if ( $value instanceof GetPaid_Form_Item ) {
274 274
 
275
-				if ( $value->can_purchase() ) {
276
-					$prepared[] = $value;
277
-				}
275
+                if ( $value->can_purchase() ) {
276
+                    $prepared[] = $value;
277
+                }
278 278
 
279
-				continue;
279
+                continue;
280 280
 
281
-			}
281
+            }
282 282
 
283
-			// $item_id => $quantity (buy buttons)
284
-			if ( is_numeric( $key ) && is_numeric( $value ) ) {
285
-				$item = new GetPaid_Form_Item( $key );
283
+            // $item_id => $quantity (buy buttons)
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
-					$value = (float) $value;
290
-					$item->set_quantity( $value );
291
-					if ( 0 == $value ) {
292
-						$item->set_quantity( 1 );
293
-						$item->set_allow_quantities( true );
294
-					}
289
+                    $value = (float) $value;
290
+                    $item->set_quantity( $value );
291
+                    if ( 0 == $value ) {
292
+                        $item->set_quantity( 1 );
293
+                        $item->set_allow_quantities( true );
294
+                    }
295 295
 
296
-					$prepared[] = $item;
297
-				}
296
+                    $prepared[] = $item;
297
+                }
298 298
 
299
-				continue;
300
-			}
299
+                continue;
300
+            }
301 301
 
302
-			// Items saved via payment forms editor.
303
-			if ( is_array( $value ) && isset( $value['id'] ) ) {
302
+            // Items saved via payment forms editor.
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() ) {
308
-					continue;
309
-				}
307
+                if ( ! $item->can_purchase() ) {
308
+                    continue;
309
+                }
310 310
 
311
-				// Sub-total (Cart items).
312
-				if ( isset( $value['subtotal'] ) ) {
313
-					$item->set_price( $value['subtotal'] );
314
-				}
311
+                // Sub-total (Cart items).
312
+                if ( isset( $value['subtotal'] ) ) {
313
+                    $item->set_price( $value['subtotal'] );
314
+                }
315 315
 
316
-				if ( isset( $value['quantity'] ) ) {
317
-					$item->set_quantity( $value['quantity'] );
318
-				}
316
+                if ( isset( $value['quantity'] ) ) {
317
+                    $item->set_quantity( $value['quantity'] );
318
+                }
319 319
 
320
-				if ( isset( $value['allow_quantities'] ) ) {
321
-					$item->set_allow_quantities( $value['allow_quantities'] );
322
-				}
320
+                if ( isset( $value['allow_quantities'] ) ) {
321
+                    $item->set_allow_quantities( $value['allow_quantities'] );
322
+                }
323 323
 
324
-				if ( isset( $value['required'] ) ) {
325
-					$item->set_is_required( $value['required'] );
326
-				}
324
+                if ( isset( $value['required'] ) ) {
325
+                    $item->set_is_required( $value['required'] );
326
+                }
327 327
 
328
-				if ( isset( $value['description'] ) ) {
329
-					$item->set_custom_description( $value['description'] );
330
-				}
328
+                if ( isset( $value['description'] ) ) {
329
+                    $item->set_custom_description( $value['description'] );
330
+                }
331 331
 
332
-				$prepared[] = $item;
333
-				continue;
332
+                $prepared[] = $item;
333
+                continue;
334
+
335
+            }
336
+
337
+            // $item_id => array( 'price' => 10 ) (item variations)
338
+            if ( is_numeric( $key ) && is_array( $value ) ) {
339
+                $item = new GetPaid_Form_Item( $key );
340
+
341
+                if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) {
342
+                    $item->set_price( $value['price'] );
343
+                }
344
+
345
+                if ( $item->can_purchase() ) {
346
+                    $prepared[] = $item;
347
+                }
348
+
349
+                continue;
350
+            }
351
+
352
+        }
353
+
354
+        if ( 'objects' == $return && 'view' == $context ) {
355
+            return $prepared;
356
+        }
357
+
358
+        $items = array();
359
+        foreach ( $prepared as $item ) {
360
+            $items[] = $item->prepare_data_for_use();
361
+        }
362
+
363
+        return $items;
364
+    }
365
+
366
+    /**
367
+     * Get a single item belonging to the form.
368
+     *
369
+     * @since 1.0.19
370
+     * @param  int $item_id The item id to return.
371
+     * @return GetPaid_Form_Item|bool
372
+     */
373
+    public function get_item( $item_id ) {
374
+
375
+        if ( empty( $item_id ) || ! is_numeric( $item_id ) ) {
376
+            return false;
377
+        }
378
+
379
+        foreach( $this->get_items() as $item ) {
380
+            if ( $item->get_id() == (int) $item_id ) {
381
+                return $item;
382
+            }
383
+        }
384
+
385
+        return false;
386
+
387
+    }
388
+
389
+    /**
390
+     * Gets a single element.
391
+     *
392
+     * @since 1.0.19
393
+     * @param  string $element_type The element type to return.
394
+     * @return array|bool
395
+     */
396
+    public function get_element_type( $element_type ) {
397
+
398
+        if ( empty( $element_type ) || ! is_scalar( $element_type ) ) {
399
+            return false;
400
+        }
401
+
402
+        foreach ( $this->get_prop( 'elements' ) as $element ) {
403
+
404
+            if ( $element['type'] == $element_type ) {
405
+                return $element;
406
+            }
407
+
408
+        }
409
+
410
+        return false;
411
+
412
+    }
413
+
414
+    /**
415
+     * Get the total amount earned via this form.
416
+     *
417
+     * @since 1.0.19
418
+     * @param  string $context View or edit context.
419
+     * @return float
420
+     */
421
+    public function get_earned( $context = 'view' ) {
422
+        return $this->get_prop( 'earned', $context );
423
+    }
424
+
425
+    /**
426
+     * Get the total amount refunded via this form.
427
+     *
428
+     * @since 1.0.19
429
+     * @param  string $context View or edit context.
430
+     * @return float
431
+     */
432
+    public function get_refunded( $context = 'view' ) {
433
+        return $this->get_prop( 'refunded', $context );
434
+    }
334 435
 
335
-			}
436
+    /**
437
+     * Get the total amount cancelled via this form.
438
+     *
439
+     * @since 1.0.19
440
+     * @param  string $context View or edit context.
441
+     * @return float
442
+     */
443
+    public function get_cancelled( $context = 'view' ) {
444
+        return $this->get_prop( 'cancelled', $context );
445
+    }
336 446
 
337
-			// $item_id => array( 'price' => 10 ) (item variations)
338
-			if ( is_numeric( $key ) && is_array( $value ) ) {
339
-				$item = new GetPaid_Form_Item( $key );
447
+    /**
448
+     * Get the total amount failed via this form.
449
+     *
450
+     * @since 1.0.19
451
+     * @param  string $context View or edit context.
452
+     * @return float
453
+     */
454
+    public function get_failed( $context = 'view' ) {
455
+        return $this->get_prop( 'failed', $context );
456
+    }
340 457
 
341
-				if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) {
342
-					$item->set_price( $value['price'] );
343
-				}
344
-
345
-				if ( $item->can_purchase() ) {
346
-					$prepared[] = $item;
347
-				}
348
-
349
-				continue;
350
-			}
351
-
352
-		}
353
-
354
-		if ( 'objects' == $return && 'view' == $context ) {
355
-			return $prepared;
356
-		}
357
-
358
-		$items = array();
359
-		foreach ( $prepared as $item ) {
360
-			$items[] = $item->prepare_data_for_use();
361
-		}
362
-
363
-		return $items;
364
-	}
365
-
366
-	/**
367
-	 * Get a single item belonging to the form.
368
-	 *
369
-	 * @since 1.0.19
370
-	 * @param  int $item_id The item id to return.
371
-	 * @return GetPaid_Form_Item|bool
372
-	 */
373
-	public function get_item( $item_id ) {
374
-
375
-		if ( empty( $item_id ) || ! is_numeric( $item_id ) ) {
376
-			return false;
377
-		}
378
-
379
-		foreach( $this->get_items() as $item ) {
380
-			if ( $item->get_id() == (int) $item_id ) {
381
-				return $item;
382
-			}
383
-		}
384
-
385
-		return false;
386
-
387
-	}
388
-
389
-	/**
390
-	 * Gets a single element.
391
-	 *
392
-	 * @since 1.0.19
393
-	 * @param  string $element_type The element type to return.
394
-	 * @return array|bool
395
-	 */
396
-	public function get_element_type( $element_type ) {
397
-
398
-		if ( empty( $element_type ) || ! is_scalar( $element_type ) ) {
399
-			return false;
400
-		}
401
-
402
-		foreach ( $this->get_prop( 'elements' ) as $element ) {
403
-
404
-			if ( $element['type'] == $element_type ) {
405
-				return $element;
406
-			}
407
-
408
-		}
409
-
410
-		return false;
411
-
412
-	}
413
-
414
-	/**
415
-	 * Get the total amount earned via this form.
416
-	 *
417
-	 * @since 1.0.19
418
-	 * @param  string $context View or edit context.
419
-	 * @return float
420
-	 */
421
-	public function get_earned( $context = 'view' ) {
422
-		return $this->get_prop( 'earned', $context );
423
-	}
424
-
425
-	/**
426
-	 * Get the total amount refunded via this form.
427
-	 *
428
-	 * @since 1.0.19
429
-	 * @param  string $context View or edit context.
430
-	 * @return float
431
-	 */
432
-	public function get_refunded( $context = 'view' ) {
433
-		return $this->get_prop( 'refunded', $context );
434
-	}
435
-
436
-	/**
437
-	 * Get the total amount cancelled via this form.
438
-	 *
439
-	 * @since 1.0.19
440
-	 * @param  string $context View or edit context.
441
-	 * @return float
442
-	 */
443
-	public function get_cancelled( $context = 'view' ) {
444
-		return $this->get_prop( 'cancelled', $context );
445
-	}
446
-
447
-	/**
448
-	 * Get the total amount failed via this form.
449
-	 *
450
-	 * @since 1.0.19
451
-	 * @param  string $context View or edit context.
452
-	 * @return float
453
-	 */
454
-	public function get_failed( $context = 'view' ) {
455
-		return $this->get_prop( 'failed', $context );
456
-	}
457
-
458
-	/**
459
-	 * Get the currency.
460
-	 *
461
-	 * @since 1.0.19
462
-	 * @param  string $context View or edit context.
463
-	 * @return string
464
-	 */
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 );
468
-	}
458
+    /**
459
+     * Get the currency.
460
+     *
461
+     * @since 1.0.19
462
+     * @param  string $context View or edit context.
463
+     * @return string
464
+     */
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 );
468
+    }
469 469
 
470 470
     /*
471 471
 	|--------------------------------------------------------------------------
@@ -478,22 +478,22 @@  discard block
 block discarded – undo
478 478
     */
479 479
 
480 480
     /**
481
-	 * Set plugin version when the item was created.
482
-	 *
483
-	 * @since 1.0.19
484
-	 */
485
-	public function set_version( $value ) {
486
-		$this->set_prop( 'version', $value );
481
+     * Set plugin version when the item was created.
482
+     *
483
+     * @since 1.0.19
484
+     */
485
+    public function set_version( $value ) {
486
+        $this->set_prop( 'version', $value );
487 487
     }
488 488
 
489 489
     /**
490
-	 * Set date when the item was created.
491
-	 *
492
-	 * @since 1.0.19
493
-	 * @param string $value Value to set.
490
+     * Set date when the item was created.
491
+     *
492
+     * @since 1.0.19
493
+     * @param string $value Value to set.
494 494
      * @return bool Whether or not the date was set.
495
-	 */
496
-	public function set_date_created( $value ) {
495
+     */
496
+    public function set_date_created( $value ) {
497 497
         $date = strtotime( $value );
498 498
 
499 499
         if ( $date ) {
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
     }
507 507
 
508 508
     /**
509
-	 * Set date when the item was last modified.
510
-	 *
511
-	 * @since 1.0.19
512
-	 * @param string $value Value to set.
509
+     * Set date when the item was last modified.
510
+     *
511
+     * @since 1.0.19
512
+     * @param string $value Value to set.
513 513
      * @return bool Whether or not the date was set.
514
-	 */
515
-	public function set_date_modified( $value ) {
514
+     */
515
+    public function set_date_modified( $value ) {
516 516
         $date = strtotime( $value );
517 517
 
518 518
         if ( $date ) {
@@ -525,131 +525,131 @@  discard block
 block discarded – undo
525 525
     }
526 526
 
527 527
     /**
528
-	 * Set the item name.
529
-	 *
530
-	 * @since 1.0.19
531
-	 * @param  string $value New name.
532
-	 */
533
-	public function set_name( $value ) {
534
-		$this->set_prop( 'name', sanitize_text_field( $value ) );
528
+     * Set the item name.
529
+     *
530
+     * @since 1.0.19
531
+     * @param  string $value New name.
532
+     */
533
+    public function set_name( $value ) {
534
+        $this->set_prop( 'name', sanitize_text_field( $value ) );
535 535
     }
536 536
 
537 537
     /**
538
-	 * Alias of self::set_name().
539
-	 *
540
-	 * @since 1.0.19
541
-	 * @param  string $value New name.
542
-	 */
543
-	public function set_title( $value ) {
544
-		$this->set_name( $value );
538
+     * Alias of self::set_name().
539
+     *
540
+     * @since 1.0.19
541
+     * @param  string $value New name.
542
+     */
543
+    public function set_title( $value ) {
544
+        $this->set_name( $value );
545 545
     }
546 546
 
547 547
     /**
548
-	 * Set the owner of the item.
549
-	 *
550
-	 * @since 1.0.19
551
-	 * @param  int $value New author.
552
-	 */
553
-	public function set_author( $value ) {
554
-		$this->set_prop( 'author', (int) $value );
555
-	}
548
+     * Set the owner of the item.
549
+     *
550
+     * @since 1.0.19
551
+     * @param  int $value New author.
552
+     */
553
+    public function set_author( $value ) {
554
+        $this->set_prop( 'author', (int) $value );
555
+    }
556 556
 
557
-	/**
558
-	 * Set the form elements.
559
-	 *
560
-	 * @since 1.0.19
561
-	 * @sinve 2.3.4 Array values sanitized.
562
-	 * @param  array $value Form elements.
563
-	 */
564
-	public function set_elements( $value ) {
565
-		if ( is_array( $value ) ) {
557
+    /**
558
+     * Set the form elements.
559
+     *
560
+     * @since 1.0.19
561
+     * @sinve 2.3.4 Array values sanitized.
562
+     * @param  array $value Form elements.
563
+     */
564
+    public function set_elements( $value ) {
565
+        if ( is_array( $value ) ) {
566 566
 
567
-			// sanitize
568
-			if(!empty($value )){
567
+            // sanitize
568
+            if(!empty($value )){
569 569
 
570
-				foreach($value as $key => $val_arr){
571
-					$help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : '';
572
-					$value[$key] = array_map( 'sanitize_text_field', $val_arr );
573
-					$value[$key]['description'] = $help_text;
574
-				}
570
+                foreach($value as $key => $val_arr){
571
+                    $help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : '';
572
+                    $value[$key] = array_map( 'sanitize_text_field', $val_arr );
573
+                    $value[$key]['description'] = $help_text;
574
+                }
575 575
 				
576
-			}
577
-
578
-			$this->set_prop( 'elements', $value );
579
-		}
580
-	}
581
-
582
-	/**
583
-	 * Set the form items.
584
-	 *
585
-	 * @since 1.0.19
586
-	 * @param  array $value Form elements.
587
-	 */
588
-	public function set_items( $value ) {
589
-		if ( is_array( $value ) ) {
590
-			$this->set_prop( 'items', $value );
591
-		}
592
-	}
593
-
594
-	/**
595
-	 * Set the total amount earned via this form.
596
-	 *
597
-	 * @since 1.0.19
598
-	 * @param  float $value Amount earned.
599
-	 */
600
-	public function set_earned( $value ) {
601
-		$value = max( (float) $value, 0 );
602
-		$this->set_prop( 'earned', $value );
603
-	}
604
-
605
-	/**
606
-	 * Set the total amount refunded via this form.
607
-	 *
608
-	 * @since 1.0.19
609
-	 * @param  float $value Amount refunded.
610
-	 */
611
-	public function set_refunded( $value ) {
612
-		$value = max( (float) $value, 0 );
613
-		$this->set_prop( 'refunded', $value );
614
-	}
615
-
616
-	/**
617
-	 * Set the total amount cancelled via this form.
618
-	 *
619
-	 * @since 1.0.19
620
-	 * @param  float $value Amount cancelled.
621
-	 */
622
-	public function set_cancelled( $value ) {
623
-		$value = max( (float) $value, 0 );
624
-		$this->set_prop( 'cancelled', $value );
625
-	}
626
-
627
-	/**
628
-	 * Set the total amount failed via this form.
629
-	 *
630
-	 * @since 1.0.19
631
-	 * @param  float $value Amount cancelled.
632
-	 */
633
-	public function set_failed( $value ) {
634
-		$value = max( (float) $value, 0 );
635
-		$this->set_prop( 'failed', $value );
636
-	}
576
+            }
577
+
578
+            $this->set_prop( 'elements', $value );
579
+        }
580
+    }
581
+
582
+    /**
583
+     * Set the form items.
584
+     *
585
+     * @since 1.0.19
586
+     * @param  array $value Form elements.
587
+     */
588
+    public function set_items( $value ) {
589
+        if ( is_array( $value ) ) {
590
+            $this->set_prop( 'items', $value );
591
+        }
592
+    }
593
+
594
+    /**
595
+     * Set the total amount earned via this form.
596
+     *
597
+     * @since 1.0.19
598
+     * @param  float $value Amount earned.
599
+     */
600
+    public function set_earned( $value ) {
601
+        $value = max( (float) $value, 0 );
602
+        $this->set_prop( 'earned', $value );
603
+    }
604
+
605
+    /**
606
+     * Set the total amount refunded via this form.
607
+     *
608
+     * @since 1.0.19
609
+     * @param  float $value Amount refunded.
610
+     */
611
+    public function set_refunded( $value ) {
612
+        $value = max( (float) $value, 0 );
613
+        $this->set_prop( 'refunded', $value );
614
+    }
615
+
616
+    /**
617
+     * Set the total amount cancelled via this form.
618
+     *
619
+     * @since 1.0.19
620
+     * @param  float $value Amount cancelled.
621
+     */
622
+    public function set_cancelled( $value ) {
623
+        $value = max( (float) $value, 0 );
624
+        $this->set_prop( 'cancelled', $value );
625
+    }
626
+
627
+    /**
628
+     * Set the total amount failed via this form.
629
+     *
630
+     * @since 1.0.19
631
+     * @param  float $value Amount cancelled.
632
+     */
633
+    public function set_failed( $value ) {
634
+        $value = max( (float) $value, 0 );
635
+        $this->set_prop( 'failed', $value );
636
+    }
637 637
 
638 638
     /**
639 639
      * Create an item. For backwards compatibilty.
640 640
      *
641 641
      * @deprecated
642
-	 * @return int item id
642
+     * @return int item id
643 643
      */
644 644
     public function create( $data = array() ) {
645 645
 
646
-		// Set the properties.
647
-		if ( is_array( $data ) ) {
648
-			$this->set_props( $data );
649
-		}
646
+        // Set the properties.
647
+        if ( is_array( $data ) ) {
648
+            $this->set_props( $data );
649
+        }
650 650
 
651
-		// Save the item.
652
-		return $this->save();
651
+        // Save the item.
652
+        return $this->save();
653 653
 
654 654
     }
655 655
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
      * Updates an item. For backwards compatibilty.
658 658
      *
659 659
      * @deprecated
660
-	 * @return int item id
660
+     * @return int item id
661 661
      */
662 662
     public function update( $data = array() ) {
663 663
         return $this->create( $data );
@@ -673,22 +673,22 @@  discard block
 block discarded – undo
673 673
 	*/
674 674
 
675 675
     /**
676
-	 * Checks whether this is the default payment form.
677
-	 *
678
-	 * @since 1.0.19
679
-	 * @return bool
680
-	 */
676
+     * Checks whether this is the default payment form.
677
+     *
678
+     * @since 1.0.19
679
+     * @return bool
680
+     */
681 681
     public function is_default() {
682 682
         $is_default = $this->get_id() == wpinv_get_default_payment_form();
683 683
         return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->get_id(), $this );
684
-	}
684
+    }
685 685
 
686 686
     /**
687
-	 * Checks whether the form is active.
688
-	 *
689
-	 * @since 1.0.19
690
-	 * @return bool
691
-	 */
687
+     * Checks whether the form is active.
688
+     *
689
+     * @since 1.0.19
690
+     * @return bool
691
+     */
692 692
     public function is_active() {
693 693
         $is_active = 0 !== (int) $this->get_id();
694 694
 
@@ -697,76 +697,76 @@  discard block
 block discarded – undo
697 697
         }
698 698
 
699 699
         return (bool) apply_filters( 'wpinv_is_payment_form_active', $is_active, $this );
700
-	}
701
-
702
-	/**
703
-	 * Checks whether the form has a given item.
704
-	 *
705
-	 * @since 1.0.19
706
-	 * @return bool
707
-	 */
700
+    }
701
+
702
+    /**
703
+     * Checks whether the form has a given item.
704
+     *
705
+     * @since 1.0.19
706
+     * @return bool
707
+     */
708 708
     public function has_item( $item_id ) {
709 709
         return false !== $this->get_item( $item_id );
710
-	}
711
-
712
-	/**
713
-	 * Checks whether the form has a given element.
714
-	 *
715
-	 * @since 1.0.19
716
-	 * @return bool
717
-	 */
710
+    }
711
+
712
+    /**
713
+     * Checks whether the form has a given element.
714
+     *
715
+     * @since 1.0.19
716
+     * @return bool
717
+     */
718 718
     public function has_element_type( $element_type ) {
719 719
         return false !== $this->get_element_type( $element_type );
720
-	}
721
-
722
-	/**
723
-	 * Checks whether this form is recurring or not.
724
-	 *
725
-	 * @since 1.0.19
726
-	 * @return bool
727
-	 */
720
+    }
721
+
722
+    /**
723
+     * Checks whether this form is recurring or not.
724
+     *
725
+     * @since 1.0.19
726
+     * @return bool
727
+     */
728 728
     public function is_recurring() {
729 729
 
730
-		if ( ! empty( $this->invoice ) ) {
731
-			return $this->invoice->is_recurring();
732
-		}
730
+        if ( ! empty( $this->invoice ) ) {
731
+            return $this->invoice->is_recurring();
732
+        }
733 733
 
734
-		foreach ( $this->get_items() as $item ) {
734
+        foreach ( $this->get_items() as $item ) {
735 735
 
736
-			if ( $item->is_recurring() ) {
737
-				return true;
738
-			}
736
+            if ( $item->is_recurring() ) {
737
+                return true;
738
+            }
739 739
 
740
-		}
740
+        }
741 741
 
742 742
         return false;
743
-	}
743
+    }
744 744
 
745
-	/**
746
-	 * Retrieves the form's html.
747
-	 *
748
-	 * @since 1.0.19
749
-	 */
745
+    /**
746
+     * Retrieves the form's html.
747
+     *
748
+     * @since 1.0.19
749
+     */
750 750
     public function get_html( $extra_markup = '' ) {
751 751
 
752
-		// Return the HTML.
753
-		return wpinv_get_template_html(
754
-			'payment-forms/form.php',
755
-			array(
756
-				'form'         => $this,
757
-				'extra_markup' => $extra_markup,
758
-			)
759
-		);
760
-
761
-	}
762
-
763
-	/**
764
-	 * Displays the payment form.
765
-	 *
766
-	 * @since 1.0.19
767
-	 */
752
+        // Return the HTML.
753
+        return wpinv_get_template_html(
754
+            'payment-forms/form.php',
755
+            array(
756
+                'form'         => $this,
757
+                'extra_markup' => $extra_markup,
758
+            )
759
+        );
760
+
761
+    }
762
+
763
+    /**
764
+     * Displays the payment form.
765
+     *
766
+     * @since 1.0.19
767
+     */
768 768
     public function display( $extra_markup = '' ) {
769
-		echo $this->get_html( $extra_markup );
769
+        echo $this->get_html( $extra_markup );
770 770
     }
771 771
 
772 772
 }
Please login to merge, or discard this patch.
invoicing.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 
20 20
 // Define constants.
21 21
 if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) {
22
-	define( 'WPINV_PLUGIN_FILE', __FILE__ );
22
+    define( 'WPINV_PLUGIN_FILE', __FILE__ );
23 23
 }
24 24
 
25 25
 if ( ! defined( 'WPINV_VERSION' ) ) {
26
-	define( 'WPINV_VERSION', '2.3.4' );
26
+    define( 'WPINV_VERSION', '2.3.4' );
27 27
 }
28 28
 
29 29
 // Include the main Invoicing class.
30 30
 if ( ! class_exists( 'WPInv_Plugin', false ) ) {
31
-	require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
31
+    require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
32 32
 }
33 33
 
34 34
 /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $GLOBALS['invoicing'] = new WPInv_Plugin();
44 44
     }
45 45
 
46
-	return $GLOBALS['invoicing'];
46
+    return $GLOBALS['invoicing'];
47 47
 }
48 48
 
49 49
 /**
Please login to merge, or discard this patch.