Passed
Push — master ( 8614dd...22bbb7 )
by Brian
18:27
created
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * Bail if we are not in WP.
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16 16
 add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
18
-	$this_version = "0.1.85";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
22
-	}
17
+    global $ayecode_ui_version,$ayecode_ui_file_key;
18
+    $this_version = "0.1.85";
19
+    if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
+        $ayecode_ui_version = $this_version ;
21
+        $ayecode_ui_file_key = wp_hash( __FILE__ );
22
+    }
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28 28
 add_action('after_setup_theme', function () {
29
-	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
-	}
29
+    global $ayecode_ui_file_key;
30
+    if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
+        include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
+        include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
+    }
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39 39
 if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
42
-			return false;
43
-		}
44
-		return AUI::instance();
45
-	}
40
+    function aui(){
41
+        if(!class_exists("AUI",false)){
42
+            return false;
43
+        }
44
+        return AUI::instance();
45
+    }
46 46
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.85";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (empty($ayecode_ui_version) || version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 2 patches
Indentation   +1678 added lines, -1678 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
  * @return mixed|void
12 12
  */
13 13
 function sd_pagenow_exclude() {
14
-	return apply_filters(
15
-		'sd_pagenow_exclude',
16
-		array(
17
-			'upload.php',
18
-			'edit-comments.php',
19
-			'edit-tags.php',
20
-			'index.php',
21
-			'media-new.php',
22
-			'options-discussion.php',
23
-			'options-writing.php',
24
-			'edit.php',
25
-			'themes.php',
26
-			'users.php',
27
-		)
28
-	);
14
+    return apply_filters(
15
+        'sd_pagenow_exclude',
16
+        array(
17
+            'upload.php',
18
+            'edit-comments.php',
19
+            'edit-tags.php',
20
+            'index.php',
21
+            'media-new.php',
22
+            'options-discussion.php',
23
+            'options-writing.php',
24
+            'edit.php',
25
+            'themes.php',
26
+            'users.php',
27
+        )
28
+    );
29 29
 }
30 30
 
31 31
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * @return mixed|void
38 38
  */
39 39
 function sd_widget_exclude() {
40
-	return apply_filters( 'sd_widget_exclude', array() );
40
+    return apply_filters( 'sd_widget_exclude', array() );
41 41
 }
42 42
 
43 43
 
@@ -50,82 +50,82 @@  discard block
 block discarded – undo
50 50
  * @return array
51 51
  */
52 52
 function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) {
53
-	$options = array(
54
-		''     => __( 'None', 'super-duper' ),
55
-		'auto' => __( 'auto', 'super-duper' ),
56
-		'0'    => '0',
57
-		'1'    => '1',
58
-		'2'    => '2',
59
-		'3'    => '3',
60
-		'4'    => '4',
61
-		'5'    => '5',
62
-		'6'    => '6',
63
-		'7'    => '7',
64
-		'8'    => '8',
65
-		'9'    => '9',
66
-		'10'    => '10',
67
-		'11'    => '11',
68
-		'12'    => '12',
69
-	);
70
-
71
-	if ( $include_negatives ) {
72
-		$options['n1'] = '-1';
73
-		$options['n2'] = '-2';
74
-		$options['n3'] = '-3';
75
-		$options['n4'] = '-4';
76
-		$options['n5'] = '-5';
77
-		$options['n6'] = '-6';
78
-		$options['n7'] = '-7';
79
-		$options['n8'] = '-8';
80
-		$options['n9'] = '-9';
81
-		$options['n10'] = '-10';
82
-		$options['n11'] = '-11';
83
-		$options['n12'] = '-12';
84
-	}
85
-
86
-	$defaults = array(
87
-		'type'     => 'select',
88
-		'title'    => __( 'Margin top', 'super-duper' ),
89
-		'options'  => $options,
90
-		'default'  => '',
91
-		'desc_tip' => true,
92
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
93
-	);
94
-
95
-	// title
96
-	if ( $type == 'mt' ) {
97
-		$defaults['title'] = __( 'Margin top', 'super-duper' );
98
-		$defaults['icon']  = 'box-top';
99
-		$defaults['row']   = array(
100
-			'title' => __( 'Margins', 'super-duper' ),
101
-			'key'   => 'wrapper-margins',
102
-			'open'  => true,
103
-			'class' => 'text-center',
104
-		);
105
-	} elseif ( $type == 'mr' ) {
106
-		$defaults['title'] = __( 'Margin right', 'super-duper' );
107
-		$defaults['icon']  = 'box-right';
108
-		$defaults['row']   = array(
109
-			'key' => 'wrapper-margins',
110
-		);
111
-	} elseif ( $type == 'mb' ) {
112
-		$defaults['title'] = __( 'Margin bottom', 'super-duper' );
113
-		$defaults['icon']  = 'box-bottom';
114
-		$defaults['row']   = array(
115
-			'key' => 'wrapper-margins',
116
-		);
117
-	} elseif ( $type == 'ml' ) {
118
-		$defaults['title'] = __( 'Margin left', 'super-duper' );
119
-		$defaults['icon']  = 'box-left';
120
-		$defaults['row']   = array(
121
-			'key'   => 'wrapper-margins',
122
-			'close' => true,
123
-		);
124
-	}
125
-
126
-	$input = wp_parse_args( $overwrite, $defaults );
127
-
128
-	return $input;
53
+    $options = array(
54
+        ''     => __( 'None', 'super-duper' ),
55
+        'auto' => __( 'auto', 'super-duper' ),
56
+        '0'    => '0',
57
+        '1'    => '1',
58
+        '2'    => '2',
59
+        '3'    => '3',
60
+        '4'    => '4',
61
+        '5'    => '5',
62
+        '6'    => '6',
63
+        '7'    => '7',
64
+        '8'    => '8',
65
+        '9'    => '9',
66
+        '10'    => '10',
67
+        '11'    => '11',
68
+        '12'    => '12',
69
+    );
70
+
71
+    if ( $include_negatives ) {
72
+        $options['n1'] = '-1';
73
+        $options['n2'] = '-2';
74
+        $options['n3'] = '-3';
75
+        $options['n4'] = '-4';
76
+        $options['n5'] = '-5';
77
+        $options['n6'] = '-6';
78
+        $options['n7'] = '-7';
79
+        $options['n8'] = '-8';
80
+        $options['n9'] = '-9';
81
+        $options['n10'] = '-10';
82
+        $options['n11'] = '-11';
83
+        $options['n12'] = '-12';
84
+    }
85
+
86
+    $defaults = array(
87
+        'type'     => 'select',
88
+        'title'    => __( 'Margin top', 'super-duper' ),
89
+        'options'  => $options,
90
+        'default'  => '',
91
+        'desc_tip' => true,
92
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
93
+    );
94
+
95
+    // title
96
+    if ( $type == 'mt' ) {
97
+        $defaults['title'] = __( 'Margin top', 'super-duper' );
98
+        $defaults['icon']  = 'box-top';
99
+        $defaults['row']   = array(
100
+            'title' => __( 'Margins', 'super-duper' ),
101
+            'key'   => 'wrapper-margins',
102
+            'open'  => true,
103
+            'class' => 'text-center',
104
+        );
105
+    } elseif ( $type == 'mr' ) {
106
+        $defaults['title'] = __( 'Margin right', 'super-duper' );
107
+        $defaults['icon']  = 'box-right';
108
+        $defaults['row']   = array(
109
+            'key' => 'wrapper-margins',
110
+        );
111
+    } elseif ( $type == 'mb' ) {
112
+        $defaults['title'] = __( 'Margin bottom', 'super-duper' );
113
+        $defaults['icon']  = 'box-bottom';
114
+        $defaults['row']   = array(
115
+            'key' => 'wrapper-margins',
116
+        );
117
+    } elseif ( $type == 'ml' ) {
118
+        $defaults['title'] = __( 'Margin left', 'super-duper' );
119
+        $defaults['icon']  = 'box-left';
120
+        $defaults['row']   = array(
121
+            'key'   => 'wrapper-margins',
122
+            'close' => true,
123
+        );
124
+    }
125
+
126
+    $input = wp_parse_args( $overwrite, $defaults );
127
+
128
+    return $input;
129 129
 }
130 130
 
131 131
 /**
@@ -137,67 +137,67 @@  discard block
 block discarded – undo
137 137
  * @return array
138 138
  */
139 139
 function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
140
-	$options = array(
141
-		''  => __( 'None', 'super-duper' ),
142
-		'0' => '0',
143
-		'1' => '1',
144
-		'2' => '2',
145
-		'3' => '3',
146
-		'4' => '4',
147
-		'5' => '5',
148
-		'6'    => '6',
149
-		'7'    => '7',
150
-		'8'    => '8',
151
-		'9'    => '9',
152
-		'10'    => '10',
153
-		'11'    => '11',
154
-		'12'    => '12',
155
-	);
156
-
157
-	$defaults = array(
158
-		'type'     => 'select',
159
-		'title'    => __( 'Padding top', 'super-duper' ),
160
-		'options'  => $options,
161
-		'default'  => '',
162
-		'desc_tip' => true,
163
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
164
-	);
165
-
166
-	// title
167
-	if ( $type == 'pt' ) {
168
-		$defaults['title'] = __( 'Padding top', 'super-duper' );
169
-		$defaults['icon']  = 'box-top';
170
-		$defaults['row']   = array(
171
-			'title' => __( 'Padding', 'super-duper' ),
172
-			'key'   => 'wrapper-padding',
173
-			'open'  => true,
174
-			'class' => 'text-center',
175
-		);
176
-	} elseif ( $type == 'pr' ) {
177
-		$defaults['title'] = __( 'Padding right', 'super-duper' );
178
-		$defaults['icon']  = 'box-right';
179
-		$defaults['row']   = array(
180
-			'key' => 'wrapper-padding',
181
-		);
182
-	} elseif ( $type == 'pb' ) {
183
-		$defaults['title'] = __( 'Padding bottom', 'super-duper' );
184
-		$defaults['icon']  = 'box-bottom';
185
-		$defaults['row']   = array(
186
-			'key' => 'wrapper-padding',
187
-		);
188
-	} elseif ( $type == 'pl' ) {
189
-		$defaults['title'] = __( 'Padding left', 'super-duper' );
190
-		$defaults['icon']  = 'box-left';
191
-		$defaults['row']   = array(
192
-			'key'   => 'wrapper-padding',
193
-			'close' => true,
194
-
195
-		);
196
-	}
197
-
198
-	$input = wp_parse_args( $overwrite, $defaults );
199
-
200
-	return $input;
140
+    $options = array(
141
+        ''  => __( 'None', 'super-duper' ),
142
+        '0' => '0',
143
+        '1' => '1',
144
+        '2' => '2',
145
+        '3' => '3',
146
+        '4' => '4',
147
+        '5' => '5',
148
+        '6'    => '6',
149
+        '7'    => '7',
150
+        '8'    => '8',
151
+        '9'    => '9',
152
+        '10'    => '10',
153
+        '11'    => '11',
154
+        '12'    => '12',
155
+    );
156
+
157
+    $defaults = array(
158
+        'type'     => 'select',
159
+        'title'    => __( 'Padding top', 'super-duper' ),
160
+        'options'  => $options,
161
+        'default'  => '',
162
+        'desc_tip' => true,
163
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
164
+    );
165
+
166
+    // title
167
+    if ( $type == 'pt' ) {
168
+        $defaults['title'] = __( 'Padding top', 'super-duper' );
169
+        $defaults['icon']  = 'box-top';
170
+        $defaults['row']   = array(
171
+            'title' => __( 'Padding', 'super-duper' ),
172
+            'key'   => 'wrapper-padding',
173
+            'open'  => true,
174
+            'class' => 'text-center',
175
+        );
176
+    } elseif ( $type == 'pr' ) {
177
+        $defaults['title'] = __( 'Padding right', 'super-duper' );
178
+        $defaults['icon']  = 'box-right';
179
+        $defaults['row']   = array(
180
+            'key' => 'wrapper-padding',
181
+        );
182
+    } elseif ( $type == 'pb' ) {
183
+        $defaults['title'] = __( 'Padding bottom', 'super-duper' );
184
+        $defaults['icon']  = 'box-bottom';
185
+        $defaults['row']   = array(
186
+            'key' => 'wrapper-padding',
187
+        );
188
+    } elseif ( $type == 'pl' ) {
189
+        $defaults['title'] = __( 'Padding left', 'super-duper' );
190
+        $defaults['icon']  = 'box-left';
191
+        $defaults['row']   = array(
192
+            'key'   => 'wrapper-padding',
193
+            'close' => true,
194
+
195
+        );
196
+    }
197
+
198
+    $input = wp_parse_args( $overwrite, $defaults );
199
+
200
+    return $input;
201 201
 }
202 202
 
203 203
 /**
@@ -210,57 +210,57 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function sd_get_border_input( $type = 'border', $overwrite = array() ) {
212 212
 
213
-	$defaults = array(
214
-		'type'     => 'select',
215
-		'title'    => __( 'Border' ),
216
-		'options'  => array(),
217
-		'default'  => '',
218
-		'desc_tip' => true,
219
-		'group'    => __( 'Wrapper Styles', 'geodirectory' ),
220
-	);
221
-
222
-	// title
223
-	if ( $type == 'rounded' ) {
224
-		$defaults['title']   = __( 'Border radius type', 'super-duper' );
225
-		$defaults['options'] = array(
226
-			''               => __( 'Default', 'super-duper' ),
227
-			'rounded'        => 'rounded',
228
-			'rounded-top'    => 'rounded-top',
229
-			'rounded-right'  => 'rounded-right',
230
-			'rounded-bottom' => 'rounded-bottom',
231
-			'rounded-left'   => 'rounded-left',
232
-			'rounded-circle' => 'rounded-circle',
233
-			'rounded-pill'   => 'rounded-pill',
234
-			'rounded-0'      => 'rounded-0',
235
-		);
236
-	} elseif ( $type == 'rounded_size' ) {
237
-		$defaults['title']   = __( 'Border radius size', 'super-duper' );
238
-		$defaults['options'] = array(
239
-			''   => __( 'Default', 'super-duper' ),
240
-			'sm' => __( 'Small', 'super-duper' ),
241
-			'lg' => __( 'Large', 'super-duper' ),
242
-		);
243
-	} elseif ( $type == 'type' ) {
244
-		$defaults['title']   = __( 'Border type', 'super-duper' );
245
-		$defaults['options'] = array(
246
-			''              => __( 'None', 'super-duper' ),
247
-			'border'        => __( 'Full', 'super-duper' ),
248
-			'border-top'    => __( 'Top', 'super-duper' ),
249
-			'border-bottom' => __( 'Bottom', 'super-duper' ),
250
-			'border-left'   => __( 'Left', 'super-duper' ),
251
-			'border-right'  => __( 'Right', 'super-duper' ),
252
-		);
253
-	} else {
254
-		$defaults['title']   = __( 'Border color' );
255
-		$defaults['options'] = array(
256
-			                       ''  => __( 'Default', 'super-duper' ),
257
-			                       '0' => __( 'None', 'super-duper' ),
258
-		                       ) + sd_aui_colors();
259
-	}
260
-
261
-	$input = wp_parse_args( $overwrite, $defaults );
262
-
263
-	return $input;
213
+    $defaults = array(
214
+        'type'     => 'select',
215
+        'title'    => __( 'Border' ),
216
+        'options'  => array(),
217
+        'default'  => '',
218
+        'desc_tip' => true,
219
+        'group'    => __( 'Wrapper Styles', 'geodirectory' ),
220
+    );
221
+
222
+    // title
223
+    if ( $type == 'rounded' ) {
224
+        $defaults['title']   = __( 'Border radius type', 'super-duper' );
225
+        $defaults['options'] = array(
226
+            ''               => __( 'Default', 'super-duper' ),
227
+            'rounded'        => 'rounded',
228
+            'rounded-top'    => 'rounded-top',
229
+            'rounded-right'  => 'rounded-right',
230
+            'rounded-bottom' => 'rounded-bottom',
231
+            'rounded-left'   => 'rounded-left',
232
+            'rounded-circle' => 'rounded-circle',
233
+            'rounded-pill'   => 'rounded-pill',
234
+            'rounded-0'      => 'rounded-0',
235
+        );
236
+    } elseif ( $type == 'rounded_size' ) {
237
+        $defaults['title']   = __( 'Border radius size', 'super-duper' );
238
+        $defaults['options'] = array(
239
+            ''   => __( 'Default', 'super-duper' ),
240
+            'sm' => __( 'Small', 'super-duper' ),
241
+            'lg' => __( 'Large', 'super-duper' ),
242
+        );
243
+    } elseif ( $type == 'type' ) {
244
+        $defaults['title']   = __( 'Border type', 'super-duper' );
245
+        $defaults['options'] = array(
246
+            ''              => __( 'None', 'super-duper' ),
247
+            'border'        => __( 'Full', 'super-duper' ),
248
+            'border-top'    => __( 'Top', 'super-duper' ),
249
+            'border-bottom' => __( 'Bottom', 'super-duper' ),
250
+            'border-left'   => __( 'Left', 'super-duper' ),
251
+            'border-right'  => __( 'Right', 'super-duper' ),
252
+        );
253
+    } else {
254
+        $defaults['title']   = __( 'Border color' );
255
+        $defaults['options'] = array(
256
+                                    ''  => __( 'Default', 'super-duper' ),
257
+                                    '0' => __( 'None', 'super-duper' ),
258
+                                ) + sd_aui_colors();
259
+    }
260
+
261
+    $input = wp_parse_args( $overwrite, $defaults );
262
+
263
+    return $input;
264 264
 }
265 265
 
266 266
 /**
@@ -272,25 +272,25 @@  discard block
 block discarded – undo
272 272
  * @return array
273 273
  */
274 274
 function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
275
-	$options = array(
276
-		''          => __( 'None', 'super-duper' ),
277
-		'shadow-sm' => __( 'Small', 'super-duper' ),
278
-		'shadow'    => __( 'Regular', 'super-duper' ),
279
-		'shadow-lg' => __( 'Large', 'super-duper' ),
280
-	);
281
-
282
-	$defaults = array(
283
-		'type'     => 'select',
284
-		'title'    => __( 'Shadow', 'super-duper' ),
285
-		'options'  => $options,
286
-		'default'  => '',
287
-		'desc_tip' => true,
288
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
289
-	);
290
-
291
-	$input = wp_parse_args( $overwrite, $defaults );
292
-
293
-	return $input;
275
+    $options = array(
276
+        ''          => __( 'None', 'super-duper' ),
277
+        'shadow-sm' => __( 'Small', 'super-duper' ),
278
+        'shadow'    => __( 'Regular', 'super-duper' ),
279
+        'shadow-lg' => __( 'Large', 'super-duper' ),
280
+    );
281
+
282
+    $defaults = array(
283
+        'type'     => 'select',
284
+        'title'    => __( 'Shadow', 'super-duper' ),
285
+        'options'  => $options,
286
+        'default'  => '',
287
+        'desc_tip' => true,
288
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
289
+    );
290
+
291
+    $input = wp_parse_args( $overwrite, $defaults );
292
+
293
+    return $input;
294 294
 }
295 295
 
296 296
 /**
@@ -302,23 +302,23 @@  discard block
 block discarded – undo
302 302
  * @return array
303 303
  */
304 304
 function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
305
-	$options = array(
306
-		           ''            => __( 'None', 'super-duper' ),
307
-		           'transparent' => __( 'Transparent', 'super-duper' ),
308
-	           ) + sd_aui_colors();
309
-
310
-	$defaults = array(
311
-		'type'     => 'select',
312
-		'title'    => __( 'Background color', 'super-duper' ),
313
-		'options'  => $options,
314
-		'default'  => '',
315
-		'desc_tip' => true,
316
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
317
-	);
318
-
319
-	$input = wp_parse_args( $overwrite, $defaults );
320
-
321
-	return $input;
305
+    $options = array(
306
+                    ''            => __( 'None', 'super-duper' ),
307
+                    'transparent' => __( 'Transparent', 'super-duper' ),
308
+                ) + sd_aui_colors();
309
+
310
+    $defaults = array(
311
+        'type'     => 'select',
312
+        'title'    => __( 'Background color', 'super-duper' ),
313
+        'options'  => $options,
314
+        'default'  => '',
315
+        'desc_tip' => true,
316
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
317
+    );
318
+
319
+    $input = wp_parse_args( $overwrite, $defaults );
320
+
321
+    return $input;
322 322
 }
323 323
 
324 324
 /**
@@ -330,118 +330,118 @@  discard block
 block discarded – undo
330 330
  * @return array
331 331
  */
332 332
 function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
333
-	$options = array(
334
-		           ''            => __( 'None', 'super-duper' ),
335
-		           'transparent' => __( 'Transparent', 'super-duper' ),
336
-	           ) + sd_aui_colors()
337
-	           + array(
338
-		           'custom-color'    => __( 'Custom Color', 'super-duper' ),
339
-		           'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
340
-	           );
341
-
342
-	$defaults = array(
343
-		'type'     => 'select',
344
-		'title'    => __( 'Background Color', 'super-duper' ),
345
-		'options'  => $options,
346
-		'default'  => '',
347
-		'desc_tip' => true,
348
-		'group'    => __( 'Background', 'super-duper' ),
349
-	);
350
-
351
-	if ( $overwrite !== false ) {
352
-		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
353
-	}
354
-
355
-	if ( $overwrite_color !== false ) {
356
-		$input[ $type . '_color' ] = wp_parse_args(
357
-			$overwrite_color,
358
-			array(
359
-				'type'            => 'color',
360
-				'title'           => __( 'Custom color', 'super-duper' ),
361
-				'placeholder'     => '',
362
-				'default'         => '#0073aa',
363
-				'desc_tip'        => true,
364
-				'group'           => __( 'Background', 'super-duper' ),
365
-				'element_require' => '[%' . $type . '%]=="custom-color"',
366
-			)
367
-		);
368
-	}
369
-
370
-	if ( $overwrite_gradient !== false ) {
371
-		$input[ $type . '_gradient' ] = wp_parse_args(
372
-			$overwrite_gradient,
373
-			array(
374
-				'type'            => 'gradient',
375
-				'title'           => __( 'Custom gradient', 'super-duper' ),
376
-				'placeholder'     => '',
377
-				'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
378
-				'desc_tip'        => true,
379
-				'group'           => __( 'Background', 'super-duper' ),
380
-				'element_require' => '[%' . $type . '%]=="custom-gradient"',
381
-			)
382
-		);
383
-	}
384
-
385
-	if ( $overwrite_image !== false ) {
386
-
387
-		$input[ $type . '_image_fixed' ] = array(
388
-			'type'            => 'checkbox',
389
-			'title'           => __( 'Fixed background', 'super-duper' ),
390
-			'default'         => '',
391
-			'desc_tip'        => true,
392
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
393
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
394
-
395
-		);
396
-
397
-		$input[ $type . '_image_use_featured' ] = array(
398
-			'type'            => 'checkbox',
399
-			'title'           => __( 'Use featured image', 'super-duper' ),
400
-			'default'         => '',
401
-			'desc_tip'        => true,
402
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
403
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
404
-
405
-		);
406
-
407
-		$input[ $type . '_image' ] = wp_parse_args(
408
-			$overwrite_image,
409
-			array(
410
-				'type'        => 'image',
411
-				'title'       => __( 'Custom image', 'super-duper' ),
412
-				'placeholder' => '',
413
-				'default'     => '',
414
-				'desc_tip'    => true,
415
-				'group'       => __( 'Background', 'super-duper' ),
416
-				//          'element_require' => ' ![%' . $type . '_image_use_featured%] '
417
-			)
418
-		);
419
-
420
-		$input[ $type . '_image_id' ] = wp_parse_args(
421
-			$overwrite_image,
422
-			array(
423
-				'type'        => 'hidden',
424
-				'hidden_type' => 'number',
425
-				'title'       => '',
426
-				'placeholder' => '',
427
-				'default'     => '',
428
-				'group'       => __( 'Background', 'super-duper' ),
429
-			)
430
-		);
431
-
432
-		$input[ $type . '_image_xy' ] = wp_parse_args(
433
-			$overwrite_image,
434
-			array(
435
-				'type'        => 'image_xy',
436
-				'title'       => '',
437
-				'placeholder' => '',
438
-				'default'     => '',
439
-				'group'       => __( 'Background', 'super-duper' ),
440
-			)
441
-		);
442
-	}
443
-
444
-	return $input;
333
+    $options = array(
334
+                    ''            => __( 'None', 'super-duper' ),
335
+                    'transparent' => __( 'Transparent', 'super-duper' ),
336
+                ) + sd_aui_colors()
337
+               + array(
338
+                    'custom-color'    => __( 'Custom Color', 'super-duper' ),
339
+                    'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
340
+                );
341
+
342
+    $defaults = array(
343
+        'type'     => 'select',
344
+        'title'    => __( 'Background Color', 'super-duper' ),
345
+        'options'  => $options,
346
+        'default'  => '',
347
+        'desc_tip' => true,
348
+        'group'    => __( 'Background', 'super-duper' ),
349
+    );
350
+
351
+    if ( $overwrite !== false ) {
352
+        $input[ $type ] = wp_parse_args( $overwrite, $defaults );
353
+    }
354
+
355
+    if ( $overwrite_color !== false ) {
356
+        $input[ $type . '_color' ] = wp_parse_args(
357
+            $overwrite_color,
358
+            array(
359
+                'type'            => 'color',
360
+                'title'           => __( 'Custom color', 'super-duper' ),
361
+                'placeholder'     => '',
362
+                'default'         => '#0073aa',
363
+                'desc_tip'        => true,
364
+                'group'           => __( 'Background', 'super-duper' ),
365
+                'element_require' => '[%' . $type . '%]=="custom-color"',
366
+            )
367
+        );
368
+    }
369
+
370
+    if ( $overwrite_gradient !== false ) {
371
+        $input[ $type . '_gradient' ] = wp_parse_args(
372
+            $overwrite_gradient,
373
+            array(
374
+                'type'            => 'gradient',
375
+                'title'           => __( 'Custom gradient', 'super-duper' ),
376
+                'placeholder'     => '',
377
+                'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
378
+                'desc_tip'        => true,
379
+                'group'           => __( 'Background', 'super-duper' ),
380
+                'element_require' => '[%' . $type . '%]=="custom-gradient"',
381
+            )
382
+        );
383
+    }
384
+
385
+    if ( $overwrite_image !== false ) {
386
+
387
+        $input[ $type . '_image_fixed' ] = array(
388
+            'type'            => 'checkbox',
389
+            'title'           => __( 'Fixed background', 'super-duper' ),
390
+            'default'         => '',
391
+            'desc_tip'        => true,
392
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
393
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
394
+
395
+        );
396
+
397
+        $input[ $type . '_image_use_featured' ] = array(
398
+            'type'            => 'checkbox',
399
+            'title'           => __( 'Use featured image', 'super-duper' ),
400
+            'default'         => '',
401
+            'desc_tip'        => true,
402
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
403
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
404
+
405
+        );
406
+
407
+        $input[ $type . '_image' ] = wp_parse_args(
408
+            $overwrite_image,
409
+            array(
410
+                'type'        => 'image',
411
+                'title'       => __( 'Custom image', 'super-duper' ),
412
+                'placeholder' => '',
413
+                'default'     => '',
414
+                'desc_tip'    => true,
415
+                'group'       => __( 'Background', 'super-duper' ),
416
+                //          'element_require' => ' ![%' . $type . '_image_use_featured%] '
417
+            )
418
+        );
419
+
420
+        $input[ $type . '_image_id' ] = wp_parse_args(
421
+            $overwrite_image,
422
+            array(
423
+                'type'        => 'hidden',
424
+                'hidden_type' => 'number',
425
+                'title'       => '',
426
+                'placeholder' => '',
427
+                'default'     => '',
428
+                'group'       => __( 'Background', 'super-duper' ),
429
+            )
430
+        );
431
+
432
+        $input[ $type . '_image_xy' ] = wp_parse_args(
433
+            $overwrite_image,
434
+            array(
435
+                'type'        => 'image_xy',
436
+                'title'       => '',
437
+                'placeholder' => '',
438
+                'default'     => '',
439
+                'group'       => __( 'Background', 'super-duper' ),
440
+            )
441
+        );
442
+    }
443
+
444
+    return $input;
445 445
 }
446 446
 
447 447
 /**
@@ -454,175 +454,175 @@  discard block
 block discarded – undo
454 454
  */
455 455
 function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
456 456
 
457
-	$options = array(
458
-		''                      => __( 'None', 'super-duper' ),
459
-		'mountains'             => __( 'Mountains', 'super-duper' ),
460
-		'drops'                 => __( 'Drops', 'super-duper' ),
461
-		'clouds'                => __( 'Clouds', 'super-duper' ),
462
-		'zigzag'                => __( 'Zigzag', 'super-duper' ),
463
-		'pyramids'              => __( 'Pyramids', 'super-duper' ),
464
-		'triangle'              => __( 'Triangle', 'super-duper' ),
465
-		'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
466
-		'tilt'                  => __( 'Tilt', 'super-duper' ),
467
-		'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
468
-		'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
469
-		'curve'                 => __( 'Curve', 'super-duper' ),
470
-		'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
471
-		'waves'                 => __( 'Waves', 'super-duper' ),
472
-		'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
473
-		'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
474
-		'arrow'                 => __( 'Arrow', 'super-duper' ),
475
-		'split'                 => __( 'Split', 'super-duper' ),
476
-		'book'                  => __( 'Book', 'super-duper' ),
477
-	);
478
-
479
-	$defaults = array(
480
-		'type'     => 'select',
481
-		'title'    => __( 'Type', 'super-duper' ),
482
-		'options'  => $options,
483
-		'default'  => '',
484
-		'desc_tip' => true,
485
-		'group'    => __( 'Shape Divider', 'super-duper' ),
486
-	);
487
-
488
-	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
489
-
490
-	$input[ $type . '_notice' ] = array(
491
-		'type'            => 'notice',
492
-		'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
493
-		'status'          => 'warning',
494
-		'group'           => __( 'Shape Divider', 'super-duper' ),
495
-		'element_require' => '[%' . $type . '%]!=""',
496
-	);
497
-
498
-	$input[ $type . '_position' ] = wp_parse_args(
499
-		$overwrite_color,
500
-		array(
501
-			'type'            => 'select',
502
-			'title'           => __( 'Position', 'super-duper' ),
503
-			'options'         => array(
504
-				'top'    => __( 'Top', 'super-duper' ),
505
-				'bottom' => __( 'Bottom', 'super-duper' ),
506
-			),
507
-			'desc_tip'        => true,
508
-			'group'           => __( 'Shape Divider', 'super-duper' ),
509
-			'element_require' => '[%' . $type . '%]!=""',
510
-		)
511
-	);
512
-
513
-	$options = array(
514
-		           ''            => __( 'None', 'super-duper' ),
515
-		           'transparent' => __( 'Transparent', 'super-duper' ),
516
-	           ) + sd_aui_colors()
517
-	           + array(
518
-		           'custom-color' => __( 'Custom Color', 'super-duper' ),
519
-	           );
520
-
521
-	$input[ $type . '_color' ] = wp_parse_args(
522
-		$overwrite_color,
523
-		array(
524
-			'type'            => 'select',
525
-			'title'           => __( 'Color', 'super-duper' ),
526
-			'options'         => $options,
527
-			'desc_tip'        => true,
528
-			'group'           => __( 'Shape Divider', 'super-duper' ),
529
-			'element_require' => '[%' . $type . '%]!=""',
530
-		)
531
-	);
532
-
533
-	$input[ $type . '_custom_color' ] = wp_parse_args(
534
-		$overwrite_color,
535
-		array(
536
-			'type'            => 'color',
537
-			'title'           => __( 'Custom color', 'super-duper' ),
538
-			'placeholder'     => '',
539
-			'default'         => '#0073aa',
540
-			'desc_tip'        => true,
541
-			'group'           => __( 'Shape Divider', 'super-duper' ),
542
-			'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
543
-		)
544
-	);
545
-
546
-	$input[ $type . '_width' ] = wp_parse_args(
547
-		$overwrite_gradient,
548
-		array(
549
-			'type'              => 'range',
550
-			'title'             => __( 'Width', 'super-duper' ),
551
-			'placeholder'       => '',
552
-			'default'           => '200',
553
-			'desc_tip'          => true,
554
-			'custom_attributes' => array(
555
-				'min' => 100,
556
-				'max' => 300,
557
-			),
558
-			'group'             => __( 'Shape Divider', 'super-duper' ),
559
-			'element_require'   => '[%' . $type . '%]!=""',
560
-		)
561
-	);
562
-
563
-	$input[ $type . '_height' ] = array(
564
-		'type'              => 'range',
565
-		'title'             => __( 'Height', 'super-duper' ),
566
-		'default'           => '100',
567
-		'desc_tip'          => true,
568
-		'custom_attributes' => array(
569
-			'min' => 0,
570
-			'max' => 500,
571
-		),
572
-		'group'             => __( 'Shape Divider', 'super-duper' ),
573
-		'element_require'   => '[%' . $type . '%]!=""',
574
-	);
575
-
576
-	$requires = array(
577
-		'mountains'             => array( 'flip' ),
578
-		'drops'                 => array( 'flip', 'invert' ),
579
-		'clouds'                => array( 'flip', 'invert' ),
580
-		'zigzag'                => array(),
581
-		'pyramids'              => array( 'flip', 'invert' ),
582
-		'triangle'              => array( 'invert' ),
583
-		'triangle-asymmetrical' => array( 'flip', 'invert' ),
584
-		'tilt'                  => array( 'flip' ),
585
-		'opacity-tilt'          => array( 'flip' ),
586
-		'opacity-fan'           => array(),
587
-		'curve'                 => array( 'invert' ),
588
-		'curve-asymmetrical'    => array( 'flip', 'invert' ),
589
-		'waves'                 => array( 'flip', 'invert' ),
590
-		'wave-brush'            => array( 'flip' ),
591
-		'waves-pattern'         => array( 'flip' ),
592
-		'arrow'                 => array( 'invert' ),
593
-		'split'                 => array( 'invert' ),
594
-		'book'                  => array( 'invert' ),
595
-	);
596
-
597
-	$input[ $type . '_flip' ] = array(
598
-		'type'            => 'checkbox',
599
-		'title'           => __( 'Flip', 'super-duper' ),
600
-		'default'         => '',
601
-		'desc_tip'        => true,
602
-		'group'           => __( 'Shape Divider', 'super-duper' ),
603
-		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
604
-	);
605
-
606
-	$input[ $type . '_invert' ] = array(
607
-		'type'            => 'checkbox',
608
-		'title'           => __( 'Invert', 'super-duper' ),
609
-		'default'         => '',
610
-		'desc_tip'        => true,
611
-		'group'           => __( 'Shape Divider', 'super-duper' ),
612
-		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
613
-	);
614
-
615
-	$input[ $type . '_btf' ] = array(
616
-		'type'            => 'checkbox',
617
-		'title'           => __( 'Bring to front', 'super-duper' ),
618
-		'default'         => '',
619
-		'desc_tip'        => true,
620
-		'group'           => __( 'Shape Divider', 'super-duper' ),
621
-		'element_require' => '[%' . $type . '%]!=""',
622
-
623
-	);
624
-
625
-	return $input;
457
+    $options = array(
458
+        ''                      => __( 'None', 'super-duper' ),
459
+        'mountains'             => __( 'Mountains', 'super-duper' ),
460
+        'drops'                 => __( 'Drops', 'super-duper' ),
461
+        'clouds'                => __( 'Clouds', 'super-duper' ),
462
+        'zigzag'                => __( 'Zigzag', 'super-duper' ),
463
+        'pyramids'              => __( 'Pyramids', 'super-duper' ),
464
+        'triangle'              => __( 'Triangle', 'super-duper' ),
465
+        'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
466
+        'tilt'                  => __( 'Tilt', 'super-duper' ),
467
+        'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
468
+        'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
469
+        'curve'                 => __( 'Curve', 'super-duper' ),
470
+        'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
471
+        'waves'                 => __( 'Waves', 'super-duper' ),
472
+        'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
473
+        'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
474
+        'arrow'                 => __( 'Arrow', 'super-duper' ),
475
+        'split'                 => __( 'Split', 'super-duper' ),
476
+        'book'                  => __( 'Book', 'super-duper' ),
477
+    );
478
+
479
+    $defaults = array(
480
+        'type'     => 'select',
481
+        'title'    => __( 'Type', 'super-duper' ),
482
+        'options'  => $options,
483
+        'default'  => '',
484
+        'desc_tip' => true,
485
+        'group'    => __( 'Shape Divider', 'super-duper' ),
486
+    );
487
+
488
+    $input[ $type ] = wp_parse_args( $overwrite, $defaults );
489
+
490
+    $input[ $type . '_notice' ] = array(
491
+        'type'            => 'notice',
492
+        'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
493
+        'status'          => 'warning',
494
+        'group'           => __( 'Shape Divider', 'super-duper' ),
495
+        'element_require' => '[%' . $type . '%]!=""',
496
+    );
497
+
498
+    $input[ $type . '_position' ] = wp_parse_args(
499
+        $overwrite_color,
500
+        array(
501
+            'type'            => 'select',
502
+            'title'           => __( 'Position', 'super-duper' ),
503
+            'options'         => array(
504
+                'top'    => __( 'Top', 'super-duper' ),
505
+                'bottom' => __( 'Bottom', 'super-duper' ),
506
+            ),
507
+            'desc_tip'        => true,
508
+            'group'           => __( 'Shape Divider', 'super-duper' ),
509
+            'element_require' => '[%' . $type . '%]!=""',
510
+        )
511
+    );
512
+
513
+    $options = array(
514
+                    ''            => __( 'None', 'super-duper' ),
515
+                    'transparent' => __( 'Transparent', 'super-duper' ),
516
+                ) + sd_aui_colors()
517
+               + array(
518
+                    'custom-color' => __( 'Custom Color', 'super-duper' ),
519
+                );
520
+
521
+    $input[ $type . '_color' ] = wp_parse_args(
522
+        $overwrite_color,
523
+        array(
524
+            'type'            => 'select',
525
+            'title'           => __( 'Color', 'super-duper' ),
526
+            'options'         => $options,
527
+            'desc_tip'        => true,
528
+            'group'           => __( 'Shape Divider', 'super-duper' ),
529
+            'element_require' => '[%' . $type . '%]!=""',
530
+        )
531
+    );
532
+
533
+    $input[ $type . '_custom_color' ] = wp_parse_args(
534
+        $overwrite_color,
535
+        array(
536
+            'type'            => 'color',
537
+            'title'           => __( 'Custom color', 'super-duper' ),
538
+            'placeholder'     => '',
539
+            'default'         => '#0073aa',
540
+            'desc_tip'        => true,
541
+            'group'           => __( 'Shape Divider', 'super-duper' ),
542
+            'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
543
+        )
544
+    );
545
+
546
+    $input[ $type . '_width' ] = wp_parse_args(
547
+        $overwrite_gradient,
548
+        array(
549
+            'type'              => 'range',
550
+            'title'             => __( 'Width', 'super-duper' ),
551
+            'placeholder'       => '',
552
+            'default'           => '200',
553
+            'desc_tip'          => true,
554
+            'custom_attributes' => array(
555
+                'min' => 100,
556
+                'max' => 300,
557
+            ),
558
+            'group'             => __( 'Shape Divider', 'super-duper' ),
559
+            'element_require'   => '[%' . $type . '%]!=""',
560
+        )
561
+    );
562
+
563
+    $input[ $type . '_height' ] = array(
564
+        'type'              => 'range',
565
+        'title'             => __( 'Height', 'super-duper' ),
566
+        'default'           => '100',
567
+        'desc_tip'          => true,
568
+        'custom_attributes' => array(
569
+            'min' => 0,
570
+            'max' => 500,
571
+        ),
572
+        'group'             => __( 'Shape Divider', 'super-duper' ),
573
+        'element_require'   => '[%' . $type . '%]!=""',
574
+    );
575
+
576
+    $requires = array(
577
+        'mountains'             => array( 'flip' ),
578
+        'drops'                 => array( 'flip', 'invert' ),
579
+        'clouds'                => array( 'flip', 'invert' ),
580
+        'zigzag'                => array(),
581
+        'pyramids'              => array( 'flip', 'invert' ),
582
+        'triangle'              => array( 'invert' ),
583
+        'triangle-asymmetrical' => array( 'flip', 'invert' ),
584
+        'tilt'                  => array( 'flip' ),
585
+        'opacity-tilt'          => array( 'flip' ),
586
+        'opacity-fan'           => array(),
587
+        'curve'                 => array( 'invert' ),
588
+        'curve-asymmetrical'    => array( 'flip', 'invert' ),
589
+        'waves'                 => array( 'flip', 'invert' ),
590
+        'wave-brush'            => array( 'flip' ),
591
+        'waves-pattern'         => array( 'flip' ),
592
+        'arrow'                 => array( 'invert' ),
593
+        'split'                 => array( 'invert' ),
594
+        'book'                  => array( 'invert' ),
595
+    );
596
+
597
+    $input[ $type . '_flip' ] = array(
598
+        'type'            => 'checkbox',
599
+        'title'           => __( 'Flip', 'super-duper' ),
600
+        'default'         => '',
601
+        'desc_tip'        => true,
602
+        'group'           => __( 'Shape Divider', 'super-duper' ),
603
+        'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
604
+    );
605
+
606
+    $input[ $type . '_invert' ] = array(
607
+        'type'            => 'checkbox',
608
+        'title'           => __( 'Invert', 'super-duper' ),
609
+        'default'         => '',
610
+        'desc_tip'        => true,
611
+        'group'           => __( 'Shape Divider', 'super-duper' ),
612
+        'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
613
+    );
614
+
615
+    $input[ $type . '_btf' ] = array(
616
+        'type'            => 'checkbox',
617
+        'title'           => __( 'Bring to front', 'super-duper' ),
618
+        'default'         => '',
619
+        'desc_tip'        => true,
620
+        'group'           => __( 'Shape Divider', 'super-duper' ),
621
+        'element_require' => '[%' . $type . '%]!=""',
622
+
623
+    );
624
+
625
+    return $input;
626 626
 }
627 627
 
628 628
 /**
@@ -635,22 +635,22 @@  discard block
 block discarded – undo
635 635
  * @return string
636 636
  */
637 637
 function sd_get_element_require_string( $args, $key, $type ) {
638
-	$output   = '';
639
-	$requires = array();
640
-
641
-	if ( ! empty( $args ) ) {
642
-		foreach ( $args as $t => $k ) {
643
-			if ( in_array( $key, $k ) ) {
644
-				$requires[] = '[%' . $type . '%]=="' . $t . '"';
645
-			}
646
-		}
647
-
648
-		if ( ! empty( $requires ) ) {
649
-			$output = '(' . implode( ' || ', $requires ) . ')';
650
-		}
651
-	}
652
-
653
-	return $output;
638
+    $output   = '';
639
+    $requires = array();
640
+
641
+    if ( ! empty( $args ) ) {
642
+        foreach ( $args as $t => $k ) {
643
+            if ( in_array( $key, $k ) ) {
644
+                $requires[] = '[%' . $type . '%]=="' . $t . '"';
645
+            }
646
+        }
647
+
648
+        if ( ! empty( $requires ) ) {
649
+            $output = '(' . implode( ' || ', $requires ) . ')';
650
+        }
651
+    }
652
+
653
+    return $output;
654 654
 }
655 655
 
656 656
 /**
@@ -662,41 +662,41 @@  discard block
 block discarded – undo
662 662
  * @return array
663 663
  */
664 664
 function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) {
665
-	$options = array(
666
-		           '' => __( 'None', 'super-duper' ),
667
-	           ) + sd_aui_colors();
668
-
669
-	if ( $has_custom ) {
670
-		$options['custom'] = __( 'Custom color', 'super-duper' );
671
-	}
672
-
673
-	$defaults = array(
674
-		'type'     => 'select',
675
-		'title'    => __( 'Text color', 'super-duper' ),
676
-		'options'  => $options,
677
-		'default'  => '',
678
-		'desc_tip' => true,
679
-		'group'    => __( 'Typography', 'super-duper' ),
680
-	);
681
-
682
-	$input = wp_parse_args( $overwrite, $defaults );
683
-
684
-	return $input;
665
+    $options = array(
666
+                    '' => __( 'None', 'super-duper' ),
667
+                ) + sd_aui_colors();
668
+
669
+    if ( $has_custom ) {
670
+        $options['custom'] = __( 'Custom color', 'super-duper' );
671
+    }
672
+
673
+    $defaults = array(
674
+        'type'     => 'select',
675
+        'title'    => __( 'Text color', 'super-duper' ),
676
+        'options'  => $options,
677
+        'default'  => '',
678
+        'desc_tip' => true,
679
+        'group'    => __( 'Typography', 'super-duper' ),
680
+    );
681
+
682
+    $input = wp_parse_args( $overwrite, $defaults );
683
+
684
+    return $input;
685 685
 }
686 686
 
687 687
 function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) {
688
-	$inputs = array();
688
+    $inputs = array();
689 689
 
690
-	if ( $overwrite !== false ) {
691
-		$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
692
-	}
690
+    if ( $overwrite !== false ) {
691
+        $inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
692
+    }
693 693
 
694
-	if ( $overwrite_custom !== false ) {
695
-		$custom            = $type . '_custom';
696
-		$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
697
-	}
694
+    if ( $overwrite_custom !== false ) {
695
+        $custom            = $type . '_custom';
696
+        $inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
697
+    }
698 698
 
699
-	return $inputs;
699
+    return $inputs;
700 700
 }
701 701
 
702 702
 /**
@@ -709,22 +709,22 @@  discard block
 block discarded – undo
709 709
  */
710 710
 function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) {
711 711
 
712
-	$defaults = array(
713
-		'type'        => 'color',
714
-		'title'       => __( 'Custom color', 'super-duper' ),
715
-		'default'     => '',
716
-		'placeholder' => '',
717
-		'desc_tip'    => true,
718
-		'group'       => __( 'Typography', 'super-duper' ),
719
-	);
712
+    $defaults = array(
713
+        'type'        => 'color',
714
+        'title'       => __( 'Custom color', 'super-duper' ),
715
+        'default'     => '',
716
+        'placeholder' => '',
717
+        'desc_tip'    => true,
718
+        'group'       => __( 'Typography', 'super-duper' ),
719
+    );
720 720
 
721
-	if ( $parent_type ) {
722
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
723
-	}
721
+    if ( $parent_type ) {
722
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
723
+    }
724 724
 
725
-	$input = wp_parse_args( $overwrite, $defaults );
725
+    $input = wp_parse_args( $overwrite, $defaults );
726 726
 
727
-	return $input;
727
+    return $input;
728 728
 }
729 729
 
730 730
 /**
@@ -737,43 +737,43 @@  discard block
 block discarded – undo
737 737
  */
738 738
 function sd_get_col_input( $type = 'col', $overwrite = array() ) {
739 739
 
740
-	$device_size = '';
741
-	if ( ! empty( $overwrite['device_type'] ) ) {
742
-		if ( $overwrite['device_type'] == 'Tablet' ) {
743
-			$device_size = '-md';
744
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
745
-			$device_size = '-lg';
746
-		}
747
-	}
748
-	$options = array(
749
-		''   => __( 'auto', 'super-duper' ),
750
-		'1'  => '1/12',
751
-		'2'  => '2/12',
752
-		'3'  => '3/12',
753
-		'4'  => '4/12',
754
-		'5'  => '5/12',
755
-		'6'  => '6/12',
756
-		'7'  => '7/12',
757
-		'8'  => '8/12',
758
-		'9'  => '9/12',
759
-		'10' => '10/12',
760
-		'11' => '11/12',
761
-		'12' => '12/12',
762
-	);
763
-
764
-	$defaults = array(
765
-		'type'            => 'select',
766
-		'title'           => __( 'Column width', 'super-duper' ),
767
-		'options'         => $options,
768
-		'default'         => '',
769
-		'desc_tip'        => true,
770
-		'group'           => __( 'Container', 'super-duper' ),
771
-		'element_require' => '[%container%]=="col"',
772
-	);
773
-
774
-	$input = wp_parse_args( $overwrite, $defaults );
775
-
776
-	return $input;
740
+    $device_size = '';
741
+    if ( ! empty( $overwrite['device_type'] ) ) {
742
+        if ( $overwrite['device_type'] == 'Tablet' ) {
743
+            $device_size = '-md';
744
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
745
+            $device_size = '-lg';
746
+        }
747
+    }
748
+    $options = array(
749
+        ''   => __( 'auto', 'super-duper' ),
750
+        '1'  => '1/12',
751
+        '2'  => '2/12',
752
+        '3'  => '3/12',
753
+        '4'  => '4/12',
754
+        '5'  => '5/12',
755
+        '6'  => '6/12',
756
+        '7'  => '7/12',
757
+        '8'  => '8/12',
758
+        '9'  => '9/12',
759
+        '10' => '10/12',
760
+        '11' => '11/12',
761
+        '12' => '12/12',
762
+    );
763
+
764
+    $defaults = array(
765
+        'type'            => 'select',
766
+        'title'           => __( 'Column width', 'super-duper' ),
767
+        'options'         => $options,
768
+        'default'         => '',
769
+        'desc_tip'        => true,
770
+        'group'           => __( 'Container', 'super-duper' ),
771
+        'element_require' => '[%container%]=="col"',
772
+    );
773
+
774
+    $input = wp_parse_args( $overwrite, $defaults );
775
+
776
+    return $input;
777 777
 }
778 778
 
779 779
 /**
@@ -786,37 +786,37 @@  discard block
 block discarded – undo
786 786
  */
787 787
 function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
788 788
 
789
-	$device_size = '';
790
-	if ( ! empty( $overwrite['device_type'] ) ) {
791
-		if ( $overwrite['device_type'] == 'Tablet' ) {
792
-			$device_size = '-md';
793
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
794
-			$device_size = '-lg';
795
-		}
796
-	}
797
-	$options = array(
798
-		''  => __( 'auto', 'super-duper' ),
799
-		'1' => '1',
800
-		'2' => '2',
801
-		'3' => '3',
802
-		'4' => '4',
803
-		'5' => '5',
804
-		'6' => '6',
805
-	);
806
-
807
-	$defaults = array(
808
-		'type'            => 'select',
809
-		'title'           => __( 'Row columns', 'super-duper' ),
810
-		'options'         => $options,
811
-		'default'         => '',
812
-		'desc_tip'        => true,
813
-		'group'           => __( 'Container', 'super-duper' ),
814
-		'element_require' => '[%container%]=="row"',
815
-	);
816
-
817
-	$input = wp_parse_args( $overwrite, $defaults );
818
-
819
-	return $input;
789
+    $device_size = '';
790
+    if ( ! empty( $overwrite['device_type'] ) ) {
791
+        if ( $overwrite['device_type'] == 'Tablet' ) {
792
+            $device_size = '-md';
793
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
794
+            $device_size = '-lg';
795
+        }
796
+    }
797
+    $options = array(
798
+        ''  => __( 'auto', 'super-duper' ),
799
+        '1' => '1',
800
+        '2' => '2',
801
+        '3' => '3',
802
+        '4' => '4',
803
+        '5' => '5',
804
+        '6' => '6',
805
+    );
806
+
807
+    $defaults = array(
808
+        'type'            => 'select',
809
+        'title'           => __( 'Row columns', 'super-duper' ),
810
+        'options'         => $options,
811
+        'default'         => '',
812
+        'desc_tip'        => true,
813
+        'group'           => __( 'Container', 'super-duper' ),
814
+        'element_require' => '[%container%]=="row"',
815
+    );
816
+
817
+    $input = wp_parse_args( $overwrite, $defaults );
818
+
819
+    return $input;
820 820
 }
821 821
 
822 822
 /**
@@ -829,33 +829,33 @@  discard block
 block discarded – undo
829 829
  */
830 830
 function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
831 831
 
832
-	$device_size = '';
833
-	if ( ! empty( $overwrite['device_type'] ) ) {
834
-		if ( $overwrite['device_type'] == 'Tablet' ) {
835
-			$device_size = '-md';
836
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
837
-			$device_size = '-lg';
838
-		}
839
-	}
840
-	$options = array(
841
-		''                                => __( 'Default', 'super-duper' ),
842
-		'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
843
-		'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
844
-		'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
845
-	);
846
-
847
-	$defaults = array(
848
-		'type'     => 'select',
849
-		'title'    => __( 'Text align', 'super-duper' ),
850
-		'options'  => $options,
851
-		'default'  => '',
852
-		'desc_tip' => true,
853
-		'group'    => __( 'Typography', 'super-duper' ),
854
-	);
855
-
856
-	$input = wp_parse_args( $overwrite, $defaults );
857
-
858
-	return $input;
832
+    $device_size = '';
833
+    if ( ! empty( $overwrite['device_type'] ) ) {
834
+        if ( $overwrite['device_type'] == 'Tablet' ) {
835
+            $device_size = '-md';
836
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
837
+            $device_size = '-lg';
838
+        }
839
+    }
840
+    $options = array(
841
+        ''                                => __( 'Default', 'super-duper' ),
842
+        'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
843
+        'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
844
+        'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
845
+    );
846
+
847
+    $defaults = array(
848
+        'type'     => 'select',
849
+        'title'    => __( 'Text align', 'super-duper' ),
850
+        'options'  => $options,
851
+        'default'  => '',
852
+        'desc_tip' => true,
853
+        'group'    => __( 'Typography', 'super-duper' ),
854
+    );
855
+
856
+    $input = wp_parse_args( $overwrite, $defaults );
857
+
858
+    return $input;
859 859
 }
860 860
 
861 861
 /**
@@ -868,39 +868,39 @@  discard block
 block discarded – undo
868 868
  */
869 869
 function sd_get_display_input( $type = 'display', $overwrite = array() ) {
870 870
 
871
-	$device_size = '';
872
-	if ( ! empty( $overwrite['device_type'] ) ) {
873
-		if ( $overwrite['device_type'] == 'Tablet' ) {
874
-			$device_size = '-md';
875
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
876
-			$device_size = '-lg';
877
-		}
878
-	}
879
-	$options = array(
880
-		''                                   => __( 'Default', 'super-duper' ),
881
-		'd' . $device_size . '-none'         => 'none',
882
-		'd' . $device_size . '-inline'       => 'inline',
883
-		'd' . $device_size . '-inline-block' => 'inline-block',
884
-		'd' . $device_size . '-block'        => 'block',
885
-		'd' . $device_size . '-table'        => 'table',
886
-		'd' . $device_size . '-table-cell'   => 'table-cell',
887
-		'd' . $device_size . '-table-row'    => 'table-row',
888
-		'd' . $device_size . '-flex'         => 'flex',
889
-		'd' . $device_size . '-inline-flex'  => 'inline-flex',
890
-	);
891
-
892
-	$defaults = array(
893
-		'type'     => 'select',
894
-		'title'    => __( 'Display', 'super-duper' ),
895
-		'options'  => $options,
896
-		'default'  => '',
897
-		'desc_tip' => true,
898
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
899
-	);
900
-
901
-	$input = wp_parse_args( $overwrite, $defaults );
902
-
903
-	return $input;
871
+    $device_size = '';
872
+    if ( ! empty( $overwrite['device_type'] ) ) {
873
+        if ( $overwrite['device_type'] == 'Tablet' ) {
874
+            $device_size = '-md';
875
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
876
+            $device_size = '-lg';
877
+        }
878
+    }
879
+    $options = array(
880
+        ''                                   => __( 'Default', 'super-duper' ),
881
+        'd' . $device_size . '-none'         => 'none',
882
+        'd' . $device_size . '-inline'       => 'inline',
883
+        'd' . $device_size . '-inline-block' => 'inline-block',
884
+        'd' . $device_size . '-block'        => 'block',
885
+        'd' . $device_size . '-table'        => 'table',
886
+        'd' . $device_size . '-table-cell'   => 'table-cell',
887
+        'd' . $device_size . '-table-row'    => 'table-row',
888
+        'd' . $device_size . '-flex'         => 'flex',
889
+        'd' . $device_size . '-inline-flex'  => 'inline-flex',
890
+    );
891
+
892
+    $defaults = array(
893
+        'type'     => 'select',
894
+        'title'    => __( 'Display', 'super-duper' ),
895
+        'options'  => $options,
896
+        'default'  => '',
897
+        'desc_tip' => true,
898
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
899
+    );
900
+
901
+    $input = wp_parse_args( $overwrite, $defaults );
902
+
903
+    return $input;
904 904
 }
905 905
 
906 906
 /**
@@ -913,17 +913,17 @@  discard block
 block discarded – undo
913 913
  */
914 914
 function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
915 915
 
916
-	$defaults = array(
917
-		'type'     => 'checkbox',
918
-		'title'    => __( 'Text justify', 'super-duper' ),
919
-		'default'  => '',
920
-		'desc_tip' => true,
921
-		'group'    => __( 'Typography', 'super-duper' ),
922
-	);
916
+    $defaults = array(
917
+        'type'     => 'checkbox',
918
+        'title'    => __( 'Text justify', 'super-duper' ),
919
+        'default'  => '',
920
+        'desc_tip' => true,
921
+        'group'    => __( 'Typography', 'super-duper' ),
922
+    );
923 923
 
924
-	$input = wp_parse_args( $overwrite, $defaults );
924
+    $input = wp_parse_args( $overwrite, $defaults );
925 925
 
926
-	return $input;
926
+    return $input;
927 927
 }
928 928
 
929 929
 /**
@@ -936,50 +936,50 @@  discard block
 block discarded – undo
936 936
  * @return array
937 937
  */
938 938
 function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) {
939
-	$theme_colors = array();
940
-
941
-	$theme_colors['primary']   = __( 'Primary', 'super-duper' );
942
-	$theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
943
-	$theme_colors['success']   = __( 'Success', 'super-duper' );
944
-	$theme_colors['danger']    = __( 'Danger', 'super-duper' );
945
-	$theme_colors['warning']   = __( 'Warning', 'super-duper' );
946
-	$theme_colors['info']      = __( 'Info', 'super-duper' );
947
-	$theme_colors['light']     = __( 'Light', 'super-duper' );
948
-	$theme_colors['dark']      = __( 'Dark', 'super-duper' );
949
-	$theme_colors['white']     = __( 'White', 'super-duper' );
950
-	$theme_colors['purple']    = __( 'Purple', 'super-duper' );
951
-	$theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
952
-	$theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
953
-	$theme_colors['gray']      = __( 'Gray', 'super-duper' );
954
-	$theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
955
-	$theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
956
-	$theme_colors['orange']    = __( 'Orange', 'super-duper' );
957
-
958
-	if ( $include_outlines ) {
959
-		$button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
960
-		$theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
961
-		$theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
962
-		$theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
963
-		$theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
964
-		$theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
965
-		$theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
966
-		$theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
967
-		$theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
968
-		$theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
969
-		$theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
970
-		$theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
971
-		$theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
972
-		$theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
973
-		$theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
974
-		$theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
975
-		$theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
976
-	}
977
-
978
-	if ( $include_branding ) {
979
-		$theme_colors = $theme_colors + sd_aui_branding_colors();
980
-	}
981
-
982
-	return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
939
+    $theme_colors = array();
940
+
941
+    $theme_colors['primary']   = __( 'Primary', 'super-duper' );
942
+    $theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
943
+    $theme_colors['success']   = __( 'Success', 'super-duper' );
944
+    $theme_colors['danger']    = __( 'Danger', 'super-duper' );
945
+    $theme_colors['warning']   = __( 'Warning', 'super-duper' );
946
+    $theme_colors['info']      = __( 'Info', 'super-duper' );
947
+    $theme_colors['light']     = __( 'Light', 'super-duper' );
948
+    $theme_colors['dark']      = __( 'Dark', 'super-duper' );
949
+    $theme_colors['white']     = __( 'White', 'super-duper' );
950
+    $theme_colors['purple']    = __( 'Purple', 'super-duper' );
951
+    $theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
952
+    $theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
953
+    $theme_colors['gray']      = __( 'Gray', 'super-duper' );
954
+    $theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
955
+    $theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
956
+    $theme_colors['orange']    = __( 'Orange', 'super-duper' );
957
+
958
+    if ( $include_outlines ) {
959
+        $button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
960
+        $theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
961
+        $theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
962
+        $theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
963
+        $theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
964
+        $theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
965
+        $theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
966
+        $theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
967
+        $theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
968
+        $theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
969
+        $theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
970
+        $theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
971
+        $theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
972
+        $theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
973
+        $theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
974
+        $theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
975
+        $theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
976
+    }
977
+
978
+    if ( $include_branding ) {
979
+        $theme_colors = $theme_colors + sd_aui_branding_colors();
980
+    }
981
+
982
+    return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
983 983
 }
984 984
 
985 985
 /**
@@ -988,19 +988,19 @@  discard block
 block discarded – undo
988 988
  * @return array
989 989
  */
990 990
 function sd_aui_branding_colors() {
991
-	return array(
992
-		'facebook'  => __( 'Facebook', 'super-duper' ),
993
-		'twitter'   => __( 'Twitter', 'super-duper' ),
994
-		'instagram' => __( 'Instagram', 'super-duper' ),
995
-		'linkedin'  => __( 'Linkedin', 'super-duper' ),
996
-		'flickr'    => __( 'Flickr', 'super-duper' ),
997
-		'github'    => __( 'GitHub', 'super-duper' ),
998
-		'youtube'   => __( 'YouTube', 'super-duper' ),
999
-		'wordpress' => __( 'WordPress', 'super-duper' ),
1000
-		'google'    => __( 'Google', 'super-duper' ),
1001
-		'yahoo'     => __( 'Yahoo', 'super-duper' ),
1002
-		'vkontakte' => __( 'Vkontakte', 'super-duper' ),
1003
-	);
991
+    return array(
992
+        'facebook'  => __( 'Facebook', 'super-duper' ),
993
+        'twitter'   => __( 'Twitter', 'super-duper' ),
994
+        'instagram' => __( 'Instagram', 'super-duper' ),
995
+        'linkedin'  => __( 'Linkedin', 'super-duper' ),
996
+        'flickr'    => __( 'Flickr', 'super-duper' ),
997
+        'github'    => __( 'GitHub', 'super-duper' ),
998
+        'youtube'   => __( 'YouTube', 'super-duper' ),
999
+        'wordpress' => __( 'WordPress', 'super-duper' ),
1000
+        'google'    => __( 'Google', 'super-duper' ),
1001
+        'yahoo'     => __( 'Yahoo', 'super-duper' ),
1002
+        'vkontakte' => __( 'Vkontakte', 'super-duper' ),
1003
+    );
1004 1004
 }
1005 1005
 
1006 1006
 
@@ -1014,36 +1014,36 @@  discard block
 block discarded – undo
1014 1014
  */
1015 1015
 function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
1016 1016
 
1017
-	$options = array(
1018
-		'container'       => __( 'container (default)', 'super-duper' ),
1019
-		'container-sm'    => 'container-sm',
1020
-		'container-md'    => 'container-md',
1021
-		'container-lg'    => 'container-lg',
1022
-		'container-xl'    => 'container-xl',
1023
-		'container-xxl'   => 'container-xxl',
1024
-		'container-fluid' => 'container-fluid',
1025
-		'row'             => 'row',
1026
-		'col'             => 'col',
1027
-		'card'            => 'card',
1028
-		'card-header'     => 'card-header',
1029
-		'card-body'       => 'card-body',
1030
-		'card-footer'     => 'card-footer',
1031
-		'list-group'      => 'list-group',
1032
-		'list-group-item' => 'list-group-item',
1033
-	);
1034
-
1035
-	$defaults = array(
1036
-		'type'     => 'select',
1037
-		'title'    => __( 'Type', 'super-duper' ),
1038
-		'options'  => $options,
1039
-		'default'  => '',
1040
-		'desc_tip' => true,
1041
-		'group'    => __( 'Container', 'super-duper' ),
1042
-	);
1043
-
1044
-	$input = wp_parse_args( $overwrite, $defaults );
1045
-
1046
-	return $input;
1017
+    $options = array(
1018
+        'container'       => __( 'container (default)', 'super-duper' ),
1019
+        'container-sm'    => 'container-sm',
1020
+        'container-md'    => 'container-md',
1021
+        'container-lg'    => 'container-lg',
1022
+        'container-xl'    => 'container-xl',
1023
+        'container-xxl'   => 'container-xxl',
1024
+        'container-fluid' => 'container-fluid',
1025
+        'row'             => 'row',
1026
+        'col'             => 'col',
1027
+        'card'            => 'card',
1028
+        'card-header'     => 'card-header',
1029
+        'card-body'       => 'card-body',
1030
+        'card-footer'     => 'card-footer',
1031
+        'list-group'      => 'list-group',
1032
+        'list-group-item' => 'list-group-item',
1033
+    );
1034
+
1035
+    $defaults = array(
1036
+        'type'     => 'select',
1037
+        'title'    => __( 'Type', 'super-duper' ),
1038
+        'options'  => $options,
1039
+        'default'  => '',
1040
+        'desc_tip' => true,
1041
+        'group'    => __( 'Container', 'super-duper' ),
1042
+    );
1043
+
1044
+    $input = wp_parse_args( $overwrite, $defaults );
1045
+
1046
+    return $input;
1047 1047
 }
1048 1048
 
1049 1049
 /**
@@ -1056,30 +1056,30 @@  discard block
 block discarded – undo
1056 1056
  */
1057 1057
 function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
1058 1058
 
1059
-	$options = array(
1060
-		''                  => __( 'Default', 'super-duper' ),
1061
-		'position-static'   => 'static',
1062
-		'position-relative' => 'relative',
1063
-		'position-absolute' => 'absolute',
1064
-		'position-fixed'    => 'fixed',
1065
-		'position-sticky'   => 'sticky',
1066
-		'fixed-top'         => 'fixed-top',
1067
-		'fixed-bottom'      => 'fixed-bottom',
1068
-		'sticky-top'        => 'sticky-top',
1069
-	);
1070
-
1071
-	$defaults = array(
1072
-		'type'     => 'select',
1073
-		'title'    => __( 'Position', 'super-duper' ),
1074
-		'options'  => $options,
1075
-		'default'  => '',
1076
-		'desc_tip' => true,
1077
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1078
-	);
1079
-
1080
-	$input = wp_parse_args( $overwrite, $defaults );
1081
-
1082
-	return $input;
1059
+    $options = array(
1060
+        ''                  => __( 'Default', 'super-duper' ),
1061
+        'position-static'   => 'static',
1062
+        'position-relative' => 'relative',
1063
+        'position-absolute' => 'absolute',
1064
+        'position-fixed'    => 'fixed',
1065
+        'position-sticky'   => 'sticky',
1066
+        'fixed-top'         => 'fixed-top',
1067
+        'fixed-bottom'      => 'fixed-bottom',
1068
+        'sticky-top'        => 'sticky-top',
1069
+    );
1070
+
1071
+    $defaults = array(
1072
+        'type'     => 'select',
1073
+        'title'    => __( 'Position', 'super-duper' ),
1074
+        'options'  => $options,
1075
+        'default'  => '',
1076
+        'desc_tip' => true,
1077
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1078
+    );
1079
+
1080
+    $input = wp_parse_args( $overwrite, $defaults );
1081
+
1082
+    return $input;
1083 1083
 }
1084 1084
 
1085 1085
 /**
@@ -1092,38 +1092,38 @@  discard block
 block discarded – undo
1092 1092
  */
1093 1093
 function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1094 1094
 
1095
-	$defaults = array(
1096
-		'type'            => 'number',
1097
-		'title'           => __( 'Sticky offset', 'super-duper' ),
1098
-		//'desc' =>  __('Sticky offset'),
1099
-		'default'         => '',
1100
-		'desc_tip'        => true,
1101
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1102
-		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1103
-	);
1104
-
1105
-	// title
1106
-	if ( $type == 'top' ) {
1107
-		$defaults['title'] = __( 'Top offset', 'super-duper' );
1108
-		$defaults['icon']  = 'box-top';
1109
-		$defaults['row']   = array(
1110
-			'title' => __( 'Sticky offset', 'super-duper' ),
1111
-			'key'   => 'sticky-offset',
1112
-			'open'  => true,
1113
-			'class' => 'text-center',
1114
-		);
1115
-	} elseif ( $type == 'bottom' ) {
1116
-		$defaults['title'] = __( 'Bottom offset', 'super-duper' );
1117
-		$defaults['icon']  = 'box-bottom';
1118
-		$defaults['row']   = array(
1119
-			'key'   => 'sticky-offset',
1120
-			'close' => true,
1121
-		);
1122
-	}
1123
-
1124
-	$input = wp_parse_args( $overwrite, $defaults );
1125
-
1126
-	return $input;
1095
+    $defaults = array(
1096
+        'type'            => 'number',
1097
+        'title'           => __( 'Sticky offset', 'super-duper' ),
1098
+        //'desc' =>  __('Sticky offset'),
1099
+        'default'         => '',
1100
+        'desc_tip'        => true,
1101
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1102
+        'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1103
+    );
1104
+
1105
+    // title
1106
+    if ( $type == 'top' ) {
1107
+        $defaults['title'] = __( 'Top offset', 'super-duper' );
1108
+        $defaults['icon']  = 'box-top';
1109
+        $defaults['row']   = array(
1110
+            'title' => __( 'Sticky offset', 'super-duper' ),
1111
+            'key'   => 'sticky-offset',
1112
+            'open'  => true,
1113
+            'class' => 'text-center',
1114
+        );
1115
+    } elseif ( $type == 'bottom' ) {
1116
+        $defaults['title'] = __( 'Bottom offset', 'super-duper' );
1117
+        $defaults['icon']  = 'box-bottom';
1118
+        $defaults['row']   = array(
1119
+            'key'   => 'sticky-offset',
1120
+            'close' => true,
1121
+        );
1122
+    }
1123
+
1124
+    $input = wp_parse_args( $overwrite, $defaults );
1125
+
1126
+    return $input;
1127 1127
 }
1128 1128
 
1129 1129
 /**
@@ -1136,36 +1136,36 @@  discard block
 block discarded – undo
1136 1136
  */
1137 1137
 function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
1138 1138
 
1139
-	$options = array(
1140
-		''          => __( 'Inherit from parent', 'super-duper' ),
1141
-		'h6'        => 'h6',
1142
-		'h5'        => 'h5',
1143
-		'h4'        => 'h4',
1144
-		'h3'        => 'h3',
1145
-		'h2'        => 'h2',
1146
-		'h1'        => 'h1',
1147
-		'display-1' => 'display-1',
1148
-		'display-2' => 'display-2',
1149
-		'display-3' => 'display-3',
1150
-		'display-4' => 'display-4',
1151
-	);
1152
-
1153
-	if ( $has_custom ) {
1154
-		$options['custom'] = __( 'Custom size', 'super-duper' );
1155
-	}
1156
-
1157
-	$defaults = array(
1158
-		'type'     => 'select',
1159
-		'title'    => __( 'Font size', 'super-duper' ),
1160
-		'options'  => $options,
1161
-		'default'  => '',
1162
-		'desc_tip' => true,
1163
-		'group'    => __( 'Typography', 'super-duper' ),
1164
-	);
1165
-
1166
-	$input = wp_parse_args( $overwrite, $defaults );
1167
-
1168
-	return $input;
1139
+    $options = array(
1140
+        ''          => __( 'Inherit from parent', 'super-duper' ),
1141
+        'h6'        => 'h6',
1142
+        'h5'        => 'h5',
1143
+        'h4'        => 'h4',
1144
+        'h3'        => 'h3',
1145
+        'h2'        => 'h2',
1146
+        'h1'        => 'h1',
1147
+        'display-1' => 'display-1',
1148
+        'display-2' => 'display-2',
1149
+        'display-3' => 'display-3',
1150
+        'display-4' => 'display-4',
1151
+    );
1152
+
1153
+    if ( $has_custom ) {
1154
+        $options['custom'] = __( 'Custom size', 'super-duper' );
1155
+    }
1156
+
1157
+    $defaults = array(
1158
+        'type'     => 'select',
1159
+        'title'    => __( 'Font size', 'super-duper' ),
1160
+        'options'  => $options,
1161
+        'default'  => '',
1162
+        'desc_tip' => true,
1163
+        'group'    => __( 'Typography', 'super-duper' ),
1164
+    );
1165
+
1166
+    $input = wp_parse_args( $overwrite, $defaults );
1167
+
1168
+    return $input;
1169 1169
 }
1170 1170
 
1171 1171
 /**
@@ -1178,27 +1178,27 @@  discard block
 block discarded – undo
1178 1178
  */
1179 1179
 function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
1180 1180
 
1181
-	$defaults = array(
1182
-		'type'              => 'number',
1183
-		'title'             => __( 'Font size (rem)', 'super-duper' ),
1184
-		'default'           => '',
1185
-		'placeholder'       => '1.25',
1186
-		'custom_attributes' => array(
1187
-			'step' => '0.1',
1188
-			'min'  => '0',
1189
-			'max'  => '100',
1190
-		),
1191
-		'desc_tip'          => true,
1192
-		'group'             => __( 'Typography', 'super-duper' ),
1193
-	);
1194
-
1195
-	if ( $parent_type ) {
1196
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1197
-	}
1198
-
1199
-	$input = wp_parse_args( $overwrite, $defaults );
1200
-
1201
-	return $input;
1181
+    $defaults = array(
1182
+        'type'              => 'number',
1183
+        'title'             => __( 'Font size (rem)', 'super-duper' ),
1184
+        'default'           => '',
1185
+        'placeholder'       => '1.25',
1186
+        'custom_attributes' => array(
1187
+            'step' => '0.1',
1188
+            'min'  => '0',
1189
+            'max'  => '100',
1190
+        ),
1191
+        'desc_tip'          => true,
1192
+        'group'             => __( 'Typography', 'super-duper' ),
1193
+    );
1194
+
1195
+    if ( $parent_type ) {
1196
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1197
+    }
1198
+
1199
+    $input = wp_parse_args( $overwrite, $defaults );
1200
+
1201
+    return $input;
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1211,23 +1211,23 @@  discard block
 block discarded – undo
1211 1211
  */
1212 1212
 function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) {
1213 1213
 
1214
-	$defaults = array(
1215
-		'type'              => 'number',
1216
-		'title'             => __( 'Font Line Height', 'super-duper' ),
1217
-		'default'           => '',
1218
-		'placeholder'       => '1.75',
1219
-		'custom_attributes' => array(
1220
-			'step' => '0.1',
1221
-			'min'  => '0',
1222
-			'max'  => '100',
1223
-		),
1224
-		'desc_tip'          => true,
1225
-		'group'             => __( 'Typography', 'super-duper' ),
1226
-	);
1227
-
1228
-	$input = wp_parse_args( $overwrite, $defaults );
1229
-
1230
-	return $input;
1214
+    $defaults = array(
1215
+        'type'              => 'number',
1216
+        'title'             => __( 'Font Line Height', 'super-duper' ),
1217
+        'default'           => '',
1218
+        'placeholder'       => '1.75',
1219
+        'custom_attributes' => array(
1220
+            'step' => '0.1',
1221
+            'min'  => '0',
1222
+            'max'  => '100',
1223
+        ),
1224
+        'desc_tip'          => true,
1225
+        'group'             => __( 'Typography', 'super-duper' ),
1226
+    );
1227
+
1228
+    $input = wp_parse_args( $overwrite, $defaults );
1229
+
1230
+    return $input;
1231 1231
 }
1232 1232
 
1233 1233
 /**
@@ -1240,18 +1240,18 @@  discard block
 block discarded – undo
1240 1240
  */
1241 1241
 function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1242 1242
 
1243
-	$inputs = array();
1243
+    $inputs = array();
1244 1244
 
1245
-	if ( $overwrite !== false ) {
1246
-		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1247
-	}
1245
+    if ( $overwrite !== false ) {
1246
+        $inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1247
+    }
1248 1248
 
1249
-	if ( $overwrite_custom !== false ) {
1250
-		$custom            = $type . '_custom';
1251
-		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1252
-	}
1249
+    if ( $overwrite_custom !== false ) {
1250
+        $custom            = $type . '_custom';
1251
+        $inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1252
+    }
1253 1253
 
1254
-	return $inputs;
1254
+    return $inputs;
1255 1255
 }
1256 1256
 
1257 1257
 /**
@@ -1264,33 +1264,33 @@  discard block
 block discarded – undo
1264 1264
  */
1265 1265
 function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
1266 1266
 
1267
-	$options = array(
1268
-		''                                => __( 'Inherit', 'super-duper' ),
1269
-		'font-weight-bold'                => 'bold',
1270
-		'font-weight-bolder'              => 'bolder',
1271
-		'font-weight-normal'              => 'normal',
1272
-		'font-weight-light'               => 'light',
1273
-		'font-weight-lighter'             => 'lighter',
1274
-		'font-italic'                     => 'italic',
1275
-		'font-weight-bold font-italic'    => 'bold italic',
1276
-		'font-weight-bolder font-italic'  => 'bolder italic',
1277
-		'font-weight-normal font-italic'  => 'normal italic',
1278
-		'font-weight-light font-italic'   => 'light italic',
1279
-		'font-weight-lighter font-italic' => 'lighter italic',
1280
-	);
1281
-
1282
-	$defaults = array(
1283
-		'type'     => 'select',
1284
-		'title'    => __( 'Appearance', 'super-duper' ),
1285
-		'options'  => $options,
1286
-		'default'  => '',
1287
-		'desc_tip' => true,
1288
-		'group'    => __( 'Typography', 'super-duper' ),
1289
-	);
1290
-
1291
-	$input = wp_parse_args( $overwrite, $defaults );
1292
-
1293
-	return $input;
1267
+    $options = array(
1268
+        ''                                => __( 'Inherit', 'super-duper' ),
1269
+        'font-weight-bold'                => 'bold',
1270
+        'font-weight-bolder'              => 'bolder',
1271
+        'font-weight-normal'              => 'normal',
1272
+        'font-weight-light'               => 'light',
1273
+        'font-weight-lighter'             => 'lighter',
1274
+        'font-italic'                     => 'italic',
1275
+        'font-weight-bold font-italic'    => 'bold italic',
1276
+        'font-weight-bolder font-italic'  => 'bolder italic',
1277
+        'font-weight-normal font-italic'  => 'normal italic',
1278
+        'font-weight-light font-italic'   => 'light italic',
1279
+        'font-weight-lighter font-italic' => 'lighter italic',
1280
+    );
1281
+
1282
+    $defaults = array(
1283
+        'type'     => 'select',
1284
+        'title'    => __( 'Appearance', 'super-duper' ),
1285
+        'options'  => $options,
1286
+        'default'  => '',
1287
+        'desc_tip' => true,
1288
+        'group'    => __( 'Typography', 'super-duper' ),
1289
+    );
1290
+
1291
+    $input = wp_parse_args( $overwrite, $defaults );
1292
+
1293
+    return $input;
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1303,25 +1303,25 @@  discard block
 block discarded – undo
1303 1303
  */
1304 1304
 function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
1305 1305
 
1306
-	$options = array(
1307
-		''                => __( 'Default', 'super-duper' ),
1308
-		'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1309
-		'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1310
-		'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1311
-	);
1312
-
1313
-	$defaults = array(
1314
-		'type'     => 'select',
1315
-		'title'    => __( 'Letter case', 'super-duper' ),
1316
-		'options'  => $options,
1317
-		'default'  => '',
1318
-		'desc_tip' => true,
1319
-		'group'    => __( 'Typography', 'super-duper' ),
1320
-	);
1321
-
1322
-	$input = wp_parse_args( $overwrite, $defaults );
1323
-
1324
-	return $input;
1306
+    $options = array(
1307
+        ''                => __( 'Default', 'super-duper' ),
1308
+        'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1309
+        'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1310
+        'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1311
+    );
1312
+
1313
+    $defaults = array(
1314
+        'type'     => 'select',
1315
+        'title'    => __( 'Letter case', 'super-duper' ),
1316
+        'options'  => $options,
1317
+        'default'  => '',
1318
+        'desc_tip' => true,
1319
+        'group'    => __( 'Typography', 'super-duper' ),
1320
+    );
1321
+
1322
+    $input = wp_parse_args( $overwrite, $defaults );
1323
+
1324
+    return $input;
1325 1325
 }
1326 1326
 
1327 1327
 /**
@@ -1335,23 +1335,23 @@  discard block
 block discarded – undo
1335 1335
  */
1336 1336
 function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
1337 1337
 
1338
-	$options = array(
1339
-		''            => __( 'No', 'super-duper' ),
1340
-		'font-italic' => __( 'Yes', 'super-duper' ),
1341
-	);
1338
+    $options = array(
1339
+        ''            => __( 'No', 'super-duper' ),
1340
+        'font-italic' => __( 'Yes', 'super-duper' ),
1341
+    );
1342 1342
 
1343
-	$defaults = array(
1344
-		'type'     => 'select',
1345
-		'title'    => __( 'Font italic', 'super-duper' ),
1346
-		'options'  => $options,
1347
-		'default'  => '',
1348
-		'desc_tip' => true,
1349
-		'group'    => __( 'Typography', 'super-duper' ),
1350
-	);
1343
+    $defaults = array(
1344
+        'type'     => 'select',
1345
+        'title'    => __( 'Font italic', 'super-duper' ),
1346
+        'options'  => $options,
1347
+        'default'  => '',
1348
+        'desc_tip' => true,
1349
+        'group'    => __( 'Typography', 'super-duper' ),
1350
+    );
1351 1351
 
1352
-	$input = wp_parse_args( $overwrite, $defaults );
1352
+    $input = wp_parse_args( $overwrite, $defaults );
1353 1353
 
1354
-	return $input;
1354
+    return $input;
1355 1355
 }
1356 1356
 
1357 1357
 /**
@@ -1364,18 +1364,18 @@  discard block
 block discarded – undo
1364 1364
  */
1365 1365
 function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
1366 1366
 
1367
-	$defaults = array(
1368
-		'type'     => 'text',
1369
-		'title'    => __( 'HTML anchor', 'super-duper' ),
1370
-		'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ),
1371
-		'default'  => '',
1372
-		'desc_tip' => true,
1373
-		'group'    => __( 'Advanced', 'super-duper' ),
1374
-	);
1367
+    $defaults = array(
1368
+        'type'     => 'text',
1369
+        'title'    => __( 'HTML anchor', 'super-duper' ),
1370
+        'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ),
1371
+        'default'  => '',
1372
+        'desc_tip' => true,
1373
+        'group'    => __( 'Advanced', 'super-duper' ),
1374
+    );
1375 1375
 
1376
-	$input = wp_parse_args( $overwrite, $defaults );
1376
+    $input = wp_parse_args( $overwrite, $defaults );
1377 1377
 
1378
-	return $input;
1378
+    return $input;
1379 1379
 }
1380 1380
 
1381 1381
 /**
@@ -1388,18 +1388,18 @@  discard block
 block discarded – undo
1388 1388
  */
1389 1389
 function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
1390 1390
 
1391
-	$defaults = array(
1392
-		'type'     => 'text',
1393
-		'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1394
-		'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1395
-		'default'  => '',
1396
-		'desc_tip' => true,
1397
-		'group'    => __( 'Advanced', 'super-duper' ),
1398
-	);
1391
+    $defaults = array(
1392
+        'type'     => 'text',
1393
+        'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1394
+        'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1395
+        'default'  => '',
1396
+        'desc_tip' => true,
1397
+        'group'    => __( 'Advanced', 'super-duper' ),
1398
+    );
1399 1399
 
1400
-	$input = wp_parse_args( $overwrite, $defaults );
1400
+    $input = wp_parse_args( $overwrite, $defaults );
1401 1401
 
1402
-	return $input;
1402
+    return $input;
1403 1403
 }
1404 1404
 
1405 1405
 /**
@@ -1412,244 +1412,244 @@  discard block
 block discarded – undo
1412 1412
  */
1413 1413
 function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) {
1414 1414
 
1415
-	$options = array(
1416
-		''       => __( 'none', 'super-duper' ),
1417
-		'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1418
-		'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1419
-		'hover-move-up'    => __( 'Move up', 'super-duper' ),
1420
-		'hover-move-down'  => __( 'Move down', 'super-duper' ),
1421
-		'hover-move-left'  => __( 'Move left', 'super-duper' ),
1422
-		'hover-move-right' => __( 'Move right', 'super-duper' ),
1423
-	);
1424
-
1425
-	$defaults = array(
1426
-		'type'     => 'select',
1427
-		'multiple' => true,
1428
-		'title'    => __( 'Hover Animations', 'super-duper' ),
1429
-		'options'  => $options,
1430
-		'default'  => '',
1431
-		'desc_tip' => true,
1432
-		'group'    => __( 'Hover Animations', 'super-duper' ),
1433
-	);
1434
-
1435
-	$input = wp_parse_args( $overwrite, $defaults );
1436
-
1437
-	return $input;
1415
+    $options = array(
1416
+        ''       => __( 'none', 'super-duper' ),
1417
+        'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1418
+        'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1419
+        'hover-move-up'    => __( 'Move up', 'super-duper' ),
1420
+        'hover-move-down'  => __( 'Move down', 'super-duper' ),
1421
+        'hover-move-left'  => __( 'Move left', 'super-duper' ),
1422
+        'hover-move-right' => __( 'Move right', 'super-duper' ),
1423
+    );
1424
+
1425
+    $defaults = array(
1426
+        'type'     => 'select',
1427
+        'multiple' => true,
1428
+        'title'    => __( 'Hover Animations', 'super-duper' ),
1429
+        'options'  => $options,
1430
+        'default'  => '',
1431
+        'desc_tip' => true,
1432
+        'group'    => __( 'Hover Animations', 'super-duper' ),
1433
+    );
1434
+
1435
+    $input = wp_parse_args( $overwrite, $defaults );
1436
+
1437
+    return $input;
1438 1438
 }
1439 1439
 
1440 1440
 
1441 1441
 function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) {
1442
-	$device_size = '';
1443
-	if ( ! empty( $overwrite['device_type'] ) ) {
1444
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1445
-			$device_size = '-md';
1446
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1447
-			$device_size = '-lg';
1448
-		}
1449
-	}
1450
-	$options = array(
1451
-		''                                         => __( 'Default', 'super-duper' ),
1452
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1453
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1454
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1455
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1456
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1457
-	);
1458
-
1459
-	$defaults = array(
1460
-		'type'            => 'select',
1461
-		'title'           => __( 'Vertical Align Items', 'super-duper' ),
1462
-		'options'         => $options,
1463
-		'default'         => '',
1464
-		'desc_tip'        => true,
1465
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1466
-		'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1467
-
1468
-	);
1469
-
1470
-	$input = wp_parse_args( $overwrite, $defaults );
1471
-
1472
-	return $input;
1442
+    $device_size = '';
1443
+    if ( ! empty( $overwrite['device_type'] ) ) {
1444
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1445
+            $device_size = '-md';
1446
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1447
+            $device_size = '-lg';
1448
+        }
1449
+    }
1450
+    $options = array(
1451
+        ''                                         => __( 'Default', 'super-duper' ),
1452
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1453
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1454
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1455
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1456
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1457
+    );
1458
+
1459
+    $defaults = array(
1460
+        'type'            => 'select',
1461
+        'title'           => __( 'Vertical Align Items', 'super-duper' ),
1462
+        'options'         => $options,
1463
+        'default'         => '',
1464
+        'desc_tip'        => true,
1465
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1466
+        'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1467
+
1468
+    );
1469
+
1470
+    $input = wp_parse_args( $overwrite, $defaults );
1471
+
1472
+    return $input;
1473 1473
 }
1474 1474
 
1475 1475
 function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) {
1476
-	$inputs = array();
1477
-	$sizes  = array(
1478
-		''    => 'Mobile',
1479
-		'_md' => 'Tablet',
1480
-		'_lg' => 'Desktop',
1481
-	);
1482
-
1483
-	if ( $overwrite !== false ) {
1484
-
1485
-		foreach ( $sizes as $ds => $dt ) {
1486
-			$overwrite['device_type'] = $dt;
1487
-			$inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1488
-		}
1489
-	}
1490
-
1491
-	return $inputs;
1476
+    $inputs = array();
1477
+    $sizes  = array(
1478
+        ''    => 'Mobile',
1479
+        '_md' => 'Tablet',
1480
+        '_lg' => 'Desktop',
1481
+    );
1482
+
1483
+    if ( $overwrite !== false ) {
1484
+
1485
+        foreach ( $sizes as $ds => $dt ) {
1486
+            $overwrite['device_type'] = $dt;
1487
+            $inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1488
+        }
1489
+    }
1490
+
1491
+    return $inputs;
1492 1492
 }
1493 1493
 
1494 1494
 function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) {
1495
-	$device_size = '';
1496
-	if ( ! empty( $overwrite['device_type'] ) ) {
1497
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1498
-			$device_size = '-md';
1499
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1500
-			$device_size = '-lg';
1501
-		}
1502
-	}
1503
-	$options = array(
1504
-		''                                             => __( 'Default', 'super-duper' ),
1505
-		'justify-content' . $device_size . '-start'    => 'justify-content-start',
1506
-		'justify-content' . $device_size . '-end'      => 'justify-content-end',
1507
-		'justify-content' . $device_size . '-center'   => 'justify-content-center',
1508
-		'justify-content' . $device_size . '-between' => 'justify-content-between',
1509
-		'justify-content' . $device_size . '-stretch'  => 'justify-content-around',
1510
-	);
1511
-
1512
-	$defaults = array(
1513
-		'type'            => 'select',
1514
-		'title'           => __( 'Justify content' ),
1515
-		'options'         => $options,
1516
-		'default'         => '',
1517
-		'desc_tip'        => true,
1518
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1519
-		'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1520
-
1521
-	);
1522
-
1523
-	$input = wp_parse_args( $overwrite, $defaults );
1524
-
1525
-	return $input;
1495
+    $device_size = '';
1496
+    if ( ! empty( $overwrite['device_type'] ) ) {
1497
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1498
+            $device_size = '-md';
1499
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1500
+            $device_size = '-lg';
1501
+        }
1502
+    }
1503
+    $options = array(
1504
+        ''                                             => __( 'Default', 'super-duper' ),
1505
+        'justify-content' . $device_size . '-start'    => 'justify-content-start',
1506
+        'justify-content' . $device_size . '-end'      => 'justify-content-end',
1507
+        'justify-content' . $device_size . '-center'   => 'justify-content-center',
1508
+        'justify-content' . $device_size . '-between' => 'justify-content-between',
1509
+        'justify-content' . $device_size . '-stretch'  => 'justify-content-around',
1510
+    );
1511
+
1512
+    $defaults = array(
1513
+        'type'            => 'select',
1514
+        'title'           => __( 'Justify content' ),
1515
+        'options'         => $options,
1516
+        'default'         => '',
1517
+        'desc_tip'        => true,
1518
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1519
+        'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1520
+
1521
+    );
1522
+
1523
+    $input = wp_parse_args( $overwrite, $defaults );
1524
+
1525
+    return $input;
1526 1526
 }
1527 1527
 
1528 1528
 function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) {
1529
-	$inputs = array();
1530
-	$sizes  = array(
1531
-		''    => 'Mobile',
1532
-		'_md' => 'Tablet',
1533
-		'_lg' => 'Desktop',
1534
-	);
1535
-
1536
-	if ( $overwrite !== false ) {
1537
-
1538
-		foreach ( $sizes as $ds => $dt ) {
1539
-			$overwrite['device_type'] = $dt;
1540
-			$inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1541
-		}
1542
-	}
1543
-
1544
-	return $inputs;
1529
+    $inputs = array();
1530
+    $sizes  = array(
1531
+        ''    => 'Mobile',
1532
+        '_md' => 'Tablet',
1533
+        '_lg' => 'Desktop',
1534
+    );
1535
+
1536
+    if ( $overwrite !== false ) {
1537
+
1538
+        foreach ( $sizes as $ds => $dt ) {
1539
+            $overwrite['device_type'] = $dt;
1540
+            $inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1541
+        }
1542
+    }
1543
+
1544
+    return $inputs;
1545 1545
 }
1546 1546
 
1547 1547
 
1548 1548
 function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) {
1549
-	$device_size = '';
1550
-	if ( ! empty( $overwrite['device_type'] ) ) {
1551
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1552
-			$device_size = '-md';
1553
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1554
-			$device_size = '-lg';
1555
-		}
1556
-	}
1557
-	$options = array(
1558
-		''                                         => __( 'Default', 'super-duper' ),
1559
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1560
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1561
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1562
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1563
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1564
-	);
1565
-
1566
-	$defaults = array(
1567
-		'type'            => 'select',
1568
-		'title'           => __( 'Align Self', 'super-duper' ),
1569
-		'options'         => $options,
1570
-		'default'         => '',
1571
-		'desc_tip'        => true,
1572
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1573
-		'element_require' => ' [%container%]=="col" ',
1574
-
1575
-	);
1576
-
1577
-	$input = wp_parse_args( $overwrite, $defaults );
1578
-
1579
-	return $input;
1549
+    $device_size = '';
1550
+    if ( ! empty( $overwrite['device_type'] ) ) {
1551
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1552
+            $device_size = '-md';
1553
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1554
+            $device_size = '-lg';
1555
+        }
1556
+    }
1557
+    $options = array(
1558
+        ''                                         => __( 'Default', 'super-duper' ),
1559
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1560
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1561
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1562
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1563
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1564
+    );
1565
+
1566
+    $defaults = array(
1567
+        'type'            => 'select',
1568
+        'title'           => __( 'Align Self', 'super-duper' ),
1569
+        'options'         => $options,
1570
+        'default'         => '',
1571
+        'desc_tip'        => true,
1572
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1573
+        'element_require' => ' [%container%]=="col" ',
1574
+
1575
+    );
1576
+
1577
+    $input = wp_parse_args( $overwrite, $defaults );
1578
+
1579
+    return $input;
1580 1580
 }
1581 1581
 
1582 1582
 function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) {
1583
-	$inputs = array();
1584
-	$sizes  = array(
1585
-		''    => 'Mobile',
1586
-		'_md' => 'Tablet',
1587
-		'_lg' => 'Desktop',
1588
-	);
1589
-
1590
-	if ( $overwrite !== false ) {
1591
-
1592
-		foreach ( $sizes as $ds => $dt ) {
1593
-			$overwrite['device_type'] = $dt;
1594
-			$inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1595
-		}
1596
-	}
1597
-
1598
-	return $inputs;
1583
+    $inputs = array();
1584
+    $sizes  = array(
1585
+        ''    => 'Mobile',
1586
+        '_md' => 'Tablet',
1587
+        '_lg' => 'Desktop',
1588
+    );
1589
+
1590
+    if ( $overwrite !== false ) {
1591
+
1592
+        foreach ( $sizes as $ds => $dt ) {
1593
+            $overwrite['device_type'] = $dt;
1594
+            $inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1595
+        }
1596
+    }
1597
+
1598
+    return $inputs;
1599 1599
 }
1600 1600
 
1601 1601
 function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) {
1602
-	$device_size = '';
1603
-	if ( ! empty( $overwrite['device_type'] ) ) {
1604
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1605
-			$device_size = '-md';
1606
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1607
-			$device_size = '-lg';
1608
-		}
1609
-	}
1610
-	$options = array(
1611
-		'' => __( 'Default', 'super-duper' ),
1612
-	);
1613
-
1614
-	$i = 0;
1615
-	while ( $i <= 12 ) {
1616
-		$options[ 'order' . $device_size . '-' . $i ] = $i;
1617
-		$i++;
1618
-	}
1619
-
1620
-	$defaults = array(
1621
-		'type'            => 'select',
1622
-		'title'           => __( 'Flex Order', 'super-duper' ),
1623
-		'options'         => $options,
1624
-		'default'         => '',
1625
-		'desc_tip'        => true,
1626
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1627
-		'element_require' => ' [%container%]=="col" ',
1628
-
1629
-	);
1630
-
1631
-	$input = wp_parse_args( $overwrite, $defaults );
1632
-
1633
-	return $input;
1602
+    $device_size = '';
1603
+    if ( ! empty( $overwrite['device_type'] ) ) {
1604
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1605
+            $device_size = '-md';
1606
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1607
+            $device_size = '-lg';
1608
+        }
1609
+    }
1610
+    $options = array(
1611
+        '' => __( 'Default', 'super-duper' ),
1612
+    );
1613
+
1614
+    $i = 0;
1615
+    while ( $i <= 12 ) {
1616
+        $options[ 'order' . $device_size . '-' . $i ] = $i;
1617
+        $i++;
1618
+    }
1619
+
1620
+    $defaults = array(
1621
+        'type'            => 'select',
1622
+        'title'           => __( 'Flex Order', 'super-duper' ),
1623
+        'options'         => $options,
1624
+        'default'         => '',
1625
+        'desc_tip'        => true,
1626
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1627
+        'element_require' => ' [%container%]=="col" ',
1628
+
1629
+    );
1630
+
1631
+    $input = wp_parse_args( $overwrite, $defaults );
1632
+
1633
+    return $input;
1634 1634
 }
1635 1635
 
1636 1636
 function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) {
1637
-	$inputs = array();
1638
-	$sizes  = array(
1639
-		''    => 'Mobile',
1640
-		'_md' => 'Tablet',
1641
-		'_lg' => 'Desktop',
1642
-	);
1643
-
1644
-	if ( $overwrite !== false ) {
1645
-
1646
-		foreach ( $sizes as $ds => $dt ) {
1647
-			$overwrite['device_type'] = $dt;
1648
-			$inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1649
-		}
1650
-	}
1651
-
1652
-	return $inputs;
1637
+    $inputs = array();
1638
+    $sizes  = array(
1639
+        ''    => 'Mobile',
1640
+        '_md' => 'Tablet',
1641
+        '_lg' => 'Desktop',
1642
+    );
1643
+
1644
+    if ( $overwrite !== false ) {
1645
+
1646
+        foreach ( $sizes as $ds => $dt ) {
1647
+            $overwrite['device_type'] = $dt;
1648
+            $inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1649
+        }
1650
+    }
1651
+
1652
+    return $inputs;
1653 1653
 }
1654 1654
 
1655 1655
 /**
@@ -1662,345 +1662,345 @@  discard block
 block discarded – undo
1662 1662
  */
1663 1663
 function sd_build_aui_class( $args ) {
1664 1664
 
1665
-	$classes = array();
1666
-
1667
-	// margins.
1668
-	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1669
-		$classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1670
-		$mt        = $args['mt'];
1671
-	} else {
1672
-		$mt = null;
1673
-	}
1674
-	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1675
-		$classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1676
-		$mr        = $args['mr'];
1677
-	} else {
1678
-		$mr = null;
1679
-	}
1680
-	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1681
-		$classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1682
-		$mb        = $args['mb'];
1683
-	} else {
1684
-		$mb = null;
1685
-	}
1686
-	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1687
-		$classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1688
-		$ml        = $args['ml'];
1689
-	} else {
1690
-		$ml = null;
1691
-	}
1692
-
1693
-	// margins tablet.
1694
-	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1695
-		$classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1696
-		$mt_md     = $args['mt_md'];
1697
-	} else {
1698
-		$mt_md = null;
1699
-	}
1700
-	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1701
-		$classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1702
-		$mt_md     = $args['mr_md'];
1703
-	} else {
1704
-		$mr_md = null;
1705
-	}
1706
-	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1707
-		$classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1708
-		$mt_md     = $args['mb_md'];
1709
-	} else {
1710
-		$mb_md = null;
1711
-	}
1712
-	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1713
-		$classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1714
-		$mt_md     = $args['ml_md'];
1715
-	} else {
1716
-		$ml_md = null;
1717
-	}
1718
-
1719
-	// margins desktop.
1720
-	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1721
-		if ( $mt == null && $mt_md == null ) {
1722
-			$classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1723
-		} else {
1724
-			$classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1725
-		}
1726
-	}
1727
-	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1728
-		if ( $mr == null && $mr_md == null ) {
1729
-			$classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1730
-		} else {
1731
-			$classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1732
-		}
1733
-	}
1734
-	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1735
-		if ( $mb == null && $mb_md == null ) {
1736
-			$classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1737
-		} else {
1738
-			$classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1739
-		}
1740
-	}
1741
-	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1742
-		if ( $ml == null && $ml_md == null ) {
1743
-			$classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1744
-		} else {
1745
-			$classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1746
-		}
1747
-	}
1748
-
1749
-	// padding.
1750
-	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1751
-		$classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1752
-		$pt        = $args['pt'];
1753
-	} else {
1754
-		$pt = null;
1755
-	}
1756
-	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1757
-		$classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1758
-		$pr        = $args['pr'];
1759
-	} else {
1760
-		$pr = null;
1761
-	}
1762
-	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1763
-		$classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1764
-		$pb        = $args['pb'];
1765
-	} else {
1766
-		$pb = null;
1767
-	}
1768
-	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1769
-		$classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1770
-		$pl        = $args['pl'];
1771
-	} else {
1772
-		$pl = null;
1773
-	}
1774
-
1775
-	// padding tablet.
1776
-	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1777
-		$classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1778
-		$pt_md     = $args['pt_md'];
1779
-	} else {
1780
-		$pt_md = null;
1781
-	}
1782
-	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1783
-		$classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1784
-		$pt_md     = $args['pr_md'];
1785
-	} else {
1786
-		$pr_md = null;
1787
-	}
1788
-	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1789
-		$classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1790
-		$pt_md     = $args['pb_md'];
1791
-	} else {
1792
-		$pb_md = null;
1793
-	}
1794
-	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1795
-		$classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1796
-		$pt_md     = $args['pl_md'];
1797
-	} else {
1798
-		$pl_md = null;
1799
-	}
1800
-
1801
-	// padding desktop.
1802
-	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1803
-		if ( $pt == null && $pt_md == null ) {
1804
-			$classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1805
-		} else {
1806
-			$classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1807
-		}
1808
-	}
1809
-	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1810
-		if ( $pr == null && $pr_md == null ) {
1811
-			$classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1812
-		} else {
1813
-			$classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1814
-		}
1815
-	}
1816
-	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1817
-		if ( $pb == null && $pb_md == null ) {
1818
-			$classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1819
-		} else {
1820
-			$classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1821
-		}
1822
-	}
1823
-	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1824
-		if ( $pl == null && $pl_md == null ) {
1825
-			$classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1826
-		} else {
1827
-			$classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1828
-		}
1829
-	}
1830
-
1831
-	// row cols, mobile, tablet, desktop
1832
-	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1833
-		$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1834
-		$row_cols  = $args['row_cols'];
1835
-	} else {
1836
-		$row_cols = null;
1837
-	}
1838
-	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1839
-		$classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1840
-		$row_cols_md = $args['row_cols_md'];
1841
-	} else {
1842
-		$row_cols_md = null;
1843
-	}
1844
-	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1845
-		if ( $row_cols == null && $row_cols_md == null ) {
1846
-			$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1847
-		} else {
1848
-			$classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1849
-		}
1850
-	}
1851
-
1852
-	// columns , mobile, tablet, desktop
1853
-	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1854
-		$classes[] = sanitize_html_class( 'col-' . $args['col'] );
1855
-		$col       = $args['col'];
1856
-	} else {
1857
-		$col = null;
1858
-	}
1859
-	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1860
-		$classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1861
-		$col_md    = $args['col_md'];
1862
-	} else {
1863
-		$col_md = null;
1864
-	}
1865
-	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1866
-		if ( $col == null && $col_md == null ) {
1867
-			$classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1868
-		} else {
1869
-			$classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1870
-		}
1871
-	}
1872
-
1873
-	// border
1874
-	if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1875
-		$classes[] = 'border-0';
1876
-	} elseif ( ! empty( $args['border'] ) ) {
1877
-		$classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1878
-	}
1879
-
1880
-	// border radius type
1881
-	if ( ! empty( $args['rounded'] ) ) {
1882
-		$classes[] = sanitize_html_class( $args['rounded'] );
1883
-	}
1884
-
1885
-	// border radius size
1886
-	if ( ! empty( $args['rounded_size'] ) ) {
1887
-		$classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1888
-		// if we set a size then we need to remove "rounded" if set
1889
-		if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1890
-			unset( $classes[ $key ] );
1891
-		}
1892
-	}
1893
-
1894
-	// shadow
1895
-	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1896
-
1897
-	// background
1898
-	if ( ! empty( $args['bg'] ) ) {
1899
-		$classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1900
-	}
1901
-
1902
-	// text_color
1903
-	if ( ! empty( $args['text_color'] ) ) {
1904
-		$classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1905
-	}
1906
-
1907
-	// text_align
1908
-	if ( ! empty( $args['text_justify'] ) ) {
1909
-		$classes[] = 'text-justify';
1910
-	} else {
1911
-		if ( ! empty( $args['text_align'] ) ) {
1912
-			$classes[]  = sanitize_html_class( $args['text_align'] );
1913
-			$text_align = $args['text_align'];
1914
-		} else {
1915
-			$text_align = null;
1916
-		}
1917
-		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1918
-			$classes[]     = sanitize_html_class( $args['text_align_md'] );
1919
-			$text_align_md = $args['text_align_md'];
1920
-		} else {
1921
-			$text_align_md = null;
1922
-		}
1923
-		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1924
-			if ( $text_align == null && $text_align_md == null ) {
1925
-				$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1926
-			} else {
1927
-				$classes[] = sanitize_html_class( $args['text_align_lg'] );
1928
-			}
1929
-		}
1930
-	}
1931
-
1932
-	// display
1933
-	if ( ! empty( $args['display'] ) ) {
1934
-		$classes[] = sanitize_html_class( $args['display'] );
1935
-		$display   = $args['display'];
1936
-	} else {
1937
-		$display = null;
1938
-	}
1939
-	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1940
-		$classes[]  = sanitize_html_class( $args['display_md'] );
1941
-		$display_md = $args['display_md'];
1942
-	} else {
1943
-		$display_md = null;
1944
-	}
1945
-	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1946
-		if ( $display == null && $display_md == null ) {
1947
-			$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1948
-		} else {
1949
-			$classes[] = sanitize_html_class( $args['display_lg'] );
1950
-		}
1951
-	}
1952
-
1953
-	// bgtus - background transparent until scroll
1954
-	if ( ! empty( $args['bgtus'] ) ) {
1955
-		$classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1956
-	}
1957
-
1958
-	// hover animations
1959
-	if ( ! empty( $args['hover_animations'] ) ) {
1960
-		$classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1961
-	}
1962
-
1963
-	// build classes from build keys
1964
-	$build_keys = sd_get_class_build_keys();
1965
-	if ( ! empty( $build_keys ) ) {
1966
-		foreach ( $build_keys as $key ) {
1967
-
1968
-			if ( substr( $key, -4 ) == '-MTD' ) {
1969
-
1970
-				$k = str_replace( '_MTD', '', $key );
1971
-
1972
-				// Mobile, Tablet, Desktop
1973
-				if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1974
-					$classes[] = sanitize_html_class( $args[ $k ] );
1975
-					$v         = $args[ $k ];
1976
-				} else {
1977
-					$v = null;
1978
-				}
1979
-				if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1980
-					$classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1981
-					$v_md      = $args[ $k . '_md' ];
1982
-				} else {
1983
-					$v_md = null;
1984
-				}
1985
-				if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1986
-					if ( $v == null && $v_md == null ) {
1987
-						$classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1988
-					} else {
1989
-						$classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1990
-					}
1991
-				}
1992
-			} else {
1993
-				if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1994
-					continue;
1995
-				}
1996
-				if ( ! empty( $args[ $key ] ) ) {
1997
-					$classes[] = sd_sanitize_html_classes( $args[ $key ] );
1998
-				}
1999
-			}
2000
-		}
2001
-	}
2002
-
2003
-	return implode( ' ', $classes );
1665
+    $classes = array();
1666
+
1667
+    // margins.
1668
+    if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1669
+        $classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1670
+        $mt        = $args['mt'];
1671
+    } else {
1672
+        $mt = null;
1673
+    }
1674
+    if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1675
+        $classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1676
+        $mr        = $args['mr'];
1677
+    } else {
1678
+        $mr = null;
1679
+    }
1680
+    if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1681
+        $classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1682
+        $mb        = $args['mb'];
1683
+    } else {
1684
+        $mb = null;
1685
+    }
1686
+    if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1687
+        $classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1688
+        $ml        = $args['ml'];
1689
+    } else {
1690
+        $ml = null;
1691
+    }
1692
+
1693
+    // margins tablet.
1694
+    if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1695
+        $classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1696
+        $mt_md     = $args['mt_md'];
1697
+    } else {
1698
+        $mt_md = null;
1699
+    }
1700
+    if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1701
+        $classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1702
+        $mt_md     = $args['mr_md'];
1703
+    } else {
1704
+        $mr_md = null;
1705
+    }
1706
+    if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1707
+        $classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1708
+        $mt_md     = $args['mb_md'];
1709
+    } else {
1710
+        $mb_md = null;
1711
+    }
1712
+    if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1713
+        $classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1714
+        $mt_md     = $args['ml_md'];
1715
+    } else {
1716
+        $ml_md = null;
1717
+    }
1718
+
1719
+    // margins desktop.
1720
+    if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1721
+        if ( $mt == null && $mt_md == null ) {
1722
+            $classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1723
+        } else {
1724
+            $classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1725
+        }
1726
+    }
1727
+    if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1728
+        if ( $mr == null && $mr_md == null ) {
1729
+            $classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1730
+        } else {
1731
+            $classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1732
+        }
1733
+    }
1734
+    if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1735
+        if ( $mb == null && $mb_md == null ) {
1736
+            $classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1737
+        } else {
1738
+            $classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1739
+        }
1740
+    }
1741
+    if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1742
+        if ( $ml == null && $ml_md == null ) {
1743
+            $classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1744
+        } else {
1745
+            $classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1746
+        }
1747
+    }
1748
+
1749
+    // padding.
1750
+    if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1751
+        $classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1752
+        $pt        = $args['pt'];
1753
+    } else {
1754
+        $pt = null;
1755
+    }
1756
+    if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1757
+        $classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1758
+        $pr        = $args['pr'];
1759
+    } else {
1760
+        $pr = null;
1761
+    }
1762
+    if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1763
+        $classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1764
+        $pb        = $args['pb'];
1765
+    } else {
1766
+        $pb = null;
1767
+    }
1768
+    if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1769
+        $classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1770
+        $pl        = $args['pl'];
1771
+    } else {
1772
+        $pl = null;
1773
+    }
1774
+
1775
+    // padding tablet.
1776
+    if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1777
+        $classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1778
+        $pt_md     = $args['pt_md'];
1779
+    } else {
1780
+        $pt_md = null;
1781
+    }
1782
+    if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1783
+        $classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1784
+        $pt_md     = $args['pr_md'];
1785
+    } else {
1786
+        $pr_md = null;
1787
+    }
1788
+    if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1789
+        $classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1790
+        $pt_md     = $args['pb_md'];
1791
+    } else {
1792
+        $pb_md = null;
1793
+    }
1794
+    if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1795
+        $classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1796
+        $pt_md     = $args['pl_md'];
1797
+    } else {
1798
+        $pl_md = null;
1799
+    }
1800
+
1801
+    // padding desktop.
1802
+    if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1803
+        if ( $pt == null && $pt_md == null ) {
1804
+            $classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1805
+        } else {
1806
+            $classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1807
+        }
1808
+    }
1809
+    if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1810
+        if ( $pr == null && $pr_md == null ) {
1811
+            $classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1812
+        } else {
1813
+            $classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1814
+        }
1815
+    }
1816
+    if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1817
+        if ( $pb == null && $pb_md == null ) {
1818
+            $classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1819
+        } else {
1820
+            $classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1821
+        }
1822
+    }
1823
+    if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1824
+        if ( $pl == null && $pl_md == null ) {
1825
+            $classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1826
+        } else {
1827
+            $classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1828
+        }
1829
+    }
1830
+
1831
+    // row cols, mobile, tablet, desktop
1832
+    if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1833
+        $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1834
+        $row_cols  = $args['row_cols'];
1835
+    } else {
1836
+        $row_cols = null;
1837
+    }
1838
+    if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1839
+        $classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1840
+        $row_cols_md = $args['row_cols_md'];
1841
+    } else {
1842
+        $row_cols_md = null;
1843
+    }
1844
+    if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1845
+        if ( $row_cols == null && $row_cols_md == null ) {
1846
+            $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1847
+        } else {
1848
+            $classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1849
+        }
1850
+    }
1851
+
1852
+    // columns , mobile, tablet, desktop
1853
+    if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1854
+        $classes[] = sanitize_html_class( 'col-' . $args['col'] );
1855
+        $col       = $args['col'];
1856
+    } else {
1857
+        $col = null;
1858
+    }
1859
+    if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1860
+        $classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1861
+        $col_md    = $args['col_md'];
1862
+    } else {
1863
+        $col_md = null;
1864
+    }
1865
+    if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1866
+        if ( $col == null && $col_md == null ) {
1867
+            $classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1868
+        } else {
1869
+            $classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1870
+        }
1871
+    }
1872
+
1873
+    // border
1874
+    if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1875
+        $classes[] = 'border-0';
1876
+    } elseif ( ! empty( $args['border'] ) ) {
1877
+        $classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1878
+    }
1879
+
1880
+    // border radius type
1881
+    if ( ! empty( $args['rounded'] ) ) {
1882
+        $classes[] = sanitize_html_class( $args['rounded'] );
1883
+    }
1884
+
1885
+    // border radius size
1886
+    if ( ! empty( $args['rounded_size'] ) ) {
1887
+        $classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1888
+        // if we set a size then we need to remove "rounded" if set
1889
+        if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1890
+            unset( $classes[ $key ] );
1891
+        }
1892
+    }
1893
+
1894
+    // shadow
1895
+    //if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1896
+
1897
+    // background
1898
+    if ( ! empty( $args['bg'] ) ) {
1899
+        $classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1900
+    }
1901
+
1902
+    // text_color
1903
+    if ( ! empty( $args['text_color'] ) ) {
1904
+        $classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1905
+    }
1906
+
1907
+    // text_align
1908
+    if ( ! empty( $args['text_justify'] ) ) {
1909
+        $classes[] = 'text-justify';
1910
+    } else {
1911
+        if ( ! empty( $args['text_align'] ) ) {
1912
+            $classes[]  = sanitize_html_class( $args['text_align'] );
1913
+            $text_align = $args['text_align'];
1914
+        } else {
1915
+            $text_align = null;
1916
+        }
1917
+        if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1918
+            $classes[]     = sanitize_html_class( $args['text_align_md'] );
1919
+            $text_align_md = $args['text_align_md'];
1920
+        } else {
1921
+            $text_align_md = null;
1922
+        }
1923
+        if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1924
+            if ( $text_align == null && $text_align_md == null ) {
1925
+                $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1926
+            } else {
1927
+                $classes[] = sanitize_html_class( $args['text_align_lg'] );
1928
+            }
1929
+        }
1930
+    }
1931
+
1932
+    // display
1933
+    if ( ! empty( $args['display'] ) ) {
1934
+        $classes[] = sanitize_html_class( $args['display'] );
1935
+        $display   = $args['display'];
1936
+    } else {
1937
+        $display = null;
1938
+    }
1939
+    if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1940
+        $classes[]  = sanitize_html_class( $args['display_md'] );
1941
+        $display_md = $args['display_md'];
1942
+    } else {
1943
+        $display_md = null;
1944
+    }
1945
+    if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1946
+        if ( $display == null && $display_md == null ) {
1947
+            $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1948
+        } else {
1949
+            $classes[] = sanitize_html_class( $args['display_lg'] );
1950
+        }
1951
+    }
1952
+
1953
+    // bgtus - background transparent until scroll
1954
+    if ( ! empty( $args['bgtus'] ) ) {
1955
+        $classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1956
+    }
1957
+
1958
+    // hover animations
1959
+    if ( ! empty( $args['hover_animations'] ) ) {
1960
+        $classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1961
+    }
1962
+
1963
+    // build classes from build keys
1964
+    $build_keys = sd_get_class_build_keys();
1965
+    if ( ! empty( $build_keys ) ) {
1966
+        foreach ( $build_keys as $key ) {
1967
+
1968
+            if ( substr( $key, -4 ) == '-MTD' ) {
1969
+
1970
+                $k = str_replace( '_MTD', '', $key );
1971
+
1972
+                // Mobile, Tablet, Desktop
1973
+                if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1974
+                    $classes[] = sanitize_html_class( $args[ $k ] );
1975
+                    $v         = $args[ $k ];
1976
+                } else {
1977
+                    $v = null;
1978
+                }
1979
+                if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1980
+                    $classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1981
+                    $v_md      = $args[ $k . '_md' ];
1982
+                } else {
1983
+                    $v_md = null;
1984
+                }
1985
+                if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1986
+                    if ( $v == null && $v_md == null ) {
1987
+                        $classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1988
+                    } else {
1989
+                        $classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1990
+                    }
1991
+                }
1992
+            } else {
1993
+                if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1994
+                    continue;
1995
+                }
1996
+                if ( ! empty( $args[ $key ] ) ) {
1997
+                    $classes[] = sd_sanitize_html_classes( $args[ $key ] );
1998
+                }
1999
+            }
2000
+        }
2001
+    }
2002
+
2003
+    return implode( ' ', $classes );
2004 2004
 }
2005 2005
 
2006 2006
 /**
@@ -2012,85 +2012,85 @@  discard block
 block discarded – undo
2012 2012
  */
2013 2013
 function sd_build_aui_styles( $args ) {
2014 2014
 
2015
-	$styles = array();
2016
-
2017
-	// background color
2018
-	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2019
-		if ( $args['bg'] == 'custom-color' ) {
2020
-			$styles['background-color'] = $args['bg_color'];
2021
-		} elseif ( $args['bg'] == 'custom-gradient' ) {
2022
-			$styles['background-image'] = $args['bg_gradient'];
2023
-
2024
-			// use background on text.
2025
-			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2026
-				$styles['background-clip']         = 'text';
2027
-				$styles['-webkit-background-clip'] = 'text';
2028
-				$styles['text-fill-color']         = 'transparent';
2029
-				$styles['-webkit-text-fill-color'] = 'transparent';
2030
-			}
2031
-		}
2032
-	}
2033
-
2034
-	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2035
-		$hasImage = true;
2036
-		if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2037
-			$styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2038
-			$styles['background-blend-mode'] = 'overlay';
2039
-		} elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2040
-			$styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2041
-		} elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2042
-			// do nothing as we alreay have a preset
2043
-			$hasImage = false;
2044
-		} else {
2045
-			$styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2046
-		}
2047
-
2048
-		if ( $hasImage ) {
2049
-			$styles['background-size'] = 'cover';
2050
-
2051
-			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2052
-				$styles['background-attachment'] = 'fixed';
2053
-			}
2054
-		}
2055
-
2056
-		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2057
-			$styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2058
-		}
2059
-	}
2060
-
2061
-	// sticky offset top
2062
-	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2063
-		$styles['top'] = absint( $args['sticky_offset_top'] );
2064
-	}
2065
-
2066
-	// sticky offset bottom
2067
-	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2068
-		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2069
-	}
2070
-
2071
-	// font size
2072
-	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2073
-		$styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2074
-	}
2075
-
2076
-	// font color
2077
-	if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2078
-		$styles['color'] = esc_attr( $args['text_color_custom'] );
2079
-	}
2080
-
2081
-	// font line height
2082
-	if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2083
-		$styles['line-height'] = esc_attr( $args['font_line_height'] );
2084
-	}
2085
-
2086
-	$style_string = '';
2087
-	if ( ! empty( $styles ) ) {
2088
-		foreach ( $styles as $key => $val ) {
2089
-			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2090
-		}
2091
-	}
2092
-
2093
-	return $style_string;
2015
+    $styles = array();
2016
+
2017
+    // background color
2018
+    if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2019
+        if ( $args['bg'] == 'custom-color' ) {
2020
+            $styles['background-color'] = $args['bg_color'];
2021
+        } elseif ( $args['bg'] == 'custom-gradient' ) {
2022
+            $styles['background-image'] = $args['bg_gradient'];
2023
+
2024
+            // use background on text.
2025
+            if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2026
+                $styles['background-clip']         = 'text';
2027
+                $styles['-webkit-background-clip'] = 'text';
2028
+                $styles['text-fill-color']         = 'transparent';
2029
+                $styles['-webkit-text-fill-color'] = 'transparent';
2030
+            }
2031
+        }
2032
+    }
2033
+
2034
+    if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2035
+        $hasImage = true;
2036
+        if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2037
+            $styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2038
+            $styles['background-blend-mode'] = 'overlay';
2039
+        } elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2040
+            $styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2041
+        } elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2042
+            // do nothing as we alreay have a preset
2043
+            $hasImage = false;
2044
+        } else {
2045
+            $styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2046
+        }
2047
+
2048
+        if ( $hasImage ) {
2049
+            $styles['background-size'] = 'cover';
2050
+
2051
+            if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2052
+                $styles['background-attachment'] = 'fixed';
2053
+            }
2054
+        }
2055
+
2056
+        if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2057
+            $styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2058
+        }
2059
+    }
2060
+
2061
+    // sticky offset top
2062
+    if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2063
+        $styles['top'] = absint( $args['sticky_offset_top'] );
2064
+    }
2065
+
2066
+    // sticky offset bottom
2067
+    if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2068
+        $styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2069
+    }
2070
+
2071
+    // font size
2072
+    if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2073
+        $styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2074
+    }
2075
+
2076
+    // font color
2077
+    if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2078
+        $styles['color'] = esc_attr( $args['text_color_custom'] );
2079
+    }
2080
+
2081
+    // font line height
2082
+    if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2083
+        $styles['line-height'] = esc_attr( $args['font_line_height'] );
2084
+    }
2085
+
2086
+    $style_string = '';
2087
+    if ( ! empty( $styles ) ) {
2088
+        foreach ( $styles as $key => $val ) {
2089
+            $style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2090
+        }
2091
+    }
2092
+
2093
+    return $style_string;
2094 2094
 
2095 2095
 }
2096 2096
 
@@ -2103,19 +2103,19 @@  discard block
 block discarded – undo
2103 2103
  * @return string
2104 2104
  */
2105 2105
 function sd_sanitize_html_classes( $classes, $sep = ' ' ) {
2106
-	$return = '';
2106
+    $return = '';
2107 2107
 
2108
-	if ( ! is_array( $classes ) ) {
2109
-		$classes = explode( $sep, $classes );
2110
-	}
2108
+    if ( ! is_array( $classes ) ) {
2109
+        $classes = explode( $sep, $classes );
2110
+    }
2111 2111
 
2112
-	if ( ! empty( $classes ) ) {
2113
-		foreach ( $classes as $class ) {
2114
-			$return .= sanitize_html_class( $class ) . ' ';
2115
-		}
2116
-	}
2112
+    if ( ! empty( $classes ) ) {
2113
+        foreach ( $classes as $class ) {
2114
+            $return .= sanitize_html_class( $class ) . ' ';
2115
+        }
2116
+    }
2117 2117
 
2118
-	return $return;
2118
+    return $return;
2119 2119
 }
2120 2120
 
2121 2121
 
@@ -2125,26 +2125,26 @@  discard block
 block discarded – undo
2125 2125
  * @return void
2126 2126
  */
2127 2127
 function sd_get_class_build_keys() {
2128
-	$keys = array(
2129
-		'container',
2130
-		'position',
2131
-		'flex_direction',
2132
-		'shadow',
2133
-		'rounded',
2134
-		'nav_style',
2135
-		'horizontal_alignment',
2136
-		'nav_fill',
2137
-		'width',
2138
-		'font_weight',
2139
-		'font_size',
2140
-		'font_case',
2141
-		'css_class',
2142
-		'flex_align_items-MTD',
2143
-		'flex_justify_content-MTD',
2144
-		'flex_align_self-MTD',
2145
-		'flex_order-MTD',
2146
-		'styleid',
2147
-	);
2148
-
2149
-	return apply_filters( 'sd_class_build_keys', $keys );
2128
+    $keys = array(
2129
+        'container',
2130
+        'position',
2131
+        'flex_direction',
2132
+        'shadow',
2133
+        'rounded',
2134
+        'nav_style',
2135
+        'horizontal_alignment',
2136
+        'nav_fill',
2137
+        'width',
2138
+        'font_weight',
2139
+        'font_size',
2140
+        'font_case',
2141
+        'css_class',
2142
+        'flex_align_items-MTD',
2143
+        'flex_justify_content-MTD',
2144
+        'flex_align_self-MTD',
2145
+        'flex_order-MTD',
2146
+        'styleid',
2147
+    );
2148
+
2149
+    return apply_filters( 'sd_class_build_keys', $keys );
2150 2150
 }
Please login to merge, or discard this patch.
Spacing   +580 added lines, -580 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * @return mixed|void
38 38
  */
39 39
 function sd_widget_exclude() {
40
-	return apply_filters( 'sd_widget_exclude', array() );
40
+	return apply_filters('sd_widget_exclude', array());
41 41
 }
42 42
 
43 43
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
  *
50 50
  * @return array
51 51
  */
52
-function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) {
52
+function sd_get_margin_input($type = 'mt', $overwrite = array(), $include_negatives = true) {
53 53
 	$options = array(
54
-		''     => __( 'None', 'super-duper' ),
55
-		'auto' => __( 'auto', 'super-duper' ),
54
+		''     => __('None', 'super-duper'),
55
+		'auto' => __('auto', 'super-duper'),
56 56
 		'0'    => '0',
57 57
 		'1'    => '1',
58 58
 		'2'    => '2',
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		'12'    => '12',
69 69
 	);
70 70
 
71
-	if ( $include_negatives ) {
71
+	if ($include_negatives) {
72 72
 		$options['n1'] = '-1';
73 73
 		$options['n2'] = '-2';
74 74
 		$options['n3'] = '-3';
@@ -85,37 +85,37 @@  discard block
 block discarded – undo
85 85
 
86 86
 	$defaults = array(
87 87
 		'type'     => 'select',
88
-		'title'    => __( 'Margin top', 'super-duper' ),
88
+		'title'    => __('Margin top', 'super-duper'),
89 89
 		'options'  => $options,
90 90
 		'default'  => '',
91 91
 		'desc_tip' => true,
92
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
92
+		'group'    => __('Wrapper Styles', 'super-duper'),
93 93
 	);
94 94
 
95 95
 	// title
96
-	if ( $type == 'mt' ) {
97
-		$defaults['title'] = __( 'Margin top', 'super-duper' );
96
+	if ($type == 'mt') {
97
+		$defaults['title'] = __('Margin top', 'super-duper');
98 98
 		$defaults['icon']  = 'box-top';
99 99
 		$defaults['row']   = array(
100
-			'title' => __( 'Margins', 'super-duper' ),
100
+			'title' => __('Margins', 'super-duper'),
101 101
 			'key'   => 'wrapper-margins',
102 102
 			'open'  => true,
103 103
 			'class' => 'text-center',
104 104
 		);
105
-	} elseif ( $type == 'mr' ) {
106
-		$defaults['title'] = __( 'Margin right', 'super-duper' );
105
+	} elseif ($type == 'mr') {
106
+		$defaults['title'] = __('Margin right', 'super-duper');
107 107
 		$defaults['icon']  = 'box-right';
108 108
 		$defaults['row']   = array(
109 109
 			'key' => 'wrapper-margins',
110 110
 		);
111
-	} elseif ( $type == 'mb' ) {
112
-		$defaults['title'] = __( 'Margin bottom', 'super-duper' );
111
+	} elseif ($type == 'mb') {
112
+		$defaults['title'] = __('Margin bottom', 'super-duper');
113 113
 		$defaults['icon']  = 'box-bottom';
114 114
 		$defaults['row']   = array(
115 115
 			'key' => 'wrapper-margins',
116 116
 		);
117
-	} elseif ( $type == 'ml' ) {
118
-		$defaults['title'] = __( 'Margin left', 'super-duper' );
117
+	} elseif ($type == 'ml') {
118
+		$defaults['title'] = __('Margin left', 'super-duper');
119 119
 		$defaults['icon']  = 'box-left';
120 120
 		$defaults['row']   = array(
121 121
 			'key'   => 'wrapper-margins',
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		);
124 124
 	}
125 125
 
126
-	$input = wp_parse_args( $overwrite, $defaults );
126
+	$input = wp_parse_args($overwrite, $defaults);
127 127
 
128 128
 	return $input;
129 129
 }
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return array
138 138
  */
139
-function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
139
+function sd_get_padding_input($type = 'pt', $overwrite = array()) {
140 140
 	$options = array(
141
-		''  => __( 'None', 'super-duper' ),
141
+		''  => __('None', 'super-duper'),
142 142
 		'0' => '0',
143 143
 		'1' => '1',
144 144
 		'2' => '2',
@@ -156,37 +156,37 @@  discard block
 block discarded – undo
156 156
 
157 157
 	$defaults = array(
158 158
 		'type'     => 'select',
159
-		'title'    => __( 'Padding top', 'super-duper' ),
159
+		'title'    => __('Padding top', 'super-duper'),
160 160
 		'options'  => $options,
161 161
 		'default'  => '',
162 162
 		'desc_tip' => true,
163
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
163
+		'group'    => __('Wrapper Styles', 'super-duper'),
164 164
 	);
165 165
 
166 166
 	// title
167
-	if ( $type == 'pt' ) {
168
-		$defaults['title'] = __( 'Padding top', 'super-duper' );
167
+	if ($type == 'pt') {
168
+		$defaults['title'] = __('Padding top', 'super-duper');
169 169
 		$defaults['icon']  = 'box-top';
170 170
 		$defaults['row']   = array(
171
-			'title' => __( 'Padding', 'super-duper' ),
171
+			'title' => __('Padding', 'super-duper'),
172 172
 			'key'   => 'wrapper-padding',
173 173
 			'open'  => true,
174 174
 			'class' => 'text-center',
175 175
 		);
176
-	} elseif ( $type == 'pr' ) {
177
-		$defaults['title'] = __( 'Padding right', 'super-duper' );
176
+	} elseif ($type == 'pr') {
177
+		$defaults['title'] = __('Padding right', 'super-duper');
178 178
 		$defaults['icon']  = 'box-right';
179 179
 		$defaults['row']   = array(
180 180
 			'key' => 'wrapper-padding',
181 181
 		);
182
-	} elseif ( $type == 'pb' ) {
183
-		$defaults['title'] = __( 'Padding bottom', 'super-duper' );
182
+	} elseif ($type == 'pb') {
183
+		$defaults['title'] = __('Padding bottom', 'super-duper');
184 184
 		$defaults['icon']  = 'box-bottom';
185 185
 		$defaults['row']   = array(
186 186
 			'key' => 'wrapper-padding',
187 187
 		);
188
-	} elseif ( $type == 'pl' ) {
189
-		$defaults['title'] = __( 'Padding left', 'super-duper' );
188
+	} elseif ($type == 'pl') {
189
+		$defaults['title'] = __('Padding left', 'super-duper');
190 190
 		$defaults['icon']  = 'box-left';
191 191
 		$defaults['row']   = array(
192 192
 			'key'   => 'wrapper-padding',
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		);
196 196
 	}
197 197
 
198
-	$input = wp_parse_args( $overwrite, $defaults );
198
+	$input = wp_parse_args($overwrite, $defaults);
199 199
 
200 200
 	return $input;
201 201
 }
@@ -208,22 +208,22 @@  discard block
 block discarded – undo
208 208
  *
209 209
  * @return array
210 210
  */
211
-function sd_get_border_input( $type = 'border', $overwrite = array() ) {
211
+function sd_get_border_input($type = 'border', $overwrite = array()) {
212 212
 
213 213
 	$defaults = array(
214 214
 		'type'     => 'select',
215
-		'title'    => __( 'Border' ),
215
+		'title'    => __('Border'),
216 216
 		'options'  => array(),
217 217
 		'default'  => '',
218 218
 		'desc_tip' => true,
219
-		'group'    => __( 'Wrapper Styles', 'geodirectory' ),
219
+		'group'    => __('Wrapper Styles', 'geodirectory'),
220 220
 	);
221 221
 
222 222
 	// title
223
-	if ( $type == 'rounded' ) {
224
-		$defaults['title']   = __( 'Border radius type', 'super-duper' );
223
+	if ($type == 'rounded') {
224
+		$defaults['title']   = __('Border radius type', 'super-duper');
225 225
 		$defaults['options'] = array(
226
-			''               => __( 'Default', 'super-duper' ),
226
+			''               => __('Default', 'super-duper'),
227 227
 			'rounded'        => 'rounded',
228 228
 			'rounded-top'    => 'rounded-top',
229 229
 			'rounded-right'  => 'rounded-right',
@@ -233,32 +233,32 @@  discard block
 block discarded – undo
233 233
 			'rounded-pill'   => 'rounded-pill',
234 234
 			'rounded-0'      => 'rounded-0',
235 235
 		);
236
-	} elseif ( $type == 'rounded_size' ) {
237
-		$defaults['title']   = __( 'Border radius size', 'super-duper' );
236
+	} elseif ($type == 'rounded_size') {
237
+		$defaults['title']   = __('Border radius size', 'super-duper');
238 238
 		$defaults['options'] = array(
239
-			''   => __( 'Default', 'super-duper' ),
240
-			'sm' => __( 'Small', 'super-duper' ),
241
-			'lg' => __( 'Large', 'super-duper' ),
239
+			''   => __('Default', 'super-duper'),
240
+			'sm' => __('Small', 'super-duper'),
241
+			'lg' => __('Large', 'super-duper'),
242 242
 		);
243
-	} elseif ( $type == 'type' ) {
244
-		$defaults['title']   = __( 'Border type', 'super-duper' );
243
+	} elseif ($type == 'type') {
244
+		$defaults['title']   = __('Border type', 'super-duper');
245 245
 		$defaults['options'] = array(
246
-			''              => __( 'None', 'super-duper' ),
247
-			'border'        => __( 'Full', 'super-duper' ),
248
-			'border-top'    => __( 'Top', 'super-duper' ),
249
-			'border-bottom' => __( 'Bottom', 'super-duper' ),
250
-			'border-left'   => __( 'Left', 'super-duper' ),
251
-			'border-right'  => __( 'Right', 'super-duper' ),
246
+			''              => __('None', 'super-duper'),
247
+			'border'        => __('Full', 'super-duper'),
248
+			'border-top'    => __('Top', 'super-duper'),
249
+			'border-bottom' => __('Bottom', 'super-duper'),
250
+			'border-left'   => __('Left', 'super-duper'),
251
+			'border-right'  => __('Right', 'super-duper'),
252 252
 		);
253 253
 	} else {
254
-		$defaults['title']   = __( 'Border color' );
254
+		$defaults['title']   = __('Border color');
255 255
 		$defaults['options'] = array(
256
-			                       ''  => __( 'Default', 'super-duper' ),
257
-			                       '0' => __( 'None', 'super-duper' ),
256
+			                       ''  => __('Default', 'super-duper'),
257
+			                       '0' => __('None', 'super-duper'),
258 258
 		                       ) + sd_aui_colors();
259 259
 	}
260 260
 
261
-	$input = wp_parse_args( $overwrite, $defaults );
261
+	$input = wp_parse_args($overwrite, $defaults);
262 262
 
263 263
 	return $input;
264 264
 }
@@ -271,24 +271,24 @@  discard block
 block discarded – undo
271 271
  *
272 272
  * @return array
273 273
  */
274
-function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
274
+function sd_get_shadow_input($type = 'shadow', $overwrite = array()) {
275 275
 	$options = array(
276
-		''          => __( 'None', 'super-duper' ),
277
-		'shadow-sm' => __( 'Small', 'super-duper' ),
278
-		'shadow'    => __( 'Regular', 'super-duper' ),
279
-		'shadow-lg' => __( 'Large', 'super-duper' ),
276
+		''          => __('None', 'super-duper'),
277
+		'shadow-sm' => __('Small', 'super-duper'),
278
+		'shadow'    => __('Regular', 'super-duper'),
279
+		'shadow-lg' => __('Large', 'super-duper'),
280 280
 	);
281 281
 
282 282
 	$defaults = array(
283 283
 		'type'     => 'select',
284
-		'title'    => __( 'Shadow', 'super-duper' ),
284
+		'title'    => __('Shadow', 'super-duper'),
285 285
 		'options'  => $options,
286 286
 		'default'  => '',
287 287
 		'desc_tip' => true,
288
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
288
+		'group'    => __('Wrapper Styles', 'super-duper'),
289 289
 	);
290 290
 
291
-	$input = wp_parse_args( $overwrite, $defaults );
291
+	$input = wp_parse_args($overwrite, $defaults);
292 292
 
293 293
 	return $input;
294 294
 }
@@ -301,22 +301,22 @@  discard block
 block discarded – undo
301 301
  *
302 302
  * @return array
303 303
  */
304
-function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
304
+function sd_get_background_input($type = 'bg', $overwrite = array()) {
305 305
 	$options = array(
306
-		           ''            => __( 'None', 'super-duper' ),
307
-		           'transparent' => __( 'Transparent', 'super-duper' ),
306
+		           ''            => __('None', 'super-duper'),
307
+		           'transparent' => __('Transparent', 'super-duper'),
308 308
 	           ) + sd_aui_colors();
309 309
 
310 310
 	$defaults = array(
311 311
 		'type'     => 'select',
312
-		'title'    => __( 'Background color', 'super-duper' ),
312
+		'title'    => __('Background color', 'super-duper'),
313 313
 		'options'  => $options,
314 314
 		'default'  => '',
315 315
 		'desc_tip' => true,
316
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
316
+		'group'    => __('Wrapper Styles', 'super-duper'),
317 317
 	);
318 318
 
319
-	$input = wp_parse_args( $overwrite, $defaults );
319
+	$input = wp_parse_args($overwrite, $defaults);
320 320
 
321 321
 	return $input;
322 322
 }
@@ -329,95 +329,95 @@  discard block
 block discarded – undo
329 329
  *
330 330
  * @return array
331 331
  */
332
-function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
332
+function sd_get_background_inputs($type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array()) {
333 333
 	$options = array(
334
-		           ''            => __( 'None', 'super-duper' ),
335
-		           'transparent' => __( 'Transparent', 'super-duper' ),
334
+		           ''            => __('None', 'super-duper'),
335
+		           'transparent' => __('Transparent', 'super-duper'),
336 336
 	           ) + sd_aui_colors()
337 337
 	           + array(
338
-		           'custom-color'    => __( 'Custom Color', 'super-duper' ),
339
-		           'custom-gradient' => __( 'Custom Gradient', 'super-duper' ),
338
+		           'custom-color'    => __('Custom Color', 'super-duper'),
339
+		           'custom-gradient' => __('Custom Gradient', 'super-duper'),
340 340
 	           );
341 341
 
342 342
 	$defaults = array(
343 343
 		'type'     => 'select',
344
-		'title'    => __( 'Background Color', 'super-duper' ),
344
+		'title'    => __('Background Color', 'super-duper'),
345 345
 		'options'  => $options,
346 346
 		'default'  => '',
347 347
 		'desc_tip' => true,
348
-		'group'    => __( 'Background', 'super-duper' ),
348
+		'group'    => __('Background', 'super-duper'),
349 349
 	);
350 350
 
351
-	if ( $overwrite !== false ) {
352
-		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
351
+	if ($overwrite !== false) {
352
+		$input[$type] = wp_parse_args($overwrite, $defaults);
353 353
 	}
354 354
 
355
-	if ( $overwrite_color !== false ) {
356
-		$input[ $type . '_color' ] = wp_parse_args(
355
+	if ($overwrite_color !== false) {
356
+		$input[$type . '_color'] = wp_parse_args(
357 357
 			$overwrite_color,
358 358
 			array(
359 359
 				'type'            => 'color',
360
-				'title'           => __( 'Custom color', 'super-duper' ),
360
+				'title'           => __('Custom color', 'super-duper'),
361 361
 				'placeholder'     => '',
362 362
 				'default'         => '#0073aa',
363 363
 				'desc_tip'        => true,
364
-				'group'           => __( 'Background', 'super-duper' ),
364
+				'group'           => __('Background', 'super-duper'),
365 365
 				'element_require' => '[%' . $type . '%]=="custom-color"',
366 366
 			)
367 367
 		);
368 368
 	}
369 369
 
370
-	if ( $overwrite_gradient !== false ) {
371
-		$input[ $type . '_gradient' ] = wp_parse_args(
370
+	if ($overwrite_gradient !== false) {
371
+		$input[$type . '_gradient'] = wp_parse_args(
372 372
 			$overwrite_gradient,
373 373
 			array(
374 374
 				'type'            => 'gradient',
375
-				'title'           => __( 'Custom gradient', 'super-duper' ),
375
+				'title'           => __('Custom gradient', 'super-duper'),
376 376
 				'placeholder'     => '',
377 377
 				'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
378 378
 				'desc_tip'        => true,
379
-				'group'           => __( 'Background', 'super-duper' ),
379
+				'group'           => __('Background', 'super-duper'),
380 380
 				'element_require' => '[%' . $type . '%]=="custom-gradient"',
381 381
 			)
382 382
 		);
383 383
 	}
384 384
 
385
-	if ( $overwrite_image !== false ) {
385
+	if ($overwrite_image !== false) {
386 386
 
387
-		$input[ $type . '_image_fixed' ] = array(
387
+		$input[$type . '_image_fixed'] = array(
388 388
 			'type'            => 'checkbox',
389
-			'title'           => __( 'Fixed background', 'super-duper' ),
389
+			'title'           => __('Fixed background', 'super-duper'),
390 390
 			'default'         => '',
391 391
 			'desc_tip'        => true,
392
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background' ),
392
+			'group'           => !empty($overwrite_image['group']) ? $overwrite_image['group'] : __('Background'),
393 393
 			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
394 394
 
395 395
 		);
396 396
 
397
-		$input[ $type . '_image_use_featured' ] = array(
397
+		$input[$type . '_image_use_featured'] = array(
398 398
 			'type'            => 'checkbox',
399
-			'title'           => __( 'Use featured image', 'super-duper' ),
399
+			'title'           => __('Use featured image', 'super-duper'),
400 400
 			'default'         => '',
401 401
 			'desc_tip'        => true,
402
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
402
+			'group'           => !empty($overwrite_image['group']) ? $overwrite_image['group'] : __('Background', 'super-duper'),
403 403
 			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
404 404
 
405 405
 		);
406 406
 
407
-		$input[ $type . '_image' ] = wp_parse_args(
407
+		$input[$type . '_image'] = wp_parse_args(
408 408
 			$overwrite_image,
409 409
 			array(
410 410
 				'type'        => 'image',
411
-				'title'       => __( 'Custom image', 'super-duper' ),
411
+				'title'       => __('Custom image', 'super-duper'),
412 412
 				'placeholder' => '',
413 413
 				'default'     => '',
414 414
 				'desc_tip'    => true,
415
-				'group'       => __( 'Background', 'super-duper' ),
415
+				'group'       => __('Background', 'super-duper'),
416 416
 				//          'element_require' => ' ![%' . $type . '_image_use_featured%] '
417 417
 			)
418 418
 		);
419 419
 
420
-		$input[ $type . '_image_id' ] = wp_parse_args(
420
+		$input[$type . '_image_id'] = wp_parse_args(
421 421
 			$overwrite_image,
422 422
 			array(
423 423
 				'type'        => 'hidden',
@@ -425,18 +425,18 @@  discard block
 block discarded – undo
425 425
 				'title'       => '',
426 426
 				'placeholder' => '',
427 427
 				'default'     => '',
428
-				'group'       => __( 'Background', 'super-duper' ),
428
+				'group'       => __('Background', 'super-duper'),
429 429
 			)
430 430
 		);
431 431
 
432
-		$input[ $type . '_image_xy' ] = wp_parse_args(
432
+		$input[$type . '_image_xy'] = wp_parse_args(
433 433
 			$overwrite_image,
434 434
 			array(
435 435
 				'type'        => 'image_xy',
436 436
 				'title'       => '',
437 437
 				'placeholder' => '',
438 438
 				'default'     => '',
439
-				'group'       => __( 'Background', 'super-duper' ),
439
+				'group'       => __('Background', 'super-duper'),
440 440
 			)
441 441
 		);
442 442
 	}
@@ -452,102 +452,102 @@  discard block
 block discarded – undo
452 452
  *
453 453
  * @return array
454 454
  */
455
-function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
455
+function sd_get_shape_divider_inputs($type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array()) {
456 456
 
457 457
 	$options = array(
458
-		''                      => __( 'None', 'super-duper' ),
459
-		'mountains'             => __( 'Mountains', 'super-duper' ),
460
-		'drops'                 => __( 'Drops', 'super-duper' ),
461
-		'clouds'                => __( 'Clouds', 'super-duper' ),
462
-		'zigzag'                => __( 'Zigzag', 'super-duper' ),
463
-		'pyramids'              => __( 'Pyramids', 'super-duper' ),
464
-		'triangle'              => __( 'Triangle', 'super-duper' ),
465
-		'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
466
-		'tilt'                  => __( 'Tilt', 'super-duper' ),
467
-		'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
468
-		'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
469
-		'curve'                 => __( 'Curve', 'super-duper' ),
470
-		'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
471
-		'waves'                 => __( 'Waves', 'super-duper' ),
472
-		'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
473
-		'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
474
-		'arrow'                 => __( 'Arrow', 'super-duper' ),
475
-		'split'                 => __( 'Split', 'super-duper' ),
476
-		'book'                  => __( 'Book', 'super-duper' ),
458
+		''                      => __('None', 'super-duper'),
459
+		'mountains'             => __('Mountains', 'super-duper'),
460
+		'drops'                 => __('Drops', 'super-duper'),
461
+		'clouds'                => __('Clouds', 'super-duper'),
462
+		'zigzag'                => __('Zigzag', 'super-duper'),
463
+		'pyramids'              => __('Pyramids', 'super-duper'),
464
+		'triangle'              => __('Triangle', 'super-duper'),
465
+		'triangle-asymmetrical' => __('Triangle Asymmetrical', 'super-duper'),
466
+		'tilt'                  => __('Tilt', 'super-duper'),
467
+		'opacity-tilt'          => __('Opacity Tilt', 'super-duper'),
468
+		'opacity-fan'           => __('Opacity Fan', 'super-duper'),
469
+		'curve'                 => __('Curve', 'super-duper'),
470
+		'curve-asymmetrical'    => __('Curve Asymmetrical', 'super-duper'),
471
+		'waves'                 => __('Waves', 'super-duper'),
472
+		'wave-brush'            => __('Wave Brush', 'super-duper'),
473
+		'waves-pattern'         => __('Waves Pattern', 'super-duper'),
474
+		'arrow'                 => __('Arrow', 'super-duper'),
475
+		'split'                 => __('Split', 'super-duper'),
476
+		'book'                  => __('Book', 'super-duper'),
477 477
 	);
478 478
 
479 479
 	$defaults = array(
480 480
 		'type'     => 'select',
481
-		'title'    => __( 'Type', 'super-duper' ),
481
+		'title'    => __('Type', 'super-duper'),
482 482
 		'options'  => $options,
483 483
 		'default'  => '',
484 484
 		'desc_tip' => true,
485
-		'group'    => __( 'Shape Divider', 'super-duper' ),
485
+		'group'    => __('Shape Divider', 'super-duper'),
486 486
 	);
487 487
 
488
-	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
488
+	$input[$type] = wp_parse_args($overwrite, $defaults);
489 489
 
490
-	$input[ $type . '_notice' ] = array(
490
+	$input[$type . '_notice'] = array(
491 491
 		'type'            => 'notice',
492
-		'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
492
+		'desc'            => __('Parent element must be position `relative`', 'super-duper'),
493 493
 		'status'          => 'warning',
494
-		'group'           => __( 'Shape Divider', 'super-duper' ),
494
+		'group'           => __('Shape Divider', 'super-duper'),
495 495
 		'element_require' => '[%' . $type . '%]!=""',
496 496
 	);
497 497
 
498
-	$input[ $type . '_position' ] = wp_parse_args(
498
+	$input[$type . '_position'] = wp_parse_args(
499 499
 		$overwrite_color,
500 500
 		array(
501 501
 			'type'            => 'select',
502
-			'title'           => __( 'Position', 'super-duper' ),
502
+			'title'           => __('Position', 'super-duper'),
503 503
 			'options'         => array(
504
-				'top'    => __( 'Top', 'super-duper' ),
505
-				'bottom' => __( 'Bottom', 'super-duper' ),
504
+				'top'    => __('Top', 'super-duper'),
505
+				'bottom' => __('Bottom', 'super-duper'),
506 506
 			),
507 507
 			'desc_tip'        => true,
508
-			'group'           => __( 'Shape Divider', 'super-duper' ),
508
+			'group'           => __('Shape Divider', 'super-duper'),
509 509
 			'element_require' => '[%' . $type . '%]!=""',
510 510
 		)
511 511
 	);
512 512
 
513 513
 	$options = array(
514
-		           ''            => __( 'None', 'super-duper' ),
515
-		           'transparent' => __( 'Transparent', 'super-duper' ),
514
+		           ''            => __('None', 'super-duper'),
515
+		           'transparent' => __('Transparent', 'super-duper'),
516 516
 	           ) + sd_aui_colors()
517 517
 	           + array(
518
-		           'custom-color' => __( 'Custom Color', 'super-duper' ),
518
+		           'custom-color' => __('Custom Color', 'super-duper'),
519 519
 	           );
520 520
 
521
-	$input[ $type . '_color' ] = wp_parse_args(
521
+	$input[$type . '_color'] = wp_parse_args(
522 522
 		$overwrite_color,
523 523
 		array(
524 524
 			'type'            => 'select',
525
-			'title'           => __( 'Color', 'super-duper' ),
525
+			'title'           => __('Color', 'super-duper'),
526 526
 			'options'         => $options,
527 527
 			'desc_tip'        => true,
528
-			'group'           => __( 'Shape Divider', 'super-duper' ),
528
+			'group'           => __('Shape Divider', 'super-duper'),
529 529
 			'element_require' => '[%' . $type . '%]!=""',
530 530
 		)
531 531
 	);
532 532
 
533
-	$input[ $type . '_custom_color' ] = wp_parse_args(
533
+	$input[$type . '_custom_color'] = wp_parse_args(
534 534
 		$overwrite_color,
535 535
 		array(
536 536
 			'type'            => 'color',
537
-			'title'           => __( 'Custom color', 'super-duper' ),
537
+			'title'           => __('Custom color', 'super-duper'),
538 538
 			'placeholder'     => '',
539 539
 			'default'         => '#0073aa',
540 540
 			'desc_tip'        => true,
541
-			'group'           => __( 'Shape Divider', 'super-duper' ),
541
+			'group'           => __('Shape Divider', 'super-duper'),
542 542
 			'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
543 543
 		)
544 544
 	);
545 545
 
546
-	$input[ $type . '_width' ] = wp_parse_args(
546
+	$input[$type . '_width'] = wp_parse_args(
547 547
 		$overwrite_gradient,
548 548
 		array(
549 549
 			'type'              => 'range',
550
-			'title'             => __( 'Width', 'super-duper' ),
550
+			'title'             => __('Width', 'super-duper'),
551 551
 			'placeholder'       => '',
552 552
 			'default'           => '200',
553 553
 			'desc_tip'          => true,
@@ -555,69 +555,69 @@  discard block
 block discarded – undo
555 555
 				'min' => 100,
556 556
 				'max' => 300,
557 557
 			),
558
-			'group'             => __( 'Shape Divider', 'super-duper' ),
558
+			'group'             => __('Shape Divider', 'super-duper'),
559 559
 			'element_require'   => '[%' . $type . '%]!=""',
560 560
 		)
561 561
 	);
562 562
 
563
-	$input[ $type . '_height' ] = array(
563
+	$input[$type . '_height'] = array(
564 564
 		'type'              => 'range',
565
-		'title'             => __( 'Height', 'super-duper' ),
565
+		'title'             => __('Height', 'super-duper'),
566 566
 		'default'           => '100',
567 567
 		'desc_tip'          => true,
568 568
 		'custom_attributes' => array(
569 569
 			'min' => 0,
570 570
 			'max' => 500,
571 571
 		),
572
-		'group'             => __( 'Shape Divider', 'super-duper' ),
572
+		'group'             => __('Shape Divider', 'super-duper'),
573 573
 		'element_require'   => '[%' . $type . '%]!=""',
574 574
 	);
575 575
 
576 576
 	$requires = array(
577
-		'mountains'             => array( 'flip' ),
578
-		'drops'                 => array( 'flip', 'invert' ),
579
-		'clouds'                => array( 'flip', 'invert' ),
577
+		'mountains'             => array('flip'),
578
+		'drops'                 => array('flip', 'invert'),
579
+		'clouds'                => array('flip', 'invert'),
580 580
 		'zigzag'                => array(),
581
-		'pyramids'              => array( 'flip', 'invert' ),
582
-		'triangle'              => array( 'invert' ),
583
-		'triangle-asymmetrical' => array( 'flip', 'invert' ),
584
-		'tilt'                  => array( 'flip' ),
585
-		'opacity-tilt'          => array( 'flip' ),
581
+		'pyramids'              => array('flip', 'invert'),
582
+		'triangle'              => array('invert'),
583
+		'triangle-asymmetrical' => array('flip', 'invert'),
584
+		'tilt'                  => array('flip'),
585
+		'opacity-tilt'          => array('flip'),
586 586
 		'opacity-fan'           => array(),
587
-		'curve'                 => array( 'invert' ),
588
-		'curve-asymmetrical'    => array( 'flip', 'invert' ),
589
-		'waves'                 => array( 'flip', 'invert' ),
590
-		'wave-brush'            => array( 'flip' ),
591
-		'waves-pattern'         => array( 'flip' ),
592
-		'arrow'                 => array( 'invert' ),
593
-		'split'                 => array( 'invert' ),
594
-		'book'                  => array( 'invert' ),
587
+		'curve'                 => array('invert'),
588
+		'curve-asymmetrical'    => array('flip', 'invert'),
589
+		'waves'                 => array('flip', 'invert'),
590
+		'wave-brush'            => array('flip'),
591
+		'waves-pattern'         => array('flip'),
592
+		'arrow'                 => array('invert'),
593
+		'split'                 => array('invert'),
594
+		'book'                  => array('invert'),
595 595
 	);
596 596
 
597
-	$input[ $type . '_flip' ] = array(
597
+	$input[$type . '_flip'] = array(
598 598
 		'type'            => 'checkbox',
599
-		'title'           => __( 'Flip', 'super-duper' ),
599
+		'title'           => __('Flip', 'super-duper'),
600 600
 		'default'         => '',
601 601
 		'desc_tip'        => true,
602
-		'group'           => __( 'Shape Divider', 'super-duper' ),
603
-		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
602
+		'group'           => __('Shape Divider', 'super-duper'),
603
+		'element_require' => sd_get_element_require_string($requires, 'flip', 'sd'),
604 604
 	);
605 605
 
606
-	$input[ $type . '_invert' ] = array(
606
+	$input[$type . '_invert'] = array(
607 607
 		'type'            => 'checkbox',
608
-		'title'           => __( 'Invert', 'super-duper' ),
608
+		'title'           => __('Invert', 'super-duper'),
609 609
 		'default'         => '',
610 610
 		'desc_tip'        => true,
611
-		'group'           => __( 'Shape Divider', 'super-duper' ),
612
-		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
611
+		'group'           => __('Shape Divider', 'super-duper'),
612
+		'element_require' => sd_get_element_require_string($requires, 'invert', 'sd'),
613 613
 	);
614 614
 
615
-	$input[ $type . '_btf' ] = array(
615
+	$input[$type . '_btf'] = array(
616 616
 		'type'            => 'checkbox',
617
-		'title'           => __( 'Bring to front', 'super-duper' ),
617
+		'title'           => __('Bring to front', 'super-duper'),
618 618
 		'default'         => '',
619 619
 		'desc_tip'        => true,
620
-		'group'           => __( 'Shape Divider', 'super-duper' ),
620
+		'group'           => __('Shape Divider', 'super-duper'),
621 621
 		'element_require' => '[%' . $type . '%]!=""',
622 622
 
623 623
 	);
@@ -634,19 +634,19 @@  discard block
 block discarded – undo
634 634
  *
635 635
  * @return string
636 636
  */
637
-function sd_get_element_require_string( $args, $key, $type ) {
637
+function sd_get_element_require_string($args, $key, $type) {
638 638
 	$output   = '';
639 639
 	$requires = array();
640 640
 
641
-	if ( ! empty( $args ) ) {
642
-		foreach ( $args as $t => $k ) {
643
-			if ( in_array( $key, $k ) ) {
641
+	if (!empty($args)) {
642
+		foreach ($args as $t => $k) {
643
+			if (in_array($key, $k)) {
644 644
 				$requires[] = '[%' . $type . '%]=="' . $t . '"';
645 645
 			}
646 646
 		}
647 647
 
648
-		if ( ! empty( $requires ) ) {
649
-			$output = '(' . implode( ' || ', $requires ) . ')';
648
+		if (!empty($requires)) {
649
+			$output = '(' . implode(' || ', $requires) . ')';
650 650
 		}
651 651
 	}
652 652
 
@@ -661,39 +661,39 @@  discard block
 block discarded – undo
661 661
  *
662 662
  * @return array
663 663
  */
664
-function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) {
664
+function sd_get_text_color_input($type = 'text_color', $overwrite = array(), $has_custom = false) {
665 665
 	$options = array(
666
-		           '' => __( 'None', 'super-duper' ),
666
+		           '' => __('None', 'super-duper'),
667 667
 	           ) + sd_aui_colors();
668 668
 
669
-	if ( $has_custom ) {
670
-		$options['custom'] = __( 'Custom color', 'super-duper' );
669
+	if ($has_custom) {
670
+		$options['custom'] = __('Custom color', 'super-duper');
671 671
 	}
672 672
 
673 673
 	$defaults = array(
674 674
 		'type'     => 'select',
675
-		'title'    => __( 'Text color', 'super-duper' ),
675
+		'title'    => __('Text color', 'super-duper'),
676 676
 		'options'  => $options,
677 677
 		'default'  => '',
678 678
 		'desc_tip' => true,
679
-		'group'    => __( 'Typography', 'super-duper' ),
679
+		'group'    => __('Typography', 'super-duper'),
680 680
 	);
681 681
 
682
-	$input = wp_parse_args( $overwrite, $defaults );
682
+	$input = wp_parse_args($overwrite, $defaults);
683 683
 
684 684
 	return $input;
685 685
 }
686 686
 
687
-function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) {
687
+function sd_get_text_color_input_group($type = 'text_color', $overwrite = array(), $overwrite_custom = array()) {
688 688
 	$inputs = array();
689 689
 
690
-	if ( $overwrite !== false ) {
691
-		$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
690
+	if ($overwrite !== false) {
691
+		$inputs[$type] = sd_get_text_color_input($type, $overwrite, true);
692 692
 	}
693 693
 
694
-	if ( $overwrite_custom !== false ) {
694
+	if ($overwrite_custom !== false) {
695 695
 		$custom            = $type . '_custom';
696
-		$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
696
+		$inputs[$custom] = sd_get_custom_color_input($custom, $overwrite_custom, $type);
697 697
 	}
698 698
 
699 699
 	return $inputs;
@@ -707,22 +707,22 @@  discard block
 block discarded – undo
707 707
  *
708 708
  * @return array
709 709
  */
710
-function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) {
710
+function sd_get_custom_color_input($type = 'color_custom', $overwrite = array(), $parent_type = '') {
711 711
 
712 712
 	$defaults = array(
713 713
 		'type'        => 'color',
714
-		'title'       => __( 'Custom color', 'super-duper' ),
714
+		'title'       => __('Custom color', 'super-duper'),
715 715
 		'default'     => '',
716 716
 		'placeholder' => '',
717 717
 		'desc_tip'    => true,
718
-		'group'       => __( 'Typography', 'super-duper' ),
718
+		'group'       => __('Typography', 'super-duper'),
719 719
 	);
720 720
 
721
-	if ( $parent_type ) {
721
+	if ($parent_type) {
722 722
 		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
723 723
 	}
724 724
 
725
-	$input = wp_parse_args( $overwrite, $defaults );
725
+	$input = wp_parse_args($overwrite, $defaults);
726 726
 
727 727
 	return $input;
728 728
 }
@@ -735,18 +735,18 @@  discard block
 block discarded – undo
735 735
  *
736 736
  * @return array
737 737
  */
738
-function sd_get_col_input( $type = 'col', $overwrite = array() ) {
738
+function sd_get_col_input($type = 'col', $overwrite = array()) {
739 739
 
740 740
 	$device_size = '';
741
-	if ( ! empty( $overwrite['device_type'] ) ) {
742
-		if ( $overwrite['device_type'] == 'Tablet' ) {
741
+	if (!empty($overwrite['device_type'])) {
742
+		if ($overwrite['device_type'] == 'Tablet') {
743 743
 			$device_size = '-md';
744
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
744
+		} elseif ($overwrite['device_type'] == 'Desktop') {
745 745
 			$device_size = '-lg';
746 746
 		}
747 747
 	}
748 748
 	$options = array(
749
-		''   => __( 'auto', 'super-duper' ),
749
+		''   => __('auto', 'super-duper'),
750 750
 		'1'  => '1/12',
751 751
 		'2'  => '2/12',
752 752
 		'3'  => '3/12',
@@ -763,15 +763,15 @@  discard block
 block discarded – undo
763 763
 
764 764
 	$defaults = array(
765 765
 		'type'            => 'select',
766
-		'title'           => __( 'Column width', 'super-duper' ),
766
+		'title'           => __('Column width', 'super-duper'),
767 767
 		'options'         => $options,
768 768
 		'default'         => '',
769 769
 		'desc_tip'        => true,
770
-		'group'           => __( 'Container', 'super-duper' ),
770
+		'group'           => __('Container', 'super-duper'),
771 771
 		'element_require' => '[%container%]=="col"',
772 772
 	);
773 773
 
774
-	$input = wp_parse_args( $overwrite, $defaults );
774
+	$input = wp_parse_args($overwrite, $defaults);
775 775
 
776 776
 	return $input;
777 777
 }
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
  *
785 785
  * @return array
786 786
  */
787
-function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
787
+function sd_get_row_cols_input($type = 'row_cols', $overwrite = array()) {
788 788
 
789 789
 	$device_size = '';
790
-	if ( ! empty( $overwrite['device_type'] ) ) {
791
-		if ( $overwrite['device_type'] == 'Tablet' ) {
790
+	if (!empty($overwrite['device_type'])) {
791
+		if ($overwrite['device_type'] == 'Tablet') {
792 792
 			$device_size = '-md';
793
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
793
+		} elseif ($overwrite['device_type'] == 'Desktop') {
794 794
 			$device_size = '-lg';
795 795
 		}
796 796
 	}
797 797
 	$options = array(
798
-		''  => __( 'auto', 'super-duper' ),
798
+		''  => __('auto', 'super-duper'),
799 799
 		'1' => '1',
800 800
 		'2' => '2',
801 801
 		'3' => '3',
@@ -806,15 +806,15 @@  discard block
 block discarded – undo
806 806
 
807 807
 	$defaults = array(
808 808
 		'type'            => 'select',
809
-		'title'           => __( 'Row columns', 'super-duper' ),
809
+		'title'           => __('Row columns', 'super-duper'),
810 810
 		'options'         => $options,
811 811
 		'default'         => '',
812 812
 		'desc_tip'        => true,
813
-		'group'           => __( 'Container', 'super-duper' ),
813
+		'group'           => __('Container', 'super-duper'),
814 814
 		'element_require' => '[%container%]=="row"',
815 815
 	);
816 816
 
817
-	$input = wp_parse_args( $overwrite, $defaults );
817
+	$input = wp_parse_args($overwrite, $defaults);
818 818
 
819 819
 	return $input;
820 820
 }
@@ -827,33 +827,33 @@  discard block
 block discarded – undo
827 827
  *
828 828
  * @return array
829 829
  */
830
-function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
830
+function sd_get_text_align_input($type = 'text_align', $overwrite = array()) {
831 831
 
832 832
 	$device_size = '';
833
-	if ( ! empty( $overwrite['device_type'] ) ) {
834
-		if ( $overwrite['device_type'] == 'Tablet' ) {
833
+	if (!empty($overwrite['device_type'])) {
834
+		if ($overwrite['device_type'] == 'Tablet') {
835 835
 			$device_size = '-md';
836
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
836
+		} elseif ($overwrite['device_type'] == 'Desktop') {
837 837
 			$device_size = '-lg';
838 838
 		}
839 839
 	}
840 840
 	$options = array(
841
-		''                                => __( 'Default', 'super-duper' ),
842
-		'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
843
-		'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
844
-		'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
841
+		''                                => __('Default', 'super-duper'),
842
+		'text' . $device_size . '-left'   => __('Left', 'super-duper'),
843
+		'text' . $device_size . '-right'  => __('Right', 'super-duper'),
844
+		'text' . $device_size . '-center' => __('Center', 'super-duper'),
845 845
 	);
846 846
 
847 847
 	$defaults = array(
848 848
 		'type'     => 'select',
849
-		'title'    => __( 'Text align', 'super-duper' ),
849
+		'title'    => __('Text align', 'super-duper'),
850 850
 		'options'  => $options,
851 851
 		'default'  => '',
852 852
 		'desc_tip' => true,
853
-		'group'    => __( 'Typography', 'super-duper' ),
853
+		'group'    => __('Typography', 'super-duper'),
854 854
 	);
855 855
 
856
-	$input = wp_parse_args( $overwrite, $defaults );
856
+	$input = wp_parse_args($overwrite, $defaults);
857 857
 
858 858
 	return $input;
859 859
 }
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return array
868 868
  */
869
-function sd_get_display_input( $type = 'display', $overwrite = array() ) {
869
+function sd_get_display_input($type = 'display', $overwrite = array()) {
870 870
 
871 871
 	$device_size = '';
872
-	if ( ! empty( $overwrite['device_type'] ) ) {
873
-		if ( $overwrite['device_type'] == 'Tablet' ) {
872
+	if (!empty($overwrite['device_type'])) {
873
+		if ($overwrite['device_type'] == 'Tablet') {
874 874
 			$device_size = '-md';
875
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
875
+		} elseif ($overwrite['device_type'] == 'Desktop') {
876 876
 			$device_size = '-lg';
877 877
 		}
878 878
 	}
879 879
 	$options = array(
880
-		''                                   => __( 'Default', 'super-duper' ),
880
+		''                                   => __('Default', 'super-duper'),
881 881
 		'd' . $device_size . '-none'         => 'none',
882 882
 		'd' . $device_size . '-inline'       => 'inline',
883 883
 		'd' . $device_size . '-inline-block' => 'inline-block',
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 
892 892
 	$defaults = array(
893 893
 		'type'     => 'select',
894
-		'title'    => __( 'Display', 'super-duper' ),
894
+		'title'    => __('Display', 'super-duper'),
895 895
 		'options'  => $options,
896 896
 		'default'  => '',
897 897
 		'desc_tip' => true,
898
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
898
+		'group'    => __('Wrapper Styles', 'super-duper'),
899 899
 	);
900 900
 
901
-	$input = wp_parse_args( $overwrite, $defaults );
901
+	$input = wp_parse_args($overwrite, $defaults);
902 902
 
903 903
 	return $input;
904 904
 }
@@ -911,17 +911,17 @@  discard block
 block discarded – undo
911 911
  *
912 912
  * @return array
913 913
  */
914
-function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
914
+function sd_get_text_justify_input($type = 'text_justify', $overwrite = array()) {
915 915
 
916 916
 	$defaults = array(
917 917
 		'type'     => 'checkbox',
918
-		'title'    => __( 'Text justify', 'super-duper' ),
918
+		'title'    => __('Text justify', 'super-duper'),
919 919
 		'default'  => '',
920 920
 		'desc_tip' => true,
921
-		'group'    => __( 'Typography', 'super-duper' ),
921
+		'group'    => __('Typography', 'super-duper'),
922 922
 	);
923 923
 
924
-	$input = wp_parse_args( $overwrite, $defaults );
924
+	$input = wp_parse_args($overwrite, $defaults);
925 925
 
926 926
 	return $input;
927 927
 }
@@ -935,51 +935,51 @@  discard block
 block discarded – undo
935 935
  *
936 936
  * @return array
937 937
  */
938
-function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) {
938
+function sd_aui_colors($include_branding = false, $include_outlines = false, $outline_button_only_text = false) {
939 939
 	$theme_colors = array();
940 940
 
941
-	$theme_colors['primary']   = __( 'Primary', 'super-duper' );
942
-	$theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
943
-	$theme_colors['success']   = __( 'Success', 'super-duper' );
944
-	$theme_colors['danger']    = __( 'Danger', 'super-duper' );
945
-	$theme_colors['warning']   = __( 'Warning', 'super-duper' );
946
-	$theme_colors['info']      = __( 'Info', 'super-duper' );
947
-	$theme_colors['light']     = __( 'Light', 'super-duper' );
948
-	$theme_colors['dark']      = __( 'Dark', 'super-duper' );
949
-	$theme_colors['white']     = __( 'White', 'super-duper' );
950
-	$theme_colors['purple']    = __( 'Purple', 'super-duper' );
951
-	$theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
952
-	$theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
953
-	$theme_colors['gray']      = __( 'Gray', 'super-duper' );
954
-	$theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
955
-	$theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
956
-	$theme_colors['orange']    = __( 'Orange', 'super-duper' );
957
-
958
-	if ( $include_outlines ) {
959
-		$button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
960
-		$theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
961
-		$theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
962
-		$theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
963
-		$theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
964
-		$theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
965
-		$theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
966
-		$theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
967
-		$theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
968
-		$theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
969
-		$theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
970
-		$theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
971
-		$theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
972
-		$theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
973
-		$theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
974
-		$theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
975
-		$theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
976
-	}
977
-
978
-	if ( $include_branding ) {
941
+	$theme_colors['primary']   = __('Primary', 'super-duper');
942
+	$theme_colors['secondary'] = __('Secondary', 'super-duper');
943
+	$theme_colors['success']   = __('Success', 'super-duper');
944
+	$theme_colors['danger']    = __('Danger', 'super-duper');
945
+	$theme_colors['warning']   = __('Warning', 'super-duper');
946
+	$theme_colors['info']      = __('Info', 'super-duper');
947
+	$theme_colors['light']     = __('Light', 'super-duper');
948
+	$theme_colors['dark']      = __('Dark', 'super-duper');
949
+	$theme_colors['white']     = __('White', 'super-duper');
950
+	$theme_colors['purple']    = __('Purple', 'super-duper');
951
+	$theme_colors['salmon']    = __('Salmon', 'super-duper');
952
+	$theme_colors['cyan']      = __('Cyan', 'super-duper');
953
+	$theme_colors['gray']      = __('Gray', 'super-duper');
954
+	$theme_colors['gray-dark'] = __('Gray dark', 'super-duper');
955
+	$theme_colors['indigo']    = __('Indigo', 'super-duper');
956
+	$theme_colors['orange']    = __('Orange', 'super-duper');
957
+
958
+	if ($include_outlines) {
959
+		$button_only                       = $outline_button_only_text ? ' ' . __('(button only)', 'super-duper') : '';
960
+		$theme_colors['outline-primary']   = __('Primary outline', 'super-duper') . $button_only;
961
+		$theme_colors['outline-secondary'] = __('Secondary outline', 'super-duper') . $button_only;
962
+		$theme_colors['outline-success']   = __('Success outline', 'super-duper') . $button_only;
963
+		$theme_colors['outline-danger']    = __('Danger outline', 'super-duper') . $button_only;
964
+		$theme_colors['outline-warning']   = __('Warning outline', 'super-duper') . $button_only;
965
+		$theme_colors['outline-info']      = __('Info outline', 'super-duper') . $button_only;
966
+		$theme_colors['outline-light']     = __('Light outline', 'super-duper') . $button_only;
967
+		$theme_colors['outline-dark']      = __('Dark outline', 'super-duper') . $button_only;
968
+		$theme_colors['outline-white']     = __('White outline', 'super-duper') . $button_only;
969
+		$theme_colors['outline-purple']    = __('Purple outline', 'super-duper') . $button_only;
970
+		$theme_colors['outline-salmon']    = __('Salmon outline', 'super-duper') . $button_only;
971
+		$theme_colors['outline-cyan']      = __('Cyan outline', 'super-duper') . $button_only;
972
+		$theme_colors['outline-gray']      = __('Gray outline', 'super-duper') . $button_only;
973
+		$theme_colors['outline-gray-dark'] = __('Gray dark outline', 'super-duper') . $button_only;
974
+		$theme_colors['outline-indigo']    = __('Indigo outline', 'super-duper') . $button_only;
975
+		$theme_colors['outline-orange']    = __('Orange outline', 'super-duper') . $button_only;
976
+	}
977
+
978
+	if ($include_branding) {
979 979
 		$theme_colors = $theme_colors + sd_aui_branding_colors();
980 980
 	}
981 981
 
982
-	return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
982
+	return apply_filters('sd_aui_colors', $theme_colors, $include_outlines, $include_branding);
983 983
 }
984 984
 
985 985
 /**
@@ -989,17 +989,17 @@  discard block
 block discarded – undo
989 989
  */
990 990
 function sd_aui_branding_colors() {
991 991
 	return array(
992
-		'facebook'  => __( 'Facebook', 'super-duper' ),
993
-		'twitter'   => __( 'Twitter', 'super-duper' ),
994
-		'instagram' => __( 'Instagram', 'super-duper' ),
995
-		'linkedin'  => __( 'Linkedin', 'super-duper' ),
996
-		'flickr'    => __( 'Flickr', 'super-duper' ),
997
-		'github'    => __( 'GitHub', 'super-duper' ),
998
-		'youtube'   => __( 'YouTube', 'super-duper' ),
999
-		'wordpress' => __( 'WordPress', 'super-duper' ),
1000
-		'google'    => __( 'Google', 'super-duper' ),
1001
-		'yahoo'     => __( 'Yahoo', 'super-duper' ),
1002
-		'vkontakte' => __( 'Vkontakte', 'super-duper' ),
992
+		'facebook'  => __('Facebook', 'super-duper'),
993
+		'twitter'   => __('Twitter', 'super-duper'),
994
+		'instagram' => __('Instagram', 'super-duper'),
995
+		'linkedin'  => __('Linkedin', 'super-duper'),
996
+		'flickr'    => __('Flickr', 'super-duper'),
997
+		'github'    => __('GitHub', 'super-duper'),
998
+		'youtube'   => __('YouTube', 'super-duper'),
999
+		'wordpress' => __('WordPress', 'super-duper'),
1000
+		'google'    => __('Google', 'super-duper'),
1001
+		'yahoo'     => __('Yahoo', 'super-duper'),
1002
+		'vkontakte' => __('Vkontakte', 'super-duper'),
1003 1003
 	);
1004 1004
 }
1005 1005
 
@@ -1012,10 +1012,10 @@  discard block
 block discarded – undo
1012 1012
  *
1013 1013
  * @return array
1014 1014
  */
1015
-function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
1015
+function sd_get_container_class_input($type = 'container', $overwrite = array()) {
1016 1016
 
1017 1017
 	$options = array(
1018
-		'container'       => __( 'container (default)', 'super-duper' ),
1018
+		'container'       => __('container (default)', 'super-duper'),
1019 1019
 		'container-sm'    => 'container-sm',
1020 1020
 		'container-md'    => 'container-md',
1021 1021
 		'container-lg'    => 'container-lg',
@@ -1034,14 +1034,14 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 	$defaults = array(
1036 1036
 		'type'     => 'select',
1037
-		'title'    => __( 'Type', 'super-duper' ),
1037
+		'title'    => __('Type', 'super-duper'),
1038 1038
 		'options'  => $options,
1039 1039
 		'default'  => '',
1040 1040
 		'desc_tip' => true,
1041
-		'group'    => __( 'Container', 'super-duper' ),
1041
+		'group'    => __('Container', 'super-duper'),
1042 1042
 	);
1043 1043
 
1044
-	$input = wp_parse_args( $overwrite, $defaults );
1044
+	$input = wp_parse_args($overwrite, $defaults);
1045 1045
 
1046 1046
 	return $input;
1047 1047
 }
@@ -1054,10 +1054,10 @@  discard block
 block discarded – undo
1054 1054
  *
1055 1055
  * @return array
1056 1056
  */
1057
-function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
1057
+function sd_get_position_class_input($type = 'position', $overwrite = array()) {
1058 1058
 
1059 1059
 	$options = array(
1060
-		''                  => __( 'Default', 'super-duper' ),
1060
+		''                  => __('Default', 'super-duper'),
1061 1061
 		'position-static'   => 'static',
1062 1062
 		'position-relative' => 'relative',
1063 1063
 		'position-absolute' => 'absolute',
@@ -1070,14 +1070,14 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
 	$defaults = array(
1072 1072
 		'type'     => 'select',
1073
-		'title'    => __( 'Position', 'super-duper' ),
1073
+		'title'    => __('Position', 'super-duper'),
1074 1074
 		'options'  => $options,
1075 1075
 		'default'  => '',
1076 1076
 		'desc_tip' => true,
1077
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1077
+		'group'    => __('Wrapper Styles', 'super-duper'),
1078 1078
 	);
1079 1079
 
1080
-	$input = wp_parse_args( $overwrite, $defaults );
1080
+	$input = wp_parse_args($overwrite, $defaults);
1081 1081
 
1082 1082
 	return $input;
1083 1083
 }
@@ -1090,30 +1090,30 @@  discard block
 block discarded – undo
1090 1090
  *
1091 1091
  * @return array
1092 1092
  */
1093
-function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1093
+function sd_get_sticky_offset_input($type = 'top', $overwrite = array()) {
1094 1094
 
1095 1095
 	$defaults = array(
1096 1096
 		'type'            => 'number',
1097
-		'title'           => __( 'Sticky offset', 'super-duper' ),
1097
+		'title'           => __('Sticky offset', 'super-duper'),
1098 1098
 		//'desc' =>  __('Sticky offset'),
1099 1099
 		'default'         => '',
1100 1100
 		'desc_tip'        => true,
1101
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1101
+		'group'           => __('Wrapper Styles', 'super-duper'),
1102 1102
 		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1103 1103
 	);
1104 1104
 
1105 1105
 	// title
1106
-	if ( $type == 'top' ) {
1107
-		$defaults['title'] = __( 'Top offset', 'super-duper' );
1106
+	if ($type == 'top') {
1107
+		$defaults['title'] = __('Top offset', 'super-duper');
1108 1108
 		$defaults['icon']  = 'box-top';
1109 1109
 		$defaults['row']   = array(
1110
-			'title' => __( 'Sticky offset', 'super-duper' ),
1110
+			'title' => __('Sticky offset', 'super-duper'),
1111 1111
 			'key'   => 'sticky-offset',
1112 1112
 			'open'  => true,
1113 1113
 			'class' => 'text-center',
1114 1114
 		);
1115
-	} elseif ( $type == 'bottom' ) {
1116
-		$defaults['title'] = __( 'Bottom offset', 'super-duper' );
1115
+	} elseif ($type == 'bottom') {
1116
+		$defaults['title'] = __('Bottom offset', 'super-duper');
1117 1117
 		$defaults['icon']  = 'box-bottom';
1118 1118
 		$defaults['row']   = array(
1119 1119
 			'key'   => 'sticky-offset',
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 		);
1122 1122
 	}
1123 1123
 
1124
-	$input = wp_parse_args( $overwrite, $defaults );
1124
+	$input = wp_parse_args($overwrite, $defaults);
1125 1125
 
1126 1126
 	return $input;
1127 1127
 }
@@ -1134,10 +1134,10 @@  discard block
 block discarded – undo
1134 1134
  *
1135 1135
  * @return array
1136 1136
  */
1137
-function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
1137
+function sd_get_font_size_input($type = 'font_size', $overwrite = array(), $has_custom = false) {
1138 1138
 
1139 1139
 	$options = array(
1140
-		''          => __( 'Inherit from parent', 'super-duper' ),
1140
+		''          => __('Inherit from parent', 'super-duper'),
1141 1141
 		'h6'        => 'h6',
1142 1142
 		'h5'        => 'h5',
1143 1143
 		'h4'        => 'h4',
@@ -1150,20 +1150,20 @@  discard block
 block discarded – undo
1150 1150
 		'display-4' => 'display-4',
1151 1151
 	);
1152 1152
 
1153
-	if ( $has_custom ) {
1154
-		$options['custom'] = __( 'Custom size', 'super-duper' );
1153
+	if ($has_custom) {
1154
+		$options['custom'] = __('Custom size', 'super-duper');
1155 1155
 	}
1156 1156
 
1157 1157
 	$defaults = array(
1158 1158
 		'type'     => 'select',
1159
-		'title'    => __( 'Font size', 'super-duper' ),
1159
+		'title'    => __('Font size', 'super-duper'),
1160 1160
 		'options'  => $options,
1161 1161
 		'default'  => '',
1162 1162
 		'desc_tip' => true,
1163
-		'group'    => __( 'Typography', 'super-duper' ),
1163
+		'group'    => __('Typography', 'super-duper'),
1164 1164
 	);
1165 1165
 
1166
-	$input = wp_parse_args( $overwrite, $defaults );
1166
+	$input = wp_parse_args($overwrite, $defaults);
1167 1167
 
1168 1168
 	return $input;
1169 1169
 }
@@ -1176,11 +1176,11 @@  discard block
 block discarded – undo
1176 1176
  *
1177 1177
  * @return array
1178 1178
  */
1179
-function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
1179
+function sd_get_font_custom_size_input($type = 'font_size_custom', $overwrite = array(), $parent_type = '') {
1180 1180
 
1181 1181
 	$defaults = array(
1182 1182
 		'type'              => 'number',
1183
-		'title'             => __( 'Font size (rem)', 'super-duper' ),
1183
+		'title'             => __('Font size (rem)', 'super-duper'),
1184 1184
 		'default'           => '',
1185 1185
 		'placeholder'       => '1.25',
1186 1186
 		'custom_attributes' => array(
@@ -1189,14 +1189,14 @@  discard block
 block discarded – undo
1189 1189
 			'max'  => '100',
1190 1190
 		),
1191 1191
 		'desc_tip'          => true,
1192
-		'group'             => __( 'Typography', 'super-duper' ),
1192
+		'group'             => __('Typography', 'super-duper'),
1193 1193
 	);
1194 1194
 
1195
-	if ( $parent_type ) {
1195
+	if ($parent_type) {
1196 1196
 		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1197 1197
 	}
1198 1198
 
1199
-	$input = wp_parse_args( $overwrite, $defaults );
1199
+	$input = wp_parse_args($overwrite, $defaults);
1200 1200
 
1201 1201
 	return $input;
1202 1202
 }
@@ -1209,11 +1209,11 @@  discard block
 block discarded – undo
1209 1209
  *
1210 1210
  * @return array
1211 1211
  */
1212
-function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) {
1212
+function sd_get_font_line_height_input($type = 'font_line_height', $overwrite = array()) {
1213 1213
 
1214 1214
 	$defaults = array(
1215 1215
 		'type'              => 'number',
1216
-		'title'             => __( 'Font Line Height', 'super-duper' ),
1216
+		'title'             => __('Font Line Height', 'super-duper'),
1217 1217
 		'default'           => '',
1218 1218
 		'placeholder'       => '1.75',
1219 1219
 		'custom_attributes' => array(
@@ -1222,10 +1222,10 @@  discard block
 block discarded – undo
1222 1222
 			'max'  => '100',
1223 1223
 		),
1224 1224
 		'desc_tip'          => true,
1225
-		'group'             => __( 'Typography', 'super-duper' ),
1225
+		'group'             => __('Typography', 'super-duper'),
1226 1226
 	);
1227 1227
 
1228
-	$input = wp_parse_args( $overwrite, $defaults );
1228
+	$input = wp_parse_args($overwrite, $defaults);
1229 1229
 
1230 1230
 	return $input;
1231 1231
 }
@@ -1238,17 +1238,17 @@  discard block
 block discarded – undo
1238 1238
  *
1239 1239
  * @return array
1240 1240
  */
1241
-function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1241
+function sd_get_font_size_input_group($type = 'font_size', $overwrite = array(), $overwrite_custom = array()) {
1242 1242
 
1243 1243
 	$inputs = array();
1244 1244
 
1245
-	if ( $overwrite !== false ) {
1246
-		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1245
+	if ($overwrite !== false) {
1246
+		$inputs[$type] = sd_get_font_size_input($type, $overwrite, true);
1247 1247
 	}
1248 1248
 
1249
-	if ( $overwrite_custom !== false ) {
1249
+	if ($overwrite_custom !== false) {
1250 1250
 		$custom            = $type . '_custom';
1251
-		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1251
+		$inputs[$custom] = sd_get_font_custom_size_input($custom, $overwrite_custom, $type);
1252 1252
 	}
1253 1253
 
1254 1254
 	return $inputs;
@@ -1262,10 +1262,10 @@  discard block
 block discarded – undo
1262 1262
  *
1263 1263
  * @return array
1264 1264
  */
1265
-function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
1265
+function sd_get_font_weight_input($type = 'font_weight', $overwrite = array()) {
1266 1266
 
1267 1267
 	$options = array(
1268
-		''                                => __( 'Inherit', 'super-duper' ),
1268
+		''                                => __('Inherit', 'super-duper'),
1269 1269
 		'font-weight-bold'                => 'bold',
1270 1270
 		'font-weight-bolder'              => 'bolder',
1271 1271
 		'font-weight-normal'              => 'normal',
@@ -1281,14 +1281,14 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
 	$defaults = array(
1283 1283
 		'type'     => 'select',
1284
-		'title'    => __( 'Appearance', 'super-duper' ),
1284
+		'title'    => __('Appearance', 'super-duper'),
1285 1285
 		'options'  => $options,
1286 1286
 		'default'  => '',
1287 1287
 		'desc_tip' => true,
1288
-		'group'    => __( 'Typography', 'super-duper' ),
1288
+		'group'    => __('Typography', 'super-duper'),
1289 1289
 	);
1290 1290
 
1291
-	$input = wp_parse_args( $overwrite, $defaults );
1291
+	$input = wp_parse_args($overwrite, $defaults);
1292 1292
 
1293 1293
 	return $input;
1294 1294
 }
@@ -1301,25 +1301,25 @@  discard block
 block discarded – undo
1301 1301
  *
1302 1302
  * @return array
1303 1303
  */
1304
-function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
1304
+function sd_get_font_case_input($type = 'font_weight', $overwrite = array()) {
1305 1305
 
1306 1306
 	$options = array(
1307
-		''                => __( 'Default', 'super-duper' ),
1308
-		'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1309
-		'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1310
-		'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1307
+		''                => __('Default', 'super-duper'),
1308
+		'text-lowercase'  => __('lowercase', 'super-duper'),
1309
+		'text-uppercase'  => __('UPPERCASE', 'super-duper'),
1310
+		'text-capitalize' => __('Capitalize', 'super-duper'),
1311 1311
 	);
1312 1312
 
1313 1313
 	$defaults = array(
1314 1314
 		'type'     => 'select',
1315
-		'title'    => __( 'Letter case', 'super-duper' ),
1315
+		'title'    => __('Letter case', 'super-duper'),
1316 1316
 		'options'  => $options,
1317 1317
 		'default'  => '',
1318 1318
 		'desc_tip' => true,
1319
-		'group'    => __( 'Typography', 'super-duper' ),
1319
+		'group'    => __('Typography', 'super-duper'),
1320 1320
 	);
1321 1321
 
1322
-	$input = wp_parse_args( $overwrite, $defaults );
1322
+	$input = wp_parse_args($overwrite, $defaults);
1323 1323
 
1324 1324
 	return $input;
1325 1325
 }
@@ -1333,23 +1333,23 @@  discard block
 block discarded – undo
1333 1333
  * A helper function for font size
1334 1334
  *
1335 1335
  */
1336
-function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
1336
+function sd_get_font_italic_input($type = 'font_italic', $overwrite = array()) {
1337 1337
 
1338 1338
 	$options = array(
1339
-		''            => __( 'No', 'super-duper' ),
1340
-		'font-italic' => __( 'Yes', 'super-duper' ),
1339
+		''            => __('No', 'super-duper'),
1340
+		'font-italic' => __('Yes', 'super-duper'),
1341 1341
 	);
1342 1342
 
1343 1343
 	$defaults = array(
1344 1344
 		'type'     => 'select',
1345
-		'title'    => __( 'Font italic', 'super-duper' ),
1345
+		'title'    => __('Font italic', 'super-duper'),
1346 1346
 		'options'  => $options,
1347 1347
 		'default'  => '',
1348 1348
 		'desc_tip' => true,
1349
-		'group'    => __( 'Typography', 'super-duper' ),
1349
+		'group'    => __('Typography', 'super-duper'),
1350 1350
 	);
1351 1351
 
1352
-	$input = wp_parse_args( $overwrite, $defaults );
1352
+	$input = wp_parse_args($overwrite, $defaults);
1353 1353
 
1354 1354
 	return $input;
1355 1355
 }
@@ -1362,18 +1362,18 @@  discard block
 block discarded – undo
1362 1362
  *
1363 1363
  * @return array
1364 1364
  */
1365
-function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
1365
+function sd_get_anchor_input($type = 'anchor', $overwrite = array()) {
1366 1366
 
1367 1367
 	$defaults = array(
1368 1368
 		'type'     => 'text',
1369
-		'title'    => __( 'HTML anchor', 'super-duper' ),
1370
-		'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.' ),
1369
+		'title'    => __('HTML anchor', 'super-duper'),
1370
+		'desc'     => __('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'),
1371 1371
 		'default'  => '',
1372 1372
 		'desc_tip' => true,
1373
-		'group'    => __( 'Advanced', 'super-duper' ),
1373
+		'group'    => __('Advanced', 'super-duper'),
1374 1374
 	);
1375 1375
 
1376
-	$input = wp_parse_args( $overwrite, $defaults );
1376
+	$input = wp_parse_args($overwrite, $defaults);
1377 1377
 
1378 1378
 	return $input;
1379 1379
 }
@@ -1386,18 +1386,18 @@  discard block
 block discarded – undo
1386 1386
  *
1387 1387
  * @return array
1388 1388
  */
1389
-function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
1389
+function sd_get_class_input($type = 'css_class', $overwrite = array()) {
1390 1390
 
1391 1391
 	$defaults = array(
1392 1392
 		'type'     => 'text',
1393
-		'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1394
-		'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1393
+		'title'    => __('Additional CSS class(es)', 'super-duper'),
1394
+		'desc'     => __('Separate multiple classes with spaces.', 'super-duper'),
1395 1395
 		'default'  => '',
1396 1396
 		'desc_tip' => true,
1397
-		'group'    => __( 'Advanced', 'super-duper' ),
1397
+		'group'    => __('Advanced', 'super-duper'),
1398 1398
 	);
1399 1399
 
1400
-	$input = wp_parse_args( $overwrite, $defaults );
1400
+	$input = wp_parse_args($overwrite, $defaults);
1401 1401
 
1402 1402
 	return $input;
1403 1403
 }
@@ -1410,45 +1410,45 @@  discard block
 block discarded – undo
1410 1410
  *
1411 1411
  * @return array
1412 1412
  */
1413
-function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) {
1413
+function sd_get_hover_animations_input($type = 'hover_animations', $overwrite = array()) {
1414 1414
 
1415 1415
 	$options = array(
1416
-		''       => __( 'none', 'super-duper' ),
1417
-		'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1418
-		'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1419
-		'hover-move-up'    => __( 'Move up', 'super-duper' ),
1420
-		'hover-move-down'  => __( 'Move down', 'super-duper' ),
1421
-		'hover-move-left'  => __( 'Move left', 'super-duper' ),
1422
-		'hover-move-right' => __( 'Move right', 'super-duper' ),
1416
+		''       => __('none', 'super-duper'),
1417
+		'hover-zoom'       => __('Zoom', 'super-duper'),
1418
+		'hover-shadow'     => __('Shadow', 'super-duper'),
1419
+		'hover-move-up'    => __('Move up', 'super-duper'),
1420
+		'hover-move-down'  => __('Move down', 'super-duper'),
1421
+		'hover-move-left'  => __('Move left', 'super-duper'),
1422
+		'hover-move-right' => __('Move right', 'super-duper'),
1423 1423
 	);
1424 1424
 
1425 1425
 	$defaults = array(
1426 1426
 		'type'     => 'select',
1427 1427
 		'multiple' => true,
1428
-		'title'    => __( 'Hover Animations', 'super-duper' ),
1428
+		'title'    => __('Hover Animations', 'super-duper'),
1429 1429
 		'options'  => $options,
1430 1430
 		'default'  => '',
1431 1431
 		'desc_tip' => true,
1432
-		'group'    => __( 'Hover Animations', 'super-duper' ),
1432
+		'group'    => __('Hover Animations', 'super-duper'),
1433 1433
 	);
1434 1434
 
1435
-	$input = wp_parse_args( $overwrite, $defaults );
1435
+	$input = wp_parse_args($overwrite, $defaults);
1436 1436
 
1437 1437
 	return $input;
1438 1438
 }
1439 1439
 
1440 1440
 
1441
-function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) {
1441
+function sd_get_flex_align_items_input($type = 'align-items', $overwrite = array()) {
1442 1442
 	$device_size = '';
1443
-	if ( ! empty( $overwrite['device_type'] ) ) {
1444
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1443
+	if (!empty($overwrite['device_type'])) {
1444
+		if ($overwrite['device_type'] == 'Tablet') {
1445 1445
 			$device_size = '-md';
1446
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1446
+		} elseif ($overwrite['device_type'] == 'Desktop') {
1447 1447
 			$device_size = '-lg';
1448 1448
 		}
1449 1449
 	}
1450 1450
 	$options = array(
1451
-		''                                         => __( 'Default', 'super-duper' ),
1451
+		''                                         => __('Default', 'super-duper'),
1452 1452
 		'align-items' . $device_size . '-start'    => 'align-items-start',
1453 1453
 		'align-items' . $device_size . '-end'      => 'align-items-end',
1454 1454
 		'align-items' . $device_size . '-center'   => 'align-items-center',
@@ -1458,21 +1458,21 @@  discard block
 block discarded – undo
1458 1458
 
1459 1459
 	$defaults = array(
1460 1460
 		'type'            => 'select',
1461
-		'title'           => __( 'Vertical Align Items', 'super-duper' ),
1461
+		'title'           => __('Vertical Align Items', 'super-duper'),
1462 1462
 		'options'         => $options,
1463 1463
 		'default'         => '',
1464 1464
 		'desc_tip'        => true,
1465
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1465
+		'group'           => __('Wrapper Styles', 'super-duper'),
1466 1466
 		'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1467 1467
 
1468 1468
 	);
1469 1469
 
1470
-	$input = wp_parse_args( $overwrite, $defaults );
1470
+	$input = wp_parse_args($overwrite, $defaults);
1471 1471
 
1472 1472
 	return $input;
1473 1473
 }
1474 1474
 
1475
-function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) {
1475
+function sd_get_flex_align_items_input_group($type = 'flex_align_items', $overwrite = array()) {
1476 1476
 	$inputs = array();
1477 1477
 	$sizes  = array(
1478 1478
 		''    => 'Mobile',
@@ -1480,28 +1480,28 @@  discard block
 block discarded – undo
1480 1480
 		'_lg' => 'Desktop',
1481 1481
 	);
1482 1482
 
1483
-	if ( $overwrite !== false ) {
1483
+	if ($overwrite !== false) {
1484 1484
 
1485
-		foreach ( $sizes as $ds => $dt ) {
1485
+		foreach ($sizes as $ds => $dt) {
1486 1486
 			$overwrite['device_type'] = $dt;
1487
-			$inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1487
+			$inputs[$type . $ds]    = sd_get_flex_align_items_input($type, $overwrite);
1488 1488
 		}
1489 1489
 	}
1490 1490
 
1491 1491
 	return $inputs;
1492 1492
 }
1493 1493
 
1494
-function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) {
1494
+function sd_get_flex_justify_content_input($type = 'flex_justify_content', $overwrite = array()) {
1495 1495
 	$device_size = '';
1496
-	if ( ! empty( $overwrite['device_type'] ) ) {
1497
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1496
+	if (!empty($overwrite['device_type'])) {
1497
+		if ($overwrite['device_type'] == 'Tablet') {
1498 1498
 			$device_size = '-md';
1499
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1499
+		} elseif ($overwrite['device_type'] == 'Desktop') {
1500 1500
 			$device_size = '-lg';
1501 1501
 		}
1502 1502
 	}
1503 1503
 	$options = array(
1504
-		''                                             => __( 'Default', 'super-duper' ),
1504
+		''                                             => __('Default', 'super-duper'),
1505 1505
 		'justify-content' . $device_size . '-start'    => 'justify-content-start',
1506 1506
 		'justify-content' . $device_size . '-end'      => 'justify-content-end',
1507 1507
 		'justify-content' . $device_size . '-center'   => 'justify-content-center',
@@ -1511,21 +1511,21 @@  discard block
 block discarded – undo
1511 1511
 
1512 1512
 	$defaults = array(
1513 1513
 		'type'            => 'select',
1514
-		'title'           => __( 'Justify content' ),
1514
+		'title'           => __('Justify content'),
1515 1515
 		'options'         => $options,
1516 1516
 		'default'         => '',
1517 1517
 		'desc_tip'        => true,
1518
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1518
+		'group'           => __('Wrapper Styles', 'super-duper'),
1519 1519
 		'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1520 1520
 
1521 1521
 	);
1522 1522
 
1523
-	$input = wp_parse_args( $overwrite, $defaults );
1523
+	$input = wp_parse_args($overwrite, $defaults);
1524 1524
 
1525 1525
 	return $input;
1526 1526
 }
1527 1527
 
1528
-function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) {
1528
+function sd_get_flex_justify_content_input_group($type = 'flex_justify_content', $overwrite = array()) {
1529 1529
 	$inputs = array();
1530 1530
 	$sizes  = array(
1531 1531
 		''    => 'Mobile',
@@ -1533,11 +1533,11 @@  discard block
 block discarded – undo
1533 1533
 		'_lg' => 'Desktop',
1534 1534
 	);
1535 1535
 
1536
-	if ( $overwrite !== false ) {
1536
+	if ($overwrite !== false) {
1537 1537
 
1538
-		foreach ( $sizes as $ds => $dt ) {
1538
+		foreach ($sizes as $ds => $dt) {
1539 1539
 			$overwrite['device_type'] = $dt;
1540
-			$inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1540
+			$inputs[$type . $ds]    = sd_get_flex_justify_content_input($type, $overwrite);
1541 1541
 		}
1542 1542
 	}
1543 1543
 
@@ -1545,17 +1545,17 @@  discard block
 block discarded – undo
1545 1545
 }
1546 1546
 
1547 1547
 
1548
-function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) {
1548
+function sd_get_flex_align_self_input($type = 'flex_align_self', $overwrite = array()) {
1549 1549
 	$device_size = '';
1550
-	if ( ! empty( $overwrite['device_type'] ) ) {
1551
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1550
+	if (!empty($overwrite['device_type'])) {
1551
+		if ($overwrite['device_type'] == 'Tablet') {
1552 1552
 			$device_size = '-md';
1553
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1553
+		} elseif ($overwrite['device_type'] == 'Desktop') {
1554 1554
 			$device_size = '-lg';
1555 1555
 		}
1556 1556
 	}
1557 1557
 	$options = array(
1558
-		''                                         => __( 'Default', 'super-duper' ),
1558
+		''                                         => __('Default', 'super-duper'),
1559 1559
 		'align-items' . $device_size . '-start'    => 'align-items-start',
1560 1560
 		'align-items' . $device_size . '-end'      => 'align-items-end',
1561 1561
 		'align-items' . $device_size . '-center'   => 'align-items-center',
@@ -1565,21 +1565,21 @@  discard block
 block discarded – undo
1565 1565
 
1566 1566
 	$defaults = array(
1567 1567
 		'type'            => 'select',
1568
-		'title'           => __( 'Align Self', 'super-duper' ),
1568
+		'title'           => __('Align Self', 'super-duper'),
1569 1569
 		'options'         => $options,
1570 1570
 		'default'         => '',
1571 1571
 		'desc_tip'        => true,
1572
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1572
+		'group'           => __('Wrapper Styles', 'super-duper'),
1573 1573
 		'element_require' => ' [%container%]=="col" ',
1574 1574
 
1575 1575
 	);
1576 1576
 
1577
-	$input = wp_parse_args( $overwrite, $defaults );
1577
+	$input = wp_parse_args($overwrite, $defaults);
1578 1578
 
1579 1579
 	return $input;
1580 1580
 }
1581 1581
 
1582
-function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) {
1582
+function sd_get_flex_align_self_input_group($type = 'flex_align_self', $overwrite = array()) {
1583 1583
 	$inputs = array();
1584 1584
 	$sizes  = array(
1585 1585
 		''    => 'Mobile',
@@ -1587,53 +1587,53 @@  discard block
 block discarded – undo
1587 1587
 		'_lg' => 'Desktop',
1588 1588
 	);
1589 1589
 
1590
-	if ( $overwrite !== false ) {
1590
+	if ($overwrite !== false) {
1591 1591
 
1592
-		foreach ( $sizes as $ds => $dt ) {
1592
+		foreach ($sizes as $ds => $dt) {
1593 1593
 			$overwrite['device_type'] = $dt;
1594
-			$inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1594
+			$inputs[$type . $ds]    = sd_get_flex_align_self_input($type, $overwrite);
1595 1595
 		}
1596 1596
 	}
1597 1597
 
1598 1598
 	return $inputs;
1599 1599
 }
1600 1600
 
1601
-function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) {
1601
+function sd_get_flex_order_input($type = 'flex_order', $overwrite = array()) {
1602 1602
 	$device_size = '';
1603
-	if ( ! empty( $overwrite['device_type'] ) ) {
1604
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1603
+	if (!empty($overwrite['device_type'])) {
1604
+		if ($overwrite['device_type'] == 'Tablet') {
1605 1605
 			$device_size = '-md';
1606
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1606
+		} elseif ($overwrite['device_type'] == 'Desktop') {
1607 1607
 			$device_size = '-lg';
1608 1608
 		}
1609 1609
 	}
1610 1610
 	$options = array(
1611
-		'' => __( 'Default', 'super-duper' ),
1611
+		'' => __('Default', 'super-duper'),
1612 1612
 	);
1613 1613
 
1614 1614
 	$i = 0;
1615
-	while ( $i <= 12 ) {
1616
-		$options[ 'order' . $device_size . '-' . $i ] = $i;
1615
+	while ($i <= 12) {
1616
+		$options['order' . $device_size . '-' . $i] = $i;
1617 1617
 		$i++;
1618 1618
 	}
1619 1619
 
1620 1620
 	$defaults = array(
1621 1621
 		'type'            => 'select',
1622
-		'title'           => __( 'Flex Order', 'super-duper' ),
1622
+		'title'           => __('Flex Order', 'super-duper'),
1623 1623
 		'options'         => $options,
1624 1624
 		'default'         => '',
1625 1625
 		'desc_tip'        => true,
1626
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1626
+		'group'           => __('Wrapper Styles', 'super-duper'),
1627 1627
 		'element_require' => ' [%container%]=="col" ',
1628 1628
 
1629 1629
 	);
1630 1630
 
1631
-	$input = wp_parse_args( $overwrite, $defaults );
1631
+	$input = wp_parse_args($overwrite, $defaults);
1632 1632
 
1633 1633
 	return $input;
1634 1634
 }
1635 1635
 
1636
-function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) {
1636
+function sd_get_flex_order_input_group($type = 'flex_order', $overwrite = array()) {
1637 1637
 	$inputs = array();
1638 1638
 	$sizes  = array(
1639 1639
 		''    => 'Mobile',
@@ -1641,11 +1641,11 @@  discard block
 block discarded – undo
1641 1641
 		'_lg' => 'Desktop',
1642 1642
 	);
1643 1643
 
1644
-	if ( $overwrite !== false ) {
1644
+	if ($overwrite !== false) {
1645 1645
 
1646
-		foreach ( $sizes as $ds => $dt ) {
1646
+		foreach ($sizes as $ds => $dt) {
1647 1647
 			$overwrite['device_type'] = $dt;
1648
-			$inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1648
+			$inputs[$type . $ds]    = sd_get_flex_order_input($type, $overwrite);
1649 1649
 		}
1650 1650
 	}
1651 1651
 
@@ -1660,234 +1660,234 @@  discard block
 block discarded – undo
1660 1660
  * @return string
1661 1661
  * @todo find best way to use px- py- or general p-
1662 1662
  */
1663
-function sd_build_aui_class( $args ) {
1663
+function sd_build_aui_class($args) {
1664 1664
 
1665 1665
 	$classes = array();
1666 1666
 
1667 1667
 	// margins.
1668
-	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1669
-		$classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
1668
+	if (isset($args['mt']) && $args['mt'] !== '') {
1669
+		$classes[] = 'mt-' . sanitize_html_class($args['mt']);
1670 1670
 		$mt        = $args['mt'];
1671 1671
 	} else {
1672 1672
 		$mt = null;
1673 1673
 	}
1674
-	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1675
-		$classes[] = 'mr-' . sanitize_html_class( $args['mr'] );
1674
+	if (isset($args['mr']) && $args['mr'] !== '') {
1675
+		$classes[] = 'mr-' . sanitize_html_class($args['mr']);
1676 1676
 		$mr        = $args['mr'];
1677 1677
 	} else {
1678 1678
 		$mr = null;
1679 1679
 	}
1680
-	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1681
-		$classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
1680
+	if (isset($args['mb']) && $args['mb'] !== '') {
1681
+		$classes[] = 'mb-' . sanitize_html_class($args['mb']);
1682 1682
 		$mb        = $args['mb'];
1683 1683
 	} else {
1684 1684
 		$mb = null;
1685 1685
 	}
1686
-	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1687
-		$classes[] = 'ml-' . sanitize_html_class( $args['ml'] );
1686
+	if (isset($args['ml']) && $args['ml'] !== '') {
1687
+		$classes[] = 'ml-' . sanitize_html_class($args['ml']);
1688 1688
 		$ml        = $args['ml'];
1689 1689
 	} else {
1690 1690
 		$ml = null;
1691 1691
 	}
1692 1692
 
1693 1693
 	// margins tablet.
1694
-	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1695
-		$classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
1694
+	if (isset($args['mt_md']) && $args['mt_md'] !== '') {
1695
+		$classes[] = 'mt-md-' . sanitize_html_class($args['mt_md']);
1696 1696
 		$mt_md     = $args['mt_md'];
1697 1697
 	} else {
1698 1698
 		$mt_md = null;
1699 1699
 	}
1700
-	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1701
-		$classes[] = 'mr-md-' . sanitize_html_class( $args['mr_md'] );
1700
+	if (isset($args['mr_md']) && $args['mr_md'] !== '') {
1701
+		$classes[] = 'mr-md-' . sanitize_html_class($args['mr_md']);
1702 1702
 		$mt_md     = $args['mr_md'];
1703 1703
 	} else {
1704 1704
 		$mr_md = null;
1705 1705
 	}
1706
-	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1707
-		$classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
1706
+	if (isset($args['mb_md']) && $args['mb_md'] !== '') {
1707
+		$classes[] = 'mb-md-' . sanitize_html_class($args['mb_md']);
1708 1708
 		$mt_md     = $args['mb_md'];
1709 1709
 	} else {
1710 1710
 		$mb_md = null;
1711 1711
 	}
1712
-	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1713
-		$classes[] = 'ml-md-' . sanitize_html_class( $args['ml_md'] );
1712
+	if (isset($args['ml_md']) && $args['ml_md'] !== '') {
1713
+		$classes[] = 'ml-md-' . sanitize_html_class($args['ml_md']);
1714 1714
 		$mt_md     = $args['ml_md'];
1715 1715
 	} else {
1716 1716
 		$ml_md = null;
1717 1717
 	}
1718 1718
 
1719 1719
 	// margins desktop.
1720
-	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1721
-		if ( $mt == null && $mt_md == null ) {
1722
-			$classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
1720
+	if (isset($args['mt_lg']) && $args['mt_lg'] !== '') {
1721
+		if ($mt == null && $mt_md == null) {
1722
+			$classes[] = 'mt-' . sanitize_html_class($args['mt_lg']);
1723 1723
 		} else {
1724
-			$classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
1724
+			$classes[] = 'mt-lg-' . sanitize_html_class($args['mt_lg']);
1725 1725
 		}
1726 1726
 	}
1727
-	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1728
-		if ( $mr == null && $mr_md == null ) {
1729
-			$classes[] = 'mr-' . sanitize_html_class( $args['mr_lg'] );
1727
+	if (isset($args['mr_lg']) && $args['mr_lg'] !== '') {
1728
+		if ($mr == null && $mr_md == null) {
1729
+			$classes[] = 'mr-' . sanitize_html_class($args['mr_lg']);
1730 1730
 		} else {
1731
-			$classes[] = 'mr-lg-' . sanitize_html_class( $args['mr_lg'] );
1731
+			$classes[] = 'mr-lg-' . sanitize_html_class($args['mr_lg']);
1732 1732
 		}
1733 1733
 	}
1734
-	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1735
-		if ( $mb == null && $mb_md == null ) {
1736
-			$classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
1734
+	if (isset($args['mb_lg']) && $args['mb_lg'] !== '') {
1735
+		if ($mb == null && $mb_md == null) {
1736
+			$classes[] = 'mb-' . sanitize_html_class($args['mb_lg']);
1737 1737
 		} else {
1738
-			$classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
1738
+			$classes[] = 'mb-lg-' . sanitize_html_class($args['mb_lg']);
1739 1739
 		}
1740 1740
 	}
1741
-	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1742
-		if ( $ml == null && $ml_md == null ) {
1743
-			$classes[] = 'ml-' . sanitize_html_class( $args['ml_lg'] );
1741
+	if (isset($args['ml_lg']) && $args['ml_lg'] !== '') {
1742
+		if ($ml == null && $ml_md == null) {
1743
+			$classes[] = 'ml-' . sanitize_html_class($args['ml_lg']);
1744 1744
 		} else {
1745
-			$classes[] = 'ml-lg-' . sanitize_html_class( $args['ml_lg'] );
1745
+			$classes[] = 'ml-lg-' . sanitize_html_class($args['ml_lg']);
1746 1746
 		}
1747 1747
 	}
1748 1748
 
1749 1749
 	// padding.
1750
-	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1751
-		$classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
1750
+	if (isset($args['pt']) && $args['pt'] !== '') {
1751
+		$classes[] = 'pt-' . sanitize_html_class($args['pt']);
1752 1752
 		$pt        = $args['pt'];
1753 1753
 	} else {
1754 1754
 		$pt = null;
1755 1755
 	}
1756
-	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1757
-		$classes[] = 'pr-' . sanitize_html_class( $args['pr'] );
1756
+	if (isset($args['pr']) && $args['pr'] !== '') {
1757
+		$classes[] = 'pr-' . sanitize_html_class($args['pr']);
1758 1758
 		$pr        = $args['pr'];
1759 1759
 	} else {
1760 1760
 		$pr = null;
1761 1761
 	}
1762
-	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1763
-		$classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
1762
+	if (isset($args['pb']) && $args['pb'] !== '') {
1763
+		$classes[] = 'pb-' . sanitize_html_class($args['pb']);
1764 1764
 		$pb        = $args['pb'];
1765 1765
 	} else {
1766 1766
 		$pb = null;
1767 1767
 	}
1768
-	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1769
-		$classes[] = 'pl-' . sanitize_html_class( $args['pl'] );
1768
+	if (isset($args['pl']) && $args['pl'] !== '') {
1769
+		$classes[] = 'pl-' . sanitize_html_class($args['pl']);
1770 1770
 		$pl        = $args['pl'];
1771 1771
 	} else {
1772 1772
 		$pl = null;
1773 1773
 	}
1774 1774
 
1775 1775
 	// padding tablet.
1776
-	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1777
-		$classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
1776
+	if (isset($args['pt_md']) && $args['pt_md'] !== '') {
1777
+		$classes[] = 'pt-md-' . sanitize_html_class($args['pt_md']);
1778 1778
 		$pt_md     = $args['pt_md'];
1779 1779
 	} else {
1780 1780
 		$pt_md = null;
1781 1781
 	}
1782
-	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1783
-		$classes[] = 'pr-md-' . sanitize_html_class( $args['pr_md'] );
1782
+	if (isset($args['pr_md']) && $args['pr_md'] !== '') {
1783
+		$classes[] = 'pr-md-' . sanitize_html_class($args['pr_md']);
1784 1784
 		$pt_md     = $args['pr_md'];
1785 1785
 	} else {
1786 1786
 		$pr_md = null;
1787 1787
 	}
1788
-	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1789
-		$classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
1788
+	if (isset($args['pb_md']) && $args['pb_md'] !== '') {
1789
+		$classes[] = 'pb-md-' . sanitize_html_class($args['pb_md']);
1790 1790
 		$pt_md     = $args['pb_md'];
1791 1791
 	} else {
1792 1792
 		$pb_md = null;
1793 1793
 	}
1794
-	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1795
-		$classes[] = 'pl-md-' . sanitize_html_class( $args['pl_md'] );
1794
+	if (isset($args['pl_md']) && $args['pl_md'] !== '') {
1795
+		$classes[] = 'pl-md-' . sanitize_html_class($args['pl_md']);
1796 1796
 		$pt_md     = $args['pl_md'];
1797 1797
 	} else {
1798 1798
 		$pl_md = null;
1799 1799
 	}
1800 1800
 
1801 1801
 	// padding desktop.
1802
-	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1803
-		if ( $pt == null && $pt_md == null ) {
1804
-			$classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
1802
+	if (isset($args['pt_lg']) && $args['pt_lg'] !== '') {
1803
+		if ($pt == null && $pt_md == null) {
1804
+			$classes[] = 'pt-' . sanitize_html_class($args['pt_lg']);
1805 1805
 		} else {
1806
-			$classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
1806
+			$classes[] = 'pt-lg-' . sanitize_html_class($args['pt_lg']);
1807 1807
 		}
1808 1808
 	}
1809
-	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1810
-		if ( $pr == null && $pr_md == null ) {
1811
-			$classes[] = 'pr-' . sanitize_html_class( $args['pr_lg'] );
1809
+	if (isset($args['pr_lg']) && $args['pr_lg'] !== '') {
1810
+		if ($pr == null && $pr_md == null) {
1811
+			$classes[] = 'pr-' . sanitize_html_class($args['pr_lg']);
1812 1812
 		} else {
1813
-			$classes[] = 'pr-lg-' . sanitize_html_class( $args['pr_lg'] );
1813
+			$classes[] = 'pr-lg-' . sanitize_html_class($args['pr_lg']);
1814 1814
 		}
1815 1815
 	}
1816
-	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1817
-		if ( $pb == null && $pb_md == null ) {
1818
-			$classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
1816
+	if (isset($args['pb_lg']) && $args['pb_lg'] !== '') {
1817
+		if ($pb == null && $pb_md == null) {
1818
+			$classes[] = 'pb-' . sanitize_html_class($args['pb_lg']);
1819 1819
 		} else {
1820
-			$classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
1820
+			$classes[] = 'pb-lg-' . sanitize_html_class($args['pb_lg']);
1821 1821
 		}
1822 1822
 	}
1823
-	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1824
-		if ( $pl == null && $pl_md == null ) {
1825
-			$classes[] = 'pl-' . sanitize_html_class( $args['pl_lg'] );
1823
+	if (isset($args['pl_lg']) && $args['pl_lg'] !== '') {
1824
+		if ($pl == null && $pl_md == null) {
1825
+			$classes[] = 'pl-' . sanitize_html_class($args['pl_lg']);
1826 1826
 		} else {
1827
-			$classes[] = 'pl-lg-' . sanitize_html_class( $args['pl_lg'] );
1827
+			$classes[] = 'pl-lg-' . sanitize_html_class($args['pl_lg']);
1828 1828
 		}
1829 1829
 	}
1830 1830
 
1831 1831
 	// row cols, mobile, tablet, desktop
1832
-	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1833
-		$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
1832
+	if (!empty($args['row_cols']) && $args['row_cols'] !== '') {
1833
+		$classes[] = sanitize_html_class('row-cols-' . $args['row_cols']);
1834 1834
 		$row_cols  = $args['row_cols'];
1835 1835
 	} else {
1836 1836
 		$row_cols = null;
1837 1837
 	}
1838
-	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1839
-		$classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
1838
+	if (!empty($args['row_cols_md']) && $args['row_cols_md'] !== '') {
1839
+		$classes[]   = sanitize_html_class('row-cols-md-' . $args['row_cols_md']);
1840 1840
 		$row_cols_md = $args['row_cols_md'];
1841 1841
 	} else {
1842 1842
 		$row_cols_md = null;
1843 1843
 	}
1844
-	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1845
-		if ( $row_cols == null && $row_cols_md == null ) {
1846
-			$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
1844
+	if (!empty($args['row_cols_lg']) && $args['row_cols_lg'] !== '') {
1845
+		if ($row_cols == null && $row_cols_md == null) {
1846
+			$classes[] = sanitize_html_class('row-cols-' . $args['row_cols_lg']);
1847 1847
 		} else {
1848
-			$classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
1848
+			$classes[] = sanitize_html_class('row-cols-lg-' . $args['row_cols_lg']);
1849 1849
 		}
1850 1850
 	}
1851 1851
 
1852 1852
 	// columns , mobile, tablet, desktop
1853
-	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1854
-		$classes[] = sanitize_html_class( 'col-' . $args['col'] );
1853
+	if (!empty($args['col']) && $args['col'] !== '') {
1854
+		$classes[] = sanitize_html_class('col-' . $args['col']);
1855 1855
 		$col       = $args['col'];
1856 1856
 	} else {
1857 1857
 		$col = null;
1858 1858
 	}
1859
-	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1860
-		$classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
1859
+	if (!empty($args['col_md']) && $args['col_md'] !== '') {
1860
+		$classes[] = sanitize_html_class('col-md-' . $args['col_md']);
1861 1861
 		$col_md    = $args['col_md'];
1862 1862
 	} else {
1863 1863
 		$col_md = null;
1864 1864
 	}
1865
-	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1866
-		if ( $col == null && $col_md == null ) {
1867
-			$classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
1865
+	if (!empty($args['col_lg']) && $args['col_lg'] !== '') {
1866
+		if ($col == null && $col_md == null) {
1867
+			$classes[] = sanitize_html_class('col-' . $args['col_lg']);
1868 1868
 		} else {
1869
-			$classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
1869
+			$classes[] = sanitize_html_class('col-lg-' . $args['col_lg']);
1870 1870
 		}
1871 1871
 	}
1872 1872
 
1873 1873
 	// border
1874
-	if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1874
+	if (!empty($args['border']) && ($args['border'] == 'none' || $args['border'] === '0')) {
1875 1875
 		$classes[] = 'border-0';
1876
-	} elseif ( ! empty( $args['border'] ) ) {
1877
-		$classes[] = 'border border-' . sanitize_html_class( $args['border'] );
1876
+	} elseif (!empty($args['border'])) {
1877
+		$classes[] = 'border border-' . sanitize_html_class($args['border']);
1878 1878
 	}
1879 1879
 
1880 1880
 	// border radius type
1881
-	if ( ! empty( $args['rounded'] ) ) {
1882
-		$classes[] = sanitize_html_class( $args['rounded'] );
1881
+	if (!empty($args['rounded'])) {
1882
+		$classes[] = sanitize_html_class($args['rounded']);
1883 1883
 	}
1884 1884
 
1885 1885
 	// border radius size
1886
-	if ( ! empty( $args['rounded_size'] ) ) {
1887
-		$classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
1886
+	if (!empty($args['rounded_size'])) {
1887
+		$classes[] = 'rounded-' . sanitize_html_class($args['rounded_size']);
1888 1888
 		// if we set a size then we need to remove "rounded" if set
1889
-		if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
1890
-			unset( $classes[ $key ] );
1889
+		if (($key = array_search('rounded', $classes)) !== false) {
1890
+			unset($classes[$key]);
1891 1891
 		}
1892 1892
 	}
1893 1893
 
@@ -1895,112 +1895,112 @@  discard block
 block discarded – undo
1895 1895
 	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1896 1896
 
1897 1897
 	// background
1898
-	if ( ! empty( $args['bg'] ) ) {
1899
-		$classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
1898
+	if (!empty($args['bg'])) {
1899
+		$classes[] = 'bg-' . sanitize_html_class($args['bg']);
1900 1900
 	}
1901 1901
 
1902 1902
 	// text_color
1903
-	if ( ! empty( $args['text_color'] ) ) {
1904
-		$classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
1903
+	if (!empty($args['text_color'])) {
1904
+		$classes[] = 'text-' . sanitize_html_class($args['text_color']);
1905 1905
 	}
1906 1906
 
1907 1907
 	// text_align
1908
-	if ( ! empty( $args['text_justify'] ) ) {
1908
+	if (!empty($args['text_justify'])) {
1909 1909
 		$classes[] = 'text-justify';
1910 1910
 	} else {
1911
-		if ( ! empty( $args['text_align'] ) ) {
1912
-			$classes[]  = sanitize_html_class( $args['text_align'] );
1911
+		if (!empty($args['text_align'])) {
1912
+			$classes[]  = sanitize_html_class($args['text_align']);
1913 1913
 			$text_align = $args['text_align'];
1914 1914
 		} else {
1915 1915
 			$text_align = null;
1916 1916
 		}
1917
-		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1918
-			$classes[]     = sanitize_html_class( $args['text_align_md'] );
1917
+		if (!empty($args['text_align_md']) && $args['text_align_md'] !== '') {
1918
+			$classes[]     = sanitize_html_class($args['text_align_md']);
1919 1919
 			$text_align_md = $args['text_align_md'];
1920 1920
 		} else {
1921 1921
 			$text_align_md = null;
1922 1922
 		}
1923
-		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1924
-			if ( $text_align == null && $text_align_md == null ) {
1925
-				$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
1923
+		if (!empty($args['text_align_lg']) && $args['text_align_lg'] !== '') {
1924
+			if ($text_align == null && $text_align_md == null) {
1925
+				$classes[] = sanitize_html_class(str_replace('-lg', '', $args['text_align_lg']));
1926 1926
 			} else {
1927
-				$classes[] = sanitize_html_class( $args['text_align_lg'] );
1927
+				$classes[] = sanitize_html_class($args['text_align_lg']);
1928 1928
 			}
1929 1929
 		}
1930 1930
 	}
1931 1931
 
1932 1932
 	// display
1933
-	if ( ! empty( $args['display'] ) ) {
1934
-		$classes[] = sanitize_html_class( $args['display'] );
1933
+	if (!empty($args['display'])) {
1934
+		$classes[] = sanitize_html_class($args['display']);
1935 1935
 		$display   = $args['display'];
1936 1936
 	} else {
1937 1937
 		$display = null;
1938 1938
 	}
1939
-	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1940
-		$classes[]  = sanitize_html_class( $args['display_md'] );
1939
+	if (!empty($args['display_md']) && $args['display_md'] !== '') {
1940
+		$classes[]  = sanitize_html_class($args['display_md']);
1941 1941
 		$display_md = $args['display_md'];
1942 1942
 	} else {
1943 1943
 		$display_md = null;
1944 1944
 	}
1945
-	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1946
-		if ( $display == null && $display_md == null ) {
1947
-			$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
1945
+	if (!empty($args['display_lg']) && $args['display_lg'] !== '') {
1946
+		if ($display == null && $display_md == null) {
1947
+			$classes[] = sanitize_html_class(str_replace('-lg', '', $args['display_lg']));
1948 1948
 		} else {
1949
-			$classes[] = sanitize_html_class( $args['display_lg'] );
1949
+			$classes[] = sanitize_html_class($args['display_lg']);
1950 1950
 		}
1951 1951
 	}
1952 1952
 
1953 1953
 	// bgtus - background transparent until scroll
1954
-	if ( ! empty( $args['bgtus'] ) ) {
1955
-		$classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
1954
+	if (!empty($args['bgtus'])) {
1955
+		$classes[] = sanitize_html_class('bg-transparent-until-scroll');
1956 1956
 	}
1957 1957
 
1958 1958
 	// hover animations
1959
-	if ( ! empty( $args['hover_animations'] ) ) {
1960
-		$classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
1959
+	if (!empty($args['hover_animations'])) {
1960
+		$classes[] = sd_sanitize_html_classes(str_replace(',', ' ', $args['hover_animations']));
1961 1961
 	}
1962 1962
 
1963 1963
 	// build classes from build keys
1964 1964
 	$build_keys = sd_get_class_build_keys();
1965
-	if ( ! empty( $build_keys ) ) {
1966
-		foreach ( $build_keys as $key ) {
1965
+	if (!empty($build_keys)) {
1966
+		foreach ($build_keys as $key) {
1967 1967
 
1968
-			if ( substr( $key, -4 ) == '-MTD' ) {
1968
+			if (substr($key, -4) == '-MTD') {
1969 1969
 
1970
-				$k = str_replace( '_MTD', '', $key );
1970
+				$k = str_replace('_MTD', '', $key);
1971 1971
 
1972 1972
 				// Mobile, Tablet, Desktop
1973
-				if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
1974
-					$classes[] = sanitize_html_class( $args[ $k ] );
1975
-					$v         = $args[ $k ];
1973
+				if (!empty($args[$k]) && $args[$k] !== '') {
1974
+					$classes[] = sanitize_html_class($args[$k]);
1975
+					$v         = $args[$k];
1976 1976
 				} else {
1977 1977
 					$v = null;
1978 1978
 				}
1979
-				if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
1980
-					$classes[] = sanitize_html_class( $args[ $k . '_md' ] );
1981
-					$v_md      = $args[ $k . '_md' ];
1979
+				if (!empty($args[$k . '_md']) && $args[$k . '_md'] !== '') {
1980
+					$classes[] = sanitize_html_class($args[$k . '_md']);
1981
+					$v_md      = $args[$k . '_md'];
1982 1982
 				} else {
1983 1983
 					$v_md = null;
1984 1984
 				}
1985
-				if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
1986
-					if ( $v == null && $v_md == null ) {
1987
-						$classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
1985
+				if (!empty($args[$k . '_lg']) && $args[$k . '_lg'] !== '') {
1986
+					if ($v == null && $v_md == null) {
1987
+						$classes[] = sanitize_html_class(str_replace('-lg', '', $args[$k . '_lg']));
1988 1988
 					} else {
1989
-						$classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
1989
+						$classes[] = sanitize_html_class($args[$k . '_lg']);
1990 1990
 					}
1991 1991
 				}
1992 1992
 			} else {
1993
-				if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1993
+				if ($key == 'font_size' && !empty($args[$key]) && $args[$key] == 'custom') {
1994 1994
 					continue;
1995 1995
 				}
1996
-				if ( ! empty( $args[ $key ] ) ) {
1997
-					$classes[] = sd_sanitize_html_classes( $args[ $key ] );
1996
+				if (!empty($args[$key])) {
1997
+					$classes[] = sd_sanitize_html_classes($args[$key]);
1998 1998
 				}
1999 1999
 			}
2000 2000
 		}
2001 2001
 	}
2002 2002
 
2003
-	return implode( ' ', $classes );
2003
+	return implode(' ', $classes);
2004 2004
 }
2005 2005
 
2006 2006
 /**
@@ -2010,19 +2010,19 @@  discard block
 block discarded – undo
2010 2010
  *
2011 2011
  * @return array
2012 2012
  */
2013
-function sd_build_aui_styles( $args ) {
2013
+function sd_build_aui_styles($args) {
2014 2014
 
2015 2015
 	$styles = array();
2016 2016
 
2017 2017
 	// background color
2018
-	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2019
-		if ( $args['bg'] == 'custom-color' ) {
2018
+	if (!empty($args['bg']) && $args['bg'] !== '') {
2019
+		if ($args['bg'] == 'custom-color') {
2020 2020
 			$styles['background-color'] = $args['bg_color'];
2021
-		} elseif ( $args['bg'] == 'custom-gradient' ) {
2021
+		} elseif ($args['bg'] == 'custom-gradient') {
2022 2022
 			$styles['background-image'] = $args['bg_gradient'];
2023 2023
 
2024 2024
 			// use background on text.
2025
-			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2025
+			if (!empty($args['bg_on_text']) && $args['bg_on_text']) {
2026 2026
 				$styles['background-clip']         = 'text';
2027 2027
 				$styles['-webkit-background-clip'] = 'text';
2028 2028
 				$styles['text-fill-color']         = 'transparent';
@@ -2031,62 +2031,62 @@  discard block
 block discarded – undo
2031 2031
 		}
2032 2032
 	}
2033 2033
 
2034
-	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2034
+	if (!empty($args['bg_image']) && $args['bg_image'] !== '') {
2035 2035
 		$hasImage = true;
2036
-		if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2036
+		if (!empty($styles['background-color']) && $args['bg'] == 'custom-color') {
2037 2037
 			$styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2038 2038
 			$styles['background-blend-mode'] = 'overlay';
2039
-		} elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2039
+		} elseif (!empty($styles['background-image']) && $args['bg'] == 'custom-gradient') {
2040 2040
 			$styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2041
-		} elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2041
+		} elseif (!empty($args['bg']) && $args['bg'] != '' && $args['bg'] != 'transparent') {
2042 2042
 			// do nothing as we alreay have a preset
2043 2043
 			$hasImage = false;
2044 2044
 		} else {
2045 2045
 			$styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2046 2046
 		}
2047 2047
 
2048
-		if ( $hasImage ) {
2048
+		if ($hasImage) {
2049 2049
 			$styles['background-size'] = 'cover';
2050 2050
 
2051
-			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2051
+			if (!empty($args['bg_image_fixed']) && $args['bg_image_fixed']) {
2052 2052
 				$styles['background-attachment'] = 'fixed';
2053 2053
 			}
2054 2054
 		}
2055 2055
 
2056
-		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2057
-			$styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2056
+		if ($hasImage && !empty($args['bg_image_xy']) && !empty($args['bg_image_xy']['x'])) {
2057
+			$styles['background-position'] = ($args['bg_image_xy']['x'] * 100) . '% ' . ($args['bg_image_xy']['y'] * 100) . '%';
2058 2058
 		}
2059 2059
 	}
2060 2060
 
2061 2061
 	// sticky offset top
2062
-	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2063
-		$styles['top'] = absint( $args['sticky_offset_top'] );
2062
+	if (!empty($args['sticky_offset_top']) && $args['sticky_offset_top'] !== '') {
2063
+		$styles['top'] = absint($args['sticky_offset_top']);
2064 2064
 	}
2065 2065
 
2066 2066
 	// sticky offset bottom
2067
-	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2068
-		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2067
+	if (!empty($args['sticky_offset_bottom']) && $args['sticky_offset_bottom'] !== '') {
2068
+		$styles['bottom'] = absint($args['sticky_offset_bottom']);
2069 2069
 	}
2070 2070
 
2071 2071
 	// font size
2072
-	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2072
+	if (!empty($args['font_size_custom']) && $args['font_size_custom'] !== '') {
2073 2073
 		$styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2074 2074
 	}
2075 2075
 
2076 2076
 	// font color
2077
-	if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2078
-		$styles['color'] = esc_attr( $args['text_color_custom'] );
2077
+	if (!empty($args['text_color_custom']) && $args['text_color_custom'] !== '') {
2078
+		$styles['color'] = esc_attr($args['text_color_custom']);
2079 2079
 	}
2080 2080
 
2081 2081
 	// font line height
2082
-	if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2083
-		$styles['line-height'] = esc_attr( $args['font_line_height'] );
2082
+	if (!empty($args['font_line_height']) && $args['font_line_height'] !== '') {
2083
+		$styles['line-height'] = esc_attr($args['font_line_height']);
2084 2084
 	}
2085 2085
 
2086 2086
 	$style_string = '';
2087
-	if ( ! empty( $styles ) ) {
2088
-		foreach ( $styles as $key => $val ) {
2089
-			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2087
+	if (!empty($styles)) {
2088
+		foreach ($styles as $key => $val) {
2089
+			$style_string .= esc_attr($key) . ':' . esc_attr($val) . ';';
2090 2090
 		}
2091 2091
 	}
2092 2092
 
@@ -2102,16 +2102,16 @@  discard block
 block discarded – undo
2102 2102
  *
2103 2103
  * @return string
2104 2104
  */
2105
-function sd_sanitize_html_classes( $classes, $sep = ' ' ) {
2105
+function sd_sanitize_html_classes($classes, $sep = ' ') {
2106 2106
 	$return = '';
2107 2107
 
2108
-	if ( ! is_array( $classes ) ) {
2109
-		$classes = explode( $sep, $classes );
2108
+	if (!is_array($classes)) {
2109
+		$classes = explode($sep, $classes);
2110 2110
 	}
2111 2111
 
2112
-	if ( ! empty( $classes ) ) {
2113
-		foreach ( $classes as $class ) {
2114
-			$return .= sanitize_html_class( $class ) . ' ';
2112
+	if (!empty($classes)) {
2113
+		foreach ($classes as $class) {
2114
+			$return .= sanitize_html_class($class) . ' ';
2115 2115
 		}
2116 2116
 	}
2117 2117
 
@@ -2146,5 +2146,5 @@  discard block
 block discarded – undo
2146 2146
 		'styleid',
2147 2147
 	);
2148 2148
 
2149
-	return apply_filters( 'sd_class_build_keys', $keys );
2149
+	return apply_filters('sd_class_build_keys', $keys);
2150 2150
 }
Please login to merge, or discard this patch.
includes/class-getpaid-subscriptions-query.php 2 patches
Indentation   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -16,512 +16,512 @@
 block discarded – undo
16 16
  */
17 17
 class GetPaid_Subscriptions_Query {
18 18
 
19
-	/**
20
-	 * Query vars, after parsing
21
-	 *
22
-	 * @since 1.0.19
23
-	 * @var array
24
-	 */
25
-	public $query_vars = array();
26
-
27
-	/**
28
-	 * List of found subscriptions.
29
-	 *
30
-	 * @since 1.0.19
31
-	 * @var array
32
-	 */
33
-	private $results;
34
-
35
-	/**
36
-	 * Total number of found subscriptions for the current query
37
-	 *
38
-	 * @since 1.0.19
39
-	 * @var int
40
-	 */
41
-	private $total_subscriptions = 0;
42
-
43
-	/**
44
-	 * The SQL query used to fetch matching subscriptions.
45
-	 *
46
-	 * @since 1.0.19
47
-	 * @var string
48
-	 */
49
-	public $request;
50
-
51
-	// SQL clauses
52
-
53
-	/**
54
-	 * Contains the 'FIELDS' sql clause
55
-	 *
56
-	 * @since 1.0.19
57
-	 * @var string
58
-	 */
59
-	public $query_fields;
60
-
61
-	/**
62
-	 * Contains the 'FROM' sql clause
63
-	 *
64
-	 * @since 1.0.19
65
-	 * @var string
66
-	 */
67
-	public $query_from;
68
-
69
-	/**
70
-	 * Contains the 'WHERE' sql clause
71
-	 *
72
-	 * @since 1.0.19
73
-	 * @var string
74
-	 */
75
-	public $query_where;
76
-
77
-	/**
78
-	 * Contains the 'ORDER BY' sql clause
79
-	 *
80
-	 * @since 1.0.19
81
-	 * @var string
82
-	 */
83
-	public $query_orderby;
84
-
85
-	/**
86
-	 * Contains the 'LIMIT' sql clause
87
-	 *
88
-	 * @since 1.0.19
89
-	 * @var string
90
-	 */
91
-	public $query_limit;
92
-
93
-	/**
94
-	 * Class constructor.
95
-	 *
96
-	 * @since 1.0.19
97
-	 *
98
-	 * @param null|string|array $query Optional. The query variables.
99
-	 */
100
-	public function __construct( $query = null ) {
101
-		if ( ! is_null( $query ) ) {
102
-			$this->prepare_query( $query );
103
-			$this->query();
104
-		}
105
-	}
106
-
107
-	/**
108
-	 * Fills in missing query variables with default values.
109
-	 *
110
-	 * @since 1.0.19
111
-	 *
112
-	 * @param  string|array $args Query vars, as passed to `GetPaid_Subscriptions_Query`.
113
-	 * @return array Complete query variables with undefined ones filled in with defaults.
114
-	 */
115
-	public static function fill_query_vars( $args ) {
116
-		$defaults = array(
117
-			'status'          => 'all',
118
-			'customer_in'     => array(),
119
-			'customer_not_in' => array(),
120
-			'product_in'      => array(),
121
-			'product_not_in'  => array(),
122
-			'include'         => array(),
123
-			'exclude'         => array(),
124
-			'orderby'         => 'id',
125
-			'order'           => 'DESC',
126
-			'offset'          => '',
127
-			'number'          => 10,
128
-			'paged'           => 1,
129
-			'count_total'     => true,
130
-			'fields'          => 'all',
131
-		);
132
-
133
-		return wp_parse_args( $args, $defaults );
134
-	}
135
-
136
-	/**
137
-	 * Prepare the query variables.
138
-	 *
139
-	 * @since 1.0.19
140
-	 *
141
-	 * @global wpdb $wpdb WordPress database abstraction object.
142
-	 *
143
-	 * @param string|array $query {
144
-	 *     Optional. Array or string of Query parameters.
145
-	 *
146
-	 *     @type string|array $status              The subscription status to filter by. Can either be a single status or an array of statuses.
147
-	 *                                             Default is all.
148
-	 *     @type int[]        $customer_in         An array of customer ids to filter by.
149
-	 *     @type int[]        $customer_not_in     An array of customer ids whose subscriptions should be excluded.
150
-	 *     @type int[]        $invoice_in          An array of invoice ids to filter by.
151
-	 *     @type int[]        $invoice_not_in      An array of invoice ids whose subscriptions should be excluded.
152
-	 *     @type int[]        $product_in          An array of product ids to filter by.
153
-	 *     @type int[]        $product_not_in      An array of product ids whose subscriptions should be excluded.
154
-	 *     @type array        $date_created_query  A WP_Date_Query compatible array use to filter subscriptions by their date of creation.
155
-	 *     @type array        $date_expires_query  A WP_Date_Query compatible array use to filter subscriptions by their expiration date.
156
-	 *     @type array        $include             An array of subscription IDs to include. Default empty array.
157
-	 *     @type array        $exclude             An array of subscription IDs to exclude. Default empty array.
158
-	 *     @type string|array $orderby             Field(s) to sort the retrieved subscription by. May be a single value,
159
-	 *                                             an array of values, or a multi-dimensional array with fields as
160
-	 *                                             keys and orders ('ASC' or 'DESC') as values. Accepted values are
161
-	 *                                             'id', 'customer_id', 'frequency', 'period', 'initial_amount,
162
-	 *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
163
-	 *                                             'transaction_id', 'product_id', 'trial_period', 'include', 'status', 'profile_id'. Default array( 'id' ).
164
-	 *     @type string       $order               Designates ascending or descending order of subscriptions. Order values
165
-	 *                                             passed as part of an `$orderby` array take precedence over this
166
-	 *                                             parameter. Accepts 'ASC', 'DESC'. Default 'DESC'.
167
-	 *     @type int          $offset              Number of subscriptions to offset in retrieved results. Can be used in
168
-	 *                                             conjunction with pagination. Default 0.
169
-	 *     @type int          $number              Number of subscriptions to limit the query for. Can be used in
170
-	 *                                             conjunction with pagination. Value -1 (all) is supported, but
171
-	 *                                             should be used with caution on larger sites.
172
-	 *                                             Default 10.
173
-	 *     @type int          $paged               When used with number, defines the page of results to return.
174
-	 *                                             Default 1.
175
-	 *     @type bool         $count_total         Whether to count the total number of subscriptions found. If pagination
176
-	 *                                             is not needed, setting this to false can improve performance.
177
-	 *                                             Default true.
178
-	 *     @type string|array $fields              Which fields to return. Single or all fields (string), or array
179
-	 *                                             of fields. Accepts 'id', 'customer_id', 'frequency', 'period', 'initial_amount,
180
-	 *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
181
-	 *                                             'transaction_id', 'product_id', 'trial_period', 'status', 'profile_id'.
182
-	 *                                             Use 'all' for all fields. Default 'all'.
183
-	 * }
184
-	 */
185
-	public function prepare_query( $query = array() ) {
186
-		global $wpdb;
187
-
188
-		if ( empty( $this->query_vars ) || ! empty( $query ) ) {
189
-			$this->query_limit = null;
190
-			$this->query_vars  = $this->fill_query_vars( $query );
191
-		}
192
-
193
-		if ( ! empty( $this->query_vars['fields'] ) && 'all' !== $this->query_vars['fields'] ) {
194
-			$this->query_vars['fields'] = wpinv_parse_list( $this->query_vars['fields'] );
195
-		}
196
-
197
-		do_action( 'getpaid_pre_get_subscriptions', array( &$this ) );
198
-
199
-		// Ensure that query vars are filled after 'getpaid_pre_get_subscriptions'.
200
-		$qv                =& $this->query_vars;
201
-		$qv                = $this->fill_query_vars( $qv );
202
-		$table             = $wpdb->prefix . 'wpinv_subscriptions';
203
-		$this->query_from  = "FROM $table";
204
-
205
-		// Prepare query fields.
206
-		$this->prepare_query_fields( $qv, $table );
207
-
208
-		// Prepare query where.
209
-		$this->prepare_query_where( $qv, $table );
210
-
211
-		// Prepare query order.
212
-		$this->prepare_query_order( $qv, $table );
213
-
214
-		// limit
215
-		if ( isset( $qv['number'] ) && $qv['number'] > 0 ) {
216
-			if ( $qv['offset'] ) {
217
-				$this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] );
218
-			} else {
219
-				$this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] );
220
-			}
221
-		}
222
-
223
-		do_action_ref_array( 'getpaid_after_subscriptions_query', array( &$this ) );
224
-	}
225
-
226
-	/**
227
-	 * Prepares the query fields.
228
-	 *
229
-	 * @since 1.0.19
230
-	 *
231
-	 * @param array $qv Query vars.
232
-	 * @param string $table Table name.
233
-	 */
234
-	protected function prepare_query_fields( &$qv, $table ) {
235
-
236
-		if ( is_array( $qv['fields'] ) ) {
237
-			$qv['fields'] = array_unique( $qv['fields'] );
238
-
239
-			$query_fields = array();
240
-			foreach ( $qv['fields'] as $field ) {
241
-				$field          = sanitize_key( $field );
242
-				$query_fields[] = "$table.`$field`";
243
-			}
244
-			$this->query_fields = implode( ',', $query_fields );
245
-		} else {
246
-			$this->query_fields = "$table.*";
247
-		}
248
-
249
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
250
-			$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
251
-		}
252
-
253
-	}
254
-
255
-	/**
256
-	 * Prepares the query where.
257
-	 *
258
-	 * @since 1.0.19
259
-	 *
260
-	 * @param array $qv Query vars.
261
-	 * @param string $table Table name.
262
-	 */
263
-	protected function prepare_query_where( &$qv, $table ) {
264
-		global $wpdb;
265
-		$this->query_where = 'WHERE 1=1';
266
-
267
-		// Status.
268
-		if ( 'all' !== $qv['status'] ) {
269
-			$statuses           = wpinv_clean( wpinv_parse_list( $qv['status'] ) );
270
-			$prepared_statuses  = join( ',', array_fill( 0, count( $statuses ), '%s' ) );
271
-			$this->query_where .= $wpdb->prepare( " AND $table.`status` IN ( $prepared_statuses )", $statuses );
272
-		}
273
-
274
-		if ( ! empty( $qv['customer_in'] ) ) {
275
-			$customer_in        = implode( ',', wp_parse_id_list( $qv['customer_in'] ) );
276
-			$this->query_where .= " AND $table.`customer_id` IN ($customer_in)";
277
-		} elseif ( ! empty( $qv['customer_not_in'] ) ) {
278
-			$customer_not_in    = implode( ',', wp_parse_id_list( $qv['customer_not_in'] ) );
279
-			$this->query_where .= " AND $table.`customer_id` NOT IN ($customer_not_in)";
280
-		}
281
-
282
-		if ( ! empty( $qv['product_in'] ) ) {
283
-			$product_in         = implode( ',', wp_parse_id_list( $qv['product_in'] ) );
284
-			$this->query_where .= " AND $table.`product_id` IN ($product_in)";
285
-		} elseif ( ! empty( $qv['product_not_in'] ) ) {
286
-			$product_not_in     = implode( ',', wp_parse_id_list( $qv['product_not_in'] ) );
287
-			$this->query_where .= " AND $table.`product_id` NOT IN ($product_not_in)";
288
-		}
289
-
290
-		if ( ! empty( $qv['invoice_in'] ) ) {
291
-			$invoice_in         = implode( ',', wp_parse_id_list( $qv['invoice_in'] ) );
292
-			$this->query_where .= " AND $table.`parent_payment_id` IN ($invoice_in)";
293
-		} elseif ( ! empty( $qv['invoice_not_in'] ) ) {
294
-			$invoice_not_in     = implode( ',', wp_parse_id_list( $qv['invoice_not_in'] ) );
295
-			$this->query_where .= " AND $table.`parent_payment_id` NOT IN ($invoice_not_in)";
296
-		}
297
-
298
-		if ( ! empty( $qv['include'] ) ) {
299
-			$include            = implode( ',', wp_parse_id_list( $qv['include'] ) );
300
-			$this->query_where .= " AND $table.`id` IN ($include)";
301
-		} elseif ( ! empty( $qv['exclude'] ) ) {
302
-			$exclude            = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
303
-			$this->query_where .= " AND $table.`id` NOT IN ($exclude)";
304
-		}
305
-
306
-		// Date queries are allowed for the subscription creation date.
307
-		if ( ! empty( $qv['date_created_query'] ) && is_array( $qv['date_created_query'] ) ) {
308
-			$date_created_query = new WP_Date_Query( $qv['date_created_query'], "$table.created" );
309
-			$this->query_where .= $date_created_query->get_sql();
310
-		}
311
-
312
-		// Date queries are also allowed for the subscription expiration date.
313
-		if ( ! empty( $qv['date_expires_query'] ) && is_array( $qv['date_expires_query'] ) ) {
314
-			$date_expires_query = new WP_Date_Query( $qv['date_expires_query'], "$table.expiration" );
315
-			$this->query_where .= $date_expires_query->get_sql();
316
-		}
317
-
318
-	}
319
-
320
-	/**
321
-	 * Prepares the query order.
322
-	 *
323
-	 * @since 1.0.19
324
-	 *
325
-	 * @param array $qv Query vars.
326
-	 * @param string $table Table name.
327
-	 */
328
-	protected function prepare_query_order( &$qv, $table ) {
329
-
330
-		// sorting.
331
-		$qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
332
-		$order       = $this->parse_order( $qv['order'] );
333
-
334
-		// Default order is by 'id' (latest subscriptions).
335
-		if ( empty( $qv['orderby'] ) ) {
336
-			$qv['orderby'] = array( 'id' );
337
-		}
338
-
339
-		// 'orderby' values may be an array, comma- or space-separated list.
340
-		$ordersby      = array_filter( wpinv_parse_list( $qv['orderby'] ) );
341
-
342
-		$orderby_array = array();
343
-		foreach ( $ordersby as $_key => $_value ) {
344
-
345
-			if ( is_int( $_key ) ) {
346
-				// Integer key means this is a flat array of 'orderby' fields.
347
-				$_orderby = $_value;
348
-				$_order   = $order;
349
-			} else {
350
-				// Non-integer key means that the key is the field and the value is ASC/DESC.
351
-				$_orderby = $_key;
352
-				$_order   = $_value;
353
-			}
354
-
355
-			$parsed = $this->parse_orderby( $_orderby, $table );
356
-
357
-			if ( $parsed ) {
358
-				$orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
359
-			}
19
+    /**
20
+     * Query vars, after parsing
21
+     *
22
+     * @since 1.0.19
23
+     * @var array
24
+     */
25
+    public $query_vars = array();
26
+
27
+    /**
28
+     * List of found subscriptions.
29
+     *
30
+     * @since 1.0.19
31
+     * @var array
32
+     */
33
+    private $results;
34
+
35
+    /**
36
+     * Total number of found subscriptions for the current query
37
+     *
38
+     * @since 1.0.19
39
+     * @var int
40
+     */
41
+    private $total_subscriptions = 0;
42
+
43
+    /**
44
+     * The SQL query used to fetch matching subscriptions.
45
+     *
46
+     * @since 1.0.19
47
+     * @var string
48
+     */
49
+    public $request;
50
+
51
+    // SQL clauses
52
+
53
+    /**
54
+     * Contains the 'FIELDS' sql clause
55
+     *
56
+     * @since 1.0.19
57
+     * @var string
58
+     */
59
+    public $query_fields;
60
+
61
+    /**
62
+     * Contains the 'FROM' sql clause
63
+     *
64
+     * @since 1.0.19
65
+     * @var string
66
+     */
67
+    public $query_from;
68
+
69
+    /**
70
+     * Contains the 'WHERE' sql clause
71
+     *
72
+     * @since 1.0.19
73
+     * @var string
74
+     */
75
+    public $query_where;
76
+
77
+    /**
78
+     * Contains the 'ORDER BY' sql clause
79
+     *
80
+     * @since 1.0.19
81
+     * @var string
82
+     */
83
+    public $query_orderby;
84
+
85
+    /**
86
+     * Contains the 'LIMIT' sql clause
87
+     *
88
+     * @since 1.0.19
89
+     * @var string
90
+     */
91
+    public $query_limit;
92
+
93
+    /**
94
+     * Class constructor.
95
+     *
96
+     * @since 1.0.19
97
+     *
98
+     * @param null|string|array $query Optional. The query variables.
99
+     */
100
+    public function __construct( $query = null ) {
101
+        if ( ! is_null( $query ) ) {
102
+            $this->prepare_query( $query );
103
+            $this->query();
104
+        }
105
+    }
106
+
107
+    /**
108
+     * Fills in missing query variables with default values.
109
+     *
110
+     * @since 1.0.19
111
+     *
112
+     * @param  string|array $args Query vars, as passed to `GetPaid_Subscriptions_Query`.
113
+     * @return array Complete query variables with undefined ones filled in with defaults.
114
+     */
115
+    public static function fill_query_vars( $args ) {
116
+        $defaults = array(
117
+            'status'          => 'all',
118
+            'customer_in'     => array(),
119
+            'customer_not_in' => array(),
120
+            'product_in'      => array(),
121
+            'product_not_in'  => array(),
122
+            'include'         => array(),
123
+            'exclude'         => array(),
124
+            'orderby'         => 'id',
125
+            'order'           => 'DESC',
126
+            'offset'          => '',
127
+            'number'          => 10,
128
+            'paged'           => 1,
129
+            'count_total'     => true,
130
+            'fields'          => 'all',
131
+        );
132
+
133
+        return wp_parse_args( $args, $defaults );
134
+    }
135
+
136
+    /**
137
+     * Prepare the query variables.
138
+     *
139
+     * @since 1.0.19
140
+     *
141
+     * @global wpdb $wpdb WordPress database abstraction object.
142
+     *
143
+     * @param string|array $query {
144
+     *     Optional. Array or string of Query parameters.
145
+     *
146
+     *     @type string|array $status              The subscription status to filter by. Can either be a single status or an array of statuses.
147
+     *                                             Default is all.
148
+     *     @type int[]        $customer_in         An array of customer ids to filter by.
149
+     *     @type int[]        $customer_not_in     An array of customer ids whose subscriptions should be excluded.
150
+     *     @type int[]        $invoice_in          An array of invoice ids to filter by.
151
+     *     @type int[]        $invoice_not_in      An array of invoice ids whose subscriptions should be excluded.
152
+     *     @type int[]        $product_in          An array of product ids to filter by.
153
+     *     @type int[]        $product_not_in      An array of product ids whose subscriptions should be excluded.
154
+     *     @type array        $date_created_query  A WP_Date_Query compatible array use to filter subscriptions by their date of creation.
155
+     *     @type array        $date_expires_query  A WP_Date_Query compatible array use to filter subscriptions by their expiration date.
156
+     *     @type array        $include             An array of subscription IDs to include. Default empty array.
157
+     *     @type array        $exclude             An array of subscription IDs to exclude. Default empty array.
158
+     *     @type string|array $orderby             Field(s) to sort the retrieved subscription by. May be a single value,
159
+     *                                             an array of values, or a multi-dimensional array with fields as
160
+     *                                             keys and orders ('ASC' or 'DESC') as values. Accepted values are
161
+     *                                             'id', 'customer_id', 'frequency', 'period', 'initial_amount,
162
+     *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
163
+     *                                             'transaction_id', 'product_id', 'trial_period', 'include', 'status', 'profile_id'. Default array( 'id' ).
164
+     *     @type string       $order               Designates ascending or descending order of subscriptions. Order values
165
+     *                                             passed as part of an `$orderby` array take precedence over this
166
+     *                                             parameter. Accepts 'ASC', 'DESC'. Default 'DESC'.
167
+     *     @type int          $offset              Number of subscriptions to offset in retrieved results. Can be used in
168
+     *                                             conjunction with pagination. Default 0.
169
+     *     @type int          $number              Number of subscriptions to limit the query for. Can be used in
170
+     *                                             conjunction with pagination. Value -1 (all) is supported, but
171
+     *                                             should be used with caution on larger sites.
172
+     *                                             Default 10.
173
+     *     @type int          $paged               When used with number, defines the page of results to return.
174
+     *                                             Default 1.
175
+     *     @type bool         $count_total         Whether to count the total number of subscriptions found. If pagination
176
+     *                                             is not needed, setting this to false can improve performance.
177
+     *                                             Default true.
178
+     *     @type string|array $fields              Which fields to return. Single or all fields (string), or array
179
+     *                                             of fields. Accepts 'id', 'customer_id', 'frequency', 'period', 'initial_amount,
180
+     *                                             'recurring_amount', 'bill_times', 'parent_payment_id', 'created', 'expiration'
181
+     *                                             'transaction_id', 'product_id', 'trial_period', 'status', 'profile_id'.
182
+     *                                             Use 'all' for all fields. Default 'all'.
183
+     * }
184
+     */
185
+    public function prepare_query( $query = array() ) {
186
+        global $wpdb;
187
+
188
+        if ( empty( $this->query_vars ) || ! empty( $query ) ) {
189
+            $this->query_limit = null;
190
+            $this->query_vars  = $this->fill_query_vars( $query );
191
+        }
192
+
193
+        if ( ! empty( $this->query_vars['fields'] ) && 'all' !== $this->query_vars['fields'] ) {
194
+            $this->query_vars['fields'] = wpinv_parse_list( $this->query_vars['fields'] );
195
+        }
196
+
197
+        do_action( 'getpaid_pre_get_subscriptions', array( &$this ) );
198
+
199
+        // Ensure that query vars are filled after 'getpaid_pre_get_subscriptions'.
200
+        $qv                =& $this->query_vars;
201
+        $qv                = $this->fill_query_vars( $qv );
202
+        $table             = $wpdb->prefix . 'wpinv_subscriptions';
203
+        $this->query_from  = "FROM $table";
204
+
205
+        // Prepare query fields.
206
+        $this->prepare_query_fields( $qv, $table );
207
+
208
+        // Prepare query where.
209
+        $this->prepare_query_where( $qv, $table );
210
+
211
+        // Prepare query order.
212
+        $this->prepare_query_order( $qv, $table );
213
+
214
+        // limit
215
+        if ( isset( $qv['number'] ) && $qv['number'] > 0 ) {
216
+            if ( $qv['offset'] ) {
217
+                $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] );
218
+            } else {
219
+                $this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] );
220
+            }
221
+        }
222
+
223
+        do_action_ref_array( 'getpaid_after_subscriptions_query', array( &$this ) );
224
+    }
225
+
226
+    /**
227
+     * Prepares the query fields.
228
+     *
229
+     * @since 1.0.19
230
+     *
231
+     * @param array $qv Query vars.
232
+     * @param string $table Table name.
233
+     */
234
+    protected function prepare_query_fields( &$qv, $table ) {
235
+
236
+        if ( is_array( $qv['fields'] ) ) {
237
+            $qv['fields'] = array_unique( $qv['fields'] );
238
+
239
+            $query_fields = array();
240
+            foreach ( $qv['fields'] as $field ) {
241
+                $field          = sanitize_key( $field );
242
+                $query_fields[] = "$table.`$field`";
243
+            }
244
+            $this->query_fields = implode( ',', $query_fields );
245
+        } else {
246
+            $this->query_fields = "$table.*";
247
+        }
248
+
249
+        if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
250
+            $this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
251
+        }
252
+
253
+    }
254
+
255
+    /**
256
+     * Prepares the query where.
257
+     *
258
+     * @since 1.0.19
259
+     *
260
+     * @param array $qv Query vars.
261
+     * @param string $table Table name.
262
+     */
263
+    protected function prepare_query_where( &$qv, $table ) {
264
+        global $wpdb;
265
+        $this->query_where = 'WHERE 1=1';
266
+
267
+        // Status.
268
+        if ( 'all' !== $qv['status'] ) {
269
+            $statuses           = wpinv_clean( wpinv_parse_list( $qv['status'] ) );
270
+            $prepared_statuses  = join( ',', array_fill( 0, count( $statuses ), '%s' ) );
271
+            $this->query_where .= $wpdb->prepare( " AND $table.`status` IN ( $prepared_statuses )", $statuses );
272
+        }
273
+
274
+        if ( ! empty( $qv['customer_in'] ) ) {
275
+            $customer_in        = implode( ',', wp_parse_id_list( $qv['customer_in'] ) );
276
+            $this->query_where .= " AND $table.`customer_id` IN ($customer_in)";
277
+        } elseif ( ! empty( $qv['customer_not_in'] ) ) {
278
+            $customer_not_in    = implode( ',', wp_parse_id_list( $qv['customer_not_in'] ) );
279
+            $this->query_where .= " AND $table.`customer_id` NOT IN ($customer_not_in)";
280
+        }
281
+
282
+        if ( ! empty( $qv['product_in'] ) ) {
283
+            $product_in         = implode( ',', wp_parse_id_list( $qv['product_in'] ) );
284
+            $this->query_where .= " AND $table.`product_id` IN ($product_in)";
285
+        } elseif ( ! empty( $qv['product_not_in'] ) ) {
286
+            $product_not_in     = implode( ',', wp_parse_id_list( $qv['product_not_in'] ) );
287
+            $this->query_where .= " AND $table.`product_id` NOT IN ($product_not_in)";
288
+        }
289
+
290
+        if ( ! empty( $qv['invoice_in'] ) ) {
291
+            $invoice_in         = implode( ',', wp_parse_id_list( $qv['invoice_in'] ) );
292
+            $this->query_where .= " AND $table.`parent_payment_id` IN ($invoice_in)";
293
+        } elseif ( ! empty( $qv['invoice_not_in'] ) ) {
294
+            $invoice_not_in     = implode( ',', wp_parse_id_list( $qv['invoice_not_in'] ) );
295
+            $this->query_where .= " AND $table.`parent_payment_id` NOT IN ($invoice_not_in)";
296
+        }
297
+
298
+        if ( ! empty( $qv['include'] ) ) {
299
+            $include            = implode( ',', wp_parse_id_list( $qv['include'] ) );
300
+            $this->query_where .= " AND $table.`id` IN ($include)";
301
+        } elseif ( ! empty( $qv['exclude'] ) ) {
302
+            $exclude            = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
303
+            $this->query_where .= " AND $table.`id` NOT IN ($exclude)";
304
+        }
305
+
306
+        // Date queries are allowed for the subscription creation date.
307
+        if ( ! empty( $qv['date_created_query'] ) && is_array( $qv['date_created_query'] ) ) {
308
+            $date_created_query = new WP_Date_Query( $qv['date_created_query'], "$table.created" );
309
+            $this->query_where .= $date_created_query->get_sql();
310
+        }
311
+
312
+        // Date queries are also allowed for the subscription expiration date.
313
+        if ( ! empty( $qv['date_expires_query'] ) && is_array( $qv['date_expires_query'] ) ) {
314
+            $date_expires_query = new WP_Date_Query( $qv['date_expires_query'], "$table.expiration" );
315
+            $this->query_where .= $date_expires_query->get_sql();
316
+        }
317
+
318
+    }
319
+
320
+    /**
321
+     * Prepares the query order.
322
+     *
323
+     * @since 1.0.19
324
+     *
325
+     * @param array $qv Query vars.
326
+     * @param string $table Table name.
327
+     */
328
+    protected function prepare_query_order( &$qv, $table ) {
329
+
330
+        // sorting.
331
+        $qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
332
+        $order       = $this->parse_order( $qv['order'] );
333
+
334
+        // Default order is by 'id' (latest subscriptions).
335
+        if ( empty( $qv['orderby'] ) ) {
336
+            $qv['orderby'] = array( 'id' );
337
+        }
338
+
339
+        // 'orderby' values may be an array, comma- or space-separated list.
340
+        $ordersby      = array_filter( wpinv_parse_list( $qv['orderby'] ) );
341
+
342
+        $orderby_array = array();
343
+        foreach ( $ordersby as $_key => $_value ) {
344
+
345
+            if ( is_int( $_key ) ) {
346
+                // Integer key means this is a flat array of 'orderby' fields.
347
+                $_orderby = $_value;
348
+                $_order   = $order;
349
+            } else {
350
+                // Non-integer key means that the key is the field and the value is ASC/DESC.
351
+                $_orderby = $_key;
352
+                $_order   = $_value;
353
+            }
354
+
355
+            $parsed = $this->parse_orderby( $_orderby, $table );
356
+
357
+            if ( $parsed ) {
358
+                $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
359
+            }
360 360
 }
361 361
 
362
-		// If no valid clauses were found, order by id.
363
-		if ( empty( $orderby_array ) ) {
364
-			$orderby_array[] = "id $order";
365
-		}
366
-
367
-		$this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );
368
-
369
-	}
370
-
371
-	/**
372
-	 * Execute the query, with the current variables.
373
-	 *
374
-	 * @since 1.0.19
375
-	 *
376
-	 * @global wpdb $wpdb WordPress database abstraction object.
377
-	 */
378
-	public function query() {
379
-		global $wpdb;
380
-
381
-		$qv =& $this->query_vars;
382
-
383
-		// Return a non-null value to bypass the default GetPaid subscriptions query and remember to set the
384
-		// total_subscriptions property.
385
-		$this->results = apply_filters_ref_array( 'getpaid_subscriptions_pre_query', array( null, &$this ) );
386
-
387
-		if ( null === $this->results ) {
388
-			$this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
389
-
390
-			if ( ( is_array( $qv['fields'] ) && 1 != count( $qv['fields'] ) ) || 'all' == $qv['fields'] ) {
391
-				$this->results = $wpdb->get_results( $this->request );
392
-			} else {
393
-				$this->results = $wpdb->get_col( $this->request );
394
-			}
395
-
396
-			if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
397
-				$found_subscriptions_query = apply_filters( 'getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this );
398
-				$this->total_subscriptions   = (int) $wpdb->get_var( $found_subscriptions_query );
399
-			}
400
-		}
401
-
402
-		if ( 'all' == $qv['fields'] ) {
403
-			foreach ( $this->results as $key => $subscription ) {
404
-				$this->set_cache( $subscription->id, $subscription, 'getpaid_subscriptions' );
405
-				$this->set_cache( $subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids' );
406
-				$this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
407
-				$this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
408
-				$this->results[ $key ] = new WPInv_Subscription( $subscription );
409
-			}
410
-		}
411
-
412
-	}
413
-
414
-	/**
415
-	 * Set cache
416
-	 *
417
-	 * @param string  $id
418
-	 * @param mixed   $data
419
-	 * @param string  $group
420
-	 * @param integer $expire
421
-	 * @return boolean
422
-	 */
423
-	public function set_cache( $key, $data, $group = '', $expire = 0 ) {
424
-
425
-		if ( empty( $key ) ) {
426
-			return false;
427
-		}
428
-
429
-		wp_cache_set( $key, $data, $group, $expire );
430
-	}
431
-
432
-	/**
433
-	 * Retrieve query variable.
434
-	 *
435
-	 * @since 1.0.19
436
-	 *
437
-	 * @param string $query_var Query variable key.
438
-	 * @return mixed
439
-	 */
440
-	public function get( $query_var ) {
441
-		if ( isset( $this->query_vars[ $query_var ] ) ) {
442
-			return $this->query_vars[ $query_var ];
443
-		}
444
-
445
-		return null;
446
-	}
447
-
448
-	/**
449
-	 * Set query variable.
450
-	 *
451
-	 * @since 1.0.19
452
-	 *
453
-	 * @param string $query_var Query variable key.
454
-	 * @param mixed $value Query variable value.
455
-	 */
456
-	public function set( $query_var, $value ) {
457
-		$this->query_vars[ $query_var ] = $value;
458
-	}
459
-
460
-	/**
461
-	 * Return the list of subscriptions.
462
-	 *
463
-	 * @since 1.0.19
464
-	 *
465
-	 * @return WPInv_Subscription[]|array Found subscriptions.
466
-	 */
467
-	public function get_results() {
468
-		return $this->results;
469
-	}
470
-
471
-	/**
472
-	 * Return the total number of subscriptions for the current query.
473
-	 *
474
-	 * @since 1.0.19
475
-	 *
476
-	 * @return int Number of total subscriptions.
477
-	 */
478
-	public function get_total() {
479
-		return $this->total_subscriptions;
480
-	}
481
-
482
-	/**
483
-	 * Parse and sanitize 'orderby' keys passed to the subscriptions query.
484
-	 *
485
-	 * @since 1.0.19
486
-	 *
487
-	 * @param string $orderby Alias for the field to order by.
488
-	 *  @param string $table The current table.
489
-	 * @return string Value to use in the ORDER clause, if `$orderby` is valid.
490
-	 */
491
-	protected function parse_orderby( $orderby, $table ) {
492
-
493
-		$_orderby = '';
494
-		if ( in_array( $orderby, array( 'customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id' ) ) ) {
495
-			$_orderby = "$table.`$orderby`";
496
-		} elseif ( 'id' === strtolower( $orderby ) ) {
497
-			$_orderby = "$table.id";
498
-		} elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) {
499
-			$include     = wp_parse_id_list( $this->query_vars['include'] );
500
-			$include_sql = implode( ',', $include );
501
-			$_orderby    = "FIELD( $table.id, $include_sql )";
502
-		}
503
-
504
-		return $_orderby;
505
-	}
506
-
507
-	/**
508
-	 * Parse an 'order' query variable and cast it to ASC or DESC as necessary.
509
-	 *
510
-	 * @since 1.0.19
511
-	 *
512
-	 * @param string $order The 'order' query variable.
513
-	 * @return string The sanitized 'order' query variable.
514
-	 */
515
-	protected function parse_order( $order ) {
516
-		if ( ! is_string( $order ) || empty( $order ) ) {
517
-			return 'DESC';
518
-		}
519
-
520
-		if ( 'ASC' === strtoupper( $order ) ) {
521
-			return 'ASC';
522
-		} else {
523
-			return 'DESC';
524
-		}
525
-	}
362
+        // If no valid clauses were found, order by id.
363
+        if ( empty( $orderby_array ) ) {
364
+            $orderby_array[] = "id $order";
365
+        }
366
+
367
+        $this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );
368
+
369
+    }
370
+
371
+    /**
372
+     * Execute the query, with the current variables.
373
+     *
374
+     * @since 1.0.19
375
+     *
376
+     * @global wpdb $wpdb WordPress database abstraction object.
377
+     */
378
+    public function query() {
379
+        global $wpdb;
380
+
381
+        $qv =& $this->query_vars;
382
+
383
+        // Return a non-null value to bypass the default GetPaid subscriptions query and remember to set the
384
+        // total_subscriptions property.
385
+        $this->results = apply_filters_ref_array( 'getpaid_subscriptions_pre_query', array( null, &$this ) );
386
+
387
+        if ( null === $this->results ) {
388
+            $this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
389
+
390
+            if ( ( is_array( $qv['fields'] ) && 1 != count( $qv['fields'] ) ) || 'all' == $qv['fields'] ) {
391
+                $this->results = $wpdb->get_results( $this->request );
392
+            } else {
393
+                $this->results = $wpdb->get_col( $this->request );
394
+            }
395
+
396
+            if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
397
+                $found_subscriptions_query = apply_filters( 'getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this );
398
+                $this->total_subscriptions   = (int) $wpdb->get_var( $found_subscriptions_query );
399
+            }
400
+        }
401
+
402
+        if ( 'all' == $qv['fields'] ) {
403
+            foreach ( $this->results as $key => $subscription ) {
404
+                $this->set_cache( $subscription->id, $subscription, 'getpaid_subscriptions' );
405
+                $this->set_cache( $subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids' );
406
+                $this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
407
+                $this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
408
+                $this->results[ $key ] = new WPInv_Subscription( $subscription );
409
+            }
410
+        }
411
+
412
+    }
413
+
414
+    /**
415
+     * Set cache
416
+     *
417
+     * @param string  $id
418
+     * @param mixed   $data
419
+     * @param string  $group
420
+     * @param integer $expire
421
+     * @return boolean
422
+     */
423
+    public function set_cache( $key, $data, $group = '', $expire = 0 ) {
424
+
425
+        if ( empty( $key ) ) {
426
+            return false;
427
+        }
428
+
429
+        wp_cache_set( $key, $data, $group, $expire );
430
+    }
431
+
432
+    /**
433
+     * Retrieve query variable.
434
+     *
435
+     * @since 1.0.19
436
+     *
437
+     * @param string $query_var Query variable key.
438
+     * @return mixed
439
+     */
440
+    public function get( $query_var ) {
441
+        if ( isset( $this->query_vars[ $query_var ] ) ) {
442
+            return $this->query_vars[ $query_var ];
443
+        }
444
+
445
+        return null;
446
+    }
447
+
448
+    /**
449
+     * Set query variable.
450
+     *
451
+     * @since 1.0.19
452
+     *
453
+     * @param string $query_var Query variable key.
454
+     * @param mixed $value Query variable value.
455
+     */
456
+    public function set( $query_var, $value ) {
457
+        $this->query_vars[ $query_var ] = $value;
458
+    }
459
+
460
+    /**
461
+     * Return the list of subscriptions.
462
+     *
463
+     * @since 1.0.19
464
+     *
465
+     * @return WPInv_Subscription[]|array Found subscriptions.
466
+     */
467
+    public function get_results() {
468
+        return $this->results;
469
+    }
470
+
471
+    /**
472
+     * Return the total number of subscriptions for the current query.
473
+     *
474
+     * @since 1.0.19
475
+     *
476
+     * @return int Number of total subscriptions.
477
+     */
478
+    public function get_total() {
479
+        return $this->total_subscriptions;
480
+    }
481
+
482
+    /**
483
+     * Parse and sanitize 'orderby' keys passed to the subscriptions query.
484
+     *
485
+     * @since 1.0.19
486
+     *
487
+     * @param string $orderby Alias for the field to order by.
488
+     *  @param string $table The current table.
489
+     * @return string Value to use in the ORDER clause, if `$orderby` is valid.
490
+     */
491
+    protected function parse_orderby( $orderby, $table ) {
492
+
493
+        $_orderby = '';
494
+        if ( in_array( $orderby, array( 'customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id' ) ) ) {
495
+            $_orderby = "$table.`$orderby`";
496
+        } elseif ( 'id' === strtolower( $orderby ) ) {
497
+            $_orderby = "$table.id";
498
+        } elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) {
499
+            $include     = wp_parse_id_list( $this->query_vars['include'] );
500
+            $include_sql = implode( ',', $include );
501
+            $_orderby    = "FIELD( $table.id, $include_sql )";
502
+        }
503
+
504
+        return $_orderby;
505
+    }
506
+
507
+    /**
508
+     * Parse an 'order' query variable and cast it to ASC or DESC as necessary.
509
+     *
510
+     * @since 1.0.19
511
+     *
512
+     * @param string $order The 'order' query variable.
513
+     * @return string The sanitized 'order' query variable.
514
+     */
515
+    protected function parse_order( $order ) {
516
+        if ( ! is_string( $order ) || empty( $order ) ) {
517
+            return 'DESC';
518
+        }
519
+
520
+        if ( 'ASC' === strtoupper( $order ) ) {
521
+            return 'ASC';
522
+        } else {
523
+            return 'DESC';
524
+        }
525
+    }
526 526
 
527 527
 }
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @param null|string|array $query Optional. The query variables.
99 99
 	 */
100
-	public function __construct( $query = null ) {
101
-		if ( ! is_null( $query ) ) {
102
-			$this->prepare_query( $query );
100
+	public function __construct($query = null) {
101
+		if (!is_null($query)) {
102
+			$this->prepare_query($query);
103 103
 			$this->query();
104 104
 		}
105 105
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param  string|array $args Query vars, as passed to `GetPaid_Subscriptions_Query`.
113 113
 	 * @return array Complete query variables with undefined ones filled in with defaults.
114 114
 	 */
115
-	public static function fill_query_vars( $args ) {
115
+	public static function fill_query_vars($args) {
116 116
 		$defaults = array(
117 117
 			'status'          => 'all',
118 118
 			'customer_in'     => array(),
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 			'fields'          => 'all',
131 131
 		);
132 132
 
133
-		return wp_parse_args( $args, $defaults );
133
+		return wp_parse_args($args, $defaults);
134 134
 	}
135 135
 
136 136
 	/**
@@ -182,45 +182,45 @@  discard block
 block discarded – undo
182 182
 	 *                                             Use 'all' for all fields. Default 'all'.
183 183
 	 * }
184 184
 	 */
185
-	public function prepare_query( $query = array() ) {
185
+	public function prepare_query($query = array()) {
186 186
 		global $wpdb;
187 187
 
188
-		if ( empty( $this->query_vars ) || ! empty( $query ) ) {
188
+		if (empty($this->query_vars) || !empty($query)) {
189 189
 			$this->query_limit = null;
190
-			$this->query_vars  = $this->fill_query_vars( $query );
190
+			$this->query_vars  = $this->fill_query_vars($query);
191 191
 		}
192 192
 
193
-		if ( ! empty( $this->query_vars['fields'] ) && 'all' !== $this->query_vars['fields'] ) {
194
-			$this->query_vars['fields'] = wpinv_parse_list( $this->query_vars['fields'] );
193
+		if (!empty($this->query_vars['fields']) && 'all' !== $this->query_vars['fields']) {
194
+			$this->query_vars['fields'] = wpinv_parse_list($this->query_vars['fields']);
195 195
 		}
196 196
 
197
-		do_action( 'getpaid_pre_get_subscriptions', array( &$this ) );
197
+		do_action('getpaid_pre_get_subscriptions', array(&$this));
198 198
 
199 199
 		// Ensure that query vars are filled after 'getpaid_pre_get_subscriptions'.
200
-		$qv                =& $this->query_vars;
201
-		$qv                = $this->fill_query_vars( $qv );
200
+		$qv                = & $this->query_vars;
201
+		$qv                = $this->fill_query_vars($qv);
202 202
 		$table             = $wpdb->prefix . 'wpinv_subscriptions';
203 203
 		$this->query_from  = "FROM $table";
204 204
 
205 205
 		// Prepare query fields.
206
-		$this->prepare_query_fields( $qv, $table );
206
+		$this->prepare_query_fields($qv, $table);
207 207
 
208 208
 		// Prepare query where.
209
-		$this->prepare_query_where( $qv, $table );
209
+		$this->prepare_query_where($qv, $table);
210 210
 
211 211
 		// Prepare query order.
212
-		$this->prepare_query_order( $qv, $table );
212
+		$this->prepare_query_order($qv, $table);
213 213
 
214 214
 		// limit
215
-		if ( isset( $qv['number'] ) && $qv['number'] > 0 ) {
216
-			if ( $qv['offset'] ) {
217
-				$this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['offset'], $qv['number'] );
215
+		if (isset($qv['number']) && $qv['number'] > 0) {
216
+			if ($qv['offset']) {
217
+				$this->query_limit = $wpdb->prepare('LIMIT %d, %d', $qv['offset'], $qv['number']);
218 218
 			} else {
219
-				$this->query_limit = $wpdb->prepare( 'LIMIT %d, %d', $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] );
219
+				$this->query_limit = $wpdb->prepare('LIMIT %d, %d', $qv['number'] * ($qv['paged'] - 1), $qv['number']);
220 220
 			}
221 221
 		}
222 222
 
223
-		do_action_ref_array( 'getpaid_after_subscriptions_query', array( &$this ) );
223
+		do_action_ref_array('getpaid_after_subscriptions_query', array(&$this));
224 224
 	}
225 225
 
226 226
 	/**
@@ -231,22 +231,22 @@  discard block
 block discarded – undo
231 231
 	 * @param array $qv Query vars.
232 232
 	 * @param string $table Table name.
233 233
 	 */
234
-	protected function prepare_query_fields( &$qv, $table ) {
234
+	protected function prepare_query_fields(&$qv, $table) {
235 235
 
236
-		if ( is_array( $qv['fields'] ) ) {
237
-			$qv['fields'] = array_unique( $qv['fields'] );
236
+		if (is_array($qv['fields'])) {
237
+			$qv['fields'] = array_unique($qv['fields']);
238 238
 
239 239
 			$query_fields = array();
240
-			foreach ( $qv['fields'] as $field ) {
241
-				$field          = sanitize_key( $field );
240
+			foreach ($qv['fields'] as $field) {
241
+				$field          = sanitize_key($field);
242 242
 				$query_fields[] = "$table.`$field`";
243 243
 			}
244
-			$this->query_fields = implode( ',', $query_fields );
244
+			$this->query_fields = implode(',', $query_fields);
245 245
 		} else {
246 246
 			$this->query_fields = "$table.*";
247 247
 		}
248 248
 
249
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
249
+		if (isset($qv['count_total']) && $qv['count_total']) {
250 250
 			$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
251 251
 		}
252 252
 
@@ -260,58 +260,58 @@  discard block
 block discarded – undo
260 260
 	 * @param array $qv Query vars.
261 261
 	 * @param string $table Table name.
262 262
 	 */
263
-	protected function prepare_query_where( &$qv, $table ) {
263
+	protected function prepare_query_where(&$qv, $table) {
264 264
 		global $wpdb;
265 265
 		$this->query_where = 'WHERE 1=1';
266 266
 
267 267
 		// Status.
268
-		if ( 'all' !== $qv['status'] ) {
269
-			$statuses           = wpinv_clean( wpinv_parse_list( $qv['status'] ) );
270
-			$prepared_statuses  = join( ',', array_fill( 0, count( $statuses ), '%s' ) );
271
-			$this->query_where .= $wpdb->prepare( " AND $table.`status` IN ( $prepared_statuses )", $statuses );
268
+		if ('all' !== $qv['status']) {
269
+			$statuses           = wpinv_clean(wpinv_parse_list($qv['status']));
270
+			$prepared_statuses  = join(',', array_fill(0, count($statuses), '%s'));
271
+			$this->query_where .= $wpdb->prepare(" AND $table.`status` IN ( $prepared_statuses )", $statuses);
272 272
 		}
273 273
 
274
-		if ( ! empty( $qv['customer_in'] ) ) {
275
-			$customer_in        = implode( ',', wp_parse_id_list( $qv['customer_in'] ) );
274
+		if (!empty($qv['customer_in'])) {
275
+			$customer_in        = implode(',', wp_parse_id_list($qv['customer_in']));
276 276
 			$this->query_where .= " AND $table.`customer_id` IN ($customer_in)";
277
-		} elseif ( ! empty( $qv['customer_not_in'] ) ) {
278
-			$customer_not_in    = implode( ',', wp_parse_id_list( $qv['customer_not_in'] ) );
277
+		} elseif (!empty($qv['customer_not_in'])) {
278
+			$customer_not_in    = implode(',', wp_parse_id_list($qv['customer_not_in']));
279 279
 			$this->query_where .= " AND $table.`customer_id` NOT IN ($customer_not_in)";
280 280
 		}
281 281
 
282
-		if ( ! empty( $qv['product_in'] ) ) {
283
-			$product_in         = implode( ',', wp_parse_id_list( $qv['product_in'] ) );
282
+		if (!empty($qv['product_in'])) {
283
+			$product_in         = implode(',', wp_parse_id_list($qv['product_in']));
284 284
 			$this->query_where .= " AND $table.`product_id` IN ($product_in)";
285
-		} elseif ( ! empty( $qv['product_not_in'] ) ) {
286
-			$product_not_in     = implode( ',', wp_parse_id_list( $qv['product_not_in'] ) );
285
+		} elseif (!empty($qv['product_not_in'])) {
286
+			$product_not_in     = implode(',', wp_parse_id_list($qv['product_not_in']));
287 287
 			$this->query_where .= " AND $table.`product_id` NOT IN ($product_not_in)";
288 288
 		}
289 289
 
290
-		if ( ! empty( $qv['invoice_in'] ) ) {
291
-			$invoice_in         = implode( ',', wp_parse_id_list( $qv['invoice_in'] ) );
290
+		if (!empty($qv['invoice_in'])) {
291
+			$invoice_in         = implode(',', wp_parse_id_list($qv['invoice_in']));
292 292
 			$this->query_where .= " AND $table.`parent_payment_id` IN ($invoice_in)";
293
-		} elseif ( ! empty( $qv['invoice_not_in'] ) ) {
294
-			$invoice_not_in     = implode( ',', wp_parse_id_list( $qv['invoice_not_in'] ) );
293
+		} elseif (!empty($qv['invoice_not_in'])) {
294
+			$invoice_not_in     = implode(',', wp_parse_id_list($qv['invoice_not_in']));
295 295
 			$this->query_where .= " AND $table.`parent_payment_id` NOT IN ($invoice_not_in)";
296 296
 		}
297 297
 
298
-		if ( ! empty( $qv['include'] ) ) {
299
-			$include            = implode( ',', wp_parse_id_list( $qv['include'] ) );
298
+		if (!empty($qv['include'])) {
299
+			$include            = implode(',', wp_parse_id_list($qv['include']));
300 300
 			$this->query_where .= " AND $table.`id` IN ($include)";
301
-		} elseif ( ! empty( $qv['exclude'] ) ) {
302
-			$exclude            = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
301
+		} elseif (!empty($qv['exclude'])) {
302
+			$exclude            = implode(',', wp_parse_id_list($qv['exclude']));
303 303
 			$this->query_where .= " AND $table.`id` NOT IN ($exclude)";
304 304
 		}
305 305
 
306 306
 		// Date queries are allowed for the subscription creation date.
307
-		if ( ! empty( $qv['date_created_query'] ) && is_array( $qv['date_created_query'] ) ) {
308
-			$date_created_query = new WP_Date_Query( $qv['date_created_query'], "$table.created" );
307
+		if (!empty($qv['date_created_query']) && is_array($qv['date_created_query'])) {
308
+			$date_created_query = new WP_Date_Query($qv['date_created_query'], "$table.created");
309 309
 			$this->query_where .= $date_created_query->get_sql();
310 310
 		}
311 311
 
312 312
 		// Date queries are also allowed for the subscription expiration date.
313
-		if ( ! empty( $qv['date_expires_query'] ) && is_array( $qv['date_expires_query'] ) ) {
314
-			$date_expires_query = new WP_Date_Query( $qv['date_expires_query'], "$table.expiration" );
313
+		if (!empty($qv['date_expires_query']) && is_array($qv['date_expires_query'])) {
314
+			$date_expires_query = new WP_Date_Query($qv['date_expires_query'], "$table.expiration");
315 315
 			$this->query_where .= $date_expires_query->get_sql();
316 316
 		}
317 317
 
@@ -325,24 +325,24 @@  discard block
 block discarded – undo
325 325
 	 * @param array $qv Query vars.
326 326
 	 * @param string $table Table name.
327 327
 	 */
328
-	protected function prepare_query_order( &$qv, $table ) {
328
+	protected function prepare_query_order(&$qv, $table) {
329 329
 
330 330
 		// sorting.
331
-		$qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
332
-		$order       = $this->parse_order( $qv['order'] );
331
+		$qv['order'] = isset($qv['order']) ? strtoupper($qv['order']) : '';
332
+		$order       = $this->parse_order($qv['order']);
333 333
 
334 334
 		// Default order is by 'id' (latest subscriptions).
335
-		if ( empty( $qv['orderby'] ) ) {
336
-			$qv['orderby'] = array( 'id' );
335
+		if (empty($qv['orderby'])) {
336
+			$qv['orderby'] = array('id');
337 337
 		}
338 338
 
339 339
 		// 'orderby' values may be an array, comma- or space-separated list.
340
-		$ordersby      = array_filter( wpinv_parse_list( $qv['orderby'] ) );
340
+		$ordersby      = array_filter(wpinv_parse_list($qv['orderby']));
341 341
 
342 342
 		$orderby_array = array();
343
-		foreach ( $ordersby as $_key => $_value ) {
343
+		foreach ($ordersby as $_key => $_value) {
344 344
 
345
-			if ( is_int( $_key ) ) {
345
+			if (is_int($_key)) {
346 346
 				// Integer key means this is a flat array of 'orderby' fields.
347 347
 				$_orderby = $_value;
348 348
 				$_order   = $order;
@@ -352,19 +352,19 @@  discard block
 block discarded – undo
352 352
 				$_order   = $_value;
353 353
 			}
354 354
 
355
-			$parsed = $this->parse_orderby( $_orderby, $table );
355
+			$parsed = $this->parse_orderby($_orderby, $table);
356 356
 
357
-			if ( $parsed ) {
358
-				$orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
357
+			if ($parsed) {
358
+				$orderby_array[] = $parsed . ' ' . $this->parse_order($_order);
359 359
 			}
360 360
 }
361 361
 
362 362
 		// If no valid clauses were found, order by id.
363
-		if ( empty( $orderby_array ) ) {
363
+		if (empty($orderby_array)) {
364 364
 			$orderby_array[] = "id $order";
365 365
 		}
366 366
 
367
-		$this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );
367
+		$this->query_orderby = 'ORDER BY ' . implode(', ', $orderby_array);
368 368
 
369 369
 	}
370 370
 
@@ -378,34 +378,34 @@  discard block
 block discarded – undo
378 378
 	public function query() {
379 379
 		global $wpdb;
380 380
 
381
-		$qv =& $this->query_vars;
381
+		$qv = & $this->query_vars;
382 382
 
383 383
 		// Return a non-null value to bypass the default GetPaid subscriptions query and remember to set the
384 384
 		// total_subscriptions property.
385
-		$this->results = apply_filters_ref_array( 'getpaid_subscriptions_pre_query', array( null, &$this ) );
385
+		$this->results = apply_filters_ref_array('getpaid_subscriptions_pre_query', array(null, &$this));
386 386
 
387
-		if ( null === $this->results ) {
387
+		if (null === $this->results) {
388 388
 			$this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
389 389
 
390
-			if ( ( is_array( $qv['fields'] ) && 1 != count( $qv['fields'] ) ) || 'all' == $qv['fields'] ) {
391
-				$this->results = $wpdb->get_results( $this->request );
390
+			if ((is_array($qv['fields']) && 1 != count($qv['fields'])) || 'all' == $qv['fields']) {
391
+				$this->results = $wpdb->get_results($this->request);
392 392
 			} else {
393
-				$this->results = $wpdb->get_col( $this->request );
393
+				$this->results = $wpdb->get_col($this->request);
394 394
 			}
395 395
 
396
-			if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
397
-				$found_subscriptions_query = apply_filters( 'getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this );
398
-				$this->total_subscriptions   = (int) $wpdb->get_var( $found_subscriptions_query );
396
+			if (isset($qv['count_total']) && $qv['count_total']) {
397
+				$found_subscriptions_query = apply_filters('getpaid_found_subscriptions_query', 'SELECT FOUND_ROWS()', $this);
398
+				$this->total_subscriptions = (int) $wpdb->get_var($found_subscriptions_query);
399 399
 			}
400 400
 		}
401 401
 
402
-		if ( 'all' == $qv['fields'] ) {
403
-			foreach ( $this->results as $key => $subscription ) {
404
-				$this->set_cache( $subscription->id, $subscription, 'getpaid_subscriptions' );
405
-				$this->set_cache( $subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids' );
406
-				$this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
407
-				$this->set_cache( $subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids' );
408
-				$this->results[ $key ] = new WPInv_Subscription( $subscription );
402
+		if ('all' == $qv['fields']) {
403
+			foreach ($this->results as $key => $subscription) {
404
+				$this->set_cache($subscription->id, $subscription, 'getpaid_subscriptions');
405
+				$this->set_cache($subscription->profile_id, $subscription->id, 'getpaid_subscription_profile_ids_to_subscription_ids');
406
+				$this->set_cache($subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids');
407
+				$this->set_cache($subscription->transaction_id, $subscription->id, 'getpaid_subscription_transaction_ids_to_subscription_ids');
408
+				$this->results[$key] = new WPInv_Subscription($subscription);
409 409
 			}
410 410
 		}
411 411
 
@@ -420,13 +420,13 @@  discard block
 block discarded – undo
420 420
 	 * @param integer $expire
421 421
 	 * @return boolean
422 422
 	 */
423
-	public function set_cache( $key, $data, $group = '', $expire = 0 ) {
423
+	public function set_cache($key, $data, $group = '', $expire = 0) {
424 424
 
425
-		if ( empty( $key ) ) {
425
+		if (empty($key)) {
426 426
 			return false;
427 427
 		}
428 428
 
429
-		wp_cache_set( $key, $data, $group, $expire );
429
+		wp_cache_set($key, $data, $group, $expire);
430 430
 	}
431 431
 
432 432
 	/**
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 	 * @param string $query_var Query variable key.
438 438
 	 * @return mixed
439 439
 	 */
440
-	public function get( $query_var ) {
441
-		if ( isset( $this->query_vars[ $query_var ] ) ) {
442
-			return $this->query_vars[ $query_var ];
440
+	public function get($query_var) {
441
+		if (isset($this->query_vars[$query_var])) {
442
+			return $this->query_vars[$query_var];
443 443
 		}
444 444
 
445 445
 		return null;
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	 * @param string $query_var Query variable key.
454 454
 	 * @param mixed $value Query variable value.
455 455
 	 */
456
-	public function set( $query_var, $value ) {
457
-		$this->query_vars[ $query_var ] = $value;
456
+	public function set($query_var, $value) {
457
+		$this->query_vars[$query_var] = $value;
458 458
 	}
459 459
 
460 460
 	/**
@@ -488,16 +488,16 @@  discard block
 block discarded – undo
488 488
 	 *  @param string $table The current table.
489 489
 	 * @return string Value to use in the ORDER clause, if `$orderby` is valid.
490 490
 	 */
491
-	protected function parse_orderby( $orderby, $table ) {
491
+	protected function parse_orderby($orderby, $table) {
492 492
 
493 493
 		$_orderby = '';
494
-		if ( in_array( $orderby, array( 'customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id' ) ) ) {
494
+		if (in_array($orderby, array('customer_id', 'frequency', 'period', 'initial_amount', 'recurring_amount', 'bill_times', 'transaction_id', 'parent_payment_id', 'product_id', 'created', 'expiration', 'trial_period', 'status', 'profile_id'))) {
495 495
 			$_orderby = "$table.`$orderby`";
496
-		} elseif ( 'id' === strtolower( $orderby ) ) {
496
+		} elseif ('id' === strtolower($orderby)) {
497 497
 			$_orderby = "$table.id";
498
-		} elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) {
499
-			$include     = wp_parse_id_list( $this->query_vars['include'] );
500
-			$include_sql = implode( ',', $include );
498
+		} elseif ('include' === $orderby && !empty($this->query_vars['include'])) {
499
+			$include     = wp_parse_id_list($this->query_vars['include']);
500
+			$include_sql = implode(',', $include);
501 501
 			$_orderby    = "FIELD( $table.id, $include_sql )";
502 502
 		}
503 503
 
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
 	 * @param string $order The 'order' query variable.
513 513
 	 * @return string The sanitized 'order' query variable.
514 514
 	 */
515
-	protected function parse_order( $order ) {
516
-		if ( ! is_string( $order ) || empty( $order ) ) {
515
+	protected function parse_order($order) {
516
+		if (!is_string($order) || empty($order)) {
517 517
 			return 'DESC';
518 518
 		}
519 519
 
520
-		if ( 'ASC' === strtoupper( $order ) ) {
520
+		if ('ASC' === strtoupper($order)) {
521 521
 			return 'ASC';
522 522
 		} else {
523 523
 			return 'DESC';
Please login to merge, or discard this patch.
includes/class-wpinv-invoice.php 2 patches
Indentation   +2656 added lines, -2656 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 class WPInv_Invoice extends GetPaid_Data {
15 15
 
16 16
     /**
17
-	 * Which data store to load.
18
-	 *
19
-	 * @var string
20
-	 */
17
+     * Which data store to load.
18
+     *
19
+     * @var string
20
+     */
21 21
     protected $data_store_name = 'invoice';
22 22
 
23 23
     /**
24
-	 * This is the name of this object type.
25
-	 *
26
-	 * @var string
27
-	 */
24
+     * This is the name of this object type.
25
+     *
26
+     * @var string
27
+     */
28 28
     protected $object_type = 'invoice';
29 29
 
30 30
     /**
31
-	 * Item Data array. This is the core item data exposed in APIs.
32
-	 *
33
-	 * @since 1.0.19
34
-	 * @var array
35
-	 */
36
-	protected $data = array(
37
-		'parent_id'              => 0,
38
-		'status'                 => 'wpi-pending',
39
-		'version'                => '',
40
-		'date_created'           => null,
31
+     * Item Data array. This is the core item data exposed in APIs.
32
+     *
33
+     * @since 1.0.19
34
+     * @var array
35
+     */
36
+    protected $data = array(
37
+        'parent_id'              => 0,
38
+        'status'                 => 'wpi-pending',
39
+        'version'                => '',
40
+        'date_created'           => null,
41 41
         'date_modified'          => null,
42 42
         'due_date'               => null,
43 43
         'completed_date'         => null,
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
         'state'                  => null,
61 61
         'zip'                    => null,
62 62
         'company'                => null,
63
-		'company_id'             => null,
63
+        'company_id'             => null,
64 64
         'vat_number'             => null,
65 65
         'vat_rate'               => null,
66 66
         'address'                => null,
67 67
         'address_confirmed'      => false,
68 68
         'shipping'               => null,
69
-		'subtotal'               => 0,
69
+        'subtotal'               => 0,
70 70
         'total_discount'         => 0,
71 71
         'total_tax'              => 0,
72
-		'total_fees'             => 0,
73
-		'total'                  => 0,
72
+        'total_fees'             => 0,
73
+        'total'                  => 0,
74 74
         'fees'                   => array(),
75 75
         'discounts'              => array(),
76 76
         'taxes'                  => array(),
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
         'transaction_id'         => '',
83 83
         'currency'               => '',
84 84
         'disable_taxes'          => false,
85
-		'subscription_id'        => null,
86
-		'remote_subscription_id' => null,
87
-		'is_viewed'              => false,
88
-		'email_cc'               => '',
89
-		'template'               => 'quantity', // hours, amount only
90
-		'created_via'            => null,
85
+        'subscription_id'        => null,
86
+        'remote_subscription_id' => null,
87
+        'is_viewed'              => false,
88
+        'email_cc'               => '',
89
+        'template'               => 'quantity', // hours, amount only
90
+        'created_via'            => null,
91 91
     );
92 92
 
93 93
     /**
94
-	 * Stores meta in cache for future reads.
95
-	 *
96
-	 * A group must be set to to enable caching.
97
-	 *
98
-	 * @var string
99
-	 */
100
-	protected $cache_group = 'getpaid_invoices';
94
+     * Stores meta in cache for future reads.
95
+     *
96
+     * A group must be set to to enable caching.
97
+     *
98
+     * @var string
99
+     */
100
+    protected $cache_group = 'getpaid_invoices';
101 101
 
102 102
     /**
103 103
      * Stores a reference to the original WP_Post object
@@ -111,110 +111,110 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @var int
113 113
      */
114
-	protected $recurring_item = null;
114
+    protected $recurring_item = null;
115 115
 
116
-	/**
116
+    /**
117 117
      * Stores an array of item totals.
118
-	 *
119
-	 * e.g $totals['discount'] = array(
120
-	 *      'initial'   => 10,
121
-	 *      'recurring' => 10,
122
-	 * )
118
+     *
119
+     * e.g $totals['discount'] = array(
120
+     *      'initial'   => 10,
121
+     *      'recurring' => 10,
122
+     * )
123 123
      *
124 124
      * @var array
125 125
      */
126
-	protected $totals = array();
126
+    protected $totals = array();
127 127
 
128
-	/**
128
+    /**
129 129
      * Tax rate.
130
-	 *
130
+     *
131 131
      * @var float
132 132
      */
133
-	protected $tax_rate = 0;
133
+    protected $tax_rate = 0;
134 134
 
135
-	/**
136
-	 * Stores the status transition information.
137
-	 *
138
-	 * @since 1.0.19
139
-	 * @var bool|array
140
-	 */
141
-	protected $status_transition = false;
135
+    /**
136
+     * Stores the status transition information.
137
+     *
138
+     * @since 1.0.19
139
+     * @var bool|array
140
+     */
141
+    protected $status_transition = false;
142 142
 
143 143
     /**
144
-	 * Get the invoice if ID is passed, otherwise the invoice is new and empty.
145
-	 *
146
-	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
147
-	 */
144
+     * Get the invoice if ID is passed, otherwise the invoice is new and empty.
145
+     *
146
+     * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
147
+     */
148 148
     public function __construct( $invoice = 0 ) {
149 149
 
150 150
         parent::__construct( $invoice );
151 151
 
152
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
153
-			$this->set_id( (int) $invoice );
154
-		} elseif ( $invoice instanceof self ) {
155
-			$this->set_id( $invoice->get_id() );
156
-		} elseif ( ! empty( $invoice->ID ) ) {
157
-			$this->set_id( $invoice->ID );
158
-		} elseif ( is_array( $invoice ) ) {
159
-			$this->set_props( $invoice );
160
-
161
-			if ( isset( $invoice['ID'] ) ) {
162
-				$this->set_id( $invoice['ID'] );
163
-			}
152
+        if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
153
+            $this->set_id( (int) $invoice );
154
+        } elseif ( $invoice instanceof self ) {
155
+            $this->set_id( $invoice->get_id() );
156
+        } elseif ( ! empty( $invoice->ID ) ) {
157
+            $this->set_id( $invoice->ID );
158
+        } elseif ( is_array( $invoice ) ) {
159
+            $this->set_props( $invoice );
160
+
161
+            if ( isset( $invoice['ID'] ) ) {
162
+                $this->set_id( $invoice['ID'] );
163
+            }
164 164
 } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
165
-			$this->set_id( $invoice_id );
166
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
169
-			$this->set_id( $invoice_id );
170
-		} else {
171
-			$this->set_object_read( true );
172
-		}
165
+            $this->set_id( $invoice_id );
166
+        } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
167
+            $this->set_id( $invoice_id );
168
+        } elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
169
+            $this->set_id( $invoice_id );
170
+        } else {
171
+            $this->set_object_read( true );
172
+        }
173 173
 
174 174
         // Load the datastore.
175
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
175
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
176 176
 
177
-		if ( $this->get_id() > 0 ) {
177
+        if ( $this->get_id() > 0 ) {
178 178
             $this->post = get_post( $this->get_id() );
179 179
             $this->ID   = $this->get_id();
180
-			$this->data_store->read( $this );
180
+            $this->data_store->read( $this );
181 181
         }
182 182
 
183 183
     }
184 184
 
185 185
     /**
186
-	 * Given an invoice key/number, it returns its id.
187
-	 *
188
-	 *
189
-	 * @static
190
-	 * @param string $value The invoice key or number
191
-	 * @param string $field Either key, transaction_id or number.
192
-	 * @since 1.0.15
193
-	 * @return int
194
-	 */
195
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
186
+     * Given an invoice key/number, it returns its id.
187
+     *
188
+     *
189
+     * @static
190
+     * @param string $value The invoice key or number
191
+     * @param string $field Either key, transaction_id or number.
192
+     * @since 1.0.15
193
+     * @return int
194
+     */
195
+    public static function get_invoice_id_by_field( $value, $field = 'key' ) {
196 196
         global $wpdb;
197 197
 
198
-		// Trim the value.
199
-		$value = trim( $value );
198
+        // Trim the value.
199
+        $value = trim( $value );
200 200
 
201
-		if ( empty( $value ) ) {
202
-			return 0;
203
-		}
201
+        if ( empty( $value ) ) {
202
+            return 0;
203
+        }
204 204
 
205 205
         // Valid fields.
206 206
         $fields = array( 'key', 'number', 'transaction_id' );
207 207
 
208
-		// Ensure a field has been passed.
209
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
210
-			return 0;
211
-		}
208
+        // Ensure a field has been passed.
209
+        if ( empty( $field ) || ! in_array( $field, $fields ) ) {
210
+            return 0;
211
+        }
212 212
 
213
-		// Maybe retrieve from the cache.
214
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
215
-		if ( false !== $invoice_id ) {
216
-			return $invoice_id;
217
-		}
213
+        // Maybe retrieve from the cache.
214
+        $invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
215
+        if ( false !== $invoice_id ) {
216
+            return $invoice_id;
217
+        }
218 218
 
219 219
         // Fetch from the db.
220 220
         $table       = $wpdb->prefix . 'getpaid_invoices';
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
             $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
223 223
         );
224 224
 
225
-		// Update the cache with our data
226
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
225
+        // Update the cache with our data
226
+        wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
227 227
 
228
-		return $invoice_id;
228
+        return $invoice_id;
229 229
     }
230 230
 
231 231
     /**
@@ -251,83 +251,83 @@  discard block
 block discarded – undo
251 251
     */
252 252
 
253 253
     /**
254
-	 * Get parent invoice ID.
255
-	 *
256
-	 * @since 1.0.19
257
-	 * @param  string $context View or edit context.
258
-	 * @return int
259
-	 */
260
-	public function get_parent_id( $context = 'view' ) {
261
-		return (int) $this->get_prop( 'parent_id', $context );
254
+     * Get parent invoice ID.
255
+     *
256
+     * @since 1.0.19
257
+     * @param  string $context View or edit context.
258
+     * @return int
259
+     */
260
+    public function get_parent_id( $context = 'view' ) {
261
+        return (int) $this->get_prop( 'parent_id', $context );
262 262
     }
263 263
 
264 264
     /**
265
-	 * Get parent invoice.
266
-	 *
267
-	 * @since 1.0.19
268
-	 * @return WPInv_Invoice
269
-	 */
265
+     * Get parent invoice.
266
+     *
267
+     * @since 1.0.19
268
+     * @return WPInv_Invoice
269
+     */
270 270
     public function get_parent_payment() {
271 271
         return new WPInv_Invoice( $this->get_parent_id() );
272 272
     }
273 273
 
274 274
     /**
275
-	 * Alias for self::get_parent_payment().
276
-	 *
277
-	 * @since 1.0.19
278
-	 * @return WPInv_Invoice
279
-	 */
275
+     * Alias for self::get_parent_payment().
276
+     *
277
+     * @since 1.0.19
278
+     * @return WPInv_Invoice
279
+     */
280 280
     public function get_parent() {
281 281
         return $this->get_parent_payment();
282 282
     }
283 283
 
284 284
     /**
285
-	 * Get invoice status.
286
-	 *
287
-	 * @since 1.0.19
288
-	 * @param  string $context View or edit context.
289
-	 * @return string
290
-	 */
291
-	public function get_status( $context = 'view' ) {
292
-		return $this->get_prop( 'status', $context );
293
-	}
285
+     * Get invoice status.
286
+     *
287
+     * @since 1.0.19
288
+     * @param  string $context View or edit context.
289
+     * @return string
290
+     */
291
+    public function get_status( $context = 'view' ) {
292
+        return $this->get_prop( 'status', $context );
293
+    }
294 294
 
295
-	/**
296
-	 * Retrieves an array of possible invoice statuses.
297
-	 *
298
-	 * @since 1.0.19
299
-	 * @return array
300
-	 */
301
-	public function get_all_statuses() {
302
-		return wpinv_get_invoice_statuses( true, true, $this );
295
+    /**
296
+     * Retrieves an array of possible invoice statuses.
297
+     *
298
+     * @since 1.0.19
299
+     * @return array
300
+     */
301
+    public function get_all_statuses() {
302
+        return wpinv_get_invoice_statuses( true, true, $this );
303 303
     }
304 304
 
305 305
     /**
306
-	 * Get invoice status nice name.
307
-	 *
308
-	 * @since 1.0.19
309
-	 * @return string
310
-	 */
306
+     * Get invoice status nice name.
307
+     *
308
+     * @since 1.0.19
309
+     * @return string
310
+     */
311 311
     public function get_status_nicename() {
312
-		$statuses = $this->get_all_statuses();
312
+        $statuses = $this->get_all_statuses();
313 313
 
314 314
         $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
315 315
 
316 316
         return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
317 317
     }
318 318
 
319
-	/**
320
-	 * Retrieves the invoice status class
321
-	 *
322
-	 * @since  1.0.19
323
-	 * @return string
324
-	 */
325
-	public function get_status_class() {
326
-		$statuses = getpaid_get_invoice_status_classes();
327
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
328
-	}
319
+    /**
320
+     * Retrieves the invoice status class
321
+     *
322
+     * @since  1.0.19
323
+     * @return string
324
+     */
325
+    public function get_status_class() {
326
+        $statuses = getpaid_get_invoice_status_classes();
327
+        return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
328
+    }
329 329
 
330
-	/**
330
+    /**
331 331
      * Retrieves the invoice status label html
332 332
      *
333 333
      * @since  1.0.0
@@ -335,263 +335,263 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function get_status_label_html() {
337 337
 
338
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
339
-		$status       = sanitize_html_class( $this->get_status() );
340
-		$class        = esc_attr( $this->get_status_class() );
341
-
342
-		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
343
-	}
344
-
345
-    /**
346
-	 * Get plugin version when the invoice was created.
347
-	 *
348
-	 * @since 1.0.19
349
-	 * @param  string $context View or edit context.
350
-	 * @return string
351
-	 */
352
-	public function get_version( $context = 'view' ) {
353
-		return $this->get_prop( 'version', $context );
354
-	}
355
-
356
-	/**
357
-	 * @deprecated
358
-	 */
359
-	public function get_invoice_date( $format = true ) {
360
-		$date      = getpaid_format_date( $this->get_date_completed() );
361
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
362
-		$formatted = getpaid_format_date( $date );
363
-
364
-		if ( $format ) {
365
-			return $formatted;
366
-		}
367
-
368
-		return empty( $formatted ) ? '' : $date;
369
-
370
-    }
371
-
372
-    /**
373
-	 * Get date when the invoice was created.
374
-	 *
375
-	 * @since 1.0.19
376
-	 * @param  string $context View or edit context.
377
-	 * @return string
378
-	 */
379
-	public function get_date_created( $context = 'view' ) {
380
-		return $this->get_prop( 'date_created', $context );
381
-	}
382
-
383
-	/**
384
-	 * Alias for self::get_date_created().
385
-	 *
386
-	 * @since 1.0.19
387
-	 * @param  string $context View or edit context.
388
-	 * @return string
389
-	 */
390
-	public function get_created_date( $context = 'view' ) {
391
-		return $this->get_date_created( $context );
392
-    }
393
-
394
-    /**
395
-	 * Get GMT date when the invoice was created.
396
-	 *
397
-	 * @since 1.0.19
398
-	 * @param  string $context View or edit context.
399
-	 * @return string
400
-	 */
401
-	public function get_date_created_gmt( $context = 'view' ) {
338
+        $status_label = sanitize_text_field( $this->get_status_nicename() );
339
+        $status       = sanitize_html_class( $this->get_status() );
340
+        $class        = esc_attr( $this->get_status_class() );
341
+
342
+        return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
343
+    }
344
+
345
+    /**
346
+     * Get plugin version when the invoice was created.
347
+     *
348
+     * @since 1.0.19
349
+     * @param  string $context View or edit context.
350
+     * @return string
351
+     */
352
+    public function get_version( $context = 'view' ) {
353
+        return $this->get_prop( 'version', $context );
354
+    }
355
+
356
+    /**
357
+     * @deprecated
358
+     */
359
+    public function get_invoice_date( $format = true ) {
360
+        $date      = getpaid_format_date( $this->get_date_completed() );
361
+        $date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
362
+        $formatted = getpaid_format_date( $date );
363
+
364
+        if ( $format ) {
365
+            return $formatted;
366
+        }
367
+
368
+        return empty( $formatted ) ? '' : $date;
369
+
370
+    }
371
+
372
+    /**
373
+     * Get date when the invoice was created.
374
+     *
375
+     * @since 1.0.19
376
+     * @param  string $context View or edit context.
377
+     * @return string
378
+     */
379
+    public function get_date_created( $context = 'view' ) {
380
+        return $this->get_prop( 'date_created', $context );
381
+    }
382
+
383
+    /**
384
+     * Alias for self::get_date_created().
385
+     *
386
+     * @since 1.0.19
387
+     * @param  string $context View or edit context.
388
+     * @return string
389
+     */
390
+    public function get_created_date( $context = 'view' ) {
391
+        return $this->get_date_created( $context );
392
+    }
393
+
394
+    /**
395
+     * Get GMT date when the invoice was created.
396
+     *
397
+     * @since 1.0.19
398
+     * @param  string $context View or edit context.
399
+     * @return string
400
+     */
401
+    public function get_date_created_gmt( $context = 'view' ) {
402 402
         $date = $this->get_date_created( $context );
403 403
 
404 404
         if ( $date ) {
405 405
             $date = get_gmt_from_date( $date );
406 406
         }
407
-		return $date;
407
+        return $date;
408 408
     }
409 409
 
410 410
     /**
411
-	 * Get date when the invoice was last modified.
412
-	 *
413
-	 * @since 1.0.19
414
-	 * @param  string $context View or edit context.
415
-	 * @return string
416
-	 */
417
-	public function get_date_modified( $context = 'view' ) {
418
-		return $this->get_prop( 'date_modified', $context );
419
-	}
411
+     * Get date when the invoice was last modified.
412
+     *
413
+     * @since 1.0.19
414
+     * @param  string $context View or edit context.
415
+     * @return string
416
+     */
417
+    public function get_date_modified( $context = 'view' ) {
418
+        return $this->get_prop( 'date_modified', $context );
419
+    }
420 420
 
421
-	/**
422
-	 * Alias for self::get_date_modified().
423
-	 *
424
-	 * @since 1.0.19
425
-	 * @param  string $context View or edit context.
426
-	 * @return string
427
-	 */
428
-	public function get_modified_date( $context = 'view' ) {
429
-		return $this->get_date_modified( $context );
421
+    /**
422
+     * Alias for self::get_date_modified().
423
+     *
424
+     * @since 1.0.19
425
+     * @param  string $context View or edit context.
426
+     * @return string
427
+     */
428
+    public function get_modified_date( $context = 'view' ) {
429
+        return $this->get_date_modified( $context );
430 430
     }
431 431
 
432 432
     /**
433
-	 * Get GMT date when the invoice was last modified.
434
-	 *
435
-	 * @since 1.0.19
436
-	 * @param  string $context View or edit context.
437
-	 * @return string
438
-	 */
439
-	public function get_date_modified_gmt( $context = 'view' ) {
433
+     * Get GMT date when the invoice was last modified.
434
+     *
435
+     * @since 1.0.19
436
+     * @param  string $context View or edit context.
437
+     * @return string
438
+     */
439
+    public function get_date_modified_gmt( $context = 'view' ) {
440 440
         $date = $this->get_date_modified( $context );
441 441
 
442 442
         if ( $date ) {
443 443
             $date = get_gmt_from_date( $date );
444 444
         }
445
-		return $date;
445
+        return $date;
446 446
     }
447 447
 
448 448
     /**
449
-	 * Get the invoice due date.
450
-	 *
451
-	 * @since 1.0.19
452
-	 * @param  string $context View or edit context.
453
-	 * @return string
454
-	 */
455
-	public function get_due_date( $context = 'view' ) {
456
-		return $this->get_prop( 'due_date', $context );
449
+     * Get the invoice due date.
450
+     *
451
+     * @since 1.0.19
452
+     * @param  string $context View or edit context.
453
+     * @return string
454
+     */
455
+    public function get_due_date( $context = 'view' ) {
456
+        return $this->get_prop( 'due_date', $context );
457 457
     }
458 458
 
459 459
     /**
460
-	 * Alias for self::get_due_date().
461
-	 *
462
-	 * @since 1.0.19
463
-	 * @param  string $context View or edit context.
464
-	 * @return string
465
-	 */
466
-	public function get_date_due( $context = 'view' ) {
467
-		return $this->get_due_date( $context );
460
+     * Alias for self::get_due_date().
461
+     *
462
+     * @since 1.0.19
463
+     * @param  string $context View or edit context.
464
+     * @return string
465
+     */
466
+    public function get_date_due( $context = 'view' ) {
467
+        return $this->get_due_date( $context );
468 468
     }
469 469
 
470 470
     /**
471
-	 * Get the invoice GMT due date.
472
-	 *
473
-	 * @since 1.0.19
474
-	 * @param  string $context View or edit context.
475
-	 * @return string
476
-	 */
477
-	public function get_due_date_gmt( $context = 'view' ) {
471
+     * Get the invoice GMT due date.
472
+     *
473
+     * @since 1.0.19
474
+     * @param  string $context View or edit context.
475
+     * @return string
476
+     */
477
+    public function get_due_date_gmt( $context = 'view' ) {
478 478
         $date = $this->get_due_date( $context );
479 479
 
480 480
         if ( $date ) {
481 481
             $date = get_gmt_from_date( $date );
482 482
         }
483
-		return $date;
483
+        return $date;
484 484
     }
485 485
 
486 486
     /**
487
-	 * Alias for self::get_due_date_gmt().
488
-	 *
489
-	 * @since 1.0.19
490
-	 * @param  string $context View or edit context.
491
-	 * @return string
492
-	 */
493
-	public function get_gmt_date_due( $context = 'view' ) {
494
-		return $this->get_due_date_gmt( $context );
487
+     * Alias for self::get_due_date_gmt().
488
+     *
489
+     * @since 1.0.19
490
+     * @param  string $context View or edit context.
491
+     * @return string
492
+     */
493
+    public function get_gmt_date_due( $context = 'view' ) {
494
+        return $this->get_due_date_gmt( $context );
495 495
     }
496 496
 
497 497
     /**
498
-	 * Get date when the invoice was completed.
499
-	 *
500
-	 * @since 1.0.19
501
-	 * @param  string $context View or edit context.
502
-	 * @return string
503
-	 */
504
-	public function get_completed_date( $context = 'view' ) {
505
-		return $this->get_prop( 'completed_date', $context );
498
+     * Get date when the invoice was completed.
499
+     *
500
+     * @since 1.0.19
501
+     * @param  string $context View or edit context.
502
+     * @return string
503
+     */
504
+    public function get_completed_date( $context = 'view' ) {
505
+        return $this->get_prop( 'completed_date', $context );
506 506
     }
507 507
 
508 508
     /**
509
-	 * Alias for self::get_completed_date().
510
-	 *
511
-	 * @since 1.0.19
512
-	 * @param  string $context View or edit context.
513
-	 * @return string
514
-	 */
515
-	public function get_date_completed( $context = 'view' ) {
516
-		return $this->get_completed_date( $context );
509
+     * Alias for self::get_completed_date().
510
+     *
511
+     * @since 1.0.19
512
+     * @param  string $context View or edit context.
513
+     * @return string
514
+     */
515
+    public function get_date_completed( $context = 'view' ) {
516
+        return $this->get_completed_date( $context );
517 517
     }
518 518
 
519 519
     /**
520
-	 * Get GMT date when the invoice was was completed.
521
-	 *
522
-	 * @since 1.0.19
523
-	 * @param  string $context View or edit context.
524
-	 * @return string
525
-	 */
526
-	public function get_completed_date_gmt( $context = 'view' ) {
520
+     * Get GMT date when the invoice was was completed.
521
+     *
522
+     * @since 1.0.19
523
+     * @param  string $context View or edit context.
524
+     * @return string
525
+     */
526
+    public function get_completed_date_gmt( $context = 'view' ) {
527 527
         $date = $this->get_completed_date( $context );
528 528
 
529 529
         if ( $date ) {
530 530
             $date = get_gmt_from_date( $date );
531 531
         }
532
-		return $date;
532
+        return $date;
533 533
     }
534 534
 
535 535
     /**
536
-	 * Alias for self::get_completed_date_gmt().
537
-	 *
538
-	 * @since 1.0.19
539
-	 * @param  string $context View or edit context.
540
-	 * @return string
541
-	 */
542
-	public function get_gmt_completed_date( $context = 'view' ) {
543
-		return $this->get_completed_date_gmt( $context );
536
+     * Alias for self::get_completed_date_gmt().
537
+     *
538
+     * @since 1.0.19
539
+     * @param  string $context View or edit context.
540
+     * @return string
541
+     */
542
+    public function get_gmt_completed_date( $context = 'view' ) {
543
+        return $this->get_completed_date_gmt( $context );
544 544
     }
545 545
 
546 546
     /**
547
-	 * Get the invoice number.
548
-	 *
549
-	 * @since 1.0.19
550
-	 * @param  string $context View or edit context.
551
-	 * @return string
552
-	 */
553
-	public function get_number( $context = 'view' ) {
554
-		$number = $this->get_prop( 'number', $context );
547
+     * Get the invoice number.
548
+     *
549
+     * @since 1.0.19
550
+     * @param  string $context View or edit context.
551
+     * @return string
552
+     */
553
+    public function get_number( $context = 'view' ) {
554
+        $number = $this->get_prop( 'number', $context );
555 555
 
556
-		if ( empty( $number ) ) {
557
-			$number = $this->generate_number();
558
-			$this->set_number( $this->generate_number() );
559
-		}
556
+        if ( empty( $number ) ) {
557
+            $number = $this->generate_number();
558
+            $this->set_number( $this->generate_number() );
559
+        }
560 560
 
561
-		return $number;
561
+        return $number;
562 562
     }
563 563
 
564
-	/**
565
-	 * Set the invoice number.
566
-	 *
567
-	 * @since 1.0.19
568
-	 */
569
-	public function maybe_set_number() {
564
+    /**
565
+     * Set the invoice number.
566
+     *
567
+     * @since 1.0.19
568
+     */
569
+    public function maybe_set_number() {
570 570
         $number = $this->get_number();
571 571
 
572 572
         if ( empty( $number ) || $this->get_id() == $number ) {
573
-			$this->set_number( $this->generate_number() );
573
+            $this->set_number( $this->generate_number() );
574 574
         }
575 575
 
576
-	}
576
+    }
577 577
 
578 578
     /**
579
-	 * Get the invoice key.
580
-	 *
581
-	 * @since 1.0.19
582
-	 * @param  string $context View or edit context.
583
-	 * @return string
584
-	 */
585
-	public function get_key( $context = 'view' ) {
579
+     * Get the invoice key.
580
+     *
581
+     * @since 1.0.19
582
+     * @param  string $context View or edit context.
583
+     * @return string
584
+     */
585
+    public function get_key( $context = 'view' ) {
586 586
         return $this->get_prop( 'key', $context );
587
-	}
588
-
589
-	/**
590
-	 * Set the invoice key.
591
-	 *
592
-	 * @since 1.0.19
593
-	 */
594
-	public function maybe_set_key() {
587
+    }
588
+
589
+    /**
590
+     * Set the invoice key.
591
+     *
592
+     * @since 1.0.19
593
+     */
594
+    public function maybe_set_key() {
595 595
         $key = $this->get_key();
596 596
 
597 597
         if ( empty( $key ) ) {
@@ -602,140 +602,140 @@  discard block
 block discarded – undo
602 602
     }
603 603
 
604 604
     /**
605
-	 * Get the invoice type.
606
-	 *
607
-	 * @since 1.0.19
608
-	 * @param  string $context View or edit context.
609
-	 * @return string
610
-	 */
611
-	public function get_type( $context = 'view' ) {
605
+     * Get the invoice type.
606
+     *
607
+     * @since 1.0.19
608
+     * @param  string $context View or edit context.
609
+     * @return string
610
+     */
611
+    public function get_type( $context = 'view' ) {
612 612
         return $this->get_prop( 'type', $context );
613
-	}
614
-
615
-	/**
616
-	 * Returns the post type name.
617
-	 *
618
-	 * @since 1.0.19
619
-	 * @return string
620
-	 */
621
-	public function get_invoice_quote_type() {
613
+    }
614
+
615
+    /**
616
+     * Returns the post type name.
617
+     *
618
+     * @since 1.0.19
619
+     * @return string
620
+     */
621
+    public function get_invoice_quote_type() {
622 622
         return getpaid_get_post_type_label( $this->get_post_type(), false );
623 623
     }
624 624
 
625 625
     /**
626
-	 * Get the invoice post type label.
627
-	 *
628
-	 * @since 1.0.19
629
-	 * @param  string $context View or edit context.
630
-	 * @return string
631
-	 */
632
-	public function get_label( $context = 'view' ) {
626
+     * Get the invoice post type label.
627
+     *
628
+     * @since 1.0.19
629
+     * @param  string $context View or edit context.
630
+     * @return string
631
+     */
632
+    public function get_label( $context = 'view' ) {
633 633
         return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
634
-	}
635
-
636
-	/**
637
-	 * Get the invoice post type.
638
-	 *
639
-	 * @since 1.0.19
640
-	 * @param  string $context View or edit context.
641
-	 * @return string
642
-	 */
643
-	public function get_post_type( $context = 'view' ) {
634
+    }
635
+
636
+    /**
637
+     * Get the invoice post type.
638
+     *
639
+     * @since 1.0.19
640
+     * @param  string $context View or edit context.
641
+     * @return string
642
+     */
643
+    public function get_post_type( $context = 'view' ) {
644 644
         return $this->get_prop( 'post_type', $context );
645 645
     }
646 646
 
647 647
     /**
648
-	 * Get the invoice mode.
649
-	 *
650
-	 * @since 1.0.19
651
-	 * @param  string $context View or edit context.
652
-	 * @return string
653
-	 */
654
-	public function get_mode( $context = 'view' ) {
648
+     * Get the invoice mode.
649
+     *
650
+     * @since 1.0.19
651
+     * @param  string $context View or edit context.
652
+     * @return string
653
+     */
654
+    public function get_mode( $context = 'view' ) {
655 655
         return $this->get_prop( 'mode', $context );
656 656
     }
657 657
 
658 658
     /**
659
-	 * Get the invoice path.
660
-	 *
661
-	 * @since 1.0.19
662
-	 * @param  string $context View or edit context.
663
-	 * @return string
664
-	 */
665
-	public function get_path( $context = 'view' ) {
659
+     * Get the invoice path.
660
+     *
661
+     * @since 1.0.19
662
+     * @param  string $context View or edit context.
663
+     * @return string
664
+     */
665
+    public function get_path( $context = 'view' ) {
666 666
         $path   = $this->get_prop( 'path', $context );
667
-		$prefix = $this->get_type();
667
+        $prefix = $this->get_type();
668 668
 
669
-		if ( 0 !== strpos( $path, $prefix ) ) {
670
-			$path = sanitize_title( $prefix . '-' . $this->get_id() );
671
-			$this->set_path( $path );
672
-		}
669
+        if ( 0 !== strpos( $path, $prefix ) ) {
670
+            $path = sanitize_title( $prefix . '-' . $this->get_id() );
671
+            $this->set_path( $path );
672
+        }
673 673
 
674
-		return $path;
674
+        return $path;
675 675
     }
676 676
 
677 677
     /**
678
-	 * Get the invoice name/title.
679
-	 *
680
-	 * @since 1.0.19
681
-	 * @param  string $context View or edit context.
682
-	 * @return string
683
-	 */
684
-	public function get_name( $context = 'view' ) {
678
+     * Get the invoice name/title.
679
+     *
680
+     * @since 1.0.19
681
+     * @param  string $context View or edit context.
682
+     * @return string
683
+     */
684
+    public function get_name( $context = 'view' ) {
685 685
         return $this->get_prop( 'title', $context );
686 686
     }
687 687
 
688 688
     /**
689
-	 * Alias of self::get_name().
690
-	 *
691
-	 * @since 1.0.19
692
-	 * @param  string $context View or edit context.
693
-	 * @return string
694
-	 */
695
-	public function get_title( $context = 'view' ) {
696
-		return $this->get_name( $context );
689
+     * Alias of self::get_name().
690
+     *
691
+     * @since 1.0.19
692
+     * @param  string $context View or edit context.
693
+     * @return string
694
+     */
695
+    public function get_title( $context = 'view' ) {
696
+        return $this->get_name( $context );
697 697
     }
698 698
 
699 699
     /**
700
-	 * Get the invoice description.
701
-	 *
702
-	 * @since 1.0.19
703
-	 * @param  string $context View or edit context.
704
-	 * @return string
705
-	 */
706
-	public function get_description( $context = 'view' ) {
707
-		return $this->get_prop( 'description', $context );
700
+     * Get the invoice description.
701
+     *
702
+     * @since 1.0.19
703
+     * @param  string $context View or edit context.
704
+     * @return string
705
+     */
706
+    public function get_description( $context = 'view' ) {
707
+        return $this->get_prop( 'description', $context );
708 708
     }
709 709
 
710 710
     /**
711
-	 * Alias of self::get_description().
712
-	 *
713
-	 * @since 1.0.19
714
-	 * @param  string $context View or edit context.
715
-	 * @return string
716
-	 */
717
-	public function get_excerpt( $context = 'view' ) {
718
-		return $this->get_description( $context );
711
+     * Alias of self::get_description().
712
+     *
713
+     * @since 1.0.19
714
+     * @param  string $context View or edit context.
715
+     * @return string
716
+     */
717
+    public function get_excerpt( $context = 'view' ) {
718
+        return $this->get_description( $context );
719 719
     }
720 720
 
721 721
     /**
722
-	 * Alias of self::get_description().
723
-	 *
724
-	 * @since 1.0.19
725
-	 * @param  string $context View or edit context.
726
-	 * @return string
727
-	 */
728
-	public function get_summary( $context = 'view' ) {
729
-		return $this->get_description( $context );
722
+     * Alias of self::get_description().
723
+     *
724
+     * @since 1.0.19
725
+     * @param  string $context View or edit context.
726
+     * @return string
727
+     */
728
+    public function get_summary( $context = 'view' ) {
729
+        return $this->get_description( $context );
730 730
     }
731 731
 
732 732
     /**
733
-	 * Returns the user info.
734
-	 *
735
-	 * @since 1.0.19
733
+     * Returns the user info.
734
+     *
735
+     * @since 1.0.19
736 736
      * @param  string $context View or edit context.
737
-	 * @return array
738
-	 */
737
+     * @return array
738
+     */
739 739
     public function get_user_info( $context = 'view' ) {
740 740
 
741 741
         $user_info = array(
@@ -750,683 +750,683 @@  discard block
 block discarded – undo
750 750
             'state'      => $this->get_state( $context ),
751 751
             'zip'        => $this->get_zip( $context ),
752 752
             'company'    => $this->get_company( $context ),
753
-			'company_id' => $this->get_company_id( $context ),
753
+            'company_id' => $this->get_company_id( $context ),
754 754
             'vat_number' => $this->get_vat_number( $context ),
755 755
             'discount'   => $this->get_discount_code( $context ),
756
-		);
756
+        );
757 757
 
758
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
758
+        return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
759 759
 
760 760
     }
761 761
 
762 762
     /**
763
-	 * Get the customer id.
764
-	 *
765
-	 * @since 1.0.19
766
-	 * @param  string $context View or edit context.
767
-	 * @return int
768
-	 */
769
-	public function get_author( $context = 'view' ) {
770
-		return (int) $this->get_prop( 'author', $context );
763
+     * Get the customer id.
764
+     *
765
+     * @since 1.0.19
766
+     * @param  string $context View or edit context.
767
+     * @return int
768
+     */
769
+    public function get_author( $context = 'view' ) {
770
+        return (int) $this->get_prop( 'author', $context );
771 771
     }
772 772
 
773 773
     /**
774
-	 * Alias of self::get_author().
775
-	 *
776
-	 * @since 1.0.19
777
-	 * @param  string $context View or edit context.
778
-	 * @return int
779
-	 */
780
-	public function get_user_id( $context = 'view' ) {
781
-		return $this->get_author( $context );
774
+     * Alias of self::get_author().
775
+     *
776
+     * @since 1.0.19
777
+     * @param  string $context View or edit context.
778
+     * @return int
779
+     */
780
+    public function get_user_id( $context = 'view' ) {
781
+        return $this->get_author( $context );
782 782
     }
783 783
 
784
-     /**
785
-	 * Alias of self::get_author().
786
-	 *
787
-	 * @since 1.0.19
788
-	 * @param  string $context View or edit context.
789
-	 * @return int
790
-	 */
791
-	public function get_customer_id( $context = 'view' ) {
792
-		return $this->get_author( $context );
784
+        /**
785
+         * Alias of self::get_author().
786
+         *
787
+         * @since 1.0.19
788
+         * @param  string $context View or edit context.
789
+         * @return int
790
+         */
791
+    public function get_customer_id( $context = 'view' ) {
792
+        return $this->get_author( $context );
793 793
     }
794 794
 
795 795
     /**
796
-	 * Get the customer's ip.
797
-	 *
798
-	 * @since 1.0.19
799
-	 * @param  string $context View or edit context.
800
-	 * @return string
801
-	 */
802
-	public function get_ip( $context = 'view' ) {
803
-		return $this->get_prop( 'user_ip', $context );
796
+     * Get the customer's ip.
797
+     *
798
+     * @since 1.0.19
799
+     * @param  string $context View or edit context.
800
+     * @return string
801
+     */
802
+    public function get_ip( $context = 'view' ) {
803
+        return $this->get_prop( 'user_ip', $context );
804 804
     }
805 805
 
806 806
     /**
807
-	 * Alias of self::get_ip().
808
-	 *
809
-	 * @since 1.0.19
810
-	 * @param  string $context View or edit context.
811
-	 * @return string
812
-	 */
813
-	public function get_user_ip( $context = 'view' ) {
814
-		return $this->get_ip( $context );
807
+     * Alias of self::get_ip().
808
+     *
809
+     * @since 1.0.19
810
+     * @param  string $context View or edit context.
811
+     * @return string
812
+     */
813
+    public function get_user_ip( $context = 'view' ) {
814
+        return $this->get_ip( $context );
815 815
     }
816 816
 
817
-     /**
818
-	 * Alias of self::get_ip().
819
-	 *
820
-	 * @since 1.0.19
821
-	 * @param  string $context View or edit context.
822
-	 * @return string
823
-	 */
824
-	public function get_customer_ip( $context = 'view' ) {
825
-		return $this->get_ip( $context );
817
+        /**
818
+         * Alias of self::get_ip().
819
+         *
820
+         * @since 1.0.19
821
+         * @param  string $context View or edit context.
822
+         * @return string
823
+         */
824
+    public function get_customer_ip( $context = 'view' ) {
825
+        return $this->get_ip( $context );
826 826
     }
827 827
 
828 828
     /**
829
-	 * Get the customer's first name.
830
-	 *
831
-	 * @since 1.0.19
832
-	 * @param  string $context View or edit context.
833
-	 * @return string
834
-	 */
835
-	public function get_first_name( $context = 'view' ) {
836
-		return $this->get_prop( 'first_name', $context );
829
+     * Get the customer's first name.
830
+     *
831
+     * @since 1.0.19
832
+     * @param  string $context View or edit context.
833
+     * @return string
834
+     */
835
+    public function get_first_name( $context = 'view' ) {
836
+        return $this->get_prop( 'first_name', $context );
837 837
     }
838 838
 
839 839
     /**
840
-	 * Alias of self::get_first_name().
841
-	 *
842
-	 * @since 1.0.19
843
-	 * @param  string $context View or edit context.
844
-	 * @return string
845
-	 */
846
-	public function get_user_first_name( $context = 'view' ) {
847
-		return $this->get_first_name( $context );
840
+     * Alias of self::get_first_name().
841
+     *
842
+     * @since 1.0.19
843
+     * @param  string $context View or edit context.
844
+     * @return string
845
+     */
846
+    public function get_user_first_name( $context = 'view' ) {
847
+        return $this->get_first_name( $context );
848 848
     }
849 849
 
850
-     /**
851
-	 * Alias of self::get_first_name().
852
-	 *
853
-	 * @since 1.0.19
854
-	 * @param  string $context View or edit context.
855
-	 * @return string
856
-	 */
857
-	public function get_customer_first_name( $context = 'view' ) {
858
-		return $this->get_first_name( $context );
850
+        /**
851
+         * Alias of self::get_first_name().
852
+         *
853
+         * @since 1.0.19
854
+         * @param  string $context View or edit context.
855
+         * @return string
856
+         */
857
+    public function get_customer_first_name( $context = 'view' ) {
858
+        return $this->get_first_name( $context );
859 859
     }
860 860
 
861 861
     /**
862
-	 * Get the customer's last name.
863
-	 *
864
-	 * @since 1.0.19
865
-	 * @param  string $context View or edit context.
866
-	 * @return string
867
-	 */
868
-	public function get_last_name( $context = 'view' ) {
869
-		return $this->get_prop( 'last_name', $context );
862
+     * Get the customer's last name.
863
+     *
864
+     * @since 1.0.19
865
+     * @param  string $context View or edit context.
866
+     * @return string
867
+     */
868
+    public function get_last_name( $context = 'view' ) {
869
+        return $this->get_prop( 'last_name', $context );
870 870
     }
871 871
 
872 872
     /**
873
-	 * Alias of self::get_last_name().
874
-	 *
875
-	 * @since 1.0.19
876
-	 * @param  string $context View or edit context.
877
-	 * @return string
878
-	 */
879
-	public function get_user_last_name( $context = 'view' ) {
880
-		return $this->get_last_name( $context );
873
+     * Alias of self::get_last_name().
874
+     *
875
+     * @since 1.0.19
876
+     * @param  string $context View or edit context.
877
+     * @return string
878
+     */
879
+    public function get_user_last_name( $context = 'view' ) {
880
+        return $this->get_last_name( $context );
881 881
     }
882 882
 
883 883
     /**
884
-	 * Alias of self::get_last_name().
885
-	 *
886
-	 * @since 1.0.19
887
-	 * @param  string $context View or edit context.
888
-	 * @return string
889
-	 */
890
-	public function get_customer_last_name( $context = 'view' ) {
891
-		return $this->get_last_name( $context );
884
+     * Alias of self::get_last_name().
885
+     *
886
+     * @since 1.0.19
887
+     * @param  string $context View or edit context.
888
+     * @return string
889
+     */
890
+    public function get_customer_last_name( $context = 'view' ) {
891
+        return $this->get_last_name( $context );
892 892
     }
893 893
 
894 894
     /**
895
-	 * Get the customer's full name.
896
-	 *
897
-	 * @since 1.0.19
898
-	 * @param  string $context View or edit context.
899
-	 * @return string
900
-	 */
901
-	public function get_full_name( $context = 'view' ) {
902
-		$name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
895
+     * Get the customer's full name.
896
+     *
897
+     * @since 1.0.19
898
+     * @param  string $context View or edit context.
899
+     * @return string
900
+     */
901
+    public function get_full_name( $context = 'view' ) {
902
+        $name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
903 903
 
904
-		if ( ! $name ) {
905
-			$user = get_userdata( $this->get_author( $context ) );
904
+        if ( ! $name ) {
905
+            $user = get_userdata( $this->get_author( $context ) );
906 906
 
907
-			if ( $user ) {
908
-				$name = $user->display_name;
909
-			}
910
-		}
907
+            if ( $user ) {
908
+                $name = $user->display_name;
909
+            }
910
+        }
911 911
 
912
-		if ( ! $name ) {
913
-			$name = $this->get_email( $context );
914
-		}
912
+        if ( ! $name ) {
913
+            $name = $this->get_email( $context );
914
+        }
915 915
 
916
-		return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
916
+        return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
917 917
     }
918 918
 
919 919
     /**
920
-	 * Alias of self::get_full_name().
921
-	 *
922
-	 * @since 1.0.19
923
-	 * @param  string $context View or edit context.
924
-	 * @return string
925
-	 */
926
-	public function get_user_full_name( $context = 'view' ) {
927
-		return $this->get_full_name( $context );
920
+     * Alias of self::get_full_name().
921
+     *
922
+     * @since 1.0.19
923
+     * @param  string $context View or edit context.
924
+     * @return string
925
+     */
926
+    public function get_user_full_name( $context = 'view' ) {
927
+        return $this->get_full_name( $context );
928 928
     }
929 929
 
930 930
     /**
931
-	 * Alias of self::get_full_name().
932
-	 *
933
-	 * @since 1.0.19
934
-	 * @param  string $context View or edit context.
935
-	 * @return string
936
-	 */
937
-	public function get_customer_full_name( $context = 'view' ) {
938
-		return $this->get_full_name( $context );
931
+     * Alias of self::get_full_name().
932
+     *
933
+     * @since 1.0.19
934
+     * @param  string $context View or edit context.
935
+     * @return string
936
+     */
937
+    public function get_customer_full_name( $context = 'view' ) {
938
+        return $this->get_full_name( $context );
939 939
     }
940 940
 
941 941
     /**
942
-	 * Get the customer's phone number.
943
-	 *
944
-	 * @since 1.0.19
945
-	 * @param  string $context View or edit context.
946
-	 * @return string
947
-	 */
948
-	public function get_phone( $context = 'view' ) {
949
-		return $this->get_prop( 'phone', $context );
942
+     * Get the customer's phone number.
943
+     *
944
+     * @since 1.0.19
945
+     * @param  string $context View or edit context.
946
+     * @return string
947
+     */
948
+    public function get_phone( $context = 'view' ) {
949
+        return $this->get_prop( 'phone', $context );
950
+    }
951
+
952
+    /**
953
+     * Alias of self::get_phone().
954
+     *
955
+     * @since 1.0.19
956
+     * @param  string $context View or edit context.
957
+     * @return string
958
+     */
959
+    public function get_phone_number( $context = 'view' ) {
960
+        return $this->get_phone( $context );
950 961
     }
951 962
 
952 963
     /**
953
-	 * Alias of self::get_phone().
954
-	 *
955
-	 * @since 1.0.19
956
-	 * @param  string $context View or edit context.
957
-	 * @return string
958
-	 */
959
-	public function get_phone_number( $context = 'view' ) {
960
-		return $this->get_phone( $context );
964
+     * Alias of self::get_phone().
965
+     *
966
+     * @since 1.0.19
967
+     * @param  string $context View or edit context.
968
+     * @return string
969
+     */
970
+    public function get_user_phone( $context = 'view' ) {
971
+        return $this->get_phone( $context );
972
+    }
973
+
974
+    /**
975
+     * Alias of self::get_phone().
976
+     *
977
+     * @since 1.0.19
978
+     * @param  string $context View or edit context.
979
+     * @return string
980
+     */
981
+    public function get_customer_phone( $context = 'view' ) {
982
+        return $this->get_phone( $context );
961 983
     }
962 984
 
963 985
     /**
964
-	 * Alias of self::get_phone().
965
-	 *
966
-	 * @since 1.0.19
967
-	 * @param  string $context View or edit context.
968
-	 * @return string
969
-	 */
970
-	public function get_user_phone( $context = 'view' ) {
971
-		return $this->get_phone( $context );
986
+     * Get the customer's email address.
987
+     *
988
+     * @since 1.0.19
989
+     * @param  string $context View or edit context.
990
+     * @return string
991
+     */
992
+    public function get_email( $context = 'view' ) {
993
+        return $this->get_prop( 'email', $context );
972 994
     }
973 995
 
974 996
     /**
975
-	 * Alias of self::get_phone().
976
-	 *
977
-	 * @since 1.0.19
978
-	 * @param  string $context View or edit context.
979
-	 * @return string
980
-	 */
981
-	public function get_customer_phone( $context = 'view' ) {
982
-		return $this->get_phone( $context );
997
+     * Alias of self::get_email().
998
+     *
999
+     * @since 1.0.19
1000
+     * @param  string $context View or edit context.
1001
+     * @return string
1002
+     */
1003
+    public function get_email_address( $context = 'view' ) {
1004
+        return $this->get_email( $context );
983 1005
     }
984 1006
 
985 1007
     /**
986
-	 * Get the customer's email address.
987
-	 *
988
-	 * @since 1.0.19
989
-	 * @param  string $context View or edit context.
990
-	 * @return string
991
-	 */
992
-	public function get_email( $context = 'view' ) {
993
-		return $this->get_prop( 'email', $context );
1008
+     * Alias of self::get_email().
1009
+     *
1010
+     * @since 1.0.19
1011
+     * @param  string $context View or edit context.
1012
+     * @return string
1013
+     */
1014
+    public function get_user_email( $context = 'view' ) {
1015
+        return $this->get_email( $context );
994 1016
     }
995 1017
 
996 1018
     /**
997
-	 * Alias of self::get_email().
998
-	 *
999
-	 * @since 1.0.19
1000
-	 * @param  string $context View or edit context.
1001
-	 * @return string
1002
-	 */
1003
-	public function get_email_address( $context = 'view' ) {
1004
-		return $this->get_email( $context );
1019
+     * Alias of self::get_email().
1020
+     *
1021
+     * @since 1.0.19
1022
+     * @param  string $context View or edit context.
1023
+     * @return string
1024
+     */
1025
+    public function get_customer_email( $context = 'view' ) {
1026
+        return $this->get_email( $context );
1005 1027
     }
1006 1028
 
1007 1029
     /**
1008
-	 * Alias of self::get_email().
1009
-	 *
1010
-	 * @since 1.0.19
1011
-	 * @param  string $context View or edit context.
1012
-	 * @return string
1013
-	 */
1014
-	public function get_user_email( $context = 'view' ) {
1015
-		return $this->get_email( $context );
1030
+     * Get the customer's country.
1031
+     *
1032
+     * @since 1.0.19
1033
+     * @param  string $context View or edit context.
1034
+     * @return string
1035
+     */
1036
+    public function get_country( $context = 'view' ) {
1037
+        $country = $this->get_prop( 'country', $context );
1038
+        return empty( $country ) ? wpinv_get_default_country() : $country;
1039
+    }
1040
+
1041
+    /**
1042
+     * Alias of self::get_country().
1043
+     *
1044
+     * @since 1.0.19
1045
+     * @param  string $context View or edit context.
1046
+     * @return string
1047
+     */
1048
+    public function get_user_country( $context = 'view' ) {
1049
+        return $this->get_country( $context );
1050
+    }
1051
+
1052
+    /**
1053
+     * Alias of self::get_country().
1054
+     *
1055
+     * @since 1.0.19
1056
+     * @param  string $context View or edit context.
1057
+     * @return string
1058
+     */
1059
+    public function get_customer_country( $context = 'view' ) {
1060
+        return $this->get_country( $context );
1061
+    }
1062
+
1063
+    /**
1064
+     * Get the customer's state.
1065
+     *
1066
+     * @since 1.0.19
1067
+     * @param  string $context View or edit context.
1068
+     * @return string
1069
+     */
1070
+    public function get_state( $context = 'view' ) {
1071
+        $state = $this->get_prop( 'state', $context );
1072
+        return empty( $state ) ? wpinv_get_default_state() : $state;
1073
+    }
1074
+
1075
+    /**
1076
+     * Alias of self::get_state().
1077
+     *
1078
+     * @since 1.0.19
1079
+     * @param  string $context View or edit context.
1080
+     * @return string
1081
+     */
1082
+    public function get_user_state( $context = 'view' ) {
1083
+        return $this->get_state( $context );
1084
+    }
1085
+
1086
+    /**
1087
+     * Alias of self::get_state().
1088
+     *
1089
+     * @since 1.0.19
1090
+     * @param  string $context View or edit context.
1091
+     * @return string
1092
+     */
1093
+    public function get_customer_state( $context = 'view' ) {
1094
+        return $this->get_state( $context );
1095
+    }
1096
+
1097
+    /**
1098
+     * Get the customer's city.
1099
+     *
1100
+     * @since 1.0.19
1101
+     * @param  string $context View or edit context.
1102
+     * @return string
1103
+     */
1104
+    public function get_city( $context = 'view' ) {
1105
+        return $this->get_prop( 'city', $context );
1016 1106
     }
1017 1107
 
1018 1108
     /**
1019
-	 * Alias of self::get_email().
1020
-	 *
1021
-	 * @since 1.0.19
1022
-	 * @param  string $context View or edit context.
1023
-	 * @return string
1024
-	 */
1025
-	public function get_customer_email( $context = 'view' ) {
1026
-		return $this->get_email( $context );
1109
+     * Alias of self::get_city().
1110
+     *
1111
+     * @since 1.0.19
1112
+     * @param  string $context View or edit context.
1113
+     * @return string
1114
+     */
1115
+    public function get_user_city( $context = 'view' ) {
1116
+        return $this->get_city( $context );
1027 1117
     }
1028 1118
 
1029 1119
     /**
1030
-	 * Get the customer's country.
1031
-	 *
1032
-	 * @since 1.0.19
1033
-	 * @param  string $context View or edit context.
1034
-	 * @return string
1035
-	 */
1036
-	public function get_country( $context = 'view' ) {
1037
-		$country = $this->get_prop( 'country', $context );
1038
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1120
+     * Alias of self::get_city().
1121
+     *
1122
+     * @since 1.0.19
1123
+     * @param  string $context View or edit context.
1124
+     * @return string
1125
+     */
1126
+    public function get_customer_city( $context = 'view' ) {
1127
+        return $this->get_city( $context );
1039 1128
     }
1040 1129
 
1041 1130
     /**
1042
-	 * Alias of self::get_country().
1043
-	 *
1044
-	 * @since 1.0.19
1045
-	 * @param  string $context View or edit context.
1046
-	 * @return string
1047
-	 */
1048
-	public function get_user_country( $context = 'view' ) {
1049
-		return $this->get_country( $context );
1131
+     * Get the customer's zip.
1132
+     *
1133
+     * @since 1.0.19
1134
+     * @param  string $context View or edit context.
1135
+     * @return string
1136
+     */
1137
+    public function get_zip( $context = 'view' ) {
1138
+        return $this->get_prop( 'zip', $context );
1050 1139
     }
1051 1140
 
1052 1141
     /**
1053
-	 * Alias of self::get_country().
1054
-	 *
1055
-	 * @since 1.0.19
1056
-	 * @param  string $context View or edit context.
1057
-	 * @return string
1058
-	 */
1059
-	public function get_customer_country( $context = 'view' ) {
1060
-		return $this->get_country( $context );
1142
+     * Alias of self::get_zip().
1143
+     *
1144
+     * @since 1.0.19
1145
+     * @param  string $context View or edit context.
1146
+     * @return string
1147
+     */
1148
+    public function get_user_zip( $context = 'view' ) {
1149
+        return $this->get_zip( $context );
1061 1150
     }
1062 1151
 
1063 1152
     /**
1064
-	 * Get the customer's state.
1065
-	 *
1066
-	 * @since 1.0.19
1067
-	 * @param  string $context View or edit context.
1068
-	 * @return string
1069
-	 */
1070
-	public function get_state( $context = 'view' ) {
1071
-		$state = $this->get_prop( 'state', $context );
1072
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1153
+     * Alias of self::get_zip().
1154
+     *
1155
+     * @since 1.0.19
1156
+     * @param  string $context View or edit context.
1157
+     * @return string
1158
+     */
1159
+    public function get_customer_zip( $context = 'view' ) {
1160
+        return $this->get_zip( $context );
1073 1161
     }
1074 1162
 
1075 1163
     /**
1076
-	 * Alias of self::get_state().
1077
-	 *
1078
-	 * @since 1.0.19
1079
-	 * @param  string $context View or edit context.
1080
-	 * @return string
1081
-	 */
1082
-	public function get_user_state( $context = 'view' ) {
1083
-		return $this->get_state( $context );
1164
+     * Get the customer's company.
1165
+     *
1166
+     * @since 1.0.19
1167
+     * @param  string $context View or edit context.
1168
+     * @return string
1169
+     */
1170
+    public function get_company( $context = 'view' ) {
1171
+        return $this->get_prop( 'company', $context );
1084 1172
     }
1085 1173
 
1086 1174
     /**
1087
-	 * Alias of self::get_state().
1088
-	 *
1089
-	 * @since 1.0.19
1090
-	 * @param  string $context View or edit context.
1091
-	 * @return string
1092
-	 */
1093
-	public function get_customer_state( $context = 'view' ) {
1094
-		return $this->get_state( $context );
1175
+     * Alias of self::get_company().
1176
+     *
1177
+     * @since 1.0.19
1178
+     * @param  string $context View or edit context.
1179
+     * @return string
1180
+     */
1181
+    public function get_user_company( $context = 'view' ) {
1182
+        return $this->get_company( $context );
1095 1183
     }
1096 1184
 
1097 1185
     /**
1098
-	 * Get the customer's city.
1099
-	 *
1100
-	 * @since 1.0.19
1101
-	 * @param  string $context View or edit context.
1102
-	 * @return string
1103
-	 */
1104
-	public function get_city( $context = 'view' ) {
1105
-		return $this->get_prop( 'city', $context );
1186
+     * Alias of self::get_company().
1187
+     *
1188
+     * @since 1.0.19
1189
+     * @param  string $context View or edit context.
1190
+     * @return string
1191
+     */
1192
+    public function get_customer_company( $context = 'view' ) {
1193
+        return $this->get_company( $context );
1106 1194
     }
1107 1195
 
1108 1196
     /**
1109
-	 * Alias of self::get_city().
1110
-	 *
1111
-	 * @since 1.0.19
1112
-	 * @param  string $context View or edit context.
1113
-	 * @return string
1114
-	 */
1115
-	public function get_user_city( $context = 'view' ) {
1116
-		return $this->get_city( $context );
1197
+     * Get the customer's company id.
1198
+     *
1199
+     * @since 1.0.19
1200
+     * @param  string $context View or edit context.
1201
+     * @return string
1202
+     */
1203
+    public function get_company_id( $context = 'view' ) {
1204
+        return $this->get_prop( 'company_id', $context );
1117 1205
     }
1118 1206
 
1119 1207
     /**
1120
-	 * Alias of self::get_city().
1121
-	 *
1122
-	 * @since 1.0.19
1123
-	 * @param  string $context View or edit context.
1124
-	 * @return string
1125
-	 */
1126
-	public function get_customer_city( $context = 'view' ) {
1127
-		return $this->get_city( $context );
1208
+     * Get the customer's vat number.
1209
+     *
1210
+     * @since 1.0.19
1211
+     * @param  string $context View or edit context.
1212
+     * @return string
1213
+     */
1214
+    public function get_vat_number( $context = 'view' ) {
1215
+        return $this->get_prop( 'vat_number', $context );
1128 1216
     }
1129 1217
 
1130 1218
     /**
1131
-	 * Get the customer's zip.
1132
-	 *
1133
-	 * @since 1.0.19
1134
-	 * @param  string $context View or edit context.
1135
-	 * @return string
1136
-	 */
1137
-	public function get_zip( $context = 'view' ) {
1138
-		return $this->get_prop( 'zip', $context );
1219
+     * Alias of self::get_vat_number().
1220
+     *
1221
+     * @since 1.0.19
1222
+     * @param  string $context View or edit context.
1223
+     * @return string
1224
+     */
1225
+    public function get_user_vat_number( $context = 'view' ) {
1226
+        return $this->get_vat_number( $context );
1139 1227
     }
1140 1228
 
1141 1229
     /**
1142
-	 * Alias of self::get_zip().
1143
-	 *
1144
-	 * @since 1.0.19
1145
-	 * @param  string $context View or edit context.
1146
-	 * @return string
1147
-	 */
1148
-	public function get_user_zip( $context = 'view' ) {
1149
-		return $this->get_zip( $context );
1230
+     * Alias of self::get_vat_number().
1231
+     *
1232
+     * @since 1.0.19
1233
+     * @param  string $context View or edit context.
1234
+     * @return string
1235
+     */
1236
+    public function get_customer_vat_number( $context = 'view' ) {
1237
+        return $this->get_vat_number( $context );
1150 1238
     }
1151 1239
 
1152 1240
     /**
1153
-	 * Alias of self::get_zip().
1154
-	 *
1155
-	 * @since 1.0.19
1156
-	 * @param  string $context View or edit context.
1157
-	 * @return string
1158
-	 */
1159
-	public function get_customer_zip( $context = 'view' ) {
1160
-		return $this->get_zip( $context );
1241
+     * Get the customer's vat rate.
1242
+     *
1243
+     * @since 1.0.19
1244
+     * @param  string $context View or edit context.
1245
+     * @return string
1246
+     */
1247
+    public function get_vat_rate( $context = 'view' ) {
1248
+        return $this->get_prop( 'vat_rate', $context );
1161 1249
     }
1162 1250
 
1163 1251
     /**
1164
-	 * Get the customer's company.
1165
-	 *
1166
-	 * @since 1.0.19
1167
-	 * @param  string $context View or edit context.
1168
-	 * @return string
1169
-	 */
1170
-	public function get_company( $context = 'view' ) {
1171
-		return $this->get_prop( 'company', $context );
1252
+     * Alias of self::get_vat_rate().
1253
+     *
1254
+     * @since 1.0.19
1255
+     * @param  string $context View or edit context.
1256
+     * @return string
1257
+     */
1258
+    public function get_user_vat_rate( $context = 'view' ) {
1259
+        return $this->get_vat_rate( $context );
1172 1260
     }
1173 1261
 
1174 1262
     /**
1175
-	 * Alias of self::get_company().
1176
-	 *
1177
-	 * @since 1.0.19
1178
-	 * @param  string $context View or edit context.
1179
-	 * @return string
1180
-	 */
1181
-	public function get_user_company( $context = 'view' ) {
1182
-		return $this->get_company( $context );
1263
+     * Alias of self::get_vat_rate().
1264
+     *
1265
+     * @since 1.0.19
1266
+     * @param  string $context View or edit context.
1267
+     * @return string
1268
+     */
1269
+    public function get_customer_vat_rate( $context = 'view' ) {
1270
+        return $this->get_vat_rate( $context );
1183 1271
     }
1184 1272
 
1185 1273
     /**
1186
-	 * Alias of self::get_company().
1187
-	 *
1188
-	 * @since 1.0.19
1189
-	 * @param  string $context View or edit context.
1190
-	 * @return string
1191
-	 */
1192
-	public function get_customer_company( $context = 'view' ) {
1193
-		return $this->get_company( $context );
1274
+     * Get the customer's address.
1275
+     *
1276
+     * @since 1.0.19
1277
+     * @param  string $context View or edit context.
1278
+     * @return string
1279
+     */
1280
+    public function get_address( $context = 'view' ) {
1281
+        return $this->get_prop( 'address', $context );
1194 1282
     }
1195 1283
 
1196
-	/**
1197
-	 * Get the customer's company id.
1198
-	 *
1199
-	 * @since 1.0.19
1200
-	 * @param  string $context View or edit context.
1201
-	 * @return string
1202
-	 */
1203
-	public function get_company_id( $context = 'view' ) {
1204
-		return $this->get_prop( 'company_id', $context );
1284
+    /**
1285
+     * Alias of self::get_address().
1286
+     *
1287
+     * @since 1.0.19
1288
+     * @param  string $context View or edit context.
1289
+     * @return string
1290
+     */
1291
+    public function get_user_address( $context = 'view' ) {
1292
+        return $this->get_address( $context );
1205 1293
     }
1206 1294
 
1207 1295
     /**
1208
-	 * Get the customer's vat number.
1209
-	 *
1210
-	 * @since 1.0.19
1211
-	 * @param  string $context View or edit context.
1212
-	 * @return string
1213
-	 */
1214
-	public function get_vat_number( $context = 'view' ) {
1215
-		return $this->get_prop( 'vat_number', $context );
1296
+     * Alias of self::get_address().
1297
+     *
1298
+     * @since 1.0.19
1299
+     * @param  string $context View or edit context.
1300
+     * @return string
1301
+     */
1302
+    public function get_customer_address( $context = 'view' ) {
1303
+        return $this->get_address( $context );
1216 1304
     }
1217 1305
 
1218 1306
     /**
1219
-	 * Alias of self::get_vat_number().
1220
-	 *
1221
-	 * @since 1.0.19
1222
-	 * @param  string $context View or edit context.
1223
-	 * @return string
1224
-	 */
1225
-	public function get_user_vat_number( $context = 'view' ) {
1226
-		return $this->get_vat_number( $context );
1307
+     * Get whether the customer has viewed the invoice or not.
1308
+     *
1309
+     * @since 1.0.19
1310
+     * @param  string $context View or edit context.
1311
+     * @return bool
1312
+     */
1313
+    public function get_is_viewed( $context = 'view' ) {
1314
+        return (bool) $this->get_prop( 'is_viewed', $context );
1227 1315
     }
1228 1316
 
1229 1317
     /**
1230
-	 * Alias of self::get_vat_number().
1231
-	 *
1232
-	 * @since 1.0.19
1233
-	 * @param  string $context View or edit context.
1234
-	 * @return string
1235
-	 */
1236
-	public function get_customer_vat_number( $context = 'view' ) {
1237
-		return $this->get_vat_number( $context );
1318
+     * Get other recipients for invoice communications.
1319
+     *
1320
+     * @since 1.0.19
1321
+     * @param  string $context View or edit context.
1322
+     * @return bool
1323
+     */
1324
+    public function get_email_cc( $context = 'view' ) {
1325
+        return $this->get_prop( 'email_cc', $context );
1238 1326
     }
1239 1327
 
1240
-    /**
1241
-	 * Get the customer's vat rate.
1242
-	 *
1243
-	 * @since 1.0.19
1244
-	 * @param  string $context View or edit context.
1245
-	 * @return string
1246
-	 */
1247
-	public function get_vat_rate( $context = 'view' ) {
1248
-		return $this->get_prop( 'vat_rate', $context );
1249
-    }
1250
-
1251
-    /**
1252
-	 * Alias of self::get_vat_rate().
1253
-	 *
1254
-	 * @since 1.0.19
1255
-	 * @param  string $context View or edit context.
1256
-	 * @return string
1257
-	 */
1258
-	public function get_user_vat_rate( $context = 'view' ) {
1259
-		return $this->get_vat_rate( $context );
1260
-    }
1261
-
1262
-    /**
1263
-	 * Alias of self::get_vat_rate().
1264
-	 *
1265
-	 * @since 1.0.19
1266
-	 * @param  string $context View or edit context.
1267
-	 * @return string
1268
-	 */
1269
-	public function get_customer_vat_rate( $context = 'view' ) {
1270
-		return $this->get_vat_rate( $context );
1271
-    }
1272
-
1273
-    /**
1274
-	 * Get the customer's address.
1275
-	 *
1276
-	 * @since 1.0.19
1277
-	 * @param  string $context View or edit context.
1278
-	 * @return string
1279
-	 */
1280
-	public function get_address( $context = 'view' ) {
1281
-		return $this->get_prop( 'address', $context );
1282
-    }
1283
-
1284
-    /**
1285
-	 * Alias of self::get_address().
1286
-	 *
1287
-	 * @since 1.0.19
1288
-	 * @param  string $context View or edit context.
1289
-	 * @return string
1290
-	 */
1291
-	public function get_user_address( $context = 'view' ) {
1292
-		return $this->get_address( $context );
1293
-    }
1294
-
1295
-    /**
1296
-	 * Alias of self::get_address().
1297
-	 *
1298
-	 * @since 1.0.19
1299
-	 * @param  string $context View or edit context.
1300
-	 * @return string
1301
-	 */
1302
-	public function get_customer_address( $context = 'view' ) {
1303
-		return $this->get_address( $context );
1304
-    }
1305
-
1306
-    /**
1307
-	 * Get whether the customer has viewed the invoice or not.
1308
-	 *
1309
-	 * @since 1.0.19
1310
-	 * @param  string $context View or edit context.
1311
-	 * @return bool
1312
-	 */
1313
-	public function get_is_viewed( $context = 'view' ) {
1314
-		return (bool) $this->get_prop( 'is_viewed', $context );
1315
-	}
1316
-
1317
-	/**
1318
-	 * Get other recipients for invoice communications.
1319
-	 *
1320
-	 * @since 1.0.19
1321
-	 * @param  string $context View or edit context.
1322
-	 * @return bool
1323
-	 */
1324
-	public function get_email_cc( $context = 'view' ) {
1325
-		return $this->get_prop( 'email_cc', $context );
1326
-	}
1327
-
1328
-	/**
1329
-	 * Get invoice template.
1330
-	 *
1331
-	 * @since 1.0.19
1332
-	 * @param  string $context View or edit context.
1333
-	 * @return bool
1334
-	 */
1335
-	public function get_template( $context = 'view' ) {
1336
-		return $this->get_prop( 'template', $context );
1337
-	}
1338
-
1339
-	/**
1340
-	 * Get invoice source.
1341
-	 *
1342
-	 * @since 1.0.19
1343
-	 * @param  string $context View or edit context.
1344
-	 * @return bool
1345
-	 */
1346
-	public function get_created_via( $context = 'view' ) {
1347
-		return $this->get_prop( 'created_via', $context );
1348
-	}
1349
-
1350
-	/**
1351
-	 * Get whether the customer has confirmed their address.
1352
-	 *
1353
-	 * @since 1.0.19
1354
-	 * @param  string $context View or edit context.
1355
-	 * @return bool
1356
-	 */
1357
-	public function get_address_confirmed( $context = 'view' ) {
1358
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1359
-    }
1360
-
1361
-    /**
1362
-	 * Alias of self::get_address_confirmed().
1363
-	 *
1364
-	 * @since 1.0.19
1365
-	 * @param  string $context View or edit context.
1366
-	 * @return bool
1367
-	 */
1368
-	public function get_user_address_confirmed( $context = 'view' ) {
1369
-		return $this->get_address_confirmed( $context );
1370
-    }
1371
-
1372
-    /**
1373
-	 * Alias of self::get_address().
1374
-	 *
1375
-	 * @since 1.0.19
1376
-	 * @param  string $context View or edit context.
1377
-	 * @return bool
1378
-	 */
1379
-	public function get_customer_address_confirmed( $context = 'view' ) {
1380
-		return $this->get_address_confirmed( $context );
1381
-    }
1382
-
1383
-	/**
1384
-	 * Get the shipping address.
1385
-	 *
1386
-	 * @since 1.0.19
1387
-	 * @return array|false
1388
-	 */
1389
-	public function get_shipping_address() {
1390
-
1391
-		$shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1392
-		return is_array( $shipping_address ) ? $shipping_address : false;
1393
-    }
1394
-
1395
-	/**
1396
-	 * Check if the invoice has a shipping address.
1397
-	 */
1398
-	public function has_shipping_address() {
1399
-		return false !== $this->get_shipping_address();
1400
-    }
1401
-
1402
-	/**
1403
-	 * Get the shipping amount.
1404
-	 *
1405
-	 * @since 1.0.19
1406
-	 * @param  string $context View or edit context.
1407
-	 * @return float
1408
-	 */
1409
-	public function get_shipping( $context = 'view' ) {
1410
-
1411
-		if ( $context = 'view' ) {
1412
-			return floatval( $this->get_prop( 'shipping', $context ) );
1413
-		}
1414
-
1415
-		return $this->get_prop( 'shipping', $context );
1416
-    }
1417
-
1418
-	public function has_shipping() {
1419
-		return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && null !== $this->get_prop( 'shipping', 'edit' );
1420
-    }
1421
-
1422
-    /**
1423
-	 * Get the invoice subtotal.
1424
-	 *
1425
-	 * @since 1.0.19
1426
-	 * @param  string $context View or edit context.
1427
-	 * @return float
1428
-	 */
1429
-	public function get_subtotal( $context = 'view' ) {
1328
+    /**
1329
+     * Get invoice template.
1330
+     *
1331
+     * @since 1.0.19
1332
+     * @param  string $context View or edit context.
1333
+     * @return bool
1334
+     */
1335
+    public function get_template( $context = 'view' ) {
1336
+        return $this->get_prop( 'template', $context );
1337
+    }
1338
+
1339
+    /**
1340
+     * Get invoice source.
1341
+     *
1342
+     * @since 1.0.19
1343
+     * @param  string $context View or edit context.
1344
+     * @return bool
1345
+     */
1346
+    public function get_created_via( $context = 'view' ) {
1347
+        return $this->get_prop( 'created_via', $context );
1348
+    }
1349
+
1350
+    /**
1351
+     * Get whether the customer has confirmed their address.
1352
+     *
1353
+     * @since 1.0.19
1354
+     * @param  string $context View or edit context.
1355
+     * @return bool
1356
+     */
1357
+    public function get_address_confirmed( $context = 'view' ) {
1358
+        return (bool) $this->get_prop( 'address_confirmed', $context );
1359
+    }
1360
+
1361
+    /**
1362
+     * Alias of self::get_address_confirmed().
1363
+     *
1364
+     * @since 1.0.19
1365
+     * @param  string $context View or edit context.
1366
+     * @return bool
1367
+     */
1368
+    public function get_user_address_confirmed( $context = 'view' ) {
1369
+        return $this->get_address_confirmed( $context );
1370
+    }
1371
+
1372
+    /**
1373
+     * Alias of self::get_address().
1374
+     *
1375
+     * @since 1.0.19
1376
+     * @param  string $context View or edit context.
1377
+     * @return bool
1378
+     */
1379
+    public function get_customer_address_confirmed( $context = 'view' ) {
1380
+        return $this->get_address_confirmed( $context );
1381
+    }
1382
+
1383
+    /**
1384
+     * Get the shipping address.
1385
+     *
1386
+     * @since 1.0.19
1387
+     * @return array|false
1388
+     */
1389
+    public function get_shipping_address() {
1390
+
1391
+        $shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1392
+        return is_array( $shipping_address ) ? $shipping_address : false;
1393
+    }
1394
+
1395
+    /**
1396
+     * Check if the invoice has a shipping address.
1397
+     */
1398
+    public function has_shipping_address() {
1399
+        return false !== $this->get_shipping_address();
1400
+    }
1401
+
1402
+    /**
1403
+     * Get the shipping amount.
1404
+     *
1405
+     * @since 1.0.19
1406
+     * @param  string $context View or edit context.
1407
+     * @return float
1408
+     */
1409
+    public function get_shipping( $context = 'view' ) {
1410
+
1411
+        if ( $context = 'view' ) {
1412
+            return floatval( $this->get_prop( 'shipping', $context ) );
1413
+        }
1414
+
1415
+        return $this->get_prop( 'shipping', $context );
1416
+    }
1417
+
1418
+    public function has_shipping() {
1419
+        return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && null !== $this->get_prop( 'shipping', 'edit' );
1420
+    }
1421
+
1422
+    /**
1423
+     * Get the invoice subtotal.
1424
+     *
1425
+     * @since 1.0.19
1426
+     * @param  string $context View or edit context.
1427
+     * @return float
1428
+     */
1429
+    public function get_subtotal( $context = 'view' ) {
1430 1430
         $subtotal = (float) $this->get_prop( 'subtotal', $context );
1431 1431
 
1432 1432
         // Backwards compatibility.
@@ -1438,198 +1438,198 @@  discard block
 block discarded – undo
1438 1438
     }
1439 1439
 
1440 1440
     /**
1441
-	 * Get the invoice discount total.
1442
-	 *
1443
-	 * @since 1.0.19
1444
-	 * @param  string $context View or edit context.
1445
-	 * @return float
1446
-	 */
1447
-	public function get_total_discount( $context = 'view' ) {
1448
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1441
+     * Get the invoice discount total.
1442
+     *
1443
+     * @since 1.0.19
1444
+     * @param  string $context View or edit context.
1445
+     * @return float
1446
+     */
1447
+    public function get_total_discount( $context = 'view' ) {
1448
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1449 1449
     }
1450 1450
 
1451 1451
     /**
1452
-	 * Get the invoice tax total.
1453
-	 *
1454
-	 * @since 1.0.19
1455
-	 * @param  string $context View or edit context.
1456
-	 * @return float
1457
-	 */
1458
-	public function get_total_tax( $context = 'view' ) {
1459
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1460
-	}
1452
+     * Get the invoice tax total.
1453
+     *
1454
+     * @since 1.0.19
1455
+     * @param  string $context View or edit context.
1456
+     * @return float
1457
+     */
1458
+    public function get_total_tax( $context = 'view' ) {
1459
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1460
+    }
1461 1461
 
1462
-	/**
1463
-	 * @deprecated
1464
-	 */
1465
-	public function get_final_tax( $currency = false ) {
1466
-		$tax = $this->get_total_tax();
1462
+    /**
1463
+     * @deprecated
1464
+     */
1465
+    public function get_final_tax( $currency = false ) {
1466
+        $tax = $this->get_total_tax();
1467 1467
 
1468 1468
         if ( $currency ) {
1469
-			return wpinv_price( $tax, $this->get_currency() );
1469
+            return wpinv_price( $tax, $this->get_currency() );
1470 1470
         }
1471 1471
 
1472 1472
         return $tax;
1473 1473
     }
1474 1474
 
1475 1475
     /**
1476
-	 * Get the invoice fees total.
1477
-	 *
1478
-	 * @since 1.0.19
1479
-	 * @param  string $context View or edit context.
1480
-	 * @return float
1481
-	 */
1482
-	public function get_total_fees( $context = 'view' ) {
1483
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1476
+     * Get the invoice fees total.
1477
+     *
1478
+     * @since 1.0.19
1479
+     * @param  string $context View or edit context.
1480
+     * @return float
1481
+     */
1482
+    public function get_total_fees( $context = 'view' ) {
1483
+        return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1484 1484
     }
1485 1485
 
1486 1486
     /**
1487
-	 * Alias for self::get_total_fees().
1488
-	 *
1489
-	 * @since 1.0.19
1490
-	 * @param  string $context View or edit context.
1491
-	 * @return float
1492
-	 */
1493
-	public function get_fees_total( $context = 'view' ) {
1494
-		return $this->get_total_fees( $context );
1487
+     * Alias for self::get_total_fees().
1488
+     *
1489
+     * @since 1.0.19
1490
+     * @param  string $context View or edit context.
1491
+     * @return float
1492
+     */
1493
+    public function get_fees_total( $context = 'view' ) {
1494
+        return $this->get_total_fees( $context );
1495 1495
     }
1496 1496
 
1497 1497
     /**
1498
-	 * Get the invoice total.
1499
-	 *
1500
-	 * @since 1.0.19
1498
+     * Get the invoice total.
1499
+     *
1500
+     * @since 1.0.19
1501 1501
      * @return float
1502
-	 */
1503
-	public function get_total( $context = 'view' ) {
1504
-		$total = $this->get_prop( 'total', $context );
1505
-
1506
-		if ( $this->has_shipping() && $context == 'view' ) {
1507
-			$total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1508
-		}
1509
-
1510
-		return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1511
-	}
1512
-
1513
-	/**
1514
-	 * Retrieves the non-recurring total of items.
1515
-	 *
1516
-	 * @since 2.3.0
1517
-	 * @return float
1518
-	 */
1519
-	public function get_non_recurring_total() {
1520
-
1521
-		$subtotal = 0;
1522
-		foreach ( $this->get_items() as $item ) {
1523
-			if ( ! $item->is_recurring() ) {
1524
-				$subtotal += $item->get_sub_total();
1525
-			}
1526
-		}
1527
-
1528
-		foreach ( $this->get_fees() as $fee ) {
1529
-			if ( empty( $fee['recurring_fee'] ) ) {
1530
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1531
-			}
1532
-		}
1533
-
1534
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1502
+     */
1503
+    public function get_total( $context = 'view' ) {
1504
+        $total = $this->get_prop( 'total', $context );
1505
+
1506
+        if ( $this->has_shipping() && $context == 'view' ) {
1507
+            $total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1508
+        }
1509
+
1510
+        return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1511
+    }
1512
+
1513
+    /**
1514
+     * Retrieves the non-recurring total of items.
1515
+     *
1516
+     * @since 2.3.0
1517
+     * @return float
1518
+     */
1519
+    public function get_non_recurring_total() {
1520
+
1521
+        $subtotal = 0;
1522
+        foreach ( $this->get_items() as $item ) {
1523
+            if ( ! $item->is_recurring() ) {
1524
+                $subtotal += $item->get_sub_total();
1525
+            }
1526
+        }
1527
+
1528
+        foreach ( $this->get_fees() as $fee ) {
1529
+            if ( empty( $fee['recurring_fee'] ) ) {
1530
+                $subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1531
+            }
1532
+        }
1533
+
1534
+        $subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1535 1535
         return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1536 1536
 
1537 1537
     }
1538 1538
 
1539
-	/**
1540
-	 * Get the invoice totals.
1541
-	 *
1542
-	 * @since 1.0.19
1539
+    /**
1540
+     * Get the invoice totals.
1541
+     *
1542
+     * @since 1.0.19
1543 1543
      * @return array
1544
-	 */
1545
-	public function get_totals() {
1546
-		return $this->totals;
1544
+     */
1545
+    public function get_totals() {
1546
+        return $this->totals;
1547 1547
     }
1548 1548
 
1549 1549
     /**
1550
-	 * Get the initial invoice total.
1551
-	 *
1552
-	 * @since 1.0.19
1550
+     * Get the initial invoice total.
1551
+     *
1552
+     * @since 1.0.19
1553 1553
      * @param  string $context View or edit context.
1554 1554
      * @return float
1555
-	 */
1555
+     */
1556 1556
     public function get_initial_total() {
1557 1557
 
1558
-		if ( empty( $this->totals ) ) {
1559
-			$this->recalculate_total();
1560
-		}
1558
+        if ( empty( $this->totals ) ) {
1559
+            $this->recalculate_total();
1560
+        }
1561 1561
 
1562
-		$tax      = $this->totals['tax']['initial'];
1563
-		$fee      = $this->totals['fee']['initial'];
1564
-		$discount = $this->totals['discount']['initial'];
1565
-		$subtotal = $this->totals['subtotal']['initial'];
1566
-		$total    = $tax + $fee - $discount + $subtotal;
1562
+        $tax      = $this->totals['tax']['initial'];
1563
+        $fee      = $this->totals['fee']['initial'];
1564
+        $discount = $this->totals['discount']['initial'];
1565
+        $subtotal = $this->totals['subtotal']['initial'];
1566
+        $total    = $tax + $fee - $discount + $subtotal;
1567 1567
 
1568
-		if ( 0 > $total ) {
1569
-			$total = 0;
1570
-		}
1568
+        if ( 0 > $total ) {
1569
+            $total = 0;
1570
+        }
1571 1571
 
1572
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1572
+        $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1573 1573
         return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1574
-	}
1574
+    }
1575 1575
 
1576
-	/**
1577
-	 * Get the recurring invoice total.
1578
-	 *
1579
-	 * @since 1.0.19
1576
+    /**
1577
+     * Get the recurring invoice total.
1578
+     *
1579
+     * @since 1.0.19
1580 1580
      * @param  string $context View or edit context.
1581 1581
      * @return float
1582
-	 */
1582
+     */
1583 1583
     public function get_recurring_total() {
1584 1584
 
1585
-		if ( empty( $this->totals ) ) {
1586
-			$this->recalculate_total();
1587
-		}
1585
+        if ( empty( $this->totals ) ) {
1586
+            $this->recalculate_total();
1587
+        }
1588 1588
 
1589
-		$tax      = $this->totals['tax']['recurring'];
1590
-		$fee      = $this->totals['fee']['recurring'];
1591
-		$discount = $this->totals['discount']['recurring'];
1592
-		$subtotal = $this->totals['subtotal']['recurring'];
1593
-		$total    = $tax + $fee - $discount + $subtotal;
1589
+        $tax      = $this->totals['tax']['recurring'];
1590
+        $fee      = $this->totals['fee']['recurring'];
1591
+        $discount = $this->totals['discount']['recurring'];
1592
+        $subtotal = $this->totals['subtotal']['recurring'];
1593
+        $total    = $tax + $fee - $discount + $subtotal;
1594 1594
 
1595
-		if ( 0 > $total ) {
1596
-			$total = 0;
1597
-		}
1595
+        if ( 0 > $total ) {
1596
+            $total = 0;
1597
+        }
1598 1598
 
1599
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1599
+        $total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1600 1600
         return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1601
-	}
1601
+    }
1602 1602
 
1603
-	/**
1604
-	 * Returns recurring payment details.
1605
-	 *
1606
-	 * @since 1.0.19
1603
+    /**
1604
+     * Returns recurring payment details.
1605
+     *
1606
+     * @since 1.0.19
1607 1607
      * @param  string $field Optionally provide a field to return.
1608
-	 * @param string $currency Whether to include the currency.
1608
+     * @param string $currency Whether to include the currency.
1609 1609
      * @return float|string
1610
-	 */
1610
+     */
1611 1611
     public function get_recurring_details( $field = '', $currency = false ) {
1612 1612
 
1613
-		// Maybe recalculate totals.
1614
-		if ( empty( $this->totals ) ) {
1615
-			$this->recalculate_total();
1616
-		}
1613
+        // Maybe recalculate totals.
1614
+        if ( empty( $this->totals ) ) {
1615
+            $this->recalculate_total();
1616
+        }
1617 1617
 
1618
-		// Prepare recurring totals.
1618
+        // Prepare recurring totals.
1619 1619
         $data = apply_filters(
1620
-			'wpinv_get_invoice_recurring_details',
1621
-			array(
1622
-				'cart_details' => $this->get_cart_details(),
1623
-				'subtotal'     => $this->totals['subtotal']['recurring'],
1624
-				'discount'     => $this->totals['discount']['recurring'],
1625
-				'tax'          => $this->totals['tax']['recurring'],
1626
-				'fee'          => $this->totals['fee']['recurring'],
1627
-				'total'        => $this->get_recurring_total(),
1628
-			),
1629
-			$this,
1630
-			$field,
1631
-			$currency
1632
-		);
1620
+            'wpinv_get_invoice_recurring_details',
1621
+            array(
1622
+                'cart_details' => $this->get_cart_details(),
1623
+                'subtotal'     => $this->totals['subtotal']['recurring'],
1624
+                'discount'     => $this->totals['discount']['recurring'],
1625
+                'tax'          => $this->totals['tax']['recurring'],
1626
+                'fee'          => $this->totals['fee']['recurring'],
1627
+                'total'        => $this->get_recurring_total(),
1628
+            ),
1629
+            $this,
1630
+            $field,
1631
+            $currency
1632
+        );
1633 1633
 
1634 1634
         if ( isset( $data[ $field ] ) ) {
1635 1635
             return ( $currency ? wpinv_price( $data[ $field ], $this->get_currency() ) : $data[ $field ] );
@@ -1639,166 +1639,166 @@  discard block
 block discarded – undo
1639 1639
     }
1640 1640
 
1641 1641
     /**
1642
-	 * Get the invoice fees.
1643
-	 *
1644
-	 * @since 1.0.19
1645
-	 * @param  string $context View or edit context.
1646
-	 * @return array
1647
-	 */
1648
-	public function get_fees( $context = 'view' ) {
1649
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1642
+     * Get the invoice fees.
1643
+     *
1644
+     * @since 1.0.19
1645
+     * @param  string $context View or edit context.
1646
+     * @return array
1647
+     */
1648
+    public function get_fees( $context = 'view' ) {
1649
+        return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1650 1650
     }
1651 1651
 
1652 1652
     /**
1653
-	 * Get the invoice discounts.
1654
-	 *
1655
-	 * @since 1.0.19
1656
-	 * @param  string $context View or edit context.
1657
-	 * @return array
1658
-	 */
1659
-	public function get_discounts( $context = 'view' ) {
1660
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1653
+     * Get the invoice discounts.
1654
+     *
1655
+     * @since 1.0.19
1656
+     * @param  string $context View or edit context.
1657
+     * @return array
1658
+     */
1659
+    public function get_discounts( $context = 'view' ) {
1660
+        return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1661 1661
     }
1662 1662
 
1663 1663
     /**
1664
-	 * Get the invoice taxes.
1665
-	 *
1666
-	 * @since 1.0.19
1667
-	 * @param  string $context View or edit context.
1668
-	 * @return array
1669
-	 */
1670
-	public function get_taxes( $context = 'view' ) {
1671
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1664
+     * Get the invoice taxes.
1665
+     *
1666
+     * @since 1.0.19
1667
+     * @param  string $context View or edit context.
1668
+     * @return array
1669
+     */
1670
+    public function get_taxes( $context = 'view' ) {
1671
+        return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1672 1672
     }
1673 1673
 
1674 1674
     /**
1675
-	 * Get the invoice items.
1676
-	 *
1677
-	 * @since 1.0.19
1678
-	 * @param  string $context View or edit context.
1679
-	 * @return GetPaid_Form_Item[]
1680
-	 */
1681
-	public function get_items( $context = 'view' ) {
1675
+     * Get the invoice items.
1676
+     *
1677
+     * @since 1.0.19
1678
+     * @param  string $context View or edit context.
1679
+     * @return GetPaid_Form_Item[]
1680
+     */
1681
+    public function get_items( $context = 'view' ) {
1682 1682
         return $this->get_prop( 'items', $context );
1683
-	}
1683
+    }
1684 1684
 
1685
-	/**
1686
-	 * Get the invoice item ids.
1687
-	 *
1688
-	 * @since 1.0.19
1689
-	 * @return string
1690
-	 */
1691
-	public function get_item_ids() {
1692
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1685
+    /**
1686
+     * Get the invoice item ids.
1687
+     *
1688
+     * @since 1.0.19
1689
+     * @return string
1690
+     */
1691
+    public function get_item_ids() {
1692
+        return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1693 1693
     }
1694 1694
 
1695 1695
     /**
1696
-	 * Get the invoice's payment form.
1697
-	 *
1698
-	 * @since 1.0.19
1699
-	 * @param  string $context View or edit context.
1700
-	 * @return int
1701
-	 */
1702
-	public function get_payment_form( $context = 'view' ) {
1703
-		return intval( $this->get_prop( 'payment_form', $context ) );
1696
+     * Get the invoice's payment form.
1697
+     *
1698
+     * @since 1.0.19
1699
+     * @param  string $context View or edit context.
1700
+     * @return int
1701
+     */
1702
+    public function get_payment_form( $context = 'view' ) {
1703
+        return intval( $this->get_prop( 'payment_form', $context ) );
1704 1704
     }
1705 1705
 
1706 1706
     /**
1707
-	 * Get the invoice's submission id.
1708
-	 *
1709
-	 * @since 1.0.19
1710
-	 * @param  string $context View or edit context.
1711
-	 * @return string
1712
-	 */
1713
-	public function get_submission_id( $context = 'view' ) {
1714
-		return $this->get_prop( 'submission_id', $context );
1707
+     * Get the invoice's submission id.
1708
+     *
1709
+     * @since 1.0.19
1710
+     * @param  string $context View or edit context.
1711
+     * @return string
1712
+     */
1713
+    public function get_submission_id( $context = 'view' ) {
1714
+        return $this->get_prop( 'submission_id', $context );
1715 1715
     }
1716 1716
 
1717 1717
     /**
1718
-	 * Get the invoice's discount code.
1719
-	 *
1720
-	 * @since 1.0.19
1721
-	 * @param  string $context View or edit context.
1722
-	 * @return string
1723
-	 */
1724
-	public function get_discount_code( $context = 'view' ) {
1725
-		return $this->get_prop( 'discount_code', $context );
1718
+     * Get the invoice's discount code.
1719
+     *
1720
+     * @since 1.0.19
1721
+     * @param  string $context View or edit context.
1722
+     * @return string
1723
+     */
1724
+    public function get_discount_code( $context = 'view' ) {
1725
+        return $this->get_prop( 'discount_code', $context );
1726 1726
     }
1727 1727
 
1728 1728
     /**
1729
-	 * Get the invoice's gateway.
1730
-	 *
1731
-	 * @since 1.0.19
1732
-	 * @param  string $context View or edit context.
1733
-	 * @return string
1734
-	 */
1735
-	public function get_gateway( $context = 'view' ) {
1736
-		return $this->get_prop( 'gateway', $context );
1729
+     * Get the invoice's gateway.
1730
+     *
1731
+     * @since 1.0.19
1732
+     * @param  string $context View or edit context.
1733
+     * @return string
1734
+     */
1735
+    public function get_gateway( $context = 'view' ) {
1736
+        return $this->get_prop( 'gateway', $context );
1737 1737
     }
1738 1738
 
1739 1739
     /**
1740
-	 * Get the invoice's gateway display title.
1741
-	 *
1742
-	 * @since 1.0.19
1743
-	 * @return string
1744
-	 */
1740
+     * Get the invoice's gateway display title.
1741
+     *
1742
+     * @since 1.0.19
1743
+     * @return string
1744
+     */
1745 1745
     public function get_gateway_title() {
1746 1746
         $title = wpinv_get_gateway_checkout_label( $this->get_gateway() );
1747 1747
         return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1748 1748
     }
1749 1749
 
1750 1750
     /**
1751
-	 * Get the invoice's transaction id.
1752
-	 *
1753
-	 * @since 1.0.19
1754
-	 * @param  string $context View or edit context.
1755
-	 * @return string
1756
-	 */
1757
-	public function get_transaction_id( $context = 'view' ) {
1758
-		return $this->get_prop( 'transaction_id', $context );
1751
+     * Get the invoice's transaction id.
1752
+     *
1753
+     * @since 1.0.19
1754
+     * @param  string $context View or edit context.
1755
+     * @return string
1756
+     */
1757
+    public function get_transaction_id( $context = 'view' ) {
1758
+        return $this->get_prop( 'transaction_id', $context );
1759 1759
     }
1760 1760
 
1761 1761
     /**
1762
-	 * Get the invoice's currency.
1763
-	 *
1764
-	 * @since 1.0.19
1765
-	 * @param  string $context View or edit context.
1766
-	 * @return string
1767
-	 */
1768
-	public function get_currency( $context = 'view' ) {
1762
+     * Get the invoice's currency.
1763
+     *
1764
+     * @since 1.0.19
1765
+     * @param  string $context View or edit context.
1766
+     * @return string
1767
+     */
1768
+    public function get_currency( $context = 'view' ) {
1769 1769
         $currency = $this->get_prop( 'currency', $context );
1770 1770
         return empty( $currency ) ? wpinv_get_currency() : $currency;
1771 1771
     }
1772 1772
 
1773 1773
     /**
1774
-	 * Checks if we are charging taxes for this invoice.
1775
-	 *
1776
-	 * @since 1.0.19
1777
-	 * @param  string $context View or edit context.
1778
-	 * @return bool
1779
-	 */
1780
-	public function get_disable_taxes( $context = 'view' ) {
1774
+     * Checks if we are charging taxes for this invoice.
1775
+     *
1776
+     * @since 1.0.19
1777
+     * @param  string $context View or edit context.
1778
+     * @return bool
1779
+     */
1780
+    public function get_disable_taxes( $context = 'view' ) {
1781 1781
         return (bool) $this->get_prop( 'disable_taxes', $context );
1782 1782
     }
1783 1783
 
1784 1784
     /**
1785
-	 * Retrieves the subscription id for an invoice.
1786
-	 *
1787
-	 * @since 1.0.19
1788
-	 * @param  string $context View or edit context.
1789
-	 * @return int
1790
-	 */
1785
+     * Retrieves the subscription id for an invoice.
1786
+     *
1787
+     * @since 1.0.19
1788
+     * @param  string $context View or edit context.
1789
+     * @return int
1790
+     */
1791 1791
     public function get_subscription_id( $context = 'view' ) {
1792
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1793
-	}
1794
-
1795
-	/**
1796
-	 * Retrieves the remote subscription id for an invoice.
1797
-	 *
1798
-	 * @since 1.0.19
1799
-	 * @param  string $context View or edit context.
1800
-	 * @return int
1801
-	 */
1792
+        return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1793
+    }
1794
+
1795
+    /**
1796
+     * Retrieves the remote subscription id for an invoice.
1797
+     *
1798
+     * @since 1.0.19
1799
+     * @param  string $context View or edit context.
1800
+     * @return int
1801
+     */
1802 1802
     public function get_remote_subscription_id( $context = 'view' ) {
1803 1803
         $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1804 1804
 
@@ -1811,12 +1811,12 @@  discard block
 block discarded – undo
1811 1811
     }
1812 1812
 
1813 1813
     /**
1814
-	 * Retrieves the payment meta for an invoice.
1815
-	 *
1816
-	 * @since 1.0.19
1817
-	 * @param  string $context View or edit context.
1818
-	 * @return array
1819
-	 */
1814
+     * Retrieves the payment meta for an invoice.
1815
+     *
1816
+     * @since 1.0.19
1817
+     * @param  string $context View or edit context.
1818
+     * @return array
1819
+     */
1820 1820
     public function get_payment_meta( $context = 'view' ) {
1821 1821
 
1822 1822
         return array(
@@ -1836,31 +1836,31 @@  discard block
 block discarded – undo
1836 1836
     }
1837 1837
 
1838 1838
     /**
1839
-	 * Retrieves the cart details for an invoice.
1840
-	 *
1841
-	 * @since 1.0.19
1842
-	 * @return array
1843
-	 */
1839
+     * Retrieves the cart details for an invoice.
1840
+     *
1841
+     * @since 1.0.19
1842
+     * @return array
1843
+     */
1844 1844
     public function get_cart_details() {
1845 1845
         $items        = $this->get_items();
1846 1846
         $cart_details = array();
1847 1847
 
1848 1848
         foreach ( $items as $item ) {
1849
-			$item->invoice_id = $this->get_id();
1849
+            $item->invoice_id = $this->get_id();
1850 1850
             $cart_details[]   = $item->prepare_data_for_saving();
1851 1851
         }
1852 1852
 
1853 1853
         return $cart_details;
1854
-	}
1854
+    }
1855 1855
 
1856
-	/**
1857
-	 * Retrieves the recurring item.
1858
-	 *
1859
-	 * @return null|GetPaid_Form_Item|int
1860
-	 */
1861
-	public function get_recurring( $object = false ) {
1856
+    /**
1857
+     * Retrieves the recurring item.
1858
+     *
1859
+     * @return null|GetPaid_Form_Item|int
1860
+     */
1861
+    public function get_recurring( $object = false ) {
1862 1862
 
1863
-		// Are we returning an object?
1863
+        // Are we returning an object?
1864 1864
         if ( $object ) {
1865 1865
             return $this->get_item( $this->recurring_item );
1866 1866
         }
@@ -1868,124 +1868,124 @@  discard block
 block discarded – undo
1868 1868
         return $this->recurring_item;
1869 1869
     }
1870 1870
 
1871
-	/**
1872
-	 * Retrieves the subscription name.
1873
-	 *
1874
-	 * @since 1.0.19
1875
-	 * @return string
1876
-	 */
1877
-	public function get_subscription_name() {
1871
+    /**
1872
+     * Retrieves the subscription name.
1873
+     *
1874
+     * @since 1.0.19
1875
+     * @return string
1876
+     */
1877
+    public function get_subscription_name() {
1878 1878
 
1879
-		// Retrieve the recurring name
1879
+        // Retrieve the recurring name
1880 1880
         $item = $this->get_recurring( true );
1881 1881
 
1882
-		// Abort if it does not exist.
1882
+        // Abort if it does not exist.
1883 1883
         if ( empty( $item ) ) {
1884 1884
             return '';
1885 1885
         }
1886 1886
 
1887
-		// Return the item name.
1887
+        // Return the item name.
1888 1888
         return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1889
-	}
1890
-
1891
-	/**
1892
-	 * Retrieves the view url.
1893
-	 *
1894
-	 * @since 1.0.19
1895
-	 * @return string
1896
-	 */
1897
-	public function get_view_url() {
1889
+    }
1890
+
1891
+    /**
1892
+     * Retrieves the view url.
1893
+     *
1894
+     * @since 1.0.19
1895
+     * @return string
1896
+     */
1897
+    public function get_view_url() {
1898 1898
         $invoice_url = get_permalink( $this->get_id() );
1899
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1899
+        $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1900 1900
         return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1901
-	}
1901
+    }
1902 1902
 
1903
-	/**
1904
-	 * Retrieves the payment url.
1905
-	 *
1906
-	 * @since 1.0.19
1907
-	 * @return string
1908
-	 */
1909
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1903
+    /**
1904
+     * Retrieves the payment url.
1905
+     *
1906
+     * @since 1.0.19
1907
+     * @return string
1908
+     */
1909
+    public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1910 1910
 
1911
-		// Retrieve the checkout url.
1911
+        // Retrieve the checkout url.
1912 1912
         $pay_url = wpinv_get_checkout_uri();
1913 1913
 
1914
-		// Maybe force ssl.
1914
+        // Maybe force ssl.
1915 1915
         if ( is_ssl() ) {
1916 1916
             $pay_url = str_replace( 'http:', 'https:', $pay_url );
1917 1917
         }
1918 1918
 
1919
-		// Add the invoice key.
1920
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1919
+        // Add the invoice key.
1920
+        $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1921 1921
 
1922
-		// (Maybe?) add a secret
1922
+        // (Maybe?) add a secret
1923 1923
         if ( $secret ) {
1924 1924
             $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1925 1925
         }
1926 1926
 
1927 1927
         return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1928
-	}
1928
+    }
1929 1929
 
1930
-	/**
1931
-	 * Retrieves the receipt url.
1932
-	 *
1933
-	 * @since 1.0.19
1934
-	 * @return string
1935
-	 */
1936
-	public function get_receipt_url() {
1930
+    /**
1931
+     * Retrieves the receipt url.
1932
+     *
1933
+     * @since 1.0.19
1934
+     * @return string
1935
+     */
1936
+    public function get_receipt_url() {
1937 1937
 
1938
-		// Retrieve the checkout url.
1938
+        // Retrieve the checkout url.
1939 1939
         $receipt_url = wpinv_get_success_page_uri();
1940 1940
 
1941
-		// Maybe force ssl.
1941
+        // Maybe force ssl.
1942 1942
         if ( is_ssl() ) {
1943 1943
             $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1944 1944
         }
1945 1945
 
1946
-		// Add the invoice key.
1947
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1946
+        // Add the invoice key.
1947
+        $receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1948 1948
 
1949 1949
         return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1950
-	}
1951
-
1952
-	/**
1953
-	 * Retrieves the remote transaction url.
1954
-	 *
1955
-	 * @since 1.6.0
1956
-	 * @return string
1957
-	 */
1958
-	public function get_transaction_url() {
1959
-		return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1960
-	}
1961
-
1962
-	/**
1963
-	 * Retrieves the default status.
1964
-	 *
1965
-	 * @since 1.0.19
1966
-	 * @return string
1967
-	 */
1968
-	public function get_default_status() {
1969
-
1970
-		$type   = $this->get_type();
1971
-		$status = "wpi-$type-pending";
1972
-		return str_replace( '-invoice', '', $status );
1973
-
1974
-	}
1975
-
1976
-    /**
1977
-	 * Magic method for accessing invoice properties.
1978
-	 *
1979
-	 * @since 1.0.15
1980
-	 * @access public
1981
-	 *
1982
-	 * @param string $key Discount data to retrieve
1983
-	 * @param  string $context View or edit context.
1984
-	 * @return mixed Value of the given invoice property (if set).
1985
-	 */
1986
-	public function get( $key, $context = 'view' ) {
1950
+    }
1951
+
1952
+    /**
1953
+     * Retrieves the remote transaction url.
1954
+     *
1955
+     * @since 1.6.0
1956
+     * @return string
1957
+     */
1958
+    public function get_transaction_url() {
1959
+        return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1960
+    }
1961
+
1962
+    /**
1963
+     * Retrieves the default status.
1964
+     *
1965
+     * @since 1.0.19
1966
+     * @return string
1967
+     */
1968
+    public function get_default_status() {
1969
+
1970
+        $type   = $this->get_type();
1971
+        $status = "wpi-$type-pending";
1972
+        return str_replace( '-invoice', '', $status );
1973
+
1974
+    }
1975
+
1976
+    /**
1977
+     * Magic method for accessing invoice properties.
1978
+     *
1979
+     * @since 1.0.15
1980
+     * @access public
1981
+     *
1982
+     * @param string $key Discount data to retrieve
1983
+     * @param  string $context View or edit context.
1984
+     * @return mixed Value of the given invoice property (if set).
1985
+     */
1986
+    public function get( $key, $context = 'view' ) {
1987 1987
         return $this->get_prop( $key, $context );
1988
-	}
1988
+    }
1989 1989
 
1990 1990
     /*
1991 1991
 	|--------------------------------------------------------------------------
@@ -1998,129 +1998,129 @@  discard block
 block discarded – undo
1998 1998
     */
1999 1999
 
2000 2000
     /**
2001
-	 * Magic method for setting invoice properties.
2002
-	 *
2003
-	 * @since 1.0.19
2004
-	 * @access public
2005
-	 *
2006
-	 * @param string $key Discount data to retrieve
2007
-	 * @param  mixed $value new value.
2008
-	 * @return mixed Value of the given invoice property (if set).
2009
-	 */
2010
-	public function set( $key, $value ) {
2001
+     * Magic method for setting invoice properties.
2002
+     *
2003
+     * @since 1.0.19
2004
+     * @access public
2005
+     *
2006
+     * @param string $key Discount data to retrieve
2007
+     * @param  mixed $value new value.
2008
+     * @return mixed Value of the given invoice property (if set).
2009
+     */
2010
+    public function set( $key, $value ) {
2011 2011
 
2012 2012
         $setter = "set_$key";
2013 2013
         if ( is_callable( array( $this, $setter ) ) ) {
2014 2014
             $this->{$setter}( $value );
2015 2015
         }
2016 2016
 
2017
-	}
2018
-
2019
-	/**
2020
-	 * Sets item status.
2021
-	 *
2022
-	 * @since 1.0.19
2023
-	 * @param string $new_status    New status.
2024
-	 * @param string $note          Optional note to add.
2025
-	 * @param bool   $manual_update Is this a manual status change?.
2026
-	 * @return array details of change.
2027
-	 */
2028
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
2029
-		$old_status = $this->get_status();
2030
-
2031
-		$statuses = $this->get_all_statuses();
2032
-
2033
-		if ( isset( $statuses['draft'] ) ) {
2034
-			unset( $statuses['draft'] );
2035
-		}
2036
-
2037
-		$this->set_prop( 'status', $new_status );
2038
-
2039
-		// If setting the status, ensure it's set to a valid status.
2040
-		if ( true === $this->object_read ) {
2041
-
2042
-			// Only allow valid new status.
2043
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
2044
-				$new_status = $this->get_default_status();
2045
-			}
2046
-
2047
-			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2048
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2049
-				$old_status = $this->get_default_status();
2050
-			}
2051
-
2052
-			// Paid - Renewal (i.e when duplicating a parent invoice )
2053
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2054
-				$old_status = 'wpi-pending';
2055
-			}
2056
-
2057
-			if ( $old_status !== $new_status ) {
2058
-				$this->status_transition = array(
2059
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2060
-					'to'     => $new_status,
2061
-					'note'   => $note,
2062
-					'manual' => (bool) $manual_update,
2063
-				);
2064
-
2065
-				if ( $manual_update ) {
2066
-					do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2067
-				}
2068
-
2069
-				$this->maybe_set_date_paid();
2070
-
2071
-			}
2072
-		}
2073
-
2074
-		return array(
2075
-			'from' => $old_status,
2076
-			'to'   => $new_status,
2077
-		);
2078
-	}
2079
-
2080
-	/**
2081
-	 * Maybe set date paid.
2082
-	 *
2083
-	 * Sets the date paid variable when transitioning to the payment complete
2084
-	 * order status.
2085
-	 *
2086
-	 * @since 1.0.19
2087
-	 */
2088
-	public function maybe_set_date_paid() {
2089
-
2090
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2091
-			$this->set_date_completed( current_time( 'mysql' ) );
2092
-		}
2093
-	}
2094
-
2095
-    /**
2096
-	 * Set parent invoice ID.
2097
-	 *
2098
-	 * @since 1.0.19
2099
-	 */
2100
-	public function set_parent_id( $value ) {
2101
-		if ( $value && ( $value === $this->get_id() ) ) {
2102
-			return;
2103
-		}
2104
-		$this->set_prop( 'parent_id', absint( $value ) );
2105
-    }
2106
-
2107
-    /**
2108
-	 * Set plugin version when the invoice was created.
2109
-	 *
2110
-	 * @since 1.0.19
2111
-	 */
2112
-	public function set_version( $value ) {
2113
-		$this->set_prop( 'version', $value );
2114
-    }
2115
-
2116
-    /**
2117
-	 * Set date when the invoice was created.
2118
-	 *
2119
-	 * @since 1.0.19
2120
-	 * @param string $value Value to set.
2017
+    }
2018
+
2019
+    /**
2020
+     * Sets item status.
2021
+     *
2022
+     * @since 1.0.19
2023
+     * @param string $new_status    New status.
2024
+     * @param string $note          Optional note to add.
2025
+     * @param bool   $manual_update Is this a manual status change?.
2026
+     * @return array details of change.
2027
+     */
2028
+    public function set_status( $new_status, $note = '', $manual_update = false ) {
2029
+        $old_status = $this->get_status();
2030
+
2031
+        $statuses = $this->get_all_statuses();
2032
+
2033
+        if ( isset( $statuses['draft'] ) ) {
2034
+            unset( $statuses['draft'] );
2035
+        }
2036
+
2037
+        $this->set_prop( 'status', $new_status );
2038
+
2039
+        // If setting the status, ensure it's set to a valid status.
2040
+        if ( true === $this->object_read ) {
2041
+
2042
+            // Only allow valid new status.
2043
+            if ( ! array_key_exists( $new_status, $statuses ) ) {
2044
+                $new_status = $this->get_default_status();
2045
+            }
2046
+
2047
+            // If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2048
+            if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2049
+                $old_status = $this->get_default_status();
2050
+            }
2051
+
2052
+            // Paid - Renewal (i.e when duplicating a parent invoice )
2053
+            if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2054
+                $old_status = 'wpi-pending';
2055
+            }
2056
+
2057
+            if ( $old_status !== $new_status ) {
2058
+                $this->status_transition = array(
2059
+                    'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2060
+                    'to'     => $new_status,
2061
+                    'note'   => $note,
2062
+                    'manual' => (bool) $manual_update,
2063
+                );
2064
+
2065
+                if ( $manual_update ) {
2066
+                    do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2067
+                }
2068
+
2069
+                $this->maybe_set_date_paid();
2070
+
2071
+            }
2072
+        }
2073
+
2074
+        return array(
2075
+            'from' => $old_status,
2076
+            'to'   => $new_status,
2077
+        );
2078
+    }
2079
+
2080
+    /**
2081
+     * Maybe set date paid.
2082
+     *
2083
+     * Sets the date paid variable when transitioning to the payment complete
2084
+     * order status.
2085
+     *
2086
+     * @since 1.0.19
2087
+     */
2088
+    public function maybe_set_date_paid() {
2089
+
2090
+        if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2091
+            $this->set_date_completed( current_time( 'mysql' ) );
2092
+        }
2093
+    }
2094
+
2095
+    /**
2096
+     * Set parent invoice ID.
2097
+     *
2098
+     * @since 1.0.19
2099
+     */
2100
+    public function set_parent_id( $value ) {
2101
+        if ( $value && ( $value === $this->get_id() ) ) {
2102
+            return;
2103
+        }
2104
+        $this->set_prop( 'parent_id', absint( $value ) );
2105
+    }
2106
+
2107
+    /**
2108
+     * Set plugin version when the invoice was created.
2109
+     *
2110
+     * @since 1.0.19
2111
+     */
2112
+    public function set_version( $value ) {
2113
+        $this->set_prop( 'version', $value );
2114
+    }
2115
+
2116
+    /**
2117
+     * Set date when the invoice was created.
2118
+     *
2119
+     * @since 1.0.19
2120
+     * @param string $value Value to set.
2121 2121
      * @return bool Whether or not the date was set.
2122
-	 */
2123
-	public function set_date_created( $value ) {
2122
+     */
2123
+    public function set_date_created( $value ) {
2124 2124
         $date = strtotime( $value );
2125 2125
 
2126 2126
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2128,19 +2128,19 @@  discard block
 block discarded – undo
2128 2128
             return true;
2129 2129
         }
2130 2130
 
2131
-		$this->set_prop( 'date_created', '' );
2132
-		return false;
2131
+        $this->set_prop( 'date_created', '' );
2132
+        return false;
2133 2133
 
2134 2134
     }
2135 2135
 
2136 2136
     /**
2137
-	 * Set date invoice due date.
2138
-	 *
2139
-	 * @since 1.0.19
2140
-	 * @param string $value Value to set.
2137
+     * Set date invoice due date.
2138
+     *
2139
+     * @since 1.0.19
2140
+     * @param string $value Value to set.
2141 2141
      * @return bool Whether or not the date was set.
2142
-	 */
2143
-	public function set_due_date( $value ) {
2142
+     */
2143
+    public function set_due_date( $value ) {
2144 2144
         $date = strtotime( $value );
2145 2145
 
2146 2146
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2148,29 +2148,29 @@  discard block
 block discarded – undo
2148 2148
             return true;
2149 2149
         }
2150 2150
 
2151
-		$this->set_prop( 'due_date', '' );
2151
+        $this->set_prop( 'due_date', '' );
2152 2152
         return false;
2153 2153
 
2154 2154
     }
2155 2155
 
2156 2156
     /**
2157
-	 * Alias of self::set_due_date().
2158
-	 *
2159
-	 * @since 1.0.19
2160
-	 * @param  string $value New name.
2161
-	 */
2162
-	public function set_date_due( $value ) {
2163
-		$this->set_due_date( $value );
2157
+     * Alias of self::set_due_date().
2158
+     *
2159
+     * @since 1.0.19
2160
+     * @param  string $value New name.
2161
+     */
2162
+    public function set_date_due( $value ) {
2163
+        $this->set_due_date( $value );
2164 2164
     }
2165 2165
 
2166 2166
     /**
2167
-	 * Set date invoice was completed.
2168
-	 *
2169
-	 * @since 1.0.19
2170
-	 * @param string $value Value to set.
2167
+     * Set date invoice was completed.
2168
+     *
2169
+     * @since 1.0.19
2170
+     * @param string $value Value to set.
2171 2171
      * @return bool Whether or not the date was set.
2172
-	 */
2173
-	public function set_completed_date( $value ) {
2172
+     */
2173
+    public function set_completed_date( $value ) {
2174 2174
         $date = strtotime( $value );
2175 2175
 
2176 2176
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2178,29 +2178,29 @@  discard block
 block discarded – undo
2178 2178
             return true;
2179 2179
         }
2180 2180
 
2181
-		$this->set_prop( 'completed_date', '' );
2181
+        $this->set_prop( 'completed_date', '' );
2182 2182
         return false;
2183 2183
 
2184 2184
     }
2185 2185
 
2186 2186
     /**
2187
-	 * Alias of self::set_completed_date().
2188
-	 *
2189
-	 * @since 1.0.19
2190
-	 * @param  string $value New name.
2191
-	 */
2192
-	public function set_date_completed( $value ) {
2193
-		$this->set_completed_date( $value );
2187
+     * Alias of self::set_completed_date().
2188
+     *
2189
+     * @since 1.0.19
2190
+     * @param  string $value New name.
2191
+     */
2192
+    public function set_date_completed( $value ) {
2193
+        $this->set_completed_date( $value );
2194 2194
     }
2195 2195
 
2196 2196
     /**
2197
-	 * Set date when the invoice was last modified.
2198
-	 *
2199
-	 * @since 1.0.19
2200
-	 * @param string $value Value to set.
2197
+     * Set date when the invoice was last modified.
2198
+     *
2199
+     * @since 1.0.19
2200
+     * @param string $value Value to set.
2201 2201
      * @return bool Whether or not the date was set.
2202
-	 */
2203
-	public function set_date_modified( $value ) {
2202
+     */
2203
+    public function set_date_modified( $value ) {
2204 2204
         $date = strtotime( $value );
2205 2205
 
2206 2206
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -2208,813 +2208,813 @@  discard block
 block discarded – undo
2208 2208
             return true;
2209 2209
         }
2210 2210
 
2211
-		$this->set_prop( 'date_modified', '' );
2211
+        $this->set_prop( 'date_modified', '' );
2212 2212
         return false;
2213 2213
 
2214 2214
     }
2215 2215
 
2216 2216
     /**
2217
-	 * Set the invoice number.
2218
-	 *
2219
-	 * @since 1.0.19
2220
-	 * @param  string $value New number.
2221
-	 */
2222
-	public function set_number( $value ) {
2217
+     * Set the invoice number.
2218
+     *
2219
+     * @since 1.0.19
2220
+     * @param  string $value New number.
2221
+     */
2222
+    public function set_number( $value ) {
2223 2223
         $number = sanitize_text_field( $value );
2224
-		$this->set_prop( 'number', $number );
2224
+        $this->set_prop( 'number', $number );
2225 2225
     }
2226 2226
 
2227 2227
     /**
2228
-	 * Set the invoice type.
2229
-	 *
2230
-	 * @since 1.0.19
2231
-	 * @param  string $value Type.
2232
-	 */
2233
-	public function set_type( $value ) {
2228
+     * Set the invoice type.
2229
+     *
2230
+     * @since 1.0.19
2231
+     * @param  string $value Type.
2232
+     */
2233
+    public function set_type( $value ) {
2234 2234
         $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2235
-		$this->set_prop( 'type', $type );
2236
-	}
2235
+        $this->set_prop( 'type', $type );
2236
+    }
2237 2237
 
2238 2238
     /**
2239
-	 * Set the invoice post type.
2240
-	 *
2241
-	 * @since 1.0.19
2242
-	 * @param  string $value Post type.
2243
-	 */
2244
-	public function set_post_type( $value ) {
2239
+     * Set the invoice post type.
2240
+     *
2241
+     * @since 1.0.19
2242
+     * @param  string $value Post type.
2243
+     */
2244
+    public function set_post_type( $value ) {
2245 2245
         if ( getpaid_is_invoice_post_type( $value ) ) {
2246
-			$this->set_type( $value );
2246
+            $this->set_type( $value );
2247 2247
             $this->set_prop( 'post_type', $value );
2248 2248
         }
2249 2249
     }
2250 2250
 
2251 2251
     /**
2252
-	 * Set the invoice key.
2253
-	 *
2254
-	 * @since 1.0.19
2255
-	 * @param  string $value New key.
2256
-	 */
2257
-	public function set_key( $value ) {
2252
+     * Set the invoice key.
2253
+     *
2254
+     * @since 1.0.19
2255
+     * @param  string $value New key.
2256
+     */
2257
+    public function set_key( $value ) {
2258 2258
         $key = sanitize_text_field( $value );
2259
-		$this->set_prop( 'key', $key );
2259
+        $this->set_prop( 'key', $key );
2260 2260
     }
2261 2261
 
2262 2262
     /**
2263
-	 * Set the invoice mode.
2264
-	 *
2265
-	 * @since 1.0.19
2266
-	 * @param  string $value mode.
2267
-	 */
2268
-	public function set_mode( $value ) {
2263
+     * Set the invoice mode.
2264
+     *
2265
+     * @since 1.0.19
2266
+     * @param  string $value mode.
2267
+     */
2268
+    public function set_mode( $value ) {
2269 2269
         if ( in_array( $value, array( 'live', 'test' ) ) ) {
2270 2270
             $this->set_prop( 'mode', $value );
2271 2271
         }
2272 2272
     }
2273 2273
 
2274 2274
     /**
2275
-	 * Set the invoice path.
2276
-	 *
2277
-	 * @since 1.0.19
2278
-	 * @param  string $value path.
2279
-	 */
2280
-	public function set_path( $value ) {
2275
+     * Set the invoice path.
2276
+     *
2277
+     * @since 1.0.19
2278
+     * @param  string $value path.
2279
+     */
2280
+    public function set_path( $value ) {
2281 2281
         $this->set_prop( 'path', $value );
2282 2282
     }
2283 2283
 
2284 2284
     /**
2285
-	 * Set the invoice name.
2286
-	 *
2287
-	 * @since 1.0.19
2288
-	 * @param  string $value New name.
2289
-	 */
2290
-	public function set_name( $value ) {
2285
+     * Set the invoice name.
2286
+     *
2287
+     * @since 1.0.19
2288
+     * @param  string $value New name.
2289
+     */
2290
+    public function set_name( $value ) {
2291 2291
         $name = sanitize_text_field( $value );
2292
-		$this->set_prop( 'name', $name );
2292
+        $this->set_prop( 'name', $name );
2293 2293
     }
2294 2294
 
2295 2295
     /**
2296
-	 * Alias of self::set_name().
2297
-	 *
2298
-	 * @since 1.0.19
2299
-	 * @param  string $value New name.
2300
-	 */
2301
-	public function set_title( $value ) {
2302
-		$this->set_name( $value );
2296
+     * Alias of self::set_name().
2297
+     *
2298
+     * @since 1.0.19
2299
+     * @param  string $value New name.
2300
+     */
2301
+    public function set_title( $value ) {
2302
+        $this->set_name( $value );
2303 2303
     }
2304 2304
 
2305 2305
     /**
2306
-	 * Set the invoice description.
2307
-	 *
2308
-	 * @since 1.0.19
2309
-	 * @param  string $value New description.
2310
-	 */
2311
-	public function set_description( $value ) {
2306
+     * Set the invoice description.
2307
+     *
2308
+     * @since 1.0.19
2309
+     * @param  string $value New description.
2310
+     */
2311
+    public function set_description( $value ) {
2312 2312
         $description = wp_kses_post( $value );
2313
-		$this->set_prop( 'description', $description );
2313
+        $this->set_prop( 'description', $description );
2314
+    }
2315
+
2316
+    /**
2317
+     * Alias of self::set_description().
2318
+     *
2319
+     * @since 1.0.19
2320
+     * @param  string $value New description.
2321
+     */
2322
+    public function set_excerpt( $value ) {
2323
+        $this->set_description( $value );
2324
+    }
2325
+
2326
+    /**
2327
+     * Alias of self::set_description().
2328
+     *
2329
+     * @since 1.0.19
2330
+     * @param  string $value New description.
2331
+     */
2332
+    public function set_summary( $value ) {
2333
+        $this->set_description( $value );
2334
+    }
2335
+
2336
+    /**
2337
+     * Set the receiver of the invoice.
2338
+     *
2339
+     * @since 1.0.19
2340
+     * @param  int $value New author.
2341
+     */
2342
+    public function set_author( $value ) {
2343
+        $user = get_user_by( 'id', (int) $value );
2344
+
2345
+        if ( $user && $user->ID ) {
2346
+            $this->set_prop( 'author', $user->ID );
2347
+            $this->set_prop( 'email', $user->user_email );
2348
+        }
2349
+
2350
+    }
2351
+
2352
+    /**
2353
+     * Alias of self::set_author().
2354
+     *
2355
+     * @since 1.0.19
2356
+     * @param  int $value New user id.
2357
+     */
2358
+    public function set_user_id( $value ) {
2359
+        $this->set_author( $value );
2360
+    }
2361
+
2362
+    /**
2363
+     * Alias of self::set_author().
2364
+     *
2365
+     * @since 1.0.19
2366
+     * @param  int $value New user id.
2367
+     */
2368
+    public function set_customer_id( $value ) {
2369
+        $this->set_author( $value );
2370
+    }
2371
+
2372
+    /**
2373
+     * Set the customer's ip.
2374
+     *
2375
+     * @since 1.0.19
2376
+     * @param  string $value ip address.
2377
+     */
2378
+    public function set_ip( $value ) {
2379
+        $this->set_prop( 'ip', $value );
2380
+    }
2381
+
2382
+    /**
2383
+     * Alias of self::set_ip().
2384
+     *
2385
+     * @since 1.0.19
2386
+     * @param  string $value ip address.
2387
+     */
2388
+    public function set_user_ip( $value ) {
2389
+        $this->set_ip( $value );
2390
+    }
2391
+
2392
+    /**
2393
+     * Set the customer's first name.
2394
+     *
2395
+     * @since 1.0.19
2396
+     * @param  string $value first name.
2397
+     */
2398
+    public function set_first_name( $value ) {
2399
+        $this->set_prop( 'first_name', $value );
2400
+    }
2401
+
2402
+    /**
2403
+     * Alias of self::set_first_name().
2404
+     *
2405
+     * @since 1.0.19
2406
+     * @param  string $value first name.
2407
+     */
2408
+    public function set_user_first_name( $value ) {
2409
+        $this->set_first_name( $value );
2410
+    }
2411
+
2412
+    /**
2413
+     * Alias of self::set_first_name().
2414
+     *
2415
+     * @since 1.0.19
2416
+     * @param  string $value first name.
2417
+     */
2418
+    public function set_customer_first_name( $value ) {
2419
+        $this->set_first_name( $value );
2420
+    }
2421
+
2422
+    /**
2423
+     * Set the customer's last name.
2424
+     *
2425
+     * @since 1.0.19
2426
+     * @param  string $value last name.
2427
+     */
2428
+    public function set_last_name( $value ) {
2429
+        $this->set_prop( 'last_name', $value );
2430
+    }
2431
+
2432
+    /**
2433
+     * Alias of self::set_last_name().
2434
+     *
2435
+     * @since 1.0.19
2436
+     * @param  string $value last name.
2437
+     */
2438
+    public function set_user_last_name( $value ) {
2439
+        $this->set_last_name( $value );
2440
+    }
2441
+
2442
+    /**
2443
+     * Alias of self::set_last_name().
2444
+     *
2445
+     * @since 1.0.19
2446
+     * @param  string $value last name.
2447
+     */
2448
+    public function set_customer_last_name( $value ) {
2449
+        $this->set_last_name( $value );
2450
+    }
2451
+
2452
+    /**
2453
+     * Set the customer's phone number.
2454
+     *
2455
+     * @since 1.0.19
2456
+     * @param  string $value phone.
2457
+     */
2458
+    public function set_phone( $value ) {
2459
+        $this->set_prop( 'phone', $value );
2314 2460
     }
2315 2461
 
2316 2462
     /**
2317
-	 * Alias of self::set_description().
2318
-	 *
2319
-	 * @since 1.0.19
2320
-	 * @param  string $value New description.
2321
-	 */
2322
-	public function set_excerpt( $value ) {
2323
-		$this->set_description( $value );
2463
+     * Alias of self::set_phone().
2464
+     *
2465
+     * @since 1.0.19
2466
+     * @param  string $value phone.
2467
+     */
2468
+    public function set_user_phone( $value ) {
2469
+        $this->set_phone( $value );
2324 2470
     }
2325 2471
 
2326 2472
     /**
2327
-	 * Alias of self::set_description().
2328
-	 *
2329
-	 * @since 1.0.19
2330
-	 * @param  string $value New description.
2331
-	 */
2332
-	public function set_summary( $value ) {
2333
-		$this->set_description( $value );
2473
+     * Alias of self::set_phone().
2474
+     *
2475
+     * @since 1.0.19
2476
+     * @param  string $value phone.
2477
+     */
2478
+    public function set_customer_phone( $value ) {
2479
+        $this->set_phone( $value );
2334 2480
     }
2335 2481
 
2336 2482
     /**
2337
-	 * Set the receiver of the invoice.
2338
-	 *
2339
-	 * @since 1.0.19
2340
-	 * @param  int $value New author.
2341
-	 */
2342
-	public function set_author( $value ) {
2343
-		$user = get_user_by( 'id', (int) $value );
2483
+     * Alias of self::set_phone().
2484
+     *
2485
+     * @since 1.0.19
2486
+     * @param  string $value phone.
2487
+     */
2488
+    public function set_phone_number( $value ) {
2489
+        $this->set_phone( $value );
2490
+    }
2344 2491
 
2345
-		if ( $user && $user->ID ) {
2346
-			$this->set_prop( 'author', $user->ID );
2347
-			$this->set_prop( 'email', $user->user_email );
2348
-		}
2492
+    /**
2493
+     * Set the customer's email address.
2494
+     *
2495
+     * @since 1.0.19
2496
+     * @param  string $value email address.
2497
+     */
2498
+    public function set_email( $value ) {
2499
+        $this->set_prop( 'email', $value );
2500
+    }
2349 2501
 
2502
+    /**
2503
+     * Alias of self::set_email().
2504
+     *
2505
+     * @since 1.0.19
2506
+     * @param  string $value email address.
2507
+     */
2508
+    public function set_user_email( $value ) {
2509
+        $this->set_email( $value );
2350 2510
     }
2351 2511
 
2352 2512
     /**
2353
-	 * Alias of self::set_author().
2354
-	 *
2355
-	 * @since 1.0.19
2356
-	 * @param  int $value New user id.
2357
-	 */
2358
-	public function set_user_id( $value ) {
2359
-		$this->set_author( $value );
2513
+     * Alias of self::set_email().
2514
+     *
2515
+     * @since 1.0.19
2516
+     * @param  string $value email address.
2517
+     */
2518
+    public function set_email_address( $value ) {
2519
+        $this->set_email( $value );
2360 2520
     }
2361 2521
 
2362 2522
     /**
2363
-	 * Alias of self::set_author().
2364
-	 *
2365
-	 * @since 1.0.19
2366
-	 * @param  int $value New user id.
2367
-	 */
2368
-	public function set_customer_id( $value ) {
2369
-		$this->set_author( $value );
2523
+     * Alias of self::set_email().
2524
+     *
2525
+     * @since 1.0.19
2526
+     * @param  string $value email address.
2527
+     */
2528
+    public function set_customer_email( $value ) {
2529
+        $this->set_email( $value );
2370 2530
     }
2371 2531
 
2372 2532
     /**
2373
-	 * Set the customer's ip.
2374
-	 *
2375
-	 * @since 1.0.19
2376
-	 * @param  string $value ip address.
2377
-	 */
2378
-	public function set_ip( $value ) {
2379
-		$this->set_prop( 'ip', $value );
2533
+     * Set the customer's country.
2534
+     *
2535
+     * @since 1.0.19
2536
+     * @param  string $value country.
2537
+     */
2538
+    public function set_country( $value ) {
2539
+        $this->set_prop( 'country', $value );
2380 2540
     }
2381 2541
 
2382 2542
     /**
2383
-	 * Alias of self::set_ip().
2384
-	 *
2385
-	 * @since 1.0.19
2386
-	 * @param  string $value ip address.
2387
-	 */
2388
-	public function set_user_ip( $value ) {
2389
-		$this->set_ip( $value );
2543
+     * Alias of self::set_country().
2544
+     *
2545
+     * @since 1.0.19
2546
+     * @param  string $value country.
2547
+     */
2548
+    public function set_user_country( $value ) {
2549
+        $this->set_country( $value );
2390 2550
     }
2391 2551
 
2392 2552
     /**
2393
-	 * Set the customer's first name.
2394
-	 *
2395
-	 * @since 1.0.19
2396
-	 * @param  string $value first name.
2397
-	 */
2398
-	public function set_first_name( $value ) {
2399
-		$this->set_prop( 'first_name', $value );
2553
+     * Alias of self::set_country().
2554
+     *
2555
+     * @since 1.0.19
2556
+     * @param  string $value country.
2557
+     */
2558
+    public function set_customer_country( $value ) {
2559
+        $this->set_country( $value );
2400 2560
     }
2401 2561
 
2402 2562
     /**
2403
-	 * Alias of self::set_first_name().
2404
-	 *
2405
-	 * @since 1.0.19
2406
-	 * @param  string $value first name.
2407
-	 */
2408
-	public function set_user_first_name( $value ) {
2409
-		$this->set_first_name( $value );
2563
+     * Set the customer's state.
2564
+     *
2565
+     * @since 1.0.19
2566
+     * @param  string $value state.
2567
+     */
2568
+    public function set_state( $value ) {
2569
+        $this->set_prop( 'state', $value );
2410 2570
     }
2411 2571
 
2412 2572
     /**
2413
-	 * Alias of self::set_first_name().
2414
-	 *
2415
-	 * @since 1.0.19
2416
-	 * @param  string $value first name.
2417
-	 */
2418
-	public function set_customer_first_name( $value ) {
2419
-		$this->set_first_name( $value );
2573
+     * Alias of self::set_state().
2574
+     *
2575
+     * @since 1.0.19
2576
+     * @param  string $value state.
2577
+     */
2578
+    public function set_user_state( $value ) {
2579
+        $this->set_state( $value );
2420 2580
     }
2421 2581
 
2422 2582
     /**
2423
-	 * Set the customer's last name.
2424
-	 *
2425
-	 * @since 1.0.19
2426
-	 * @param  string $value last name.
2427
-	 */
2428
-	public function set_last_name( $value ) {
2429
-		$this->set_prop( 'last_name', $value );
2583
+     * Alias of self::set_state().
2584
+     *
2585
+     * @since 1.0.19
2586
+     * @param  string $value state.
2587
+     */
2588
+    public function set_customer_state( $value ) {
2589
+        $this->set_state( $value );
2430 2590
     }
2431 2591
 
2432 2592
     /**
2433
-	 * Alias of self::set_last_name().
2434
-	 *
2435
-	 * @since 1.0.19
2436
-	 * @param  string $value last name.
2437
-	 */
2438
-	public function set_user_last_name( $value ) {
2439
-		$this->set_last_name( $value );
2593
+     * Set the customer's city.
2594
+     *
2595
+     * @since 1.0.19
2596
+     * @param  string $value city.
2597
+     */
2598
+    public function set_city( $value ) {
2599
+        $this->set_prop( 'city', $value );
2440 2600
     }
2441 2601
 
2442 2602
     /**
2443
-	 * Alias of self::set_last_name().
2444
-	 *
2445
-	 * @since 1.0.19
2446
-	 * @param  string $value last name.
2447
-	 */
2448
-	public function set_customer_last_name( $value ) {
2449
-		$this->set_last_name( $value );
2603
+     * Alias of self::set_city().
2604
+     *
2605
+     * @since 1.0.19
2606
+     * @param  string $value city.
2607
+     */
2608
+    public function set_user_city( $value ) {
2609
+        $this->set_city( $value );
2450 2610
     }
2451 2611
 
2452 2612
     /**
2453
-	 * Set the customer's phone number.
2454
-	 *
2455
-	 * @since 1.0.19
2456
-	 * @param  string $value phone.
2457
-	 */
2458
-	public function set_phone( $value ) {
2459
-		$this->set_prop( 'phone', $value );
2613
+     * Alias of self::set_city().
2614
+     *
2615
+     * @since 1.0.19
2616
+     * @param  string $value city.
2617
+     */
2618
+    public function set_customer_city( $value ) {
2619
+        $this->set_city( $value );
2460 2620
     }
2461 2621
 
2462 2622
     /**
2463
-	 * Alias of self::set_phone().
2464
-	 *
2465
-	 * @since 1.0.19
2466
-	 * @param  string $value phone.
2467
-	 */
2468
-	public function set_user_phone( $value ) {
2469
-		$this->set_phone( $value );
2623
+     * Set the customer's zip code.
2624
+     *
2625
+     * @since 1.0.19
2626
+     * @param  string $value zip.
2627
+     */
2628
+    public function set_zip( $value ) {
2629
+        $this->set_prop( 'zip', $value );
2470 2630
     }
2471 2631
 
2472 2632
     /**
2473
-	 * Alias of self::set_phone().
2474
-	 *
2475
-	 * @since 1.0.19
2476
-	 * @param  string $value phone.
2477
-	 */
2478
-	public function set_customer_phone( $value ) {
2479
-		$this->set_phone( $value );
2633
+     * Alias of self::set_zip().
2634
+     *
2635
+     * @since 1.0.19
2636
+     * @param  string $value zip.
2637
+     */
2638
+    public function set_user_zip( $value ) {
2639
+        $this->set_zip( $value );
2480 2640
     }
2481 2641
 
2482 2642
     /**
2483
-	 * Alias of self::set_phone().
2484
-	 *
2485
-	 * @since 1.0.19
2486
-	 * @param  string $value phone.
2487
-	 */
2488
-	public function set_phone_number( $value ) {
2489
-		$this->set_phone( $value );
2643
+     * Alias of self::set_zip().
2644
+     *
2645
+     * @since 1.0.19
2646
+     * @param  string $value zip.
2647
+     */
2648
+    public function set_customer_zip( $value ) {
2649
+        $this->set_zip( $value );
2490 2650
     }
2491 2651
 
2492 2652
     /**
2493
-	 * Set the customer's email address.
2494
-	 *
2495
-	 * @since 1.0.19
2496
-	 * @param  string $value email address.
2497
-	 */
2498
-	public function set_email( $value ) {
2499
-		$this->set_prop( 'email', $value );
2653
+     * Set the customer's company.
2654
+     *
2655
+     * @since 1.0.19
2656
+     * @param  string $value company.
2657
+     */
2658
+    public function set_company( $value ) {
2659
+        $this->set_prop( 'company', $value );
2500 2660
     }
2501 2661
 
2502 2662
     /**
2503
-	 * Alias of self::set_email().
2504
-	 *
2505
-	 * @since 1.0.19
2506
-	 * @param  string $value email address.
2507
-	 */
2508
-	public function set_user_email( $value ) {
2509
-		$this->set_email( $value );
2663
+     * Alias of self::set_company().
2664
+     *
2665
+     * @since 1.0.19
2666
+     * @param  string $value company.
2667
+     */
2668
+    public function set_user_company( $value ) {
2669
+        $this->set_company( $value );
2510 2670
     }
2511 2671
 
2512 2672
     /**
2513
-	 * Alias of self::set_email().
2514
-	 *
2515
-	 * @since 1.0.19
2516
-	 * @param  string $value email address.
2517
-	 */
2518
-	public function set_email_address( $value ) {
2519
-		$this->set_email( $value );
2673
+     * Alias of self::set_company().
2674
+     *
2675
+     * @since 1.0.19
2676
+     * @param  string $value company.
2677
+     */
2678
+    public function set_customer_company( $value ) {
2679
+        $this->set_company( $value );
2520 2680
     }
2521 2681
 
2522 2682
     /**
2523
-	 * Alias of self::set_email().
2524
-	 *
2525
-	 * @since 1.0.19
2526
-	 * @param  string $value email address.
2527
-	 */
2528
-	public function set_customer_email( $value ) {
2529
-		$this->set_email( $value );
2683
+     * Set the customer's company id.
2684
+     *
2685
+     * @since 1.0.19
2686
+     * @param  string $value company id.
2687
+     */
2688
+    public function set_company_id( $value ) {
2689
+        $this->set_prop( 'company_id', $value );
2530 2690
     }
2531 2691
 
2532 2692
     /**
2533
-	 * Set the customer's country.
2534
-	 *
2535
-	 * @since 1.0.19
2536
-	 * @param  string $value country.
2537
-	 */
2538
-	public function set_country( $value ) {
2539
-		$this->set_prop( 'country', $value );
2693
+     * Set the customer's var number.
2694
+     *
2695
+     * @since 1.0.19
2696
+     * @param  string $value var number.
2697
+     */
2698
+    public function set_vat_number( $value ) {
2699
+        $this->set_prop( 'vat_number', $value );
2540 2700
     }
2541 2701
 
2542 2702
     /**
2543
-	 * Alias of self::set_country().
2544
-	 *
2545
-	 * @since 1.0.19
2546
-	 * @param  string $value country.
2547
-	 */
2548
-	public function set_user_country( $value ) {
2549
-		$this->set_country( $value );
2703
+     * Alias of self::set_vat_number().
2704
+     *
2705
+     * @since 1.0.19
2706
+     * @param  string $value var number.
2707
+     */
2708
+    public function set_user_vat_number( $value ) {
2709
+        $this->set_vat_number( $value );
2550 2710
     }
2551 2711
 
2552 2712
     /**
2553
-	 * Alias of self::set_country().
2554
-	 *
2555
-	 * @since 1.0.19
2556
-	 * @param  string $value country.
2557
-	 */
2558
-	public function set_customer_country( $value ) {
2559
-		$this->set_country( $value );
2713
+     * Alias of self::set_vat_number().
2714
+     *
2715
+     * @since 1.0.19
2716
+     * @param  string $value var number.
2717
+     */
2718
+    public function set_customer_vat_number( $value ) {
2719
+        $this->set_vat_number( $value );
2560 2720
     }
2561 2721
 
2562 2722
     /**
2563
-	 * Set the customer's state.
2564
-	 *
2565
-	 * @since 1.0.19
2566
-	 * @param  string $value state.
2567
-	 */
2568
-	public function set_state( $value ) {
2569
-		$this->set_prop( 'state', $value );
2723
+     * Set the customer's vat rate.
2724
+     *
2725
+     * @since 1.0.19
2726
+     * @param  string $value var rate.
2727
+     */
2728
+    public function set_vat_rate( $value ) {
2729
+        $this->set_prop( 'vat_rate', $value );
2570 2730
     }
2571 2731
 
2572 2732
     /**
2573
-	 * Alias of self::set_state().
2574
-	 *
2575
-	 * @since 1.0.19
2576
-	 * @param  string $value state.
2577
-	 */
2578
-	public function set_user_state( $value ) {
2579
-		$this->set_state( $value );
2733
+     * Alias of self::set_vat_rate().
2734
+     *
2735
+     * @since 1.0.19
2736
+     * @param  string $value var number.
2737
+     */
2738
+    public function set_user_vat_rate( $value ) {
2739
+        $this->set_vat_rate( $value );
2580 2740
     }
2581 2741
 
2582 2742
     /**
2583
-	 * Alias of self::set_state().
2584
-	 *
2585
-	 * @since 1.0.19
2586
-	 * @param  string $value state.
2587
-	 */
2588
-	public function set_customer_state( $value ) {
2589
-		$this->set_state( $value );
2743
+     * Alias of self::set_vat_rate().
2744
+     *
2745
+     * @since 1.0.19
2746
+     * @param  string $value var number.
2747
+     */
2748
+    public function set_customer_vat_rate( $value ) {
2749
+        $this->set_vat_rate( $value );
2590 2750
     }
2591 2751
 
2592 2752
     /**
2593
-	 * Set the customer's city.
2594
-	 *
2595
-	 * @since 1.0.19
2596
-	 * @param  string $value city.
2597
-	 */
2598
-	public function set_city( $value ) {
2599
-		$this->set_prop( 'city', $value );
2753
+     * Set the customer's address.
2754
+     *
2755
+     * @since 1.0.19
2756
+     * @param  string $value address.
2757
+     */
2758
+    public function set_address( $value ) {
2759
+        $this->set_prop( 'address', $value );
2600 2760
     }
2601 2761
 
2602 2762
     /**
2603
-	 * Alias of self::set_city().
2604
-	 *
2605
-	 * @since 1.0.19
2606
-	 * @param  string $value city.
2607
-	 */
2608
-	public function set_user_city( $value ) {
2609
-		$this->set_city( $value );
2763
+     * Alias of self::set_address().
2764
+     *
2765
+     * @since 1.0.19
2766
+     * @param  string $value address.
2767
+     */
2768
+    public function set_user_address( $value ) {
2769
+        $this->set_address( $value );
2610 2770
     }
2611 2771
 
2612 2772
     /**
2613
-	 * Alias of self::set_city().
2614
-	 *
2615
-	 * @since 1.0.19
2616
-	 * @param  string $value city.
2617
-	 */
2618
-	public function set_customer_city( $value ) {
2619
-		$this->set_city( $value );
2773
+     * Alias of self::set_address().
2774
+     *
2775
+     * @since 1.0.19
2776
+     * @param  string $value address.
2777
+     */
2778
+    public function set_customer_address( $value ) {
2779
+        $this->set_address( $value );
2620 2780
     }
2621 2781
 
2622 2782
     /**
2623
-	 * Set the customer's zip code.
2624
-	 *
2625
-	 * @since 1.0.19
2626
-	 * @param  string $value zip.
2627
-	 */
2628
-	public function set_zip( $value ) {
2629
-		$this->set_prop( 'zip', $value );
2783
+     * Set whether the customer has viewed the invoice or not.
2784
+     *
2785
+     * @since 1.0.19
2786
+     * @param  int|bool $value confirmed.
2787
+     */
2788
+    public function set_is_viewed( $value ) {
2789
+        $this->set_prop( 'is_viewed', $value );
2630 2790
     }
2631 2791
 
2632 2792
     /**
2633
-	 * Alias of self::set_zip().
2634
-	 *
2635
-	 * @since 1.0.19
2636
-	 * @param  string $value zip.
2637
-	 */
2638
-	public function set_user_zip( $value ) {
2639
-		$this->set_zip( $value );
2793
+     * Set extra email recipients.
2794
+     *
2795
+     * @since 1.0.19
2796
+     * @param  string $value email recipients.
2797
+     */
2798
+    public function set_email_cc( $value ) {
2799
+        $this->set_prop( 'email_cc', $value );
2640 2800
     }
2641 2801
 
2642 2802
     /**
2643
-	 * Alias of self::set_zip().
2644
-	 *
2645
-	 * @since 1.0.19
2646
-	 * @param  string $value zip.
2647
-	 */
2648
-	public function set_customer_zip( $value ) {
2649
-		$this->set_zip( $value );
2803
+     * Set the invoice template.
2804
+     *
2805
+     * @since 1.0.19
2806
+     * @param  string $value template.
2807
+     */
2808
+    public function set_template( $value ) {
2809
+        if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2810
+            $this->set_prop( 'template', $value );
2811
+        }
2650 2812
     }
2651 2813
 
2652 2814
     /**
2653
-	 * Set the customer's company.
2654
-	 *
2655
-	 * @since 1.0.19
2656
-	 * @param  string $value company.
2657
-	 */
2658
-	public function set_company( $value ) {
2659
-		$this->set_prop( 'company', $value );
2815
+     * Set the invoice source.
2816
+     *
2817
+     * @since 1.0.19
2818
+     * @param  string $value source.
2819
+     * @deprecated
2820
+     */
2821
+    public function created_via( $value ) {
2822
+        $this->set_created_via( sanitize_text_field( $value ) );
2660 2823
     }
2661 2824
 
2662 2825
     /**
2663
-	 * Alias of self::set_company().
2664
-	 *
2665
-	 * @since 1.0.19
2666
-	 * @param  string $value company.
2667
-	 */
2668
-	public function set_user_company( $value ) {
2669
-		$this->set_company( $value );
2826
+     * Set the invoice source.
2827
+     *
2828
+     * @since 1.0.19
2829
+     * @param  string $value source.
2830
+     */
2831
+    public function set_created_via( $value ) {
2832
+        $this->set_prop( 'created_via', sanitize_text_field( $value ) );
2670 2833
     }
2671 2834
 
2672 2835
     /**
2673
-	 * Alias of self::set_company().
2674
-	 *
2675
-	 * @since 1.0.19
2676
-	 * @param  string $value company.
2677
-	 */
2678
-	public function set_customer_company( $value ) {
2679
-		$this->set_company( $value );
2680
-    }
2681
-
2682
-	/**
2683
-	 * Set the customer's company id.
2684
-	 *
2685
-	 * @since 1.0.19
2686
-	 * @param  string $value company id.
2687
-	 */
2688
-	public function set_company_id( $value ) {
2689
-		$this->set_prop( 'company_id', $value );
2836
+     * Set the customer's address confirmed status.
2837
+     *
2838
+     * @since 1.0.19
2839
+     * @param  int|bool $value confirmed.
2840
+     */
2841
+    public function set_address_confirmed( $value ) {
2842
+        $this->set_prop( 'address_confirmed', $value );
2690 2843
     }
2691 2844
 
2692 2845
     /**
2693
-	 * Set the customer's var number.
2694
-	 *
2695
-	 * @since 1.0.19
2696
-	 * @param  string $value var number.
2697
-	 */
2698
-	public function set_vat_number( $value ) {
2699
-		$this->set_prop( 'vat_number', $value );
2846
+     * Alias of self::set_address_confirmed().
2847
+     *
2848
+     * @since 1.0.19
2849
+     * @param  int|bool $value confirmed.
2850
+     */
2851
+    public function set_user_address_confirmed( $value ) {
2852
+        $this->set_address_confirmed( $value );
2700 2853
     }
2701 2854
 
2702 2855
     /**
2703
-	 * Alias of self::set_vat_number().
2704
-	 *
2705
-	 * @since 1.0.19
2706
-	 * @param  string $value var number.
2707
-	 */
2708
-	public function set_user_vat_number( $value ) {
2709
-		$this->set_vat_number( $value );
2856
+     * Alias of self::set_address_confirmed().
2857
+     *
2858
+     * @since 1.0.19
2859
+     * @param  int|bool $value confirmed.
2860
+     */
2861
+    public function set_customer_address_confirmed( $value ) {
2862
+        $this->set_address_confirmed( $value );
2710 2863
     }
2711 2864
 
2712 2865
     /**
2713
-	 * Alias of self::set_vat_number().
2714
-	 *
2715
-	 * @since 1.0.19
2716
-	 * @param  string $value var number.
2717
-	 */
2718
-	public function set_customer_vat_number( $value ) {
2719
-		$this->set_vat_number( $value );
2866
+     * Set the shipping fee
2867
+     *
2868
+     * @since 1.0.19
2869
+     * @param  float $value shipping amount.
2870
+     */
2871
+    public function set_shipping( $value ) {
2872
+
2873
+        if ( ! is_numeric( $value ) ) {
2874
+            return $this->set_prop( 'shipping', null );
2875
+        }
2876
+
2877
+        $this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2720 2878
     }
2721 2879
 
2722 2880
     /**
2723
-	 * Set the customer's vat rate.
2724
-	 *
2725
-	 * @since 1.0.19
2726
-	 * @param  string $value var rate.
2727
-	 */
2728
-	public function set_vat_rate( $value ) {
2729
-		$this->set_prop( 'vat_rate', $value );
2881
+     * Set the invoice sub total.
2882
+     *
2883
+     * @since 1.0.19
2884
+     * @param  float $value sub total.
2885
+     */
2886
+    public function set_subtotal( $value ) {
2887
+        $this->set_prop( 'subtotal', max( 0, $value ) );
2730 2888
     }
2731 2889
 
2732
-    /**
2733
-	 * Alias of self::set_vat_rate().
2734
-	 *
2735
-	 * @since 1.0.19
2736
-	 * @param  string $value var number.
2737
-	 */
2738
-	public function set_user_vat_rate( $value ) {
2739
-		$this->set_vat_rate( $value );
2740
-    }
2741
-
2742
-    /**
2743
-	 * Alias of self::set_vat_rate().
2744
-	 *
2745
-	 * @since 1.0.19
2746
-	 * @param  string $value var number.
2747
-	 */
2748
-	public function set_customer_vat_rate( $value ) {
2749
-		$this->set_vat_rate( $value );
2750
-    }
2751
-
2752
-    /**
2753
-	 * Set the customer's address.
2754
-	 *
2755
-	 * @since 1.0.19
2756
-	 * @param  string $value address.
2757
-	 */
2758
-	public function set_address( $value ) {
2759
-		$this->set_prop( 'address', $value );
2760
-    }
2761
-
2762
-    /**
2763
-	 * Alias of self::set_address().
2764
-	 *
2765
-	 * @since 1.0.19
2766
-	 * @param  string $value address.
2767
-	 */
2768
-	public function set_user_address( $value ) {
2769
-		$this->set_address( $value );
2770
-    }
2771
-
2772
-    /**
2773
-	 * Alias of self::set_address().
2774
-	 *
2775
-	 * @since 1.0.19
2776
-	 * @param  string $value address.
2777
-	 */
2778
-	public function set_customer_address( $value ) {
2779
-		$this->set_address( $value );
2780
-    }
2781
-
2782
-    /**
2783
-	 * Set whether the customer has viewed the invoice or not.
2784
-	 *
2785
-	 * @since 1.0.19
2786
-	 * @param  int|bool $value confirmed.
2787
-	 */
2788
-	public function set_is_viewed( $value ) {
2789
-		$this->set_prop( 'is_viewed', $value );
2790
-	}
2791
-
2792
-	/**
2793
-	 * Set extra email recipients.
2794
-	 *
2795
-	 * @since 1.0.19
2796
-	 * @param  string $value email recipients.
2797
-	 */
2798
-	public function set_email_cc( $value ) {
2799
-		$this->set_prop( 'email_cc', $value );
2800
-	}
2801
-
2802
-	/**
2803
-	 * Set the invoice template.
2804
-	 *
2805
-	 * @since 1.0.19
2806
-	 * @param  string $value template.
2807
-	 */
2808
-	public function set_template( $value ) {
2809
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2810
-			$this->set_prop( 'template', $value );
2811
-		}
2812
-	}
2813
-
2814
-	/**
2815
-	 * Set the invoice source.
2816
-	 *
2817
-	 * @since 1.0.19
2818
-	 * @param  string $value source.
2819
-	 * @deprecated
2820
-	 */
2821
-	public function created_via( $value ) {
2822
-		$this->set_created_via( sanitize_text_field( $value ) );
2823
-	}
2824
-
2825
-	/**
2826
-	 * Set the invoice source.
2827
-	 *
2828
-	 * @since 1.0.19
2829
-	 * @param  string $value source.
2830
-	 */
2831
-	public function set_created_via( $value ) {
2832
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2833
-	}
2834
-
2835
-	/**
2836
-	 * Set the customer's address confirmed status.
2837
-	 *
2838
-	 * @since 1.0.19
2839
-	 * @param  int|bool $value confirmed.
2840
-	 */
2841
-	public function set_address_confirmed( $value ) {
2842
-		$this->set_prop( 'address_confirmed', $value );
2843
-    }
2844
-
2845
-    /**
2846
-	 * Alias of self::set_address_confirmed().
2847
-	 *
2848
-	 * @since 1.0.19
2849
-	 * @param  int|bool $value confirmed.
2850
-	 */
2851
-	public function set_user_address_confirmed( $value ) {
2852
-		$this->set_address_confirmed( $value );
2853
-    }
2854
-
2855
-    /**
2856
-	 * Alias of self::set_address_confirmed().
2857
-	 *
2858
-	 * @since 1.0.19
2859
-	 * @param  int|bool $value confirmed.
2860
-	 */
2861
-	public function set_customer_address_confirmed( $value ) {
2862
-		$this->set_address_confirmed( $value );
2863
-    }
2864
-
2865
-    /**
2866
-	 * Set the shipping fee
2867
-	 *
2868
-	 * @since 1.0.19
2869
-	 * @param  float $value shipping amount.
2870
-	 */
2871
-	public function set_shipping( $value ) {
2872
-
2873
-		if ( ! is_numeric( $value ) ) {
2874
-			return $this->set_prop( 'shipping', null );
2875
-		}
2876
-
2877
-		$this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2878
-	}
2879
-
2880
-	/**
2881
-	 * Set the invoice sub total.
2882
-	 *
2883
-	 * @since 1.0.19
2884
-	 * @param  float $value sub total.
2885
-	 */
2886
-	public function set_subtotal( $value ) {
2887
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2888
-	}
2889
-
2890
-	/**
2891
-	 * Set the invoice total.
2892
-	 *
2893
-	 * @since 1.0.19
2894
-	 * @param  float $value sub total.
2895
-	 */
2896
-	public function set_total( $value ) {
2897
-		$this->set_prop( 'total', max( 0, $value ) );
2890
+    /**
2891
+     * Set the invoice total.
2892
+     *
2893
+     * @since 1.0.19
2894
+     * @param  float $value sub total.
2895
+     */
2896
+    public function set_total( $value ) {
2897
+        $this->set_prop( 'total', max( 0, $value ) );
2898 2898
     }
2899 2899
 
2900 2900
     /**
2901
-	 * Set the invoice discount amount.
2902
-	 *
2903
-	 * @since 1.0.19
2904
-	 * @param  float $value discount total.
2905
-	 */
2906
-	public function set_total_discount( $value ) {
2907
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2901
+     * Set the invoice discount amount.
2902
+     *
2903
+     * @since 1.0.19
2904
+     * @param  float $value discount total.
2905
+     */
2906
+    public function set_total_discount( $value ) {
2907
+        $this->set_prop( 'total_discount', max( 0, $value ) );
2908 2908
     }
2909 2909
 
2910 2910
     /**
2911
-	 * Alias of self::set_total_discount().
2912
-	 *
2913
-	 * @since 1.0.19
2914
-	 * @param  float $value discount total.
2915
-	 */
2916
-	public function set_discount( $value ) {
2917
-		$this->set_total_discount( $value );
2911
+     * Alias of self::set_total_discount().
2912
+     *
2913
+     * @since 1.0.19
2914
+     * @param  float $value discount total.
2915
+     */
2916
+    public function set_discount( $value ) {
2917
+        $this->set_total_discount( $value );
2918 2918
     }
2919 2919
 
2920 2920
     /**
2921
-	 * Set the invoice tax amount.
2922
-	 *
2923
-	 * @since 1.0.19
2924
-	 * @param  float $value tax total.
2925
-	 */
2926
-	public function set_total_tax( $value ) {
2927
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2921
+     * Set the invoice tax amount.
2922
+     *
2923
+     * @since 1.0.19
2924
+     * @param  float $value tax total.
2925
+     */
2926
+    public function set_total_tax( $value ) {
2927
+        $this->set_prop( 'total_tax', max( 0, $value ) );
2928 2928
     }
2929 2929
 
2930 2930
     /**
2931
-	 * Alias of self::set_total_tax().
2932
-	 *
2933
-	 * @since 1.0.19
2934
-	 * @param  float $value tax total.
2935
-	 */
2936
-	public function set_tax_total( $value ) {
2937
-		$this->set_total_tax( $value );
2931
+     * Alias of self::set_total_tax().
2932
+     *
2933
+     * @since 1.0.19
2934
+     * @param  float $value tax total.
2935
+     */
2936
+    public function set_tax_total( $value ) {
2937
+        $this->set_total_tax( $value );
2938 2938
     }
2939 2939
 
2940 2940
     /**
2941
-	 * Set the invoice fees amount.
2942
-	 *
2943
-	 * @since 1.0.19
2944
-	 * @param  float $value fees total.
2945
-	 */
2946
-	public function set_total_fees( $value ) {
2947
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2941
+     * Set the invoice fees amount.
2942
+     *
2943
+     * @since 1.0.19
2944
+     * @param  float $value fees total.
2945
+     */
2946
+    public function set_total_fees( $value ) {
2947
+        $this->set_prop( 'total_fees', max( 0, $value ) );
2948 2948
     }
2949 2949
 
2950 2950
     /**
2951
-	 * Alias of self::set_total_fees().
2952
-	 *
2953
-	 * @since 1.0.19
2954
-	 * @param  float $value fees total.
2955
-	 */
2956
-	public function set_fees_total( $value ) {
2957
-		$this->set_total_fees( $value );
2951
+     * Alias of self::set_total_fees().
2952
+     *
2953
+     * @since 1.0.19
2954
+     * @param  float $value fees total.
2955
+     */
2956
+    public function set_fees_total( $value ) {
2957
+        $this->set_total_fees( $value );
2958 2958
     }
2959 2959
 
2960 2960
     /**
2961
-	 * Set the invoice fees.
2962
-	 *
2963
-	 * @since 1.0.19
2964
-	 * @param  array $value fees.
2965
-	 */
2966
-	public function set_fees( $value ) {
2961
+     * Set the invoice fees.
2962
+     *
2963
+     * @since 1.0.19
2964
+     * @param  array $value fees.
2965
+     */
2966
+    public function set_fees( $value ) {
2967 2967
 
2968
-		if ( ! is_array( $value ) ) {
2969
-			$value = array();
2970
-		}
2968
+        if ( ! is_array( $value ) ) {
2969
+            $value = array();
2970
+        }
2971 2971
 
2972
-		$this->set_prop( 'fees', $value );
2972
+        $this->set_prop( 'fees', $value );
2973 2973
 
2974 2974
     }
2975 2975
 
2976 2976
     /**
2977
-	 * Set the invoice taxes.
2978
-	 *
2979
-	 * @since 1.0.19
2980
-	 * @param  array $value taxes.
2981
-	 */
2982
-	public function set_taxes( $value ) {
2977
+     * Set the invoice taxes.
2978
+     *
2979
+     * @since 1.0.19
2980
+     * @param  array $value taxes.
2981
+     */
2982
+    public function set_taxes( $value ) {
2983 2983
 
2984
-		if ( ! is_array( $value ) ) {
2985
-			$value = array();
2986
-		}
2984
+        if ( ! is_array( $value ) ) {
2985
+            $value = array();
2986
+        }
2987 2987
 
2988
-		$this->set_prop( 'taxes', $value );
2988
+        $this->set_prop( 'taxes', $value );
2989 2989
 
2990 2990
     }
2991 2991
 
2992 2992
     /**
2993
-	 * Set the invoice discounts.
2994
-	 *
2995
-	 * @since 1.0.19
2996
-	 * @param  array $value discounts.
2997
-	 */
2998
-	public function set_discounts( $value ) {
2993
+     * Set the invoice discounts.
2994
+     *
2995
+     * @since 1.0.19
2996
+     * @param  array $value discounts.
2997
+     */
2998
+    public function set_discounts( $value ) {
2999 2999
 
3000
-		if ( ! is_array( $value ) ) {
3001
-			$value = array();
3002
-		}
3000
+        if ( ! is_array( $value ) ) {
3001
+            $value = array();
3002
+        }
3003 3003
 
3004
-		$this->set_prop( 'discounts', $value );
3004
+        $this->set_prop( 'discounts', $value );
3005 3005
     }
3006 3006
 
3007 3007
     /**
3008
-	 * Set the invoice items.
3009
-	 *
3010
-	 * @since 1.0.19
3011
-	 * @param  GetPaid_Form_Item[] $value items.
3012
-	 */
3013
-	public function set_items( $value ) {
3008
+     * Set the invoice items.
3009
+     *
3010
+     * @since 1.0.19
3011
+     * @param  GetPaid_Form_Item[] $value items.
3012
+     */
3013
+    public function set_items( $value ) {
3014 3014
 
3015 3015
         // Remove existing items.
3016 3016
         $this->set_prop( 'items', array() );
3017
-		$this->recurring_item = null;
3017
+        $this->recurring_item = null;
3018 3018
 
3019 3019
         // Ensure that we have an array.
3020 3020
         if ( ! is_array( $value ) ) {
@@ -3028,95 +3028,95 @@  discard block
 block discarded – undo
3028 3028
     }
3029 3029
 
3030 3030
     /**
3031
-	 * Set the payment form.
3032
-	 *
3033
-	 * @since 1.0.19
3034
-	 * @param  int $value payment form.
3035
-	 */
3036
-	public function set_payment_form( $value ) {
3037
-		$this->set_prop( 'payment_form', $value );
3031
+     * Set the payment form.
3032
+     *
3033
+     * @since 1.0.19
3034
+     * @param  int $value payment form.
3035
+     */
3036
+    public function set_payment_form( $value ) {
3037
+        $this->set_prop( 'payment_form', $value );
3038 3038
     }
3039 3039
 
3040 3040
     /**
3041
-	 * Set the submission id.
3042
-	 *
3043
-	 * @since 1.0.19
3044
-	 * @param  string $value submission id.
3045
-	 */
3046
-	public function set_submission_id( $value ) {
3047
-		$this->set_prop( 'submission_id', $value );
3041
+     * Set the submission id.
3042
+     *
3043
+     * @since 1.0.19
3044
+     * @param  string $value submission id.
3045
+     */
3046
+    public function set_submission_id( $value ) {
3047
+        $this->set_prop( 'submission_id', $value );
3048 3048
     }
3049 3049
 
3050 3050
     /**
3051
-	 * Set the discount code.
3052
-	 *
3053
-	 * @since 1.0.19
3054
-	 * @param  string $value discount code.
3055
-	 */
3056
-	public function set_discount_code( $value ) {
3057
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3051
+     * Set the discount code.
3052
+     *
3053
+     * @since 1.0.19
3054
+     * @param  string $value discount code.
3055
+     */
3056
+    public function set_discount_code( $value ) {
3057
+        $this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3058 3058
     }
3059 3059
 
3060 3060
     /**
3061
-	 * Set the gateway.
3062
-	 *
3063
-	 * @since 1.0.19
3064
-	 * @param  string $value gateway.
3065
-	 */
3066
-	public function set_gateway( $value ) {
3067
-		$this->set_prop( 'gateway', $value );
3061
+     * Set the gateway.
3062
+     *
3063
+     * @since 1.0.19
3064
+     * @param  string $value gateway.
3065
+     */
3066
+    public function set_gateway( $value ) {
3067
+        $this->set_prop( 'gateway', $value );
3068 3068
     }
3069 3069
 
3070 3070
     /**
3071
-	 * Set the transaction id.
3072
-	 *
3073
-	 * @since 1.0.19
3074
-	 * @param  string $value transaction id.
3075
-	 */
3076
-	public function set_transaction_id( $value ) {
3077
-		if ( ! empty( $value ) ) {
3078
-			$this->set_prop( 'transaction_id', $value );
3079
-		}
3071
+     * Set the transaction id.
3072
+     *
3073
+     * @since 1.0.19
3074
+     * @param  string $value transaction id.
3075
+     */
3076
+    public function set_transaction_id( $value ) {
3077
+        if ( ! empty( $value ) ) {
3078
+            $this->set_prop( 'transaction_id', $value );
3079
+        }
3080 3080
     }
3081 3081
 
3082 3082
     /**
3083
-	 * Set the currency id.
3084
-	 *
3085
-	 * @since 1.0.19
3086
-	 * @param  string $value currency id.
3087
-	 */
3088
-	public function set_currency( $value ) {
3089
-		$this->set_prop( 'currency', $value );
3083
+     * Set the currency id.
3084
+     *
3085
+     * @since 1.0.19
3086
+     * @param  string $value currency id.
3087
+     */
3088
+    public function set_currency( $value ) {
3089
+        $this->set_prop( 'currency', $value );
3090 3090
     }
3091 3091
 
3092
-	/**
3093
-	 * Set whether to disable taxes.
3094
-	 *
3095
-	 * @since 1.0.19
3096
-	 * @param  bool $value value.
3097
-	 */
3098
-	public function set_disable_taxes( $value ) {
3099
-		$this->set_prop( 'disable_taxes', (bool) $value );
3100
-	}
3092
+    /**
3093
+     * Set whether to disable taxes.
3094
+     *
3095
+     * @since 1.0.19
3096
+     * @param  bool $value value.
3097
+     */
3098
+    public function set_disable_taxes( $value ) {
3099
+        $this->set_prop( 'disable_taxes', (bool) $value );
3100
+    }
3101 3101
 
3102 3102
     /**
3103
-	 * Set the subscription id.
3104
-	 *
3105
-	 * @since 1.0.19
3106
-	 * @param  string $value subscription id.
3107
-	 */
3108
-	public function set_subscription_id( $value ) {
3109
-		$this->set_prop( 'subscription_id', $value );
3110
-	}
3103
+     * Set the subscription id.
3104
+     *
3105
+     * @since 1.0.19
3106
+     * @param  string $value subscription id.
3107
+     */
3108
+    public function set_subscription_id( $value ) {
3109
+        $this->set_prop( 'subscription_id', $value );
3110
+    }
3111 3111
 
3112
-	/**
3113
-	 * Set the remote subscription id.
3114
-	 *
3115
-	 * @since 1.0.19
3116
-	 * @param  string $value subscription id.
3117
-	 */
3118
-	public function set_remote_subscription_id( $value ) {
3119
-		$this->set_prop( 'remote_subscription_id', $value );
3112
+    /**
3113
+     * Set the remote subscription id.
3114
+     *
3115
+     * @since 1.0.19
3116
+     * @param  string $value subscription id.
3117
+     */
3118
+    public function set_remote_subscription_id( $value ) {
3119
+        $this->set_prop( 'remote_subscription_id', $value );
3120 3120
     }
3121 3121
 
3122 3122
     /*
@@ -3155,24 +3155,24 @@  discard block
 block discarded – undo
3155 3155
      */
3156 3156
     public function is_taxable() {
3157 3157
         return ! $this->get_disable_taxes();
3158
-	}
3158
+    }
3159 3159
 
3160
-	/**
3161
-	 * @deprecated
3162
-	 */
3163
-	public function has_vat() {
3160
+    /**
3161
+     * @deprecated
3162
+     */
3163
+    public function has_vat() {
3164 3164
         return $this->is_taxable();
3165
-	}
3165
+    }
3166 3166
 
3167
-	/**
3168
-	 * Checks to see if the invoice requires payment.
3169
-	 */
3170
-	public function is_free() {
3167
+    /**
3168
+     * Checks to see if the invoice requires payment.
3169
+     */
3170
+    public function is_free() {
3171 3171
         $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3172 3172
 
3173
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3174
-			$is_free = false;
3175
-		}
3173
+        if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3174
+            $is_free = false;
3175
+        }
3176 3176
 
3177 3177
         return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3178 3178
     }
@@ -3183,46 +3183,46 @@  discard block
 block discarded – undo
3183 3183
     public function is_paid() {
3184 3184
         $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3185 3185
         return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3186
-	}
3186
+    }
3187 3187
 
3188
-	/**
3188
+    /**
3189 3189
      * Checks if the invoice needs payment.
3190 3190
      */
3191
-	public function needs_payment() {
3192
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3191
+    public function needs_payment() {
3192
+        $needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3193 3193
         return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3194 3194
     }
3195 3195
 
3196
-	/**
3196
+    /**
3197 3197
      * Checks if the invoice is refunded.
3198 3198
      */
3199
-	public function is_refunded() {
3199
+    public function is_refunded() {
3200 3200
         $is_refunded = $this->has_status( 'wpi-refunded' );
3201 3201
         return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3202
-	}
3202
+    }
3203 3203
 
3204
-	/**
3204
+    /**
3205 3205
      * Checks if the invoice is held.
3206 3206
      */
3207
-	public function is_held() {
3207
+    public function is_held() {
3208 3208
         $is_held = $this->has_status( 'wpi-onhold' );
3209 3209
         return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3210
-	}
3210
+    }
3211 3211
 
3212
-	/**
3212
+    /**
3213 3213
      * Checks if the invoice is due.
3214 3214
      */
3215
-	public function is_due() {
3216
-		$due_date = $this->get_due_date();
3217
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3218
-	}
3215
+    public function is_due() {
3216
+        $due_date = $this->get_due_date();
3217
+        return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3218
+    }
3219 3219
 
3220
-	/**
3220
+    /**
3221 3221
      * Checks if the invoice is draft.
3222 3222
      */
3223
-	public function is_draft() {
3223
+    public function is_draft() {
3224 3224
         return $this->has_status( 'draft, auto-draft' );
3225
-	}
3225
+    }
3226 3226
 
3227 3227
     /**
3228 3228
      * Checks if the invoice has a given status.
@@ -3230,9 +3230,9 @@  discard block
 block discarded – undo
3230 3230
     public function has_status( $status ) {
3231 3231
         $status = wpinv_parse_list( $status );
3232 3232
         return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3233
-	}
3233
+    }
3234 3234
 
3235
-	/**
3235
+    /**
3236 3236
      * Checks if the invoice is of a given type.
3237 3237
      */
3238 3238
     public function is_type( $type ) {
@@ -3255,25 +3255,25 @@  discard block
 block discarded – undo
3255 3255
      */
3256 3256
     public function has_free_trial() {
3257 3257
         return $this->is_recurring() && 0 == $this->get_initial_total();
3258
-	}
3258
+    }
3259 3259
 
3260
-	/**
3260
+    /**
3261 3261
      * @deprecated
3262 3262
      */
3263 3263
     public function is_free_trial() {
3264 3264
         $this->has_free_trial();
3265 3265
     }
3266 3266
 
3267
-	/**
3267
+    /**
3268 3268
      * Check if the initial payment if 0.
3269 3269
      *
3270 3270
      */
3271
-	public function is_initial_free() {
3271
+    public function is_initial_free() {
3272 3272
         $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3273 3273
         return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3274 3274
     }
3275 3275
 
3276
-	/**
3276
+    /**
3277 3277
      * Check if the recurring item has a free trial.
3278 3278
      *
3279 3279
      */
@@ -3286,21 +3286,21 @@  discard block
 block discarded – undo
3286 3286
 
3287 3287
         $item = $this->get_recurring( true );
3288 3288
         return $item->has_free_trial();
3289
-	}
3289
+    }
3290 3290
 
3291
-	/**
3291
+    /**
3292 3292
      * Check if the free trial is a result of a discount.
3293 3293
      */
3294 3294
     public function is_free_trial_from_discount() {
3295
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3296
-	}
3295
+        return $this->has_free_trial() && ! $this->item_has_free_trial();
3296
+    }
3297 3297
 
3298
-	/**
3298
+    /**
3299 3299
      * @deprecated
3300 3300
      */
3301 3301
     public function discount_first_payment_only() {
3302 3302
 
3303
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3303
+        $discount = wpinv_get_discount_obj( $this->get_discount_code() );
3304 3304
         if ( ! $discount->exists() || ! $this->is_recurring() ) {
3305 3305
             return true;
3306 3306
         }
@@ -3325,146 +3325,146 @@  discard block
 block discarded – undo
3325 3325
      */
3326 3326
     public function add_item( $item ) {
3327 3327
 
3328
-		if ( is_array( $item ) ) {
3329
-			$item = $this->process_array_item( $item );
3330
-		}
3328
+        if ( is_array( $item ) ) {
3329
+            $item = $this->process_array_item( $item );
3330
+        }
3331 3331
 
3332
-		if ( is_numeric( $item ) ) {
3333
-			$item = new GetPaid_Form_Item( $item );
3334
-		}
3332
+        if ( is_numeric( $item ) ) {
3333
+            $item = new GetPaid_Form_Item( $item );
3334
+        }
3335 3335
 
3336 3336
         // Make sure that it is available for purchase.
3337
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3338
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3337
+        if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3338
+            return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3339 3339
         }
3340 3340
 
3341 3341
         // Do we have a recurring item?
3342
-		if ( $item->is_recurring() ) {
3343
-			$this->recurring_item = $item->get_id();
3342
+        if ( $item->is_recurring() ) {
3343
+            $this->recurring_item = $item->get_id();
3344 3344
         }
3345 3345
 
3346 3346
         // Invoice id.
3347 3347
         $item->invoice_id = (int) $this->get_id();
3348 3348
 
3349
-		// Remove duplicates.
3350
-		$this->remove_item( $item->get_id() );
3349
+        // Remove duplicates.
3350
+        $this->remove_item( $item->get_id() );
3351 3351
 
3352
-		if ( 0 == $item->get_quantity() ) {
3353
-			return;
3354
-		}
3352
+        if ( 0 == $item->get_quantity() ) {
3353
+            return;
3354
+        }
3355 3355
 
3356
-		// Retrieve all items.
3356
+        // Retrieve all items.
3357 3357
         $items   = $this->get_items();
3358 3358
 
3359
-		// Add new item.
3359
+        // Add new item.
3360 3360
         $items[] = $item;
3361 3361
 
3362 3362
         $this->set_prop( 'items', $items );
3363 3363
 
3364
-		return true;
3365
-	}
3364
+        return true;
3365
+    }
3366 3366
 
3367
-	/**
3368
-	 * Converts an array to an item.
3369
-	 *
3370
-	 * @since 1.0.19
3371
-	 * @return GetPaid_Form_Item
3372
-	 */
3373
-	protected function process_array_item( $array ) {
3367
+    /**
3368
+     * Converts an array to an item.
3369
+     *
3370
+     * @since 1.0.19
3371
+     * @return GetPaid_Form_Item
3372
+     */
3373
+    protected function process_array_item( $array ) {
3374 3374
 
3375
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3376
-		$item    = new GetPaid_Form_Item( $item_id );
3375
+        $item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3376
+        $item    = new GetPaid_Form_Item( $item_id );
3377 3377
 
3378
-		// Set item data.
3379
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3380
-			if ( isset( $array[ "item_$key" ] ) ) {
3381
-				$method = "set_$key";
3382
-				$item->$method( $array[ "item_$key" ] );
3383
-			}
3384
-		}
3378
+        // Set item data.
3379
+        foreach ( array( 'name', 'price', 'description' ) as $key ) {
3380
+            if ( isset( $array[ "item_$key" ] ) ) {
3381
+                $method = "set_$key";
3382
+                $item->$method( $array[ "item_$key" ] );
3383
+            }
3384
+        }
3385 3385
 
3386
-		if ( isset( $array['quantity'] ) ) {
3387
-			$item->set_quantity( $array['quantity'] );
3388
-		}
3386
+        if ( isset( $array['quantity'] ) ) {
3387
+            $item->set_quantity( $array['quantity'] );
3388
+        }
3389 3389
 
3390
-		// Set item meta.
3391
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3392
-			$item->set_item_meta( $array['meta'] );
3393
-		}
3390
+        // Set item meta.
3391
+        if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3392
+            $item->set_item_meta( $array['meta'] );
3393
+        }
3394 3394
 
3395
-		return $item;
3395
+        return $item;
3396 3396
 
3397
-	}
3397
+    }
3398 3398
 
3399 3399
     /**
3400
-	 * Retrieves a specific item.
3401
-	 *
3402
-	 * @since 1.0.19
3403
-	 * @return GetPaid_Form_Item|null
3404
-	 */
3405
-	public function get_item( $item_id ) {
3400
+     * Retrieves a specific item.
3401
+     *
3402
+     * @since 1.0.19
3403
+     * @return GetPaid_Form_Item|null
3404
+     */
3405
+    public function get_item( $item_id ) {
3406 3406
 
3407
-		foreach ( $this->get_items() as $item ) {
3408
-			if ( (int) $item_id == $item->get_id() ) {
3409
-				return $item;
3410
-			}
3411
-		}
3407
+        foreach ( $this->get_items() as $item ) {
3408
+            if ( (int) $item_id == $item->get_id() ) {
3409
+                return $item;
3410
+            }
3411
+        }
3412 3412
 
3413
-		return null;
3413
+        return null;
3414 3414
     }
3415 3415
 
3416 3416
     /**
3417
-	 * Removes a specific item.
3418
-	 *
3419
-	 * @since 1.0.19
3420
-	 */
3421
-	public function remove_item( $item_id ) {
3422
-		$items   = $this->get_items();
3423
-		$item_id = (int) $item_id;
3417
+     * Removes a specific item.
3418
+     *
3419
+     * @since 1.0.19
3420
+     */
3421
+    public function remove_item( $item_id ) {
3422
+        $items   = $this->get_items();
3423
+        $item_id = (int) $item_id;
3424 3424
 
3425
-		foreach ( $items as $index => $item ) {
3426
-			if ( (int) $item_id == $item->get_id() ) {
3427
-				unset( $items[ $index ] );
3428
-				$this->set_prop( 'items', $items );
3425
+        foreach ( $items as $index => $item ) {
3426
+            if ( (int) $item_id == $item->get_id() ) {
3427
+                unset( $items[ $index ] );
3428
+                $this->set_prop( 'items', $items );
3429 3429
 
3430
-				if ( $item_id == $this->recurring_item ) {
3431
-					$this->recurring_item = null;
3432
-				}
3430
+                if ( $item_id == $this->recurring_item ) {
3431
+                    $this->recurring_item = null;
3432
+                }
3433 3433
 }
3434
-		}
3434
+        }
3435 3435
 
3436 3436
     }
3437 3437
 
3438 3438
     /**
3439
-	 * Adds a fee to the invoice.
3440
-	 *
3441
-	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3442
-	 * @since 1.0.19
3443
-	 */
3439
+     * Adds a fee to the invoice.
3440
+     *
3441
+     * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3442
+     * @since 1.0.19
3443
+     */
3444 3444
     public function add_fee( $fee ) {
3445 3445
 
3446
-		$fees                 = $this->get_fees();
3447
-		$fees[ $fee['name'] ] = $fee;
3448
-		$this->set_prop( 'fees', $fees );
3446
+        $fees                 = $this->get_fees();
3447
+        $fees[ $fee['name'] ] = $fee;
3448
+        $this->set_prop( 'fees', $fees );
3449 3449
 
3450 3450
     }
3451 3451
 
3452 3452
     /**
3453
-	 * Retrieves a specific fee.
3454
-	 *
3455
-	 * @since 1.0.19
3456
-	 */
3457
-	public function get_fee( $fee ) {
3453
+     * Retrieves a specific fee.
3454
+     *
3455
+     * @since 1.0.19
3456
+     */
3457
+    public function get_fee( $fee ) {
3458 3458
         $fees = $this->get_fees();
3459
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3459
+        return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3460 3460
     }
3461 3461
 
3462 3462
     /**
3463
-	 * Removes a specific fee.
3464
-	 *
3465
-	 * @since 1.0.19
3466
-	 */
3467
-	public function remove_fee( $fee ) {
3463
+     * Removes a specific fee.
3464
+     *
3465
+     * @since 1.0.19
3466
+     */
3467
+    public function remove_fee( $fee ) {
3468 3468
         $fees = $this->get_fees();
3469 3469
         if ( isset( $fees[ $fee ] ) ) {
3470 3470
             unset( $fees[ $fee ] );
@@ -3472,55 +3472,55 @@  discard block
 block discarded – undo
3472 3472
         }
3473 3473
     }
3474 3474
 
3475
-	/**
3476
-	 * Adds a discount to the invoice.
3477
-	 *
3478
-	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3479
-	 * @since 1.0.19
3480
-	 */
3481
-	public function add_discount( $discount ) {
3475
+    /**
3476
+     * Adds a discount to the invoice.
3477
+     *
3478
+     * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3479
+     * @since 1.0.19
3480
+     */
3481
+    public function add_discount( $discount ) {
3482 3482
 
3483
-		$discounts = $this->get_discounts();
3484
-		$discounts[ $discount['name'] ] = $discount;
3485
-		$this->set_prop( 'discounts', $discounts );
3483
+        $discounts = $this->get_discounts();
3484
+        $discounts[ $discount['name'] ] = $discount;
3485
+        $this->set_prop( 'discounts', $discounts );
3486 3486
 
3487
-	}
3487
+    }
3488 3488
 
3489 3489
     /**
3490
-	 * Retrieves a specific discount.
3491
-	 *
3492
-	 * @since 1.0.19
3493
-	 * @return float
3494
-	 */
3495
-	public function get_discount( $discount = false ) {
3490
+     * Retrieves a specific discount.
3491
+     *
3492
+     * @since 1.0.19
3493
+     * @return float
3494
+     */
3495
+    public function get_discount( $discount = false ) {
3496 3496
 
3497
-		// Backwards compatibilty.
3498
-		if ( empty( $discount ) ) {
3499
-			return $this->get_total_discount();
3500
-		}
3497
+        // Backwards compatibilty.
3498
+        if ( empty( $discount ) ) {
3499
+            return $this->get_total_discount();
3500
+        }
3501 3501
 
3502 3502
         $discounts = $this->get_discounts();
3503
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3503
+        return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3504 3504
     }
3505 3505
 
3506 3506
     /**
3507
-	 * Removes a specific discount.
3508
-	 *
3509
-	 * @since 1.0.19
3510
-	 */
3511
-	public function remove_discount( $discount ) {
3507
+     * Removes a specific discount.
3508
+     *
3509
+     * @since 1.0.19
3510
+     */
3511
+    public function remove_discount( $discount ) {
3512 3512
         $discounts = $this->get_discounts();
3513 3513
         if ( isset( $discounts[ $discount ] ) ) {
3514 3514
             unset( $discounts[ $discount ] );
3515 3515
             $this->set_prop( 'discounts', $discounts );
3516 3516
         }
3517 3517
 
3518
-		if ( 'discount_code' == $discount ) {
3519
-			foreach ( $this->get_items() as $item ) {
3520
-				$item->item_discount           = 0;
3521
-				$item->recurring_item_discount = 0;
3522
-			}
3523
-		}
3518
+        if ( 'discount_code' == $discount ) {
3519
+            foreach ( $this->get_items() as $item ) {
3520
+                $item->item_discount           = 0;
3521
+                $item->recurring_item_discount = 0;
3522
+            }
3523
+        }
3524 3524
 
3525 3525
     }
3526 3526
 
@@ -3533,34 +3533,34 @@  discard block
 block discarded – undo
3533 3533
         if ( $this->is_taxable() ) {
3534 3534
 
3535 3535
             $taxes                 = $this->get_taxes();
3536
-			$taxes[ $tax['name'] ] = $tax;
3537
-			$this->set_prop( 'taxes', $tax );
3536
+            $taxes[ $tax['name'] ] = $tax;
3537
+            $this->set_prop( 'taxes', $tax );
3538 3538
 
3539 3539
         }
3540 3540
     }
3541 3541
 
3542 3542
     /**
3543
-	 * Retrieves a specific tax.
3544
-	 *
3545
-	 * @since 1.0.19
3546
-	 */
3547
-	public function get_tax( $tax = null ) {
3543
+     * Retrieves a specific tax.
3544
+     *
3545
+     * @since 1.0.19
3546
+     */
3547
+    public function get_tax( $tax = null ) {
3548 3548
 
3549
-		// Backwards compatility.
3550
-		if ( empty( $tax ) ) {
3551
-			return $this->get_total_tax();
3552
-		}
3549
+        // Backwards compatility.
3550
+        if ( empty( $tax ) ) {
3551
+            return $this->get_total_tax();
3552
+        }
3553 3553
 
3554 3554
         $taxes = $this->get_taxes();
3555
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3555
+        return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3556 3556
     }
3557 3557
 
3558 3558
     /**
3559
-	 * Removes a specific tax.
3560
-	 *
3561
-	 * @since 1.0.19
3562
-	 */
3563
-	public function remove_tax( $tax ) {
3559
+     * Removes a specific tax.
3560
+     *
3561
+     * @since 1.0.19
3562
+     */
3563
+    public function remove_tax( $tax ) {
3564 3564
         $taxes = $this->get_taxes();
3565 3565
         if ( isset( $taxes[ $tax ] ) ) {
3566 3566
             unset( $taxes[ $tax ] );
@@ -3569,184 +3569,184 @@  discard block
 block discarded – undo
3569 3569
     }
3570 3570
 
3571 3571
     /**
3572
-	 * Recalculates the invoice subtotal.
3573
-	 *
3574
-	 * @since 1.0.19
3575
-	 * @return float The recalculated subtotal
3576
-	 */
3577
-	public function recalculate_subtotal() {
3572
+     * Recalculates the invoice subtotal.
3573
+     *
3574
+     * @since 1.0.19
3575
+     * @return float The recalculated subtotal
3576
+     */
3577
+    public function recalculate_subtotal() {
3578 3578
         $items     = $this->get_items();
3579
-		$subtotal  = 0;
3580
-		$recurring = 0;
3579
+        $subtotal  = 0;
3580
+        $recurring = 0;
3581 3581
 
3582 3582
         foreach ( $items as $item ) {
3583
-			$subtotal  += $item->get_sub_total( 'edit' );
3584
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3583
+            $subtotal  += $item->get_sub_total( 'edit' );
3584
+            $recurring += $item->get_recurring_sub_total( 'edit' );
3585 3585
         }
3586 3586
 
3587
-		if ( wpinv_prices_include_tax() ) {
3588
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3589
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3590
-		}
3587
+        if ( wpinv_prices_include_tax() ) {
3588
+            $subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3589
+            $recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3590
+        }
3591 3591
 
3592
-		$current = $this->is_renewal() ? $recurring : $subtotal;
3593
-		$this->set_subtotal( $current );
3592
+        $current = $this->is_renewal() ? $recurring : $subtotal;
3593
+        $this->set_subtotal( $current );
3594 3594
 
3595
-		$this->totals['subtotal'] = array(
3596
-			'initial'   => $subtotal,
3597
-			'recurring' => $recurring,
3598
-		);
3595
+        $this->totals['subtotal'] = array(
3596
+            'initial'   => $subtotal,
3597
+            'recurring' => $recurring,
3598
+        );
3599 3599
 
3600 3600
         return $current;
3601 3601
     }
3602 3602
 
3603 3603
     /**
3604
-	 * Recalculates the invoice discount total.
3605
-	 *
3606
-	 * @since 1.0.19
3607
-	 * @return float The recalculated discount
3608
-	 */
3609
-	public function recalculate_total_discount() {
3604
+     * Recalculates the invoice discount total.
3605
+     *
3606
+     * @since 1.0.19
3607
+     * @return float The recalculated discount
3608
+     */
3609
+    public function recalculate_total_discount() {
3610 3610
         $discounts = $this->get_discounts();
3611
-		$discount  = 0;
3612
-		$recurring = 0;
3611
+        $discount  = 0;
3612
+        $recurring = 0;
3613 3613
 
3614 3614
         foreach ( $discounts as $data ) {
3615
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3616
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3617
-		}
3615
+            $discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3616
+            $recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3617
+        }
3618 3618
 
3619
-		$current = $this->is_renewal() ? $recurring : $discount;
3619
+        $current = $this->is_renewal() ? $recurring : $discount;
3620 3620
 
3621
-		$this->set_total_discount( $current );
3621
+        $this->set_total_discount( $current );
3622 3622
 
3623
-		$this->totals['discount'] = array(
3624
-			'initial'   => $discount,
3625
-			'recurring' => $recurring,
3626
-		);
3623
+        $this->totals['discount'] = array(
3624
+            'initial'   => $discount,
3625
+            'recurring' => $recurring,
3626
+        );
3627 3627
 
3628
-		return $current;
3628
+        return $current;
3629 3629
 
3630 3630
     }
3631 3631
 
3632 3632
     /**
3633
-	 * Recalculates the invoice tax total.
3634
-	 *
3635
-	 * @since 1.0.19
3636
-	 * @return float The recalculated tax
3637
-	 */
3638
-	public function recalculate_total_tax() {
3633
+     * Recalculates the invoice tax total.
3634
+     *
3635
+     * @since 1.0.19
3636
+     * @return float The recalculated tax
3637
+     */
3638
+    public function recalculate_total_tax() {
3639 3639
 
3640
-		// Maybe disable taxes.
3641
-		$vat_number = $this->get_vat_number();
3642
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3640
+        // Maybe disable taxes.
3641
+        $vat_number = $this->get_vat_number();
3642
+        $skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3643 3643
 
3644
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3645
-			$skip_tax = false;
3646
-		}
3644
+        if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3645
+            $skip_tax = false;
3646
+        }
3647 3647
 
3648
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3648
+        if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3649 3649
 
3650
-			$this->totals['tax'] = array(
3651
-				'initial'   => 0,
3652
-				'recurring' => 0,
3653
-			);
3650
+            $this->totals['tax'] = array(
3651
+                'initial'   => 0,
3652
+                'recurring' => 0,
3653
+            );
3654 3654
 
3655
-			$this->tax_rate = 0;
3655
+            $this->tax_rate = 0;
3656 3656
 
3657
-			$this->set_taxes( array() );
3658
-			$current = 0;
3659
-		} else {
3657
+            $this->set_taxes( array() );
3658
+            $current = 0;
3659
+        } else {
3660 3660
 
3661
-			$item_taxes = array();
3661
+            $item_taxes = array();
3662 3662
 
3663
-			foreach ( $this->get_items() as $item ) {
3664
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3665
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3666
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3667
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3668
-				foreach ( $taxes as $name => $amount ) {
3669
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3670
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3663
+            foreach ( $this->get_items() as $item ) {
3664
+                $rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3665
+                $rates    = getpaid_filter_item_tax_rates( $item, $rates );
3666
+                $taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3667
+                $r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3668
+                foreach ( $taxes as $name => $amount ) {
3669
+                    $recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3670
+                    $tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3671 3671
 
3672
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3673
-						$item_taxes[ $name ] = $tax;
3674
-						continue;
3675
-					}
3672
+                    if ( ! isset( $item_taxes[ $name ] ) ) {
3673
+                        $item_taxes[ $name ] = $tax;
3674
+                        continue;
3675
+                    }
3676 3676
 
3677
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3678
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3677
+                    $item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3678
+                    $item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3679 3679
 
3680
-				}
3681
-			}
3680
+                }
3681
+            }
3682 3682
 
3683
-			$item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3684
-			$this->set_taxes( $item_taxes );
3683
+            $item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3684
+            $this->set_taxes( $item_taxes );
3685 3685
 
3686
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3687
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3686
+            $initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3687
+            $recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3688 3688
 
3689
-			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3689
+            $current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3690 3690
 
3691
-			$this->totals['tax'] = array(
3692
-				'initial'   => $initial_tax,
3693
-				'recurring' => $recurring_tax,
3694
-			);
3691
+            $this->totals['tax'] = array(
3692
+                'initial'   => $initial_tax,
3693
+                'recurring' => $recurring_tax,
3694
+            );
3695 3695
 
3696
-		}
3696
+        }
3697 3697
 
3698
-		$this->set_total_tax( $current );
3698
+        $this->set_total_tax( $current );
3699 3699
 
3700
-		return $current;
3700
+        return $current;
3701 3701
 
3702 3702
     }
3703 3703
 
3704 3704
     /**
3705
-	 * Recalculates the invoice fees total.
3706
-	 *
3707
-	 * @since 1.0.19
3708
-	 * @return float The recalculated fee
3709
-	 */
3710
-	public function recalculate_total_fees() {
3711
-		$fees      = $this->get_fees();
3712
-		$fee       = 0;
3713
-		$recurring = 0;
3705
+     * Recalculates the invoice fees total.
3706
+     *
3707
+     * @since 1.0.19
3708
+     * @return float The recalculated fee
3709
+     */
3710
+    public function recalculate_total_fees() {
3711
+        $fees      = $this->get_fees();
3712
+        $fee       = 0;
3713
+        $recurring = 0;
3714 3714
 
3715 3715
         foreach ( $fees as $data ) {
3716
-			$fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3717
-			$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3718
-		}
3716
+            $fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3717
+            $recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3718
+        }
3719 3719
 
3720
-		$current = $this->is_renewal() ? $recurring : $fee;
3721
-		$this->set_total_fees( $current );
3720
+        $current = $this->is_renewal() ? $recurring : $fee;
3721
+        $this->set_total_fees( $current );
3722 3722
 
3723
-		$this->totals['fee'] = array(
3724
-			'initial'   => $fee,
3725
-			'recurring' => $recurring,
3726
-		);
3723
+        $this->totals['fee'] = array(
3724
+            'initial'   => $fee,
3725
+            'recurring' => $recurring,
3726
+        );
3727 3727
 
3728 3728
         $this->set_total_fees( $fee );
3729 3729
         return $current;
3730 3730
     }
3731 3731
 
3732 3732
     /**
3733
-	 * Recalculates the invoice total.
3734
-	 *
3735
-	 * @since 1.0.19
3733
+     * Recalculates the invoice total.
3734
+     *
3735
+     * @since 1.0.19
3736 3736
      * @return float The invoice total
3737
-	 */
3738
-	public function recalculate_total() {
3737
+     */
3738
+    public function recalculate_total() {
3739 3739
         $this->recalculate_total_fees();
3740 3740
         $this->recalculate_total_discount();
3741
-		$this->recalculate_total_tax();
3742
-		$this->recalculate_subtotal();
3743
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3744
-		return $this->get_total();
3745
-	}
3746
-
3747
-	/**
3748
-	 * @deprecated
3749
-	 */
3741
+        $this->recalculate_total_tax();
3742
+        $this->recalculate_subtotal();
3743
+        $this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3744
+        return $this->get_total();
3745
+    }
3746
+
3747
+    /**
3748
+     * @deprecated
3749
+     */
3750 3750
     public function recalculate_totals() {
3751 3751
         $this->recalculate_total();
3752 3752
         $this->save( true );
@@ -3760,22 +3760,22 @@  discard block
 block discarded – undo
3760 3760
         return $this->get_data();
3761 3761
     }
3762 3762
 
3763
-	/**
3763
+    /**
3764 3764
      * Adds a system note to an invoice.
3765 3765
      *
3766 3766
      * @param string $note The note being added.
3767
-	 * @return int|false The new note's ID on success, false on failure.
3767
+     * @return int|false The new note's ID on success, false on failure.
3768 3768
      *
3769 3769
      */
3770 3770
     public function add_system_note( $note ) {
3771
-		return $this->add_note( $note, false, false, true );
3772
-	}
3771
+        return $this->add_note( $note, false, false, true );
3772
+    }
3773 3773
 
3774 3774
     /**
3775 3775
      * Adds a note to an invoice.
3776 3776
      *
3777 3777
      * @param string $note The note being added.
3778
-	 * @return int|false The new note's ID on success, false on failure.
3778
+     * @return int|false The new note's ID on success, false on failure.
3779 3779
      *
3780 3780
      */
3781 3781
     public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
@@ -3785,21 +3785,21 @@  discard block
 block discarded – undo
3785 3785
             return false;
3786 3786
         }
3787 3787
 
3788
-		$author       = 'System';
3789
-		$author_email = '[email protected]';
3788
+        $author       = 'System';
3789
+        $author_email = '[email protected]';
3790 3790
 
3791
-		// If this is an admin comment or it has been added by the user.
3792
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3793
-			$user         = get_user_by( 'id', get_current_user_id() );
3791
+        // If this is an admin comment or it has been added by the user.
3792
+        if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3793
+            $user         = get_user_by( 'id', get_current_user_id() );
3794 3794
             $author       = $user->display_name;
3795 3795
             $author_email = $user->user_email;
3796
-		}
3796
+        }
3797 3797
 
3798
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3798
+        return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3799 3799
 
3800
-	}
3800
+    }
3801 3801
 
3802
-	/**
3802
+    /**
3803 3803
      * Generates a unique key for the invoice.
3804 3804
      */
3805 3805
     public function generate_key( $string = '' ) {
@@ -3819,113 +3819,113 @@  discard block
 block discarded – undo
3819 3819
             $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3820 3820
         }
3821 3821
 
3822
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3823
-
3824
-	}
3825
-
3826
-	/**
3827
-	 * Handle the status transition.
3828
-	 */
3829
-	protected function status_transition() {
3830
-		$status_transition = $this->status_transition;
3831
-
3832
-		// Reset status transition variable.
3833
-		$this->status_transition = false;
3834
-
3835
-		if ( $status_transition ) {
3836
-			try {
3837
-
3838
-				// Fire a hook for the status change.
3839
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3840
-
3841
-				// @deprecated this is deprecated and will be removed in the future.
3842
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3843
-
3844
-				if ( ! empty( $status_transition['from'] ) ) {
3845
-
3846
-					/* translators: 1: old invoice status 2: new invoice status */
3847
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3848
-
3849
-					// Fire another hook.
3850
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3851
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3822
+        return wpinv_format_invoice_number( $number, $this->get_post_type() );
3852 3823
 
3853
-					// @deprecated this is deprecated and will be removed in the future.
3854
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3855
-
3856
-					// Note the transition occurred.
3857
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3858
-
3859
-					// Work out if this was for a payment, and trigger a payment_status hook instead.
3860
-					if (
3861
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3862
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3863
-					) {
3864
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3865
-					}
3866
-
3867
-					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3868
-					if (
3869
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3870
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3871
-					) {
3872
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3873
-					}
3874
-				} else {
3875
-					/* translators: %s: new invoice status */
3876
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
3877
-
3878
-					// Note the transition occurred.
3879
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3824
+    }
3880 3825
 
3881
-				}
3882
-			} catch ( Exception $e ) {
3883
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3884
-			}
3885
-		}
3886
-	}
3826
+    /**
3827
+     * Handle the status transition.
3828
+     */
3829
+    protected function status_transition() {
3830
+        $status_transition = $this->status_transition;
3831
+
3832
+        // Reset status transition variable.
3833
+        $this->status_transition = false;
3834
+
3835
+        if ( $status_transition ) {
3836
+            try {
3837
+
3838
+                // Fire a hook for the status change.
3839
+                do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3840
+
3841
+                // @deprecated this is deprecated and will be removed in the future.
3842
+                do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3843
+
3844
+                if ( ! empty( $status_transition['from'] ) ) {
3845
+
3846
+                    /* translators: 1: old invoice status 2: new invoice status */
3847
+                    $transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3848
+
3849
+                    // Fire another hook.
3850
+                    do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3851
+                    do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3852
+
3853
+                    // @deprecated this is deprecated and will be removed in the future.
3854
+                    do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3855
+
3856
+                    // Note the transition occurred.
3857
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3858
+
3859
+                    // Work out if this was for a payment, and trigger a payment_status hook instead.
3860
+                    if (
3861
+                        in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3862
+                        && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3863
+                    ) {
3864
+                        do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3865
+                    }
3866
+
3867
+                    // Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3868
+                    if (
3869
+                        in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3870
+                        && in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3871
+                    ) {
3872
+                        do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3873
+                    }
3874
+                } else {
3875
+                    /* translators: %s: new invoice status */
3876
+                    $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
3877
+
3878
+                    // Note the transition occurred.
3879
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3880
+
3881
+                }
3882
+            } catch ( Exception $e ) {
3883
+                $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3884
+            }
3885
+        }
3886
+    }
3887 3887
 
3888
-	/**
3889
-	 * Updates an invoice status.
3890
-	 */
3891
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3888
+    /**
3889
+     * Updates an invoice status.
3890
+     */
3891
+    public function update_status( $new_status = false, $note = '', $manual = false ) {
3892 3892
 
3893
-		// Fires before updating a status.
3894
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3893
+        // Fires before updating a status.
3894
+        do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3895 3895
 
3896
-		// Update the status.
3897
-		$this->set_status( $new_status, $note, $manual );
3896
+        // Update the status.
3897
+        $this->set_status( $new_status, $note, $manual );
3898 3898
 
3899
-		// Save the order.
3900
-		return $this->save();
3899
+        // Save the order.
3900
+        return $this->save();
3901 3901
 
3902
-	}
3902
+    }
3903 3903
 
3904
-	/**
3905
-	 * @deprecated
3906
-	 */
3907
-	public function refresh_item_ids() {
3904
+    /**
3905
+     * @deprecated
3906
+     */
3907
+    public function refresh_item_ids() {
3908 3908
         $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
3909 3909
         update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3910
-	}
3910
+    }
3911 3911
 
3912
-	/**
3913
-	 * @deprecated
3914
-	 */
3915
-	public function update_items( $temp = false ) {
3912
+    /**
3913
+     * @deprecated
3914
+     */
3915
+    public function update_items( $temp = false ) {
3916 3916
 
3917
-		$this->set_items( $this->get_items() );
3917
+        $this->set_items( $this->get_items() );
3918 3918
 
3919
-		if ( ! $temp ) {
3920
-			$this->save();
3921
-		}
3919
+        if ( ! $temp ) {
3920
+            $this->save();
3921
+        }
3922 3922
 
3923 3923
         return $this;
3924
-	}
3924
+    }
3925 3925
 
3926
-	/**
3927
-	 * @deprecated
3928
-	 */
3926
+    /**
3927
+     * @deprecated
3928
+     */
3929 3929
     public function validate_discount() {
3930 3930
 
3931 3931
         $discount_code = $this->get_discount_code();
@@ -3941,101 +3941,101 @@  discard block
 block discarded – undo
3941 3941
 
3942 3942
     }
3943 3943
 
3944
-	/**
3945
-	 * Refunds an invoice.
3946
-	 */
3944
+    /**
3945
+     * Refunds an invoice.
3946
+     */
3947 3947
     public function refund() {
3948
-		$this->set_status( 'wpi-refunded' );
3948
+        $this->set_status( 'wpi-refunded' );
3949 3949
         $this->save();
3950
-	}
3950
+    }
3951 3951
 
3952
-	/**
3953
-	 * Marks an invoice as paid.
3954
-	 *
3955
-	 * @param string $transaction_id
3956
-	 */
3952
+    /**
3953
+     * Marks an invoice as paid.
3954
+     *
3955
+     * @param string $transaction_id
3956
+     */
3957 3957
     public function mark_paid( $transaction_id = null, $note = '' ) {
3958 3958
 
3959
-		// Set the transaction id.
3960
-		if ( empty( $transaction_id ) ) {
3961
-			$transaction_id = $this->generate_key( 'trans_' );
3962
-		}
3959
+        // Set the transaction id.
3960
+        if ( empty( $transaction_id ) ) {
3961
+            $transaction_id = $this->generate_key( 'trans_' );
3962
+        }
3963 3963
 
3964
-		if ( ! $this->get_transaction_id() ) {
3965
-			$this->set_transaction_id( $transaction_id );
3966
-		}
3964
+        if ( ! $this->get_transaction_id() ) {
3965
+            $this->set_transaction_id( $transaction_id );
3966
+        }
3967 3967
 
3968
-		if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3969
-			return $this->save();
3970
-		}
3968
+        if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3969
+            return $this->save();
3970
+        }
3971 3971
 
3972
-		// Set the completed date.
3973
-		$this->set_date_completed( current_time( 'mysql' ) );
3972
+        // Set the completed date.
3973
+        $this->set_date_completed( current_time( 'mysql' ) );
3974 3974
 
3975
-		// Set the new status.
3976
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
3977
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
3975
+        // Set the new status.
3976
+        $gateway = sanitize_text_field( $this->get_gateway_title() );
3977
+        if ( $this->is_renewal() || ! $this->is_parent() ) {
3978 3978
 
3979
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3980
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3979
+            $_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3980
+            $_note = $_note . empty( $note ) ? '' : " ($note)";
3981 3981
 
3982
-			if ( 'none' == $this->get_gateway() ) {
3983
-				$_note = $note;
3984
-			}
3982
+            if ( 'none' == $this->get_gateway() ) {
3983
+                $_note = $note;
3984
+            }
3985 3985
 
3986
-			$this->set_status( 'wpi-renewal', $_note );
3986
+            $this->set_status( 'wpi-renewal', $_note );
3987 3987
 
3988
-		} else {
3988
+        } else {
3989 3989
 
3990
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3991
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3990
+            $_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3991
+            $_note = $_note . empty( $note ) ? '' : " ($note)";
3992 3992
 
3993
-			if ( 'none' == $this->get_gateway() ) {
3994
-				$_note = $note;
3995
-			}
3993
+            if ( 'none' == $this->get_gateway() ) {
3994
+                $_note = $note;
3995
+            }
3996 3996
 
3997
-			$this->set_status( 'publish', $_note );
3997
+            $this->set_status( 'publish', $_note );
3998 3998
 
3999
-		}
3999
+        }
4000 4000
 
4001
-		// Set checkout mode.
4002
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4003
-		$this->set_mode( $mode );
4001
+        // Set checkout mode.
4002
+        $mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4003
+        $this->set_mode( $mode );
4004 4004
 
4005
-		// Save the invoice.
4005
+        // Save the invoice.
4006 4006
         $this->save();
4007
-	}
4008
-
4009
-	/**
4010
-	 * Save data to the database.
4011
-	 *
4012
-	 * @since 1.0.19
4013
-	 * @return int invoice ID
4014
-	 */
4015
-	public function save() {
4016
-		$this->maybe_set_date_paid();
4017
-		$this->maybe_set_key();
4018
-		parent::save();
4019
-		$this->clear_cache();
4020
-		$this->status_transition();
4021
-		return $this->get_id();
4022
-	}
4023
-
4024
-	/**
4007
+    }
4008
+
4009
+    /**
4010
+     * Save data to the database.
4011
+     *
4012
+     * @since 1.0.19
4013
+     * @return int invoice ID
4014
+     */
4015
+    public function save() {
4016
+        $this->maybe_set_date_paid();
4017
+        $this->maybe_set_key();
4018
+        parent::save();
4019
+        $this->clear_cache();
4020
+        $this->status_transition();
4021
+        return $this->get_id();
4022
+    }
4023
+
4024
+    /**
4025 4025
      * Clears the subscription's cache.
4026 4026
      */
4027 4027
     public function clear_cache() {
4028
-		if ( $this->get_key() ) {
4029
-			wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4030
-		}
4031
-
4032
-		if ( $this->get_number() ) {
4033
-			wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4034
-		}
4035
-
4036
-		if ( $this->get_transaction_id() ) {
4037
-			wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4038
-		}
4039
-	}
4028
+        if ( $this->get_key() ) {
4029
+            wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4030
+        }
4031
+
4032
+        if ( $this->get_number() ) {
4033
+            wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4034
+        }
4035
+
4036
+        if ( $this->get_transaction_id() ) {
4037
+            wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4038
+        }
4039
+    }
4040 4040
 
4041 4041
 }
Please login to merge, or discard this patch.
Spacing   +815 added lines, -815 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Invoice class.
@@ -145,39 +145,39 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
147 147
 	 */
148
-    public function __construct( $invoice = 0 ) {
148
+    public function __construct($invoice = 0) {
149 149
 
150
-        parent::__construct( $invoice );
150
+        parent::__construct($invoice);
151 151
 
152
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
153
-			$this->set_id( (int) $invoice );
154
-		} elseif ( $invoice instanceof self ) {
155
-			$this->set_id( $invoice->get_id() );
156
-		} elseif ( ! empty( $invoice->ID ) ) {
157
-			$this->set_id( $invoice->ID );
158
-		} elseif ( is_array( $invoice ) ) {
159
-			$this->set_props( $invoice );
152
+		if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) {
153
+			$this->set_id((int) $invoice);
154
+		} elseif ($invoice instanceof self) {
155
+			$this->set_id($invoice->get_id());
156
+		} elseif (!empty($invoice->ID)) {
157
+			$this->set_id($invoice->ID);
158
+		} elseif (is_array($invoice)) {
159
+			$this->set_props($invoice);
160 160
 
161
-			if ( isset( $invoice['ID'] ) ) {
162
-				$this->set_id( $invoice['ID'] );
161
+			if (isset($invoice['ID'])) {
162
+				$this->set_id($invoice['ID']);
163 163
 			}
164
-} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
165
-			$this->set_id( $invoice_id );
166
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
169
-			$this->set_id( $invoice_id );
164
+} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) {
165
+			$this->set_id($invoice_id);
166
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) {
167
+			$this->set_id($invoice_id);
168
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) {
169
+			$this->set_id($invoice_id);
170 170
 		} else {
171
-			$this->set_object_read( true );
171
+			$this->set_object_read(true);
172 172
 		}
173 173
 
174 174
         // Load the datastore.
175
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
175
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
176 176
 
177
-		if ( $this->get_id() > 0 ) {
178
-            $this->post = get_post( $this->get_id() );
177
+		if ($this->get_id() > 0) {
178
+            $this->post = get_post($this->get_id());
179 179
             $this->ID   = $this->get_id();
180
-			$this->data_store->read( $this );
180
+			$this->data_store->read($this);
181 181
         }
182 182
 
183 183
     }
@@ -192,38 +192,38 @@  discard block
 block discarded – undo
192 192
 	 * @since 1.0.15
193 193
 	 * @return int
194 194
 	 */
195
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
195
+	public static function get_invoice_id_by_field($value, $field = 'key') {
196 196
         global $wpdb;
197 197
 
198 198
 		// Trim the value.
199
-		$value = trim( $value );
199
+		$value = trim($value);
200 200
 
201
-		if ( empty( $value ) ) {
201
+		if (empty($value)) {
202 202
 			return 0;
203 203
 		}
204 204
 
205 205
         // Valid fields.
206
-        $fields = array( 'key', 'number', 'transaction_id' );
206
+        $fields = array('key', 'number', 'transaction_id');
207 207
 
208 208
 		// Ensure a field has been passed.
209
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
209
+		if (empty($field) || !in_array($field, $fields)) {
210 210
 			return 0;
211 211
 		}
212 212
 
213 213
 		// Maybe retrieve from the cache.
214
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
215
-		if ( false !== $invoice_id ) {
214
+		$invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids");
215
+		if (false !== $invoice_id) {
216 216
 			return $invoice_id;
217 217
 		}
218 218
 
219 219
         // Fetch from the db.
220 220
         $table       = $wpdb->prefix . 'getpaid_invoices';
221 221
         $invoice_id  = (int) $wpdb->get_var(
222
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
222
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value)
223 223
         );
224 224
 
225 225
 		// Update the cache with our data
226
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
226
+		wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids");
227 227
 
228 228
 		return $invoice_id;
229 229
     }
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
     /**
232 232
      * Checks if an invoice key is set.
233 233
      */
234
-    public function _isset( $key ) {
235
-        return isset( $this->data[ $key ] ) || method_exists( $this, "get_$key" );
234
+    public function _isset($key) {
235
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
236 236
     }
237 237
 
238 238
     /*
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @param  string $context View or edit context.
258 258
 	 * @return int
259 259
 	 */
260
-	public function get_parent_id( $context = 'view' ) {
261
-		return (int) $this->get_prop( 'parent_id', $context );
260
+	public function get_parent_id($context = 'view') {
261
+		return (int) $this->get_prop('parent_id', $context);
262 262
     }
263 263
 
264 264
     /**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return WPInv_Invoice
269 269
 	 */
270 270
     public function get_parent_payment() {
271
-        return new WPInv_Invoice( $this->get_parent_id() );
271
+        return new WPInv_Invoice($this->get_parent_id());
272 272
     }
273 273
 
274 274
     /**
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 	 * @param  string $context View or edit context.
289 289
 	 * @return string
290 290
 	 */
291
-	public function get_status( $context = 'view' ) {
292
-		return $this->get_prop( 'status', $context );
291
+	public function get_status($context = 'view') {
292
+		return $this->get_prop('status', $context);
293 293
 	}
294 294
 
295 295
 	/**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return array
300 300
 	 */
301 301
 	public function get_all_statuses() {
302
-		return wpinv_get_invoice_statuses( true, true, $this );
302
+		return wpinv_get_invoice_statuses(true, true, $this);
303 303
     }
304 304
 
305 305
     /**
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
     public function get_status_nicename() {
312 312
 		$statuses = $this->get_all_statuses();
313 313
 
314
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
314
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
315 315
 
316
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
316
+        return apply_filters('wpinv_get_invoice_status_nicename', $status, $this);
317 317
     }
318 318
 
319 319
 	/**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function get_status_class() {
326 326
 		$statuses = getpaid_get_invoice_status_classes();
327
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
327
+		return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'badge-dark';
328 328
 	}
329 329
 
330 330
 	/**
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function get_status_label_html() {
337 337
 
338
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
339
-		$status       = sanitize_html_class( $this->get_status() );
340
-		$class        = esc_attr( $this->get_status_class() );
338
+		$status_label = sanitize_text_field($this->get_status_nicename());
339
+		$status       = sanitize_html_class($this->get_status());
340
+		$class        = esc_attr($this->get_status_class());
341 341
 
342 342
 		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
343 343
 	}
@@ -349,23 +349,23 @@  discard block
 block discarded – undo
349 349
 	 * @param  string $context View or edit context.
350 350
 	 * @return string
351 351
 	 */
352
-	public function get_version( $context = 'view' ) {
353
-		return $this->get_prop( 'version', $context );
352
+	public function get_version($context = 'view') {
353
+		return $this->get_prop('version', $context);
354 354
 	}
355 355
 
356 356
 	/**
357 357
 	 * @deprecated
358 358
 	 */
359
-	public function get_invoice_date( $format = true ) {
360
-		$date      = getpaid_format_date( $this->get_date_completed() );
361
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
362
-		$formatted = getpaid_format_date( $date );
359
+	public function get_invoice_date($format = true) {
360
+		$date      = getpaid_format_date($this->get_date_completed());
361
+		$date      = empty($date) ? $this->get_date_created() : $this->get_date_completed();
362
+		$formatted = getpaid_format_date($date);
363 363
 
364
-		if ( $format ) {
364
+		if ($format) {
365 365
 			return $formatted;
366 366
 		}
367 367
 
368
-		return empty( $formatted ) ? '' : $date;
368
+		return empty($formatted) ? '' : $date;
369 369
 
370 370
     }
371 371
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 * @param  string $context View or edit context.
377 377
 	 * @return string
378 378
 	 */
379
-	public function get_date_created( $context = 'view' ) {
380
-		return $this->get_prop( 'date_created', $context );
379
+	public function get_date_created($context = 'view') {
380
+		return $this->get_prop('date_created', $context);
381 381
 	}
382 382
 
383 383
 	/**
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 	 * @param  string $context View or edit context.
388 388
 	 * @return string
389 389
 	 */
390
-	public function get_created_date( $context = 'view' ) {
391
-		return $this->get_date_created( $context );
390
+	public function get_created_date($context = 'view') {
391
+		return $this->get_date_created($context);
392 392
     }
393 393
 
394 394
     /**
@@ -398,11 +398,11 @@  discard block
 block discarded – undo
398 398
 	 * @param  string $context View or edit context.
399 399
 	 * @return string
400 400
 	 */
401
-	public function get_date_created_gmt( $context = 'view' ) {
402
-        $date = $this->get_date_created( $context );
401
+	public function get_date_created_gmt($context = 'view') {
402
+        $date = $this->get_date_created($context);
403 403
 
404
-        if ( $date ) {
405
-            $date = get_gmt_from_date( $date );
404
+        if ($date) {
405
+            $date = get_gmt_from_date($date);
406 406
         }
407 407
 		return $date;
408 408
     }
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	 * @param  string $context View or edit context.
415 415
 	 * @return string
416 416
 	 */
417
-	public function get_date_modified( $context = 'view' ) {
418
-		return $this->get_prop( 'date_modified', $context );
417
+	public function get_date_modified($context = 'view') {
418
+		return $this->get_prop('date_modified', $context);
419 419
 	}
420 420
 
421 421
 	/**
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 	 * @param  string $context View or edit context.
426 426
 	 * @return string
427 427
 	 */
428
-	public function get_modified_date( $context = 'view' ) {
429
-		return $this->get_date_modified( $context );
428
+	public function get_modified_date($context = 'view') {
429
+		return $this->get_date_modified($context);
430 430
     }
431 431
 
432 432
     /**
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 	 * @param  string $context View or edit context.
437 437
 	 * @return string
438 438
 	 */
439
-	public function get_date_modified_gmt( $context = 'view' ) {
440
-        $date = $this->get_date_modified( $context );
439
+	public function get_date_modified_gmt($context = 'view') {
440
+        $date = $this->get_date_modified($context);
441 441
 
442
-        if ( $date ) {
443
-            $date = get_gmt_from_date( $date );
442
+        if ($date) {
443
+            $date = get_gmt_from_date($date);
444 444
         }
445 445
 		return $date;
446 446
     }
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
 	 * @param  string $context View or edit context.
453 453
 	 * @return string
454 454
 	 */
455
-	public function get_due_date( $context = 'view' ) {
456
-		return $this->get_prop( 'due_date', $context );
455
+	public function get_due_date($context = 'view') {
456
+		return $this->get_prop('due_date', $context);
457 457
     }
458 458
 
459 459
     /**
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	 * @param  string $context View or edit context.
464 464
 	 * @return string
465 465
 	 */
466
-	public function get_date_due( $context = 'view' ) {
467
-		return $this->get_due_date( $context );
466
+	public function get_date_due($context = 'view') {
467
+		return $this->get_due_date($context);
468 468
     }
469 469
 
470 470
     /**
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	 * @param  string $context View or edit context.
475 475
 	 * @return string
476 476
 	 */
477
-	public function get_due_date_gmt( $context = 'view' ) {
478
-        $date = $this->get_due_date( $context );
477
+	public function get_due_date_gmt($context = 'view') {
478
+        $date = $this->get_due_date($context);
479 479
 
480
-        if ( $date ) {
481
-            $date = get_gmt_from_date( $date );
480
+        if ($date) {
481
+            $date = get_gmt_from_date($date);
482 482
         }
483 483
 		return $date;
484 484
     }
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 * @param  string $context View or edit context.
491 491
 	 * @return string
492 492
 	 */
493
-	public function get_gmt_date_due( $context = 'view' ) {
494
-		return $this->get_due_date_gmt( $context );
493
+	public function get_gmt_date_due($context = 'view') {
494
+		return $this->get_due_date_gmt($context);
495 495
     }
496 496
 
497 497
     /**
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 * @param  string $context View or edit context.
502 502
 	 * @return string
503 503
 	 */
504
-	public function get_completed_date( $context = 'view' ) {
505
-		return $this->get_prop( 'completed_date', $context );
504
+	public function get_completed_date($context = 'view') {
505
+		return $this->get_prop('completed_date', $context);
506 506
     }
507 507
 
508 508
     /**
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
 	 * @param  string $context View or edit context.
513 513
 	 * @return string
514 514
 	 */
515
-	public function get_date_completed( $context = 'view' ) {
516
-		return $this->get_completed_date( $context );
515
+	public function get_date_completed($context = 'view') {
516
+		return $this->get_completed_date($context);
517 517
     }
518 518
 
519 519
     /**
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
 	 * @param  string $context View or edit context.
524 524
 	 * @return string
525 525
 	 */
526
-	public function get_completed_date_gmt( $context = 'view' ) {
527
-        $date = $this->get_completed_date( $context );
526
+	public function get_completed_date_gmt($context = 'view') {
527
+        $date = $this->get_completed_date($context);
528 528
 
529
-        if ( $date ) {
530
-            $date = get_gmt_from_date( $date );
529
+        if ($date) {
530
+            $date = get_gmt_from_date($date);
531 531
         }
532 532
 		return $date;
533 533
     }
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 	 * @param  string $context View or edit context.
540 540
 	 * @return string
541 541
 	 */
542
-	public function get_gmt_completed_date( $context = 'view' ) {
543
-		return $this->get_completed_date_gmt( $context );
542
+	public function get_gmt_completed_date($context = 'view') {
543
+		return $this->get_completed_date_gmt($context);
544 544
     }
545 545
 
546 546
     /**
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
 	 * @param  string $context View or edit context.
551 551
 	 * @return string
552 552
 	 */
553
-	public function get_number( $context = 'view' ) {
554
-		$number = $this->get_prop( 'number', $context );
553
+	public function get_number($context = 'view') {
554
+		$number = $this->get_prop('number', $context);
555 555
 
556
-		if ( empty( $number ) ) {
556
+		if (empty($number)) {
557 557
 			$number = $this->generate_number();
558
-			$this->set_number( $this->generate_number() );
558
+			$this->set_number($this->generate_number());
559 559
 		}
560 560
 
561 561
 		return $number;
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 	public function maybe_set_number() {
570 570
         $number = $this->get_number();
571 571
 
572
-        if ( empty( $number ) || $this->get_id() == $number ) {
573
-			$this->set_number( $this->generate_number() );
572
+        if (empty($number) || $this->get_id() == $number) {
573
+			$this->set_number($this->generate_number());
574 574
         }
575 575
 
576 576
 	}
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 	 * @param  string $context View or edit context.
583 583
 	 * @return string
584 584
 	 */
585
-	public function get_key( $context = 'view' ) {
586
-        return $this->get_prop( 'key', $context );
585
+	public function get_key($context = 'view') {
586
+        return $this->get_prop('key', $context);
587 587
 	}
588 588
 
589 589
 	/**
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	public function maybe_set_key() {
595 595
         $key = $this->get_key();
596 596
 
597
-        if ( empty( $key ) ) {
598
-            $key = $this->generate_key( $this->get_type() . '_' );
599
-            $this->set_key( $key );
597
+        if (empty($key)) {
598
+            $key = $this->generate_key($this->get_type() . '_');
599
+            $this->set_key($key);
600 600
         }
601 601
 
602 602
     }
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 	 * @param  string $context View or edit context.
609 609
 	 * @return string
610 610
 	 */
611
-	public function get_type( $context = 'view' ) {
612
-        return $this->get_prop( 'type', $context );
611
+	public function get_type($context = 'view') {
612
+        return $this->get_prop('type', $context);
613 613
 	}
614 614
 
615 615
 	/**
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	 * @return string
620 620
 	 */
621 621
 	public function get_invoice_quote_type() {
622
-        return getpaid_get_post_type_label( $this->get_post_type(), false );
622
+        return getpaid_get_post_type_label($this->get_post_type(), false);
623 623
     }
624 624
 
625 625
     /**
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
 	 * @param  string $context View or edit context.
630 630
 	 * @return string
631 631
 	 */
632
-	public function get_label( $context = 'view' ) {
633
-        return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
632
+	public function get_label($context = 'view') {
633
+        return getpaid_get_post_type_label($this->get_post_type($context), false);
634 634
 	}
635 635
 
636 636
 	/**
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param  string $context View or edit context.
641 641
 	 * @return string
642 642
 	 */
643
-	public function get_post_type( $context = 'view' ) {
644
-        return $this->get_prop( 'post_type', $context );
643
+	public function get_post_type($context = 'view') {
644
+        return $this->get_prop('post_type', $context);
645 645
     }
646 646
 
647 647
     /**
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
 	 * @param  string $context View or edit context.
652 652
 	 * @return string
653 653
 	 */
654
-	public function get_mode( $context = 'view' ) {
655
-        return $this->get_prop( 'mode', $context );
654
+	public function get_mode($context = 'view') {
655
+        return $this->get_prop('mode', $context);
656 656
     }
657 657
 
658 658
     /**
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
 	 * @param  string $context View or edit context.
663 663
 	 * @return string
664 664
 	 */
665
-	public function get_path( $context = 'view' ) {
666
-        $path   = $this->get_prop( 'path', $context );
665
+	public function get_path($context = 'view') {
666
+        $path = $this->get_prop('path', $context);
667 667
 		$prefix = $this->get_type();
668 668
 
669
-		if ( 0 !== strpos( $path, $prefix ) ) {
670
-			$path = sanitize_title( $prefix . '-' . $this->get_id() );
671
-			$this->set_path( $path );
669
+		if (0 !== strpos($path, $prefix)) {
670
+			$path = sanitize_title($prefix . '-' . $this->get_id());
671
+			$this->set_path($path);
672 672
 		}
673 673
 
674 674
 		return $path;
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
 	 * @param  string $context View or edit context.
682 682
 	 * @return string
683 683
 	 */
684
-	public function get_name( $context = 'view' ) {
685
-        return $this->get_prop( 'title', $context );
684
+	public function get_name($context = 'view') {
685
+        return $this->get_prop('title', $context);
686 686
     }
687 687
 
688 688
     /**
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 	 * @param  string $context View or edit context.
693 693
 	 * @return string
694 694
 	 */
695
-	public function get_title( $context = 'view' ) {
696
-		return $this->get_name( $context );
695
+	public function get_title($context = 'view') {
696
+		return $this->get_name($context);
697 697
     }
698 698
 
699 699
     /**
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 	 * @param  string $context View or edit context.
704 704
 	 * @return string
705 705
 	 */
706
-	public function get_description( $context = 'view' ) {
707
-		return $this->get_prop( 'description', $context );
706
+	public function get_description($context = 'view') {
707
+		return $this->get_prop('description', $context);
708 708
     }
709 709
 
710 710
     /**
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
 	 * @param  string $context View or edit context.
715 715
 	 * @return string
716 716
 	 */
717
-	public function get_excerpt( $context = 'view' ) {
718
-		return $this->get_description( $context );
717
+	public function get_excerpt($context = 'view') {
718
+		return $this->get_description($context);
719 719
     }
720 720
 
721 721
     /**
@@ -725,8 +725,8 @@  discard block
 block discarded – undo
725 725
 	 * @param  string $context View or edit context.
726 726
 	 * @return string
727 727
 	 */
728
-	public function get_summary( $context = 'view' ) {
729
-		return $this->get_description( $context );
728
+	public function get_summary($context = 'view') {
729
+		return $this->get_description($context);
730 730
     }
731 731
 
732 732
     /**
@@ -736,26 +736,26 @@  discard block
 block discarded – undo
736 736
      * @param  string $context View or edit context.
737 737
 	 * @return array
738 738
 	 */
739
-    public function get_user_info( $context = 'view' ) {
739
+    public function get_user_info($context = 'view') {
740 740
 
741 741
         $user_info = array(
742
-            'user_id'    => $this->get_user_id( $context ),
743
-            'email'      => $this->get_email( $context ),
744
-            'first_name' => $this->get_first_name( $context ),
745
-            'last_name'  => $this->get_last_name( $context ),
746
-            'address'    => $this->get_address( $context ),
747
-            'phone'      => $this->get_phone( $context ),
748
-            'city'       => $this->get_city( $context ),
749
-            'country'    => $this->get_country( $context ),
750
-            'state'      => $this->get_state( $context ),
751
-            'zip'        => $this->get_zip( $context ),
752
-            'company'    => $this->get_company( $context ),
753
-			'company_id' => $this->get_company_id( $context ),
754
-            'vat_number' => $this->get_vat_number( $context ),
755
-            'discount'   => $this->get_discount_code( $context ),
742
+            'user_id'    => $this->get_user_id($context),
743
+            'email'      => $this->get_email($context),
744
+            'first_name' => $this->get_first_name($context),
745
+            'last_name'  => $this->get_last_name($context),
746
+            'address'    => $this->get_address($context),
747
+            'phone'      => $this->get_phone($context),
748
+            'city'       => $this->get_city($context),
749
+            'country'    => $this->get_country($context),
750
+            'state'      => $this->get_state($context),
751
+            'zip'        => $this->get_zip($context),
752
+            'company'    => $this->get_company($context),
753
+			'company_id' => $this->get_company_id($context),
754
+            'vat_number' => $this->get_vat_number($context),
755
+            'discount'   => $this->get_discount_code($context),
756 756
 		);
757 757
 
758
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
758
+		return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this);
759 759
 
760 760
     }
761 761
 
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 	 * @param  string $context View or edit context.
767 767
 	 * @return int
768 768
 	 */
769
-	public function get_author( $context = 'view' ) {
770
-		return (int) $this->get_prop( 'author', $context );
769
+	public function get_author($context = 'view') {
770
+		return (int) $this->get_prop('author', $context);
771 771
     }
772 772
 
773 773
     /**
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 	 * @param  string $context View or edit context.
778 778
 	 * @return int
779 779
 	 */
780
-	public function get_user_id( $context = 'view' ) {
781
-		return $this->get_author( $context );
780
+	public function get_user_id($context = 'view') {
781
+		return $this->get_author($context);
782 782
     }
783 783
 
784 784
      /**
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 	 * @param  string $context View or edit context.
789 789
 	 * @return int
790 790
 	 */
791
-	public function get_customer_id( $context = 'view' ) {
792
-		return $this->get_author( $context );
791
+	public function get_customer_id($context = 'view') {
792
+		return $this->get_author($context);
793 793
     }
794 794
 
795 795
     /**
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 	 * @param  string $context View or edit context.
800 800
 	 * @return string
801 801
 	 */
802
-	public function get_ip( $context = 'view' ) {
803
-		return $this->get_prop( 'user_ip', $context );
802
+	public function get_ip($context = 'view') {
803
+		return $this->get_prop('user_ip', $context);
804 804
     }
805 805
 
806 806
     /**
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 	 * @param  string $context View or edit context.
811 811
 	 * @return string
812 812
 	 */
813
-	public function get_user_ip( $context = 'view' ) {
814
-		return $this->get_ip( $context );
813
+	public function get_user_ip($context = 'view') {
814
+		return $this->get_ip($context);
815 815
     }
816 816
 
817 817
      /**
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 	 * @param  string $context View or edit context.
822 822
 	 * @return string
823 823
 	 */
824
-	public function get_customer_ip( $context = 'view' ) {
825
-		return $this->get_ip( $context );
824
+	public function get_customer_ip($context = 'view') {
825
+		return $this->get_ip($context);
826 826
     }
827 827
 
828 828
     /**
@@ -832,8 +832,8 @@  discard block
 block discarded – undo
832 832
 	 * @param  string $context View or edit context.
833 833
 	 * @return string
834 834
 	 */
835
-	public function get_first_name( $context = 'view' ) {
836
-		return $this->get_prop( 'first_name', $context );
835
+	public function get_first_name($context = 'view') {
836
+		return $this->get_prop('first_name', $context);
837 837
     }
838 838
 
839 839
     /**
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 	 * @param  string $context View or edit context.
844 844
 	 * @return string
845 845
 	 */
846
-	public function get_user_first_name( $context = 'view' ) {
847
-		return $this->get_first_name( $context );
846
+	public function get_user_first_name($context = 'view') {
847
+		return $this->get_first_name($context);
848 848
     }
849 849
 
850 850
      /**
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 	 * @param  string $context View or edit context.
855 855
 	 * @return string
856 856
 	 */
857
-	public function get_customer_first_name( $context = 'view' ) {
858
-		return $this->get_first_name( $context );
857
+	public function get_customer_first_name($context = 'view') {
858
+		return $this->get_first_name($context);
859 859
     }
860 860
 
861 861
     /**
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
 	 * @param  string $context View or edit context.
866 866
 	 * @return string
867 867
 	 */
868
-	public function get_last_name( $context = 'view' ) {
869
-		return $this->get_prop( 'last_name', $context );
868
+	public function get_last_name($context = 'view') {
869
+		return $this->get_prop('last_name', $context);
870 870
     }
871 871
 
872 872
     /**
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	 * @param  string $context View or edit context.
877 877
 	 * @return string
878 878
 	 */
879
-	public function get_user_last_name( $context = 'view' ) {
880
-		return $this->get_last_name( $context );
879
+	public function get_user_last_name($context = 'view') {
880
+		return $this->get_last_name($context);
881 881
     }
882 882
 
883 883
     /**
@@ -887,8 +887,8 @@  discard block
 block discarded – undo
887 887
 	 * @param  string $context View or edit context.
888 888
 	 * @return string
889 889
 	 */
890
-	public function get_customer_last_name( $context = 'view' ) {
891
-		return $this->get_last_name( $context );
890
+	public function get_customer_last_name($context = 'view') {
891
+		return $this->get_last_name($context);
892 892
     }
893 893
 
894 894
     /**
@@ -898,22 +898,22 @@  discard block
 block discarded – undo
898 898
 	 * @param  string $context View or edit context.
899 899
 	 * @return string
900 900
 	 */
901
-	public function get_full_name( $context = 'view' ) {
902
-		$name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
901
+	public function get_full_name($context = 'view') {
902
+		$name = trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
903 903
 
904
-		if ( ! $name ) {
905
-			$user = get_userdata( $this->get_author( $context ) );
904
+		if (!$name) {
905
+			$user = get_userdata($this->get_author($context));
906 906
 
907
-			if ( $user ) {
907
+			if ($user) {
908 908
 				$name = $user->display_name;
909 909
 			}
910 910
 		}
911 911
 
912
-		if ( ! $name ) {
913
-			$name = $this->get_email( $context );
912
+		if (!$name) {
913
+			$name = $this->get_email($context);
914 914
 		}
915 915
 
916
-		return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
916
+		return apply_filters('wpinv_invoice_user_full_name', $name, $this);
917 917
     }
918 918
 
919 919
     /**
@@ -923,8 +923,8 @@  discard block
 block discarded – undo
923 923
 	 * @param  string $context View or edit context.
924 924
 	 * @return string
925 925
 	 */
926
-	public function get_user_full_name( $context = 'view' ) {
927
-		return $this->get_full_name( $context );
926
+	public function get_user_full_name($context = 'view') {
927
+		return $this->get_full_name($context);
928 928
     }
929 929
 
930 930
     /**
@@ -934,8 +934,8 @@  discard block
 block discarded – undo
934 934
 	 * @param  string $context View or edit context.
935 935
 	 * @return string
936 936
 	 */
937
-	public function get_customer_full_name( $context = 'view' ) {
938
-		return $this->get_full_name( $context );
937
+	public function get_customer_full_name($context = 'view') {
938
+		return $this->get_full_name($context);
939 939
     }
940 940
 
941 941
     /**
@@ -945,8 +945,8 @@  discard block
 block discarded – undo
945 945
 	 * @param  string $context View or edit context.
946 946
 	 * @return string
947 947
 	 */
948
-	public function get_phone( $context = 'view' ) {
949
-		return $this->get_prop( 'phone', $context );
948
+	public function get_phone($context = 'view') {
949
+		return $this->get_prop('phone', $context);
950 950
     }
951 951
 
952 952
     /**
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
 	 * @param  string $context View or edit context.
957 957
 	 * @return string
958 958
 	 */
959
-	public function get_phone_number( $context = 'view' ) {
960
-		return $this->get_phone( $context );
959
+	public function get_phone_number($context = 'view') {
960
+		return $this->get_phone($context);
961 961
     }
962 962
 
963 963
     /**
@@ -967,8 +967,8 @@  discard block
 block discarded – undo
967 967
 	 * @param  string $context View or edit context.
968 968
 	 * @return string
969 969
 	 */
970
-	public function get_user_phone( $context = 'view' ) {
971
-		return $this->get_phone( $context );
970
+	public function get_user_phone($context = 'view') {
971
+		return $this->get_phone($context);
972 972
     }
973 973
 
974 974
     /**
@@ -978,8 +978,8 @@  discard block
 block discarded – undo
978 978
 	 * @param  string $context View or edit context.
979 979
 	 * @return string
980 980
 	 */
981
-	public function get_customer_phone( $context = 'view' ) {
982
-		return $this->get_phone( $context );
981
+	public function get_customer_phone($context = 'view') {
982
+		return $this->get_phone($context);
983 983
     }
984 984
 
985 985
     /**
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
 	 * @param  string $context View or edit context.
990 990
 	 * @return string
991 991
 	 */
992
-	public function get_email( $context = 'view' ) {
993
-		return $this->get_prop( 'email', $context );
992
+	public function get_email($context = 'view') {
993
+		return $this->get_prop('email', $context);
994 994
     }
995 995
 
996 996
     /**
@@ -1000,8 +1000,8 @@  discard block
 block discarded – undo
1000 1000
 	 * @param  string $context View or edit context.
1001 1001
 	 * @return string
1002 1002
 	 */
1003
-	public function get_email_address( $context = 'view' ) {
1004
-		return $this->get_email( $context );
1003
+	public function get_email_address($context = 'view') {
1004
+		return $this->get_email($context);
1005 1005
     }
1006 1006
 
1007 1007
     /**
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
 	 * @param  string $context View or edit context.
1012 1012
 	 * @return string
1013 1013
 	 */
1014
-	public function get_user_email( $context = 'view' ) {
1015
-		return $this->get_email( $context );
1014
+	public function get_user_email($context = 'view') {
1015
+		return $this->get_email($context);
1016 1016
     }
1017 1017
 
1018 1018
     /**
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
 	 * @param  string $context View or edit context.
1023 1023
 	 * @return string
1024 1024
 	 */
1025
-	public function get_customer_email( $context = 'view' ) {
1026
-		return $this->get_email( $context );
1025
+	public function get_customer_email($context = 'view') {
1026
+		return $this->get_email($context);
1027 1027
     }
1028 1028
 
1029 1029
     /**
@@ -1033,9 +1033,9 @@  discard block
 block discarded – undo
1033 1033
 	 * @param  string $context View or edit context.
1034 1034
 	 * @return string
1035 1035
 	 */
1036
-	public function get_country( $context = 'view' ) {
1037
-		$country = $this->get_prop( 'country', $context );
1038
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1036
+	public function get_country($context = 'view') {
1037
+		$country = $this->get_prop('country', $context);
1038
+		return empty($country) ? wpinv_get_default_country() : $country;
1039 1039
     }
1040 1040
 
1041 1041
     /**
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 	 * @param  string $context View or edit context.
1046 1046
 	 * @return string
1047 1047
 	 */
1048
-	public function get_user_country( $context = 'view' ) {
1049
-		return $this->get_country( $context );
1048
+	public function get_user_country($context = 'view') {
1049
+		return $this->get_country($context);
1050 1050
     }
1051 1051
 
1052 1052
     /**
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 	 * @param  string $context View or edit context.
1057 1057
 	 * @return string
1058 1058
 	 */
1059
-	public function get_customer_country( $context = 'view' ) {
1060
-		return $this->get_country( $context );
1059
+	public function get_customer_country($context = 'view') {
1060
+		return $this->get_country($context);
1061 1061
     }
1062 1062
 
1063 1063
     /**
@@ -1067,9 +1067,9 @@  discard block
 block discarded – undo
1067 1067
 	 * @param  string $context View or edit context.
1068 1068
 	 * @return string
1069 1069
 	 */
1070
-	public function get_state( $context = 'view' ) {
1071
-		$state = $this->get_prop( 'state', $context );
1072
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1070
+	public function get_state($context = 'view') {
1071
+		$state = $this->get_prop('state', $context);
1072
+		return empty($state) ? wpinv_get_default_state() : $state;
1073 1073
     }
1074 1074
 
1075 1075
     /**
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 	 * @param  string $context View or edit context.
1080 1080
 	 * @return string
1081 1081
 	 */
1082
-	public function get_user_state( $context = 'view' ) {
1083
-		return $this->get_state( $context );
1082
+	public function get_user_state($context = 'view') {
1083
+		return $this->get_state($context);
1084 1084
     }
1085 1085
 
1086 1086
     /**
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
 	 * @param  string $context View or edit context.
1091 1091
 	 * @return string
1092 1092
 	 */
1093
-	public function get_customer_state( $context = 'view' ) {
1094
-		return $this->get_state( $context );
1093
+	public function get_customer_state($context = 'view') {
1094
+		return $this->get_state($context);
1095 1095
     }
1096 1096
 
1097 1097
     /**
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
 	 * @param  string $context View or edit context.
1102 1102
 	 * @return string
1103 1103
 	 */
1104
-	public function get_city( $context = 'view' ) {
1105
-		return $this->get_prop( 'city', $context );
1104
+	public function get_city($context = 'view') {
1105
+		return $this->get_prop('city', $context);
1106 1106
     }
1107 1107
 
1108 1108
     /**
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
 	 * @param  string $context View or edit context.
1113 1113
 	 * @return string
1114 1114
 	 */
1115
-	public function get_user_city( $context = 'view' ) {
1116
-		return $this->get_city( $context );
1115
+	public function get_user_city($context = 'view') {
1116
+		return $this->get_city($context);
1117 1117
     }
1118 1118
 
1119 1119
     /**
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
 	 * @param  string $context View or edit context.
1124 1124
 	 * @return string
1125 1125
 	 */
1126
-	public function get_customer_city( $context = 'view' ) {
1127
-		return $this->get_city( $context );
1126
+	public function get_customer_city($context = 'view') {
1127
+		return $this->get_city($context);
1128 1128
     }
1129 1129
 
1130 1130
     /**
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
 	 * @param  string $context View or edit context.
1135 1135
 	 * @return string
1136 1136
 	 */
1137
-	public function get_zip( $context = 'view' ) {
1138
-		return $this->get_prop( 'zip', $context );
1137
+	public function get_zip($context = 'view') {
1138
+		return $this->get_prop('zip', $context);
1139 1139
     }
1140 1140
 
1141 1141
     /**
@@ -1145,8 +1145,8 @@  discard block
 block discarded – undo
1145 1145
 	 * @param  string $context View or edit context.
1146 1146
 	 * @return string
1147 1147
 	 */
1148
-	public function get_user_zip( $context = 'view' ) {
1149
-		return $this->get_zip( $context );
1148
+	public function get_user_zip($context = 'view') {
1149
+		return $this->get_zip($context);
1150 1150
     }
1151 1151
 
1152 1152
     /**
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
 	 * @param  string $context View or edit context.
1157 1157
 	 * @return string
1158 1158
 	 */
1159
-	public function get_customer_zip( $context = 'view' ) {
1160
-		return $this->get_zip( $context );
1159
+	public function get_customer_zip($context = 'view') {
1160
+		return $this->get_zip($context);
1161 1161
     }
1162 1162
 
1163 1163
     /**
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
 	 * @param  string $context View or edit context.
1168 1168
 	 * @return string
1169 1169
 	 */
1170
-	public function get_company( $context = 'view' ) {
1171
-		return $this->get_prop( 'company', $context );
1170
+	public function get_company($context = 'view') {
1171
+		return $this->get_prop('company', $context);
1172 1172
     }
1173 1173
 
1174 1174
     /**
@@ -1178,8 +1178,8 @@  discard block
 block discarded – undo
1178 1178
 	 * @param  string $context View or edit context.
1179 1179
 	 * @return string
1180 1180
 	 */
1181
-	public function get_user_company( $context = 'view' ) {
1182
-		return $this->get_company( $context );
1181
+	public function get_user_company($context = 'view') {
1182
+		return $this->get_company($context);
1183 1183
     }
1184 1184
 
1185 1185
     /**
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 	 * @param  string $context View or edit context.
1190 1190
 	 * @return string
1191 1191
 	 */
1192
-	public function get_customer_company( $context = 'view' ) {
1193
-		return $this->get_company( $context );
1192
+	public function get_customer_company($context = 'view') {
1193
+		return $this->get_company($context);
1194 1194
     }
1195 1195
 
1196 1196
 	/**
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 	 * @param  string $context View or edit context.
1201 1201
 	 * @return string
1202 1202
 	 */
1203
-	public function get_company_id( $context = 'view' ) {
1204
-		return $this->get_prop( 'company_id', $context );
1203
+	public function get_company_id($context = 'view') {
1204
+		return $this->get_prop('company_id', $context);
1205 1205
     }
1206 1206
 
1207 1207
     /**
@@ -1211,8 +1211,8 @@  discard block
 block discarded – undo
1211 1211
 	 * @param  string $context View or edit context.
1212 1212
 	 * @return string
1213 1213
 	 */
1214
-	public function get_vat_number( $context = 'view' ) {
1215
-		return $this->get_prop( 'vat_number', $context );
1214
+	public function get_vat_number($context = 'view') {
1215
+		return $this->get_prop('vat_number', $context);
1216 1216
     }
1217 1217
 
1218 1218
     /**
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 	 * @param  string $context View or edit context.
1223 1223
 	 * @return string
1224 1224
 	 */
1225
-	public function get_user_vat_number( $context = 'view' ) {
1226
-		return $this->get_vat_number( $context );
1225
+	public function get_user_vat_number($context = 'view') {
1226
+		return $this->get_vat_number($context);
1227 1227
     }
1228 1228
 
1229 1229
     /**
@@ -1233,8 +1233,8 @@  discard block
 block discarded – undo
1233 1233
 	 * @param  string $context View or edit context.
1234 1234
 	 * @return string
1235 1235
 	 */
1236
-	public function get_customer_vat_number( $context = 'view' ) {
1237
-		return $this->get_vat_number( $context );
1236
+	public function get_customer_vat_number($context = 'view') {
1237
+		return $this->get_vat_number($context);
1238 1238
     }
1239 1239
 
1240 1240
     /**
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
 	 * @param  string $context View or edit context.
1245 1245
 	 * @return string
1246 1246
 	 */
1247
-	public function get_vat_rate( $context = 'view' ) {
1248
-		return $this->get_prop( 'vat_rate', $context );
1247
+	public function get_vat_rate($context = 'view') {
1248
+		return $this->get_prop('vat_rate', $context);
1249 1249
     }
1250 1250
 
1251 1251
     /**
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 	 * @param  string $context View or edit context.
1256 1256
 	 * @return string
1257 1257
 	 */
1258
-	public function get_user_vat_rate( $context = 'view' ) {
1259
-		return $this->get_vat_rate( $context );
1258
+	public function get_user_vat_rate($context = 'view') {
1259
+		return $this->get_vat_rate($context);
1260 1260
     }
1261 1261
 
1262 1262
     /**
@@ -1266,8 +1266,8 @@  discard block
 block discarded – undo
1266 1266
 	 * @param  string $context View or edit context.
1267 1267
 	 * @return string
1268 1268
 	 */
1269
-	public function get_customer_vat_rate( $context = 'view' ) {
1270
-		return $this->get_vat_rate( $context );
1269
+	public function get_customer_vat_rate($context = 'view') {
1270
+		return $this->get_vat_rate($context);
1271 1271
     }
1272 1272
 
1273 1273
     /**
@@ -1277,8 +1277,8 @@  discard block
 block discarded – undo
1277 1277
 	 * @param  string $context View or edit context.
1278 1278
 	 * @return string
1279 1279
 	 */
1280
-	public function get_address( $context = 'view' ) {
1281
-		return $this->get_prop( 'address', $context );
1280
+	public function get_address($context = 'view') {
1281
+		return $this->get_prop('address', $context);
1282 1282
     }
1283 1283
 
1284 1284
     /**
@@ -1288,8 +1288,8 @@  discard block
 block discarded – undo
1288 1288
 	 * @param  string $context View or edit context.
1289 1289
 	 * @return string
1290 1290
 	 */
1291
-	public function get_user_address( $context = 'view' ) {
1292
-		return $this->get_address( $context );
1291
+	public function get_user_address($context = 'view') {
1292
+		return $this->get_address($context);
1293 1293
     }
1294 1294
 
1295 1295
     /**
@@ -1299,8 +1299,8 @@  discard block
 block discarded – undo
1299 1299
 	 * @param  string $context View or edit context.
1300 1300
 	 * @return string
1301 1301
 	 */
1302
-	public function get_customer_address( $context = 'view' ) {
1303
-		return $this->get_address( $context );
1302
+	public function get_customer_address($context = 'view') {
1303
+		return $this->get_address($context);
1304 1304
     }
1305 1305
 
1306 1306
     /**
@@ -1310,8 +1310,8 @@  discard block
 block discarded – undo
1310 1310
 	 * @param  string $context View or edit context.
1311 1311
 	 * @return bool
1312 1312
 	 */
1313
-	public function get_is_viewed( $context = 'view' ) {
1314
-		return (bool) $this->get_prop( 'is_viewed', $context );
1313
+	public function get_is_viewed($context = 'view') {
1314
+		return (bool) $this->get_prop('is_viewed', $context);
1315 1315
 	}
1316 1316
 
1317 1317
 	/**
@@ -1321,8 +1321,8 @@  discard block
 block discarded – undo
1321 1321
 	 * @param  string $context View or edit context.
1322 1322
 	 * @return bool
1323 1323
 	 */
1324
-	public function get_email_cc( $context = 'view' ) {
1325
-		return $this->get_prop( 'email_cc', $context );
1324
+	public function get_email_cc($context = 'view') {
1325
+		return $this->get_prop('email_cc', $context);
1326 1326
 	}
1327 1327
 
1328 1328
 	/**
@@ -1332,8 +1332,8 @@  discard block
 block discarded – undo
1332 1332
 	 * @param  string $context View or edit context.
1333 1333
 	 * @return bool
1334 1334
 	 */
1335
-	public function get_template( $context = 'view' ) {
1336
-		return $this->get_prop( 'template', $context );
1335
+	public function get_template($context = 'view') {
1336
+		return $this->get_prop('template', $context);
1337 1337
 	}
1338 1338
 
1339 1339
 	/**
@@ -1343,8 +1343,8 @@  discard block
 block discarded – undo
1343 1343
 	 * @param  string $context View or edit context.
1344 1344
 	 * @return bool
1345 1345
 	 */
1346
-	public function get_created_via( $context = 'view' ) {
1347
-		return $this->get_prop( 'created_via', $context );
1346
+	public function get_created_via($context = 'view') {
1347
+		return $this->get_prop('created_via', $context);
1348 1348
 	}
1349 1349
 
1350 1350
 	/**
@@ -1354,8 +1354,8 @@  discard block
 block discarded – undo
1354 1354
 	 * @param  string $context View or edit context.
1355 1355
 	 * @return bool
1356 1356
 	 */
1357
-	public function get_address_confirmed( $context = 'view' ) {
1358
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1357
+	public function get_address_confirmed($context = 'view') {
1358
+		return (bool) $this->get_prop('address_confirmed', $context);
1359 1359
     }
1360 1360
 
1361 1361
     /**
@@ -1365,8 +1365,8 @@  discard block
 block discarded – undo
1365 1365
 	 * @param  string $context View or edit context.
1366 1366
 	 * @return bool
1367 1367
 	 */
1368
-	public function get_user_address_confirmed( $context = 'view' ) {
1369
-		return $this->get_address_confirmed( $context );
1368
+	public function get_user_address_confirmed($context = 'view') {
1369
+		return $this->get_address_confirmed($context);
1370 1370
     }
1371 1371
 
1372 1372
     /**
@@ -1376,8 +1376,8 @@  discard block
 block discarded – undo
1376 1376
 	 * @param  string $context View or edit context.
1377 1377
 	 * @return bool
1378 1378
 	 */
1379
-	public function get_customer_address_confirmed( $context = 'view' ) {
1380
-		return $this->get_address_confirmed( $context );
1379
+	public function get_customer_address_confirmed($context = 'view') {
1380
+		return $this->get_address_confirmed($context);
1381 1381
     }
1382 1382
 
1383 1383
 	/**
@@ -1388,8 +1388,8 @@  discard block
 block discarded – undo
1388 1388
 	 */
1389 1389
 	public function get_shipping_address() {
1390 1390
 
1391
-		$shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1392
-		return is_array( $shipping_address ) ? $shipping_address : false;
1391
+		$shipping_address = get_post_meta($this->get_id(), 'shipping_address', true);
1392
+		return is_array($shipping_address) ? $shipping_address : false;
1393 1393
     }
1394 1394
 
1395 1395
 	/**
@@ -1406,17 +1406,17 @@  discard block
 block discarded – undo
1406 1406
 	 * @param  string $context View or edit context.
1407 1407
 	 * @return float
1408 1408
 	 */
1409
-	public function get_shipping( $context = 'view' ) {
1409
+	public function get_shipping($context = 'view') {
1410 1410
 
1411
-		if ( $context = 'view' ) {
1412
-			return floatval( $this->get_prop( 'shipping', $context ) );
1411
+		if ($context = 'view') {
1412
+			return floatval($this->get_prop('shipping', $context));
1413 1413
 		}
1414 1414
 
1415
-		return $this->get_prop( 'shipping', $context );
1415
+		return $this->get_prop('shipping', $context);
1416 1416
     }
1417 1417
 
1418 1418
 	public function has_shipping() {
1419
-		return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && null !== $this->get_prop( 'shipping', 'edit' );
1419
+		return defined('GETPAID_SHIPPING_CALCULATOR_VERSION') && null !== $this->get_prop('shipping', 'edit');
1420 1420
     }
1421 1421
 
1422 1422
     /**
@@ -1426,12 +1426,12 @@  discard block
 block discarded – undo
1426 1426
 	 * @param  string $context View or edit context.
1427 1427
 	 * @return float
1428 1428
 	 */
1429
-	public function get_subtotal( $context = 'view' ) {
1430
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1429
+	public function get_subtotal($context = 'view') {
1430
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1431 1431
 
1432 1432
         // Backwards compatibility.
1433
-        if ( is_bool( $context ) && $context ) {
1434
-            return wpinv_price( $subtotal, $this->get_currency() );
1433
+        if (is_bool($context) && $context) {
1434
+            return wpinv_price($subtotal, $this->get_currency());
1435 1435
         }
1436 1436
 
1437 1437
         return $subtotal;
@@ -1444,8 +1444,8 @@  discard block
 block discarded – undo
1444 1444
 	 * @param  string $context View or edit context.
1445 1445
 	 * @return float
1446 1446
 	 */
1447
-	public function get_total_discount( $context = 'view' ) {
1448
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1447
+	public function get_total_discount($context = 'view') {
1448
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_discount', $context)));
1449 1449
     }
1450 1450
 
1451 1451
     /**
@@ -1455,18 +1455,18 @@  discard block
 block discarded – undo
1455 1455
 	 * @param  string $context View or edit context.
1456 1456
 	 * @return float
1457 1457
 	 */
1458
-	public function get_total_tax( $context = 'view' ) {
1459
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1458
+	public function get_total_tax($context = 'view') {
1459
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_tax', $context)));
1460 1460
 	}
1461 1461
 
1462 1462
 	/**
1463 1463
 	 * @deprecated
1464 1464
 	 */
1465
-	public function get_final_tax( $currency = false ) {
1465
+	public function get_final_tax($currency = false) {
1466 1466
 		$tax = $this->get_total_tax();
1467 1467
 
1468
-        if ( $currency ) {
1469
-			return wpinv_price( $tax, $this->get_currency() );
1468
+        if ($currency) {
1469
+			return wpinv_price($tax, $this->get_currency());
1470 1470
         }
1471 1471
 
1472 1472
         return $tax;
@@ -1479,8 +1479,8 @@  discard block
 block discarded – undo
1479 1479
 	 * @param  string $context View or edit context.
1480 1480
 	 * @return float
1481 1481
 	 */
1482
-	public function get_total_fees( $context = 'view' ) {
1483
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1482
+	public function get_total_fees($context = 'view') {
1483
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_fees', $context)));
1484 1484
     }
1485 1485
 
1486 1486
     /**
@@ -1490,8 +1490,8 @@  discard block
 block discarded – undo
1490 1490
 	 * @param  string $context View or edit context.
1491 1491
 	 * @return float
1492 1492
 	 */
1493
-	public function get_fees_total( $context = 'view' ) {
1494
-		return $this->get_total_fees( $context );
1493
+	public function get_fees_total($context = 'view') {
1494
+		return $this->get_total_fees($context);
1495 1495
     }
1496 1496
 
1497 1497
     /**
@@ -1500,14 +1500,14 @@  discard block
 block discarded – undo
1500 1500
 	 * @since 1.0.19
1501 1501
      * @return float
1502 1502
 	 */
1503
-	public function get_total( $context = 'view' ) {
1504
-		$total = $this->get_prop( 'total', $context );
1503
+	public function get_total($context = 'view') {
1504
+		$total = $this->get_prop('total', $context);
1505 1505
 
1506
-		if ( $this->has_shipping() && $context == 'view' ) {
1507
-			$total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1506
+		if ($this->has_shipping() && $context == 'view') {
1507
+			$total = $this->get_prop('total', $context) + $this->get_shipping($context);
1508 1508
 		}
1509 1509
 
1510
-		return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1510
+		return wpinv_round_amount(wpinv_sanitize_amount($total));
1511 1511
 	}
1512 1512
 
1513 1513
 	/**
@@ -1519,20 +1519,20 @@  discard block
 block discarded – undo
1519 1519
 	public function get_non_recurring_total() {
1520 1520
 
1521 1521
 		$subtotal = 0;
1522
-		foreach ( $this->get_items() as $item ) {
1523
-			if ( ! $item->is_recurring() ) {
1522
+		foreach ($this->get_items() as $item) {
1523
+			if (!$item->is_recurring()) {
1524 1524
 				$subtotal += $item->get_sub_total();
1525 1525
 			}
1526 1526
 		}
1527 1527
 
1528
-		foreach ( $this->get_fees() as $fee ) {
1529
-			if ( empty( $fee['recurring_fee'] ) ) {
1530
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1528
+		foreach ($this->get_fees() as $fee) {
1529
+			if (empty($fee['recurring_fee'])) {
1530
+				$subtotal += wpinv_sanitize_amount($fee['initial_fee']);
1531 1531
 			}
1532 1532
 		}
1533 1533
 
1534
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1535
-        return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1534
+		$subtotal = wpinv_round_amount(wpinv_sanitize_amount($subtotal));
1535
+        return apply_filters('wpinv_get_non_recurring_invoice_total', $subtotal, $this);
1536 1536
 
1537 1537
     }
1538 1538
 
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
 	 */
1556 1556
     public function get_initial_total() {
1557 1557
 
1558
-		if ( empty( $this->totals ) ) {
1558
+		if (empty($this->totals)) {
1559 1559
 			$this->recalculate_total();
1560 1560
 		}
1561 1561
 
@@ -1565,12 +1565,12 @@  discard block
 block discarded – undo
1565 1565
 		$subtotal = $this->totals['subtotal']['initial'];
1566 1566
 		$total    = $tax + $fee - $discount + $subtotal;
1567 1567
 
1568
-		if ( 0 > $total ) {
1568
+		if (0 > $total) {
1569 1569
 			$total = 0;
1570 1570
 		}
1571 1571
 
1572
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1573
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1572
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1573
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1574 1574
 	}
1575 1575
 
1576 1576
 	/**
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
 	 */
1583 1583
     public function get_recurring_total() {
1584 1584
 
1585
-		if ( empty( $this->totals ) ) {
1585
+		if (empty($this->totals)) {
1586 1586
 			$this->recalculate_total();
1587 1587
 		}
1588 1588
 
@@ -1592,12 +1592,12 @@  discard block
 block discarded – undo
1592 1592
 		$subtotal = $this->totals['subtotal']['recurring'];
1593 1593
 		$total    = $tax + $fee - $discount + $subtotal;
1594 1594
 
1595
-		if ( 0 > $total ) {
1595
+		if (0 > $total) {
1596 1596
 			$total = 0;
1597 1597
 		}
1598 1598
 
1599
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1600
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1599
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1600
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1601 1601
 	}
1602 1602
 
1603 1603
 	/**
@@ -1608,10 +1608,10 @@  discard block
 block discarded – undo
1608 1608
 	 * @param string $currency Whether to include the currency.
1609 1609
      * @return float|string
1610 1610
 	 */
1611
-    public function get_recurring_details( $field = '', $currency = false ) {
1611
+    public function get_recurring_details($field = '', $currency = false) {
1612 1612
 
1613 1613
 		// Maybe recalculate totals.
1614
-		if ( empty( $this->totals ) ) {
1614
+		if (empty($this->totals)) {
1615 1615
 			$this->recalculate_total();
1616 1616
 		}
1617 1617
 
@@ -1631,8 +1631,8 @@  discard block
 block discarded – undo
1631 1631
 			$currency
1632 1632
 		);
1633 1633
 
1634
-        if ( isset( $data[ $field ] ) ) {
1635
-            return ( $currency ? wpinv_price( $data[ $field ], $this->get_currency() ) : $data[ $field ] );
1634
+        if (isset($data[$field])) {
1635
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1636 1636
         }
1637 1637
 
1638 1638
         return $data;
@@ -1645,8 +1645,8 @@  discard block
 block discarded – undo
1645 1645
 	 * @param  string $context View or edit context.
1646 1646
 	 * @return array
1647 1647
 	 */
1648
-	public function get_fees( $context = 'view' ) {
1649
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1648
+	public function get_fees($context = 'view') {
1649
+		return wpinv_parse_list($this->get_prop('fees', $context));
1650 1650
     }
1651 1651
 
1652 1652
     /**
@@ -1656,8 +1656,8 @@  discard block
 block discarded – undo
1656 1656
 	 * @param  string $context View or edit context.
1657 1657
 	 * @return array
1658 1658
 	 */
1659
-	public function get_discounts( $context = 'view' ) {
1660
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1659
+	public function get_discounts($context = 'view') {
1660
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1661 1661
     }
1662 1662
 
1663 1663
     /**
@@ -1667,8 +1667,8 @@  discard block
 block discarded – undo
1667 1667
 	 * @param  string $context View or edit context.
1668 1668
 	 * @return array
1669 1669
 	 */
1670
-	public function get_taxes( $context = 'view' ) {
1671
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1670
+	public function get_taxes($context = 'view') {
1671
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1672 1672
     }
1673 1673
 
1674 1674
     /**
@@ -1678,8 +1678,8 @@  discard block
 block discarded – undo
1678 1678
 	 * @param  string $context View or edit context.
1679 1679
 	 * @return GetPaid_Form_Item[]
1680 1680
 	 */
1681
-	public function get_items( $context = 'view' ) {
1682
-        return $this->get_prop( 'items', $context );
1681
+	public function get_items($context = 'view') {
1682
+        return $this->get_prop('items', $context);
1683 1683
 	}
1684 1684
 
1685 1685
 	/**
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 	 * @return string
1690 1690
 	 */
1691 1691
 	public function get_item_ids() {
1692
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1692
+		return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id'));
1693 1693
     }
1694 1694
 
1695 1695
     /**
@@ -1699,8 +1699,8 @@  discard block
 block discarded – undo
1699 1699
 	 * @param  string $context View or edit context.
1700 1700
 	 * @return int
1701 1701
 	 */
1702
-	public function get_payment_form( $context = 'view' ) {
1703
-		return intval( $this->get_prop( 'payment_form', $context ) );
1702
+	public function get_payment_form($context = 'view') {
1703
+		return intval($this->get_prop('payment_form', $context));
1704 1704
     }
1705 1705
 
1706 1706
     /**
@@ -1710,8 +1710,8 @@  discard block
 block discarded – undo
1710 1710
 	 * @param  string $context View or edit context.
1711 1711
 	 * @return string
1712 1712
 	 */
1713
-	public function get_submission_id( $context = 'view' ) {
1714
-		return $this->get_prop( 'submission_id', $context );
1713
+	public function get_submission_id($context = 'view') {
1714
+		return $this->get_prop('submission_id', $context);
1715 1715
     }
1716 1716
 
1717 1717
     /**
@@ -1721,8 +1721,8 @@  discard block
 block discarded – undo
1721 1721
 	 * @param  string $context View or edit context.
1722 1722
 	 * @return string
1723 1723
 	 */
1724
-	public function get_discount_code( $context = 'view' ) {
1725
-		return $this->get_prop( 'discount_code', $context );
1724
+	public function get_discount_code($context = 'view') {
1725
+		return $this->get_prop('discount_code', $context);
1726 1726
     }
1727 1727
 
1728 1728
     /**
@@ -1732,8 +1732,8 @@  discard block
 block discarded – undo
1732 1732
 	 * @param  string $context View or edit context.
1733 1733
 	 * @return string
1734 1734
 	 */
1735
-	public function get_gateway( $context = 'view' ) {
1736
-		return $this->get_prop( 'gateway', $context );
1735
+	public function get_gateway($context = 'view') {
1736
+		return $this->get_prop('gateway', $context);
1737 1737
     }
1738 1738
 
1739 1739
     /**
@@ -1743,8 +1743,8 @@  discard block
 block discarded – undo
1743 1743
 	 * @return string
1744 1744
 	 */
1745 1745
     public function get_gateway_title() {
1746
-        $title = wpinv_get_gateway_checkout_label( $this->get_gateway() );
1747
-        return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1746
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1747
+        return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this);
1748 1748
     }
1749 1749
 
1750 1750
     /**
@@ -1754,8 +1754,8 @@  discard block
 block discarded – undo
1754 1754
 	 * @param  string $context View or edit context.
1755 1755
 	 * @return string
1756 1756
 	 */
1757
-	public function get_transaction_id( $context = 'view' ) {
1758
-		return $this->get_prop( 'transaction_id', $context );
1757
+	public function get_transaction_id($context = 'view') {
1758
+		return $this->get_prop('transaction_id', $context);
1759 1759
     }
1760 1760
 
1761 1761
     /**
@@ -1765,9 +1765,9 @@  discard block
 block discarded – undo
1765 1765
 	 * @param  string $context View or edit context.
1766 1766
 	 * @return string
1767 1767
 	 */
1768
-	public function get_currency( $context = 'view' ) {
1769
-        $currency = $this->get_prop( 'currency', $context );
1770
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1768
+	public function get_currency($context = 'view') {
1769
+        $currency = $this->get_prop('currency', $context);
1770
+        return empty($currency) ? wpinv_get_currency() : $currency;
1771 1771
     }
1772 1772
 
1773 1773
     /**
@@ -1777,8 +1777,8 @@  discard block
 block discarded – undo
1777 1777
 	 * @param  string $context View or edit context.
1778 1778
 	 * @return bool
1779 1779
 	 */
1780
-	public function get_disable_taxes( $context = 'view' ) {
1781
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1780
+	public function get_disable_taxes($context = 'view') {
1781
+        return (bool) $this->get_prop('disable_taxes', $context);
1782 1782
     }
1783 1783
 
1784 1784
     /**
@@ -1788,8 +1788,8 @@  discard block
 block discarded – undo
1788 1788
 	 * @param  string $context View or edit context.
1789 1789
 	 * @return int
1790 1790
 	 */
1791
-    public function get_subscription_id( $context = 'view' ) {
1792
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1791
+    public function get_subscription_id($context = 'view') {
1792
+		return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context);
1793 1793
 	}
1794 1794
 
1795 1795
 	/**
@@ -1799,12 +1799,12 @@  discard block
 block discarded – undo
1799 1799
 	 * @param  string $context View or edit context.
1800 1800
 	 * @return int
1801 1801
 	 */
1802
-    public function get_remote_subscription_id( $context = 'view' ) {
1803
-        $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1802
+    public function get_remote_subscription_id($context = 'view') {
1803
+        $subscription_id = $this->get_prop('remote_subscription_id', $context);
1804 1804
 
1805
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1805
+        if (empty($subscription_id) && $this->is_renewal()) {
1806 1806
             $parent = $this->get_parent();
1807
-            return $parent->get_remote_subscription_id( $context );
1807
+            return $parent->get_remote_subscription_id($context);
1808 1808
         }
1809 1809
 
1810 1810
         return $subscription_id;
@@ -1817,20 +1817,20 @@  discard block
 block discarded – undo
1817 1817
 	 * @param  string $context View or edit context.
1818 1818
 	 * @return array
1819 1819
 	 */
1820
-    public function get_payment_meta( $context = 'view' ) {
1820
+    public function get_payment_meta($context = 'view') {
1821 1821
 
1822 1822
         return array(
1823
-            'price'        => $this->get_total( $context ),
1824
-            'date'         => $this->get_date_created( $context ),
1825
-            'user_email'   => $this->get_email( $context ),
1826
-            'invoice_key'  => $this->get_key( $context ),
1827
-            'currency'     => $this->get_currency( $context ),
1828
-            'items'        => $this->get_items( $context ),
1829
-            'user_info'    => $this->get_user_info( $context ),
1823
+            'price'        => $this->get_total($context),
1824
+            'date'         => $this->get_date_created($context),
1825
+            'user_email'   => $this->get_email($context),
1826
+            'invoice_key'  => $this->get_key($context),
1827
+            'currency'     => $this->get_currency($context),
1828
+            'items'        => $this->get_items($context),
1829
+            'user_info'    => $this->get_user_info($context),
1830 1830
             'cart_details' => $this->get_cart_details(),
1831
-            'status'       => $this->get_status( $context ),
1832
-            'fees'         => $this->get_fees( $context ),
1833
-            'taxes'        => $this->get_taxes( $context ),
1831
+            'status'       => $this->get_status($context),
1832
+            'fees'         => $this->get_fees($context),
1833
+            'taxes'        => $this->get_taxes($context),
1834 1834
         );
1835 1835
 
1836 1836
     }
@@ -1845,9 +1845,9 @@  discard block
 block discarded – undo
1845 1845
         $items        = $this->get_items();
1846 1846
         $cart_details = array();
1847 1847
 
1848
-        foreach ( $items as $item ) {
1848
+        foreach ($items as $item) {
1849 1849
 			$item->invoice_id = $this->get_id();
1850
-            $cart_details[]   = $item->prepare_data_for_saving();
1850
+            $cart_details[] = $item->prepare_data_for_saving();
1851 1851
         }
1852 1852
 
1853 1853
         return $cart_details;
@@ -1858,11 +1858,11 @@  discard block
 block discarded – undo
1858 1858
 	 *
1859 1859
 	 * @return null|GetPaid_Form_Item|int
1860 1860
 	 */
1861
-	public function get_recurring( $object = false ) {
1861
+	public function get_recurring($object = false) {
1862 1862
 
1863 1863
 		// Are we returning an object?
1864
-        if ( $object ) {
1865
-            return $this->get_item( $this->recurring_item );
1864
+        if ($object) {
1865
+            return $this->get_item($this->recurring_item);
1866 1866
         }
1867 1867
 
1868 1868
         return $this->recurring_item;
@@ -1877,15 +1877,15 @@  discard block
 block discarded – undo
1877 1877
 	public function get_subscription_name() {
1878 1878
 
1879 1879
 		// Retrieve the recurring name
1880
-        $item = $this->get_recurring( true );
1880
+        $item = $this->get_recurring(true);
1881 1881
 
1882 1882
 		// Abort if it does not exist.
1883
-        if ( empty( $item ) ) {
1883
+        if (empty($item)) {
1884 1884
             return '';
1885 1885
         }
1886 1886
 
1887 1887
 		// Return the item name.
1888
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1888
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1889 1889
 	}
1890 1890
 
1891 1891
 	/**
@@ -1895,9 +1895,9 @@  discard block
 block discarded – undo
1895 1895
 	 * @return string
1896 1896
 	 */
1897 1897
 	public function get_view_url() {
1898
-        $invoice_url = get_permalink( $this->get_id() );
1899
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1900
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1898
+        $invoice_url = get_permalink($this->get_id());
1899
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1900
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1901 1901
 	}
1902 1902
 
1903 1903
 	/**
@@ -1906,25 +1906,25 @@  discard block
 block discarded – undo
1906 1906
 	 * @since 1.0.19
1907 1907
 	 * @return string
1908 1908
 	 */
1909
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1909
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1910 1910
 
1911 1911
 		// Retrieve the checkout url.
1912 1912
         $pay_url = wpinv_get_checkout_uri();
1913 1913
 
1914 1914
 		// Maybe force ssl.
1915
-        if ( is_ssl() ) {
1916
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1915
+        if (is_ssl()) {
1916
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1917 1917
         }
1918 1918
 
1919 1919
 		// Add the invoice key.
1920
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1920
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1921 1921
 
1922 1922
 		// (Maybe?) add a secret
1923
-        if ( $secret ) {
1924
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1923
+        if ($secret) {
1924
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1925 1925
         }
1926 1926
 
1927
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1927
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1928 1928
 	}
1929 1929
 
1930 1930
 	/**
@@ -1939,14 +1939,14 @@  discard block
 block discarded – undo
1939 1939
         $receipt_url = wpinv_get_success_page_uri();
1940 1940
 
1941 1941
 		// Maybe force ssl.
1942
-        if ( is_ssl() ) {
1943
-            $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1942
+        if (is_ssl()) {
1943
+            $receipt_url = str_replace('http:', 'https:', $receipt_url);
1944 1944
         }
1945 1945
 
1946 1946
 		// Add the invoice key.
1947
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1947
+		$receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url);
1948 1948
 
1949
-        return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1949
+        return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this);
1950 1950
 	}
1951 1951
 
1952 1952
 	/**
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 	 * @return string
1957 1957
 	 */
1958 1958
 	public function get_transaction_url() {
1959
-		return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1959
+		return apply_filters('getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this);
1960 1960
 	}
1961 1961
 
1962 1962
 	/**
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
 		$type   = $this->get_type();
1971 1971
 		$status = "wpi-$type-pending";
1972
-		return str_replace( '-invoice', '', $status );
1972
+		return str_replace('-invoice', '', $status);
1973 1973
 
1974 1974
 	}
1975 1975
 
@@ -1983,8 +1983,8 @@  discard block
 block discarded – undo
1983 1983
 	 * @param  string $context View or edit context.
1984 1984
 	 * @return mixed Value of the given invoice property (if set).
1985 1985
 	 */
1986
-	public function get( $key, $context = 'view' ) {
1987
-        return $this->get_prop( $key, $context );
1986
+	public function get($key, $context = 'view') {
1987
+        return $this->get_prop($key, $context);
1988 1988
 	}
1989 1989
 
1990 1990
     /*
@@ -2007,11 +2007,11 @@  discard block
 block discarded – undo
2007 2007
 	 * @param  mixed $value new value.
2008 2008
 	 * @return mixed Value of the given invoice property (if set).
2009 2009
 	 */
2010
-	public function set( $key, $value ) {
2010
+	public function set($key, $value) {
2011 2011
 
2012 2012
         $setter = "set_$key";
2013
-        if ( is_callable( array( $this, $setter ) ) ) {
2014
-            $this->{$setter}( $value );
2013
+        if (is_callable(array($this, $setter))) {
2014
+            $this->{$setter}($value);
2015 2015
         }
2016 2016
 
2017 2017
 	}
@@ -2025,45 +2025,45 @@  discard block
 block discarded – undo
2025 2025
 	 * @param bool   $manual_update Is this a manual status change?.
2026 2026
 	 * @return array details of change.
2027 2027
 	 */
2028
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
2028
+	public function set_status($new_status, $note = '', $manual_update = false) {
2029 2029
 		$old_status = $this->get_status();
2030 2030
 
2031 2031
 		$statuses = $this->get_all_statuses();
2032 2032
 
2033
-		if ( isset( $statuses['draft'] ) ) {
2034
-			unset( $statuses['draft'] );
2033
+		if (isset($statuses['draft'])) {
2034
+			unset($statuses['draft']);
2035 2035
 		}
2036 2036
 
2037
-		$this->set_prop( 'status', $new_status );
2037
+		$this->set_prop('status', $new_status);
2038 2038
 
2039 2039
 		// If setting the status, ensure it's set to a valid status.
2040
-		if ( true === $this->object_read ) {
2040
+		if (true === $this->object_read) {
2041 2041
 
2042 2042
 			// Only allow valid new status.
2043
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
2043
+			if (!array_key_exists($new_status, $statuses)) {
2044 2044
 				$new_status = $this->get_default_status();
2045 2045
 			}
2046 2046
 
2047 2047
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2048
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2048
+			if ($old_status && !array_key_exists($new_status, $statuses)) {
2049 2049
 				$old_status = $this->get_default_status();
2050 2050
 			}
2051 2051
 
2052 2052
 			// Paid - Renewal (i.e when duplicating a parent invoice )
2053
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2053
+			if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) {
2054 2054
 				$old_status = 'wpi-pending';
2055 2055
 			}
2056 2056
 
2057
-			if ( $old_status !== $new_status ) {
2057
+			if ($old_status !== $new_status) {
2058 2058
 				$this->status_transition = array(
2059
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2059
+					'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
2060 2060
 					'to'     => $new_status,
2061 2061
 					'note'   => $note,
2062 2062
 					'manual' => (bool) $manual_update,
2063 2063
 				);
2064 2064
 
2065
-				if ( $manual_update ) {
2066
-					do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2065
+				if ($manual_update) {
2066
+					do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
2067 2067
 				}
2068 2068
 
2069 2069
 				$this->maybe_set_date_paid();
@@ -2087,8 +2087,8 @@  discard block
 block discarded – undo
2087 2087
 	 */
2088 2088
 	public function maybe_set_date_paid() {
2089 2089
 
2090
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2091
-			$this->set_date_completed( current_time( 'mysql' ) );
2090
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
2091
+			$this->set_date_completed(current_time('mysql'));
2092 2092
 		}
2093 2093
 	}
2094 2094
 
@@ -2097,11 +2097,11 @@  discard block
 block discarded – undo
2097 2097
 	 *
2098 2098
 	 * @since 1.0.19
2099 2099
 	 */
2100
-	public function set_parent_id( $value ) {
2101
-		if ( $value && ( $value === $this->get_id() ) ) {
2100
+	public function set_parent_id($value) {
2101
+		if ($value && ($value === $this->get_id())) {
2102 2102
 			return;
2103 2103
 		}
2104
-		$this->set_prop( 'parent_id', absint( $value ) );
2104
+		$this->set_prop('parent_id', absint($value));
2105 2105
     }
2106 2106
 
2107 2107
     /**
@@ -2109,8 +2109,8 @@  discard block
 block discarded – undo
2109 2109
 	 *
2110 2110
 	 * @since 1.0.19
2111 2111
 	 */
2112
-	public function set_version( $value ) {
2113
-		$this->set_prop( 'version', $value );
2112
+	public function set_version($value) {
2113
+		$this->set_prop('version', $value);
2114 2114
     }
2115 2115
 
2116 2116
     /**
@@ -2120,15 +2120,15 @@  discard block
 block discarded – undo
2120 2120
 	 * @param string $value Value to set.
2121 2121
      * @return bool Whether or not the date was set.
2122 2122
 	 */
2123
-	public function set_date_created( $value ) {
2124
-        $date = strtotime( $value );
2123
+	public function set_date_created($value) {
2124
+        $date = strtotime($value);
2125 2125
 
2126
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2127
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
2126
+        if ($date && $value !== '0000-00-00 00:00:00') {
2127
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
2128 2128
             return true;
2129 2129
         }
2130 2130
 
2131
-		$this->set_prop( 'date_created', '' );
2131
+		$this->set_prop('date_created', '');
2132 2132
 		return false;
2133 2133
 
2134 2134
     }
@@ -2140,15 +2140,15 @@  discard block
 block discarded – undo
2140 2140
 	 * @param string $value Value to set.
2141 2141
      * @return bool Whether or not the date was set.
2142 2142
 	 */
2143
-	public function set_due_date( $value ) {
2144
-        $date = strtotime( $value );
2143
+	public function set_due_date($value) {
2144
+        $date = strtotime($value);
2145 2145
 
2146
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2147
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
2146
+        if ($date && $value !== '0000-00-00 00:00:00') {
2147
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
2148 2148
             return true;
2149 2149
         }
2150 2150
 
2151
-		$this->set_prop( 'due_date', '' );
2151
+		$this->set_prop('due_date', '');
2152 2152
         return false;
2153 2153
 
2154 2154
     }
@@ -2159,8 +2159,8 @@  discard block
 block discarded – undo
2159 2159
 	 * @since 1.0.19
2160 2160
 	 * @param  string $value New name.
2161 2161
 	 */
2162
-	public function set_date_due( $value ) {
2163
-		$this->set_due_date( $value );
2162
+	public function set_date_due($value) {
2163
+		$this->set_due_date($value);
2164 2164
     }
2165 2165
 
2166 2166
     /**
@@ -2170,15 +2170,15 @@  discard block
 block discarded – undo
2170 2170
 	 * @param string $value Value to set.
2171 2171
      * @return bool Whether or not the date was set.
2172 2172
 	 */
2173
-	public function set_completed_date( $value ) {
2174
-        $date = strtotime( $value );
2173
+	public function set_completed_date($value) {
2174
+        $date = strtotime($value);
2175 2175
 
2176
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2177
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
2176
+        if ($date && $value !== '0000-00-00 00:00:00') {
2177
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
2178 2178
             return true;
2179 2179
         }
2180 2180
 
2181
-		$this->set_prop( 'completed_date', '' );
2181
+		$this->set_prop('completed_date', '');
2182 2182
         return false;
2183 2183
 
2184 2184
     }
@@ -2189,8 +2189,8 @@  discard block
 block discarded – undo
2189 2189
 	 * @since 1.0.19
2190 2190
 	 * @param  string $value New name.
2191 2191
 	 */
2192
-	public function set_date_completed( $value ) {
2193
-		$this->set_completed_date( $value );
2192
+	public function set_date_completed($value) {
2193
+		$this->set_completed_date($value);
2194 2194
     }
2195 2195
 
2196 2196
     /**
@@ -2200,15 +2200,15 @@  discard block
 block discarded – undo
2200 2200
 	 * @param string $value Value to set.
2201 2201
      * @return bool Whether or not the date was set.
2202 2202
 	 */
2203
-	public function set_date_modified( $value ) {
2204
-        $date = strtotime( $value );
2203
+	public function set_date_modified($value) {
2204
+        $date = strtotime($value);
2205 2205
 
2206
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2207
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
2206
+        if ($date && $value !== '0000-00-00 00:00:00') {
2207
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
2208 2208
             return true;
2209 2209
         }
2210 2210
 
2211
-		$this->set_prop( 'date_modified', '' );
2211
+		$this->set_prop('date_modified', '');
2212 2212
         return false;
2213 2213
 
2214 2214
     }
@@ -2219,9 +2219,9 @@  discard block
 block discarded – undo
2219 2219
 	 * @since 1.0.19
2220 2220
 	 * @param  string $value New number.
2221 2221
 	 */
2222
-	public function set_number( $value ) {
2223
-        $number = sanitize_text_field( $value );
2224
-		$this->set_prop( 'number', $number );
2222
+	public function set_number($value) {
2223
+        $number = sanitize_text_field($value);
2224
+		$this->set_prop('number', $number);
2225 2225
     }
2226 2226
 
2227 2227
     /**
@@ -2230,9 +2230,9 @@  discard block
 block discarded – undo
2230 2230
 	 * @since 1.0.19
2231 2231
 	 * @param  string $value Type.
2232 2232
 	 */
2233
-	public function set_type( $value ) {
2234
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2235
-		$this->set_prop( 'type', $type );
2233
+	public function set_type($value) {
2234
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
2235
+		$this->set_prop('type', $type);
2236 2236
 	}
2237 2237
 
2238 2238
     /**
@@ -2241,10 +2241,10 @@  discard block
 block discarded – undo
2241 2241
 	 * @since 1.0.19
2242 2242
 	 * @param  string $value Post type.
2243 2243
 	 */
2244
-	public function set_post_type( $value ) {
2245
-        if ( getpaid_is_invoice_post_type( $value ) ) {
2246
-			$this->set_type( $value );
2247
-            $this->set_prop( 'post_type', $value );
2244
+	public function set_post_type($value) {
2245
+        if (getpaid_is_invoice_post_type($value)) {
2246
+			$this->set_type($value);
2247
+            $this->set_prop('post_type', $value);
2248 2248
         }
2249 2249
     }
2250 2250
 
@@ -2254,9 +2254,9 @@  discard block
 block discarded – undo
2254 2254
 	 * @since 1.0.19
2255 2255
 	 * @param  string $value New key.
2256 2256
 	 */
2257
-	public function set_key( $value ) {
2258
-        $key = sanitize_text_field( $value );
2259
-		$this->set_prop( 'key', $key );
2257
+	public function set_key($value) {
2258
+        $key = sanitize_text_field($value);
2259
+		$this->set_prop('key', $key);
2260 2260
     }
2261 2261
 
2262 2262
     /**
@@ -2265,9 +2265,9 @@  discard block
 block discarded – undo
2265 2265
 	 * @since 1.0.19
2266 2266
 	 * @param  string $value mode.
2267 2267
 	 */
2268
-	public function set_mode( $value ) {
2269
-        if ( in_array( $value, array( 'live', 'test' ) ) ) {
2270
-            $this->set_prop( 'mode', $value );
2268
+	public function set_mode($value) {
2269
+        if (in_array($value, array('live', 'test'))) {
2270
+            $this->set_prop('mode', $value);
2271 2271
         }
2272 2272
     }
2273 2273
 
@@ -2277,8 +2277,8 @@  discard block
 block discarded – undo
2277 2277
 	 * @since 1.0.19
2278 2278
 	 * @param  string $value path.
2279 2279
 	 */
2280
-	public function set_path( $value ) {
2281
-        $this->set_prop( 'path', $value );
2280
+	public function set_path($value) {
2281
+        $this->set_prop('path', $value);
2282 2282
     }
2283 2283
 
2284 2284
     /**
@@ -2287,9 +2287,9 @@  discard block
 block discarded – undo
2287 2287
 	 * @since 1.0.19
2288 2288
 	 * @param  string $value New name.
2289 2289
 	 */
2290
-	public function set_name( $value ) {
2291
-        $name = sanitize_text_field( $value );
2292
-		$this->set_prop( 'name', $name );
2290
+	public function set_name($value) {
2291
+        $name = sanitize_text_field($value);
2292
+		$this->set_prop('name', $name);
2293 2293
     }
2294 2294
 
2295 2295
     /**
@@ -2298,8 +2298,8 @@  discard block
 block discarded – undo
2298 2298
 	 * @since 1.0.19
2299 2299
 	 * @param  string $value New name.
2300 2300
 	 */
2301
-	public function set_title( $value ) {
2302
-		$this->set_name( $value );
2301
+	public function set_title($value) {
2302
+		$this->set_name($value);
2303 2303
     }
2304 2304
 
2305 2305
     /**
@@ -2308,9 +2308,9 @@  discard block
 block discarded – undo
2308 2308
 	 * @since 1.0.19
2309 2309
 	 * @param  string $value New description.
2310 2310
 	 */
2311
-	public function set_description( $value ) {
2312
-        $description = wp_kses_post( $value );
2313
-		$this->set_prop( 'description', $description );
2311
+	public function set_description($value) {
2312
+        $description = wp_kses_post($value);
2313
+		$this->set_prop('description', $description);
2314 2314
     }
2315 2315
 
2316 2316
     /**
@@ -2319,8 +2319,8 @@  discard block
 block discarded – undo
2319 2319
 	 * @since 1.0.19
2320 2320
 	 * @param  string $value New description.
2321 2321
 	 */
2322
-	public function set_excerpt( $value ) {
2323
-		$this->set_description( $value );
2322
+	public function set_excerpt($value) {
2323
+		$this->set_description($value);
2324 2324
     }
2325 2325
 
2326 2326
     /**
@@ -2329,8 +2329,8 @@  discard block
 block discarded – undo
2329 2329
 	 * @since 1.0.19
2330 2330
 	 * @param  string $value New description.
2331 2331
 	 */
2332
-	public function set_summary( $value ) {
2333
-		$this->set_description( $value );
2332
+	public function set_summary($value) {
2333
+		$this->set_description($value);
2334 2334
     }
2335 2335
 
2336 2336
     /**
@@ -2339,12 +2339,12 @@  discard block
 block discarded – undo
2339 2339
 	 * @since 1.0.19
2340 2340
 	 * @param  int $value New author.
2341 2341
 	 */
2342
-	public function set_author( $value ) {
2343
-		$user = get_user_by( 'id', (int) $value );
2342
+	public function set_author($value) {
2343
+		$user = get_user_by('id', (int) $value);
2344 2344
 
2345
-		if ( $user && $user->ID ) {
2346
-			$this->set_prop( 'author', $user->ID );
2347
-			$this->set_prop( 'email', $user->user_email );
2345
+		if ($user && $user->ID) {
2346
+			$this->set_prop('author', $user->ID);
2347
+			$this->set_prop('email', $user->user_email);
2348 2348
 		}
2349 2349
 
2350 2350
     }
@@ -2355,8 +2355,8 @@  discard block
 block discarded – undo
2355 2355
 	 * @since 1.0.19
2356 2356
 	 * @param  int $value New user id.
2357 2357
 	 */
2358
-	public function set_user_id( $value ) {
2359
-		$this->set_author( $value );
2358
+	public function set_user_id($value) {
2359
+		$this->set_author($value);
2360 2360
     }
2361 2361
 
2362 2362
     /**
@@ -2365,8 +2365,8 @@  discard block
 block discarded – undo
2365 2365
 	 * @since 1.0.19
2366 2366
 	 * @param  int $value New user id.
2367 2367
 	 */
2368
-	public function set_customer_id( $value ) {
2369
-		$this->set_author( $value );
2368
+	public function set_customer_id($value) {
2369
+		$this->set_author($value);
2370 2370
     }
2371 2371
 
2372 2372
     /**
@@ -2375,8 +2375,8 @@  discard block
 block discarded – undo
2375 2375
 	 * @since 1.0.19
2376 2376
 	 * @param  string $value ip address.
2377 2377
 	 */
2378
-	public function set_ip( $value ) {
2379
-		$this->set_prop( 'ip', $value );
2378
+	public function set_ip($value) {
2379
+		$this->set_prop('ip', $value);
2380 2380
     }
2381 2381
 
2382 2382
     /**
@@ -2385,8 +2385,8 @@  discard block
 block discarded – undo
2385 2385
 	 * @since 1.0.19
2386 2386
 	 * @param  string $value ip address.
2387 2387
 	 */
2388
-	public function set_user_ip( $value ) {
2389
-		$this->set_ip( $value );
2388
+	public function set_user_ip($value) {
2389
+		$this->set_ip($value);
2390 2390
     }
2391 2391
 
2392 2392
     /**
@@ -2395,8 +2395,8 @@  discard block
 block discarded – undo
2395 2395
 	 * @since 1.0.19
2396 2396
 	 * @param  string $value first name.
2397 2397
 	 */
2398
-	public function set_first_name( $value ) {
2399
-		$this->set_prop( 'first_name', $value );
2398
+	public function set_first_name($value) {
2399
+		$this->set_prop('first_name', $value);
2400 2400
     }
2401 2401
 
2402 2402
     /**
@@ -2405,8 +2405,8 @@  discard block
 block discarded – undo
2405 2405
 	 * @since 1.0.19
2406 2406
 	 * @param  string $value first name.
2407 2407
 	 */
2408
-	public function set_user_first_name( $value ) {
2409
-		$this->set_first_name( $value );
2408
+	public function set_user_first_name($value) {
2409
+		$this->set_first_name($value);
2410 2410
     }
2411 2411
 
2412 2412
     /**
@@ -2415,8 +2415,8 @@  discard block
 block discarded – undo
2415 2415
 	 * @since 1.0.19
2416 2416
 	 * @param  string $value first name.
2417 2417
 	 */
2418
-	public function set_customer_first_name( $value ) {
2419
-		$this->set_first_name( $value );
2418
+	public function set_customer_first_name($value) {
2419
+		$this->set_first_name($value);
2420 2420
     }
2421 2421
 
2422 2422
     /**
@@ -2425,8 +2425,8 @@  discard block
 block discarded – undo
2425 2425
 	 * @since 1.0.19
2426 2426
 	 * @param  string $value last name.
2427 2427
 	 */
2428
-	public function set_last_name( $value ) {
2429
-		$this->set_prop( 'last_name', $value );
2428
+	public function set_last_name($value) {
2429
+		$this->set_prop('last_name', $value);
2430 2430
     }
2431 2431
 
2432 2432
     /**
@@ -2435,8 +2435,8 @@  discard block
 block discarded – undo
2435 2435
 	 * @since 1.0.19
2436 2436
 	 * @param  string $value last name.
2437 2437
 	 */
2438
-	public function set_user_last_name( $value ) {
2439
-		$this->set_last_name( $value );
2438
+	public function set_user_last_name($value) {
2439
+		$this->set_last_name($value);
2440 2440
     }
2441 2441
 
2442 2442
     /**
@@ -2445,8 +2445,8 @@  discard block
 block discarded – undo
2445 2445
 	 * @since 1.0.19
2446 2446
 	 * @param  string $value last name.
2447 2447
 	 */
2448
-	public function set_customer_last_name( $value ) {
2449
-		$this->set_last_name( $value );
2448
+	public function set_customer_last_name($value) {
2449
+		$this->set_last_name($value);
2450 2450
     }
2451 2451
 
2452 2452
     /**
@@ -2455,8 +2455,8 @@  discard block
 block discarded – undo
2455 2455
 	 * @since 1.0.19
2456 2456
 	 * @param  string $value phone.
2457 2457
 	 */
2458
-	public function set_phone( $value ) {
2459
-		$this->set_prop( 'phone', $value );
2458
+	public function set_phone($value) {
2459
+		$this->set_prop('phone', $value);
2460 2460
     }
2461 2461
 
2462 2462
     /**
@@ -2465,8 +2465,8 @@  discard block
 block discarded – undo
2465 2465
 	 * @since 1.0.19
2466 2466
 	 * @param  string $value phone.
2467 2467
 	 */
2468
-	public function set_user_phone( $value ) {
2469
-		$this->set_phone( $value );
2468
+	public function set_user_phone($value) {
2469
+		$this->set_phone($value);
2470 2470
     }
2471 2471
 
2472 2472
     /**
@@ -2475,8 +2475,8 @@  discard block
 block discarded – undo
2475 2475
 	 * @since 1.0.19
2476 2476
 	 * @param  string $value phone.
2477 2477
 	 */
2478
-	public function set_customer_phone( $value ) {
2479
-		$this->set_phone( $value );
2478
+	public function set_customer_phone($value) {
2479
+		$this->set_phone($value);
2480 2480
     }
2481 2481
 
2482 2482
     /**
@@ -2485,8 +2485,8 @@  discard block
 block discarded – undo
2485 2485
 	 * @since 1.0.19
2486 2486
 	 * @param  string $value phone.
2487 2487
 	 */
2488
-	public function set_phone_number( $value ) {
2489
-		$this->set_phone( $value );
2488
+	public function set_phone_number($value) {
2489
+		$this->set_phone($value);
2490 2490
     }
2491 2491
 
2492 2492
     /**
@@ -2495,8 +2495,8 @@  discard block
 block discarded – undo
2495 2495
 	 * @since 1.0.19
2496 2496
 	 * @param  string $value email address.
2497 2497
 	 */
2498
-	public function set_email( $value ) {
2499
-		$this->set_prop( 'email', $value );
2498
+	public function set_email($value) {
2499
+		$this->set_prop('email', $value);
2500 2500
     }
2501 2501
 
2502 2502
     /**
@@ -2505,8 +2505,8 @@  discard block
 block discarded – undo
2505 2505
 	 * @since 1.0.19
2506 2506
 	 * @param  string $value email address.
2507 2507
 	 */
2508
-	public function set_user_email( $value ) {
2509
-		$this->set_email( $value );
2508
+	public function set_user_email($value) {
2509
+		$this->set_email($value);
2510 2510
     }
2511 2511
 
2512 2512
     /**
@@ -2515,8 +2515,8 @@  discard block
 block discarded – undo
2515 2515
 	 * @since 1.0.19
2516 2516
 	 * @param  string $value email address.
2517 2517
 	 */
2518
-	public function set_email_address( $value ) {
2519
-		$this->set_email( $value );
2518
+	public function set_email_address($value) {
2519
+		$this->set_email($value);
2520 2520
     }
2521 2521
 
2522 2522
     /**
@@ -2525,8 +2525,8 @@  discard block
 block discarded – undo
2525 2525
 	 * @since 1.0.19
2526 2526
 	 * @param  string $value email address.
2527 2527
 	 */
2528
-	public function set_customer_email( $value ) {
2529
-		$this->set_email( $value );
2528
+	public function set_customer_email($value) {
2529
+		$this->set_email($value);
2530 2530
     }
2531 2531
 
2532 2532
     /**
@@ -2535,8 +2535,8 @@  discard block
 block discarded – undo
2535 2535
 	 * @since 1.0.19
2536 2536
 	 * @param  string $value country.
2537 2537
 	 */
2538
-	public function set_country( $value ) {
2539
-		$this->set_prop( 'country', $value );
2538
+	public function set_country($value) {
2539
+		$this->set_prop('country', $value);
2540 2540
     }
2541 2541
 
2542 2542
     /**
@@ -2545,8 +2545,8 @@  discard block
 block discarded – undo
2545 2545
 	 * @since 1.0.19
2546 2546
 	 * @param  string $value country.
2547 2547
 	 */
2548
-	public function set_user_country( $value ) {
2549
-		$this->set_country( $value );
2548
+	public function set_user_country($value) {
2549
+		$this->set_country($value);
2550 2550
     }
2551 2551
 
2552 2552
     /**
@@ -2555,8 +2555,8 @@  discard block
 block discarded – undo
2555 2555
 	 * @since 1.0.19
2556 2556
 	 * @param  string $value country.
2557 2557
 	 */
2558
-	public function set_customer_country( $value ) {
2559
-		$this->set_country( $value );
2558
+	public function set_customer_country($value) {
2559
+		$this->set_country($value);
2560 2560
     }
2561 2561
 
2562 2562
     /**
@@ -2565,8 +2565,8 @@  discard block
 block discarded – undo
2565 2565
 	 * @since 1.0.19
2566 2566
 	 * @param  string $value state.
2567 2567
 	 */
2568
-	public function set_state( $value ) {
2569
-		$this->set_prop( 'state', $value );
2568
+	public function set_state($value) {
2569
+		$this->set_prop('state', $value);
2570 2570
     }
2571 2571
 
2572 2572
     /**
@@ -2575,8 +2575,8 @@  discard block
 block discarded – undo
2575 2575
 	 * @since 1.0.19
2576 2576
 	 * @param  string $value state.
2577 2577
 	 */
2578
-	public function set_user_state( $value ) {
2579
-		$this->set_state( $value );
2578
+	public function set_user_state($value) {
2579
+		$this->set_state($value);
2580 2580
     }
2581 2581
 
2582 2582
     /**
@@ -2585,8 +2585,8 @@  discard block
 block discarded – undo
2585 2585
 	 * @since 1.0.19
2586 2586
 	 * @param  string $value state.
2587 2587
 	 */
2588
-	public function set_customer_state( $value ) {
2589
-		$this->set_state( $value );
2588
+	public function set_customer_state($value) {
2589
+		$this->set_state($value);
2590 2590
     }
2591 2591
 
2592 2592
     /**
@@ -2595,8 +2595,8 @@  discard block
 block discarded – undo
2595 2595
 	 * @since 1.0.19
2596 2596
 	 * @param  string $value city.
2597 2597
 	 */
2598
-	public function set_city( $value ) {
2599
-		$this->set_prop( 'city', $value );
2598
+	public function set_city($value) {
2599
+		$this->set_prop('city', $value);
2600 2600
     }
2601 2601
 
2602 2602
     /**
@@ -2605,8 +2605,8 @@  discard block
 block discarded – undo
2605 2605
 	 * @since 1.0.19
2606 2606
 	 * @param  string $value city.
2607 2607
 	 */
2608
-	public function set_user_city( $value ) {
2609
-		$this->set_city( $value );
2608
+	public function set_user_city($value) {
2609
+		$this->set_city($value);
2610 2610
     }
2611 2611
 
2612 2612
     /**
@@ -2615,8 +2615,8 @@  discard block
 block discarded – undo
2615 2615
 	 * @since 1.0.19
2616 2616
 	 * @param  string $value city.
2617 2617
 	 */
2618
-	public function set_customer_city( $value ) {
2619
-		$this->set_city( $value );
2618
+	public function set_customer_city($value) {
2619
+		$this->set_city($value);
2620 2620
     }
2621 2621
 
2622 2622
     /**
@@ -2625,8 +2625,8 @@  discard block
 block discarded – undo
2625 2625
 	 * @since 1.0.19
2626 2626
 	 * @param  string $value zip.
2627 2627
 	 */
2628
-	public function set_zip( $value ) {
2629
-		$this->set_prop( 'zip', $value );
2628
+	public function set_zip($value) {
2629
+		$this->set_prop('zip', $value);
2630 2630
     }
2631 2631
 
2632 2632
     /**
@@ -2635,8 +2635,8 @@  discard block
 block discarded – undo
2635 2635
 	 * @since 1.0.19
2636 2636
 	 * @param  string $value zip.
2637 2637
 	 */
2638
-	public function set_user_zip( $value ) {
2639
-		$this->set_zip( $value );
2638
+	public function set_user_zip($value) {
2639
+		$this->set_zip($value);
2640 2640
     }
2641 2641
 
2642 2642
     /**
@@ -2645,8 +2645,8 @@  discard block
 block discarded – undo
2645 2645
 	 * @since 1.0.19
2646 2646
 	 * @param  string $value zip.
2647 2647
 	 */
2648
-	public function set_customer_zip( $value ) {
2649
-		$this->set_zip( $value );
2648
+	public function set_customer_zip($value) {
2649
+		$this->set_zip($value);
2650 2650
     }
2651 2651
 
2652 2652
     /**
@@ -2655,8 +2655,8 @@  discard block
 block discarded – undo
2655 2655
 	 * @since 1.0.19
2656 2656
 	 * @param  string $value company.
2657 2657
 	 */
2658
-	public function set_company( $value ) {
2659
-		$this->set_prop( 'company', $value );
2658
+	public function set_company($value) {
2659
+		$this->set_prop('company', $value);
2660 2660
     }
2661 2661
 
2662 2662
     /**
@@ -2665,8 +2665,8 @@  discard block
 block discarded – undo
2665 2665
 	 * @since 1.0.19
2666 2666
 	 * @param  string $value company.
2667 2667
 	 */
2668
-	public function set_user_company( $value ) {
2669
-		$this->set_company( $value );
2668
+	public function set_user_company($value) {
2669
+		$this->set_company($value);
2670 2670
     }
2671 2671
 
2672 2672
     /**
@@ -2675,8 +2675,8 @@  discard block
 block discarded – undo
2675 2675
 	 * @since 1.0.19
2676 2676
 	 * @param  string $value company.
2677 2677
 	 */
2678
-	public function set_customer_company( $value ) {
2679
-		$this->set_company( $value );
2678
+	public function set_customer_company($value) {
2679
+		$this->set_company($value);
2680 2680
     }
2681 2681
 
2682 2682
 	/**
@@ -2685,8 +2685,8 @@  discard block
 block discarded – undo
2685 2685
 	 * @since 1.0.19
2686 2686
 	 * @param  string $value company id.
2687 2687
 	 */
2688
-	public function set_company_id( $value ) {
2689
-		$this->set_prop( 'company_id', $value );
2688
+	public function set_company_id($value) {
2689
+		$this->set_prop('company_id', $value);
2690 2690
     }
2691 2691
 
2692 2692
     /**
@@ -2695,8 +2695,8 @@  discard block
 block discarded – undo
2695 2695
 	 * @since 1.0.19
2696 2696
 	 * @param  string $value var number.
2697 2697
 	 */
2698
-	public function set_vat_number( $value ) {
2699
-		$this->set_prop( 'vat_number', $value );
2698
+	public function set_vat_number($value) {
2699
+		$this->set_prop('vat_number', $value);
2700 2700
     }
2701 2701
 
2702 2702
     /**
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @since 1.0.19
2706 2706
 	 * @param  string $value var number.
2707 2707
 	 */
2708
-	public function set_user_vat_number( $value ) {
2709
-		$this->set_vat_number( $value );
2708
+	public function set_user_vat_number($value) {
2709
+		$this->set_vat_number($value);
2710 2710
     }
2711 2711
 
2712 2712
     /**
@@ -2715,8 +2715,8 @@  discard block
 block discarded – undo
2715 2715
 	 * @since 1.0.19
2716 2716
 	 * @param  string $value var number.
2717 2717
 	 */
2718
-	public function set_customer_vat_number( $value ) {
2719
-		$this->set_vat_number( $value );
2718
+	public function set_customer_vat_number($value) {
2719
+		$this->set_vat_number($value);
2720 2720
     }
2721 2721
 
2722 2722
     /**
@@ -2725,8 +2725,8 @@  discard block
 block discarded – undo
2725 2725
 	 * @since 1.0.19
2726 2726
 	 * @param  string $value var rate.
2727 2727
 	 */
2728
-	public function set_vat_rate( $value ) {
2729
-		$this->set_prop( 'vat_rate', $value );
2728
+	public function set_vat_rate($value) {
2729
+		$this->set_prop('vat_rate', $value);
2730 2730
     }
2731 2731
 
2732 2732
     /**
@@ -2735,8 +2735,8 @@  discard block
 block discarded – undo
2735 2735
 	 * @since 1.0.19
2736 2736
 	 * @param  string $value var number.
2737 2737
 	 */
2738
-	public function set_user_vat_rate( $value ) {
2739
-		$this->set_vat_rate( $value );
2738
+	public function set_user_vat_rate($value) {
2739
+		$this->set_vat_rate($value);
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2745,8 +2745,8 @@  discard block
 block discarded – undo
2745 2745
 	 * @since 1.0.19
2746 2746
 	 * @param  string $value var number.
2747 2747
 	 */
2748
-	public function set_customer_vat_rate( $value ) {
2749
-		$this->set_vat_rate( $value );
2748
+	public function set_customer_vat_rate($value) {
2749
+		$this->set_vat_rate($value);
2750 2750
     }
2751 2751
 
2752 2752
     /**
@@ -2755,8 +2755,8 @@  discard block
 block discarded – undo
2755 2755
 	 * @since 1.0.19
2756 2756
 	 * @param  string $value address.
2757 2757
 	 */
2758
-	public function set_address( $value ) {
2759
-		$this->set_prop( 'address', $value );
2758
+	public function set_address($value) {
2759
+		$this->set_prop('address', $value);
2760 2760
     }
2761 2761
 
2762 2762
     /**
@@ -2765,8 +2765,8 @@  discard block
 block discarded – undo
2765 2765
 	 * @since 1.0.19
2766 2766
 	 * @param  string $value address.
2767 2767
 	 */
2768
-	public function set_user_address( $value ) {
2769
-		$this->set_address( $value );
2768
+	public function set_user_address($value) {
2769
+		$this->set_address($value);
2770 2770
     }
2771 2771
 
2772 2772
     /**
@@ -2775,8 +2775,8 @@  discard block
 block discarded – undo
2775 2775
 	 * @since 1.0.19
2776 2776
 	 * @param  string $value address.
2777 2777
 	 */
2778
-	public function set_customer_address( $value ) {
2779
-		$this->set_address( $value );
2778
+	public function set_customer_address($value) {
2779
+		$this->set_address($value);
2780 2780
     }
2781 2781
 
2782 2782
     /**
@@ -2785,8 +2785,8 @@  discard block
 block discarded – undo
2785 2785
 	 * @since 1.0.19
2786 2786
 	 * @param  int|bool $value confirmed.
2787 2787
 	 */
2788
-	public function set_is_viewed( $value ) {
2789
-		$this->set_prop( 'is_viewed', $value );
2788
+	public function set_is_viewed($value) {
2789
+		$this->set_prop('is_viewed', $value);
2790 2790
 	}
2791 2791
 
2792 2792
 	/**
@@ -2795,8 +2795,8 @@  discard block
 block discarded – undo
2795 2795
 	 * @since 1.0.19
2796 2796
 	 * @param  string $value email recipients.
2797 2797
 	 */
2798
-	public function set_email_cc( $value ) {
2799
-		$this->set_prop( 'email_cc', $value );
2798
+	public function set_email_cc($value) {
2799
+		$this->set_prop('email_cc', $value);
2800 2800
 	}
2801 2801
 
2802 2802
 	/**
@@ -2805,9 +2805,9 @@  discard block
 block discarded – undo
2805 2805
 	 * @since 1.0.19
2806 2806
 	 * @param  string $value template.
2807 2807
 	 */
2808
-	public function set_template( $value ) {
2809
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2810
-			$this->set_prop( 'template', $value );
2808
+	public function set_template($value) {
2809
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2810
+			$this->set_prop('template', $value);
2811 2811
 		}
2812 2812
 	}
2813 2813
 
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
 	 * @param  string $value source.
2819 2819
 	 * @deprecated
2820 2820
 	 */
2821
-	public function created_via( $value ) {
2822
-		$this->set_created_via( sanitize_text_field( $value ) );
2821
+	public function created_via($value) {
2822
+		$this->set_created_via(sanitize_text_field($value));
2823 2823
 	}
2824 2824
 
2825 2825
 	/**
@@ -2828,8 +2828,8 @@  discard block
 block discarded – undo
2828 2828
 	 * @since 1.0.19
2829 2829
 	 * @param  string $value source.
2830 2830
 	 */
2831
-	public function set_created_via( $value ) {
2832
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2831
+	public function set_created_via($value) {
2832
+		$this->set_prop('created_via', sanitize_text_field($value));
2833 2833
 	}
2834 2834
 
2835 2835
 	/**
@@ -2838,8 +2838,8 @@  discard block
 block discarded – undo
2838 2838
 	 * @since 1.0.19
2839 2839
 	 * @param  int|bool $value confirmed.
2840 2840
 	 */
2841
-	public function set_address_confirmed( $value ) {
2842
-		$this->set_prop( 'address_confirmed', $value );
2841
+	public function set_address_confirmed($value) {
2842
+		$this->set_prop('address_confirmed', $value);
2843 2843
     }
2844 2844
 
2845 2845
     /**
@@ -2848,8 +2848,8 @@  discard block
 block discarded – undo
2848 2848
 	 * @since 1.0.19
2849 2849
 	 * @param  int|bool $value confirmed.
2850 2850
 	 */
2851
-	public function set_user_address_confirmed( $value ) {
2852
-		$this->set_address_confirmed( $value );
2851
+	public function set_user_address_confirmed($value) {
2852
+		$this->set_address_confirmed($value);
2853 2853
     }
2854 2854
 
2855 2855
     /**
@@ -2858,8 +2858,8 @@  discard block
 block discarded – undo
2858 2858
 	 * @since 1.0.19
2859 2859
 	 * @param  int|bool $value confirmed.
2860 2860
 	 */
2861
-	public function set_customer_address_confirmed( $value ) {
2862
-		$this->set_address_confirmed( $value );
2861
+	public function set_customer_address_confirmed($value) {
2862
+		$this->set_address_confirmed($value);
2863 2863
     }
2864 2864
 
2865 2865
     /**
@@ -2868,13 +2868,13 @@  discard block
 block discarded – undo
2868 2868
 	 * @since 1.0.19
2869 2869
 	 * @param  float $value shipping amount.
2870 2870
 	 */
2871
-	public function set_shipping( $value ) {
2871
+	public function set_shipping($value) {
2872 2872
 
2873
-		if ( ! is_numeric( $value ) ) {
2874
-			return $this->set_prop( 'shipping', null );
2873
+		if (!is_numeric($value)) {
2874
+			return $this->set_prop('shipping', null);
2875 2875
 		}
2876 2876
 
2877
-		$this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2877
+		$this->set_prop('shipping', max(0, floatval($value)));
2878 2878
 	}
2879 2879
 
2880 2880
 	/**
@@ -2883,8 +2883,8 @@  discard block
 block discarded – undo
2883 2883
 	 * @since 1.0.19
2884 2884
 	 * @param  float $value sub total.
2885 2885
 	 */
2886
-	public function set_subtotal( $value ) {
2887
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2886
+	public function set_subtotal($value) {
2887
+		$this->set_prop('subtotal', max(0, $value));
2888 2888
 	}
2889 2889
 
2890 2890
 	/**
@@ -2893,8 +2893,8 @@  discard block
 block discarded – undo
2893 2893
 	 * @since 1.0.19
2894 2894
 	 * @param  float $value sub total.
2895 2895
 	 */
2896
-	public function set_total( $value ) {
2897
-		$this->set_prop( 'total', max( 0, $value ) );
2896
+	public function set_total($value) {
2897
+		$this->set_prop('total', max(0, $value));
2898 2898
     }
2899 2899
 
2900 2900
     /**
@@ -2903,8 +2903,8 @@  discard block
 block discarded – undo
2903 2903
 	 * @since 1.0.19
2904 2904
 	 * @param  float $value discount total.
2905 2905
 	 */
2906
-	public function set_total_discount( $value ) {
2907
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2906
+	public function set_total_discount($value) {
2907
+		$this->set_prop('total_discount', max(0, $value));
2908 2908
     }
2909 2909
 
2910 2910
     /**
@@ -2913,8 +2913,8 @@  discard block
 block discarded – undo
2913 2913
 	 * @since 1.0.19
2914 2914
 	 * @param  float $value discount total.
2915 2915
 	 */
2916
-	public function set_discount( $value ) {
2917
-		$this->set_total_discount( $value );
2916
+	public function set_discount($value) {
2917
+		$this->set_total_discount($value);
2918 2918
     }
2919 2919
 
2920 2920
     /**
@@ -2923,8 +2923,8 @@  discard block
 block discarded – undo
2923 2923
 	 * @since 1.0.19
2924 2924
 	 * @param  float $value tax total.
2925 2925
 	 */
2926
-	public function set_total_tax( $value ) {
2927
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2926
+	public function set_total_tax($value) {
2927
+		$this->set_prop('total_tax', max(0, $value));
2928 2928
     }
2929 2929
 
2930 2930
     /**
@@ -2933,8 +2933,8 @@  discard block
 block discarded – undo
2933 2933
 	 * @since 1.0.19
2934 2934
 	 * @param  float $value tax total.
2935 2935
 	 */
2936
-	public function set_tax_total( $value ) {
2937
-		$this->set_total_tax( $value );
2936
+	public function set_tax_total($value) {
2937
+		$this->set_total_tax($value);
2938 2938
     }
2939 2939
 
2940 2940
     /**
@@ -2943,8 +2943,8 @@  discard block
 block discarded – undo
2943 2943
 	 * @since 1.0.19
2944 2944
 	 * @param  float $value fees total.
2945 2945
 	 */
2946
-	public function set_total_fees( $value ) {
2947
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2946
+	public function set_total_fees($value) {
2947
+		$this->set_prop('total_fees', max(0, $value));
2948 2948
     }
2949 2949
 
2950 2950
     /**
@@ -2953,8 +2953,8 @@  discard block
 block discarded – undo
2953 2953
 	 * @since 1.0.19
2954 2954
 	 * @param  float $value fees total.
2955 2955
 	 */
2956
-	public function set_fees_total( $value ) {
2957
-		$this->set_total_fees( $value );
2956
+	public function set_fees_total($value) {
2957
+		$this->set_total_fees($value);
2958 2958
     }
2959 2959
 
2960 2960
     /**
@@ -2963,13 +2963,13 @@  discard block
 block discarded – undo
2963 2963
 	 * @since 1.0.19
2964 2964
 	 * @param  array $value fees.
2965 2965
 	 */
2966
-	public function set_fees( $value ) {
2966
+	public function set_fees($value) {
2967 2967
 
2968
-		if ( ! is_array( $value ) ) {
2968
+		if (!is_array($value)) {
2969 2969
 			$value = array();
2970 2970
 		}
2971 2971
 
2972
-		$this->set_prop( 'fees', $value );
2972
+		$this->set_prop('fees', $value);
2973 2973
 
2974 2974
     }
2975 2975
 
@@ -2979,13 +2979,13 @@  discard block
 block discarded – undo
2979 2979
 	 * @since 1.0.19
2980 2980
 	 * @param  array $value taxes.
2981 2981
 	 */
2982
-	public function set_taxes( $value ) {
2982
+	public function set_taxes($value) {
2983 2983
 
2984
-		if ( ! is_array( $value ) ) {
2984
+		if (!is_array($value)) {
2985 2985
 			$value = array();
2986 2986
 		}
2987 2987
 
2988
-		$this->set_prop( 'taxes', $value );
2988
+		$this->set_prop('taxes', $value);
2989 2989
 
2990 2990
     }
2991 2991
 
@@ -2995,13 +2995,13 @@  discard block
 block discarded – undo
2995 2995
 	 * @since 1.0.19
2996 2996
 	 * @param  array $value discounts.
2997 2997
 	 */
2998
-	public function set_discounts( $value ) {
2998
+	public function set_discounts($value) {
2999 2999
 
3000
-		if ( ! is_array( $value ) ) {
3000
+		if (!is_array($value)) {
3001 3001
 			$value = array();
3002 3002
 		}
3003 3003
 
3004
-		$this->set_prop( 'discounts', $value );
3004
+		$this->set_prop('discounts', $value);
3005 3005
     }
3006 3006
 
3007 3007
     /**
@@ -3010,19 +3010,19 @@  discard block
 block discarded – undo
3010 3010
 	 * @since 1.0.19
3011 3011
 	 * @param  GetPaid_Form_Item[] $value items.
3012 3012
 	 */
3013
-	public function set_items( $value ) {
3013
+	public function set_items($value) {
3014 3014
 
3015 3015
         // Remove existing items.
3016
-        $this->set_prop( 'items', array() );
3016
+        $this->set_prop('items', array());
3017 3017
 		$this->recurring_item = null;
3018 3018
 
3019 3019
         // Ensure that we have an array.
3020
-        if ( ! is_array( $value ) ) {
3020
+        if (!is_array($value)) {
3021 3021
             return;
3022 3022
         }
3023 3023
 
3024
-        foreach ( $value as $item ) {
3025
-            $this->add_item( $item );
3024
+        foreach ($value as $item) {
3025
+            $this->add_item($item);
3026 3026
         }
3027 3027
 
3028 3028
     }
@@ -3033,8 +3033,8 @@  discard block
 block discarded – undo
3033 3033
 	 * @since 1.0.19
3034 3034
 	 * @param  int $value payment form.
3035 3035
 	 */
3036
-	public function set_payment_form( $value ) {
3037
-		$this->set_prop( 'payment_form', $value );
3036
+	public function set_payment_form($value) {
3037
+		$this->set_prop('payment_form', $value);
3038 3038
     }
3039 3039
 
3040 3040
     /**
@@ -3043,8 +3043,8 @@  discard block
 block discarded – undo
3043 3043
 	 * @since 1.0.19
3044 3044
 	 * @param  string $value submission id.
3045 3045
 	 */
3046
-	public function set_submission_id( $value ) {
3047
-		$this->set_prop( 'submission_id', $value );
3046
+	public function set_submission_id($value) {
3047
+		$this->set_prop('submission_id', $value);
3048 3048
     }
3049 3049
 
3050 3050
     /**
@@ -3053,8 +3053,8 @@  discard block
 block discarded – undo
3053 3053
 	 * @since 1.0.19
3054 3054
 	 * @param  string $value discount code.
3055 3055
 	 */
3056
-	public function set_discount_code( $value ) {
3057
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3056
+	public function set_discount_code($value) {
3057
+		$this->set_prop('discount_code', sanitize_text_field($value));
3058 3058
     }
3059 3059
 
3060 3060
     /**
@@ -3063,8 +3063,8 @@  discard block
 block discarded – undo
3063 3063
 	 * @since 1.0.19
3064 3064
 	 * @param  string $value gateway.
3065 3065
 	 */
3066
-	public function set_gateway( $value ) {
3067
-		$this->set_prop( 'gateway', $value );
3066
+	public function set_gateway($value) {
3067
+		$this->set_prop('gateway', $value);
3068 3068
     }
3069 3069
 
3070 3070
     /**
@@ -3073,9 +3073,9 @@  discard block
 block discarded – undo
3073 3073
 	 * @since 1.0.19
3074 3074
 	 * @param  string $value transaction id.
3075 3075
 	 */
3076
-	public function set_transaction_id( $value ) {
3077
-		if ( ! empty( $value ) ) {
3078
-			$this->set_prop( 'transaction_id', $value );
3076
+	public function set_transaction_id($value) {
3077
+		if (!empty($value)) {
3078
+			$this->set_prop('transaction_id', $value);
3079 3079
 		}
3080 3080
     }
3081 3081
 
@@ -3085,8 +3085,8 @@  discard block
 block discarded – undo
3085 3085
 	 * @since 1.0.19
3086 3086
 	 * @param  string $value currency id.
3087 3087
 	 */
3088
-	public function set_currency( $value ) {
3089
-		$this->set_prop( 'currency', $value );
3088
+	public function set_currency($value) {
3089
+		$this->set_prop('currency', $value);
3090 3090
     }
3091 3091
 
3092 3092
 	/**
@@ -3095,8 +3095,8 @@  discard block
 block discarded – undo
3095 3095
 	 * @since 1.0.19
3096 3096
 	 * @param  bool $value value.
3097 3097
 	 */
3098
-	public function set_disable_taxes( $value ) {
3099
-		$this->set_prop( 'disable_taxes', (bool) $value );
3098
+	public function set_disable_taxes($value) {
3099
+		$this->set_prop('disable_taxes', (bool) $value);
3100 3100
 	}
3101 3101
 
3102 3102
     /**
@@ -3105,8 +3105,8 @@  discard block
 block discarded – undo
3105 3105
 	 * @since 1.0.19
3106 3106
 	 * @param  string $value subscription id.
3107 3107
 	 */
3108
-	public function set_subscription_id( $value ) {
3109
-		$this->set_prop( 'subscription_id', $value );
3108
+	public function set_subscription_id($value) {
3109
+		$this->set_prop('subscription_id', $value);
3110 3110
 	}
3111 3111
 
3112 3112
 	/**
@@ -3115,8 +3115,8 @@  discard block
 block discarded – undo
3115 3115
 	 * @since 1.0.19
3116 3116
 	 * @param  string $value subscription id.
3117 3117
 	 */
3118
-	public function set_remote_subscription_id( $value ) {
3119
-		$this->set_prop( 'remote_subscription_id', $value );
3118
+	public function set_remote_subscription_id($value) {
3119
+		$this->set_prop('remote_subscription_id', $value);
3120 3120
     }
3121 3121
 
3122 3122
     /*
@@ -3133,28 +3133,28 @@  discard block
 block discarded – undo
3133 3133
      */
3134 3134
     public function is_parent() {
3135 3135
         $parent = $this->get_parent_id();
3136
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
3136
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
3137 3137
     }
3138 3138
 
3139 3139
     /**
3140 3140
      * Checks if this is a renewal invoice.
3141 3141
      */
3142 3142
     public function is_renewal() {
3143
-        return $this->is_recurring() && ! $this->is_parent();
3143
+        return $this->is_recurring() && !$this->is_parent();
3144 3144
     }
3145 3145
 
3146 3146
     /**
3147 3147
      * Checks if this is a recurring invoice.
3148 3148
      */
3149 3149
     public function is_recurring() {
3150
-        return ! empty( $this->recurring_item );
3150
+        return !empty($this->recurring_item);
3151 3151
     }
3152 3152
 
3153 3153
     /**
3154 3154
      * Checks if this is a taxable invoice.
3155 3155
      */
3156 3156
     public function is_taxable() {
3157
-        return ! $this->get_disable_taxes();
3157
+        return !$this->get_disable_taxes();
3158 3158
 	}
3159 3159
 
3160 3160
 	/**
@@ -3168,45 +3168,45 @@  discard block
 block discarded – undo
3168 3168
 	 * Checks to see if the invoice requires payment.
3169 3169
 	 */
3170 3170
 	public function is_free() {
3171
-        $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3171
+        $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0);
3172 3172
 
3173
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3173
+		if ($this->is_recurring() && $this->get_recurring_total() > 0) {
3174 3174
 			$is_free = false;
3175 3175
 		}
3176 3176
 
3177
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3177
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
3178 3178
     }
3179 3179
 
3180 3180
     /**
3181 3181
      * Checks if the invoice is paid.
3182 3182
      */
3183 3183
     public function is_paid() {
3184
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3185
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3184
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
3185
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
3186 3186
 	}
3187 3187
 
3188 3188
 	/**
3189 3189
      * Checks if the invoice needs payment.
3190 3190
      */
3191 3191
 	public function needs_payment() {
3192
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3193
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3192
+		$needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free();
3193
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
3194 3194
     }
3195 3195
 
3196 3196
 	/**
3197 3197
      * Checks if the invoice is refunded.
3198 3198
      */
3199 3199
 	public function is_refunded() {
3200
-        $is_refunded = $this->has_status( 'wpi-refunded' );
3201
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3200
+        $is_refunded = $this->has_status('wpi-refunded');
3201
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
3202 3202
 	}
3203 3203
 
3204 3204
 	/**
3205 3205
      * Checks if the invoice is held.
3206 3206
      */
3207 3207
 	public function is_held() {
3208
-        $is_held = $this->has_status( 'wpi-onhold' );
3209
-        return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3208
+        $is_held = $this->has_status('wpi-onhold');
3209
+        return apply_filters('wpinv_invoice_is_held', $is_held, $this);
3210 3210
 	}
3211 3211
 
3212 3212
 	/**
@@ -3214,30 +3214,30 @@  discard block
 block discarded – undo
3214 3214
      */
3215 3215
 	public function is_due() {
3216 3216
 		$due_date = $this->get_due_date();
3217
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3217
+		return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date);
3218 3218
 	}
3219 3219
 
3220 3220
 	/**
3221 3221
      * Checks if the invoice is draft.
3222 3222
      */
3223 3223
 	public function is_draft() {
3224
-        return $this->has_status( 'draft, auto-draft' );
3224
+        return $this->has_status('draft, auto-draft');
3225 3225
 	}
3226 3226
 
3227 3227
     /**
3228 3228
      * Checks if the invoice has a given status.
3229 3229
      */
3230
-    public function has_status( $status ) {
3231
-        $status = wpinv_parse_list( $status );
3232
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3230
+    public function has_status($status) {
3231
+        $status = wpinv_parse_list($status);
3232
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
3233 3233
 	}
3234 3234
 
3235 3235
 	/**
3236 3236
      * Checks if the invoice is of a given type.
3237 3237
      */
3238
-    public function is_type( $type ) {
3239
-        $type = wpinv_parse_list( $type );
3240
-        return in_array( $this->get_type(), $type );
3238
+    public function is_type($type) {
3239
+        $type = wpinv_parse_list($type);
3240
+        return in_array($this->get_type(), $type);
3241 3241
     }
3242 3242
 
3243 3243
     /**
@@ -3269,8 +3269,8 @@  discard block
 block discarded – undo
3269 3269
      *
3270 3270
      */
3271 3271
 	public function is_initial_free() {
3272
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3273
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3272
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
3273
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
3274 3274
     }
3275 3275
 
3276 3276
 	/**
@@ -3280,11 +3280,11 @@  discard block
 block discarded – undo
3280 3280
     public function item_has_free_trial() {
3281 3281
 
3282 3282
         // Ensure we have a recurring item.
3283
-        if ( ! $this->is_recurring() ) {
3283
+        if (!$this->is_recurring()) {
3284 3284
             return false;
3285 3285
         }
3286 3286
 
3287
-        $item = $this->get_recurring( true );
3287
+        $item = $this->get_recurring(true);
3288 3288
         return $item->has_free_trial();
3289 3289
 	}
3290 3290
 
@@ -3292,7 +3292,7 @@  discard block
 block discarded – undo
3292 3292
      * Check if the free trial is a result of a discount.
3293 3293
      */
3294 3294
     public function is_free_trial_from_discount() {
3295
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3295
+		return $this->has_free_trial() && !$this->item_has_free_trial();
3296 3296
 	}
3297 3297
 
3298 3298
 	/**
@@ -3300,12 +3300,12 @@  discard block
 block discarded – undo
3300 3300
      */
3301 3301
     public function discount_first_payment_only() {
3302 3302
 
3303
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3304
-        if ( ! $discount->exists() || ! $this->is_recurring() ) {
3303
+		$discount = wpinv_get_discount_obj($this->get_discount_code());
3304
+        if (!$discount->exists() || !$this->is_recurring()) {
3305 3305
             return true;
3306 3306
         }
3307 3307
 
3308
-        return ! $discount->get_is_recurring();
3308
+        return !$discount->get_is_recurring();
3309 3309
     }
3310 3310
 
3311 3311
     /*
@@ -3323,23 +3323,23 @@  discard block
 block discarded – undo
3323 3323
      * @param GetPaid_Form_Item|array $item
3324 3324
      * @return WP_Error|Bool
3325 3325
      */
3326
-    public function add_item( $item ) {
3326
+    public function add_item($item) {
3327 3327
 
3328
-		if ( is_array( $item ) ) {
3329
-			$item = $this->process_array_item( $item );
3328
+		if (is_array($item)) {
3329
+			$item = $this->process_array_item($item);
3330 3330
 		}
3331 3331
 
3332
-		if ( is_numeric( $item ) ) {
3333
-			$item = new GetPaid_Form_Item( $item );
3332
+		if (is_numeric($item)) {
3333
+			$item = new GetPaid_Form_Item($item);
3334 3334
 		}
3335 3335
 
3336 3336
         // Make sure that it is available for purchase.
3337
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3338
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3337
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
3338
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
3339 3339
         }
3340 3340
 
3341 3341
         // Do we have a recurring item?
3342
-		if ( $item->is_recurring() ) {
3342
+		if ($item->is_recurring()) {
3343 3343
 			$this->recurring_item = $item->get_id();
3344 3344
         }
3345 3345
 
@@ -3347,9 +3347,9 @@  discard block
 block discarded – undo
3347 3347
         $item->invoice_id = (int) $this->get_id();
3348 3348
 
3349 3349
 		// Remove duplicates.
3350
-		$this->remove_item( $item->get_id() );
3350
+		$this->remove_item($item->get_id());
3351 3351
 
3352
-		if ( 0 == $item->get_quantity() ) {
3352
+		if (0 == $item->get_quantity()) {
3353 3353
 			return;
3354 3354
 		}
3355 3355
 
@@ -3359,7 +3359,7 @@  discard block
 block discarded – undo
3359 3359
 		// Add new item.
3360 3360
         $items[] = $item;
3361 3361
 
3362
-        $this->set_prop( 'items', $items );
3362
+        $this->set_prop('items', $items);
3363 3363
 
3364 3364
 		return true;
3365 3365
 	}
@@ -3370,26 +3370,26 @@  discard block
 block discarded – undo
3370 3370
 	 * @since 1.0.19
3371 3371
 	 * @return GetPaid_Form_Item
3372 3372
 	 */
3373
-	protected function process_array_item( $array ) {
3373
+	protected function process_array_item($array) {
3374 3374
 
3375
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3376
-		$item    = new GetPaid_Form_Item( $item_id );
3375
+		$item_id = isset($array['item_id']) ? $array['item_id'] : 0;
3376
+		$item    = new GetPaid_Form_Item($item_id);
3377 3377
 
3378 3378
 		// Set item data.
3379
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3380
-			if ( isset( $array[ "item_$key" ] ) ) {
3379
+		foreach (array('name', 'price', 'description') as $key) {
3380
+			if (isset($array["item_$key"])) {
3381 3381
 				$method = "set_$key";
3382
-				$item->$method( $array[ "item_$key" ] );
3382
+				$item->$method($array["item_$key"]);
3383 3383
 			}
3384 3384
 		}
3385 3385
 
3386
-		if ( isset( $array['quantity'] ) ) {
3387
-			$item->set_quantity( $array['quantity'] );
3386
+		if (isset($array['quantity'])) {
3387
+			$item->set_quantity($array['quantity']);
3388 3388
 		}
3389 3389
 
3390 3390
 		// Set item meta.
3391
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3392
-			$item->set_item_meta( $array['meta'] );
3391
+		if (isset($array['meta']) && is_array($array['meta'])) {
3392
+			$item->set_item_meta($array['meta']);
3393 3393
 		}
3394 3394
 
3395 3395
 		return $item;
@@ -3402,10 +3402,10 @@  discard block
 block discarded – undo
3402 3402
 	 * @since 1.0.19
3403 3403
 	 * @return GetPaid_Form_Item|null
3404 3404
 	 */
3405
-	public function get_item( $item_id ) {
3405
+	public function get_item($item_id) {
3406 3406
 
3407
-		foreach ( $this->get_items() as $item ) {
3408
-			if ( (int) $item_id == $item->get_id() ) {
3407
+		foreach ($this->get_items() as $item) {
3408
+			if ((int) $item_id == $item->get_id()) {
3409 3409
 				return $item;
3410 3410
 			}
3411 3411
 		}
@@ -3418,16 +3418,16 @@  discard block
 block discarded – undo
3418 3418
 	 *
3419 3419
 	 * @since 1.0.19
3420 3420
 	 */
3421
-	public function remove_item( $item_id ) {
3421
+	public function remove_item($item_id) {
3422 3422
 		$items   = $this->get_items();
3423 3423
 		$item_id = (int) $item_id;
3424 3424
 
3425
-		foreach ( $items as $index => $item ) {
3426
-			if ( (int) $item_id == $item->get_id() ) {
3427
-				unset( $items[ $index ] );
3428
-				$this->set_prop( 'items', $items );
3425
+		foreach ($items as $index => $item) {
3426
+			if ((int) $item_id == $item->get_id()) {
3427
+				unset($items[$index]);
3428
+				$this->set_prop('items', $items);
3429 3429
 
3430
-				if ( $item_id == $this->recurring_item ) {
3430
+				if ($item_id == $this->recurring_item) {
3431 3431
 					$this->recurring_item = null;
3432 3432
 				}
3433 3433
 }
@@ -3441,11 +3441,11 @@  discard block
 block discarded – undo
3441 3441
 	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3442 3442
 	 * @since 1.0.19
3443 3443
 	 */
3444
-    public function add_fee( $fee ) {
3444
+    public function add_fee($fee) {
3445 3445
 
3446 3446
 		$fees                 = $this->get_fees();
3447
-		$fees[ $fee['name'] ] = $fee;
3448
-		$this->set_prop( 'fees', $fees );
3447
+		$fees[$fee['name']] = $fee;
3448
+		$this->set_prop('fees', $fees);
3449 3449
 
3450 3450
     }
3451 3451
 
@@ -3454,9 +3454,9 @@  discard block
 block discarded – undo
3454 3454
 	 *
3455 3455
 	 * @since 1.0.19
3456 3456
 	 */
3457
-	public function get_fee( $fee ) {
3457
+	public function get_fee($fee) {
3458 3458
         $fees = $this->get_fees();
3459
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3459
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3460 3460
     }
3461 3461
 
3462 3462
     /**
@@ -3464,11 +3464,11 @@  discard block
 block discarded – undo
3464 3464
 	 *
3465 3465
 	 * @since 1.0.19
3466 3466
 	 */
3467
-	public function remove_fee( $fee ) {
3467
+	public function remove_fee($fee) {
3468 3468
         $fees = $this->get_fees();
3469
-        if ( isset( $fees[ $fee ] ) ) {
3470
-            unset( $fees[ $fee ] );
3471
-            $this->set_prop( 'fees', $fees );
3469
+        if (isset($fees[$fee])) {
3470
+            unset($fees[$fee]);
3471
+            $this->set_prop('fees', $fees);
3472 3472
         }
3473 3473
     }
3474 3474
 
@@ -3478,11 +3478,11 @@  discard block
 block discarded – undo
3478 3478
 	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3479 3479
 	 * @since 1.0.19
3480 3480
 	 */
3481
-	public function add_discount( $discount ) {
3481
+	public function add_discount($discount) {
3482 3482
 
3483 3483
 		$discounts = $this->get_discounts();
3484
-		$discounts[ $discount['name'] ] = $discount;
3485
-		$this->set_prop( 'discounts', $discounts );
3484
+		$discounts[$discount['name']] = $discount;
3485
+		$this->set_prop('discounts', $discounts);
3486 3486
 
3487 3487
 	}
3488 3488
 
@@ -3492,15 +3492,15 @@  discard block
 block discarded – undo
3492 3492
 	 * @since 1.0.19
3493 3493
 	 * @return float
3494 3494
 	 */
3495
-	public function get_discount( $discount = false ) {
3495
+	public function get_discount($discount = false) {
3496 3496
 
3497 3497
 		// Backwards compatibilty.
3498
-		if ( empty( $discount ) ) {
3498
+		if (empty($discount)) {
3499 3499
 			return $this->get_total_discount();
3500 3500
 		}
3501 3501
 
3502 3502
         $discounts = $this->get_discounts();
3503
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3503
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3504 3504
     }
3505 3505
 
3506 3506
     /**
@@ -3508,15 +3508,15 @@  discard block
 block discarded – undo
3508 3508
 	 *
3509 3509
 	 * @since 1.0.19
3510 3510
 	 */
3511
-	public function remove_discount( $discount ) {
3511
+	public function remove_discount($discount) {
3512 3512
         $discounts = $this->get_discounts();
3513
-        if ( isset( $discounts[ $discount ] ) ) {
3514
-            unset( $discounts[ $discount ] );
3515
-            $this->set_prop( 'discounts', $discounts );
3513
+        if (isset($discounts[$discount])) {
3514
+            unset($discounts[$discount]);
3515
+            $this->set_prop('discounts', $discounts);
3516 3516
         }
3517 3517
 
3518
-		if ( 'discount_code' == $discount ) {
3519
-			foreach ( $this->get_items() as $item ) {
3518
+		if ('discount_code' == $discount) {
3519
+			foreach ($this->get_items() as $item) {
3520 3520
 				$item->item_discount           = 0;
3521 3521
 				$item->recurring_item_discount = 0;
3522 3522
 			}
@@ -3529,12 +3529,12 @@  discard block
 block discarded – undo
3529 3529
      *
3530 3530
      * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required.
3531 3531
      */
3532
-    public function add_tax( $tax ) {
3533
-        if ( $this->is_taxable() ) {
3532
+    public function add_tax($tax) {
3533
+        if ($this->is_taxable()) {
3534 3534
 
3535
-            $taxes                 = $this->get_taxes();
3536
-			$taxes[ $tax['name'] ] = $tax;
3537
-			$this->set_prop( 'taxes', $tax );
3535
+            $taxes = $this->get_taxes();
3536
+			$taxes[$tax['name']] = $tax;
3537
+			$this->set_prop('taxes', $tax);
3538 3538
 
3539 3539
         }
3540 3540
     }
@@ -3544,15 +3544,15 @@  discard block
 block discarded – undo
3544 3544
 	 *
3545 3545
 	 * @since 1.0.19
3546 3546
 	 */
3547
-	public function get_tax( $tax = null ) {
3547
+	public function get_tax($tax = null) {
3548 3548
 
3549 3549
 		// Backwards compatility.
3550
-		if ( empty( $tax ) ) {
3550
+		if (empty($tax)) {
3551 3551
 			return $this->get_total_tax();
3552 3552
 		}
3553 3553
 
3554 3554
         $taxes = $this->get_taxes();
3555
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3555
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3556 3556
     }
3557 3557
 
3558 3558
     /**
@@ -3560,11 +3560,11 @@  discard block
 block discarded – undo
3560 3560
 	 *
3561 3561
 	 * @since 1.0.19
3562 3562
 	 */
3563
-	public function remove_tax( $tax ) {
3563
+	public function remove_tax($tax) {
3564 3564
         $taxes = $this->get_taxes();
3565
-        if ( isset( $taxes[ $tax ] ) ) {
3566
-            unset( $taxes[ $tax ] );
3567
-            $this->set_prop( 'taxes', $taxes );
3565
+        if (isset($taxes[$tax])) {
3566
+            unset($taxes[$tax]);
3567
+            $this->set_prop('taxes', $taxes);
3568 3568
         }
3569 3569
     }
3570 3570
 
@@ -3575,22 +3575,22 @@  discard block
 block discarded – undo
3575 3575
 	 * @return float The recalculated subtotal
3576 3576
 	 */
3577 3577
 	public function recalculate_subtotal() {
3578
-        $items     = $this->get_items();
3578
+        $items = $this->get_items();
3579 3579
 		$subtotal  = 0;
3580 3580
 		$recurring = 0;
3581 3581
 
3582
-        foreach ( $items as $item ) {
3583
-			$subtotal  += $item->get_sub_total( 'edit' );
3584
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3582
+        foreach ($items as $item) {
3583
+			$subtotal  += $item->get_sub_total('edit');
3584
+			$recurring += $item->get_recurring_sub_total('edit');
3585 3585
         }
3586 3586
 
3587
-		if ( wpinv_prices_include_tax() ) {
3588
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3589
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3587
+		if (wpinv_prices_include_tax()) {
3588
+			$subtotal  = max(0, $subtotal - $this->totals['tax']['initial']);
3589
+			$recurring = max(0, $recurring - $this->totals['tax']['recurring']);
3590 3590
 		}
3591 3591
 
3592 3592
 		$current = $this->is_renewal() ? $recurring : $subtotal;
3593
-		$this->set_subtotal( $current );
3593
+		$this->set_subtotal($current);
3594 3594
 
3595 3595
 		$this->totals['subtotal'] = array(
3596 3596
 			'initial'   => $subtotal,
@@ -3611,14 +3611,14 @@  discard block
 block discarded – undo
3611 3611
 		$discount  = 0;
3612 3612
 		$recurring = 0;
3613 3613
 
3614
-        foreach ( $discounts as $data ) {
3615
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3616
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3614
+        foreach ($discounts as $data) {
3615
+			$discount  += wpinv_sanitize_amount($data['initial_discount']);
3616
+			$recurring += wpinv_sanitize_amount($data['recurring_discount']);
3617 3617
 		}
3618 3618
 
3619 3619
 		$current = $this->is_renewal() ? $recurring : $discount;
3620 3620
 
3621
-		$this->set_total_discount( $current );
3621
+		$this->set_total_discount($current);
3622 3622
 
3623 3623
 		$this->totals['discount'] = array(
3624 3624
 			'initial'   => $discount,
@@ -3639,13 +3639,13 @@  discard block
 block discarded – undo
3639 3639
 
3640 3640
 		// Maybe disable taxes.
3641 3641
 		$vat_number = $this->get_vat_number();
3642
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3642
+		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($this->get_country()) && !empty($vat_number);
3643 3643
 
3644
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3644
+		if (wpinv_is_base_country($this->get_country()) && 'vat_too' === wpinv_get_option('vat_same_country_rule', 'vat_too')) {
3645 3645
 			$skip_tax = false;
3646 3646
 		}
3647 3647
 
3648
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3648
+		if (!wpinv_use_taxes() || $this->get_disable_taxes() || !wpinv_is_country_taxable($this->get_country()) || $skip_tax) {
3649 3649
 
3650 3650
 			$this->totals['tax'] = array(
3651 3651
 				'initial'   => 0,
@@ -3654,37 +3654,37 @@  discard block
 block discarded – undo
3654 3654
 
3655 3655
 			$this->tax_rate = 0;
3656 3656
 
3657
-			$this->set_taxes( array() );
3657
+			$this->set_taxes(array());
3658 3658
 			$current = 0;
3659 3659
 		} else {
3660 3660
 
3661 3661
 			$item_taxes = array();
3662 3662
 
3663
-			foreach ( $this->get_items() as $item ) {
3664
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3665
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3666
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3667
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3668
-				foreach ( $taxes as $name => $amount ) {
3669
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3670
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3671
-
3672
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3673
-						$item_taxes[ $name ] = $tax;
3663
+			foreach ($this->get_items() as $item) {
3664
+				$rates    = getpaid_get_item_tax_rates($item, $this->get_country(), $this->get_state());
3665
+				$rates    = getpaid_filter_item_tax_rates($item, $rates);
3666
+				$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
3667
+				$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
3668
+				foreach ($taxes as $name => $amount) {
3669
+					$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
3670
+					$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
3671
+
3672
+					if (!isset($item_taxes[$name])) {
3673
+						$item_taxes[$name] = $tax;
3674 3674
 						continue;
3675 3675
 					}
3676 3676
 
3677
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3678
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3677
+					$item_taxes[$name]['initial_tax']   += $tax['initial_tax'];
3678
+					$item_taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
3679 3679
 
3680 3680
 				}
3681 3681
 			}
3682 3682
 
3683
-			$item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3684
-			$this->set_taxes( $item_taxes );
3683
+			$item_taxes = array_replace($this->get_taxes(), $item_taxes);
3684
+			$this->set_taxes($item_taxes);
3685 3685
 
3686
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3687
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3686
+			$initial_tax   = array_sum(wp_list_pluck($item_taxes, 'initial_tax'));
3687
+			$recurring_tax = array_sum(wp_list_pluck($item_taxes, 'recurring_tax'));
3688 3688
 
3689 3689
 			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3690 3690
 
@@ -3695,7 +3695,7 @@  discard block
 block discarded – undo
3695 3695
 
3696 3696
 		}
3697 3697
 
3698
-		$this->set_total_tax( $current );
3698
+		$this->set_total_tax($current);
3699 3699
 
3700 3700
 		return $current;
3701 3701
 
@@ -3712,20 +3712,20 @@  discard block
 block discarded – undo
3712 3712
 		$fee       = 0;
3713 3713
 		$recurring = 0;
3714 3714
 
3715
-        foreach ( $fees as $data ) {
3716
-			$fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3717
-			$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3715
+        foreach ($fees as $data) {
3716
+			$fee       += wpinv_sanitize_amount($data['initial_fee']);
3717
+			$recurring += wpinv_sanitize_amount($data['recurring_fee']);
3718 3718
 		}
3719 3719
 
3720 3720
 		$current = $this->is_renewal() ? $recurring : $fee;
3721
-		$this->set_total_fees( $current );
3721
+		$this->set_total_fees($current);
3722 3722
 
3723 3723
 		$this->totals['fee'] = array(
3724 3724
 			'initial'   => $fee,
3725 3725
 			'recurring' => $recurring,
3726 3726
 		);
3727 3727
 
3728
-        $this->set_total_fees( $fee );
3728
+        $this->set_total_fees($fee);
3729 3729
         return $current;
3730 3730
     }
3731 3731
 
@@ -3740,7 +3740,7 @@  discard block
 block discarded – undo
3740 3740
         $this->recalculate_total_discount();
3741 3741
 		$this->recalculate_total_tax();
3742 3742
 		$this->recalculate_subtotal();
3743
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3743
+		$this->set_total($this->get_total_tax('edit') + $this->get_total_fees('edit') + $this->get_subtotal('edit') - $this->get_total_discount('edit'));
3744 3744
 		return $this->get_total();
3745 3745
 	}
3746 3746
 
@@ -3749,7 +3749,7 @@  discard block
 block discarded – undo
3749 3749
 	 */
3750 3750
     public function recalculate_totals() {
3751 3751
         $this->recalculate_total();
3752
-        $this->save( true );
3752
+        $this->save(true);
3753 3753
         return $this;
3754 3754
     }
3755 3755
 
@@ -3767,8 +3767,8 @@  discard block
 block discarded – undo
3767 3767
 	 * @return int|false The new note's ID on success, false on failure.
3768 3768
      *
3769 3769
      */
3770
-    public function add_system_note( $note ) {
3771
-		return $this->add_note( $note, false, false, true );
3770
+    public function add_system_note($note) {
3771
+		return $this->add_note($note, false, false, true);
3772 3772
 	}
3773 3773
 
3774 3774
     /**
@@ -3778,10 +3778,10 @@  discard block
 block discarded – undo
3778 3778
 	 * @return int|false The new note's ID on success, false on failure.
3779 3779
      *
3780 3780
      */
3781
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3781
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3782 3782
 
3783 3783
         // Bail if no note specified or this invoice is not yet saved.
3784
-        if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) {
3784
+        if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) {
3785 3785
             return false;
3786 3786
         }
3787 3787
 
@@ -3789,23 +3789,23 @@  discard block
 block discarded – undo
3789 3789
 		$author_email = '[email protected]';
3790 3790
 
3791 3791
 		// If this is an admin comment or it has been added by the user.
3792
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3793
-			$user         = get_user_by( 'id', get_current_user_id() );
3792
+		if (is_user_logged_in() && (!$system || $added_by_user)) {
3793
+			$user = get_user_by('id', get_current_user_id());
3794 3794
             $author       = $user->display_name;
3795 3795
             $author_email = $user->user_email;
3796 3796
 		}
3797 3797
 
3798
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3798
+		return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type);
3799 3799
 
3800 3800
 	}
3801 3801
 
3802 3802
 	/**
3803 3803
      * Generates a unique key for the invoice.
3804 3804
      */
3805
-    public function generate_key( $string = '' ) {
3806
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3805
+    public function generate_key($string = '') {
3806
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3807 3807
         return strtolower(
3808
-            $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3808
+            $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3809 3809
         );
3810 3810
     }
3811 3811
 
@@ -3815,11 +3815,11 @@  discard block
 block discarded – undo
3815 3815
     public function generate_number() {
3816 3816
         $number = $this->get_id();
3817 3817
 
3818
-        if ( wpinv_sequential_number_active( $this->get_post_type() ) ) {
3819
-            $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3818
+        if (wpinv_sequential_number_active($this->get_post_type())) {
3819
+            $number = wpinv_get_next_invoice_number($this->get_post_type());
3820 3820
         }
3821 3821
 
3822
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3822
+		return wpinv_format_invoice_number($number, $this->get_post_type());
3823 3823
 
3824 3824
 	}
3825 3825
 
@@ -3832,55 +3832,55 @@  discard block
 block discarded – undo
3832 3832
 		// Reset status transition variable.
3833 3833
 		$this->status_transition = false;
3834 3834
 
3835
-		if ( $status_transition ) {
3835
+		if ($status_transition) {
3836 3836
 			try {
3837 3837
 
3838 3838
 				// Fire a hook for the status change.
3839
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3839
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition);
3840 3840
 
3841 3841
 				// @deprecated this is deprecated and will be removed in the future.
3842
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3842
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3843 3843
 
3844
-				if ( ! empty( $status_transition['from'] ) ) {
3844
+				if (!empty($status_transition['from'])) {
3845 3845
 
3846 3846
 					/* translators: 1: old invoice status 2: new invoice status */
3847
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3847
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from'], $this), wpinv_status_nicename($status_transition['to'], $this));
3848 3848
 
3849 3849
 					// Fire another hook.
3850
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3851
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3850
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this);
3851
+					do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']);
3852 3852
 
3853 3853
 					// @deprecated this is deprecated and will be removed in the future.
3854
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3854
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3855 3855
 
3856 3856
 					// Note the transition occurred.
3857
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3857
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']);
3858 3858
 
3859 3859
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3860 3860
 					if (
3861
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3862
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3861
+						in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3862
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3863 3863
 					) {
3864
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3864
+						do_action('getpaid_invoice_payment_status_changed', $this, $status_transition);
3865 3865
 					}
3866 3866
 
3867 3867
 					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3868 3868
 					if (
3869
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3870
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3869
+						in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3870
+						&& in_array($status_transition['to'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3871 3871
 					) {
3872
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3872
+						do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition);
3873 3873
 					}
3874 3874
 				} else {
3875 3875
 					/* translators: %s: new invoice status */
3876
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
3876
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this));
3877 3877
 
3878 3878
 					// Note the transition occurred.
3879
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3879
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3880 3880
 
3881 3881
 				}
3882
-			} catch ( Exception $e ) {
3883
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3882
+			} catch (Exception $e) {
3883
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
3884 3884
 			}
3885 3885
 		}
3886 3886
 	}
@@ -3888,13 +3888,13 @@  discard block
 block discarded – undo
3888 3888
 	/**
3889 3889
 	 * Updates an invoice status.
3890 3890
 	 */
3891
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3891
+	public function update_status($new_status = false, $note = '', $manual = false) {
3892 3892
 
3893 3893
 		// Fires before updating a status.
3894
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3894
+		do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit'));
3895 3895
 
3896 3896
 		// Update the status.
3897
-		$this->set_status( $new_status, $note, $manual );
3897
+		$this->set_status($new_status, $note, $manual);
3898 3898
 
3899 3899
 		// Save the order.
3900 3900
 		return $this->save();
@@ -3905,18 +3905,18 @@  discard block
 block discarded – undo
3905 3905
 	 * @deprecated
3906 3906
 	 */
3907 3907
 	public function refresh_item_ids() {
3908
-        $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
3909
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3908
+        $item_ids = implode(',', array_unique(wp_list_pluck($this->get_cart_details(), 'item_id')));
3909
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
3910 3910
 	}
3911 3911
 
3912 3912
 	/**
3913 3913
 	 * @deprecated
3914 3914
 	 */
3915
-	public function update_items( $temp = false ) {
3915
+	public function update_items($temp = false) {
3916 3916
 
3917
-		$this->set_items( $this->get_items() );
3917
+		$this->set_items($this->get_items());
3918 3918
 
3919
-		if ( ! $temp ) {
3919
+		if (!$temp) {
3920 3920
 			$this->save();
3921 3921
 		}
3922 3922
 
@@ -3930,11 +3930,11 @@  discard block
 block discarded – undo
3930 3930
 
3931 3931
         $discount_code = $this->get_discount_code();
3932 3932
 
3933
-        if ( empty( $discount_code ) ) {
3933
+        if (empty($discount_code)) {
3934 3934
             return false;
3935 3935
         }
3936 3936
 
3937
-        $discount = wpinv_get_discount_obj( $discount_code );
3937
+        $discount = wpinv_get_discount_obj($discount_code);
3938 3938
 
3939 3939
         // Ensure it is active.
3940 3940
         return $discount->exists();
@@ -3945,7 +3945,7 @@  discard block
 block discarded – undo
3945 3945
 	 * Refunds an invoice.
3946 3946
 	 */
3947 3947
     public function refund() {
3948
-		$this->set_status( 'wpi-refunded' );
3948
+		$this->set_status('wpi-refunded');
3949 3949
         $this->save();
3950 3950
 	}
3951 3951
 
@@ -3954,53 +3954,53 @@  discard block
 block discarded – undo
3954 3954
 	 *
3955 3955
 	 * @param string $transaction_id
3956 3956
 	 */
3957
-    public function mark_paid( $transaction_id = null, $note = '' ) {
3957
+    public function mark_paid($transaction_id = null, $note = '') {
3958 3958
 
3959 3959
 		// Set the transaction id.
3960
-		if ( empty( $transaction_id ) ) {
3961
-			$transaction_id = $this->generate_key( 'trans_' );
3960
+		if (empty($transaction_id)) {
3961
+			$transaction_id = $this->generate_key('trans_');
3962 3962
 		}
3963 3963
 
3964
-		if ( ! $this->get_transaction_id() ) {
3965
-			$this->set_transaction_id( $transaction_id );
3964
+		if (!$this->get_transaction_id()) {
3965
+			$this->set_transaction_id($transaction_id);
3966 3966
 		}
3967 3967
 
3968
-		if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3968
+		if ($this->is_paid() && 'wpi-processing' != $this->get_status()) {
3969 3969
 			return $this->save();
3970 3970
 		}
3971 3971
 
3972 3972
 		// Set the completed date.
3973
-		$this->set_date_completed( current_time( 'mysql' ) );
3973
+		$this->set_date_completed(current_time('mysql'));
3974 3974
 
3975 3975
 		// Set the new status.
3976
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
3977
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
3976
+		$gateway = sanitize_text_field($this->get_gateway_title());
3977
+		if ($this->is_renewal() || !$this->is_parent()) {
3978 3978
 
3979
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3980
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3979
+			$_note = wp_sprintf(__('Renewed via %s', 'invoicing'), $gateway);
3980
+			$_note = $_note . empty($note) ? '' : " ($note)";
3981 3981
 
3982
-			if ( 'none' == $this->get_gateway() ) {
3982
+			if ('none' == $this->get_gateway()) {
3983 3983
 				$_note = $note;
3984 3984
 			}
3985 3985
 
3986
-			$this->set_status( 'wpi-renewal', $_note );
3986
+			$this->set_status('wpi-renewal', $_note);
3987 3987
 
3988 3988
 		} else {
3989 3989
 
3990
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3991
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3990
+			$_note = wp_sprintf(__('Paid via %s', 'invoicing'), $gateway);
3991
+			$_note = $_note . empty($note) ? '' : " ($note)";
3992 3992
 
3993
-			if ( 'none' == $this->get_gateway() ) {
3993
+			if ('none' == $this->get_gateway()) {
3994 3994
 				$_note = $note;
3995 3995
 			}
3996 3996
 
3997
-			$this->set_status( 'publish', $_note );
3997
+			$this->set_status('publish', $_note);
3998 3998
 
3999 3999
 		}
4000 4000
 
4001 4001
 		// Set checkout mode.
4002
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4003
-		$this->set_mode( $mode );
4002
+		$mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live';
4003
+		$this->set_mode($mode);
4004 4004
 
4005 4005
 		// Save the invoice.
4006 4006
         $this->save();
@@ -4025,16 +4025,16 @@  discard block
 block discarded – undo
4025 4025
      * Clears the subscription's cache.
4026 4026
      */
4027 4027
     public function clear_cache() {
4028
-		if ( $this->get_key() ) {
4029
-			wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4028
+		if ($this->get_key()) {
4029
+			wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids');
4030 4030
 		}
4031 4031
 
4032
-		if ( $this->get_number() ) {
4033
-			wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4032
+		if ($this->get_number()) {
4033
+			wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids');
4034 4034
 		}
4035 4035
 
4036
-		if ( $this->get_transaction_id() ) {
4037
-			wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4036
+		if ($this->get_transaction_id()) {
4037
+			wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
4038 4038
 		}
4039 4039
 	}
4040 4040
 
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-bank-transfer-gateway.php 2 patches
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22
-	/**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
22
+    /**
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27
+    protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 8;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 8;
35 35
 
36 36
     /**
37
-	 * Class constructor.
38
-	 */
39
-	public function __construct() {
37
+     * Class constructor.
38
+     */
39
+    public function __construct() {
40 40
         parent::__construct();
41 41
 
42 42
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45 45
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
-		add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
-		add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
47
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
+        add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
+        add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
+        add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
53 53
 
54 54
     }
55 55
 
56 56
     /**
57
-	 * Process Payment.
58
-	 *
59
-	 * @param WPInv_Invoice $invoice Invoice.
60
-	 * @param array $submission_data Posted checkout fields.
61
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62
-	 * @return array
63
-	 */
64
-	public function process_payment( $invoice, $submission_data, $submission ) {
57
+     * Process Payment.
58
+     *
59
+     * @param WPInv_Invoice $invoice Invoice.
60
+     * @param array $submission_data Posted checkout fields.
61
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62
+     * @return array
63
+     */
64
+    public function process_payment( $invoice, $submission_data, $submission ) {
65 65
 
66 66
         // Add a transaction id.
67 67
         $invoice->set_transaction_id( $invoice->generate_key( 'bt_' ) );
@@ -82,66 +82,66 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     /**
85
-	 * Output for the order received page.
86
-	 *
87
-	 * @param WPInv_Invoice $invoice Invoice.
88
-	 */
89
-	public function thankyou_page( $invoice ) {
85
+     * Output for the order received page.
86
+     *
87
+     * @param WPInv_Invoice $invoice Invoice.
88
+     */
89
+    public function thankyou_page( $invoice ) {
90 90
 
91 91
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
92 92
 
93
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
94 94
 
95 95
             if ( ! empty( $this->instructions ) ) {
96 96
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
97
-			}
97
+            }
98 98
 
99
-			$this->bank_details( $invoice );
99
+            $this->bank_details( $invoice );
100 100
 
101
-			echo '</div>';
101
+            echo '</div>';
102 102
 
103 103
         }
104 104
 
105
-	}
105
+    }
106 106
 
107 107
     /**
108
-	 * Add content to the WPI emails.
109
-	 *
110
-	 * @param WPInv_Invoice $invoice Invoice.
111
-	 * @param string     $email_type Email format: plain text or HTML.
112
-	 * @param bool     $sent_to_admin Sent to admin.
113
-	 */
114
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
108
+     * Add content to the WPI emails.
109
+     *
110
+     * @param WPInv_Invoice $invoice Invoice.
111
+     * @param string     $email_type Email format: plain text or HTML.
112
+     * @param bool     $sent_to_admin Sent to admin.
113
+     */
114
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
115 115
 
116
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
117 117
 
118
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
119 119
 
120
-			if ( $this->instructions ) {
121
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
120
+            if ( $this->instructions ) {
121
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
122 122
             }
123 123
 
124
-			$this->bank_details( $invoice );
124
+            $this->bank_details( $invoice );
125 125
 
126
-			echo '</div>';
126
+            echo '</div>';
127 127
 
128
-		}
128
+        }
129 129
 
130 130
     }
131 131
 
132 132
     /**
133
-	 * Get bank details and place into a list format.
134
-	 *
135
-	 * @param WPInv_Invoice $invoice Invoice.
136
-	 */
137
-	protected function bank_details( $invoice ) {
133
+     * Get bank details and place into a list format.
134
+     *
135
+     * @param WPInv_Invoice $invoice Invoice.
136
+     */
137
+    protected function bank_details( $invoice ) {
138 138
 
139
-		// Get the invoice country and country $locale.
140
-		$country = $invoice->get_country();
141
-		$locale  = $this->get_country_locale();
139
+        // Get the invoice country and country $locale.
140
+        $country = $invoice->get_country();
141
+        $locale  = $this->get_country_locale();
142 142
 
143
-		// Get sortcode label in the $locale array and use appropriate one.
144
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
143
+        // Get sortcode label in the $locale array and use appropriate one.
144
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
145 145
 
146 146
         $bank_fields = array(
147 147
             'ac_name'   => __( 'Account Name', 'invoicing' ),
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 
161 161
             if ( ! empty( $value ) ) {
162 162
                 $bank_info[ $field ] = array(
163
-					'label' => $label,
164
-					'value' => $value,
165
-				);
163
+                    'label' => $label,
164
+                    'value' => $value,
165
+                );
166 166
             }
167
-		}
167
+        }
168 168
 
169 169
         $bank_info = apply_filters( 'wpinv_bank_info', $bank_info, $invoice );
170 170
 
@@ -172,139 +172,139 @@  discard block
 block discarded – undo
172 172
             return;
173 173
         }
174 174
 
175
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html( apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ), $invoice ) ) . '</h3>' . PHP_EOL;
175
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html( apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ), $invoice ) ) . '</h3>' . PHP_EOL;
176
+
177
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
178
+
179
+        foreach ( $bank_info as $key => $data ) {
180
+            echo "<tr class='getpaid-bank-transfer-" . esc_attr( $key ) . "'><th class='font-weight-bold'>" . wp_kses_post( $data['label'] ) . "</th><td class='w-75'>" . wp_kses_post( wptexturize( $data['value'] ) ) . '</td></tr>' . PHP_EOL;
181
+        }
182
+
183
+        echo '</table>';
176 184
 
177
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
185
+    }
178 186
 
179
-		foreach ( $bank_info as $key => $data ) {
180
-			echo "<tr class='getpaid-bank-transfer-" . esc_attr( $key ) . "'><th class='font-weight-bold'>" . wp_kses_post( $data['label'] ) . "</th><td class='w-75'>" . wp_kses_post( wptexturize( $data['value'] ) ) . '</td></tr>' . PHP_EOL;
181
-		}
187
+    /**
188
+     * Get country locale if localized.
189
+     *
190
+     * @return array
191
+     */
192
+    public function get_country_locale() {
193
+
194
+        if ( empty( $this->locale ) ) {
195
+
196
+            // Locale information to be used - only those that are not 'Sort Code'.
197
+            $this->locale = apply_filters(
198
+                'getpaid_get_bank_transfer_locale',
199
+                array(
200
+                    'AU' => array(
201
+                        'sortcode' => array(
202
+                            'label' => __( 'BSB', 'invoicing' ),
203
+                        ),
204
+                    ),
205
+                    'CA' => array(
206
+                        'sortcode' => array(
207
+                            'label' => __( 'Bank transit number', 'invoicing' ),
208
+                        ),
209
+                    ),
210
+                    'IN' => array(
211
+                        'sortcode' => array(
212
+                            'label' => __( 'IFSC', 'invoicing' ),
213
+                        ),
214
+                    ),
215
+                    'IT' => array(
216
+                        'sortcode' => array(
217
+                            'label' => __( 'Branch sort', 'invoicing' ),
218
+                        ),
219
+                    ),
220
+                    'NZ' => array(
221
+                        'sortcode' => array(
222
+                            'label' => __( 'Bank code', 'invoicing' ),
223
+                        ),
224
+                    ),
225
+                    'SE' => array(
226
+                        'sortcode' => array(
227
+                            'label' => __( 'Bank code', 'invoicing' ),
228
+                        ),
229
+                    ),
230
+                    'US' => array(
231
+                        'sortcode' => array(
232
+                            'label' => __( 'Routing number', 'invoicing' ),
233
+                        ),
234
+                    ),
235
+                    'ZA' => array(
236
+                        'sortcode' => array(
237
+                            'label' => __( 'Branch code', 'invoicing' ),
238
+                        ),
239
+                    ),
240
+                )
241
+            );
182 242
 
183
-		echo '</table>';
243
+        }
244
+
245
+        return $this->locale;
184 246
 
185 247
     }
186 248
 
187 249
     /**
188
-	 * Get country locale if localized.
189
-	 *
190
-	 * @return array
191
-	 */
192
-	public function get_country_locale() {
193
-
194
-		if ( empty( $this->locale ) ) {
195
-
196
-			// Locale information to be used - only those that are not 'Sort Code'.
197
-			$this->locale = apply_filters(
198
-				'getpaid_get_bank_transfer_locale',
199
-				array(
200
-					'AU' => array(
201
-						'sortcode' => array(
202
-							'label' => __( 'BSB', 'invoicing' ),
203
-						),
204
-					),
205
-					'CA' => array(
206
-						'sortcode' => array(
207
-							'label' => __( 'Bank transit number', 'invoicing' ),
208
-						),
209
-					),
210
-					'IN' => array(
211
-						'sortcode' => array(
212
-							'label' => __( 'IFSC', 'invoicing' ),
213
-						),
214
-					),
215
-					'IT' => array(
216
-						'sortcode' => array(
217
-							'label' => __( 'Branch sort', 'invoicing' ),
218
-						),
219
-					),
220
-					'NZ' => array(
221
-						'sortcode' => array(
222
-							'label' => __( 'Bank code', 'invoicing' ),
223
-						),
224
-					),
225
-					'SE' => array(
226
-						'sortcode' => array(
227
-							'label' => __( 'Bank code', 'invoicing' ),
228
-						),
229
-					),
230
-					'US' => array(
231
-						'sortcode' => array(
232
-							'label' => __( 'Routing number', 'invoicing' ),
233
-						),
234
-					),
235
-					'ZA' => array(
236
-						'sortcode' => array(
237
-							'label' => __( 'Branch code', 'invoicing' ),
238
-						),
239
-					),
240
-				)
241
-			);
242
-
243
-		}
244
-
245
-		return $this->locale;
246
-
247
-	}
248
-
249
-	/**
250
-	 * Filters the gateway settings.
251
-	 *
252
-	 * @param array $admin_settings
253
-	 */
254
-	public function admin_settings( $admin_settings ) {
250
+     * Filters the gateway settings.
251
+     *
252
+     * @param array $admin_settings
253
+     */
254
+    public function admin_settings( $admin_settings ) {
255 255
 
256 256
         $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
257
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
257
+        $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
258 258
 
259
-		$locale  = $this->get_country_locale();
259
+        $locale  = $this->get_country_locale();
260 260
 
261
-		// Get sortcode label in the $locale array and use appropriate one.
262
-		$country  = wpinv_default_billing_country();
263
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
261
+        // Get sortcode label in the $locale array and use appropriate one.
262
+        $country  = wpinv_default_billing_country();
263
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
264 264
 
265
-		$admin_settings['bank_transfer_ac_name'] = array(
265
+        $admin_settings['bank_transfer_ac_name'] = array(
266 266
             'type' => 'text',
267 267
             'id'   => 'bank_transfer_ac_name',
268 268
             'name' => __( 'Account Name', 'invoicing' ),
269
-		);
269
+        );
270 270
 
271
-		$admin_settings['bank_transfer_ac_no'] = array(
271
+        $admin_settings['bank_transfer_ac_no'] = array(
272 272
             'type' => 'text',
273 273
             'id'   => 'bank_transfer_ac_no',
274 274
             'name' => __( 'Account Number', 'invoicing' ),
275
-		);
275
+        );
276 276
 
277
-		$admin_settings['bank_transfer_bank_name'] = array(
277
+        $admin_settings['bank_transfer_bank_name'] = array(
278 278
             'type' => 'text',
279 279
             'id'   => 'bank_transfer_bank_name',
280 280
             'name' => __( 'Bank Name', 'invoicing' ),
281
-		);
281
+        );
282 282
 
283
-		$admin_settings['bank_transfer_ifsc'] = array(
283
+        $admin_settings['bank_transfer_ifsc'] = array(
284 284
             'type' => 'text',
285 285
             'id'   => 'bank_transfer_ifsc',
286 286
             'name' => __( 'IFSC Code', 'invoicing' ),
287
-		);
287
+        );
288 288
 
289
-		$admin_settings['bank_transfer_iban'] = array(
289
+        $admin_settings['bank_transfer_iban'] = array(
290 290
             'type' => 'text',
291 291
             'id'   => 'bank_transfer_iban',
292 292
             'name' => __( 'IBAN', 'invoicing' ),
293
-		);
293
+        );
294 294
 
295
-		$admin_settings['bank_transfer_bic'] = array(
295
+        $admin_settings['bank_transfer_bic'] = array(
296 296
             'type' => 'text',
297 297
             'id'   => 'bank_transfer_bic',
298 298
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
299
-		);
299
+        );
300 300
 
301
-		$admin_settings['bank_transfer_sort_code'] = array(
302
-			'type' => 'text',
303
-			'id'   => 'bank_transfer_sort_code',
304
-			'name' => $sortcode,
305
-		);
301
+        $admin_settings['bank_transfer_sort_code'] = array(
302
+            'type' => 'text',
303
+            'id'   => 'bank_transfer_sort_code',
304
+            'name' => $sortcode,
305
+        );
306 306
 
307
-		$admin_settings['bank_transfer_info'] = array(
307
+        $admin_settings['bank_transfer_info'] = array(
308 308
             'id'   => 'bank_transfer_info',
309 309
             'name' => __( 'Instructions', 'invoicing' ),
310 310
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -314,17 +314,17 @@  discard block
 block discarded – undo
314 314
             'rows' => 5,
315 315
         );
316 316
 
317
-		return $admin_settings;
318
-	}
317
+        return $admin_settings;
318
+    }
319 319
 
320
-	/**
321
-	 * Processes invoice addons.
322
-	 *
323
-	 * @param WPInv_Invoice $invoice
324
-	 * @param GetPaid_Form_Item[] $items
325
-	 * @return WPInv_Invoice
326
-	 */
327
-	public function process_addons( $invoice, $items ) {
320
+    /**
321
+     * Processes invoice addons.
322
+     *
323
+     * @param WPInv_Invoice $invoice
324
+     * @param GetPaid_Form_Item[] $items
325
+     * @return WPInv_Invoice
326
+     */
327
+    public function process_addons( $invoice, $items ) {
328 328
 
329 329
         foreach ( $items as $item ) {
330 330
             $invoice->add_item( $item );
@@ -332,66 +332,66 @@  discard block
 block discarded – undo
332 332
 
333 333
         $invoice->recalculate_total();
334 334
         $invoice->save();
335
-	}
335
+    }
336 336
 
337
-	/**
338
-	 * (Maybe) renews a bank transfer subscription profile.
339
-	 *
340
-	 *
337
+    /**
338
+     * (Maybe) renews a bank transfer subscription profile.
339
+     *
340
+     *
341 341
      * @param WPInv_Subscription $subscription
342
-	 */
343
-	public function maybe_renew_subscription( $subscription ) {
342
+     */
343
+    public function maybe_renew_subscription( $subscription ) {
344 344
 
345 345
         // Ensure its our subscription && it's active.
346 346
         if ( $this->id === $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) {
347
-			$subscription->create_payment();
347
+            $subscription->create_payment();
348 348
         }
349 349
 
350 350
     }
351 351
 
352
-	/**
353
-	 * Process a bank transfer payment.
354
-	 *
355
-	 *
352
+    /**
353
+     * Process a bank transfer payment.
354
+     *
355
+     *
356 356
      * @param WPInv_Invoice $invoice
357
-	 */
358
-	public function invoice_paid( $invoice ) {
359
-
360
-		// Abort if not paid by bank transfer.
361
-		if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
362
-			return;
363
-		}
364
-
365
-		// Is it a parent payment?
366
-		if ( 0 == $invoice->get_parent_id() ) {
367
-
368
-			// (Maybe) activate subscriptions.
369
-			$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
370
-
371
-			if ( ! empty( $subscriptions ) ) {
372
-				$subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
373
-
374
-				foreach ( $subscriptions as $subscription ) {
375
-					if ( $subscription->exists() ) {
376
-						$duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
377
-						$expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
378
-
379
-						$subscription->set_next_renewal_date( $expiry );
380
-						$subscription->set_date_created( current_time( 'mysql' ) );
381
-						$subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
382
-						$subscription->activate();
383
-					}
384
-				}
357
+     */
358
+    public function invoice_paid( $invoice ) {
359
+
360
+        // Abort if not paid by bank transfer.
361
+        if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
362
+            return;
363
+        }
364
+
365
+        // Is it a parent payment?
366
+        if ( 0 == $invoice->get_parent_id() ) {
367
+
368
+            // (Maybe) activate subscriptions.
369
+            $subscriptions = getpaid_get_invoice_subscriptions( $invoice );
370
+
371
+            if ( ! empty( $subscriptions ) ) {
372
+                $subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
373
+
374
+                foreach ( $subscriptions as $subscription ) {
375
+                    if ( $subscription->exists() ) {
376
+                        $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
377
+                        $expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
378
+
379
+                        $subscription->set_next_renewal_date( $expiry );
380
+                        $subscription->set_date_created( current_time( 'mysql' ) );
381
+                        $subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
382
+                        $subscription->activate();
383
+                    }
384
+                }
385 385
 }
386 386
 } else {
387 387
 
388
-			$subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
388
+            $subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
389 389
 
390
-			// Renew the subscription.
391
-			if ( $subscription && $subscription->exists() ) {
392
-				$subscription->add_payment( array(), $invoice );
393
-				$subscription->renew( strtotime( $invoice->get_date_created() ) );
394
-					}
390
+            // Renew the subscription.
391
+            if ( $subscription && $subscription->exists() ) {
392
+                $subscription->add_payment( array(), $invoice );
393
+                $subscription->renew( strtotime( $invoice->get_date_created() ) );
394
+                    }
395 395
 }
396 396
 
397 397
     }
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Bank transfer Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-	protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
27
+	protected $supports = array('subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
 	public function __construct() {
40 40
         parent::__construct();
41 41
 
42
-        $this->title                = __( 'Direct bank transfer', 'invoicing' );
43
-        $this->method_title         = __( 'Bank transfer', 'invoicing' );
44
-        $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45
-        $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
42
+        $this->title                = __('Direct bank transfer', 'invoicing');
43
+        $this->method_title         = __('Bank transfer', 'invoicing');
44
+        $this->checkout_button_text = __('Proceed', 'invoicing');
45
+        $this->instructions         = apply_filters('wpinv_bank_instructions', $this->get_option('info'));
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
-		add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
-		add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
47
+		add_action('wpinv_receipt_end', array($this, 'thankyou_page'));
48
+		add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40);
49
+		add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11);
50
+		add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3);
51
+		add_action('getpaid_should_renew_subscription', array($this, 'maybe_renew_subscription'));
52
+		add_action('getpaid_invoice_status_publish', array($this, 'invoice_paid'), 20);
53 53
 
54 54
     }
55 55
 
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
61 61
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62 62
 	 * @return array
63 63
 	 */
64
-	public function process_payment( $invoice, $submission_data, $submission ) {
64
+	public function process_payment($invoice, $submission_data, $submission) {
65 65
 
66 66
         // Add a transaction id.
67
-        $invoice->set_transaction_id( $invoice->generate_key( 'bt_' ) );
67
+        $invoice->set_transaction_id($invoice->generate_key('bt_'));
68 68
 
69 69
         // Set it as pending payment.
70
-        if ( ! $invoice->needs_payment() ) {
70
+        if (!$invoice->needs_payment()) {
71 71
             $invoice->mark_paid();
72
-        } elseif ( ! $invoice->is_paid() ) {
73
-            $invoice->set_status( 'wpi-onhold' );
72
+        } elseif (!$invoice->is_paid()) {
73
+            $invoice->set_status('wpi-onhold');
74 74
         }
75 75
 
76 76
         // Save it.
77 77
         $invoice->save();
78 78
 
79 79
         // Send to the success page.
80
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
80
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
81 81
 
82 82
     }
83 83
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param WPInv_Invoice $invoice Invoice.
88 88
 	 */
89
-	public function thankyou_page( $invoice ) {
89
+	public function thankyou_page($invoice) {
90 90
 
91
-        if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
91
+        if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
92 92
 
93 93
 			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
94 94
 
95
-            if ( ! empty( $this->instructions ) ) {
96
-                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
95
+            if (!empty($this->instructions)) {
96
+                echo wp_kses_post(wpautop(wptexturize($this->instructions)));
97 97
 			}
98 98
 
99
-			$this->bank_details( $invoice );
99
+			$this->bank_details($invoice);
100 100
 
101 101
 			echo '</div>';
102 102
 
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
 	 * @param string     $email_type Email format: plain text or HTML.
112 112
 	 * @param bool     $sent_to_admin Sent to admin.
113 113
 	 */
114
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
114
+	public function email_instructions($invoice, $email_type, $sent_to_admin) {
115 115
 
116
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116
+		if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
117 117
 
118 118
 			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
119 119
 
120
-			if ( $this->instructions ) {
121
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
120
+			if ($this->instructions) {
121
+				echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL);
122 122
             }
123 123
 
124
-			$this->bank_details( $invoice );
124
+			$this->bank_details($invoice);
125 125
 
126 126
 			echo '</div>';
127 127
 
@@ -134,50 +134,50 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @param WPInv_Invoice $invoice Invoice.
136 136
 	 */
137
-	protected function bank_details( $invoice ) {
137
+	protected function bank_details($invoice) {
138 138
 
139 139
 		// Get the invoice country and country $locale.
140 140
 		$country = $invoice->get_country();
141 141
 		$locale  = $this->get_country_locale();
142 142
 
143 143
 		// Get sortcode label in the $locale array and use appropriate one.
144
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
144
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
145 145
 
146 146
         $bank_fields = array(
147
-            'ac_name'   => __( 'Account Name', 'invoicing' ),
148
-            'ac_no'     => __( 'Account Number', 'invoicing' ),
149
-            'bank_name' => __( 'Bank Name', 'invoicing' ),
150
-            'ifsc'      => __( 'IFSC code', 'invoicing' ),
151
-            'iban'      => __( 'IBAN', 'invoicing' ),
152
-            'bic'       => __( 'BIC/Swift code', 'invoicing' ),
147
+            'ac_name'   => __('Account Name', 'invoicing'),
148
+            'ac_no'     => __('Account Number', 'invoicing'),
149
+            'bank_name' => __('Bank Name', 'invoicing'),
150
+            'ifsc'      => __('IFSC code', 'invoicing'),
151
+            'iban'      => __('IBAN', 'invoicing'),
152
+            'bic'       => __('BIC/Swift code', 'invoicing'),
153 153
             'sort_code' => $sortcode,
154 154
         );
155 155
 
156 156
         $bank_info = array();
157 157
 
158
-        foreach ( $bank_fields as $field => $label ) {
159
-            $value = $this->get_option( $field );
158
+        foreach ($bank_fields as $field => $label) {
159
+            $value = $this->get_option($field);
160 160
 
161
-            if ( ! empty( $value ) ) {
162
-                $bank_info[ $field ] = array(
161
+            if (!empty($value)) {
162
+                $bank_info[$field] = array(
163 163
 					'label' => $label,
164 164
 					'value' => $value,
165 165
 				);
166 166
             }
167 167
 		}
168 168
 
169
-        $bank_info = apply_filters( 'wpinv_bank_info', $bank_info, $invoice );
169
+        $bank_info = apply_filters('wpinv_bank_info', $bank_info, $invoice);
170 170
 
171
-        if ( empty( $bank_info ) ) {
171
+        if (empty($bank_info)) {
172 172
             return;
173 173
         }
174 174
 
175
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html( apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ), $invoice ) ) . '</h3>' . PHP_EOL;
175
+		echo '<h3 class="getpaid-bank-transfer-title"> ' . esc_html(apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing'), $invoice)) . '</h3>' . PHP_EOL;
176 176
 
177 177
 		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
178 178
 
179
-		foreach ( $bank_info as $key => $data ) {
180
-			echo "<tr class='getpaid-bank-transfer-" . esc_attr( $key ) . "'><th class='font-weight-bold'>" . wp_kses_post( $data['label'] ) . "</th><td class='w-75'>" . wp_kses_post( wptexturize( $data['value'] ) ) . '</td></tr>' . PHP_EOL;
179
+		foreach ($bank_info as $key => $data) {
180
+			echo "<tr class='getpaid-bank-transfer-" . esc_attr($key) . "'><th class='font-weight-bold'>" . wp_kses_post($data['label']) . "</th><td class='w-75'>" . wp_kses_post(wptexturize($data['value'])) . '</td></tr>' . PHP_EOL;
181 181
 		}
182 182
 
183 183
 		echo '</table>';
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function get_country_locale() {
193 193
 
194
-		if ( empty( $this->locale ) ) {
194
+		if (empty($this->locale)) {
195 195
 
196 196
 			// Locale information to be used - only those that are not 'Sort Code'.
197 197
 			$this->locale = apply_filters(
@@ -199,42 +199,42 @@  discard block
 block discarded – undo
199 199
 				array(
200 200
 					'AU' => array(
201 201
 						'sortcode' => array(
202
-							'label' => __( 'BSB', 'invoicing' ),
202
+							'label' => __('BSB', 'invoicing'),
203 203
 						),
204 204
 					),
205 205
 					'CA' => array(
206 206
 						'sortcode' => array(
207
-							'label' => __( 'Bank transit number', 'invoicing' ),
207
+							'label' => __('Bank transit number', 'invoicing'),
208 208
 						),
209 209
 					),
210 210
 					'IN' => array(
211 211
 						'sortcode' => array(
212
-							'label' => __( 'IFSC', 'invoicing' ),
212
+							'label' => __('IFSC', 'invoicing'),
213 213
 						),
214 214
 					),
215 215
 					'IT' => array(
216 216
 						'sortcode' => array(
217
-							'label' => __( 'Branch sort', 'invoicing' ),
217
+							'label' => __('Branch sort', 'invoicing'),
218 218
 						),
219 219
 					),
220 220
 					'NZ' => array(
221 221
 						'sortcode' => array(
222
-							'label' => __( 'Bank code', 'invoicing' ),
222
+							'label' => __('Bank code', 'invoicing'),
223 223
 						),
224 224
 					),
225 225
 					'SE' => array(
226 226
 						'sortcode' => array(
227
-							'label' => __( 'Bank code', 'invoicing' ),
227
+							'label' => __('Bank code', 'invoicing'),
228 228
 						),
229 229
 					),
230 230
 					'US' => array(
231 231
 						'sortcode' => array(
232
-							'label' => __( 'Routing number', 'invoicing' ),
232
+							'label' => __('Routing number', 'invoicing'),
233 233
 						),
234 234
 					),
235 235
 					'ZA' => array(
236 236
 						'sortcode' => array(
237
-							'label' => __( 'Branch code', 'invoicing' ),
237
+							'label' => __('Branch code', 'invoicing'),
238 238
 						),
239 239
 					),
240 240
 				)
@@ -251,51 +251,51 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param array $admin_settings
253 253
 	 */
254
-	public function admin_settings( $admin_settings ) {
254
+	public function admin_settings($admin_settings) {
255 255
 
256
-        $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
257
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
256
+        $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing');
257
+		$admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing');
258 258
 
259
-		$locale  = $this->get_country_locale();
259
+		$locale = $this->get_country_locale();
260 260
 
261 261
 		// Get sortcode label in the $locale array and use appropriate one.
262 262
 		$country  = wpinv_default_billing_country();
263
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
263
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
264 264
 
265 265
 		$admin_settings['bank_transfer_ac_name'] = array(
266 266
             'type' => 'text',
267 267
             'id'   => 'bank_transfer_ac_name',
268
-            'name' => __( 'Account Name', 'invoicing' ),
268
+            'name' => __('Account Name', 'invoicing'),
269 269
 		);
270 270
 
271 271
 		$admin_settings['bank_transfer_ac_no'] = array(
272 272
             'type' => 'text',
273 273
             'id'   => 'bank_transfer_ac_no',
274
-            'name' => __( 'Account Number', 'invoicing' ),
274
+            'name' => __('Account Number', 'invoicing'),
275 275
 		);
276 276
 
277 277
 		$admin_settings['bank_transfer_bank_name'] = array(
278 278
             'type' => 'text',
279 279
             'id'   => 'bank_transfer_bank_name',
280
-            'name' => __( 'Bank Name', 'invoicing' ),
280
+            'name' => __('Bank Name', 'invoicing'),
281 281
 		);
282 282
 
283 283
 		$admin_settings['bank_transfer_ifsc'] = array(
284 284
             'type' => 'text',
285 285
             'id'   => 'bank_transfer_ifsc',
286
-            'name' => __( 'IFSC Code', 'invoicing' ),
286
+            'name' => __('IFSC Code', 'invoicing'),
287 287
 		);
288 288
 
289 289
 		$admin_settings['bank_transfer_iban'] = array(
290 290
             'type' => 'text',
291 291
             'id'   => 'bank_transfer_iban',
292
-            'name' => __( 'IBAN', 'invoicing' ),
292
+            'name' => __('IBAN', 'invoicing'),
293 293
 		);
294 294
 
295 295
 		$admin_settings['bank_transfer_bic'] = array(
296 296
             'type' => 'text',
297 297
             'id'   => 'bank_transfer_bic',
298
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
298
+            'name' => __('BIC/Swift Code', 'invoicing'),
299 299
 		);
300 300
 
301 301
 		$admin_settings['bank_transfer_sort_code'] = array(
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 
307 307
 		$admin_settings['bank_transfer_info'] = array(
308 308
             'id'   => 'bank_transfer_info',
309
-            'name' => __( 'Instructions', 'invoicing' ),
310
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
309
+            'name' => __('Instructions', 'invoicing'),
310
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
311 311
             'type' => 'textarea',
312
-            'std'  => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ),
312
+            'std'  => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'),
313 313
             'cols' => 50,
314 314
             'rows' => 5,
315 315
         );
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 * @param GetPaid_Form_Item[] $items
325 325
 	 * @return WPInv_Invoice
326 326
 	 */
327
-	public function process_addons( $invoice, $items ) {
327
+	public function process_addons($invoice, $items) {
328 328
 
329
-        foreach ( $items as $item ) {
330
-            $invoice->add_item( $item );
329
+        foreach ($items as $item) {
330
+            $invoice->add_item($item);
331 331
         }
332 332
 
333 333
         $invoice->recalculate_total();
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
      * @param WPInv_Subscription $subscription
342 342
 	 */
343
-	public function maybe_renew_subscription( $subscription ) {
343
+	public function maybe_renew_subscription($subscription) {
344 344
 
345 345
         // Ensure its our subscription && it's active.
346
-        if ( $this->id === $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) {
346
+        if ($this->id === $subscription->get_gateway() && $subscription->has_status('active trialling')) {
347 347
 			$subscription->create_payment();
348 348
         }
349 349
 
@@ -355,42 +355,42 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
      * @param WPInv_Invoice $invoice
357 357
 	 */
358
-	public function invoice_paid( $invoice ) {
358
+	public function invoice_paid($invoice) {
359 359
 
360 360
 		// Abort if not paid by bank transfer.
361
-		if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
361
+		if ($this->id !== $invoice->get_gateway() || !$invoice->is_recurring()) {
362 362
 			return;
363 363
 		}
364 364
 
365 365
 		// Is it a parent payment?
366
-		if ( 0 == $invoice->get_parent_id() ) {
366
+		if (0 == $invoice->get_parent_id()) {
367 367
 
368 368
 			// (Maybe) activate subscriptions.
369
-			$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
369
+			$subscriptions = getpaid_get_invoice_subscriptions($invoice);
370 370
 
371
-			if ( ! empty( $subscriptions ) ) {
372
-				$subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
371
+			if (!empty($subscriptions)) {
372
+				$subscriptions = is_array($subscriptions) ? $subscriptions : array($subscriptions);
373 373
 
374
-				foreach ( $subscriptions as $subscription ) {
375
-					if ( $subscription->exists() ) {
376
-						$duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
377
-						$expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
374
+				foreach ($subscriptions as $subscription) {
375
+					if ($subscription->exists()) {
376
+						$duration = strtotime($subscription->get_expiration()) - strtotime($subscription->get_date_created());
377
+						$expiry   = date('Y-m-d H:i:s', (current_time('timestamp') + $duration));
378 378
 
379
-						$subscription->set_next_renewal_date( $expiry );
380
-						$subscription->set_date_created( current_time( 'mysql' ) );
381
-						$subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
379
+						$subscription->set_next_renewal_date($expiry);
380
+						$subscription->set_date_created(current_time('mysql'));
381
+						$subscription->set_profile_id('bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id());
382 382
 						$subscription->activate();
383 383
 					}
384 384
 				}
385 385
 }
386 386
 } else {
387 387
 
388
-			$subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
388
+			$subscription = getpaid_get_subscription($invoice->get_subscription_id());
389 389
 
390 390
 			// Renew the subscription.
391
-			if ( $subscription && $subscription->exists() ) {
392
-				$subscription->add_payment( array(), $invoice );
393
-				$subscription->renew( strtotime( $invoice->get_date_created() ) );
391
+			if ($subscription && $subscription->exists()) {
392
+				$subscription->add_payment(array(), $invoice);
393
+				$subscription->renew(strtotime($invoice->get_date_created()));
394 394
 					}
395 395
 }
396 396
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-payment-form.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( ! defined( 'WPINC' ) ) {
3
+if (!defined('WPINC')) {
4 4
     exit;
5 5
 }
6 6
 
@@ -11,23 +11,23 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param WP_Post $post
13 13
      */
14
-    public static function output_details( $post ) {
15
-        $details = get_post_meta( $post->ID, 'payment_form_data', true );
14
+    public static function output_details($post) {
15
+        $details = get_post_meta($post->ID, 'payment_form_data', true);
16 16
 
17
-        if ( ! is_array( $details ) ) {
17
+        if (!is_array($details)) {
18 18
             return;
19 19
         }
20 20
 
21 21
         echo '<div class="bsui"> <div class="form-row row">';
22 22
 
23
-        foreach ( $details as $key => $value ) {
24
-            $key = esc_html( $key );
23
+        foreach ($details as $key => $value) {
24
+            $key = esc_html($key);
25 25
 
26
-            if ( is_array( $value ) ) {
27
-                $value = implode( ',', $value );
26
+            if (is_array($value)) {
27
+                $value = implode(',', $value);
28 28
             }
29 29
 
30
-            echo wp_kses_post( "<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group mb-3'>$value</div>" );
30
+            echo wp_kses_post("<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group mb-3'>$value</div>");
31 31
         }
32 32
 
33 33
         echo '</div></div>';
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @param WP_Post $post
41 41
      */
42
-    public static function output_shortcode( $post ) {
42
+    public static function output_shortcode($post) {
43 43
 
44
-        if ( ! is_numeric( $post ) ) {
44
+        if (!is_numeric($post)) {
45 45
             $post = $post->ID;
46 46
         }
47 47
 
48
-        if ( $post == wpinv_get_default_payment_form() ) {
48
+        if ($post == wpinv_get_default_payment_form()) {
49 49
             echo '&mdash;';
50 50
             return;
51 51
         }
52 52
 
53
-        echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint( $post ) . "]' disabled>";
53
+        echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint($post) . "]' disabled>";
54 54
 
55 55
     }
56 56
 
Please login to merge, or discard this patch.
templates/payment-forms/elements/address-fields.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -12,75 +12,75 @@  discard block
 block discarded – undo
12 12
  * @var GetPaid_Payment_Form $form
13 13
  */
14 14
 
15
-defined( 'ABSPATH' ) || exit;
15
+defined('ABSPATH') || exit;
16 16
 
17
-$field_type = sanitize_key( $field_type );
17
+$field_type = sanitize_key($field_type);
18 18
 
19
-echo "<div class='row " . esc_attr( $field_type ) . "'>";
19
+echo "<div class='row " . esc_attr($field_type) . "'>";
20 20
 
21 21
 // Prepare current user.
22
-if ( ! empty( $form->invoice ) ) {
22
+if (!empty($form->invoice)) {
23 23
     $user_id = $form->invoice->get_user_id();
24 24
 }
25 25
 
26
-if ( empty( $user_id ) && is_user_logged_in() ) {
26
+if (empty($user_id) && is_user_logged_in()) {
27 27
     $user_id = get_current_user_id();
28 28
 }
29 29
 
30
-if ( ! empty( $user_id ) ) {
31
-    $user  = wp_get_current_user();
30
+if (!empty($user_id)) {
31
+    $user = wp_get_current_user();
32 32
 }
33 33
 
34
-foreach ( $fields as $address_field ) {
34
+foreach ($fields as $address_field) {
35 35
 
36 36
     // Skip if it is hidden.
37
-    if ( empty( $address_field['visible'] ) ) {
37
+    if (empty($address_field['visible'])) {
38 38
         continue;
39 39
     }
40 40
 
41
-    do_action( 'getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field );
41
+    do_action('getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field);
42 42
 
43 43
     // Prepare variables.
44 44
     $field_name  = $address_field['name'];
45 45
     $field_name  = "{$field_type}[$field_name]";
46
-    $wrap_class  = getpaid_get_form_element_grid_class( $address_field );
47
-    $wrap_class  = esc_attr( "$wrap_class getpaid-address-field-wrapper" );
48
-    $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] );
49
-    $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] );
50
-    $value       = ! empty( $user_id ) ? get_user_meta( $user_id, '_' . $address_field['name'], true ) : '';
51
-    $label       = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] );
52
-
53
-    $method_name = 'get_' . str_replace( 'wpinv_', '', $address_field['name'] );
54
-    if ( ! empty( $form->invoice ) && is_callable( array( $form->invoice, $method_name ) ) ) {
55
-        $value = call_user_func( array( $form->invoice, $method_name ) );
46
+    $wrap_class  = getpaid_get_form_element_grid_class($address_field);
47
+    $wrap_class  = esc_attr("$wrap_class getpaid-address-field-wrapper");
48
+    $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']);
49
+    $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']);
50
+    $value       = !empty($user_id) ? get_user_meta($user_id, '_' . $address_field['name'], true) : '';
51
+    $label       = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']);
52
+
53
+    $method_name = 'get_' . str_replace('wpinv_', '', $address_field['name']);
54
+    if (!empty($form->invoice) && is_callable(array($form->invoice, $method_name))) {
55
+        $value = call_user_func(array($form->invoice, $method_name));
56 56
     }
57 57
 
58
-    if ( empty( $value ) && 'wpinv_first_name' == $address_field['name'] && ! empty( $user ) ) {
58
+    if (empty($value) && 'wpinv_first_name' == $address_field['name'] && !empty($user)) {
59 59
         $value = $user->first_name;
60 60
     }
61 61
 
62
-    if ( empty( $value ) && 'wpinv_last_name' == $address_field['name'] && ! empty( $user ) ) {
62
+    if (empty($value) && 'wpinv_last_name' == $address_field['name'] && !empty($user)) {
63 63
         $value = $user->last_name;
64 64
     }
65 65
 
66
-    if ( ! empty( $address_field['required'] ) ) {
66
+    if (!empty($address_field['required'])) {
67 67
         $label .= "<span class='text-danger'> *</span>";
68 68
     }
69 69
 
70 70
     // Display the country.
71
-    if ( 'wpinv_country' == $address_field['name'] ) {
71
+    if ('wpinv_country' == $address_field['name']) {
72 72
 
73
-        echo "<div class='form-group mb-3 " . esc_attr( $wrap_class ) . " getpaid-address-field-wrapper__country'";
73
+        echo "<div class='form-group mb-3 " . esc_attr($wrap_class) . " getpaid-address-field-wrapper__country'";
74 74
 
75 75
         aui()->select(
76 76
             array(
77 77
                 'options'          => wpinv_get_country_list(),
78
-                'name'             => esc_attr( $field_name ),
79
-                'id'               => sanitize_html_class( $field_name ) . $uniqid,
80
-                'value'            => esc_attr( $country ),
78
+                'name'             => esc_attr($field_name),
79
+                'id'               => sanitize_html_class($field_name) . $uniqid,
80
+                'value'            => esc_attr($country),
81 81
                 'placeholder'      => $placeholder,
82
-                'required'         => ! empty( $address_field['required'] ),
83
-                'label'            => wp_kses_post( $label ),
82
+                'required'         => !empty($address_field['required']),
83
+                'label'            => wp_kses_post($label),
84 84
                 'label_type'       => 'vertical',
85 85
                 'help_text'        => $description,
86 86
                 'class'            => 'getpaid-address-field wpinv_country',
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             true
95 95
         );
96 96
 
97
-        if ( wpinv_should_validate_vat_number() ) {
97
+        if (wpinv_should_validate_vat_number()) {
98 98
 
99 99
             aui()->input(
100 100
                 array(
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     'id'         => "shipping-toggle$uniqid",
104 104
                     'wrap_class' => 'getpaid-address-field-wrapper__address-confirm mt-1 d-none',
105 105
                     'required'   => false,
106
-                    'label'      => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>",
106
+                    'label'      => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>",
107 107
                     'value'      => 1,
108 108
                     'checked'    => true,
109 109
                     'class'      => 'w-auto',
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
     }
119 119
 
120 120
     // Display the state.
121
-    elseif ( 'wpinv_state' == $address_field['name'] ) {
121
+    elseif ('wpinv_state' == $address_field['name']) {
122 122
 
123
-        if ( empty( $value ) ) {
123
+        if (empty($value)) {
124 124
             $value = wpinv_get_default_state();
125 125
         }
126 126
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $placeholder,
131 131
             $label,
132 132
             $description,
133
-            ! empty( $address_field['required'] ),
133
+            !empty($address_field['required']),
134 134
             $wrap_class,
135 135
             $field_name,
136 136
             true
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 
139 139
     } else {
140 140
 
141
-        $key      = str_replace( 'wpinv_', '', $address_field['name'] );
142
-        $key      = esc_attr( str_replace( '_', '-', $key ) );
141
+        $key      = str_replace('wpinv_', '', $address_field['name']);
142
+        $key      = esc_attr(str_replace('_', '-', $key));
143 143
         $autocomplete = '';
144 144
         $replacements = array(
145 145
             'zip'        => 'postal-code',
@@ -152,37 +152,37 @@  discard block
 block discarded – undo
152 152
         );
153 153
 
154 154
 
155
-        if ( isset( $replacements[ $key ] ) ) {
155
+        if (isset($replacements[$key])) {
156 156
             $autocomplete = array(
157
-                'autocomplete' => "$field_type {$replacements[ $key ]}",
157
+                'autocomplete' => "$field_type {$replacements[$key]}",
158 158
             );
159 159
         }
160 160
 
161 161
         $append = '';
162 162
 
163
-        if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) {
164
-            $valid    = esc_attr__( 'Valid', 'invoicing' );
165
-            $invalid  = esc_attr__( 'Invalid', 'invoicing' );
166
-            $validate = esc_attr__( 'Validate', 'invoicing' );
163
+        if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) {
164
+            $valid    = esc_attr__('Valid', 'invoicing');
165
+            $invalid  = esc_attr__('Invalid', 'invoicing');
166
+            $validate = esc_attr__('Validate', 'invoicing');
167 167
             $append   = "<span class='btn btn-primary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>";
168 168
         }
169 169
 
170
-        if ( 'billing' === $field_type ) {
171
-            $description .= '<div class="getpaid-error-' . esc_attr( $field_name ) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>';
170
+        if ('billing' === $field_type) {
171
+            $description .= '<div class="getpaid-error-' . esc_attr($field_name) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>';
172 172
         }
173 173
 
174 174
         aui()->input(
175 175
             array(
176
-                'name'              => esc_attr( $field_name ),
177
-                'id'                => sanitize_html_class( $field_name ) . $uniqid,
178
-                'required'          => ! empty( $address_field['required'] ),
176
+                'name'              => esc_attr($field_name),
177
+                'id'                => sanitize_html_class($field_name) . $uniqid,
178
+                'required'          => !empty($address_field['required']),
179 179
                 'placeholder'       => $placeholder,
180
-                'label'             => wp_kses_post( $label ),
180
+                'label'             => wp_kses_post($label),
181 181
                 'label_type'        => 'vertical',
182 182
                 'help_text'         => $description,
183 183
                 'type'              => 'text',
184
-                'value'             => esc_attr( $value ),
185
-                'class'             => 'getpaid-address-field ' . esc_attr( $address_field['name'] ),
184
+                'value'             => esc_attr($value),
185
+                'class'             => 'getpaid-address-field ' . esc_attr($address_field['name']),
186 186
                 'wrap_class'        => "$wrap_class getpaid-address-field-wrapper__$key",
187 187
                 'label_class'       => 'getpaid-address-field-label getpaid-address-field-label__' . $key,
188 188
                 'extra_attributes'  => $autocomplete,
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
     }
195 195
 
196
-    do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field );
196
+    do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field);
197 197
 }
198 198
 
199 199
 echo '</div>';
Please login to merge, or discard this patch.
templates/payment-forms/elements/ip_address.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-if ( empty( $text ) ) {
13
-    $text = __( 'Your IP address is:', 'invoicing' );
12
+if (empty($text)) {
13
+    $text = __('Your IP address is:', 'invoicing');
14 14
 }
15 15
 
16 16
 ?>
17 17
 <div class="form-group mb-3 getpaid-ip-info">
18
-    <span><?php echo wp_kses_post( $text ); ?></span>
19
-    <strong><?php echo esc_html( wpinv_get_ip() ); ?></strong>
18
+    <span><?php echo wp_kses_post($text); ?></span>
19
+    <strong><?php echo esc_html(wpinv_get_ip()); ?></strong>
20 20
 </div>
Please login to merge, or discard this patch.
templates/payment-forms/elements/discount.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@  discard block
 block discarded – undo
8 8
  * @var GetPaid_Payment_Form $form The current payment form
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13
-if ( ! getpaid_has_published_discount() ) {
13
+if (!getpaid_has_published_discount()) {
14 14
     return;
15 15
 }
16 16
 
17
-if ( ! empty( $description ) ) {
17
+if (!empty($description)) {
18 18
     $description = "<small class='form-text text-muted'>$description</small>";
19 19
 } else {
20 20
     $description = '';
21 21
 }
22 22
 
23 23
 $discount_code = '';
24
-if ( ! empty( $form->invoice ) ) {
24
+if (!empty($form->invoice)) {
25 25
     $discount_code = $form->invoice->get_discount_code();
26 26
 }
27 27
 
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 <div class="form-group mb-3">
31 31
     <div class="getpaid-discount-field  border rounded p-3">
32 32
         <div class="getpaid-discount-field-inner d-flex flex-column flex-md-row">
33
-            <input name="discount" placeholder="<?php echo esc_attr( $input_label ); ?>" value="<?php echo esc_attr( $discount_code ); ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text">
34
-            <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo esc_html( $button_label ); ?></a>
33
+            <input name="discount" placeholder="<?php echo esc_attr($input_label); ?>" value="<?php echo esc_attr($discount_code); ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text">
34
+            <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo esc_html($button_label); ?></a>
35 35
         </div>
36
-        <?php echo wp_kses_post( $description ); ?>
36
+        <?php echo wp_kses_post($description); ?>
37 37
         <div class="getpaid-custom-payment-form-errors alert alert-danger d-none"></div>
38
-        <div class="getpaid-custom-payment-form-success alert alert-success d-none"><?php esc_html_e( 'Discount code applied!', 'invoicing' ); ?></div>
38
+        <div class="getpaid-custom-payment-form-success alert alert-success d-none"><?php esc_html_e('Discount code applied!', 'invoicing'); ?></div>
39 39
     </div>
40 40
 </div>
41 41
 
Please login to merge, or discard this patch.